Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding failing test case for source synchronous signals #3038

Merged
merged 4 commits into from Jul 7, 2021

Conversation

dpetrisko
Copy link
Contributor

Source-synchronous structs are a common construct. With complex code, Verilator does not detect the clock signal in the struct as a clock. Trying to fix this with a clocker pragma results in the following error, exposed by this test case:

======================================================================
vlt/t_source_sync: ==================================================
        perl /home/dpetrisko/scratch/verilator/test_regress/../bin/verilator --prefix Vt_source_sync ../obj_vlt/t_source_sync/Vt_source_sync__main.cpp --exe --make gmake --x-assign unique -cc -Mdir obj_vlt/t_source_sync -OD --debug-check --comp-limit-members 10 --clk clk  -f input.vc +define+TEST_OBJ_DIR=obj_vlt/t_source_sync t/t_source_sync.v    > obj_vlt/t_source_sync/vlt_compile.log
%Error: t/t_source_sync.v:20:14: syntax error, unexpected /*verilator clocker*/, expecting ',' or ';'
   20 |    logic clk /*verilator clocker*/ ;
      |              ^~~~~~~~~~~~~~~~~~~~~
%Error: t/t_source_sync.v:22:1: syntax error, unexpected '}'
   22 | } ss_s;
      | ^
%Error: Exiting due to 2 error(s)
%Warning: vlt/t_source_sync: Exec of perl failed: %Error: t/t_source_sync.v:20:14: syntax error, unexpected /*verilator clocker*/, expecting ',' or ';'

vlt/t_source_sync: %Error: Exec of perl failed: %Error: t/t_source_sync.v:20:14: syntax error, unexpected /*verilator clocker*/, expecting ',' or ';'
vlt/t_source_sync: FAILED: Exec of perl failed: %Error: t/t_source_sync.v:20:14: syntax error, unexpected /*verilator clocker*/, expecting ',' or ';'
==SUMMARY: Passed 0  Failed 1  Unsup 0  Time 0:01
==SUMMARY: Passed 0  Failed 1  Unsup 0  Time 0:01

======================================================================
        #vlt/t_source_sync: %Error: Exec of perl failed: %Error: t/t_source_sync.v:20:14: syntax error, unexpected /*verilator clocker*/, expecting ',' or ';'
                make && test_regress/t/t_source_sync.pl  --vlt
TESTS DONE, FAILED: Passed 0  Failed 1  Unsup 0  Time 0:01

@dpetrisko
Copy link
Contributor Author

Let me know if you would like me to raise an issue for tracking as well!

Copy link
Member

@wsnyder wsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change the .pl file to indicate a failure is expected? Then we can merge the test as failing (incorrectly due to #3047). When #3047 is fixed the .pl file would be edited to indicate it should pass.

Thanks.

test_regress/t/t_source_sync.v Outdated Show resolved Hide resolved
Comment on lines +23 to +24

endmodule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test should somehow check that the clocker attribute is honored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was having trouble with that. Basically the problem was that Verilator is normally good about inferring the source synchronous signal for small designs. Only my large complex design suddenly started having problems (always_ff @(s.clk) not triggering, etc.)

So when I wrote a test that actually exercised this, it spuriously passed

dpetrisko and others added 2 commits June 29, 2021 17:48
Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
@dpetrisko
Copy link
Contributor Author

Could you please change the .pl file to indicate a failure is expected?

Done!

@wsnyder
Copy link
Member

wsnyder commented Jun 30, 2021

Please see the test failure - maybe need to update .out?

@dpetrisko
Copy link
Contributor Author

Yep, there was a whitespace issue on the .out file, sorry about that. Should be good to go now!

@wsnyder wsnyder merged commit c5c5f11 into verilator:master Jul 7, 2021
pieter3d pushed a commit to pieter3d/verilator that referenced this pull request Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants