Error Paths

A fabric must say no correctly: to a hole, to a missing register, to a block that cannot answer. Watch an error answer travel back to its manager. See what a DMA job and a queue of transfers do when one step fails, and check the recovery.

You Will Be Able To

  • List every place in ap_soc's fabric that makes an error answer.
  • Read the two-cycle ERROR on a manager's port and say what each cycle is for.
  • Check an error in the middle of a DMA job and of a queue of transfers.
  • Follow every error with an access that must work.
Lesson
V7.6
Time
24 min
Runs on
Your browser
Check
5 questions

A pointer goes wrong in a driver and reads an address no block owns. If the fabric answers ERROR, the bug is caught at once. If it answers OKAY with 0, the driver carries on with a wrong value. The bug turns up hours later somewhere else.

An Error Answer Travelling Back to Its ManagerThe seat's port, one value per cycle: a read of an AHB hole, then a read of an APB hole. Each ends with the two-cycle ERROR.
0123456system cycle10111213141516htransNSEQIDLENSEQIDLEhaddr40000000x10007000xhreadyhrespOKAYERROROKAYERRORAHB holeAPB hole
Scroll horizontally ↔
  1. Cycle 0

    System cycle 10: the seat reads 0x4000_0000. No AHB target owns it, so its own default subordinate takes it.

  2. Cycle 1

    First ERROR cycle: hready low, hresp high. This cycle gives a manager time to cancel what comes next.

  3. Cycle 2

    Second ERROR cycle: hready high, hresp still high. The read is over, as an error.

  4. Cycle 3

    System cycle 13, the very next cycle: a read of 0x1000_7000. The AHB decoder sends it to the bridge, which spends a setup cycle first.

  5. Cycle 5

    The APB multiplexor finds no block, so the bridge turns PSLVERR into the same two-cycle ERROR.

Recorded on ap_soc v1.5, Verilator 5.052 2026-09-05, +core=bfm, from the bench's sample window of the seat's port (record-v7-labs.mjs, section errors).

Before You Start

Read Deadlock, Livelock and Hang Detection, The Default Subordinate and the Two-Cycle Error and Bit Bash, Aliasing and Unmapped Space first.

Five questions this page answers
Question
1Which pieces of ap_soc's fabric make an error answer?
2What do the two cycles of an AHB ERROR do?
3What happens to a DMA job that meets an error halfway?
4What happens to the transfer queued behind an error?
5What must a test check after an error?

The Idea: Saying No Is a Feature

Every transfer that cannot be served must still end, and end as an error. That rule protects software. An error stops a wrong access where it happens; an OKAY with 0 lets it spread.

On ap_soc the error is made in several places, each by its own logic. A hole of the AHB map goes to the manager's own default subordinate. A hole of the APB window goes to the APB multiplexor. A register block refuses an offset with no register. A guard refuses a block whose clock is stopped, and the decoder refuses a block of PD_PER while it is off.

An error from an always-on block makes one more trip. The asynchronous bridge saves PSLVERR on the clk_aon side, together with the read data. It carries both back with the acknowledge, and the fast side turns them into the AHB ERROR. A crossing that drops the saved error bit is a path of its own to test.

Each of those is a path, and each path can break on its own. It can answer OKAY, answer late, or never answer at all. An error test therefore visits every place that can say no, and checks the fabric afterwards.

Every Place the Fabric Says NoFive pieces of logic make an error answer on ap_soc, and one manager can stop its job on an error. Each is its own path to test.
  • Manager
  • Control / FSM
  • Bus
  • Peripheral
  • Power
  • Control
  • Interrupt
Every Place the Fabric Says NoFive pieces of logic make an error answer on ap_soc, and one manager can stop its job on an error. Each is its own path to test. manager A manager seat, DMA or debug control Defaultsubordinate a hole of the AHB map bus APB multiplexor a hole or a reservedpage peripheral Register block no register of thatkind control Clock guard the block's clock isstopped power Power decoder PD_PER is off manager DMA job stops in FAULT ERRORPSLVERR → ERRORPSLVERR → ERRORat onceat onceSTATUS FAULT
  1. manager A managerseat, DMA or debug
  2. control Default subordinatea hole of the AHB map
    • ERROR → A manager
  3. bus APB multiplexora hole or a reserved page
    • PSLVERR → ERROR → A manager
  4. peripheral Register blockno register of that kind
    • PSLVERR → ERROR → A manager
  5. control Clock guardthe block's clock is stopped
    • at once → A manager
  6. power Power decoderPD_PER is off
    • at once → A manager
  7. manager DMA jobstops in FAULT
    • STATUS FAULT → A manager
  1. Holes

    An AHB hole is answered by the manager's own default subordinate; an APB hole or reserved page by the APB multiplexor.

  2. Inside a block

    A register block refuses an offset with no register, a write to a read-only one, a read of a write-only one.

  3. Blocks that cannot answer

    A block with its clock stopped, or in PD_PER while it is off, is never selected. The answer is an error at once, never a wait.

  4. An error mid-job

    A DMA job that meets an ERROR stops and sets FAULT, after the bytes it already moved.

