← Protocols Interviews

Interview Question · Code Writing

The 4 KB Boundary Check

L1 JuniorL2 Mid-Levelaxiburstsverification

The Question

The interviewer asks

Why may an AXI burst not cross a 4 KB boundary? Write the check for an INCR burst.

Reveal the Model Answer

The interconnect routes a burst using its first address only. So a burst that crossed the boundary could run into the next subordinate. The rule also limits how many address bits a subordinate must increment. The check compares the 4 KB page of the first byte with the page of the last byte, aligned_start + beats*size - 1. Using the address one past the end wrongly flags a burst that ends exactly on the edge.

A Burst That Runs into the Next SubordinateArrows show where the request goes. The decoder routes the whole burst by its first address only.
A burst that runs into the next subordinateArrows show where the request goes. The decoder routes the whole burst by its first address only. component Manager INCR, 8 beats of 4bytes at 0x0FF0 checker Boundary check Page of first byte vspage of last byte component Decoder Looks at 0x0FF0only component Subordinate A 0x0000 to 0x0FFF component Subordinate B 0x1000 to 0x1FFF one requestAW handshakeall 8 beatsnever sent
  1. One decode

    The decoder sees 0x0FF0 and sends the whole burst to subordinate A.

  2. The crossing

    Beats 0 to 3 are 0x0FF0 to 0x0FFC. Beats 4 to 7 are 0x1000 to 0x100C, which belong to B, but B never sees them.

  3. The check

    The last byte is 0x0FF0 + 32 - 1 = 0x100F. Its 4 KB page differs from the first byte's page, so the request is illegal.

Read the diagram as text
  • Manager: INCR, 8 beats of 4 bytes at 0x0FF0
  • Boundary check: Page of first byte vs page of last byte
  • Decoder: Looks at 0x0FF0 only
  • Subordinate A: 0x0000 to 0x0FFF
  • Subordinate B: 0x1000 to 0x1FFF
  • Manager → Decoder: one request
  • Manager → Boundary check: AW handshake
  • Decoder → Subordinate A: all 8 beats
  • Decoder → Subordinate B: never sent

The rule exists because the decoder routes once per burst. A burst that stays inside one 4 KB page can never change subordinate.

Pages of the first and last byte. Only INCR needs it: FIXED never moves and a WRAP window is at most 16 × 128 bytes, aligned.
last  = (start / nb) * nb + beats * nb - 1;   // last byte the burst can touch
cross = (start >> 12) != (last >> 12);

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Junior)

A good junior answer gives the reason: the burst is decoded once, by its first address. It writes a check that compares the first byte with the last byte.

Cross-Questions

Where the interviewer goes next. Open a node to practise that follow-up.

WhyWhat IfProve ItBreak ItScale It

  1. The 4 KB Boundary Check
  2. WhyWho the 4 KB Rule ProtectsL1 Junior

    Who would break if a burst crossed 4 KB: the manager, the interconnect or the subordinate?

    Reveal the Model Answer

    Mainly the interconnect and the subordinate. The interconnect decodes the destination once, from the first address. So the tail of a crossing burst would land in whichever subordinate owns the next page. The subordinate computes later addresses itself, and the rule limits how far its address counter has to carry. The manager is the one that must obey the rule, by splitting its bursts.

    Self-Check

    Tick each key point you covered in your answer.

  3. Break ItFinding the Beat That Crosses 4 KBL1 JuniorL2 Mid-Level

    Break it: an INCR burst of sixteen 8-byte beats starts at 0xFC0. Which beat crosses, and when should the checker report it?

    Reveal the Model Answer

    The burst covers 128 bytes, from 0xFC0 to 0x103F. Beat 9 starts at 0x1000, on the next 4 KB page. The checker should flag the request at the address handshake. The first and last byte addresses must share every bit from bit 12 up.

    Self-Check

    Tick each key point you covered in your answer.

    Spec Misquote

    "Only the start address must stay below the boundary."

    The whole transaction, up to its last byte, must stay inside one 4 KB page.

    Source AMBA AXI Protocol Specification IHI 0022L §A3.1 Transaction request

    Wrong Altitude

    Checks the 4 KB rule on each data beat as it arrives.

    The request already decides it: start, size and length. Checking there names the cause before any data moves.

  4. What IfCan WRAP or FIXED Cross 4 KB?L2 Mid-Level

    Does your boundary checker need to handle WRAP and FIXED bursts too?

    Reveal the Model Answer

    No, because FIXED never changes address. A WRAP burst stays inside its window, at most 16 beats of 128 bytes (2 KB) and aligned to its own size. An aligned power-of-two window of 2 KB or less cannot cross a 4 KB edge. Only INCR, up to 256 beats, can cross. The checker still needs the WRAP length and alignment rules.

    Self-Check

    Tick each key point you covered in your answer.

  5. Scale ItSplitting a DMA Transfer into BurstsL2 Mid-LevelL3 Senior

    A DMA must copy 10 KB starting at 0x0000_1F40 on a 64-bit AXI bus. How does it cut the transfer into bursts?

    Reveal the Model Answer

    Cut at every 4 KB boundary first, then at the 256-beat limit. With 8-byte beats, a burst moves at most 2 KB. So here the bursts are 0x1F40 to 0x1FFF (24 beats), then 2 KB bursts of 256 beats, then the tail. Many DMAs also stop at a smaller Max_Transaction_Bytes that the system advertises, or at cache-line multiples. An unaligned start needs a strobed first beat.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer splits the transfer at every 4 KB boundary and at the 256-beat limit.

  6. Prove ItSolve P2.6.1: The Address of Every BeatSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem P2.6.1

