INTERNSHIP REPORT IMPLEMENTATION OF A DELAY LOCKED LOOP (DLL) ON AN FPGA At INDIAN INSTITUTE OF SCIENCE, BANGALORE ECE DEPARTMENT For S.N.BOSE SCHOLARS PROGRAM JUNE – AUGUST 2013 By ANMOL VITTAL CHAVAN PURDUE UNIVERSITY, West Lafayette Professor: Dr. BHARADWAJ AMRUTUR
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
INTERNSHIP REPORT
IMPLEMENTATION OF A DELAY LOCKED LOOP (DLL) ON AN FPGA
At
INDIAN INSTITUTE OF SCIENCE, BANGALORE
ECE DEPARTMENT
For S.N.BOSE SCHOLARS PROGRAM
JUNE – AUGUST 2013
By
ANMOL VITTAL CHAVAN
PURDUE UNIVERSITY, West Lafayette
Professor: Dr. BHARADWAJ AMRUTUR
2 Internship Report Anmol Vittal Chavan
Purdue University
CONTENTS Topic Page number
1. Abstract 3
2. Objective 3
3. Theory 4 - 8
4. Design and simulation 9 - 14
5. Results 15 - 21
6. Future Scope 21
7. Acknowledgements 22
8. References 23
9. Appendix 24 -26
3 Internship Report Anmol Vittal Chavan
Purdue University
Abstract
The goal of this project was to implement a Delay locked loop (DLL) based on a glitch free
coarse delay line onto an FPGA. A delay locked loop is a feedback loop which is used to
generate a specified delay in a system. It consists of a delay element, a phase detector and a
filter. The phase detector used is a positive edge triggered D- Flip flop and the filter is a
synchronous up down counter. The components (decoder, each unit delay cell, flip flop, filter)
were programmed in VHDL and simulated using the Xilinx ISE to test for their working. The
delay range on the Xilinx Virtex II Pro FPGA was measured on the oscilloscope using NOT gate
buffers. The entire DLL was then implemented onto the FPGA. The purpose of the DLL is to
generate a delay which is equal to the time period of the reference clock of the filter.
Objective
1. To program the various components of the DLL including the glitch free coarse delay
line in VHDL and simulate them using the ISE simulator
2. To understand the working of an FPGA
3. To implement the DLL onto the FPGA and understand its working.
4 Internship Report Anmol Vittal Chavan
Purdue University
THEORY 1) Delay Locked Loop (DLL)
A Delay locked loop is a negative feedback loop which is used to generate a specific
delay in a circuit. It consists of a delay line, a phase detector and a filter. The delay line has an
input which is given by dividing the FPGA clock and a delayed output. The input of the delay
cell is also the input to the phase detector. A positive edge triggered D- flip flop was used as a
phase detector. The output of the delay line was the clock to the D- flip flop. The phase detector
compares the phase of the reference input and the delay line output. The comparison yields a
signal proportional to the phase error. The output of the phase detector is fed as the input to a
filter.
Delayed output input
COARSE DELAY LINE
FILTER (Up-Down counter)
Phase Detector
Fig.1: DLL Architecture
5 Internship Report Anmol Vittal Chavan
Purdue University
A synchronous up-down counter was used as the filter. The counter counts up if the input
signal is going low and counts down if the input signal is going high and adjusts the output signal
which goes into a decoder. The decoder controls the number of delay cells being used in a delay
chain. The reference clock signal to the up- down counter determines the delay to be generated.
For example, if a delay of 20 ns is required to be generated, the reference clock should have a
time period of 20ns.
2) Coarse Delay Chain
For medium frequencies (few hundreds of MHz) maintaining fine resolution for the entire
period is very challenging and area consuming. The coarse delay units help in reducing area to
generate large delays. The coarse delay chain can be controlled to generate delays in steps of
about 100 ps. “NOT” gates were used instead of other gates because they have the least delay,
which is needed for higher resolution. They also occupy lesser space. The coarse delay line is
used to set the input-output delay as close to the target as possible. The following is the
architecture of the Lattice delay unit which is a single unit in the coarse delay line.
Lattice Delay Unit
Fig 2: Structure of a Lattice delay unit
6 Internship Report Anmol Vittal Chavan
Purdue University
Many LDU’s are connected to form a Delay line. There exists a possibility of glitch at the
output because of change in control setting at an instance where the levels of the two inputs to
the MUX being switched are different.
The following diagram illustrates such a condition.
Fig3: Glitch generated at the output due to change of setting in the coarse delay unit at an unsuitable instant.
A change in the MUX setting (which gets applied immediately) causes a change in the
output level, which is then restored once the input edge reaches the MU3 input. This generated
glitch then propagates to the output.
To solve this, it was ensured that the change in the MUX control signals are activated only when
both the inputs to the MUX are identical and settled. The input edge which takes time to
propagate to the MUX under consideration is used to change the MUX control settings.
7 Internship Report Anmol Vittal Chavan
Purdue University
A signal is generated by sampling the original control signal Sk by a negative edge triggered d
flip-flop clocked with the output of the corresponding coarse delay stage. This ensures that the
inputs of the MUX whose settings are being altered are stable by the time the select signals are
actually changed.
Fig4: D - flip flops for glitch free course delay switching 3) Field Programmable Gate Array (FPGA)
FPGAs are programmable semiconductor devices that are based around a matrix of
Configurable Logic Blocks (CLBs) connected through programmable interconnects. Its
configuration is generally specified using a hardware description language (HDL). In this
project, VHDL was used. FPGAs contain programmable logic components called "logic blocks",
and a hierarchy of reconfigurable interconnects that allow the blocks to be "wired together". As
opposed to Application Specific Integrated Circuits (ASICs), where the device is custom built for
the particular design, FPGAs can be programmed to the desired application or functionality
requirements. Much of the logic in a CLB is implemented using very small amounts of RAM in
the form of LUTs (Look up tables). All combinatorial logic (ANDs, ORs, NANDs, XORs, and
1) VHDL program made for DLL library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity for8fpga is port( outX, in2, in2b, in2c, in2d, s, sb, sc, sd: inout std_logic_vector (31 downto 0); in1, in1b, in1c, in1d: inout std_logic_vector (31 downto 0); outer, outer2, outer3, outer4: inout std_logic; FPGA_CLK : in STD_LOGIC; FOUT : out STD_LOGIC; rot: in std_logic; CLOC: OUT std_logic); end for8fpga; architecture Behavioral of for8fpga is component fiveto32 port(sel: in std_logic; inp: in std_logic_vector (4 downto 0); out1: inout std_logic_vector (31 downto 0)); end component; component dff port (d: in std_logic; clk: in std_logic; rst: in std_logic; q: out std_logic); end component; component delay_cell_2 port( in1, in2, sk, sk_1: in std_logic; outM: inout std_logic;
outN: out std_logic); end component; component dffp port (d: in std_logic; clk: in std_logic; rst: in std_logic; q: out std_logic); end component; component up_down_counter port(clk, rst_a, mode : in std_logic; --mode=1 up counting, mode=0 down counting q : out std_logic_vector(4 downto 0)); end component; signal i, j, k, l : integer := 0; signal reset : std_logic; signal count_fref, count_fref1, count_fref_2: integer range 0 to 6000 signal op1: std_logic; signal int_FREF, int_FREF_2 : STD_LOGIC; signal innn: std_logic_vector (4 downto 0); signal sel: std_logic; signal ou1 : std_logic_vector (4 downto 0); begin reset <= rot; process(FPGA_CLK) begin if(FPGA_CLK'event and FPGA_CLK='1') then if(count_fref1<999999) then count_fref1<=count_fref+1; elsif(count_fref1 >= 999999) then count_fref1<=0; end if;
25 Internship Report Anmol Vittal Chavan
Purdue University
end if; end process; process(FPGA_CLK) begin if(FPGA_CLK'event and FPGA_CLK='1') then if(count_fref =199999) then reset<='0'; elsif(count_fref >=999999) then-->= reset<='1'; end if; end if; end process;
--input clock process(FPGA_CLK) begin --if(reset = '0') then if(FPGA_CLK'event and FPGA_CLK='1') then if(count_fref<5) then count_fref<=count_fref+1; elsif(count_fref >= 5) then count_fref<=0; end if; end if; --end if; DFF8 : dff port map ('0', in2(30), reset, s(31)); --
rest, s(7)); end process; process(FPGA_CLK) begin --if(reset = '0') then if(FPGA_CLK'event and FPGA_CLK='1') then if(count_fref =2) then int_FREF<='0'; elsif(count_fref >=5) then-->= int_FREF<='1'; end if; end if; --end if; end process; -- clock for counter --int_FREF_2 <= FPGA_CLK;
TFF: dffp port map(not int_FREF_2, FPGA_CLK, '0', int_FREF_2);
-- delay line DEC1 : fiveto32 port map ('1', ou1, outX);--innn DFF1 : dff port map (outX(0), outer, reset, s(0)); in1(0) <= int_FREF; DC1 : delay_cell_2 port map(in1(0), in2(0), s(0), '0', in1(1) , outer); --in1(1) Q1: for i in 1 to 30 generate DFF2: dff port map( d => outX(i), clk => in2(i-1), rst => reset, --rest, q => s(i)); DC2 : delay_cell_2 port map( in1 => in1(i), in2 => in2(i), sk => s(i), sk_1 => not s(i-1), outM => in1(i+1), outN => in2(i-1)); end generate;
DC8 : delay_cell_2 port map(in1(31), in2(31), '0', not s(30), in2(31), in2(30));--in2(31) DFF1b : dff port map (outX(0), outer2, reset, sb(0)); in1b(0) <= outer; DC1b : delay_cell_2 port map(in1b(0), in2b(0), sb(0), '0', in1b(1) , outer2); --in1(1) Q2: for j in 1 to 30 generate DFF2b: dff port map( d => outX(j), clk => in2b(j-1), rst => reset, --rest, q => sb(j)); DC2b : delay_cell_2 port map( in1 => in1b(j),
26 Internship Report Anmol Vittal Chavan
Purdue University
in2 => in2b(j), sk => sb(j), sk_1 => not sb(j-1), outM => in1b(j+1), outN => in2b(j-1)); end generate; DFF8b : dff port map ('0', in2b(30), reset, sb(31)); --rest, s(7)); -- DC8b : delay_cell_2 port map(in1b(31), in2b(31), '0', not sb(30), in2b(31), in2b(30));--in2(31)
DFF1c : dff port map (outX(0), outer3, reset, sc(0)); -- in1c(0) <= outer2; -- DC1c : delay_cell_2 port map(in1c(0), in2c(0), sc(0), '0', in1c(1) , outer3); --in1(1) Q3: for k in 1 to 30 generate DFF2c: dff port map( d => outX(k), clk => in2c(k-1), rst => reset, --rest, q => sc(k)); DC2c : delay_cell_2 port map( in1 => in1c(k), in2 => in2c(k), sk => sc(k), sk_1 => not sc(k-1), outM => in1c(k+1), outN => in2c(k-1)); end generate; DFF8c : dff port map ('0', in2c(30), reset, sc(31)); --rest, s(7)); DC8c : delay_cell_2 port map(in1c(31), in2c(31), '0', not sc(30), in2c(31), in2c(30));--in2(31)