Where we left off
In Part I we saw why asynchronous reset distribution turns into a schedule killer on large SoCs. The reset synchronizer gives us a clean deassertion edge that is aligned to the clock. The trouble starts right after it. That one edge has to reach every flop in the domain inside a single clock cycle, late enough to meet removal and early enough to meet recovery. On a large, spread-out reset network in an advanced process, OCV squeezes that window from both sides.
I promised an architecture that removes the need to close timing on the reset lines. Here it is, and the whole idea fits in one line: we stop racing the clock. We turn the clock off, move the reset, and turn the clock back on.
Stop racing the clock
Recovery and removal are both checks against an active clock edge. Recovery asks that the reset is released early enough before the next edge. Removal asks that it is released late enough after the previous one. Both checks exist only because a clock edge is nearby.
So take the clock edge away. Gate the clock to the block off for several cycles before the reset is released, and keep it off for several cycles after. Now the release lands in a dead zone. Every flop in the domain sees its reset pin go inactive while its clock pin sits quietly at zero. When the clock finally comes back, its first edge reaches flops that left reset a long time ago. All of them, together.
Notice what changed. In Part I the reset tree had to fit inside a window shorter than one cycle of the functional clock. Now it has to fit inside a window that we choose, counted in cycles of a slow reference clock. We went from fighting for picoseconds to spending cycles, and cycles are cheap.
The sequence
Figure 1 shows the whole sequence, with the same clock and signal names as the block diagram in Figure 2. The bottom three rows show the timing check, now against a large multicycle path. rst_n is the active-low asynchronous reset going to the block. cg_en is the enable of the clock gate at the root of the block’s clock tree. core_clk is what comes out of that gate and feeds the block. The rows above them are the supporting cast. por_n starts the sequence, ref_clk is the free-running reference that is alive before any PLL locks, and clk_sel moves mux_clk from ref_clk to pll_clk at the end.
Figure 1. Reset release with the clock stopped. Shaded stretches and break marks stand for many cycles that are not drawn out.
- Assert and wait. A pulse on
por_ndropsrst_n, which stays low for at least the PLL lock time, taken from the PLL datasheet. Somewhere in that waitpll_lockrises andpll_clkbecomes usable. Before this point we do not care how many cycles go by, which is why they are shaded instead of drawn out. - Flush. The gate opens for
N_FLUSHcycles (40 here, in blue) while reset is still asserted. A few dozen slow clock edges reach the block. Flops with a synchronous reset, pipeline stages with no reset at all, and IPs that want clock edges under reset all get what they need. Then the gate closes. - Quiet before. The gate stays closed for
N_REMcycles (80 here, in red), and only then isrst_nreleased. The last clock edge any flop saw is at leastN_REMreference cycles old. Removal is met by construction. - Quiet after. The gate stays closed for another
N_RECcycles (80 here, in orange) with the reset now released. The next clock edge is at leastN_RECcycles away. Recovery is met by construction. - Switch. With the gate still closed,
clk_selmovesmux_clkfromref_clktopll_clkthrough the glitch-free mux. Skip this step to stay on the slow clock. - Run. Open the gate. The first
core_clkedge reaches flops that left reset many cycles ago.
The architecture
All of this is driven by one small clock and reset controller that lives entirely on ref_clk (Figure 2). It has five pieces.
Figure 2. The clock and reset controller. Everything inside the dashed box is small, local and timed the usual way.
- A local reset synchronizer for the controller itself. Yes, the circuit from Part I. It is still the right tool when the domain is a few dozen flops sitting next to each other.
- A cycle counter and a small state machine. The state machine loads the counter with the length of each state and moves on when it expires. That is the entire brain.
- A registered
rst_noutput. It comes straight out of a flop, so it cannot glitch, and it drives the block’s reset tree. - A glitch-free clock mux that selects between
ref_clkand the PLL clock. - A latch-based clock gate at the root of the block’s clock tree, with a two-flop synchronizer on its enable.
The state machine is short enough to fit in a table.
| State | rst_n | cg_en | Stays for | Why |
|---|---|---|---|---|
| ASSERT | 0 | 0 | PLL lock time | Reset reaches every flop, PLL settles |
| FLUSH | 0 | 1 | N_FLUSH cycles | Clock edges under reset |
| QUIET 1 | 0 | 0 | N_REM cycles | The last clock edge ages out |
| QUIET 2 | 1 | 0 | N_REC cycles | The release settles across the reset tree |
| SWITCH (optional) | 1 | 0 | Mux switching time | Select the PLL clock with the gate closed |
| RUN | 1 | 1 | Until the next reset | Normal operation |
One controller can serve several domains. Give each domain its own clock gate and reset output, and let the same counter release them in whatever order the system needs.
Sizing the counters
Call the ref_clk period T. Call t_clk the insertion delay from the clock gate to a flop’s clock pin, and t_rst the delay from the rst_n flop to that same flop’s reset pin. The two quiet windows have to satisfy:
NREM · T > tmaxclk − tminrst + tremoval
NREC · T > tmaxrst − tminclk + trecovery
One more item goes on the removal side. The two-flop synchronizer on the gate enable makes the gate close two cycles later than the state machine thinks, so count two extra cycles in N_REM. On the recovery side the same latency only helps.
Take a 50 MHz reference as an example. T is 20 ns, so 80 cycles is 1.6 µs. Give two of those cycles to the enable synchronizer and removal still has 1.56 µs. The delays on the right side of both inequalities are a few nanoseconds, even on a big block. These numbers are not close, and that is the point. No OCV derate, no extra corner and no late ECO on the reset tree can move a few nanoseconds across a window more than a microsecond wide.
So do not optimize the counters. The whole sequence here costs 200 reference cycles, which is 4 µs at 50 MHz, once per reset. Nobody will miss it.
N_FLUSH is set by function, not by timing. Use the deepest chain that needs clock edges under reset, or the largest “hold reset for N clocks” requirement among the IPs in the block. Make all three values parameters. If you want a safety net in silicon, make them programmable with conservative defaults.
What happens to STA
As long as N_REM and N_REC are tens of cycles, the path from the rst_n flop to every asynchronous pin in the block no longer needs a recovery or removal check. So we cut it:
# rst_n only moves while core_clk is stopped, by design
set_false_path -through [get_pins u_crg/rst_n]
The same cut covers any flop that uses this reset synchronously, for the same reason. If N_REM and N_REC are small, a cut is not justified. Then we need two multicycle paths on the same pins instead, one for recovery and one for removal, with the multipliers taken from the counter values. Either way the relationship is guaranteed by design and not by the placer.
Two much cheaper checks replace the timing check.
- A structural check. Every flop reset by
rst_nmust be clocked from the tree under this clock gate. One flop on a different, free-running clock breaks the guarantee for that flop. A lint rule or a short netlist script catches it. - A functional check. Assert on the controller that
core_clkhas no edge inside the two quiet windows around arst_nrelease. The controller is tiny, so simulation or formal closes this quickly.
A few things are still timed the usual way: the controller’s own logic on the slow ref_clk, its local reset synchronizer, the enable into the clock gate, and the transition and capacitance limits on the reset tree. Report the worst insertion delay of the reset tree once and compare it to N_REC times T. Then stop looking at it.
What it costs
- The clock must be stoppable at the root. An IP that needs clock edges under reset still fits. That is why we have the flush period. During FLUSH we enable the clock to the IP while its reset is still asserted.
- Each domain needs a root clock gate. Most low-power designs already have one.
- Scan mode bypasses the controller. The tester drives the reset directly and forces the gate transparent through its test enable pin.
- Warm/soft resets can reuse the same sequence. Go one step further and close the gate before asserting the reset too. Then a reset never lands on a running clock in either direction, which also keeps it from landing in the middle of a memory write.
So, hell or heaven?
A counter, a small state machine and a clock gate. That is the price of never opening a recovery or removal report for the big reset domains again. The reset tree stops being a timing problem and becomes a slow net with a transition limit.
The catch is the one from Part I. This has to be decided before the design starts, because a root clock gate and a reset sequencer are architecture, not an ECO. Decide it up front and reset timing closure becomes a non-event. Leave it for later and you already know which of the two places you are headed.