Release Order and Reset in the Middle of Work
A reset falls at once and lets go in steps. Check the steps edge by edge. Then check what a reset does to work in progress: a bus transfer, a DMA copy, a line of output.
You Will Be Able To
- Explain why a chip releases its resets in a fixed order, and what breaks if it does not.
- Write the rules of a release-order checker that stays silent through every legal reset.
- Predict what a warm reset leaves of a DMA copy that was in progress.
- Say what software must assume after a reset that struck in the middle of work.
- Lesson
- V9.2
- Time
- 26 min
- Runs on
- Your browser
- Check
- 5 questions
Two resets released in the wrong order still end with both high, so an end-state test passes. This lesson checks the order edge by edge, and pulls the reset pin in the middle of a DMA copy.
- Cycle 3
The pin's reset arrives. The bus and the core fall in the same cycle, with no clock.
- Cycle 29
26 cycles later the bus leaves reset, on a rising edge of clk_sys, through its two synchronizer flops.
- Cycle 31
The core follows 2 cycles later: its first fetch finds a bus that already runs.
Recorded on ap_soc v1.5 with the bench's sample window (Verilator 5.052 2026-09-05). clk_aon is shown only at the moments clk_sys was sampled.
Before You Start
Read A Test for Every Reset Source first. How a reset is asserted at once and released through flops is taught in Reset Architecture. DMA tests are in Scenarios That Cross Blocks.
| Question | |
|---|---|
| 1 | Why must the bus leave reset before the core? |
| 2 | What rules does a release-order checker hold, and which legal behaviour must it allow? |
| 3 | What happens to a DMA copy when the chip is reset in the middle? |
| 4 | Why is a reset request held until its reset arrives? |
| 5 | What must a test assume after a reset that cut its work short? |
The Idea: Fall Together, Rise in Steps
- Clock / reset
- Bus
- Processor
- Reset
- The bus first
The bus leaves reset 4 edges of clk_aon after the cause has gone.
- Then the core
The core follows 2 edges later, so its first fetch finds a running bus.
Read the diagram as text
- Cause gone: pin, watchdog, software
- Always-on logic: power-on only
- Bus and peripherals: 4 clk_aon edges later
- Core: 2 clk_aon edges after the bus
- Cause gone → Bus and peripherals: stretch, then two clk_sys flops
- Bus and peripherals → Core: then the core
ap_crg.sv: HOLD and HOLD_CORE, each request through ap_reset_sync on clk_sys (facts 27.11).
A reset is asserted with no clock: the moment the cause appears, every flop of the domain is cleared. That is safe, because clearing needs no timing. Letting go is not. Each domain is released on its own clock, through flops, so that all its flops start on the same edge.
Between domains, the order matters. The core's first act is a fetch over the bus. If the core runs before the bus does, that fetch meets a fabric still in reset. ap_soc therefore releases the bus first and the core two cycles of clk_aon later. That order is a requirement, so the chip level checks it at every reset.
Work in progress is the other half. A reset can strike in the middle of a bus transfer, a DMA job or a printed line. Some state is lost, some survives, and the test must know which.
New Words
| Word | Meaning |
|---|---|
| Assert and release | Asserting a reset puts flops into reset; releasing lets them run. ap_soc asserts at once and releases on a clock edge. |
| Release order | The fixed sequence in which domains leave reset. At power-up on ap_soc: the always-on logic, the bus, the core. A warm reset leaves the always-on logic alone. |
| Stretch | How long a warm reset is held after its cause has gone: 4 cycles of clk_aon on ap_soc. |
| Reset request | The level a source raises to ask for a reset. ap_soc holds it until the reset arrives, then the reset clears it. |
| Release-order checker | A passive checker at the reset controller that reports a release in the wrong order, or a reset that never ends. |
| Partial result | What a job leaves behind when a reset stops it: some bytes copied, the rest untouched. |
The Smallest Example: Counting Edges
A warm cause goes away at 100 ns. clk_aon rises at 7, 21, 35 ns and every 14 ns after. The bus waits 4 of its edges and the core 6. Each request then passes two flops on clk_sys, which rises at 5, 15, 25 ns. Work out both release times.
| Step | Time |
|---|---|
| First clk_aon edge after 100 ns | 105 ns |
| Bus request after 4 more edges | 161 ns |
| Two clk_sys edges later: the bus | 175 ns |
| Core request two clk_aon edges after the bus's | 189 ns |
| Two clk_sys edges later: the core | 205 ns |
The example below runs this release; the times are its output.
The core runs 30 ns after the bus here. The distance is 2 cycles of clk_aon, 28 ns. The clk_sys flops round it to 2 or 3 cycles of clk_sys, as the phase of the clocks decides. A checker must accept both.
The Rules
Rule 1: The core is never out of reset while the bus is in reset.
At every edge, resetn_core high with resetn_sys low is a bug. Check it during resets too, not only at the end.
Rule 2: The core leaves after the bus, never in the same edge.
Compare what the core does now with what the bus did at the last edge.
Rule 3: Every reset ends, and every request is taken back.
A request held for ever keeps the chip in reset. A requester outside its own reset never takes it back.
Rule 4: Do not limit the length of a reset the board controls.
The pin is held as long as the board holds it. A checker that limits the length of every reset cries wolf.
Rule 5: A reset in the middle of work must not break a bus rule.
Bus and DMA are reset together, so no transfer is left half done. The bench's AHB and APB checkers watch every edge.
Rule 6: After the reset, assume only what the chip promises.
SRAM keeps its words; registers return to their reset values; a job that was cut is not finished. Software must find out what is left.
Sources for These Rules
The release order and the stretch: tools/soc/ap_soc/rtl/ap_crg.sv (HOLD and HOLD_CORE, ap_reset_sync); facts 27.11.
The request held until its reset: ap_sysctl.sv (SOFT_RESET bit 1, facts 27.9); ap_watchdog.sv ("The reset request stays 1 until the reset arrives").
The bench's bus checkers and the rule "HTRANS is IDLE during reset": the bench README, "The end of a test" (facts 27.12).
SRAM keeps its words through a warm reset: facts 27.9 (ap_ahb_sram: only the wrapper's control flops are reset).
The Lab: A Pin Reset in the Middle of a Copy
The firmware fills 1,024 bytes at 0x8000_4000, clears the destination at 0x8000_6000 and starts one DMA copy. It writes event 0x92 and waits. The bench's table waits for that event, then 300 more cycles, and pulls the reset pin for 200 ns. The program runs again, finds TB_ARG set and reports what the reset left.
EVENT 13562: 00000092
CONSOLE 25829: cause 00000003 dma status 00000000
CONSOLE 26247: copied 00000036 stray 00000000Rule 6 at work: the copy was cut after 54 bytes. The rest of the destination still held the zeros of the clear (stray 0). The DMA's STATUS read 0: not BUSY, not DONE. The reset stopped the job and cleared its record. RESET_CAUSE read 0x03: power-on, then the pin.
Rules 1 and 2 at work, in the waveform at the top. The bus and the core fell together and rose bus first. The bench's AHB and APB checkers watched every edge of the run and found nothing: rule 5.
The reset lasted 26 cycles of clk_sys: 200 ns of the pin, its synchronizer, and the stretch. The core left 2 cycles after the bus, 20 ns. At power-up, lesson V3.2 recorded 30 ns: the same 28 ns of clk_aon, rounded to another number of clk_sys cycles.
Why It Is Built This Way
Why hold a request until its reset arrives? Because the request may come from one clock and the reset controller runs on another. A pulse of one clk_sys cycle could be missed by clk_aon; a level cannot. The reset then clears the requester, so the request ends by itself.
Why reset the DMA with the bus? A manager reset alone, while the fabric runs, can leave a transfer half done on the bus. Resetting both together means no transfer survives the reset at all. V9.6 shows a reset that reaches only part of the chip, and what it breaks.
Traps
The first trap is a checker written for the release at power-up only. It says "once the bus is up, it stays up", and reports at the first warm reset. A release-order checker must hold through every reset, again and again.
The second is a checker that limits how long a reset lasts. The board holds the pin as long as it likes; a test may hold it for a long time on purpose. Limit the length of a request that should end, not of a reset the board controls.
The third is a test that assumes the job it started has finished. After a reset, a DMA job may be cut, and its STATUS says nothing about how far it got. A test that checks the whole destination reports a chip bug that is really its own assumption.
At Scale
This section looks ahead. ap_soc has three release steps.
Long release sequences
Large chips release tens of domains in a planned order: memories, fabrics, clusters, cores, accelerators. The order is a table in the specification, and a checker reads it.
Reset during traffic
Teams raise resets at random moments under heavy traffic. They check that no bus rule breaks and every block comes back clean.
Quiesce before reset
Some chips stop traffic before a warm reset: a handshake that drains the bus. Then the test checks the drain as well.
Try It
Run it: the release times of the bus and the core after one cause.
Count the clk_aon edges between the cause going away and the bus's request.
Change STRETCH to 2. Does the order change, or only the times?
cause gone at 100 ns bus released at 175 ns core released at 205 nsCheck Yourself
Common Mistakes
Wrong Check only that both resets are high at the end.
A wrong order leaves the same end state and races at the first fetch.
Fix Check the order at every edge of every release.
Wrong Limit how long any reset of the bus may last.
The board controls the pin; a long pin reset is legal.
Fix Limit how long a request may outlive its reset.
Wrong Assume a DMA job finished because the chip came back.
A warm reset stops the job and clears its STATUS.
Fix After a reset, find out what is left, then start the job again.
Remember
- Resets fall at once and rise in steps: the bus, then the core; at power-up the always-on logic goes first.
- A release-order checker holds through every reset and allows long resets the board controls.
- A warm reset stops a DMA job and clears its STATUS; SRAM keeps the bytes already copied.
- After a reset in the middle of work, a test finds out what is left before it goes on.