Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
    • Latency, Throughput and Bandwidth
    • Little's Law
    • Outstanding Transactions
    • Tags and IDs
    • In-Order or Out-of-Order
    • Reorder Buffers
    • Interleaving
    • Split Completions
    • Protocol Efficiency
    • Peak and Sustained Bandwidth
    • Queueing Intuition
    • Tail Latency
    • Buffers That Hide Latency
    • Virtual Output Queues
    • Performance Modelling
    • Protocols Compared: Concurrency and Performance
    • Drills: Concurrency and Performance
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 6: Concurrency and Performance
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 6: Concurrency and Performance
  4. Interleaving

Part 6 · Concurrency and Performance · Senior (S)

Interleaving

Interleaving mixes the beats of several transactions on one channel. What it buys (no channel idles while one transaction waits), what it costs the receiver (per-transaction state), and why AXI4 removed it for write data.

On this page

    Note

    Level: Senior (S) · Answers: How many requests can be in flight?

    Before this: In-Order or Out-of-Order, Bursts

    A memory controller is returning a 16-beat burst for one requester when, halfway through, the next beat it needs is not ready (its memory bank is busy). Another requester's data is ready now. If a burst must go out in one unbroken run, the read-data channel sits idle until the bank recovers. If beats from different bursts may be mixed, the channel stays busy.

    May the beats of different transactions share a channel in mixed order, and what does that cost?

    The obvious answer, and why it breaks

    The obvious rule is that a burst, once started, runs to the end: beats 0 to 15 back to back. It keeps the receiver simple: everything between the first beat and the last belongs to one transaction. But a sender that hits a delay mid-burst must idle the channel, even though it has other data ready. Unbroken bursts trade channel utilisation for receiver simplicity.

    The idea: label every beat

    Interleaving lets the sender switch between transactions beat by beat. Each beat carries its transaction's ID, and each transaction's last beat is marked. The receiver keeps per-ID state (how many beats it has, where they go) and reassembles each transaction independently.

    Unbroken bursts

    Interleaved beats

    Channel use when one burst stalls

    Idle

    Filled with another transaction's beats

    Receiver state

    One transaction at a time

    One beat counter and destination per ID in progress

    Each beat carries

    Data (and a last marker)

    Data, ID, and a last marker

    Within one transaction

    In order

    In order (only the mixing between transactions changes)

    Build it: two reads interleaved

    A target returns two 3-beat reads, ID 0 (data 0x01, 0x02, 0x03) and ID 1 (0x11, 0x12, 0x13), mixing their beats. The receiver keeps a beat counter per ID and checks each read arrives complete and in order.

    tb.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    // Read data from two transactions interleaved beat by beat. A target returns a
    // 3-beat read for ID 0 (data 0x01, 0x02, 0x03) and a 3-beat read for ID 1 (data
    // 0x11, 0x12, 0x13), alternating between them. Every beat carries its ID, and
    // `last` marks each transaction's final beat. The receiver keeps one beat counter
    // per ID and checks each transaction arrives complete and in order.
    module tb;
      logic clk = 0;
      always #5 clk = ~clk;
      initial begin $dumpfile("wave.vcd"); $dumpvars(0, tb); end
    
      int cyc = 0;
      logic       vld, last, id;
      logic [7:0] data;
      always_comb begin
        vld = 1; id = 0; data = 0; last = 0;
        case (cyc)
          1: begin id = 0; data = 8'h01; end
          2: begin id = 1; data = 8'h11; end
          3: begin id = 0; data = 8'h02; end
          4: begin id = 1; data = 8'h12; end
          5: begin id = 1; data = 8'h13; last = 1; end
          6: begin id = 0; data = 8'h03; last = 1; end
          default: vld = 0;
        endcase
      end
    
      int beats [0:1];
      initial begin beats[0] = 0; beats[1] = 0; end
      int errors = 0, finished = 0;
      always @(posedge clk) begin
        cyc <= cyc + 1;
        if (vld) begin
          if (data != {3'b0, id, 4'(beats[id] + 1)}) errors++;   // beat n of ID k is 0xk(n+1)
          if (last != (beats[id] == 2)) errors++;
          beats[id] <= last ? 0 : beats[id] + 1;
          if (last) finished++;
        end
      end
      initial begin
        #120;
        if (errors == 0 && finished == 2) $display("PASS: two interleaved reads reassembled by ID, each complete and in order");
        else $display("FAIL: errors %0d finished %0d", errors, finished);
        $finish;
      end
    endmodule

    The receiver's whole extra cost is the per-ID counter, beats[id]: it knows which beat of which transaction each word is.

    Watch it run

    How to read it, slot by slot:

    • Slots 0 to 3: the beats alternate between the two IDs (id 0, 1, 0, 1), carrying 0x01, 0x11, 0x02, 0x12.

    • Slot 4: ID 1 sends its third beat, 0x13, with last high: ID 1 is complete, though ID 0 is not.

    • Slot 5: ID 0's last beat, 0x03, arrives with last. Each read's beats arrived in order; only the mixing between them changed.

    Why write interleaving was removed from AXI4

    For read data, the target sends the beats and the requester must reassemble them; requesters that issue several reads already track them by ID, so interleaving costs them little. For write data, the roles flip: the requester sends the beats and the target must reassemble them, and every target, including the simplest memory, would need per-ID state for every write it might receive interleaved. Few requesters gained from interleaving writes, and every target paid. AXI4 removed write data interleaving: write data must arrive in the order of the write addresses, which also made the write-data ID signal unnecessary.

    How real protocols chose

    Protocol

    Interleaving

    AXI4

    Read data of transactions with different IDs may be interleaved beat by beat. Write data may not: it arrives in write-address order (AXI4 removed write interleaving and the WID signal).

    AXI3

    Allowed write data interleaving, with a WID on each beat.

    PCI Express

    Each completion is a whole packet; different completions may be mixed in any order, but a packet is never split across others.

    What breaks

    A requester (illustrative) assumed read bursts arrive unbroken and used a single beat counter for all reads. It worked against every memory in its test bench, none of which interleaved. Connected to a real interconnect, which interleaved read data from two memories, it delivered beats to the wrong buffers. Any requester that issues reads with different IDs must keep per-ID state, because the protocol allows the target to interleave.

    Why this matters

    Senior lens. Interleaving puts per-transaction state on whoever receives the beats. Check which direction each protocol allows it in, and that every receiver in that direction keeps per-ID state. In verification, make the target models interleave aggressively: a requester that only ever saw unbroken bursts has not been tested.

    Interview

    Asked: "Why does AXI4 forbid write data interleaving?"

    Weak answer: To save pins.

    Strong answer: Because interleaving puts the reassembly cost on the receiver. For reads that's the requester, which already tracks its outstanding reads by ID, so it's cheap. For writes the receiver is the target, so every target, even a simple memory, would need per-ID state to reassemble interleaved write bursts, while few requesters benefit. AXI4 requires write data in write-address order instead, which also made WID unnecessary. Read data of different IDs may still be interleaved.

    Follow-ups: (1) What state does a receiver need to accept interleaved data? (2) Does interleaving change order within one transaction?

    Check yourself A requester issues reads on 4 different IDs. What must it track to accept interleaved read data?

    Per ID in progress: a beat count (or address) and where the data goes, until each transaction's last beat.

    Check yourself In the waveform, which read finishes first, and how does the receiver know?

    ID 1, in slot 4: its third beat arrives with last high.

    Key takeaways

    • Interleaving mixes beats of different transactions so a channel need not idle when one stalls.

    • Each beat carries its ID and the receiver keeps per-transaction state; order within a transaction is unchanged.

    • AXI4 allows read-data interleaving but removed write-data interleaving, sparing every target that state.

    Keep going

    Next: Lesson 6.8, Split Completions. One request answered by several completions, and the rules for where they split.

    Related topics

    • Part 6 overview: Concurrency and Performance

    Previous

    93 / 234

    Next: Split Completions

    Up next

    Up nextSplit Completions

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Latency, Throughput and Bandwidth
    • Little's Law
    • Outstanding Transactions
    clkvldiddata1112121330last
    Simulation output: the beats of two reads, ID 0 and ID 1, interleaved on one channel and reassembled by ID.