1 --////////////////////////////////////////////////////////////////////////////////
4 --// /___/ \ / Vendor: Xilinx
5 --// \ \ \/ Version : 2.
5
6 --// \ \ Application : 7 Series FPGAs Transceivers Wizard
7 --// / / Filename :s6link_agc_loop_fsm.vhd
13 -- Description : This module performs TX reset and initialization.
17 -- Module S6Link_agc_loop_fsm
18 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
21 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
23 -- This file contains confidential and proprietary information
24 -- of Xilinx, Inc. and is protected under U.S. and
25 -- international copyright and other intellectual property
29 -- This disclaimer is not a license and does not grant any
30 -- rights to the materials distributed herewith. Except as
31 -- otherwise provided in a valid license issued to you by
32 -- Xilinx, and to the maximum extent permitted by applicable
33 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS"
AND
34 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
35 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
36 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
37 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
38 -- (2) Xilinx shall
not be liable (whether
in contract
or tort,
39 -- including negligence, or under any other theory of
40 -- liability) for any loss or damage of any kind or nature
41 -- related to, arising under or in connection with these
42 -- materials, including for any direct, or any indirect,
43 -- special, incidental, or consequential loss or damage
44 -- (including loss of data, profits, goodwill, or any type of
45 -- loss or damage suffered as a result of any action brought
46 -- by a third party) even if such damage or loss was
47 -- reasonably foreseeable or Xilinx had been advised of the
48 -- possibility of the same.
50 -- CRITICAL APPLICATIONS
51 -- Xilinx products are not designed or intended to be fail-
52 -- safe, or for use in any application requiring fail-safe
53 -- performance, such as life-support or safety devices or
54 -- systems, Class III medical devices, nuclear facilities,
55 -- applications related to the deployment of airbags, or any
56 -- other applications that could lead to death, personal
57 -- injury, or severe property or environmental damage
58 -- (individually and collectively, "Critical
59 -- Applications"). Customer assumes the sole risk and
60 -- liability of any use of Xilinx products in Critical
61 -- Applications, subject only to applicable laws and
62 -- regulations governing limitations on product liability.
64 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
65 -- PART OF THIS FILE AT ALL TIMES.
68 --*****************************************************************************
72 use IEEE.STD_LOGIC_1164.
ALL;
76 lock0,lock1,lock2,lock3,clk,reset,ready :
in ;
77 di0 : in (15 downto 0);
78 holds : out (3 downto 0);
79 DI : out (15 downto 0);
80 Address : out (8 downto 0);
81 state : out (3 downto 0);
91 signal store_di0 : (15 downto 0) := (others => '0');
93 signal holds_reg : (3 downto 0) := (others => '0');
94 signal DI_reg : (15 downto 0) := (others => '0');
95 signal Address_reg : (8 downto 0) := (others => '0');
96 signal state_reg : (3 downto 0);
97 signal done_reg : := '0';
98 signal kill_reg : := '0';
99 signal rd_drp_reg : := '0';
100 signal wr_drp_reg : := '0';
101 signal not_kill : := '1';
103 constant load_addr_agc : (3 downto 0) := "0001";
104 constant rd_drp_agc : (3 downto 0) := "0010";
105 constant wait_drprdy_agc : (3 downto 0) := "0011";
106 constant mod_drp_agc : (3 downto 0) := "0100";
107 constant load_drp_agc : (3 downto 0) := "0101";
108 constant pulse_wr_agc : (3 downto 0) := "0110";
109 constant wait_drp_dy_agc : (3 downto 0) := "0111";
110 constant lock_agc : (3 downto 0) := "1000";
111 constant endstate : (3 downto 0) := "1001";
112 constant resetstate : (3 downto 0) := "1010";
118 Address <= Address_reg;
122 rd_drp <= rd_drp_reg;
123 wr_drp <= wr_drp_reg;
124 not_kill <= not(kill_reg);
128 if rising_edge(clk) then
130 state_reg <=resetstate;
131 holds_reg <=(others => '0');
132 DI_reg <=(others => '0');
133 Address_reg <=(others => '0');
137 elsif((lock0='1' or lock1='1' or lock2='1' or lock3='1') and (not_kill='1')) then
141 state_reg <= load_addr_agc;
143 holds_reg <= (others => '0');
147 when load_addr_agc =>
148 Address_reg <= "000011101";
149 state_reg <= rd_drp_agc;
151 when rd_drp_agc => -- Start Read Sequence Wait for DRPRDY
153 state_reg <= wait_drprdy_agc;
155 when wait_drprdy_agc => -- Wait for DRPRDY
158 state_reg <= mod_drp_agc;
160 state_reg<=wait_drprdy_agc;
166 if ((lock0='1' and lock1='0' and lock2='0' and lock3='0'))then
167 store_di0(15 downto 12) <= "0110";
--/ 64X
168 state_reg <= load_drp_agc;
169 elsif (lock1='1' and lock2='0' and lock3='0') then
170 store_di0(15 downto 12) <= "0100";
--/ 16X
171 state_reg <= load_drp_agc;
172 elsif(lock2='1' and lock3='0') then
173 store_di0(15 downto 12) <= "0010";
-- 4X
174 state_reg <= load_drp_agc;
175 elsif (lock3='1') then
176 store_di0(15 downto 12) <= "0000";
--/ 1X
177 state_reg <= load_drp_agc;
181 state_reg <= pulse_wr_agc;
186 state_reg <= wait_drp_dy_agc;
188 when wait_drp_dy_agc =>
192 state_reg <= lock_agc;
196 if(done_reg='1') then
197 state_reg <= endstate;
198 elsif(lock0='1' and lock1='1') then
199 state_reg <= mod_drp_agc;
200 elsif(lock1='1' and lock2='0') then
201 state_reg <= mod_drp_agc;
202 elsif(lock2='1' and lock3='0') then
203 state_reg <= mod_drp_agc;
204 elsif(lock3='1') then
205 state_reg <= mod_drp_agc;
208 state_reg <= lock_agc;
214 DI_reg <= (others => '0');
215 Address_reg <= (others => '0');
218 kill_reg <= done_reg;
220 when others => state_reg <= "XXXX";
229 use IEEE.STD_LOGIC_1164.
ALL;
230 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
231 use IEEE.STD_LOGIC_ARITH.
ALL;
235 usr_clk : range 0 to 4095 :=150
238 lock0,lock1,lock2,lock3,start :
out ;
239 count_lock_out : in (31 downto 0);
246 --signal lock0_reg,lock1_reg,lock2_reg,lock3_reg : := '0';
252 if rising_edge(dclk) then
261 if(count_lock_out=X"0000000A") then
263 elsif((count_lock_out)=usr_clk*40) then
265 elsif ((count_lock_out)=160*usr_clk) then
267 elsif ((count_lock_out)=640*usr_clk) then
278 use IEEE.STD_LOGIC_1164.
ALL;
279 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
280 use IEEE.STD_LOGIC_ARITH.
ALL;
281 use IEEE.NUMERIC_STD.
ALL;
285 reset,start,stop,dclk : in ;
286 count_lock_out : out (31 downto 0)
292 signal count_lock_out_reg : (31 downto 0) := (others=>'0');
296 count_lock_out <= count_lock_out_reg;
300 if rising_edge(dclk) then
301 if(reset='1' or stop='1') then
302 count_lock_out_reg <= (others=>'0');
303 elsif (start='1') then
304 count_lock_out_reg <= count_lock_out_reg + 1;
306 count_lock_out_reg <= (others=>'0');
314 use IEEE.STD_LOGIC_1164.
ALL;
315 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
316 use IEEE.STD_LOGIC_ARITH.
ALL;
317 use IEEE.NUMERIC_STD.
ALL;
321 usr_clk : range 0 to 4095 :=150
325 DCLK,reset,DRDY : in ;
326 D0 : in (15 downto 0);
327 DI : out (15 downto 0);
328 holds : out (3 downto 0);
330 DADDR : out (8 downto 0);
333 -- input[7:0] usr_clk,
334 state : out (3 downto 0);
335 count_lock_out : out (31 downto 0);
336 lock0,lock1,lock2,lock3 :
out
338 end S6Link_agc_loop_fsm;
344 lock0,lock1,lock2,lock3,clk,reset,ready :
in ;
345 di0 :
in (
15 downto 0);
346 holds :
out (
3 downto 0);
347 DI :
out (
15 downto 0);
348 Address :
out (
8 downto 0);
349 state :
out (
3 downto 0);
359 usr_clk :
range 0 to 4095 :=
150
362 lock0,lock1,lock2,lock3,start :
out ;
363 count_lock_out :
in (
31 downto 0);
370 reset,start,stop,dclk :
in ;
371 count_lock_out :
out (
31 downto 0)
377 signal lock0_reg,lock1_reg,lock2_reg,lock3_reg,start_reg,done_reg : ;
378 signal count_lock_out_reg : (31 downto 0);
382 count_lock_out <= count_lock_out_reg;
384 DEN <= rd_drp or wr_drp;
416 count_lock_out => count_lock_out_reg,
429 count_lock_out => count_lock_out_reg,