P4.14.1 The AHB5 Parity Checker

HardVerify50 minIcarus · browser samples / server checks6 hidden designsReview the topic

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

SignalWidthRole
hclk1stimulus, the same for every design
hresetn1output of the design under test
hready1output of the design under test
hwrite1output of the design under test
htranschk1output of the design under test
hreadychk1output of the design under test
hctrlchk11output of the design under test
hprotchk1output of the design under test
hwstrbchk1output of the design under test
hrespchk1output of the design under test
htrans2output of the design under test
haddr16output of the design under test
haddrchk2output of the design under test
hwdata32output of the design under test
hwdatachk4output of the design under test
hrdata32output of the design under test
hrdatachk4output of the design under test
your errors32output of the design under test
Full specification
The module you write (keep these ports)
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 signalCoversCheck Enable
htranschkHTRANS, one bitHRESETn
haddrchk[1:0]HADDR, one bit per byteHRESETn
hreadychkHREADY (the inverse)HRESETn
hctrlchk1HBURST, HMASTLOCK, HWRITE, HSIZE, HNONSEC in one bitHTRANS not IDLE
hprotchkHPROT, one bitHTRANS not IDLE
hwdatachk[3:0], hwstrbchkHWDATA per byte; HWSTRB in one bitthe data phase of a write
hrdatachk[3:0]HRDATA per bytethe data phase of a read, at an edge with HREADY high
hrespchkHRESP and HEXOKAY, one bitthe 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

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
Expected 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.

Run samples executes all 3 public checks. Check all tests runs 7 checks on the server.

Icarus · browser samples / server checks