Read the diagram as text
  • A manager: seat, DMA or debug
  • Default subordinate: a hole of the AHB map
  • APB multiplexor: a hole or a reserved page
  • Register block: no register of that kind
  • Clock guard: the block's clock is stopped
  • Power decoder: PD_PER is off
  • DMA job: stops in FAULT
  • Default subordinate → A manager: ERROR
  • APB multiplexor → A manager: PSLVERR → ERROR
  • Register block → A manager: PSLVERR → ERROR
  • Clock guard → A manager: at once
  • Power decoder → A manager: at once
  • DMA job → A manager: STATUS FAULT

Facts 27.6 (one rule for a wrong access) and 27.7 (the fabric); tools/soc/ap_soc/rtl/ap_ahb_default.sv, ap_apb_mux.sv, ap_apb_guard.sv.

New Words

New words on this page
WordMeaning
Error pathThe logic that makes an error answer and carries it back to the manager.
Two-cycle ERRORAHB's error answer: HREADY low with HRESP high, then HREADY high with HRESP high.
PSLVERRAPB's error signal, given with PREADY; the bridge turns it into the AHB ERROR.
Clock guardLogic that answers for a block whose clock is stopped, so no one waits for it.
FAULTThe DMA's STATUS bit for a job that stopped on an error.
Recovery checkAn access that must work, made right after an error.

The Smallest Example: The Transfer Behind an Error

AHB is pipelined: while one transfer is in its data phase, the next one's address is already on the bus. So when an error comes back, the next transfer has started. The two cycles of the ERROR give the manager time to decide what to do with it.

Reads A, a hole, then B
CycleAddress phase (manager cancels)Address phase (manager keeps going)HREADYHRESP
0AA1OKAY
1holehole1OKAY
2BB0ERROR
3IDLEB1ERROR
4BIDLE1OKAY

Worked from the AHB rule (IHI 0033C 5.1.3, Figure 5-1). The example below simulates both ways.

In cycle 2 the manager cannot yet know about the error, so B is on the bus either way. At the clock edge that ends cycle 2 it sees HREADY low with HRESP high. A manager that cancels drives IDLE in cycle 3, so the bus takes IDLE. It shows B again in cycle 4. A manager that keeps going leaves B on the bus, and B is taken in cycle 3.

AHB gives the manager this time to cancel, but does not make it cancel. For the remaining beats of a burst it says outright that going on is acceptable. Which one a manager does is its own choice, and a checker must know that choice.

The Rules

  1. Rule 1: Visit every place that can say no.

    The default subordinate, the APB multiplexor, each register block, the clock guard and the power decoder are separate logic. Each has its own bugs.

  2. Rule 2: Check the ERROR itself, not only that the run went on.

    The answer must be ERROR, with its two cycles. A path that answers OKAY with 0 is the bug a hole test exists for.

  3. Rule 3: Follow every error with an access that must work.

    An error that leaves the fabric or the block stuck passes a test that stops at the error.

  4. Rule 4: Check the work around an error in the middle of a job.

    A DMA job that fails halfway must keep the bytes before the error, write none after it, and say FAULT.

  5. Rule 5: Give every manager its errors.

    Each manager has its own default subordinate and its own way of reporting. The seat sees ERROR, the DMA sets FAULT, and the debug manager sets its ERROR bit.

  6. Rule 6: Never wait for a block that cannot answer.

    A stopped or powered-off block is never selected, so its answer is an error at once. Test both, with an ordinary access after.

Sources for These Rules

The two-cycle ERROR, its purpose (time to cancel the next transfer), and that continuing is acceptable: AMBA AHB, IHI 0033C 5.1.3. A default subordinate must answer ERROR for addresses no subordinate owns: IHI 0033C 4.2.1. PSLVERR: AMBA APB, IHI 0024E 3.4.

