Reset Architecture: Assert Asynchronously, Release Synchronously

Reset looks like the simplest signal on a chip: press, let go, start. It has two halves with opposite needs. Going in must work with no clock at all. Coming out must wait for the clock.

You Will Be Able To

  • Explain why a reset must take hold while the clock is stopped.
  • Explain what goes wrong when a reset is released at any moment.
  • Draw the two-flop reset synchronizer, and say when its output falls and when it rises.
Lesson
S5.5
Time
26 min
Runs on
Your browser
Check
6 questions

A board starts on the second press of its reset button, and almost never on the first. The edge on the reset pin looks clean on the scope. So the fault is not in the edge. Where is it?

Before You Start

You need Reset and Interrupts in One Picture: a reset puts storage into a known starting state. You need Reset Sources and the Reset Cause Register: where a reset comes from, and what a reset domain is.

You need Planning Clock Domains: a clock domain, metastability and the two-flop synchronizer. This page builds a close relative of that synchronizer.

It helps to know that a clock can be stopped on purpose. Dividers and Clock Gates shows how.

Five questions this page answers
Question
1Why must a reset take hold while the clock is stopped?
2What goes wrong when a reset is released at any moment?
3What feeds the D input of the first flip-flop of a reset synchronizer?
4When does the local reset fall, and when does it rise?
5Why does a reset synchronizer have two flip-flops and not one?

The Idea: In at Once, Out on the Clock

A reset has two moments. To assert a reset is to put the flip-flops into reset. To release a reset is to let them run again. The two moments need opposite things.

Asserting must work with no clock. At power-up no clock runs yet. Later a clock may be gated off, or its source may have failed. If the reset needed a clock edge to act, those flip-flops would keep whatever they held. An output pin could go on driving a wrong level. So a flip-flop gets a second input that clears it at once, with no clock. That is an asynchronous reset.

Releasing is the dangerous half. When the reset lets go, each flip-flop starts work on its next clock edge. The reset reaches different flip-flops at slightly different times, because wires differ in length. Suppose the release lands just before a clock edge for one flip-flop and just after it for its neighbour. One starts a whole cycle before the other. Two bits that should move together now disagree.

There is a second danger at the same instant. A release very close to a clock edge can leave a flip-flop metastable: neither 0 nor 1 for a while.

The cure is to release the reset in step with the clock. A small circuit, the reset synchronizer, does it. Its output falls at once when reset is asserted. It rises only just after a clock edge, so the release has almost a whole period to reach every flip-flop.

New Words

New words on this page
WordMeaning
Assert a resetDrive the reset to the level that holds flip-flops in their starting state.
Release a resetTake that level away, so the flip-flops run again from their next clock edge.
Synchronous resetA reset that a flip-flop looks at only on a clock edge, like data.
Clear inputAn input of a flip-flop that forces its output to 0 at once, for as long as it is driven.
Asynchronous resetA reset wired to the clear input. It forces the flip-flop at once, with no clock.
Reset synchronizerTwo flip-flops that pass on an assertion at once and delay a release until it is in step with the clock.
Local resetThe output of a reset synchronizer: the reset that the flip-flops of one clock domain use.
Recovery timeHow long before a clock edge a release must arrive, for the flip-flop to start cleanly on that edge.
Removal timeHow long after a clock edge a reset must stay asserted, for that edge to be ignored cleanly.

Many resets are asserted by a 0. The name of such a signal often ends in n, as local_n does in the lab.

One Picture: The Reset Synchronizer

The Reset Synchronizer, One Wire at a TimeStep through the schematic. It ends with the whole circuit: two flip-flops between the reset pin and the flip-flops of one clock domain.
  • Pads
  • Control / FSM
  • Memory
  • Clock / reset
  • Processor
