← Protocols Interviews

Interview Question · Concept

AXI IDs and Response Order

L1 JuniorL2 Mid-Levelaxiidsordering
  • Asked at Qualcomm

The Question

The interviewer asks

What does the AXI ID guarantee about the order of responses? Can read data from two transactions be interleaved?

Reveal the Model Answer

Responses with the same ID come back in request order. Different IDs carry no ordering, so they may complete in any order. Read data of different IDs may be interleaved beat by beat. The beats of one ID are never interleaved with each other. AXI4 write data has no ID and must follow the address order. AXI3 had WID and allowed write interleaving.

Two 4-beat Reads, IDs 1 and 2, Answered Beat by Beat in TurnMeasured on the bench: the memory alternates between the two transactions; each ID's beats stay in order.
ARRExpect ID 1beats still due50515253Managertwo reads openExpect ID 2beats still due60616263Memorytwo banks

Each queue holds what the manager still expects on that ID. A beat with RID 1 can only be the head of queue 1.

01234567891011clkarvalidaridx12xaraddrx100200xrvalidridx12121212rdatax5060516152625363rlastq1000011110111001100010000q2000011110111001100010000
  1. Cycle 1

    ID 1 asks for four beats from 0x100. The manager queues the four values it expects on ID 1.

  2. Cycle 2

    ID 2 asks for four beats from 0x200, one cycle later.

  3. Cycle 4

    The first beat is 50 with RID 1: the head of queue 1, as it must be.

  4. Cycle 5

    The next beat carries RID 2. The memory is interleaving the two transactions, which AXI4 allows between different IDs.

  5. Cycle 6

    RID 1 again, with 51, the new head of queue 1. Within one ID the order never changes.

  6. Cycle 10

    RLAST with RID 1: transaction 1 is complete and queue 1 is empty.

  7. Cycle 11

    RLAST with RID 2 one cycle later. Nothing was mispaired, because every beat was matched against its own queue.

Interleaving mixes transactions; it never reorders the beats of one transaction. The ID on every beat makes that safe.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Junior)

A good junior answer says same-ID responses come back in order. Responses with different IDs may come back in any order.

Cross-Questions

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

