Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 37 ยท Sequential Logic

Synchronous and Asynchronous Reset in Verilog

Compare synchronous and asynchronous resets in Verilog, write registers with active-low reset, learn reset recovery, a reset synchronizer, and when a register needs no reset at all.

When power turns on, flip-flops hold random values. A reset forces every register into a known starting state. Without one, a simulation shows x forever and real hardware starts in an undefined state. This lesson compares the two reset styles, shows the Verilog for each, and explains the practical rules that real teams follow.

Synchronous reset

A synchronous reset is checked only at the clock edge:

VERILOG
always @(posedge clk) begin
    if (rst)
        q <= 8'd0;
    else
        q <= d;
end

The sensitivity list contains only the clock. If rst goes high between edges, nothing happens until the next edge. The reset is simply one more input to the next-value logic (a multiplexer or an AND gate in front of d), so it works with any flip-flop, including ones that have no dedicated reset pin.

Pros: glitches on rst between edges are ignored, timing analysis treats it like any data path, and it works in FPGAs naturally. Cons: needs a running clock to take effect, and costs a little logic in front of every flip-flop.

Asynchronous reset

An asynchronous reset acts immediately, without waiting for a clock edge:

VERILOG
always @(posedge clk or negedge rst_n) begin
    if (!rst_n)
        q <= 8'd0;
    else
        q <= d;
end

The sensitivity list names both the clock and the reset edge. The if tests the reset first, then the normal behavior goes in the else. Most ASIC cell libraries include flip-flops with a dedicated asynchronous clear pin, so this costs no extra gates.

Pros: resets even with no clock, uses dedicated pins. Cons: a noisy reset line can reset the design at the wrong time, and releasing the reset near a clock edge can cause metastability (see below).

Active-low names

By convention, active-low signals end with _n: rst_n is asserted when it is 0 (!rst_n). Active-low resets are the default in many ASIC flows because they are safe against a floating line (a broken wire should not fire a reset). Keep to one polarity across a project.

Comparison

Synchronous Asynchronous
Sensitivity list posedge clk posedge clk or negedge rst_n
Takes effect Next clock edge Immediately
Needs a clock Yes No
Extra logic Gate in the D path None (uses dedicated pin)
Glitch sensitivity Low High
Release timing Normal data path Recovery/removal check needed

Reset release and metastability

When an asynchronous reset is released very close to a clock edge, a flip-flop can see a violation (the reset "recovery" and "removal" times, analogous to setup and hold) and go metastable. The standard fix is a reset synchronizer: assert asynchronously, release synchronously.

VERILOG
module reset_sync (
    input  wire clk,
    input  wire arst_n,      // raw asynchronous reset
    output wire rst_n        // clean reset for the design
);
    reg [1:0] sr;
    always @(posedge clk or negedge arst_n) begin
        if (!arst_n) sr <= 2'b00;
        else         sr <= {sr[0], 1'b1};
    end
    assign rst_n = sr[1];
endmodule

While arst_n is low, both flip-flops are cleared at once. When it is released, a 1 shifts in and takes two clock cycles to reach rst_n, so the design sees a release that is aligned to the clock.

Resetting everything?

Not every register needs a reset.

  • Control state (FSM state, counters, valid flags) needs one so the design starts in a known state.
  • Data path registers (pipeline data, large memories) often do not: the data is meaningless until valid, and a reset on every flip-flop adds area and routing.
  • Registers without a reset start as x in simulation; make sure the design never uses them before they are written, and that a valid flag guards them.

Initial values (FPGA)

FPGAs load flip-flop initial values from the bitstream, so reg q = 1'b0; or initial q = 0; is synthesizable on most FPGA flows, but it is not portable to ASICs. Teams that target both use an explicit reset.

Mixing styles

Do not mix reset styles on the same register, and avoid using the same signal as both an asynchronous reset and ordinary data. A common practice is "async assert, sync release" for the whole design, using the reset synchronizer above at the top level.

Stand-in: two reset styles compared (C)

This stand-in (not Verilog) simulates one register under both styles. The reset pulse (rst_n low) happens between clock edges at step 3, so you can see the asynchronous version clear immediately while the synchronous one waits for the next edge.

C Stand-in: synchronous vs asynchronous reset (C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

After the reset pulse, q_async is already 0 while q_sync still holds its old value: a short pulse that never overlaps a clock edge is invisible to a synchronous reset.

Stand-in: reset synchronizer timing (C)

C Stand-in: asynchronous assert, synchronous release (C)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

The release of arst_n at cycle 2 is seen by the first flip-flop at that edge and reaches sr1 (the design reset) one edge later, at cycle 3, so the design leaves reset aligned to the clock.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which sensitivity list describes an asynchronous active-low reset?

    The reset edge must be in the list so the block runs even without a clock edge.
  2. 2. What is a clear advantage of a synchronous reset?

    It is sampled only at the clock edge, so narrow glitches between edges do no harm.
  3. 3. What does a reset synchronizer do?

    Immediate assertion, clock-aligned release avoids recovery/removal violations.
  4. 4. Which registers typically do NOT need a reset?

    Data that is meaningless until valid can skip the reset, saving area; control state must be reset.

Summary

  • A reset puts registers into a known state; control registers need it, many data registers do not.
  • Synchronous reset is checked only on the clock edge; asynchronous reset acts at once and lists the reset edge in the sensitivity list.
  • Active-low resets use the _n suffix.
  • Releasing an async reset near a clock edge risks metastability; use a reset synchronizer (async assert, sync release).
  • FPGA initial values are not portable to ASIC flows.

Next: Counters and Shift Registers