The Reset Synchronizer, One Wire at a TimeStep through the schematic. It ends with the whole circuit: two flip-flops between the reset pin and the flip-flops of one clock domain. component Reset pin low means: reset ispressed component Constant 1 a wire tied to thesupply component First flip-flop D input: the constant1. Clear input: the pin component Second flip-flop D input: the outputof the first. Clearinput: the pin component Clock of thedomain the clock of theflip-flops being reset component Local reset the output of thesecond flip-flop. Lowmeans reset component Flip-flops of thedomain each has a clear input clearclearDQ to DclockclockQclear
  1. component First flip-flopD input: the constant 1. Clear input: the pin
    • Q to D → Second flip-flop
  2. component Second flip-flopD input: the output of the first. Clear input: the pin
    • Q → Local reset
  3. component Clock of the domainthe clock of the flip-flops being reset
    • clock → First flip-flop
    • clock → Second flip-flop
  4. component Reset pinlow means: reset is pressed
    • clear → First flip-flop
    • clear → Second flip-flop
  5. component Constant 1a wire tied to the supply
    • D → First flip-flop
  6. component Local resetthe output of the second flip-flop. Low means reset
    • clear → Flip-flops of the domain
  7. component Flip-flops of the domaineach has a clear input
  1. Two flip-flops in a row

    Start with two flip-flops on the clock of the domain. The output of the first feeds the D input of the second.

  2. The pin clears both

    The reset pin goes to the clear input of both. A clear input needs no clock. When the pin goes low, both outputs go to 0 at once.

  3. A constant 1 at the front

    The D input of the first flip-flop is tied to 1. While the pin is low the clear wins, and the flip-flop holds 0. After the pin goes high, the next clock edge loads the 1.

  4. One more edge

    The second flip-flop takes that 1 on the edge after. The pin may go high close to an edge and upset the first flip-flop. The second one gives it a whole period to settle.

  5. The output is the local reset

    Only the second flip-flop drives the flip-flops of the domain. Its output falls at once when the pin falls. It rises only just after a clock edge.

  6. The whole circuit

    Into reset: straight from the pin, with no clock. Out of reset: two clock edges after the pin lets go, in step with the clock.

Read the diagram as text
  • Reset pin: low means: reset is pressed
  • Constant 1: a wire tied to the supply
  • First flip-flop: D input: the constant 1. Clear input: the pin
  • Second flip-flop: D input: the output of the first. Clear input: the pin
  • Clock of the domain: the clock of the flip-flops being reset
  • Local reset: the output of the second flip-flop. Low means reset
  • Flip-flops of the domain: each has a clear input
  • Reset pin → First flip-flop: clear
  • Reset pin → Second flip-flop: clear
  • Constant 1 → First flip-flop: D
  • First flip-flop → Second flip-flop: Q to D
  • Clock of the domain → First flip-flop: clock
  • Clock of the domain → Second flip-flop: clock
  • Second flip-flop → Local reset: Q
  • Local reset → Flip-flops of the domain: clear

The two-flop reset synchronizer. A chip has one for each clock domain: the next page shows why.

The Smallest Example, Worked by Hand

Take a clock with a period of 10 ns. It rises at 5, 15, 25 and 35 ns. The reset pin is low from the start and goes high at 14 ns. Follow the circuit of the picture, edge by edge.

The reset synchronizer after a release at 14 ns, by hand
Clock edgeReset pinFirst flip-flopLocal resetFlip-flops of the domain
5 ns00, held by the clear0held in reset
15 ns1, since 14 nsloads the constant: 10: it loads the old 0 of the firstheld in reset
25 ns11loads the 1: rises just after 25 nsstill held: at this edge the reset was low
35 ns111all start on this edge

The local reset rose just after the edge at 25 ns. The next edge is at 35 ns. So the release has almost 10 ns to travel to every flip-flop of the domain.

Now wire the pin straight to two neighbours, with no synchronizer. The wire to neighbour A is short. The wire to neighbour B is 2 ns longer. The release reaches A at 14 ns and B at 16 ns. The clock edge at 15 ns falls between the two.

The pin wired straight to two neighbours, by hand
Clock edgeNeighbour A (release at 14 ns)Neighbour B (release at 16 ns)
15 nsreleased 1 ns ago: startsstill in reset: does not start
25 nssecond cycle of workstarts, one cycle late

Think of A and B as two bits of one state machine. For one cycle, the machine is in a state that its designer never drew.

