Module 5: Behavioral Verilog for Synthesis · 5.5 Modeling Flip-Flops and Registers

Reset Strategies: Synchronous and Asynchronous

At power-up, physical flip-flops initialize to indeterminate logic levels. An unreset state machine can start in an illegal state, and counters can start at arbitrary counts. A reset network initializes every register to a known state before normal operation begins. Section 3.2 discussed physical reset hardware. This article examines Verilog implementation patterns.

Synchronous Reset

In a synchronous reset architecture, the reset signal does not appear in the sensitivity list:

always @(posedge clk) begin
    if (!rst_n)
        q <= 1'b0;
    else
        q <= d;
end

The register updates only on the active clock edge. The synthesis tool infers a multiplexer in front of the D input. The multiplexer routes logic 0 when rst_n is active low:

  • Spurious glitches on rst_n between clock edges do not affect the stored value.
  • The reset pulse width must exceed one clock period to guarantee detection.
  • The multiplexer adds logic delay to the combinational data path.

Asynchronous Reset

In an asynchronous reset architecture, the reset edge appears directly in the sensitivity list:

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

The register clears immediately when rst_n transitions low, regardless of the clock signal state:

  • The circuit resets even if the system clock has not yet started or stabilized.
  • Standard cell libraries provide dedicated asynchronous clear pins, eliminating the input multiplexer.
  • The reset deassertion transition must satisfy setup and hold constraints relative to the clock.

If rst_n deasserts within the setup or hold window of the active clock edge, the flip-flop can become metastable. This failure mechanism is known as the reset-recovery and reset-removal problem.

Asynchronous Assertion with Synchronous Deassertion

Industry designs combine the benefits of both approaches. The reset asserts asynchronously for immediate startup and releases synchronously to prevent timing violations.

A two-stage reset synchronizer implements this strategy (Figure 1):

module reset_synchronizer (
    input  wire clk,
    input  wire async_rst_n,    // External input pin
    output wire sync_rst_n      // Internal design reset
);
    reg [1:0] sync_ff;

    always @(posedge clk or negedge async_rst_n) begin
        if (!async_rst_n)
            sync_ff <= 2'b00;                   // Immediate asynchronous assertion
        else
            sync_ff <= {sync_ff[0], 1'b1};      // Synchronous release across two clock edges
    end

    assign sync_rst_n = sync_ff[1];
endmodule

When async_rst_n falls low, both flip-flops clear immediately. Internal signal sync_rst_n asserts low without waiting for a clock edge. When async_rst_n rises high, a logic 1 shifts through the two registers across two consecutive clock edges. If the first register experiences metastability during deassertion, the second stage provides settling time. Downstream design logic connects only to sync_rst_n.

Synchronous and asynchronous reset
Figure 1: A mux in front of D, or the flip-flop's own clear pin

Active-Low Reset Polarity

Standard cell libraries typically use active-low reset inputs (rst_n). Active-low signals connect directly to hard macro pins without requiring inverters. In addition, external pull-up resistors maintain stable non-asserted states during disconnected conditions.

Use active-low reset signals by default in ASIC designs. For FPGA architectures, review the target family hardware documentation. Some FPGA slices include native active-high synchronous reset resources. Maintain consistent reset polarity across the entire design hierarchy.

Practice Exercise

Implement a 4-bit counter using both reset styles. Simulate both designs with reset deasserted near a clock edge, and observe the waveform in GTKWave.

Solution
module counter_sync_rst (
    input  wire       clk, rst_n,
    output reg  [3:0] count
);
    always @(posedge clk) begin
        if (!rst_n) count <= 4'b0000;
        else        count <= count + 1'b1;
    end
endmodule

module counter_async_rst (
    input  wire       clk, rst_n,
    output reg  [3:0] count
);
    always @(posedge clk or negedge rst_n) begin
        if (!rst_n) count <= 4'b0000;
        else        count <= count + 1'b1;
    end
endmodule

In the simulation waveform, the asynchronous counter clears immediately when rst_n falls low. The synchronous counter retains its count until the next rising clock edge, delaying reset response by up to one clock cycle.

The next article examines clock enables and register load signals, and explains why designers avoid manual clock gating in RTL.

← Inferring Flip-Flops Clock Enables and Load Signals →