Module 3: Sequential Circuit Design · 3.2 Synchronous vs. Asynchronous Design

The Synchronous Design Discipline

The synchronous design methodology enforces six fundamental rules.

Each rule prevents a specific hardware failure mode. Understanding these rules ensures that static timing analysis tools can verify your digital system.

Rule 1: Store All State in Clocked Flip-Flops

All digital state retained across clock cycles must reside in edge-triggered D flip-flops or synchronous memory arrays.

Do not store state in transparent latches, cross-coupled logic gates, or floating node capacitances. Flip-flop behavior is strictly defined: the output transitions after a clock edge, based on data present during the setup window.

Transparent latches complicate static timing analysis because signals can pass through multiple latches during an active enable period. Keep all sequential state in clocked flip-flops.

Furthermore, all flip-flops within a synchronous block must connect to a single, common clock tree.

Rule 2: Place Pure Combinational Logic Between Registers

A synchronous circuit consists of registers separated by blocks of pure combinational logic (Figure 1).

Register to register
Figure 1: Pure combinational logic placed between synchronous registers

The signal path from one register output to the subsequent register input must be a pure combinational function with bounded propagation delays. Static timing analysis calculates the longest path delay and verifies that it satisfies the clock period.

Do not include internal state, transparent latches, or tri-state conflicts within the combinational path.

Rule 3: Avoid Combinational Feedback Loops

A combinational loop is an electrical path that routes from a logic node back to itself without an intervening edge-triggered flip-flop.

// Incorrect: combinational feedback loop
assign carry_out = (a & b) | (carry_out & (a ^ b));

In this example, carry_out appears on both sides of the Boolean equation.

In silicon, this loop functions as an uncontrolled ring oscillator. The circuit oscillates at a frequency determined by internal wire and gate delays:

$$f_{\text{osc}} \approx \frac{1}{2 t_{\text{loop}}}$$

This oscillation consumes dynamic power and causes intermittent register corruption. If a synthesis compiler reports a combinational loop, you must redesign the logic to insert a register.

Rule 4: Synchronize All External Asynchronous Inputs

Signals originating from outside the clock domain (such as push buttons, external sensors, or independent clock domains) arrive asynchronously.

If an asynchronous signal transitions during the setup or hold window of a flip-flop, the flip-flop can enter metastability. The output voltage can linger at an intermediate level, causing downstream logic gates to sample conflicting logic states.

To prevent metastability propagation, route each external asynchronous input through a two-stage flip-flop synchronizer.

Rule 5: Manage Reset Assertion and Deassertion

A reset signal initializes circuit registers to known values. Digital designs use two reset methodologies:

Synchronous Reset

A synchronous reset acts as a data input:

always_ff @(posedge clk) begin
    if (rst)
        q <= 1'b0;
    else
        q <= d;
end

The reset transition takes effect only on the next rising clock edge. Static timing analysis checks synchronous reset nets as standard data paths. The circuit requires an active clock to perform the reset.

Asynchronous Reset

An asynchronous reset clears the register immediately:

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

Asserting an asynchronous reset is safe at any time. However, deasserting an asynchronous reset requires synchronization. If the reset release occurs during the recovery timing window, the flip-flop can become metastable.

Standard engineering practice uses asynchronous assertion and synchronous deassertion (Figure 2).

Reset synchroniser
Figure 2: Reset synchronizer providing immediate asynchronous assertion and clock-aligned synchronous deassertion

Two flip-flops receive the raw asynchronous reset on their clear pins. When the external reset releases, a constant logic 1 shifts through both stages on clock edges, releasing the reset synchronously.

Rule 6: Use Integrated Clock-Gating Cells

Directly gating a clock net with a standard combinational AND gate causes severe timing failures:

