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. Safe gating style

Part 9 · Senior · Senior

Safe gating style

Registered enables, scan override, and one enable per cluster for glitch-free gating.

On this page

    Why this matters

    A gate without a test override cannot shift scan data, so coverage falls exactly where gating was densest. A glitchy raw request can also reach the gate if the enable is not timed through the ICG.

    After this lesson you can: time a gate enable through a flop and the ICG latch, add the scan override to every gate, and choose one enable per cluster of registers.

    Time the enable through the ICG

    Gate control usually comes from status signals that can glitch. A flop on the enable moves every change to just after the rising edge.

    A rising-edge enable register changes while the clock is high. The ICG latch, not the register alone, prevents this change from disturbing the current pulse. The latch follows during the next low phase and must close with its setup/hold requirements met. Registration is a control-design choice, not a replacement for the ICG.

    Each slot is half a clock period, numbered from 0: even slots are just after a rising edge, odd slots just after a falling edge. run_i is the raw request, en_q the enable flop, lat the ICG latch, and gclk the gated clock.

    • Slot 1: the raw request glitches high between two rising edges. At slot 2 en_q is still 0, because the flop only samples at a rising edge.

    • Slot 3 and 4: the real request is high, so en_q rises just after the rising edge in slot 4 (E0). The latch is closed while the clock is high, so there is no gated pulse yet.

    • Slot 5 and 6: in the low phase the latch takes en_q = 1. The next rising edge (E1, slot 6) gives the first full gated pulse.

    • Slots 9 to 11: the request drops, yet the edge in slot 10 still passes a full pulse. en_q clears after it, and the latch closes the gate in slot 11.

    Keep a test path open

    Scan shift needs clocks while functional enables rest. OR-ing a test override into the latch keeps gated domains controllable in test mode.

    Every gate gets the override. A domain without one cannot shift, so coverage falls exactly where gating was densest.

    One enable per cluster

    Share gates among registers with compatible enables. Independently idle subgroups can save more switching with finer gates, but added ICG, control and clock-tree capacitance can offset the benefit. Compare activity-weighted capacitance, area, clock skew and gating timing in mapped/routed results.

    • Prefer one enable per functional cluster, not per flop.

    • Include scan and test override in every gate control.

    • Review gating chances against realistic activity traces.

    Common mistakes

    Common pitfall

    Granularity is a measured trade-off: a shared gate clocks idle subgroups whenever another subgroup runs; fine gates add overhead. Missing a required test override leaves a gated scan domain inaccessible.

    Interview

    Likely question: “What breaks if the scan override is missing on one gate.”

    • Shift stalls in that domain while the rest of the chain moves.

    • Coverage drops exactly where gating was heaviest.

    • Debug suffers, since scan dump cannot reach the frozen flops.

    Check yourself A short pulse on the idle line lands between clock edges. Why does the gated clock ignore it?

    The enable flop only samples at the rising edge, so the pulse is gone before it matters. The latch then sees a settled enable for the whole low phase.

    Check yourself Four flops share one gated clock and the enable rests for 16 cycles. What must all four outputs read at the end?

    Their values from before the idle window. With no gated edge, no flop in the cluster can change, so all four hold.

    Testbench

    This is a same-clock capture interface, not valid/ready. Acceptance occurs only at a gated rising edge with reset released. The producer holds the first word through wake-up and each accepting edge; scan captures are counted separately from functional work. Shutdown requests stop new offers only after the final acceptance; the control register permits one final full clock pulse.

    Event

    Control / gate

    Data ownership

    Falling edge before E0

    Request run; en_q still 0

    Offer word 0 and hold

    E0 rising

    en_q becomes 1 after edge; no gated edge

    Word 0 still pending

    Next low phase

    ICG latch takes en_q = 1

    Continue holding word 0

    E1 rising

    First full gated pulse

    Capture word 0; advance only afterward

    Falling edge before last capture

    Request idle

    Hold final word

    Last rising edge

    Old latched enable passes pulse; en_q clears

    Final capture completes

    Next low phase

    Latch closes gate for following rising edge

    No pending word may be discarded

    gate_ctrl.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    `timescale 1ns/1ps
    module gate_ctrl (
      input logic clk, rst_n, idle_i, block_active_i,
      output logic en_q
    );
      always_ff @(posedge clk or negedge rst_n) begin
        if (!rst_n) en_q <= 1'b0;
        else en_q <= !idle_i && block_active_i;
      end
    endmodule
    
    module safe_icg (
      input logic clk, en_q, te_i,
      output logic gclk
    );
      logic lat;
      initial lat = 1'b0;
      // Test override joins inside the latch so scan clocks run while enables rest.
      always @(clk or en_q or te_i) if (!clk) lat = en_q | te_i;
      assign gclk = lat & clk;
    endmodule
    
    module gated_nib (
      input logic gclk, rst_n,
      input logic [3:0] next_s,
      output logic [3:0] state_q
    );
      always_ff @(posedge gclk or negedge rst_n) begin
        if (!rst_n) state_q <= 4'h0;
        else state_q <= next_s;
      end
    endmodule
    

    Remember

    • The enable flop moves changes to just after the rising edge; the ICG latch, not the flop alone, protects the current pulse.

    • Every gate gets the test override, or a domain cannot shift.

    • Prefer one gate per functional cluster; finer gates add ICG, control and clock-tree cost that can cancel the saving.

    Rule of thumb: if a gate has no scan override, its whole domain is dark in test.

    Keep going

    • Practice: Integrated clock gating (ICG) cell usage in RTL

    • Interview: run a mock interview on this topic

    Related topics

    • Power domains, isolation and retention

    Previous

    275 / 350

    Next: Power domains, isolation and retention

    Up next

    Up nextPower domains, isolation and retention

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • UPF intent every RTL lead should know
    clkrun_ien_qlatgclk
    A raw request glitch is ignored, then a real request passes through the enable flop and the ICG latch to the first full gated pulse