WhyWhat IfProve ItCompareScale It

  1. AXI IDs and Response Order
  2. WhyWhy Same-ID Responses Stay in OrderL1 Junior

    Why does AXI force same-ID responses into order at all? Why not let everything reorder?

    Reveal the Model Answer

    A response carries only the ID. With two transactions open on one ID, the manager can pair each response with its request only by order. Ordering per ID also lets a simple manager use one ID and never build a reorder buffer. A capable manager uses several IDs as several in-order streams.

    Self-Check

    Tick each key point you covered in your answer.

  3. What IfInterleaved Read DataL2 Mid-Level

    Two 4-beat reads on IDs 1 and 2 come back as 1, 2, 1, 2, 2, 1, 2, 1. Legal? What must the monitor do?

    Reveal the Model Answer

    Legal: different IDs may interleave beat by beat. Each transaction's beats must still stay in order and end with its own RLAST. The monitor must assemble beats per RID and file each beat under the oldest open read of that ID. It closes the transaction on RLAST. A monitor that assumes contiguous bursts glues beats of different reads together.

    Self-Check

    Tick each key point you covered in your answer.

  4. What IfA Manager That Cannot Take InterleavingL2 Mid-LevelL3 Senior

    A manager team says their block cannot handle interleaved read data. Is that allowed, and what does the spec offer?

    Reveal the Model Answer

    Not if the manager issues different IDs: such a manager must accept interleaved data. The Read_Interleaving_Disabled property only lets it switch interleaving off as an optimisation. That works only when the attached subordinate supports it. So the test plan must cover interleaved returns for every manager that uses several IDs.

    Self-Check

    Tick each key point you covered in your answer.

    Spec Misquote

    "Interleaving is optional, so our manager need not handle it."

    Every manager that issues different IDs must accept it. Disabling it is an optimisation that needs the subordinate to support it.

    Source AMBA AXI Protocol Specification IHI 0022L §A5.6.1 Read data interleaving

  5. Scale ItChoosing IDs for ThroughputL2 Mid-LevelL3 Senior

    A manager uses one ID for everything. The latency of its short reads is terrible whenever a long read is in flight. Why, and what would you change?

    Reveal the Model Answer

    Same-ID responses must return in order, so a short read queues behind a slow one (head-of-line blocking). Give independent streams their own IDs, so the subordinate or interconnect can answer the fast one first. Keep one ID only for accesses that must stay ordered. The cost is reorder storage in the manager and more tracking downstream. Lesson P2.10 measured a fast read waiting seven edges on a shared ID, and three on its own.

    Two Reads with ID 5: The Fast Answer Waits for the Slow OneMeasured on the bench: the second read has its data two cycles after its request and may not send it.
    ARRARRManagerID 5, twice1st2ndSlow pathanswers in 6 cyclesFast pathanswers in 2 cycles

    Both answers carry ID 5. Only their order tells the manager which is which.

    012345678910clkarvalidaridx5xaraddrx40000100xto_slowto_fastfast_readyrvalidridx5xrdataxd050xr_slowr_fast
    1. Cycle 1

      The first read with ID 5 goes to the slow path, which needs six cycles. The manager notes: the first answer on ID 5 is this one.

    2. Cycle 2

      The second read with ID 5 goes to the fast path.

    3. Cycle 4

      The fast path has its data, 50, two cycles later. It may not send it: an older read with ID 5 is still open.

    4. Cycle 8

      The slow answer, d0, leaves first and lands on the first request. The manager has no other way to pair them.

    5. Cycle 9

      Now 50 leaves and lands on the second request. Five cycles of waiting bought the only guarantee the ID can give.

    The read data channel carries the ID and nothing else that names a request. Same ID, same order: that is the whole rule.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer names head-of-line blocking, where a fast response waits behind a slow one, and gives the fix.

  6. CompareA Read Issued Before the Write ResponseL1 JuniorL2 Mid-Level

    Asked if they assume reads and writes share the order

    A manager writes a word, and right after its last W beat it reads the same address with the same ID. Is it guaranteed to see the new value?

    Reveal the Model Answer

    No. AXI never orders a read against a write, whatever the IDs, so the read may return the old value. The manager's tool is to wait for the write's B response before issuing the read. Lesson P2.12 measured exactly this, with a posted write and a six-cycle write latency. The read issued after the last data beat returned the old word.

    Self-Check

    Tick each key point you covered in your answer.

    Misconception

    "Same ID means same ordering stream, so the read waits for the write."

    Same-ID ordering applies within reads and within writes. Read and write channels have no ordering guarantee between them.

    Source AMBA AXI Protocol Specification IHI 0022L §A5.3 Request ordering

  7. Scale ItOrdering a Flag After a BufferL2 Mid-LevelL3 Senior

    A DMA writes a 4 KB buffer, then writes a "done" flag that the CPU polls. How do you make sure the CPU never sees the flag before the data?

    Reveal the Model Answer

    Before writing the flag, wait for the B responses of every buffer write. Only a completion response makes an access observable. Same-ID writes stay in order only to the same location, so one ID does not order the buffer against the flag. A Bufferable B can come from a buffer partway along the path. It then guarantees observability only inside the write's Domain, so the CPU must sit in that Domain.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Mid-Level)

    A good mid-level answer says the manager must wait for every B response before it writes the flag.

  8. Prove ItSolve P2.12.1: The Stale ReadSimulator-graded

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

    Open Problem P2.12.1

  9. Prove ItSolve P2.10.1: The Same-ID Order CheckerSimulator-graded

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

    Open Problem P2.10.1

What People Get Wrong

Common wrong answers and why they fail.

Half-Truth

"AXI is out of order, so the manager must tag and reorder every response."

Only across different IDs. A manager that issues one ID gets everything in order and needs no reordering at all.

Source AMBA AXI Protocol Specification IHI 0022L §A5.1 Transaction identifiers; §A5.3 Request ordering

Spec Misquote

"Write data can be interleaved between IDs just like read data."

Not since AXI4: WID is gone, and write data follows the order of the write addresses.

Source AMBA AXI and ACE Protocol Specification IHI 0022H.c §A5.2.2 Write data ordering; AMBA AXI Protocol Specification IHI 0022L §A5.5 Write data and response ordering

Learn It, Then Prove It