Latch-Based Clock Gating Cell
Gating a clock saves power, but ANDing it with an enable makes a glitch if the enable changes while the clock is high.
A standard glitch-free clock gating cell solves this by synchronizing the enable signal. The circuit uses a negative-level sensitive latch to hold the enable signal steady during the high phase of the clock. The latched enable is then ANDed with the source clock to produce the gated clock. This ensures the output clock transitions cleanly and safely.
Timing and Reset Rules:
- Latch transparency: The internal latch is transparent when
clkis 0; it directly passes theensignal. - Latch hold: The internal latch holds its current value when
clkis 1, ignoring any changes onen. - Output logic: The
gated_clkoutput is a combinational AND ofclkand the internal latched enable. - Reset: There is no explicit reset pin; the latch assumes the value of
enwhenclkis 0.
Worked Trace:
Step 1: clk=0, en=1 → latched_en=1, gated_clk=0
Step 2: clk=1, en=1 → latched_en=1 (hold), gated_clk=1
Step 3: clk=1, en=0 → latched_en=1 (hold), gated_clk=1 (glitch prevented)
Step 4: clk=0, en=0 → latched_en=0, gated_clk=0
Step 5: clk=0, en=1 → latched_en=1, gated_clk=0
Step 6: clk=1, en=1 → latched_en=1 (hold), gated_clk=1
Port Table:
| Signal | Direction | Width | Description |
|---|---|---|---|
clk |
input | 1 | Source clock |
en |
input | 1 | Clock enable signal |
gated_clk |
output | 1 | Gated output clock |
Constraints
- Must infer a negative-level sensitive latch for the internal enable signal.
- Do not use edge-triggered flip-flops (
posedgeornegedge). - The output
gated_clkmust be the continuous logical AND ofclkand the latched enable. - All ports are 1-bit wide.
Topics
Solve this problem
Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.
This problem is part of Codiode Pro. The statement above is free to read.
The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.
Part of Clock Domain Crossing and Synchronization
Problem 8 of 36 in the Clock Domain Crossing and Synchronization track.
Related problems
Browse all problems · Verilog practice problems · Learning tracks