SURF  1.0
TenGigEthGthUltraScaleRst.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : TenGigEthGthUltraScaleRst.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2015-05-04
5 -- Last update: 2015-12-03
6 -------------------------------------------------------------------------------
7 -- Description: 10GBASE-R Ethernet Reset Module
8 -------------------------------------------------------------------------------
9 -- This file is part of 'SLAC Firmware Standard Library'.
10 -- It is subject to the license terms in the LICENSE.txt file found in the
11 -- top-level directory of this distribution and at:
12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
13 -- No part of 'SLAC Firmware Standard Library', including this file,
14 -- may be copied, modified, propagated, or distributed except according to
15 -- the terms contained in the LICENSE.txt file.
16 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 use ieee.std_logic_unsigned.all;
21 use ieee.std_logic_arith.all;
22 
23 use work.StdRtlPkg.all;
24 
25 library unisim;
26 use unisim.vcomponents.all;
27 
28 --! @see entity
29  --! @ingroup ethernet_TenGigEthCore_gthUltraScale
31  generic (
32  TPD_G : time := 1 ns);
33  port (
34  extRst : in sl;
35  coreClk : in sl;
36  coreRst : out sl;
37  phyClk : out sl;
38  phyRst : out sl;
40  qplllock : in sl;
41  txClk322 : in sl;
42  txUsrClk : out sl;
43  txUsrClk2 : out sl;
44  gtTxRst : out sl;
45  gtRxRst : out sl;
46  txUsrRdy : out sl;
47  rstCntDone : out sl);
48 end TenGigEthGthUltraScaleRst;
49 
50 architecture rtl of TenGigEthGthUltraScaleRst is
51 
52  signal coreReset : sl;
53  signal phyReset : sl;
54  signal txClockGt : sl;
55  signal txClock : sl;
56  signal txReset : sl;
57  signal txReady : sl;
58 
59  signal rstCnt : slv(15 downto 0) := (others => '0');
60  signal rstPulse : slv(3 downto 0) := "1110";
61 
62 begin
63 
64  -- Clock Outputs
65  txUsrClk2 <= txClock;
66  phyClk <= txClock;
67 
68  -- Reset Outputs
69  coreRst <= coreReset;
70  phyRst <= txReset;
71  rstCntDone <= rstCnt(15);
72  gtTxRst <= rstPulse(0);
73  gtRxRst <= rstPulse(0);
74 
75  Synchronizer_0 : entity work.Synchronizer
76  generic map(
77  TPD_G => TPD_G,
78  RST_ASYNC_G => true,
79  RST_POLARITY_G => '1',
80  STAGES_G => 5,
81  INIT_G => "11111")
82  port map (
83  clk => coreClk,
84  rst => extRst,
85  dataIn => '0',
86  dataOut => coreReset);
87 
88  CLK312_BUFG_GT : BUFG_GT
89  port map (
90  I => txclk322,
91  CE => '1',
92  CEMASK => '1',
93  CLR => txBufgGtRst,
94  CLRMASK => '0',
95  DIV => "000",
96  O => txUsrClk);
97 
98  CLK156_BUFG_GT : BUFG_GT
99  port map (
100  I => txclk322,
101  CE => '1',
102  CEMASK => '1',
103  CLR => txBufgGtRst,
104  CLRMASK => '0',
105  DIV => "001",
106  O => txClockGt);
107 
108  CLK156_BUFG : BUFG
109  port map (
110  I => txClockGt,
111  O => txClock);
112 
113  Synchronizer_1 : entity work.Synchronizer
114  generic map(
115  TPD_G => TPD_G,
116  RST_ASYNC_G => true,
117  RST_POLARITY_G => '0',
118  STAGES_G => 5,
119  INIT_G => "00000")
120  port map (
121  clk => txClock,
122  rst => qPllLock,
123  dataIn => '1',
124  dataOut => txReady);
125 
126  Synchronizer_2 : entity work.Synchronizer
127  generic map(
128  TPD_G => TPD_G,
129  RST_ASYNC_G => true,
130  RST_POLARITY_G => '1',
131  STAGES_G => 5,
132  INIT_G => "11111")
133  port map (
134  clk => txClock,
135  rst => rstPulse(0),
136  dataIn => '0',
137  dataOut => txReset);
138 
139  process(coreClk)
140  begin
141  if rising_edge(coreClk) then
142  -- Hold off release the GT resets until 500ns after configuration.
143  -- 256 ticks at the minimum possible 2.56ns period (390MHz) will be >> 500 ns.
144  if rstCnt(15) = '0' then
145  rstCnt <= rstCnt + 1 after TPD_G;
146  else
147  rstCnt <= rstCnt after TPD_G;
148  end if;
149  -- Check for reset
150  if coreReset = '1' then
151  rstPulse <= "1110" after TPD_G;
152  elsif rstCnt(15) = '1' then
153  rstPulse(3) <= '0' after TPD_G;
154  rstPulse(2 downto 0) <= rstPulse(3 downto 1) after TPD_G;
155  end if;
156  end if;
157  end process;
158 
159  process(txClock)
160  begin
161  if rising_edge(txClock) then
162  if txReset = '1' then
163  txUsrRdy <= '0' after TPD_G;
164  else
165  txUsrRdy <= txReady after TPD_G;
166  end if;
167  end if;
168  end process;
169 
170 end rtl;
INIT_Gslv := "0"
std_logic sl
Definition: StdRtlPkg.vhd:28
in rstsl :=not RST_POLARITY_G
STAGES_Gpositive := 2
RST_POLARITY_Gsl := '1'
out dataOutsl
TPD_Gtime := 1 ns
RST_ASYNC_Gboolean := false
std_logic_vector slv
Definition: StdRtlPkg.vhd:29