Clock Generators
Parameterized Clock Enable Generator — L2 Upgrade
A parameterized clock enable generator that produces a periodic enable pulse based on M/N division parameters, with global reset and enable control.
About this block
Simulate it in the Verilog IDE
Parameterized Clock Enable Generator — L2 Upgrade 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.
This IP implements a parameterized clock enable generator with M/N frequency division. It generates a periodic enable pulse based on configurable M (pulse width) and N (period) parameters.
The ce output is high for M cycles and low for N-M cycles within an N-cycle period. The used signal mirrors ce to indicate active usage cycles. The module supports global reset and a synchronous enable control.
- Choose Open in IDE. RTL Studio loads the packaged workspace for Parameterized Clock Enable Generator — L2 Upgrade.
- Read the Verilog module in the editor. The catalog line for this block: A parameterized clock enable generator that produces a periodic enable pulse based on M/N division parameters, with global reset and enable control.
- 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 Duty Cycle: Defined by the
mparameter (pulse width). - Configurable Period: Defined by the
nparameter (total period). - Synchronous Reset: Active-low polarity (
rst_n). - Global Enable: Synchronous control signal (
en) to gate the generator. - 32-bit Parameters: Supports large M and N values for low-frequency division.
- Registered Outputs:
ceandusedare registered to ensure stable timing and reduce glitches. - Low Resource Utilization: Optimized for FPGA and ASIC targets.
Ports
| Port | Direction | Width | Description |
|---|---|---|---|
| clk | Input | 1 | Clock input |
| rst_n | Input | 1 | Active-low synchronous reset |
| m | Input | 32 | Enable pulse width (cycles) |
| n | Input | 32 | Period length (cycles) |
| en | Input | 1 | Global enable control |
| ce | Output | 1 | Clock enable pulse |
| used | Output | 1 | Active usage indicator |
Architecture
The design uses a 32-bit counter that resets when it reaches N-1. The counter increments on every clock cycle when en is asserted. The ce signal is asserted when the counter value is less than M. The used signal mirrors the ce logic for explicit usage tracking. Both outputs are registered to ensure stable timing.
### Logic Flow
- Counter: Increments on
posedge(clk)ifenis high. Resets to 0 ifrst_nis low or ifcounter == n - 1. - CE Generation: Asserted if
enis high ANDcounter < mANDm > 0. - Used Generation: Mirrors
celogic.
Verification
The testbench validates reset behavior, basic M/N generation, edge cases, and enable gating. All five test cases pass successfully in Icarus Verilog simulation.
### Expected Results
After Run Simulation, the Log panel should show:
TC1 PASS Reset state correctTC2 PASS Basic M/N generation correctTC3 PASS M=0 correctTC4 PASS M=N correctTC5 PASS En=0 correctSimulation ends with INFO: PASS
### Test Cases
| Test Case | Description | Result |
|---|---|---|
| TC1 | Reset state verification | PASS |
| TC2 | Basic M=4, N=8 generation | PASS |
| TC3 | M=0 (No enable) | PASS |
| TC4 | M=N (Always enable) | PASS |
| TC5 | Enable gating (en=0) | PASS |
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
- CE Pulse Every N Cycles
- 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