S10.7.2 The DMA That Escaped Its Guest

MediumDebug20 minIcarus Verilog · serverReview the topic

A DMA retirement trace counts a write for the wrong guest. Locate the first disagreement and repair the commit guard.

Hardware context: Two-stage DMA page filter. Virtualised device access

In this exercise, translation has finished. Each write ticket carries the owner recorded when the request entered the queue. Decide if it may retire now.

Signals in the Timeline

SignalWidthRole
snapshot11input of each check
Full specification
InputMeaning at this sample
validThe slot holds a write ticket.
guest_write_ok, host_write_okBoth stages must permit a write.
revokedA set bit cancels the ticket.
ticket, ownerThree-bit saved and current owner codes. Every bit must match.

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 Slot
Input
Flags 0000, ticket 2, owner 2
Output
commit = 0

The empty slot produces no write.

Example 2

Matching Ticket
Input
Flags 1110, ticket 2, owner 2
Output
commit = 1

Both stages permit this live write for owner two.

Example 3

Revoked Ticket
Input
Flags 1111, ticket 2, owner 2
Output
commit = 0

Revocation cancels the otherwise permitted transfer.

Constraints and Contract

  • Drive commit high exactly when all four qualifications hold and the owners match. Use a combinational decision on known binary inputs.

Hints

Hint 1

Read the flags in port order.

Hint 2

Find the first sample where the target sees an unexpected write.

Hint 3

Compare the saved and current ownership codes at that sample.

What the grader checks: All known binary combinations at a single write retirement point.

27 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 Slot

Input
Flags 0000, ticket 2, owner 2
Expected output
commit = 0

The empty slot produces no write.

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

Icarus Verilog · server