Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutRoadmapCareersInternshipsFAQContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
    • Flip-Flops and Registers
      • Edge-Triggered State Elements
      • D Flip-Flop with Asynchronous Reset
      • Synchronous Reset and Register Enable
      • Clock Enable vs Gated Clock
      • A Hold Violation, Worked
    • Counters and Timers
    • Shift Registers and LFSRs
    • Pipelining
    • Stalls, Bubbles and Hazards
    • Retiming
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

←Flip-Flops and Registers
  1. Topics
  2. RTL Design
  3. Sequential Design
  4. Flip-Flops and Registers
  5. Synchronous Reset and Register Enable
On this page

    Part 3 of 9, lesson 3 of 27Part 3 of 9/Sequential/Lesson 3 of 27Intermediate

    Synchronous Reset and Register Enable

    Synchronous reset and enable act at the clock edge, with reset given priority.

    Write the enable check before the reset and the register ignores reset whenever the enable is low, or loads data during reset when it is high. Both pass a casual test and fail in the field.

    After this lesson you can: code a register with synchronous reset and enable, put reset first, and explain which registers need a reset at all.

    Synchronous reset and enable

    A synchronous reset is ordinary D logic evaluated at the clock edge. The sensitivity list holds the clock alone.

    An enable holds the value by reloading Q when disabled. The full module sits under Testbench below.

    Feature

    Implementation

    Cost

    Enable

    A 2:1 mux in front of D (feedback from Q), or a flop cell with a built-in enable

    One mux per bit if the library lacks an enable flop

    Sync reset

    An AND gate on the D input, or a flop with a sync-reset pin

    One gate per bit

    Async reset

    A dedicated reset pin on the flop

    No logic on D, but a larger cell

    The D-input logic of two 8-bit registers, one bit shown. Top: the enable mux feeds the reset AND, so reset wins. Bottom: the reset AND feeds the enable mux, so a low enable bypasses reset.

    Read each panel from d on the left to the flop's D pin; the gate nearest D decides who wins.

    • Top panel: in reg_sync_en the AND sits last. When rst_n is 0, D is 0 whatever the mux chose, so reset overrides both load and hold.

    • Bottom panel: in reg_bad_priority the mux sits last. When en is 0 it picks the Q loop, and the reset AND is not on that path at all.

    • Both: the gates and their count are the same; only the order differs. The order is set by the order of the if tests.

    Reset priority

    Reset is written first so it wins over enable. A reset must work even when the enable is low.

    Checking enable first is a classic bug, but the two shapes fail differently. The nested example below holds while disabled, so it ignores reset when en is 0 yet still clears when en is 1. A flatter chain such as if (en) before reset, as in the check below, instead loads d when en is 1 during reset.

    reg_bad_priority.sv
    1
    2
    3
    4
    5
    6
    7
    8
    // bad-example: enable checked first -> reset is ignored while en = 0
    module reg_bad_priority (input logic clk, rst_n, en, input logic [7:0] d, output logic [7:0] q);
      always_ff @(posedge clk)
        if (en) begin
          if (!rst_n) q <= '0;
          else        q <= d;
        end
    endmodule

    Common mistakes

    Reset only the registers that need a known value: control state, valid bits, pointers. Pure datapath registers that are always loaded before use do not need a reset. Dropping it saves area and routing, and makes the data path easier to retime.

    A synchronous reset requires a running clock. If the clock is gated off or not yet started when you assert reset, nothing happens. Designs that must reset with a stopped clock need an asynchronous reset.

    Check yourself A register is if (en) q <= d; else if (!rst_n) q <= 0;. When en = 0 and rst_n = 0, what happens to q?

    en is checked first and is false, so the else if runs and reset applies. But when en = 1 and rst_n = 0 the register just loads d, ignoring reset. Reset must come first in the priority chain.

    Testbench

    The register with synchronous reset and enable, plus directed checks for priority, load, and hold. After loading nonzero Q, the test asserts reset while disabled: Q must hold before the next rising edge and clear after it. The nested bad-priority module above would retain the nonzero value at that edge. Checks use a 10 ns clock and observe Q 1 ns after the edge, after NBA updates.

    reg_sync_en.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    module reg_sync_en #(parameter int W = 8) (
      input  logic         clk, rst_n, en,
      input  logic [W-1:0] d,
      output logic [W-1:0] q
    );
      always_ff @(posedge clk)
        if (!rst_n)      q <= '0;            // reset has the highest priority
        else if (en)     q <= d;             // load only when enabled
        // else: hold (implicit)
    endmodule
    
    • A synchronous reset is ordinary D logic; the sensitivity list holds the clock alone.

    • Reset is written first so it wins over enable and works even when the enable is low.

    • Reset only control state, valid bits and pointers. A synchronous reset needs a running clock.

    Rule of thumb: reset comes first in the priority chain.

    How this was checked

    Testbench checks use a 10 ns clock and observe Q 1 ns after the edge, after NBA updates. This is an ideal RTL check, not a physical timing measurement.

    • Practice: Synchronous D flip-flop with reset

    • Code lab: Counter with enable hold

    • Interview: run a mock interview on this topic

    Related topics

    • Clock enable vs gated clock

    Previous

    64 / 350

    Next: Clock Enable vs Gated Clock

    Up next

    Up nextClock Enable vs Gated Clock

    Sign in to save progress

    Practice this lessonPrevious lessonReport an error

    See also

    • Edge-Triggered State Elements
    • A Hold Violation, Worked