S6.12.1 A One-Channel DMA

HardImplement40 minIcarus Verilog · serverReview the topic

Keep one byte safe between two independent bus completions, including a peripheral request and a failed destination.

Hardware context: ap_soc one-channel DMA. Peripheral capture and fault isolation

Implement a byte-copy channel behind a bus adapter. The adapter exposes a single completion handshake for each command. This exercise uses eight-bit byte addresses and four-bit lengths.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
reset1stimulus, the same for every design
done1stimulus, the same for every design
fault1stimulus, the same for every design
ack1stimulus, the same for every design
valid1stimulus, the same for every design
write_en1stimulus, the same for every design
address8stimulus, the same for every design
write_data8stimulus, the same for every design
Full specification

Synchronous reset cancels all work and clears all outputs. In idle, start captures both bases, length and fixed_src. A zero length pulses done immediately. Ignore start until idle again.

For memory sources issue a registered read immediately after start. For a fixed peripheral source first enter a wait state. A rising edge sampling request there launches the read. A subsequent request change cannot withdraw it.

Hold valid, address, direction and payload through waits. Sample error and read_data only at a valid rising edge with ready. A successful peripheral read pulses ack for one cycle and consumes one peripheral byte.

Offer the captured byte for writing immediately after a successful read. After a successful write increment the destination modulo 256. Increment a memory source too. For another peripheral byte return to the request wait state.

After the final successful write pulse done and become idle. Either read or write failure pulses fault and stops immediately. Each event signals for one cycle. Consecutive completions can keep done high. A failed peripheral read gets no ack.

When idle or waiting, drive address, write_data, valid and write_en low. Reads drive write_data and write_en low. Sample reset ahead of all other events.

Examples

Example 1

Empty Copy
Input
Start with length zero.
Output
done = 1, fault = 0, ack = 0, valid = 0, write_en = 0, address = 0x0, write_data = 0x0

Completion needs no bus command.

Example 2

Memory Source
Input
Start one byte from 0x40 to 0x80.
Output
done = 0, fault = 0, ack = 0, valid = 1, write_en = 0, address = 0x40, write_data = 0x0

The first offer reads the source.

Example 3

Peripheral Source
Input
Start one fixed-source byte with request low.
Output
done = 0, fault = 0, ack = 0, valid = 0, write_en = 0, address = 0x0, write_data = 0x0

The channel waits for permission to read.

Constraints and Contract

  • One outstanding command, one byte per completion. The port is a local adapter contract, not a pipelined AHB interface.

Hints

Hint 1

Sketch ownership before and after each bus completion.

Hint 2

Give waiting for a peripheral its own state.

Hint 3

Try an error on the final write.

What the grader checks: All lengths, fixed and advancing sources, stalled commands, wraparound, faults and resets are checked at intermediate edges.

56 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

Empty Copy

Input
Start with length zero.
Expected output
done = 1, fault = 0, ack = 0, valid = 0, write_en = 0, address = 0x0, write_data = 0x0

Completion needs no bus command.

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

Icarus Verilog · server