V2.4.2 A Grey-Box Checker for the Interrupt Map

MediumImplement30 minIcarus Verilog · serverReview the topic

Write a passive SystemVerilog checker that watches the wires into ap_plic and reports every cycle the interrupt map of irq.csv is broken. It runs on wires recorded from the chip.

Hardware context: Probe points of ap_soc v1.5: pads, buses and interrupt wires, flops inside ap_plic and the core. Keeping white-box probes maintainable.

A grey-box check sits on the boundary between blocks. Here the boundary is the sixteen inputs of ap_plic, and the specification is irq.csv: which wire drives each source.

Write irq_map_check. At every rising edge of clk while resetn is 1, compare each checked input of ap_plic with its wire in irq.csv. Count the edges at which any checked input is wrong, and remember the lowest wrong source of the first such edge.

The bench replays wires that a probe recorded on ap_soc v1.5, cycle by cycle. Some come from the chip, some from copies with seeded faults, and some are made-up traces that say so. The checker runs on the Icarus engine with these recorded wires. A checker built into the live chip bench is not yet a problem engine.

Signals in the Timeline

SignalWidthRole
trace_no3input of each check
Full specification
SourceDriven by (irq.csv)Check
1 to 5UART0, GPIO, Timer and PWM, SPI, DMA, directlyplic_in[n] equals dev[n] in the same cycle
6, 9Watchdog, ap_pwrctl, on clk_aon, through two flip-flopsNot checked here
7, 8, 10 to 16Reserved or spare: tied to 0plic_in[n] is 0

While resetn is 0, errors and first are 0. A wrong edge adds one to errors. first is set once, at the first wrong edge, to the lowest source number wrong at that edge.

Examples

Example 1

The Chip, Five Requests in Turn
Input
ap_soc v1.5, recorded: UART0, GPIO, timer, SPI and DMA each raise and drop their request once.
Output
errors = 0, first = 0

On the chip every input matches its wire: no errors.

Example 2

Fault Q072: Source 2 Samples SPI
Input
Recorded on a copy of the chip with the qualification fault Q072.
Output
errors = 1003, first = 2

GPIO's request never reaches input 2, and later SPI's request reaches it instead: two stretches of wrong edges, first source 2.

Example 3

A Made-Up Trace: Source 8 Follows UART0
Input
The chip's trace with one tie-off broken by hand.
Output
errors = 11, first = 8

Input 8, tied to 0 by irq.csv, follows UART0's request for as long as it is high.

Constraints and Contract

  • Keep the module name and every port.
  • Read only: the checker drives nothing but errors and first.
  • Each case reports {errors, first} at the end of one trace.

Hints

Hint 1

Build the value ap_plic should see from dev, then compare it with plic_in under a mask of the checked sources.

Hint 2

A wire that is high when it should be low is as wrong as one that stays low.

Hint 3

Count edges, not events: a request that stays wrong for 600 cycles adds 600.

What the grader checks: Seven traces of ap_plic's inputs. Four were recorded by an Icarus 12 probe: two on ap_soc v1.5, two on copies with seeded faults. Three are made up from the good trace. The checker is not bound into the live chip bench.

7 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 2 problems on this path

Report a problem with this page

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

The Chip, Five Requests in Turn

Input
ap_soc v1.5, recorded: UART0, GPIO, timer, SPI and DMA each raise and drop their request once.
Expected output
errors = 0, first = 0

On the chip every input matches its wire: no errors.

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

Icarus Verilog · server