-
Notifications
You must be signed in to change notification settings - Fork 23
New Timed Assertions API #28
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
Conversation
Following this morning's discussion, I changed the always(9) { dut.io.aEqb ?== dut.io.isOne }
eventually(4) { dut.io.outB ?> dut.io.outCNotSupB }
exact(7) { dut.io.outB ?< dut.io.outCSupB }
never(10) { dut.io.outB ?>= dut.io.outC } This can also, of course, be used with arbitrary conditions: always(9) { dut.io.aEqb.peek().litValue() == dut.io.isOne.peek().litValue() }
eventually(4) { dut.io.outB.peek().litValue() > dut.io.outCNotSupB.peek().litValue() }
exact(7) { dut.io.outB.peek().litValue() < dut.io.outCSupB.peek().litValue() }
never(10) { dut.io.outB.peek().litValue() >= dut.io.outC.peek().litValue() } As a reminder, doing the same using the previous syntax is still allowed and would look like this: AssertTimed(dut, dut.io.aEqb.peek().litValue() == dut.io.isOne.peek().litValue(), "ERROR")(Always(9))
AssertTimed(dut, dut.io.outB.peek().litValue() > dut.io.outCNotSupB.peek().litValue(), "ERROR")(Eventually(4))
AssertTimed(dut, dut.io.outB.peek().litValue() < dut.io.outCSupB.peek().litValue(), "ERROR")(Exactly(7))
AssertTimed(dut, dut.io.outB.peek().litValue() >= dut.io.outC.peek().litValue(), "ERROR")(Never(10))
|
There is also now a new, similar, ExpectTimed(dut, dut.io.aEqb, 1.U, "aEqb expected timing is wrong")(Always(9)).join()
ExpectTimed(dut, dut.io.aEvEqC, 1.U, "a never equals b within the first 11 cycles")(Eventually(11)).join()
ExpectTimed(dut, dut.io.aEvEqC, 1.U, "aEqb expected timing is wrong")(Exactly(6)).join()
ExpectTimed(dut, dut.io.aNevEqb, 0.U, "a is equal to b at some point")(Never(10)).join() Now looks like: always(9, "aEqb expected timing is wrong") { dut.io.aEqb expected 1.U }
eventually(11, "a never equals b within the first 11 cycles") { dut.io.aEvEqC expected 1.U }
exact(6, "aEqb expected timing is wrong") { dut.io.aEvEqC expected 1.U }
never(10, "a is equal to b at some point") { dut.io.aNevEqb expected 0.U } The |
Let us have some more discussion on this Friday. |
This PR is a response to discussion #26.
A new timed assertions API was added, the previous one still works ofc. Now it looks similarly to ScalaTest's constructs:
The
cycles
call replaces the previously neededjoin()
call by hiding it behind a fancy wrapper.The timed operators also got a new API full of syntactic sugar:
?==
isEquals
?<
isLt
?>
isGt
?<=
isLtEq
?>=
isGtEq
The
?
symbol is needed in order to not collide with Chisel's operators.Here's an example use:
EDIT: This is no longer valid, please refer to the next comment !