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

VCD files do not display glitches and can get extremely confusing #1412

Open
whitequark opened this issue Jun 19, 2024 · 2 comments
Open

VCD files do not display glitches and can get extremely confusing #1412

whitequark opened this issue Jun 19, 2024 · 2 comments
Labels
Milestone

Comments

@whitequark
Copy link
Member

Self-contained but not quite minimal reproducer:
repro.zip

@whitequark whitequark added the bug label Jun 19, 2024
@whitequark whitequark added this to the 0.6 milestone Jun 19, 2024
@whitequark whitequark changed the title ctx.get() returns wrong values that never appear in the VCD VCD files do not display glitches and can get extremely confusing Jun 19, 2024
@whitequark
Copy link
Member Author

@wanda-phi has narrowed down the issue to the two underlying causes (thanks!). These are:

  1. Circuits that provide combinational feedback from control to status signals, when used together with testbenches that use .get() and .set(), easily cause race conditions.
  2. The VCD files do not display glitches that arise from these race conditions.

It is much easier to tackle (2) alone so that's what we should do.

@whitequark
Copy link
Member Author

In this particular case, the race condition is:

  1. A posedge causes a status signal to be asserted.
  2. A testbench samples it after the posedge using get() and manipulates a control signal. (This is violating Amaranth's execution model: the testbench is not acting like a synchronous circuit.)
  3. The change to the control signal causes the status signal to be deasserted again.
  4. On the next posedge, the circuit acts on the deasserted value of the status signal, missing an event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant