Reset Crossings and the Gate-Level View
A reset that reaches one side of a connection and not the other changes signals the other side reads as data. That is a reset-domain crossing. And a netlist simulated with unknown values tells a different story from the RTL. This lesson shows both on ap_soc.
You Will Be Able To
- Spot a reset-domain crossing and say what the receiving side may see.
- Name the usual guards: one reset for both sides, an alive level, safe reset values, quiet before reset.
- Read an RTL run beside a gate-level run and explain where unknown values differ.
- Say what a structural reset-domain tool and gate-level simulation each add.
- Lesson
- V9.6
- Time
- 26 min
- Runs on
- Your browser
- Check
- 5 questions
A reset of the core alone, raised in the middle of a program, made the bench's bus checkers stop the run twice. This lesson shows why, and how a netlist sees reset differently from RTL.
- Processor
- Bus
- Clock / reset
- Data
- Control
- A manager reset alone
A reset of the core alone cuts the core's transfer in half, while the fabric still waits for its end.
- A sender reset alone
A warm reset of the system side changes req while the always-on side keeps running.
- The guard
The bridge sends alive with req, keeps its payload unreset and resets its ack synchronizer to 1. Neither side acts on what the reset made.
Read the diagram as text
- Core: reset by a debug request alone
- Fabric and APB: keep running
- Bridge, system side: warm reset
- Bridge, always-on side: power-on only
- Core → Fabric and APB: a transfer in progress
- Bridge, system side → Bridge, always-on side: req, alive
- Bridge, always-on side → Bridge, system side: ack, answer
Sources: ap_crg.sv, where a debug request resets the core only, and the header of ap_apb_async_bridge.sv (facts 27.11).
Before You Start
Read Domain Crossings at Chip Level first. Reset crossings in RTL are taught in Reset Across Clock Domains and Reset Domain Crossing.
| Question | |
|---|---|
| 1 | What is a reset-domain crossing? |
| 2 | What can a reset of one side do to the other side of a connection? |
| 3 | How does the always-on bridge stay safe when its system side is reset? |
| 4 | Why can a netlist show unknown values where the RTL shows a number? |
| 5 | What do a structural reset tool and gate-level simulation each add? |
The Idea: A Reset Is a Change of Value
To the flop it clears, a reset is a reset. To a flop in another reset domain that samples it, it is just a change of value, at a moment nobody chose. A request toggle that falls in reset looks like a request. A manager that drops its transfer in reset looks like a broken bus. That is a reset-domain crossing.
The guards are few. Reset both sides together, so there is no other side. Or send a level that says "I am out of reset", synchronized, and ignore the crossing while it is low. Or give the receiving flops a reset value that is safe to see. Or stop traffic before the reset.
The gate-level view adds a second question. RTL resolves an unknown in an if-statement to one branch; a netlist of gates may turn it into many unknown bits. A reset that should give known values everywhere, and does in RTL, may not in gates.
New Words
| Word | Meaning |
|---|---|
| Reset domain | The flops cleared by one reset signal. |
| Reset-domain crossing (RDC) | A path between flops of two reset domains, where one may be reset while the other runs. |
| Alive level | A level the sender raises while out of reset. The receiver synchronizes it and ignores what a reset makes. |
| Quiesce | Stop traffic before a reset, so no transfer is in progress when it comes. |
| Gate-level simulation | Simulating the synthesized netlist of cells instead of the RTL. |
| X-pessimism | A netlist making a value unknown where the real circuit would give a known one. |
| X-optimism | RTL making a value known where the real circuit could give either. |
The Smallest Example: A Reset That Sends a Request
A sender toggles one flop for each request; the receiver takes each edge after two flops. The sender's toggle is reset by its warm reset; the receiver never is. One request is sent, then the sender is reset while its toggle is 1, then a second request is sent. Count with the receiver.
| Event | Toggle | An edge? | Taken |
|---|---|---|---|
| request 1 | 0 → 1 | yes | 1 |
| the sender's reset | 1 → 0 | yes, nobody sent it | 2 |
| request 2 | 0 → 1 | yes | 3 |
Three requests taken, two sent. The guard costs one more crossing: the sender's alive flag, reset with the toggle and synchronized the same way. The reset's edge then arrives with alive already low.
The Rules
Rule 1: List every path between reset domains.
For each, ask: can one side be reset while the other runs? If not, it is safe by construction.
Rule 2: Guard each path that can.
An alive level, a safe reset value, or quiet before the reset. The always-on bridge uses all three.
Rule 3: Test a reset of each domain alone, while traffic runs.
Raise it at many moments. The bench's bus checkers then catch a transfer cut in half.
Rule 4: Find the paths with a structural tool too.
A reset-domain tool lists every flop that one reset can change and another domain samples. This site has none; the inventory lists the reset rows.
Rule 5: Simulate the netlist where reset and unknowns meet.
Gate-level runs show values the RTL resolved too kindly, and reset that does not reach every flop.
Rule 6: Read a gate-level X with care.
An X may be pessimism of the cells, not a real bug. Replay the binary values to decide.
Sources for These Rules
The bridge's three guards are in the header of ap_apb_async_bridge.sv. They are unreset payload flops, an ack synchronizer reset to 1, and alive.
A debug request resets the core only: reset_sources.sv; the request is tied low on v1.5: facts 27.11. The AHB-to-APB bridge drives PWDATA from HWDATA: ap_ahb_apb_bridge.sv. RISC-V's reset of selected harts alone: RV-DBG 3.14.2 (hartreset).
An X to 0 change is a falling edge (negedge): IEEE 1800-2023, 9.4.2. Verilator starts variables at 0 unless asked to randomize them (its +verilator+rand+reset option).
Gate-level simulation spreads X from synchronizers and timing checks; switching off X from timing violations: MEHTA-DV 8.6 (p188 to p189).
The recorded RTL and netlist run of ap_ahb_rom: tools/fixtures/soc-gate-waves.json (facts 27.20).
The Lab: A Core Reset in the Middle of a Transfer
The firmware of V9.1 ran again with a debug reset at chosen moments, counted in cycles after the core first left reset. As V9.1 said, only the bench can raise this reset on v1.5. At most moments it was harmless. At two, recorded here, it struck in the middle of a bus transfer:
+reset_debug=300: RULE stable broken at edge 324: PWDATA changed from 0x30 to 0x0 inside a transfer
+reset_debug=300: RULE hwdata_hold broken at soc_tb.manager[2].hold_data: HWDATA changed during an extended write
+reset_debug=300: RULE hwdata_hold broken at soc_tb.target[3].hold_data: HWDATA changed during an extended write
+reset_debug=310: RULE trans_change broken at edge 334: NONSEQ changed to IDLE during a wait stateIn the first run the reset came 300 cycles in. The core was writing a console byte, 0x30, to ap_sysctl over the APB bridge. The bridge passes the AHB write data straight to PWDATA. So when the core's reset dropped its write data to 0, PWDATA changed while the APB transfer still ran. The AHB checker reports the same event one layer up, at the core's port and at the bridge: HWDATA changed during an extended write. With the reset 310 cycles in, the core's transfer was waiting, and it changed to IDLE in the middle of the wait. AHB and APB both forbid that. The fabric was not reset, so it saw a manager break the rules.
This is rule 3 in action, and it found a hazard of this design at this revision. On ap_soc v1.5 a reset of the core alone is unsafe while the core's bus port is busy. v1.5 is safe only because its debug request is tied low. A revision that connects it must quiesce the port first, or reset the fabric with the core. The RISC-V debug specification defines a reset of the cores alone. Any chip that offers it faces the same question.
Now the gate-level view. The boot ROM's read data register was simulated as RTL and as a generic netlist. The address was held, and the select made unknown at cycle 2:
| Cycle | Select | Address | RTL data | Netlist data |
|---|---|---|---|---|
| 0 | 0 | 0x00000000 | 32 bits X | 32 bits X |
| 1 | 1 | 0x00000000 | 0x55555553 | 0x55555553 |
| 2 | x | 0x00000000 | 0x55555553 | 16 bits X |
| 3 | 1 | 0x00000004 | 0xaaaaaaac | 0xaaaaaaac |
| 4 | 1 | 0x00000004 | 0xaaaaaaac | 0xaaaaaaac |
| 5 | 0 | 0x00000004 | 0xaaaaaaac | 0xaaaaaaac |
| 6 | 0 | 0x00000004 | 0xaaaaaaac | 0xaaaaaaac |
At cycle 2 the RTL kept the word 0x55555553. The netlist made 16 bits X: every bit that was 1. Its multiplexer of AND and OR gates, with an unknown select and equal inputs, gives X. The real circuit gives a known 1. That is X-pessimism, rule 6: replaying either value of the select on the netlist gives the word back.
Why It Is Built This Way
Why does the bridge not reset its payload flops? A copy in progress on the always-on side must see no change if the system side is reset in the middle. Unreset flops hold still; that is the safe value.
Why reset the ack synchronizer to 1? After a warm reset of the system side, the always-on side may still hold ack high from the transfer it was finishing. Starting from 1, the system side waits for a real 0 before it begins again.
Why is the guard of the example above only a start? There, alive and the toggle settle on the same edge, because the simulation has no metastability. In silicon two separate synchronizers may settle an edge apart, as V9.5 showed. If alive arrives one edge late, the reset's edge is taken again. A real design gives alive a margin, for example one more flop on the toggle's path. Or it uses levels, as the bridge does: a reset then drives them to the value that means "no request".
Traps
The first trap is testing resets only of the whole chip. Every warm reset of ap_soc resets the bus and the DMA together, so no crossing between them is ever exercised. Raise each partial reset on its own, at many moments.
The second is treating every gate-level X as a bug, or every one as noise. Some are pessimism of the cells; some are a flop that reset never reaches. Replay the binary values: if both give the same known result, it is pessimism.
The third is a two-state simulator at time 0. Verilator, as the chip bench runs it, starts every variable at 0. A flop whose asynchronous reset is already 0 at time 0 sees no falling edge. So it keeps 0 until its first clock edge, even when its reset value is 1. In silicon an asynchronous reset acts on its level, so the flop holds its reset value at once. A four-state simulator starts the reset at X, and X to 0 counts as a falling edge. Problem V9.4.2 meets this: its checker looks at the gates when the bus leaves reset, not during it.
At Scale
This section looks ahead. ap_soc has a handful of reset domains.
Many reset domains
Large chips reset clusters, accelerators and interfaces separately. Each pair is a set of crossings to list, guard and test.
Structural reset tools
Reset-domain checks run with the clock-crossing tools (MEHTA-DV 8.7 names the clock-crossing ones). They list the paths; the team adds guards or waivers.
Gate-level with timing
Late in a project, the netlist runs with delays from layout. Synchronizer flops then raise timing violations, and teams switch off the X they would spread (MEHTA-DV 8.6).
Try It
Run it: each request the receiver took, and the totals.
Find the request taken while the sender was in reset.
Set guarded to 1. Which line disappears?
receiver took a request at 77 ns receiver took a request at 287 ns receiver took a request at 525 ns sent 2, taken 3Check Yourself
Common Mistakes
Wrong Test resets only of the whole chip.
Paths between domains that reset together are never stressed; partial resets are the risky ones.
Fix Raise each domain's reset alone, while traffic runs.
Wrong Let a receiver act on every edge from a domain with its own reset.
The sender's reset makes edges nobody sent.
Fix Guard with a synchronized alive level or a safe reset value.
Wrong Call every X in a gate-level run a bug.
The netlist may be pessimistic where the circuit is known.
Fix Replay the binary values and compare.
Remember
- A reset is a change of value to every domain it does not reach: a reset-domain crossing.
- Guards: one reset for both sides, a synchronized alive level, safe reset values, quiet before reset.
- A reset of the core alone, mid-transfer, broke bus rules on ap_soc; the chip ties that request low.
- Gate-level runs show X the RTL hides; replay binary values to tell pessimism from a bug.