S1.6.2 The Document Says, the RTL Does

MediumDebug25 minIcarus Verilog · serverReview the topic

A small top level disagrees with its document in three places. Find the first wrong row, then repair every one.

Hardware context: An excerpt of the ap_soc architecture document and a small top level. Specification reading and spec-against-RTL checks

A top level decodes four devices, wires three interrupt requests and spreads five reset sources. A bench walks nine rows of its document, one row in each cycle.

Run the failing bench. Select the first cycle and the signal that differ from the document, and name the cause. Then repair the RTL. The owners have checked the three tables below: the document is right.

Signals in the Timeline

SignalWidthRole
snapshot9input of each check
Full specification
Table 1: memory map of the device window
An address in the reserved rows raises sel_reserved and no device select. An address outside 0x1000_0000 to 0x1000_FFFF raises nothing. Addresses below 0x1000_3000 belong to another block.
DeviceFirst addressSize
Watchdog0x1000_30000x1000
ap_sysctl0x1000_40000x1000
SPI0x1000_50000x1000
DMA0x1000_60000x1000
reserved0x1000_70000x9000, up to 0x1000_FFFF
Table 2: interrupt sources
Bit n of irq_source is source n. A device raises only its own source.
SourceDevice
4SPI
5DMA
6Watchdog
1 to 3other blocks: always 0 here
Table 3: what each reset source resets
Several sources can be active together. An output is 1 when any active source resets that part.
SourceProcessor (reset_core)Bus and devices (reset_bus)Debug logic (reset_debug)
Power-on (por)yesyesyes
Reset pin (pin_reset)yesyesno
Watchdog (wdt_reset)yesyesno
Software (sw_reset)yesyesno
Debugger (dbg_reset)yesnono

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

The Watchdog Region
Input
addr=0x10003000, requests wdt/spi/dma=000, resets=00000
Output
sel_wdt = 1, sel_sysctl = 0, sel_spi = 0, sel_dma = 0, sel_reserved = 0, irq_source = 'b000000, reset_core = 0, reset_bus = 0, reset_debug = 0

Only the watchdog select rises at 0x1000_3000.

Example 2

A DMA Request
Input
addr=0x00000000, requests wdt/spi/dma=001, resets=00000
Output
sel_wdt = 0, sel_sysctl = 0, sel_spi = 0, sel_dma = 0, sel_reserved = 0, irq_source = 'b010000, reset_core = 0, reset_bus = 0, reset_debug = 0

DMA raises source 5 and no other.

Example 3

Power-On Reset
Input
addr=0x00000000, requests wdt/spi/dma=000, resets=10000
Output
sel_wdt = 0, sel_sysctl = 0, sel_spi = 0, sel_dma = 0, sel_reserved = 0, irq_source = 'b000000, reset_core = 1, reset_bus = 1, reset_debug = 1

A power-on reset reaches the processor, the bus and the debug logic.

Constraints and Contract

  • Keep module device_top and its ports. The design is combinational. Every input carries a known binary value.

Hints

Hint 1

Walk the bench cycle by cycle. For each cycle, find its row in the tables.

Hint 2

The first error is not the only one. After each repair, run again.

Hint 3

Check each table in both directions: a device at the wrong place, and a place with the wrong device.

What the grader checks: The bench of the diagnosis walks nine rows. The fix cases check every region of the window at both ends, and addresses outside it. They also check all eight request patterns and all 32 reset patterns. One row uses an address drawn for each submission.

150 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 Watchdog Region

Input
addr=0x10003000, requests wdt/spi/dma=000, resets=00000
Expected output
sel_wdt = 1, sel_sysctl = 0, sel_spi = 0, sel_dma = 0, sel_reserved = 0, irq_source = 'b000000, reset_core = 0, reset_bus = 0, reset_debug = 0

Only the watchdog select rises at 0x1000_3000.

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

Icarus Verilog · server