// Incorrect: combinational AND gate on clock path
wire gated_clk = clk & (count == 8'd255);

always_ff @(posedge gated_clk)
    snapshot <= data;

The equality comparator produces intermediate glitches as count bits settle. The AND gate transmits these glitches as false clock pulses, corrupting stored data.

To sample data on a specific condition, apply the condition to the register data path:

always_ff @(posedge clk)
    if (count == 8'd255)
        snapshot <= data;

To reduce dynamic clock power on large register banks, instantiate an Integrated Clock-Gating (ICG) cell:

logic enable_reg;
always_ff @(posedge clk)
    enable_reg <= (count == 8'd254);

ICG icg_inst (.CK(clk), .EN(enable_reg), .GCLK(gated_clk));

always_ff @(posedge gated_clk)
    snapshot <= data;

The internal latch inside the ICG cell samples the enable signal during the clock low phase, preventing false edges.

Example: Resolving an Inferred Combinational Loop

Consider a priority encoder that must retain the previous grant when no requests are active:

// Incorrect: contains a combinational loop
module priority_tracker (
    input  logic [3:0] req,
    output logic [1:0] grant
);
    logic [1:0] last_grant;

    always_comb begin
        casez (req)
            4'b1???: grant = 2'd3;
            4'b01??: grant = 2'd2;
            4'b001?: grant = 2'd1;
            default: grant = last_grant;
        endcase
    end

    assign last_grant = grant;
endmodule

The signal grant feeds back into last_grant, creating a combinational loop.

To resolve the violation, register the fallback value into a synchronous flip-flop:

// Correct: registered sequential feedback
module priority_tracker (
    input  logic       clk,
    input  logic       rst_n,
    input  logic [3:0] req,
    output logic [1:0] grant
);
    logic [1:0] last_grant_reg;

    always_ff @(posedge clk or negedge rst_n) begin
        if (!rst_n)
            last_grant_reg <= 2'd0;
        else
            last_grant_reg <= grant;
    end

    always_comb begin
        casez (req)
            4'b1???: grant = 2'd3;
            4'b01??: grant = 2'd2;
            4'b001?: grant = 2'd1;
            default: grant = last_grant_reg;
        endcase
    end
endmodule

The circuit now uses a valid synchronous register to store previous output states.

Summary of the Six Rules

Rule Requirement Hardware Failure Prevented
1 Store all state in clocked flip-flops Unverified internal states, inaccurate timing reports
2 Place combinational logic between registers Undefined intermediate state transitions
3 Eliminate combinational feedback loops High-frequency oscillation, unpredictable logic values
4 Synchronize external inputs Metastability propagating into core logic
5 Control reset assertion and deassertion Inconsistent initialization, recovery timing violations
6 Use ICG cells for clock gating False clock pulses caused by combinational glitches

Practice Exercises

Problem 1

A synthesis tool reports: Inferred latch for signal state[1] in always_comb. Identify the rule violation, explain the cause, and provide the code correction.

Solution

This warning violates Rule 1 (store all state in clocked flip-flops).

An incomplete case or if statement causes this condition. If a signal is not assigned in every execution path, the compiler infers a transparent latch:

always_comb begin
    case (sel)
        2'b00: state = 4'b0001;
        2'b01: state = 4'b0010;
        2'b10: state = 4'b0100;
        // Missing 2'b11 condition
    endcase
end

To eliminate the latch, assign a default value before the case statement or include a default branch:

always_comb begin
    state = 4'b0000;
    case (sel)
        2'b00: state = 4'b0001;
        2'b01: state = 4'b0010;
        2'b10: state = 4'b0100;
        2'b11: state = 4'b1000;
        default: state = 4'b0000;
    endcase
end

Problem 2

Write a SystemVerilog reset synchronizer module that provides asynchronous reset assertion and synchronous deassertion. Explain the function of each stage.

Solution
module reset_synchronizer (
    input  logic clk,
    input  logic rst_n_async,
    output logic rst_n_sync
);
    logic ff1_q, ff2_q;

    always_ff @(posedge clk or negedge rst_n_async) begin
        if (!rst_n_async) begin
            ff1_q <= 1'b0;
            ff2_q <= 1'b0;
        end else begin
            ff1_q <= 1'b1;
            ff2_q <= ff1_q;
        end
    end

    assign rst_n_sync = ff2_q;
endmodule

When rst_n_async falls to 0, both flip-flops clear immediately, asserting rst_n_sync.

When rst_n_async releases to 1, the first flip-flop samples logic 1. If release occurs near a clock edge, the first stage can become metastable. The second flip-flop allows a full clock period for the first stage to settle, ensuring a clean synchronous release.

Problem 3

Why does the expression wire gated_clk = clk & en_reg; produce errors even when en_reg is the output of a synchronous register?

Solution

The register output en_reg transitions after delay $t_{\text{cq}}$ following a rising clock edge. At that moment, the clock signal is high.

If en_reg transitions from 0 to 1, the output of the AND gate rises mid-cycle, creating an extra clock transition. If en_reg transitions from 1 to 0, the AND gate truncates the current clock pulse. An ICG cell prevents these hazards by updating its enable latch only when the clock is low.

The next article examines the specific failure modes of asynchronous circuits: race conditions, essential hazards, and pulse degradation.

← Clock Signals and How They Are Distributed How Asynchronous Designs Fail →