What People Get Wrong

Common wrong answers and why they fail. Run It shows the wrong belief failing on a real simulator.

Missed Corner

"Compute the end as start + beats × size and flag it if its page differs from the start page."

That is the address one past the last byte, so a legal burst ending exactly at 0x0FFF is flagged. In the twin, 8 × 4 bytes at 0x0FE0 and 64 × 4 at 0x1F00 are legal. The buggy check says CROSS for both.

Run It

The off-by-one check flags two legal bursts that end exactly on a 4 KB edge. The fixed check compares the pages of the first and last byte.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: FAIL INCR 8 x 4 bytes at 00000fe0: checker says CROSS, burst is legal PASS INCR 8 x 4 bytes at 00000ff0: checker says CROSS, burst is illegal FAIL INCR 64 x 4 bytes at 00001f00: checker says CROSS, burst is legal
See the Fix
module tb;
  localparam bit BUGGY = 0;   // 1: the check uses the address one past the last byte
  function automatic bit crosses(int unsigned start, int beats, int nb);
    int unsigned last = (start / nb) * nb + beats * nb - (BUGGY ? 0 : 1);
    return (start >> 12) != (last >> 12);
  endfunction
  // legal: what the burst really is (first and last byte in one 4 KB page or not)
  task automatic check(int unsigned start, int beats, int nb, bit legal);
    string verdict, truth, mark;
    bit flagged = crosses(start, beats, nb);
    if (flagged) verdict = "CROSS"; else verdict = "ok";
    if (legal) truth = "legal"; else truth = "illegal";
    if (flagged == !legal) mark = "PASS"; else mark = "FAIL";
    $display("%s INCR %0d x %0d bytes at %h: checker says %s, burst is %s", mark, beats, nb, start, verdict, truth);
  endtask
  initial begin
    check(32'h0fe0, 8, 4, 1);    // last byte 0x0fff
    check(32'h0ff0, 8, 4, 0);    // last byte 0x100f
    check(32'h1f00, 64, 4, 1);   // 256 bytes, last byte 0x1fff
    $finish;
  end
endmodule

Prints: PASS INCR 8 x 4 bytes at 00000fe0: checker says ok, burst is legal PASS INCR 8 x 4 bytes at 00000ff0: checker says CROSS, burst is illegal PASS INCR 64 x 4 bytes at 00001f00: checker says ok, burst is legal

Half-Truth

"Because the maximum burst is 4 KB."

A 4 KB maximum size alone would still let a burst span two subordinates. The rule is about not crossing the boundary, wherever the burst starts.

Source AMBA AXI Protocol Specification IHI 0022L §A3.1 Transaction request; §A3.1.3 Maximum number of bytes in a transaction

Learn It, Then Prove It