One Release, Seen on Four Clock EdgesStep through the samples. Each column is one rising edge of the clock. The pin is released at 14 ns.
0123edge at (ns)5152535neighbour A, pin wired straightneighbour B, pin wired straightfirst flip-floplocal resetneighbour A, local resetneighbour B, local reset
Scroll horizontally ↔
  1. Edge 0

    The reset pin is low. Everything is held at 0.

  2. Edge 1

    The pin went high at 14 ns. Wired straight, neighbour A has started and neighbour B has not. The first flip-flop of the synchronizer has taken its 1.

  3. Edge 2

    The local reset goes high just after this edge. Neither neighbour behind it has started yet.

  4. Edge 3

    Both neighbours behind the local reset start on the same edge.

Drawn from the four "edge" rows of the lab. For a neighbour, 1 means that it has left reset and started work.

The Rules

  1. Rule 1: A reset is asserted asynchronously.

    It must take hold with the clock stopped, slow or not yet started.

  2. Rule 2: A reset is released synchronously.

    The release must be in step with the clock of the flip-flops it feeds.

  3. Rule 3: A reset synchronizer is two flip-flops, both cleared by the incoming reset.

    The D input of the first is tied to 1. The second takes the output of the first.

  4. Rule 4: Only the second flip-flop drives the local reset.

    The first may be metastable for a moment after a release. Nothing else may see it.

  5. Rule 5: The local reset falls at once and rises on the second clock edge after the release.

    The wait is between one and two periods of the clock.

  6. Rule 6: The local reset must still reach every flip-flop in time.

    It must arrive a recovery time before the next edge. A timing tool checks this, as it checks data.

The timing check of rule 6 has a page of its own in the timing track: Recovery and Removal.

Sources for These Rules

Flip-flops with synchronous and with asynchronous reset: Sutherland, RTL Modeling with SystemVerilog for Simulation and Synthesis, sections 8.1.5.2 and 8.1.5.3. The reset synchronizer, and the recovery time of a flip-flop with an asynchronous reset: section 8.1.5.6.

Metastability and the two-flop synchronizer: Harris and Harris, Digital Design and Computer Architecture, ARM edition, sections 3.5.4 and 3.5.5.

One bus standard states rules 1 and 2 for its own reset: Arm AMBA AHB Protocol Specification, IHI 0033 issue C, section 7.1.2.

The names recovery and removal for the two timing checks: IEEE 1800-2023, clauses 31.3.4 and 31.3.5.

The clock of 10 ns, the release at 14 ns and the wire of 2 ns are numbers of our lab.

Now Run It

The lab at the end of this page has three parts. Part 1 stops a clock and presses reset. Part 2 wires the pin straight to two neighbours. Part 3 puts a reset synchronizer in between.

Printed by the lab on Icarus. Times are in nanoseconds. Each "edge" row shows the values just after that clock edge.
loaded: sync_ff=1 async_ff=1
clock stopped, reset pressed: sync_ff=1 async_ff=0
one clock edge later: sync_ff=0 async_ff=0
edge t=5 raw=00 stage1=0 local_n=0 synced=00
pad released t=14
edge t=15 raw=10 stage1=1 local_n=0 synced=00
edge t=25 raw=11 stage1=1 local_n=1 synced=00
edge t=35 raw=11 stage1=1 local_n=1 synced=11
pad pressed t=38
3 ns later: raw=00 local_n=0 synced=00

Rule 1 at work, in the second row. The clock has stopped and reset is pressed. The flip-flop with a synchronous reset still holds its 1. The one with an asynchronous reset is at 0. Only when an edge finally comes, in the third row, does the first one clear.

Rule 2 broken, in the row at 15 ns: raw=10. Neighbour A has started and neighbour B has not. The pin was released 1 ns before that edge.

Rules 3 to 5 at work, in the same rows. At 15 ns stage1 is 1. At 25 ns local_n is 1 and both neighbours behind it still show 00. At 35 ns they show 11: both start on one edge.

Rule 1 again, in the last two rows. The pin goes low at 38 ns, between two edges. Three nanoseconds later everything is at 0. No clock edge was needed.