ap_soc's rule for a wrong access and the costs of each error: facts 27.6 and 27.7. The same sections say no block that cannot answer is waited for. The clock guard: tools/soc/ap_soc/rtl/ap_apb_guard.sv. The slow side's saved answer, read data and error, carried back with the acknowledge: tools/soc/ap_soc/rtl/ap_apb_async_bridge.sv.

Error responses as part of protocol conversion checking: MEHTA-DV 14.2.

The Lab: Errors at the Seat, in a Job, in a Queue

The seat read an AHB hole and an APB hole. Then it stopped GPIO's clock, read GPIO, started the clock again and read GPIO once more.

The lab's rows (record-v7-labs.mjs, section errors). CLK_GATE 0x1D stops bit 1, GPIO's clock; 0x1F starts it again.
core re 40000000 00000000 ffffffff 00000000 0 1
core re 10007000 00000000 ffffffff 00000000 0 1
core w 10004014 0000001d ffffffff 00000000 0 1
core re 10001000 00000000 ffffffff 00000000 0 1
core w 10004014 0000001f ffffffff 00000000 0 1
core r 10001000 00000000 0000ffff 00000000 0 1
The answers at the seat's port
AccessAnswerLatency (cycles)
Read 0x4000_0000 (AHB hole)ERROR2
Read 0x1000_7000 (APB hole)ERROR3
Write CLK_GATE = 0x1DOKAY2
Read GPIO DIR, clock stoppedERROR3
Write CLK_GATE = 0x1FOKAY2
Read GPIO DIR, clock runningOKAY2

One run on the good chip; the table passed.

The trace at the top is the first two rows. The default subordinate answers the AHB hole with the two-cycle ERROR, 2 cycles in all. The APB hole costs 3: one setup cycle in the bridge, then the same ERROR (rule 2). The stopped GPIO answers like a hole, at once, in 3 cycles. It works again as soon as its clock runs (rules 3 and 6).

The default subordinate, ap_ahb_default.sv. The first ERROR cycle is the cycle after a taken transfer. HREADYOUT is low only in that cycle, and HRESP is high in both.
assign hreadyout = !error_first_q;
assign hresp     = (error_first_q || error_second_q) ? ap_ahb_pkg::HRESP_ERROR
error_first_q  <= 1'b0;
error_first_q  <= hsel && hready && htrans[ap_ahb_pkg::ACTIVE_BIT];

Next, an error in the middle of a DMA job. The job copies four bytes to 0x8000_FFFE, two bytes below the end of SRAM.

A job whose destination runs off SRAM (section errors).
core w 80003300 44332211 ffffffff 00000000 0 1
core w 8000fffc 00000000 ffffffff 00000000 0 1
dma copy 80003300 8000fffe 00000004 00000004 0 1
core r 8000fffc 00000000 ffffffff 22110000 0 1
core r 10006014 00000000 00000007 00000004 0 1
core w 10006014 00000006 ffffffff 00000000 0 1
core r 10004000 00000000 ffffffff 2a5310c5 0 1

The job ended in FAULT (STATUS bit 2) after 2 bytes. The word at 0x8000_FFFC then read 0x2211_0000: bytes 0x11 and 0x22 landed in its upper two lanes, and nothing beyond. The table passed, and the read of CHIP_ID after it shows the fabric went on working (rule 4).

Last, an error inside a queue. The seat read SRAM, then the AHB hole, then SRAM again, each address phase on the one before's data phase.

The seat's port around the queued error
CycleAddress phasehreadyhresp
120x8000_30001OKAY
130x4000_00001OKAY
140x8000_30000ERROR
150x8000_30001ERROR
16IDLE1OKAY

From the bench's sample window. The bench marked the hole's row as wrong: rq expects OKAY, and this lab wanted the waveform, not a pass.

In cycle 14, the first ERROR cycle, the seat's next read of SRAM is already on the bus, and it stays there. In cycle 15 the error ends and that read is taken. The seat keeps going rather than cancel: AHB gave it the time and left the choice to it. A checker of a manager that does cancel must expect IDLE in that second ERROR cycle instead.

Why It Is Built This Way

Why does a stopped block answer an error rather than wait for its clock? A block without a clock cannot finish a transfer. A fabric that waited for it would hold the manager, and with it the bus, for ever. An error ends the transfer and lets software see why (facts 27.7).

Why does the DMA keep the bytes it already copied? Undoing them would need a buffer of old values. Stopping at the error and saying FAULT tells software exactly where the job stopped, through the destination it can read.

