You are on page 1of 3

DESIGN

FPGA-BASED DIGITAL CLOCK MANAGER


Heres a digital clock manager that is easy to implement. The design is very flexible with many programmable inputs
VINEET GOEL exhibits most of the functionalities of a DCM like digital frequency synthesis (multiplier/divider), duty-cycle correction, programmable phase shifter, programmable duty-cycle synthesiser and coarse phase shifter. synthesisers as well as in FPGAs. Most of the systems utilise PLL or DLL for clock multiplication. These systems result in high phase accuracy with higher programmability but at the expense of high complexity and high power consumption. The output clock frequency of the DFS is given by: fDFS = fclk multiplier divider

esign a digital clock manager (DCM) that gives flexible, complete control over the clock frequency.

Fig. 1: Multiplier/divider module

Fig. 2: Duty-cycle correction module

Fig. 4: Basic circuit of ring oscillator

An introduction
The complete DCM module is divided into five sub-modules: digital frequency systhesiser, duty-cycle corrector, programmable phase shifter, programmable dutycycle synthesiser and coarse phase shifter. The digital frequency systhesiser (DFS) performs the function of clock multiplication/division. The multiplication of a clock frequency by a programmable number is often necessary in high-performance signal

Fig. 3: Coarse phase shifter

The DCM is simulated in VHDL language using XILINX Project Navigator software. It does not rely on phase-locked loop (PLL), delay-locked loop (DLL) or any feedback loop, but

The output clock from the DFS is phase symmetric with 50% duty cycle. The duty-cycle correction module corrects the duty cycle of the input clock to 50%. If the input clock has 30% duty cycle, the output-clock duty cycle is corrected to exactly 50% with no change in frequency. The programmable phase shifter (PPS) provides the progammable phaseshifted versions of the input clock. It has integer values ranging from 255 to 255 to which phase-shift attribute is assigned. The programmable duty-cycle synthesiser varies the duty cycle of the input clock as per the programmable input. This helps to improve the metastabilty factor due to set-up/hold time violations. This module assignes 0 to 100% duty cycle to the output clock. The coarse phase shifter provides output clocks that are 90, 180 and 270 phase-shifted versions of the inWWW.EFYMAG.COM

118 DECEMBER 2007 ELECTRONICS FOR YOU

DESIGN
Since DLL or PLL is not the basis of this design, the maximum allowed input reference clock is of 1 MHz. All the sub-modules of the DCM are more or less based on the same basic concept.

Hardware description
(a) In low multiplier module, reference clock multiplied by factor 12 with clk_out as the output signal with reset signal

Consider that the DFS reference clock is to be multiplied by factor M and divided by factor D. The DFS basically consists of a master clock of frequency Fc, a divide-by-M counter, an accumulator counter counting to K and a divide-by-K counter. The value of K is given by: K= Fc T M

(b) In duty-cycle synthesiser module, reference clock with 50% duty cycle and the output clock signal clk_out2 has 20% duty cycle with reset input low.

The output of the divide-by-D counter will be a clock with time period given by: Fout = M Fc = T K

(c) In duty-cycle correction module, output clock signal clk_out3 is the duty cycle corrected version of the input refrence clock

This output is given to the input of the divide-by-D counter whose output will be a clock with frequency: Fout1 = M TD

(d) In divider module, the output clock signal clk_out4 is derived by dividing the input reference by 2

(e) In multiplier/divider module, the ref_clk is multiplied by 5 and divided by 7

(f) In programmable phase shifter, the reference clock is shifted in phase by +11 to provide clk_out6 clock signal Fig. 5: Simulation results

put clock and require no programmability. The master clock used to sample the input reference clock has a frequency of 100MHz and is generated using the ring oscillator at the gate level with delay elements implemented as inverting buffer.
120 DECEMBER 2007 ELECTRONICS FOR YOU

The values of M and D are programmable inputs to the DFS. The duty-cycle correction module is also based on the same concept as DFS. The accumulator counter counts to K over time period T driven by very high-frequency master clock. The logic part is such that the output clock changes state when the value of the accumulator counter is either K/2 or K. In this way, you can have exact 50% duty cycle output clock irrespective of the duty-cycle of the input clock. The programmable phase shifter has a programmable 8-bit input, the MSB of which defines the positive or negative phase shift with reference to the input clock and the bits 0 to 7 decide the amount of phase shift. The hardware description is the same as for duty-cycle correction module, except for the logic part. The portion of clock to be shifted per unit of the programmable input is estimated on the basis of value K accumulated in the counter and that much lag or lead is done by the master clock. The hardware representation for the programmable duty-cycle synthesiser is also similar to that of the PPS. The logic part is implemented such that on the basis of the percentage of the duty cycle required, the output clock is kept high for some part of K (0 to K1) and low for the other part of K (K1 to K). The value of K1 is derived from the input value of the duty cycle required. The coarse phase shifter provides the outputs as CLK0, CLK90, CLK180 and CLK270. The output also depends on the duty_cycle_correction input. If it is true, the output clock has 50% duty cycle. If it is false, the output clock has the same duty cycle as the input clock.
WWW.EFYMAG.COM

DESIGN
implementation and the values of delay at the gate and flip-flop level. As per the delay values provided in the datasheet of XILINX Spartan-3 FPGA XC3S1500, seven inverters are placed as delay element. The reset signal is provided to the ring oscillator as well as to all the counters and is an active-high signal. divisible by any of the divide-by-N counters. This error results in phase asymmetry. Both these errors can be minimised by having master clock at very high frequency so that the counter counts up to very large values. But since we cannot employ ring oscillators with very high frequencies (due to the need for the circuit to process the OSC signaltypically, a few nanoseconds), this limits the maximum frequency that can be controlled by the DCM. In this case, based on the current technology of FPGA used, the output frequency is below 20 MHz.

Fig. 6: Block diagram of the DCM with inputs and outputs

Fig. 4 shows the basic circuit of the ring oscillator that is used to generate very high frequencies of the order of 100 MHz. In VHDL description, an inverter in the ring oscillator is defined as: Q <= not(A) after invdel; where invdel is estimated delay for the inverter. This delay is estimated on the basis of the device used for

Error analysis
There are mainly two types of errors to be analysed in this implementation of the DCM. One of the errors occurs because the period of the reference clock may not be an integral multiple of the master clock period. This error results in jitter. The second error occurs because the accumulated value K in the counter may not be exactly

Simulation results
All the results shown in Fig. 5 are simulated on XILINX Spartan-3 software. The block diagram of the DCM with inputs and outputs is shown in Fig. 6.
The author is a research engineer at Center for Development of Telematics (C-DoT), Delhi

www.electronicsforu.com

www.eleb2b.com

www.linuxforu.com

www.itmagz.com

www.benefitmag.com

www.ffymag.com

www.efyindia.com

122 DECEMBER 2007 ELECTRONICS FOR YOU

WWW.EFYMAG.COM

You might also like