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
Verilator ignores sense list of combo always block #757
Comments
Original Redmine Comment Verilator follows the synthesis rules which you described - basically treat all combos as an "always @*". Obviously Verilator is cycle based, so will not do what the sensitivity list strictly requires; though it could be told to use only the list for doing ordering (V3Order). The main catch is there are things that need to be sensitive to for proper scheduling that are not legally or traditionally listed in the sensitivity list, for example memories or the variables that a function call inside the block needs. |
Original Redmine Comment Agree with your points. But it would be nice to have an option to Verilator which determines how the sense list should be constructed. The default process can still be "always @*". Then when user uses that option, he should be responsible for what is he doing. |
Original Redmine Comment I'm fine with adding an option like that. My caution is that you will need to solve the problems of those items which cannot be legally put into the sensitivity list. It would require changing the verilog code, but one option would be to add a meta comment (that becomes an attribute after parsing):
|
Original Redmine Comment I didn't mention the point of the meta comment is you would use it only when there are no function calls or other stuff that might get you in trouble, then you don't need to solve that issue. Both methods are also probably reasonable, add the switch and it would have the same effect as setting that meta comment on all combo always'. |
Original Redmine Comment The reason I want a switch is that it is quite difficult to find all the cases in a relative large design. And this is really important one as it may affect both the simulator performance and accuracy. I actually have tried another solution as well. I add meta info @/verilator clock_enable/@ to "c". That also works in the sense eliminate the extra loop. However, when I tried this trick in our larger design, then the simulator behaved not correct any more. So for the meta info method, my concern is the design will not simulate correctly if we only change some of the always blocks. |
Believed fixed in develop-v5 with #3278. |
Author Name: Jie Xu (@jiexu)
Original Redmine Issue: 757 from https://www.veripool.org
When investigating to improve the performance of Verilator-based simulator model, I found the following handling of combo blocks in Verilator:
The sense list in always combo block is actually not really used. When forming AstActive, the sense list of combo always block is deleted.
Instead Verilator will kind of take in all the AstVarRef on RHS as the sense item. This is reflected in V3Order.cpp when forming the graph. This in some cases will make the signal as Circular.
We have some cases where the above of handling will make Verilator generating at least inefficient(not know if incorrect) code. For example:
Verilator will take the @c@ into the @change_request@ list in this example. However here @c@ is an output and don't really need another loop to settle.
The big question here is which should we depends on, either the designer's list (@Always(a,b))@) or all the VAR used as condition. IMHO, I believe we should respect the designer as he has the option @Always*@ if he really want to take later case.
The text was updated successfully, but these errors were encountered: