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.

One Domain Reset While Its Neighbour RunsTwo places where a reset reaches one side of a connection and not the other.
  • Processor
  • Bus
  • Clock / reset
  • Data
  • Control
One Domain Reset While Its Neighbour RunsTwo places where a reset reaches one side of a connection and not the other. processor Core reset by a debugrequest alone bus Fabric and APB keep running bus Bridge, systemside warm reset clock reset Bridge, always-onside power-on only a transfer inprogressreq, aliveack, answer
  1. processor Corereset by a debug request alone
    • a transfer in progress → Fabric and APB
  2. bus Fabric and APBkeep running
  3. bus Bridge, system sidewarm reset
    • req, alive → Bridge, always-on side
  4. clock reset Bridge, always-on sidepower-on only
    • ack, answer → Bridge, system side
  1. 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.

  2. A sender reset alone

    A warm reset of the system side changes req while the always-on side keeps running.

  3. 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.

Five questions this page answers
Question
1What is a reset-domain crossing?
2What can a reset of one side do to the other side of a connection?
3How does the always-on bridge stay safe when its system side is reset?
4Why can a netlist show unknown values where the RTL shows a number?
5What 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

New words on this page
WordMeaning
Reset domainThe 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 levelA level the sender raises while out of reset. The receiver synchronizes it and ignores what a reset makes.
QuiesceStop traffic before a reset, so no transfer is in progress when it comes.
Gate-level simulationSimulating the synthesized netlist of cells instead of the RTL.
X-pessimismA netlist making a value unknown where the real circuit would give a known one.
X-optimismRTL 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.

What the receiver sees
EventToggleAn edge?Taken
request 10 → 1yes1
the sender's reset1 → 0yes, nobody sent it2
request 20 → 1yes3

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

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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:

The bench's checker lines (edges are the bench's own cycle numbers); each run ended with reason "checker".
+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 state

In 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:

ap_ahb_rom, RTL against gates
CycleSelectAddressRTL dataNetlist data
000x0000000032 bits X32 bits X
110x000000000x555555530x55555553
2x0x000000000x5555555316 bits X
310x000000040xaaaaaaac0xaaaaaaac
410x000000040xaaaaaaac0xaaaaaaac
500x000000040xaaaaaaac0xaaaaaaac
600x000000040xaaaaaaac0xaaaaaaac

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

ap_soc~12 blocks
Phone-class SoChundreds of blocks

This section looks ahead. ap_soc has a handful of reset domains.

  1. Many reset domains

    Large chips reset clusters, accelerators and interfaces separately. Each pair is a set of crossings to list, guard and test.

  2. 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.

  3. 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?

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: receiver took a request at 77 ns receiver took a request at 287 ns receiver took a request at 525 ns sent 2, taken 3

Check Yourself

Predict the outputThe receiver is now guarded by the synchronized alive level. What is the last line printed?
// A request crosses from clk_sys to clk_aon as a level that toggles once for each request (a pulse
// synchronizer). The sender's toggle flop is reset by the warm reset; the receiver is always on.
// guarded = 1: 1 makes the receiver ignore the crossing until the sender has been out of reset for two of its clocks.
module tb;
  localparam bit GUARDED = 1;
  logic clk_sys = 0, clk_aon = 0, warm_n = 1, send = 0;
  logic toggle = 0, alive = 0;                               // sender, clk_sys, reset by the warm reset
  logic [2:0] sync = 0; logic [1:0] alive_s = 0;              // receiver, clk_aon, never reset here
  int sent = 0, taken = 0;
  initial begin #5; forever begin clk_sys = 1; #5; clk_sys = 0; #5; end end
  initial begin #7; forever begin clk_aon = 1; #7; clk_aon = 0; #7; end end
  always @(posedge clk_sys or negedge warm_n)
    if (!warm_n) begin toggle <= 0; alive <= 0; end
    else begin alive <= 1; if (send) begin toggle <= ~toggle; sent++; end end
  always @(posedge clk_aon) begin
    sync <= {sync[1:0], toggle};
    alive_s <= {alive_s[0], alive};
    if ((sync[2] != sync[1]) && (!GUARDED || alive_s[1])) begin taken++; $display("receiver took a request at %0t ns", $time); end
  end
  initial begin
    #42 send = 1; #10 send = 0;                              // one request
    #200 warm_n = 0; #30 warm_n = 1;                          // a warm reset of the sender alone
    #200 send = 1; #10 send = 0;                              // a second request
    #200 $display("sent %0d, taken %0d", sent, taken);
    $finish;
  end
endmodule
ConceptIn the lab, what broke when the core alone was reset mid-transfer?
ConceptWhy does the always-on bridge reset its ack synchronizer to 1?
ConceptIn the recorded gate-level run, which bits became X?
ConceptWhat does a structural reset-domain tool add to simulation?

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.

Practice

Report a problem with this page