This repository contains a lightweight AXI4-Lite slave that sequences the Clocking Wizard MMCM dynamic phase-shift interface (psclk, psen, psincdec, psdone).
The implementation is based on doc/pg065-clk-wiz.pdf:
- Dynamic phase shift is exposed on the Clocking Wizard through
psclk,psen,psincdec, andpsdonein the product guide port table. - Dynamic phase shift is available only when the inferred/generated primitive is an MMCM. The guide's feature table marks it unsupported for PLL and BUFGCE_DIV.
- The Output Clocks configuration requires
Use Fine PSto be enabled for any output that must respond to dynamic phase-shift commands. - The full Clocking Wizard AXI4-Lite reconfiguration path is intended for frequency, phase, and duty-cycle register programming and carries a significantly larger logic footprint. This controller avoids that path and only automates the fine phase-step handshake.
rtl/axi_clk_wiz_phase_ctrl.v provides:
- A 32-bit AXI4-Lite slave.
- A signed
STEP_COUNTregister. Positive values increment phase, negative values decrement phase. - A
CONTROLregister with a software-visible output-clock select field and astartbit. - A
STATUSregister withbusy,done,error,locked, active target, and remaining steps. - Direct outputs for
psclk,psen, andpsincdec, withpsclktied tos_axi_aclk. - Sticky interrupt generation on
doneorerror.
0x00 CONTROLbit[0]:start(write1to launch a transaction)bit[10:8]:phase_target_selbit[16]:irq_enable
0x04 STATUSbit[0]:busybit[1]:donesticky, write1back to clearbit[2]:errorsticky, write1back to clearbit[3]: synchronizedclk_wiz_lockedbit[4]: sampledpsdonebit[5]: activepsincdecbit[10:8]: active targetbit[31:16]: steps remaining
0x08 STEP_COUNT- Signed 32-bit phase-step request.
0x0C APPLIED- Signed copy of the last accepted step request.
0x10 INFO0x0001_000N, whereNisNUM_OUTPUTS.
- Configure the Clocking Wizard for MMCM mode and enable Dynamic Phase Shift.
- Enable
Use Fine PSon the output clock that software intends to phase adjust. phase_target_selandphase_target_onehotare exported so software can keep track of which output clock it believes it is adjusting. The MMCM fine phase-shift pins are global control inputs, so independent runtime phase control still depends on how the upstream Clocking Wizard instance is configured.phase_target_selandphase_target_onehotdo not connect to a Clocking Wizard clock-select port, because no such runtime select port exists on the MMCM fine phase-shift interface. Treat them as bookkeeping/debug outputs unless you add external wrapper logic that uses them.s_axi_aclkis reused aspsclk. Keep that clock within the MMCM dynamic phase-shift timing limits for your device family.
tb/axi_clk_wiz_phase_ctrl_tb.v is a self-checking simulation that:
- writes AXI registers,
- requests positive and negative phase-step sequences,
- emulates
psdone, - verifies pulse counts, target selection, status, and interrupt behavior.
scripts/package_ip.tcl packages the controller as a Vivado IP repository entry under ip_repo/axi_clk_wiz_phase_ctrl_1_0.
The packaged IP explicitly marks these families as supported:
artix7 Productionspartanuplus Production