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:
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:
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.
The Chiselsim
stepUntilfunction can be a bit of a footgun. I'm looking at a third-party project that is doing a lot of:This is a "forever wait" barring whatever the simulator timeouts are. Converting this to a
stepUntilseemed 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:
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
tickmethod which has thecheckElapsedCyclecount function parameter.