-
Notifications
You must be signed in to change notification settings - Fork 174
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
Our recommended way to write testbenches is racy #377
Comments
See also #228. |
What I think we should do is to recommend using the inactive edge of a clock domain for testbench logic. This is actually already the recommended way to use CXXRTL, for the same reason. This implies eliminating or reworking |
There is a partial solution to issue (1) in a branch. We discussed issue (2) on IRC and it is possible that nothing needs to be done there because if the DUT was embedded in a normal module, the waveform dump would have the same problem as with the recommended way of writing testbenches. |
my group has been using this approach for years cause we run our testbenches for both rtl and post-synthesis netlists. so the first things i did with nmigen is:
the letter ensures we'll run the same testbenches for nmigen code, generated rtl and partial vendor-specific netlists. not quite there yet, but we are working towards it. that was my 5 cents invested into motivation for inactive edge action. as for the actual fix, i'm using the attached patch |
We currently nudge people towards writing testbenches where the testbench modifies signals (inputs, registers) on the same edge as the edge-triggered synchronous logic (i.e. posedge for default posedge domains), but this is wrong:
yield Settle()
is used;Migen did not suffer from the problem (1) because it had a far simpler simulator that always ordered synchronous logic after the testbench logic and had no way to advance the simulation by zero time. (However, this caused severe issues for testbench logic by making it impossible to observe combinatorial feedback; e.g. it is not possible to implement a 1-cycle
FIFOInterface.read()
in Migen).Migen did suffer from the problem (2).
The text was updated successfully, but these errors were encountered: