Hardware interview practice
Design glitch-free clock gating
Describe a glitch-free positive-edge clock-gating implementation and the checks that prove it cannot create runt pulses.
Starting point
Question code
input logic clk, rst_n, en;
output logic gclk;Reviewed example
Work through one case
Input
en falls while clk is high and the current gclk pulse is activeExpected output
The active gclk pulse completes; gating stops at the next safe low phaseThe stored gate enable cannot change during the propagated high pulse.
What to cover
Requirements
- Capture the functional enable only while clk is low, using an approved ICG or an equivalent low-phase model.
- Allow a propagated high pulse to complete even if en changes while clk is high.
- Treat reset/test disable through the library-approved safe control path; do not asynchronously truncate gclk high.
- Check source-edge alignment, pulse width, enable stability during high phase, and no gated edge while disabled.
