S1.2.2 The Read That Returned Zero

MediumDebug20 minIcarus Verilog · serverReview the topic

A readback tap reports zero while the pins are high. Find the first wrong sample and repair the readback tap.

Hardware context: GPIO peripheral read path. Memory-mapped I/O diagnosis

A diagnostic tap reports zero for a completed GPIO read with high input pins. Its output feeds a trace recorder. Inspect the tap.

Run the failing bench. Select the first divergent cycle and signal, diagnose the fault, then repair the tap.

Signals in the Timeline

SignalWidthRole
snapshot9input of each check
Full specification
Tap inputContract
word_indexLocal word number after byte-address conversion. In this diagnostic fixture the input register is word 5.
sel, enable, readyAll three must be high at the sample.
writingZero for a read.
pin_sampleReport all sixteen input bits for a qualifying sample.
observedDrive zero for every other sample. The tap is combinational.

The debug bench presents independent snapshots, including setup with ready high. This tap observes the peripheral interface after address decoding.

Diagnose the Failing Run

The test below runs the buggy design. Read its log, then find where it first goes wrong in the waveform.

Log

Waveform

Click a signal at a cycle to select it. Or focus the waveform and use the arrow keys: Left and Right move one cycle, Up and Down one signal.

Step 1 · The first bad cycle and signal
Step 2 · The cause

Step 3 is optional: fix the code in the editor, then run the tests.

Examples

Example 1

Idle
Input
sel/enable/ready/write=0000, word=5, pins=0x42
Output
observed = 0x0

Idle has no completed read, so the tap shows 0000.

Example 2

Setup
Input
sel/enable/ready/write=1010, word=5, pins=0x42
Output
observed = 0x0

Ready may already be high during setup. The tap still shows 0000.

Example 3

Completed Read
Input
sel/enable/ready/write=1110, word=5, pins=0x42
Output
observed = 0x42

All completion conditions hold. The tap reports the pin pattern 0042.

Constraints and Contract

  • Keep module read_tap and its ports. Every port carries known binary values.

Hints

Hint 1

Mark the first completed read of the input word.

Hint 2

Compare the local word number with the tap contract.

Hint 3

Check whether the symptom starts before or after completion.

What the grader checks: The diagnostic snapshots check this tap only. The fix cases exercise all flag and index combinations plus each data bit separately. Extra captures vary the pin data per submission.

298 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

Idle

Input
sel/enable/ready/write=0000, word=5, pins=0x42
Expected output
observed = 0x0

Idle has no completed read, so the tap shows 0000.

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

Icarus Verilog · server