This lab leaves things out. A simulator of 0 and 1 cannot show metastability, and it has no recovery time. So the row raw=10 shows two flip-flops that start a cycle apart. It does not show the electrical danger of rule 6.

Why It Is Built This Way

Design choiceThe alternativeWhat the choice buys, and costs
Assert with no clockA synchronous reset everywhereReset works at power-up and with a stopped clock. Every flip-flop needs a clear input, and its release must be timed.
Release through two flip-flopsWire the pin straight to every clear inputOne clean release for the whole domain. The domain starts one to two periods later.
Two flip-flopsOne flip-flopA period for the first to settle. One more period of waiting.
D of the first tied to 1Feed the pin into DThe pin is used only as a clear. Nothing depends on the level of the pin at a clock edge.

The Trap: A Clean Edge on the Pin

Back to the board that starts on the second press. Its reset pin was wired straight to every clear input. The scope showed a clean edge, and that was true. The edge was clean at the pin.

Inside, the release took 14 ns to reach one flip-flop of a counter and 16 ns to reach the next. Most presses let go far from a clock edge, and nothing happened. Some let go just before one. Then one bit of the counter started a cycle early, and the chip began in a state that leads nowhere.

A second press moves the release to another moment. It usually misses the edge. That is why the fault looks random and why pressing again seems to fix it.

The reverse mistake is as real. A team makes every reset synchronous to be safe. Then a clock source fails in the field. Reset is the one signal meant to recover the chip, and it now needs the clock that failed.

At Scale

This page1 clock, 1 synchronizer
A phone chiphundreds of clocks and resets

This section looks ahead. One synchronizer and one clock become a reset network across a whole chip.

  1. One synchronizer for each clock

    A release made for one clock is at a random moment for another. The next page gives each clock domain its own.

  2. A tree of buffers

    One local reset may feed a hundred thousand flip-flops. It is spread through buffers, like a clock, and timed to every leaf.

  3. An order of release

    Some blocks must be running before others start. The last page of this module puts the releases in order.

  4. Flip-flops with no reset

    Wide data registers are often left without a reset to save area. Their first value must then never be used before it is written.

Try It

Run the lab. It has three parts: a clock that has stopped, the pin wired straight to two neighbours, and the same neighbours behind a reset synchronizer.

Move the release from 14 ns to 12 ns: change the delay before "pad_n = 1" from 10 to 8. Which rows change?

Give the second wire of part 2 a delay of 0 in place of 2. Does the row at 15 ns still show 10?

Names Printed by the Lab
NameMeaning
sync_ff, async_ffTwo flip-flops that hold a 1. The first has a synchronous reset, the second an asynchronous reset.
edge t=One row for each rising edge of the clock, with the values just after that edge.
rawTwo neighbours with the pin wired straight to their clear inputs. 1 means: this one has started.
stage1The first flip-flop of the reset synchronizer.
local_nThe local reset: the output of the second flip-flop. 0 means reset.
syncedThe same two neighbours, cleared by the local reset.
pad released, pad pressedThe times at which the reset pin goes high and low. The lab calls the pin pad_n.
RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: loaded: sync_ff=1 async_ff=1 clock stopped, reset pressed: sync_ff=1 async_ff=0 one clock edge later: sync_ff=0 async_ff=0 edge t=5 raw=00 stage1=0 local_n=0 synced=00 pad released t=14 edge t=15 raw=10 stage1=1 local_n=0 synced=00 edge t=25 raw=11 stage1=1 local_n=1 synced=00 edge t=35 raw=11 stage1=1 local_n=1 synced=11 pad pressed t=38 3 ns later: raw=00 local_n=0 synced=00

Check Yourself

