chipsalliance / chipsalliance/chisel
[chiselsim] `stepUntil`, but asserting if it doesn't happen?
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
The Chiselsim `stepUntil` function can be a bit of a footgun. I'm looking at a third-party project that is doing a lot of:
``` scala
while (dut.foo.peek().litValue == 1) { dut.clock.step() }
```
This is a "forever wait" barring whatever the simulator timeouts are. Converting this to a `stepUntil` seemed obvious, however, choosing the timeout is tricky, specifically because if the timeout is not set correctly, there is no indication to the user that this failed.
E.g., the above can be rewritten to the much better:
``` scala
dut.clock.stepUntil(dut.foo, 1, 10)
```
However, if this goes beyond the 10 cycles, it just gives up and executes the next command. This would be better if it also exposed the ability to assert that this happened. This is probably just using the other `tick` method which has the `checkElapsedCycle` count function parameter.
Contributor guide
Assessment
This issue has not been assessed yet.