Put the read-channel rules inside the interface, so every bus instance checks itself.
Hardware context: A read-channel interface used by many blocks. Carry the channel rules inside the interface so every bus instance checks itself.
A read channel is an interface, rd_if, used by many blocks. Rather than binding rules into each block, put them in the interface: every instance of the bus then carries its own checks.
Add two rules, clocked by the interface's clock. Data holds while a beat is stalled, and a stalled beat is not withdrawn. Count the failures in the interface's counters.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
clk | 1 | stimulus, the same for every design |
Full specification
interface rd_if (input logic clk);
logic valid, ready;
logic [7:0] data;
int hold_f = 0, drop_f = 0;
// Add the two rules, clocked by the interface clock:
// hold: while a beat is stalled, data holds at the next edge. Count in hold_f.
// keep: a stalled beat is not withdrawn: valid stays high at the next edge. Count in drop_f.
endinterface
| Bus | What the program shown here does | Expected |
|---|---|---|
| bus0 | stalled at 15; data moves at 22 | hold fails once |
| bus1 | stalled at 15; valid drops at 22 | keep fails once |
The full check also runs a second program on another bus, which this page does not show.
Examples
Example 1
Data Moved- Input
Program: data moves during a stall
- Output
hold = 1
bus0 changes its data while stalled.
Example 2
Beat Withdrawn- Input
Program: a stalled beat withdrawn
- Output
drop = 1
bus1 drops valid while stalled.
Example 3
Each Bus Checks Itself- Input
Program: the other rule on each bus
- Output
other = 0
Each instance reports only its own bug.
Constraints and Contract
- Write both rules inside rd_if, as concurrent assertions on its clock.
- Count failures in hold_f and drop_f. Keep the signals and counters.
Hints
Hint 1
An interface may hold assertions, like a module. Each instance runs its own copy.
Hint 2
Clock the rules with the interface's clock port, clk.
Hint 3
Both rules look one edge after the stall: use |=>.
What the grader checks: Your interface is compiled with a fixed bench of two programs: the one shown here and a hidden one. Graded: the two failure counts of each bus instance.
5 checks on Verilator · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 4 steps and the final capstone