Predict the outputIn this run the pin is released at 16 ns. The clock rises at 5, 15, 25 ns and so on. The run ends when both neighbours behind the synchronizer have started. What is the last row the lab prints?
`timescale 1ns/1ns
module tb;
  logic pad_n = 1;                             // the reset pad. 0 means: reset is pressed

  // Part 1. Two flip-flops that hold a 1, on a clock that has stopped.
  logic slow_clk = 0;                          // moved by hand below, then left alone
  logic sync_ff = 0, async_ff = 0;
  always_ff @(posedge slow_clk)                // synchronous reset: looked at only on a clock edge
    if (!pad_n) sync_ff <= 0; else sync_ff <= 1;
  always_ff @(posedge slow_clk or negedge pad_n)   // asynchronous reset: acts at once
    if (!pad_n) async_ff <= 0; else async_ff <= 1;

  // Parts 2 and 3. A clock of 10 ns: rising edges at 5, 15, 25 ns and so on.
  logic clk = 0;
  always #5 clk = ~clk;

  // Part 2. The pad wired straight to two neighbours. One wire is 2 ns longer than the other.
  wire raw_a = pad_n;
  wire #2 raw_b = pad_n;
  logic a_raw, b_raw;                          // 1 means: this flip-flop has left reset
  always_ff @(posedge clk or negedge raw_a) if (!raw_a) a_raw <= 0; else a_raw <= 1;
  always_ff @(posedge clk or negedge raw_b) if (!raw_b) b_raw <= 0; else b_raw <= 1;

  // Part 3. The reset synchronizer: two flip-flops, both cleared by the pad.
  // The D input of the first is tied to 1. Only the second drives the local reset.
  logic stage1, local_n;
  always_ff @(posedge clk or negedge pad_n)
    if (!pad_n) begin stage1 <= 0; local_n <= 0; end
    else begin stage1 <= 1; local_n <= stage1; end
  // The same two wires, now fed by the local reset.
  wire sync_a = local_n;
  wire #2 sync_b = local_n;
  logic a_sync, b_sync;
  always_ff @(posedge clk or negedge sync_a) if (!sync_a) a_sync <= 0; else a_sync <= 1;
  always_ff @(posedge clk or negedge sync_b) if (!sync_b) b_sync <= 0; else b_sync <= 1;

  bit watch;
  always @(posedge clk) if (watch) begin
    $strobe("edge t=%0d raw=%b%b stage1=%b local_n=%b synced=%b%b", $time, a_raw, b_raw, stage1, local_n, a_sync, b_sync);
    #1 if (a_sync && b_sync) $finish;
  end

  initial begin
    #1 slow_clk = 1; #1 slow_clk = 0;          // one edge loads a 1 into both flip-flops
    $display("loaded: sync_ff=%b async_ff=%b", sync_ff, async_ff);
    pad_n = 0;                                 // reset is pressed. slow_clk does not move
    #1 $display("clock stopped, reset pressed: sync_ff=%b async_ff=%b", sync_ff, async_ff);
    slow_clk = 1;
    #1 $display("one clock edge later: sync_ff=%b async_ff=%b", sync_ff, async_ff);
    watch = 1;
    #12 pad_n = 1;                           // the pad is released at 16 ns
    $display("pad released t=%0d", $time);
    #200 $finish;
  end
endmodule
ConceptWhy must a reset take hold while the clock is stopped?
ConceptThe reset pin is wired straight to two neighbours and released at any moment. What can go wrong?
ConceptWhat feeds the D input of the first flip-flop of a reset synchronizer?
ConceptWhen does the local reset fall, and when does it rise?
ConceptWhy does a reset synchronizer have two flip-flops and not one?

Common Mistakes

Wrong Make every reset synchronous, to be safe.

A flip-flop whose clock has stopped never sees the reset.

Fix Assert with no clock. Release in step with the clock.

Wrong Wire the reset pin straight to every clear input.

The release reaches neighbours on different sides of a clock edge.

Fix Pass it through a reset synchronizer and use only the local reset.

Wrong Use the first flip-flop of the synchronizer as a reset.

It may be metastable just after a release.

Fix Only the second flip-flop drives anything.

Remember

  • A reset is asserted asynchronously: it must take hold with no clock.
  • A reset is released synchronously: in step with the clock of the flip-flops it feeds.
  • A reset synchronizer is two flip-flops cleared by the reset, the first with its D input tied to 1.
  • The local reset falls at once and rises on the second clock edge after the release.

Practice

Report a problem with this page