Add stream-contract conformance checkers - #44
Merged
Conversation
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A reusable checker for the valid/ready stream contract: valid held and payload stable until ready fires, transfers only when both are high, exactly one last per batch, no transfer after last, and status held until status_ready. Each violation raises naming the RULE and the CYCLE.
Motive: real bugs shipped past hand-written benches in the last few days — a core whose output was combinational off a register that had already advanced (right record counts, wrong contents), a core sustaining 1.25 instead of 1.0 records per cycle, a bench where deleting an entire error branch still passed, and one where hardwiring
output_lastlow still passed. These properties get hand-written per bench today, inconsistently.Ten tests drive deliberately BROKEN modules — dropping valid, mutating a stalled payload, emitting two lasts, never emitting last — and assert each fails with its rule identified. That is the proof the layer is worth having rather than a claim about it.
The useful conclusion is about tooling, not code. This was scoped as an evaluation of dau-sim's CSP simulator as a second simulation path alongside Verilator. It turns out not to need one: the checker is simulator-NEUTRAL Python that samples signal values, so it attaches to the existing Verilator/cocotb benches directly. The value was never a second simulator — it was that these properties should be enforced generically instead of re-derived per bench. Adopting it costs no new simulation path and no second harness.
Additive only; the existing cocotb integration's behaviour and defaults are untouched. Suite: 10 passed.