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.
| Question | |
|---|---|
| 1 | Why must a reset take hold while the clock is stopped? |
| 2 | What goes wrong when a reset is released at any moment? |
| 3 | What feeds the D input of the first flip-flop of a reset synchronizer? |
| 4 | When does the local reset fall, and when does it rise? |
| 5 | Why 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
| Word | Meaning |
|---|---|
| Assert a reset | Drive the reset to the level that holds flip-flops in their starting state. |
| Release a reset | Take that level away, so the flip-flops run again from their next clock edge. |
| Synchronous reset | A reset that a flip-flop looks at only on a clock edge, like data. |
| Clear input | An input of a flip-flop that forces its output to 0 at once, for as long as it is driven. |
| Asynchronous reset | A reset wired to the clear input. It forces the flip-flop at once, with no clock. |
| Reset synchronizer | Two flip-flops that pass on an assertion at once and delay a release until it is in step with the clock. |
| Local reset | The output of a reset synchronizer: the reset that the flip-flops of one clock domain use. |
| Recovery time | How long before a clock edge a release must arrive, for the flip-flop to start cleanly on that edge. |
| Removal time | How 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
- Pads
- Control / FSM
- Memory
- Clock / reset
- Processor
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
| Clock edge | Reset pin | First flip-flop | Local reset | Flip-flops of the domain |
|---|---|---|---|---|
| 5 ns | 0 | 0, held by the clear | 0 | held in reset |
| 15 ns | 1, since 14 ns | loads the constant: 1 | 0: it loads the old 0 of the first | held in reset |
| 25 ns | 1 | 1 | loads the 1: rises just after 25 ns | still held: at this edge the reset was low |
| 35 ns | 1 | 1 | 1 | all 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.
| Clock edge | Neighbour A (release at 14 ns) | Neighbour B (release at 16 ns) |
|---|---|---|
| 15 ns | released 1 ns ago: starts | still in reset: does not start |
| 25 ns | second cycle of work | starts, 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.
- Edge 0
The reset pin is low. Everything is held at 0.
- 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.
- Edge 2
The local reset goes high just after this edge. Neither neighbour behind it has started yet.
- 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
Rule 1: A reset is asserted asynchronously.
It must take hold with the clock stopped, slow or not yet started.
Rule 2: A reset is released synchronously.
The release must be in step with the clock of the flip-flops it feeds.
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.
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.
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.
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.
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=00Rule 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 choice | The alternative | What the choice buys, and costs |
|---|---|---|
| Assert with no clock | A synchronous reset everywhere | Reset 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-flops | Wire the pin straight to every clear input | One clean release for the whole domain. The domain starts one to two periods later. |
| Two flip-flops | One flip-flop | A period for the first to settle. One more period of waiting. |
| D of the first tied to 1 | Feed the pin into D | The 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 section looks ahead. One synchronizer and one clock become a reset network across a whole chip.
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.
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.
An order of release
Some blocks must be running before others start. The last page of this module puts the releases in order.
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
| Name | Meaning |
|---|---|
| sync_ff, async_ff | Two 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. |
| raw | Two neighbours with the pin wired straight to their clear inputs. 1 means: this one has started. |
| stage1 | The first flip-flop of the reset synchronizer. |
| local_n | The local reset: the output of the second flip-flop. 0 means reset. |
| synced | The same two neighbours, cleared by the local reset. |
| pad released, pad pressed | The times at which the reset pin goes high and low. The lab calls the pin pad_n. |
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=00Check Yourself
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.