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

Open
#5,077 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
scala
Domain
testing

Research direction

Start by locating the Chiselsim stepUntil API and the other tick method mentioned in the issue, including its checkElapsedCycle parameter. Determine how timeout exhaustion is currently handled, then define and test behavior that makes exceeding the cycle limit observable while preserving successful waits.

Written by the indexing model from the issue text.

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:

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.

Dominant language
Scala
Stars
4.8k
Forks
669
Avg merge
1d 12h
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from chipsalliance/chisel

All issues in chipsalliance/chisel

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.