Skip to content

[chiselsim] stepUntil, but asserting if it doesn't happen? #5077

@seldridge

Description

@seldridge

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions