Clock Generators
CE Pulse Every N Cycles
Generates a single-cycle clock enable pulse every N clock cycles when enabled.
About this block
Simulate it in the Verilog IDE
CE Pulse Every N Cycles is a Verilog reference block in the Clock Generators catalog. Clock dividers, gating, and clock distribution helpers. Marked Medium: more state or a wider datapath, still one workspace in the IDE.
A synthesizable Verilog module that generates a single-cycle Clock Enable (CE) pulse every N clock cycles. This IP is designed to drive lower-frequency logic from a high-speed clock domain, ensuring precise timing control.
This IP provides a simple and reliable way to generate periodic clock enable pulses.
It is suitable for low-frequency peripheral interfacing and clock division tasks.
- Choose Open in IDE. RTL Studio loads the packaged workspace for CE Pulse Every N Cycles.
- Read the Verilog module in the editor. The catalog line for this block: Generates a single-cycle clock enable pulse every N clock cycles when enabled.
- Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
- Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.
RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.
Features
- Configurable Period: Set the pulse frequency via a 32-bit input parameter
n. - Synchronous Control: Supports synchronous reset (
rst_n) and enable (en) signals. - Safe Operation: Handles
n=0by defaulting to a period of 1 cycle to prevent undefined behavior. - Verified: Tested with Icarus Verilog simulation.
Ports
| Port Name | Direction | Width | Description |
|---|---|---|---|
clk | Input | 1 | Clock input |
rst_n | Input | 1 | Active-low synchronous reset |
en | Input | 1 | Enable signal; pulse generation is active only when high |
n | Input | 32 | Period divisor; determines pulse frequency |
ce_pulse | Output | 1 | Single-cycle pulse asserted every N clocks |
Architecture
The design utilizes a 32-bit counter that increments on every clock cycle while the en signal is high.
- Counting: The counter resets to zero when it reaches
n - 1(orn_safe - 1ifnwas clamped). - Enable Handling: If
enis low, the counter immediately resets to zero. This ensures that the pulse generation does not persist across enable gaps. - Pulse Generation: The
ce_pulseoutput is asserted for exactly one clock cycle when the counter equalsn_safe - 1.
Verification
The testbench verifies the following scenarios using Icarus Verilog:
| Test Case | Description | Result |
|---|---|---|
| TC1 | N=2, en=1 | PASS |
| TC2 | N=3, en=1 | PASS |
| TC3 | N=5, en=1 | PASS |
| TC4 | en=0 (Pause) | PASS |
### Running Simulations
- Ensure Icarus Verilog is installed.
- Run the simulation script provided in the repository.
- Inspect
sim/dump.vcdusing a waveform viewer (e.g., GTKWave or RtlStudio) for detailed timing analysis.
More in Clock Generators
- 1-Cycle Data Delay
- 16-Bit DDS Phase Accumulator — L2 Upgrade
- 2:1 Clock Divider (Toggle Flip-Flop)
- 4-Phase Clock-Enable Sequencer — L1 Upgrade — L2 Upgrade
- Burst Enable for N Cycles — L1 Upgrade — L2 Upgrade
- Clock Enable with Soft-Reset Stretch — L2 Upgrade
- Clock-Enable Divider (CE Pulse) — L1 Upgrade — L2 Upgrade
- Clock-Enable Stretcher N — L1 Upgrade — L2 Upgrade
- Divide-by-3 Clock (50% Duty)
- Dual-Edge DDR Sampler — L2 Upgrade
- Duty-Correct Divide-by-2 — L1 Upgrade — L2 Upgrade
- Fractional Clock Divider with Jitter Control
- Fractional Clock Enable M/N — L2 Upgrade
- Glitch-Free Clock Select 2 — L2 Upgrade
- Integer Clock Divider
- Lost-Clock Detector — L2 Upgrade