Check every AHB5 check signal of a link, each only in the cycles its enable term names. Follow the pipeline, where data phases trail address phases.
Hardware context: One AHB5 link with parity check signals between a manager and a subordinate. Write a checker for nine AHB5 check signals that follows the pipeline.
Lesson P4.14 caught an address flip in an idle cycle, which an APB-style checker would miss. This checker covers nine check signals of one AHB5 link. Each has its own Check Enable term. Three depend on the data phase, which trails its address phase by at least one edge.
Write module ahb5_parity_checker. Add one to errors for every check signal that is wrong at an edge where its enable term is true. The traffic fills every cycle where a signal has no rule with random values and random check bits.
Seven links drive it. One is correct. Each other link breaks one check signal: in an idle cycle, in a wait state, by its coverage, or by even parity. You pass with zero on the correct link and an alarm on each broken one.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
hclk | 1 | stimulus, the same for every design |
hresetn | 1 | output of the design under test |
hready | 1 | output of the design under test |
hwrite | 1 | output of the design under test |
htranschk | 1 | output of the design under test |
hreadychk | 1 | output of the design under test |
hctrlchk1 | 1 | output of the design under test |
hprotchk | 1 | output of the design under test |
hwstrbchk | 1 | output of the design under test |
hrespchk | 1 | output of the design under test |
htrans | 2 | output of the design under test |
haddr | 16 | output of the design under test |
haddrchk | 2 | output of the design under test |
hwdata | 32 | output of the design under test |
hwdatachk | 4 | output of the design under test |
hrdata | 32 | output of the design under test |
hrdatachk | 4 | output of the design under test |
your errors | 32 | output of the design under test |
Full specification
module ahb5_parity_checker (
input logic hclk,
input logic hresetn,
input logic [1:0] htrans,
input logic [15:0] haddr, // ADDR_WIDTH = 16
input logic hwrite,
input logic [2:0] hsize,
input logic [2:0] hburst,
input logic [3:0] hprot,
input logic [31:0] hwdata,
input logic [3:0] hwstrb,
input logic hready,
input logic hresp, // HEXOKAY is not present: assumed LOW
input logic [31:0] hrdata,
input logic htranschk,
input logic [1:0] haddrchk,
input logic hctrlchk1, // HMASTLOCK and HNONSEC are not present: assumed LOW
input logic hprotchk,
input logic hwstrbchk,
input logic [3:0] hwdatachk,
input logic [3:0] hrdatachk,
input logic hreadychk,
input logic hrespchk,
output int errors
);
// your checker
endmodule
| Check signal | Covers | Check Enable |
|---|---|---|
| htranschk | HTRANS, one bit | HRESETn |
| haddrchk[1:0] | HADDR, one bit per byte | HRESETn |
| hreadychk | HREADY (the inverse) | HRESETn |
| hctrlchk1 | HBURST, HMASTLOCK, HWRITE, HSIZE, HNONSEC in one bit | HTRANS not IDLE |
| hprotchk | HPROT, one bit | HTRANS not IDLE |
| hwdatachk[3:0], hwstrbchk | HWDATA per byte; HWSTRB in one bit | the data phase of a write |
| hrdatachk[3:0] | HRDATA per byte | the data phase of a read, at an edge with HREADY high |
| hrespchk | HRESP and HEXOKAY, one bit | the data phase |
Every check bit uses odd parity. A data phase belongs to a NONSEQ or SEQ address phase taken at an edge with HREADY high. It lasts until the next edge with HREADY high. Each scenario is 32 edges, the first two in reset.
For each link you get alarm = yes or no; for the correct one, also the scenario and cycle of your first alarm.
Examples
Example 1
Noise Where No Rule Applies- Input
Link: every check signal right under its enable Scenarios: Writes and reads with wait states; IDLE gaps between transfers; Back-to-back writes with long waits
- Output
alarm = no
In idle cycles HCTRLCHK1 and HPROTCHK carry random bits, and HWDATACHK is random outside write data phases. None of that may count.
Example 2
An Idle Cycle Still Counts- Input
Link: HADDRCHK wrong in an IDLE cycle Scenarios: Writes and reads with wait states; IDLE gaps between transfers; Back-to-back writes with long waits
- Output
alarm = yes
Between two transfers, one HADDRCHK bit is wrong. HADDRCHK is enabled by HRESETn, so the checker must report it.
Example 3
A Wait State Counts Too- Input
Link: HWSTRBCHK wrong in a write wait state Scenarios: Writes and reads with wait states; IDLE gaps between transfers; Back-to-back writes with long waits
- Output
alarm = yes
HWSTRBCHK is wrong in a wait state of a write data phase and right again at the last edge.
Constraints and Contract
- Every input is always 0 or 1. Signals that are not on the link are LOW in their check bits.
- Use only your ports. errors never decreases.
Hints
Hint 1
Register "a transfer is in its data phase" and its HWRITE at every edge with HREADY high, from that edge's HTRANS.
Hint 2
Check the data-phase signals against the registered values, before you update them at the same edge.
Hint 3
Read every enable term from the table. Three are HRESETn alone, which includes idle cycles.
What the grader checks: Your checker watches one correct and six faulty links over three scenarios. Passing shows it catches these six faults and stays silent where the enable terms are false. It does not cover HCTRLCHK2, HSELxCHK or the user check signals.
7 checks on Icarus · browser samples / server checks. 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 1 steps and the final capstone