-
Notifications
You must be signed in to change notification settings - Fork 83
remedy endless feedback loop #102
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
base: master
Are you sure you want to change the base?
Conversation
Hardware wise there is no logical loop, but I guess the simulator somehow gets erroneously triggered anyway. Synthesizers don't have a problem with this piece of code. In xcelium there is actually an option to work around this problem by using the I'll see if this breaks anything. I'm not a fan of working around buggy simulators. |
I am of two minds on this. Ideally, the simulator would have synthesizer-like logic to infer there is not a loop. However, the existing grouping together all these signals into a single always_comb causes there to be an implicit directive that the simulator should re-evaluate when any one of the dependencies in the always_comb changes, so I can understand why the loop is happening. Thanks. |
Ok I think I know why this is breaking. Some simulators consider the default assignment to a signal at the top of the The solution to this issue is simply not doing a default assignment to these variables, but defining them in each branch of the case statement instead. |
For what it is worth, I updated the PR to follow in the spirit of what you suggested. It seems the most minimal change to avoid default values would be to move "go", "resume", and "cmdbusy_o" into the case statement. A healthy subset of these were already set in the case statement, so it seems fairly painless as changes go. It could still be judged as 'working around buggy simulators', but it is there for your perusal. |
Thanks this looks good I'll give it spin |
This pull request fixes some issue observed in the CVA6 project, specifically the one discussed in openhwgroup/cva6#800 Is there any reason not to include this pull request? |
@christian-lanius which simulator and version did you run? I was under the impression this was fixed (in the simulators I looked at) |
I am using the master branch of CVA6, which uses submit e19d69e of riscv-dbg. However the latest master branch looks the same in this part of the code. The issue occurs in QuestaSim 2020.4 and 2021.3 (I have also tried 2018, but that crashes beforehand with an internal error in vlog). The issue does not occur in VCS. The exact infinite loop I get is shown below:
|
As reported in #80, there is an endless simulation loop in ./src/dm_mem.sv.
In the existing code:
As a result, each always_comb re-evaluates after the other ad infinitum.
Since "go", "resume", and "cmdbusy_o" are simply combinatorial logic dependent only on "state_q", this PR moves this logic to its own always_comb.