Collect response beats that arrive interleaved by tag, and report each burst whole when its last beat lands.
Hardware context: A tagged request/response link with a fast and a slow target. Reassemble response bursts whose beats arrive interleaved by tag, closing each burst at its last beat.
Lesson P1.7 let two bursts share a response channel beat by beat. A receiver that allows this must sort the beats back into bursts. It keeps one small record per tag and closes a burst only at that tag's last beat.
Write module reassembler. For every burst it reports once: the tag, the number of beats, and the data of its first and last beats. The report comes at the edge after the burst's last beat, and done is 1 for that one cycle.
The fixture plays streams of beats. They hold one burst, two that take turns, a single-beat burst inside a long one, gaps, and two bursts on one tag. It records the first three reports in order and counts them all.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
beats | 6 | input of each check |
Full specification
module reassembler (
input logic clk,
input logic rst_n,
input logic rsp_valid, // a response beat arrives at this edge
input logic [3:0] rsp_tag,
input logic [7:0] rsp_data,
input logic rsp_last, // the last beat of its tag's burst
output logic done, // 1 for one cycle per completed burst
output logic [3:0] done_tag,
output logic [3:0] done_beats, // beats in the burst (1 to 8)
output logic [7:0] done_first, // data of its first beat
output logic [7:0] done_last // data of its last beat
);
// your reassembler
endmodule
| Rule | Meaning |
|---|---|
| Different tags | Their beats may arrive in any mix. |
| One tag | Its beats arrive in order. Its next burst starts only after the beat with rsp_last. |
| A burst | 1 to 8 beats; the last one carries rsp_last. |
| A report | done = 1 for one cycle, with done_tag, done_beats, done_first and done_last of that burst. |
The result packs the number of reports in bits 79 to 72. The first three reports follow, report 0 in bits 23 to 0, each as {tag[3:0], beats[3:0], first[7:0], last[7:0]}.
Examples
Example 1
One Burst- Input
Beats, one per edge (tag:data, * last, - none): 2:20 2:21 2:22 2:23*
- Output
reports = 1, report2 = 0x0, report1 = 0x0, report0 = 0x242023
Tag 2 sends four beats, 20 to 23. One report: tag 2, 4 beats, first 20, last 23.
Example 2
Two Bursts Taking Turns- Input
Beats, one per edge (tag:data, * last, - none): 1:80 2:20 1:81 2:21 1:82 2:22 1:83* 2:23*
- Output
reports = 2, report2 = 0x0, report1 = 0x242023, report0 = 0x148083
Tag 1 and tag 2 alternate. Tag 1 ends first, because its last beat comes first: report 0 is tag 1, 4 beats, 80 to 83. Report 1 is tag 2, 4 beats, 20 to 23.
Example 3
A One-Beat Burst Inside a Long One- Input
Beats, one per edge (tag:data, * last, - none): 5:50 6:60* 5:51*
- Output
reports = 2, report2 = 0x0, report1 = 0x525051, report0 = 0x616060
Tag 6 sends a single beat between the two beats of tag 5. Its report comes first, with first and last data both 60.
Constraints and Contract
- Keep the module name and the ports. The fixture drives one beat or none per edge and samples done just before each edge.
- Two bursts never end at the same edge, because only one beat arrives per edge.
Hints
Hint 1
Two arrays of 16, indexed by tag: the beats counted so far and the first data.
Hint 2
At a beat with rsp_last, report from the arrays (or from this beat, for a one-beat burst), then clear that tag's count.
Hint 3
A single-beat burst is both first and last. Do not read its first data from the array.
What the grader checks: Your reassembler plays ten streams of up to 26 beats on up to three tags at once. Its reports are compared with an independent model. Passing shows the per-tag bookkeeping is right on these streams.
10 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 steps and the final capstone