Traps

The stop-at-the-error trap: the test checks the ERROR and ends. A fabric that answers the error and then locks up passes. Every error row needs an ordinary access after it.

The one-hole trap: the test reads one AHB hole and calls holes done. The APB multiplexor, each register block, the clock guard and the power decoder are separate logic with separate bugs.

The trusted-data trap: software uses the read data of a transfer that answered ERROR. AHB recommends zero there but does not promise anything. Treat the data of an error as meaningless.

The polite-error trap: errors are only tested from the seat. A DMA or a debugger that meets a hole goes through its own default subordinate and its own way of reporting.

At Scale

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc answers every refusal with one kind of error.

  1. Kinds of error

    AXI separates a decode error (no such address) from a subordinate error (the target refused). Tests check that each source gives its own kind.

  2. Firewalls

    Security fabrics refuse a manager that may not reach a window. Each rule of the firewall is an error path, per manager.

  3. Error injection

    Large chips can inject an error on purpose, such as a bad parity. Then they test how software and hardware recover.

Try It

Run it: B is on the bus in the first ERROR cycle. The manager drives IDLE in the second and shows B again after.

Make the manager keep going (the predict question below). When does B finish?

Which of the two does ap_soc's seat do, according to the lab?

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: cycle address phase hready hresp 0 A 1 OKAY 1 hole 1 OKAY 2 B 0 ERROR 3 IDLE 1 ERROR 4 B 1 OKAY 5 IDLE 1 OKAY B finished at cycle 5

Check Yourself

Predict the outputNow the manager keeps B on the bus through the ERROR. What is the last line printed?
// A manager has three reads queued back to back: A, a hole, then B. A default subordinate answers the hole with
// the two-cycle ERROR: HREADY low with HRESP high, then HREADY high with HRESP high. At each clock edge the manager
// looks at HREADY and HRESP. cancel = 0: when it sees the first ERROR cycle, it drives IDLE in the next cycle and
// shows B again after the error (AHB gives it time for this). cancel = 0: it keeps B on the bus.
module tb;
  int queue [$];
  int ap = 1, dp = 0;          // the address phase on the bus, and the transfer in its data phase (0: none)
  bit err1 = 0, err2 = 0;      // the default subordinate: first and second cycle of its ERROR
  bit hready, hresp, done = 0;
  initial begin
    queue.push_back(2); queue.push_back(3);
    $display("cycle  address phase  hready  hresp");
    for (int c = 0; c < 8 && !done; c++) begin
      hready = !err1;
      hresp = err1 || err2;
      $display("  %0d    %-13s  %0d       %s", c, ap == 0 ? "IDLE" : ap == 1 ? "A" : ap == 2 ? "hole" : "B", hready, hresp ? "ERROR" : "OKAY");
      if (hready && dp == 3) begin $display("B finished at cycle %0d", c); done = 1; end
      // the clock edge at the end of cycle c
      err2 = err1;
      err1 = hready && ap == 2;
      if (hready) begin
        dp = ap;
        ap = queue.size() ? queue.pop_front() : 0;
      end else if (0 && hresp) begin
        queue.push_front(ap);  // first ERROR cycle seen: take B back and show IDLE
        ap = 0;
      end
    end
  end
endmodule
ConceptIn the lab, why did the read of a stopped GPIO cost the same as an APB hole?
ConceptThe DMA job in the lab stopped in FAULT. What did its destination hold?
ConceptWhat did the seat do with its queued read during the ERROR?
ConceptWhy must an error row be followed by an ordinary access?

Common Mistakes

Wrong End the test at the error.

A fabric that locks up after an error passes.

Fix Make an access that must work right after each error.

Wrong Test one hole and call error paths done.

Each place that says no is separate logic.

Fix Visit holes, missing registers, stopped clocks and powered-off blocks.

Wrong Expect a manager to cancel its next transfer after an ERROR.

AHB gives a manager time to cancel but does not require it.

Fix Know your manager's choice; ap_soc's seat keeps going.

Remember

  • ap_soc says no in five places: the default subordinate, the APB multiplexor, register blocks, the clock guard and the power decoder.
  • An AHB ERROR takes two cycles so the manager can cancel what comes next; ap_soc's seat keeps going.
  • A DMA job that fails halfway keeps the bytes before the error and says FAULT.
  • Every error needs a recovery check: an access that must work, right after.

Practice

Report a problem with this page