SURF  1.0
Gtp7RxRstSeq.vhd
Go to the documentation of this file.
1 ------------------------------------------------------------------------------
2 -- ____ ____
3 -- / /\/ /
4 -- /___/ \ / Vendor: Xilinx
5 -- \ \ \/ Version : 3.4
6 -- \ \ Application : 7 Series FPGAs Transceivers Wizard
7 -- / / Filename : gtwizard_0_gtrxreset_seq.vhd
8 -- /___/ /\
9 -- \ \ / \
10 -- \___\/\___\
11 --
12 --
13 -- Module gtwizard_0_gtrxreset_seq
14 -- Generated by Xilinx 7 Series FPGAs Transceivers Wizard
15 --
16 --
17 -- (c) Copyright 2010-2012 Xilinx, Inc. All rights reserved.
18 --
19 -- This file contains confidential and proprietary information
20 -- of Xilinx, Inc. and is protected under U.S. and
21 -- international copyright and other intellectual property
22 -- laws.
23 --
24 -- DISCLAIMER
25 -- This disclaimer is not a license and does not grant any
26 -- rights to the materials distributed herewith. Except as
27 -- otherwise provided in a valid license issued to you by
28 -- Xilinx, and to the maximum extent permitted by applicable
29 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
30 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
31 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
32 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
33 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
34 -- (2) Xilinx shall not be liable (whether in contract or tort,
35 -- including negligence, or under any other theory of
36 -- liability) for any loss or damage of any kind or nature
37 -- related to, arising under or in connection with these
38 -- materials, including for any direct, or any indirect,
39 -- special, incidental, or consequential loss or damage
40 -- (including loss of data, profits, goodwill, or any type of
41 -- loss or damage suffered as a result of any action brought
42 -- by a third party) even if such damage or loss was
43 -- reasonably foreseeable or Xilinx had been advised of the
44 -- possibility of the same.
45 --
46 -- CRITICAL APPLICATIONS
47 -- Xilinx products are not designed or intended to be fail-
48 -- safe, or for use in any application requiring fail-safe
49 -- performance, such as life-support or safety devices or
50 -- systems, Class III medical devices, nuclear facilities,
51 -- applications related to the deployment of airbags, or any
52 -- other applications that could lead to death, personal
53 -- injury, or severe property or environmental damage
54 -- (individually and collectively, "Critical
55 -- Applications"). Customer assumes the sole risk and
56 -- liability of any use of Xilinx products in Critical
57 -- Applications, subject only to applicable laws and
58 -- regulations governing limitations on product liability.
59 --
60 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
61 -- PART OF THIS FILE AT ALL TIMES.
62 
63 
64 library ieee;
65 use ieee.std_logic_1164.all;
66 use ieee.numeric_std.all;
67 
68 
69 --! @see entity
70  --! @ingroup xilinx_7Series_gtp7
71 entity Gtp7RxRstSeq is
72  generic(
73  TPD_G : time := 1 ns);
74  port (
75  RST_IN : in std_logic;
76  GTRXRESET_IN : in std_logic;
77  RXPMARESETDONE : in std_logic;
78  GTRXRESET_OUT : out std_logic;
79 
80  DRPCLK : in std_logic;
81  DRPADDR : out std_logic_vector(8 downto 0);
82  DRPDO : in std_logic_vector(15 downto 0);
83  DRPDI : out std_logic_vector(15 downto 0);
84  DRPRDY : in std_logic;
85  DRPEN : out std_logic;
86  DRPWE : out std_logic;
87  DRP_OP_DONE : out std_logic
88  );
89 end Gtp7RxRstSeq;
90 
91 architecture Behavioral of Gtp7RxRstSeq is
92 
93  type state_type is (
94  idle,
95  drp_rd,
96  wait_rd_data,
97  wr_16,
98  wait_wr_done1,
99  wait_pmareset,
100  wr_20,
101  wait_wr_done2);
102 
103  signal state : state_type := idle;
104  signal next_state : state_type := idle;
105  signal gtrxreset_s : std_logic;
106  signal gtrxreset_ss : std_logic;
107  signal rxpmaresetdone_ss : std_logic;
108  signal rxpmaresetdone_sss : std_logic;
109  signal rd_data : std_logic_vector(15 downto 0);
110  signal next_rd_data : std_logic_vector(15 downto 0);
111  signal original_rd_data : std_logic_vector(15 downto 0);
112  signal pmarstdone_fall_edge : std_logic;
113  signal gtrxreset_i : std_logic;
114  signal flag : std_logic := '0';
115  signal gtrxreset_o : std_logic;
116  signal drpen_o : std_logic;
117  signal drpwe_o : std_logic;
118  signal drpaddr_o : std_logic_vector(8 downto 0);
119  signal drpdi_o : std_logic_vector(15 downto 0);
120  signal drp_op_done_o : std_logic;
121  signal RST : std_logic;
122  signal GTRXRESET : std_logic;
123 
124 begin
125 
126  sync_RXPMARESETDONE : entity work.Synchronizer
127  generic map (
128  TPD_G => TPD_G)
129  port map (
130  clk => DRPCLK,
133 
134  sync_RST : entity work.RstSync
135  generic map (
136  TPD_G => TPD_G)
137  port map (
138  clk => DRPCLK,
139  asyncRst => RST_IN,
140  syncRst => RST);
141 
142  sync_GTRXRESET : entity work.RstSync
143  generic map (
144  TPD_G => TPD_G)
145  port map (
146  clk => DRPCLK,
148  syncRst => GTRXRESET);
149 
150  -- Output assignment
152  DRPEN <= drpen_o;
153  DRPWE <= drpwe_o;
154  DRPADDR <= drpaddr_o;
155  DRPDI <= drpdi_o;
157 
158  process (DRPCLK)
159  begin
160  if rising_edge(DRPCLK) then
161  if (RST = '1') then
162  state <= idle after TPD_G;
163  gtrxreset_s <= '0' after TPD_G;
164  gtrxreset_ss <= '0' after TPD_G;
165  rxpmaresetdone_sss <= '0' after TPD_G;
166  rd_data <= x"0000" after TPD_G;
167  gtrxreset_o <= '0' after TPD_G;
168  else
169  state <= next_state after TPD_G;
170  gtrxreset_s <= GTRXRESET after TPD_G;
171  gtrxreset_ss <= gtrxreset_s after TPD_G;
173  rd_data <= next_rd_data after TPD_G;
174  gtrxreset_o <= gtrxreset_i after TPD_G;
175  end if;
176  end if;
177  end process;
178 
179  process (DRPCLK)
180  begin
181  if rising_edge(DRPCLK) then
182  if (GTRXRESET = '1') then
183  drp_op_done_o <= '0' after TPD_G;
184  else
185  if (state = wait_wr_done2 and DRPRDY = '1') then
186  drp_op_done_o <= '1' after TPD_G;
187  else
189  end if;
190  end if;
191  end if;
192  end process;
193 
195 
197  begin
198  case state is
199 
200  when idle =>
201  if (gtrxreset_ss = '1') then
202  next_state <= drp_rd;
203  else
204  next_state <= idle;
205  end if;
206 
207  when drp_rd =>
208  next_state <= wait_rd_data;
209 
210  when wait_rd_data =>
211  if (DRPRDY = '1')then
212  next_state <= wr_16;
213  else
214  next_state <= wait_rd_data;
215  end if;
216 
217  when wr_16 =>
218  next_state <= wait_wr_done1;
219 
220  when wait_wr_done1 =>
221  if (DRPRDY = '1') then
222  next_state <= wait_pmareset;
223  else
224  next_state <= wait_wr_done1;
225  end if;
226 
227  when wait_pmareset =>
228  if (pmarstdone_fall_edge = '1') then
229  next_state <= wr_20;
230  else
231  next_state <= wait_pmareset;
232  end if;
233 
234  when wr_20 =>
235  next_state <= wait_wr_done2;
236 
237  when wait_wr_done2 =>
238  if (DRPRDY = '1') then
239  next_state <= idle;
240  else
241  next_state <= wait_wr_done2;
242  end if;
243 
244  when others=>
245  next_state <= idle;
246 
247  end case;
248  end process;
249 
250 -- drives DRP interface and GTRXRESET_OUT
252  begin
253 -- assert gtrxreset_out until wr to 16-bit is complete
254 -- RX_DATA_WIDTH is located at addr x"0011", [13 downto 11]
255 -- encoding is this : /16 = x "2", /20 = x"3", /32 = x"4", /40 = x"5"
256  gtrxreset_i <= '0';
257  drpaddr_o <= '0'& x"11"; -- 000010001
258  drpen_o <= '0';
259  drpwe_o <= '0';
260  drpdi_o <= x"0000";
262 
263  case state is
264 
265  --do nothing to DRP or reset
266  when idle =>
267  null;
268 
269  --assert reset and issue rd
270  when drp_rd =>
271  gtrxreset_i <= '1';
272  drpen_o <= '1';
273  drpwe_o <= '0';
274 
275  --assert reset and wait to load rd data
276  when wait_rd_data =>
277  gtrxreset_i <= '1';
278  if (DRPRDY = '1' and flag = '0') then
279  next_rd_data <= DRPDO;
280  elsif (DRPRDY = '1' and flag = '1') then
282  else
284  end if;
285 
286  --assert reset and write to 16-bit mode
287  when wr_16=>
288  gtrxreset_i <= '1';
289  drpen_o <= '1';
290  drpwe_o <= '1';
291  -- Addr "00001001" [11] = '0' puts width mode in /16 or /32
292  drpdi_o <= rd_data(15 downto 12) & '0' & rd_data(10 downto 0);
293 
294  --keep asserting reset until write to 16-bit mode is complete
295  when wait_wr_done1 =>
296  gtrxreset_i <= '1';
297 
298  --deassert reset and no DRP access until 2nd pmareset
299  when wait_pmareset =>
300  if (gtrxreset_ss = '1') then
301  gtrxreset_i <= '1';
302  else
303  gtrxreset_i <= '0';
304  end if;
305 
306  --write to 20-bit mode
307  when wr_20 =>
308  drpen_o <= '1';
309  drpwe_o <= '1';
310  drpdi_o <= rd_data(15 downto 0); --restore user setting per prev read
311 
312  --wait to complete write to 20-bit mode
313  when wait_wr_done2 =>
314  null;
315 
316  when others =>
317  null;
318 
319  end case;
320  end process;
321 
322  process (DRPCLK)
323  begin
324  if rising_edge(DRPCLK) then
325  if(state = wr_16 or state = wait_pmareset or state = wr_20 or state = wait_wr_done1) then
326  flag <= '1' after TPD_G;
327  elsif(state = wait_wr_done2) then
328  flag <= '0' after TPD_G;
329  end if;
330  if(state = wait_rd_data and DRPRDY = '1' and flag = '0') then
331  original_rd_data <= DRPDO after TPD_G;
332  end if;
333  end if;
334  end process;
335 
336 end Behavioral;
_library_ ieeeieee
Definition: Gtp7RxRst.vhd:70
state_type := idle state
out DRPADDRstd_logic_vector( 8 downto 0)
out syncRstsl
Definition: RstSync.vhd:36
in DRPDOstd_logic_vector( 15 downto 0)
in RXPMARESETDONEstd_logic
std_logic_vector( 15 downto 0) next_rd_data
in asyncRstsl
Definition: RstSync.vhd:35
out dataOutsl
in clksl
Definition: RstSync.vhd:34
out DRPWEstd_logic
state_type := idle next_state
out DRPDIstd_logic_vector( 15 downto 0)
std_logic_vector( 15 downto 0) rd_data
in GTRXRESET_INstd_logic
TPD_Gtime := 1 ns
in DRPRDYstd_logic
(idle,drp_rd,wait_rd_data,wr_16,wait_wr_done1,wait_pmareset,wr_20,wait_wr_done2) state_type
std_logic := '0' flag
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
TPD_Gtime := 1 ns
out DRPENstd_logic
std_logic_vector( 15 downto 0) drpdi_o
in DRPCLKstd_logic
out GTRXRESET_OUTstd_logic
std_logic_vector( 8 downto 0) drpaddr_o
std_logic_vector( 15 downto 0) original_rd_data
in RST_INstd_logic
out DRP_OP_DONEstd_logic