S6.9.2 The Interrupt-Driven Transmit

MediumImplement25 minIcarus Verilog · serverReview the topic

Drive UART writes from delivered interrupt claims while another device competes for service.

Hardware context: ap_soc UART0 transmit path. Firmware bring-up and service budgeting

Write the clocked bus-functional equivalent of a transmit handler. The interrupt dispatcher supplies claim_id each edge. UART0 has ID 1, as on ap_soc. Other IDs belong to other sources, and 0 means no interrupt. This exercise models handler transactions before the processor exists.

Signals in the Timeline

SignalWidthRole
clk1stimulus, the same for every design
reset1stimulus, the same for every design
irq_enable1stimulus, the same for every design
tx_write1stimulus, the same for every design
tx_data8stimulus, the same for every design
Full specification

On an idle rising edge, submit captures count (0 through 7) and message, least significant byte first. Zero requests no work. Ignore new submissions while any byte remains.

Enable UART interrupts whenever bytes remain. With no outstanding write, a matching claim and room together launch a registered write for the next cycle. A submit edge only loads the buffer.

Hold the offer and data until a later rising edge samples accepted. Ignore claim, room and submit during that wait. On acceptance retire exactly one byte. A fresh claim can launch the next write on a subsequent edge.

Drive tx_data zero whenever tx_write is low. Synchronous active-high reset cancels all pending work and clears the outputs.

Examples

Example 1

Empty Submission
Input
Submit zero bytes.
Output
irq_enable = 0, tx_write = 0, tx_data = 0x0

The empty buffer needs no interrupt.

Example 2

Pending Message
Input
Submit two bytes, starting with 0x41.
Output
irq_enable = 1, tx_write = 0, tx_data = 0x0

The interrupt source is armed.

Example 3

First Offer
Input
Claim UART0 with room after submitting 0x41.
Output
irq_enable = 1, tx_write = 1, tx_data = 0x41

The low byte appears on the active write.

Constraints and Contract

  • Keep the port signature. Every offer is a write to UART0 TX. The judge observes write, data and interrupt enable across rising edges.

Hints

Hint 1

Separate an armed source from a pending bus write.

Hint 2

Which event makes the old buffer byte expendable?

Hint 3

Check the final accepted write and the next idle edge.

What the grader checks: The BFM checks every offered byte and mask transition, including foreign claims, reset and stalled writes.

16 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 Submission

Input
Submit zero bytes.
Expected output
irq_enable = 0, tx_write = 0, tx_data = 0x0

The empty buffer needs no interrupt.

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

Icarus Verilog · server