S8.4.1 A Two-Input Trace Funnel

MediumImplement24 minIcarus Verilog · serverReview the topic

Share one registered trace slot between two sources and keep each byte paired with its owner through a stall.

Hardware context: Trace funnel and circular sink. Postmortem instruction history

The trace port can pause while both sources have events waiting. Build a one-slot registered link that can drain and refill at the same edge.

Signals in the Timeline

SignalWidthRole
edge_index10input of each check
source0_valid1input of each check
source1_valid1input of each check
sink_accepts1input of each check
Full specification

v0 and v1 offer bytes d0 and d1. Combinational take0 and take1 identify the offer accepted at the upcoming edge. Only a valid offer may be taken.

The slot has room when empty or when the sink will consume its current byte. Take one available offer whenever there is room. On a tie choose the other source from the last accepted one. Before the first intake after reset, a tie goes to source zero.

After acceptance, valid is high and id and payload hold the selected source number and byte. A full slot holds through a stall. Draining without refill clears valid and retains id and payload.

During reset suppress both takes. Synchronous reset clears valid, id and payload and restores the first tie preference.

Examples

Example 1

Empty After Reset
Input
reset=1
Output
take1 = 0, take0 = 0, valid = 0, id = 0, byte = 0x0

No source advances and the slot clears.

Example 2

Two Waiting Sources
Input
v0=v1=1, bytes 4a and c1, sink_ready=0
Output
take1 = 0, take0 = 1, valid = 1, id = 0, byte = 0x4a

An empty slot accepts source zero.

Example 3

Sink Still Paused
Input
v0=v1=1, sink_ready=0
Output
take1 = 0, take0 = 0, valid = 1, id = 0, byte = 0x4a

The full slot holds the first byte and neither source advances.

Constraints and Contract

  • Implement trace_funnel. The sink sees the registered slot. A new byte cannot pass directly through an empty slot at the intake edge.

Hints

Hint 1

Determine whether a slot frees at this edge.

Hint 2

Remember which successful intake changed the tie preference.

Hint 3

Keep the tag beside its byte during a stall.

What the grader checks: The bench compares pre-edge intake decisions and post-edge storage under ties, stalls, drains, resets and replacement.

163 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 3 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 After Reset

Input
reset=1
Expected output
take1 = 0, take0 = 0, valid = 0, id = 0, byte = 0x0

No source advances and the slot clears.

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

Icarus Verilog · server