RTL Studio Open IDE

Clock Generators

Fractional Clock Enable M/N — L2 Upgrade

Fractional Clock Enable M/N with Used-MN Indicator using Bresenham accumulator.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

Fractional Clock Enable M/N — 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 fractional clock enable generator using an M/N ratio.

It utilizes a Bresenham accumulator algorithm to distribute pulses evenly, ensuring minimal jitter in the output enable signal.

The module supports configurable M and N parameters for precise frequency scaling and is suitable for power management and clock domain crossing applications.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Fractional Clock Enable M/N — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: Fractional Clock Enable M/N with Used-MN Indicator using Bresenham accumulator.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. 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

  • Fractional Division: Divides input clock enable (ce_in) to ce_out based on an M/N ratio.
  • Bresenham Algorithm: Uses accumulation for uniform pulse distribution.
  • Configurable: M and N values are configurable via 8-bit inputs (0-255). Note: N should typically be > 0.
  • Status Indicator: used_mn flag indicates active division state (m > 0).
  • Synchronous Reset: Clean initialization behavior with active-low reset.

Ports

PortDirectionWidthDescription
clkinput1Clock input
rst_ninput1Active-low synchronous reset
ce_ininput1Input clock enable signal
minput[7:0]Numerator of the fractional ratio
ninput[7:0]Denominator of the fractional ratio
ce_outoutput1Output clock enable signal
used_mnoutput1Active-high indicator when m > 0

Verification

The testbench verifies reset behavior, basic 50% duty cycle, m=0 case, m > n wrapping, and ce_in gating.

### Expected Results

After Run Simulation, the Log panel should show:

  • TC1 PASS ce_out is 0 during reset
  • TC1 PASS used_mn is 0 during reset
  • TC2 PASS ce_out high count 5
  • TC2 PASS used_mn is high when m > 0
  • TC3 PASS ce_out is 0 when m=0
  • TC3 PASS used_mn is 0 when m=0
  • TC4 PASS ce_out high count 6
  • TC5 PASS ce_out is 0 when ce_in=0

### Test Cases

Test CaseDescriptionResult
TC1Reset behaviorPASS
TC2Basic 50% duty cycle (m=5, n=10)PASS
TC3m=0 case (no output)PASS
TC4m > n case (wrapping)PASS
TC5ce_in gatingPASS

More in Clock Generators

All Clock Generators blocks