[Interp] Produce non-empty waveforms for combinational DUTs#196
Open
[Interp] Produce non-empty waveforms for combinational DUTs#196
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: merge #195 before reviewing this PR (I merged #195 into this PR since I found the Cargo aliases defined there helpful for running the interpreter executable, so he changed
.tomlfiles come from #195). The only changed file that is relevant to this PR isinterpreter.rs.When debugging why the monitor was failing the
adder_d0(combinational adder) round-trip test (#187), I noticed that the waveform produced by the interpreter was empty (Surfer had trouble opening the.fstfile that was produced by the interpreter). I think the issue was that previously, the simulator'ssim_step()method was only called when thenext_threadsqueue is non-empty:However, for combinational DUTs like
adder_d0, thenext_threadsqueue is empty since all protocols defined with the same.protfile finish within the same cycle. As a result, the simulator never gets stepped, resulting in an empty waveform.The fix is to add an extra flag to the
Schedulerstruct that tracks whether astep()statement was encountered, and to callsim_step()on the simulator whenever astep()is encountered (regardless of whether thenext_threadsqueue is empty or not).This allows the interpreter to produce a non-empty waveform for
adder_d0!All other interpreter tests still pass after this change.