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

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
    • Low-Power RTL Hub
      • Clock gating done right
      • Safe gating style
      • Power domains, isolation and retention
      • UPF intent every RTL lead should know
    • DFT and Scan Hub
    • Physical Awareness Hub
    • Waveform Debug Hub
    • STA and ECO Hub
    • RTL-to-Implementation Closure
    • DFT-Ready RTL
    • Capstone: Resilient Streaming Peripheral
    • Principal Design Review
    • Senior RTL Interview Questions & Model Answers
  • Glossary and Notation
Loading lesson

‹Low-Power RTL Hub
  1. Topics
  2. RTL Design
  3. Senior & Interview
  4. Low-Power RTL Hub
  5. Clock gating done right

Part 9 · Senior · Senior

Clock gating done right

Intent-driven enables with a latch-based ICG model and a directed hold-and-follow testbench.

On this page

    Why this matters

    A flop whose output never changes still burns clock power every cycle, but gating the clock with a raw AND can emit a runt pulse and corrupt state. The fix is a latch-based gate (ICG) and a clear list of the cycles with no useful work.

    After this lesson you can: list the idle cycles worth gating, explain why a raw AND gate is unsafe, and say when to infer an ICG and when to instantiate one.

    Start from switching activity

    Dynamic power includes clock-pin and internal-node activity. A flop whose Q stays constant can still consume dynamic power while its clock toggles. Clock gating removes clock activity downstream of the gate; a data enable alone does not necessarily do that. Leakage remains even when switching stops.

    The first step is intent: name the cycles with no useful work. Three common sources are listed below.

    • Idle state: the block has nothing to do until the next request.

    • Empty FIFO: no data to consume or no space to produce into.

    • Stalled pipeline: downstream backpressure freezes progress for a cycle.

    The gating window

    A latch-based gate passes the clock only while the enable holds. The diagram samples each rising edge of clk.

    The cycle-sampled view explains state, not pulse shape: adjacent active slots can appear continuously high. The event trace below assumes a 10 ns period and 5 ns high phase, initially disabled.

    Time (ns)

    clk / en

    Raw AND

    Low-latch ICG

    5, rising edge

    1 / 0

    0

    0; latched enable = 0

    7, enable rises during high

    1 / 1

    Rises late: 3 ns runt pulse

    Stays 0; latch closed

    10, falling edge

    0 / 1

    Falls

    Latch opens and records 1

    15, rising edge

    1 / 1

    Rises

    Rises: full pulse begins

    17, enable falls during high

    1 / 0

    Falls early: 2 ns runt pulse

    Stays 1; latch closed

    20, falling edge

    0 / 0

    0

    Falls after full 5 ns pulse; latch records 0

    25, rising edge

    1 / 0

    0

    0

    Watch gated_clk: it copies clk only while en is high, and q moves only on gated edges.

    • Slot 0: en is 0, the gate is shut, and q holds 0.

    • Slot 1: en is still 0, and q is still 0.

    • Slot 2: en is 1, the first gated edge arrives, and q goes to 1.

    • Slot 3: en is still 1, the second gated edge arrives, and q goes to 0.

    • Slot 4: en is 0, the gate is shut, and q holds 0.

    • Slot 5: en is still 0, and q is still 0.

    Inference versus instantiation

    Write a plain enable on a normal register and let the flow map it to a library ICG cell. That keeps the RTL portable across technologies.

    Instantiate a cell only for gates that need special handling, such as a scan override. Never gate with raw AND logic in RTL.

    Style

    Use

    Risk

    Plain enable with always_ff

    Portable functional intent

    Verify mapping to a mux, clock-enable pin or ICG; review gating timing and test control

    Instantiated ICG cell

    Scan override or cells with test pins

    Locks the RTL to one library

    Raw clk & en

    Never

    Glitchy edges with no test path

    Common mistakes

    Common pitfall

    A raw clk & en can emit a runt pulse if en changes during the high phase. Registering en on the rising edge is not sufficient: its Q changes just after that edge, while the clock is high. A characterized ICG holds its gating decision throughout the high phase with a low-transparent latch (or the flow's documented equivalent), and must meet its gating setup/hold checks.

    Interview

    Likely question: “How do you prove clock gating is safe.”

    • ICG latch that holds the gating decision throughout the high phase; enable and test controls meet gating timing checks.

    • Hold check showing frozen state across the idle window.

    • Edge count showing the gated clock edged only in active cycles.

    Check yourself The enable moves in the middle of a high clock phase. What distinguishes a raw AND from a latch-based ICG?

    A raw AND can shorten the pulse or introduce an extra edge. The ICG's low-transparent latch is closed during the high phase, so that change waits for the next low phase. A rising-edge enable register alone does not provide this protection.

    Check yourself Why does a latch-based gate use the low clock phase for transparency?

    The latch follows the enable while the clock is low and freezes before the rising edge. That keeps the gate output stable across the edge, so no runt pulse forms.

    Testbench

    The latch-based gate and directed checker compare every active capture and every idle observation.

    icg_model.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    `timescale 1ns/1ps
    module icg_model (
      input logic clk, en,
      output logic gated_clk
    );
      logic en_lat;
      initial en_lat = 1'b0;
      // Latch is transparent while clk is low, frozen while clk is high.
      always @(clk or en) if (!clk) en_lat = en;
      assign gated_clk = en_lat & clk;
    endmodule
    
    module gated_reg (
      input logic gated_clk, rst_n,
      input logic [7:0] d,
      output logic [7:0] q
    );
      always_ff @(posedge gated_clk or negedge rst_n) begin
        if (!rst_n) q <= 8'h00;
        else q <= d;
      end
    endmodule
    

    Remember

    • A data enable alone does not stop clock activity; gating the clock does. Leakage stays either way.

    • A raw clk & en can glitch if en changes while clk is high. The ICG latch closes during the high phase.

    • Write a plain enable and let the flow map it to a library ICG; instantiate a cell only for special cases such as a scan override.

    Rule of thumb: never gate a clock with raw AND logic in RTL.

    How this was checked

    The event-trace table is illustrative, not a measured waveform.

    The latch-based gate and directed checker compare every active capture and every idle observation. This digital model does not check library gating timing or physical pulse widths.

    Keep going

    • Practice: A safe clock-gating cell with a latch-based enable

    • Code lab: Clock-gate control FSM

    • Interview: run a mock interview on this topic

    Related topics

    • Safe gating style

    Previous

    274 / 350

    Next: Safe gating style

    Up next

    Up nextSafe gating style

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Power domains, isolation and retention
    • UPF intent every RTL lead should know
    clkengated_clkq
    Enable, gated clock and held state across one gating window