eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
aurora_reset.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 13.09.2017 15:19:24
6 -- Design Name:
7 -- Module Name: aurora_reset - RTL
8 -- Project Name:
9 -- Target Devices:
10 -- Tool Versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 
21 
22 library IEEE;
23 use IEEE.STD_LOGIC_1164.ALL;
24 use IEEE.STD_LOGIC_UNSIGNED.ALL;
25 
26 -- Uncomment the following library declaration if using
27 -- arithmetic functions with Signed or Unsigned values
28 --use IEEE.NUMERIC_STD.ALL;
29 
30 -- Uncomment the following library declaration if instantiating
31 -- any Xilinx leaf cells in this code.
32 --library UNISIM;
33 --use UNISIM.VComponents.all;
34 
35 entity aurora_reset is
36 
37 Port ( init_clk : in STD_LOGIC;
38  BTN0 : in STD_LOGIC;
39  rst_sw : in STD_LOGIC;
40  tx_reset : out STD_LOGIC;
41  tx_GTReset : out STD_LOGIC := '0';
42  rx_reset : out STD_LOGIC;
43  rx_GTReset : out STD_LOGIC := '0');
44 end aurora_reset;
45 
46 architecture RTL of aurora_reset is
47 signal samp1 : std_logic := '1';
48 signal samp2 : std_logic := '1';
49 signal btn_samp1 : std_logic := '0';
50 signal start_seq : std_logic := '0';
51 signal count : std_logic_vector(15 downto 0) := X"0000";
52 signal pwrcount : std_logic_vector(15 downto 0) := X"0000";
53 signal tx_btn_reset : std_logic := '0';
54 signal rx_btn_reset : std_logic := '0';
55 signal tx_pwr_reset : std_logic := '0';
56 signal rx_pwr_reset : std_logic := '0';
57 signal rx_pwr_GTReset : std_logic := '0';
58 signal tx_pwr_GTReset : std_logic := '0';
59 signal rx_btn_GTReset : std_logic := '0';
60 signal tx_btn_GTReset : std_logic := '0';
61 
62 signal pwr_on : std_logic;
63 
64 begin
65 --power-on
66 --use a switch to hold system in power-up until both boards can be configured. Then release switch to start the sequence of
67 -- both resets and GTresets
68 
69 --normal reset
70 --use BTN0 to start sequence. No GTreset should be issued
71 
72 
73 --Power_on_reset
74 --Simplex power-on sequence:
75 --1. Deassert TX-side gt_reset (A)
76 --2. Deassert RX-side gt_reset (C)
77 --3. Deassert RX-side reset synchronous to user_clk (D)
78 --4. Deassert TX-side reset synchronous to user_clk (B)
79 --Note: Care must be taken to ensure that the (D) to (B) time difference is as minimal as possible.
80 
81 
82 
83  process (init_clk) begin
84  if rising_edge (init_clk) then
85  samp1 <= rst_sw;
86  samp2 <= samp1;
87  end if;
88 
89  end process;
90 
91  pwr_on <= samp2 and not samp1;
92 
93 
94  process (init_clk) begin
95  if rising_edge (init_clk) then
96  if pwr_on = '1' then
97  pwrcount <= X"FFFF";
98  elsif pwrcount /= X"0000" then
99  pwrcount <= (pwrcount - '1');
100  end if;
101  end if;
102  end process;
103 
104  process (init_clk) begin
105  if rising_edge(init_clk) then
106  if (pwrcount = X"0000" and samp2 = '0') then
107  tx_pwr_reset <= '0';
108  rx_pwr_reset <= '0';
109  tx_pwr_GTReset <= '0';
110  rx_pwr_GTREset <= '0';
111 
112  elsif (samp2 = '1') then
113  tx_pwr_reset <= '1';
114  rx_pwr_reset <= '1';
115  tx_pwr_GTReset <= '1';
116  rx_pwr_GTREset <= '1';
117  end if;
118 
119 --1. Deassert TX-side gt_reset (A)
120  if (pwrcount = X"8000") then
121  tx_pwr_GTReset <='0';
122 
123 --2. Deassert RX-side gt_reset (C)
124  elsif (pwrcount = X"7000") then
125  tx_pwr_GTReset <='0';
126  rx_pwr_GTReset <='0';
127 
128 --3. Deassert RX-side reset synchronous to user_clk (D)
129 
130  elsif (pwrcount = X"0020") then
131  rx_pwr_reset <='0';
132 
133 --4. Deassert TX-side reset synchronous to user_clk (B)
134 --Note: Care must be taken to ensure that the (D) to (B) time difference is as minimal as possible.
135 
136  elsif (pwrcount = X"001D") then
137  tx_pwr_reset <='0';
138 
139  end if;
140  end if;
141  end process;
142 
143 
144 --Button_0_reset
145 --1. tx_system_reset and rx_system_reset are asserted for at least six clock
146 -- user_clk time periods.
147 --2. tx_channel_up and rx_channel_up are deasserted after three user_clk cycles.
148 --3. rx_system_reset is deasserted (or) released after tx_system_reset is deasserted.
149 -- This ensures that the transceiver in the simplex-TX core starts transmitting initialization
150 -- data much earlier and it enhances the likelihood of the simplex-RX core aligning to the
151 -- correct data sequence.
152 --4. rx_channel_up is asserted before tx_channel_up assertion. This condition must be
153 -- satisfied by the simplex-RX core and simplex timer parameters (C_ALIGNED_TIMER,
154 -- C_BONDED_TIMER and C_VERIFY_TIMER) in the simplex-TX core need to be adjusted to
155 -- meet this criteria.
156 --5. tx_channel_up is asserted when the simplex-TX core completes the Aurora 8B/10B
157 -- protocol channel initialization sequence transmission for the configured time. Assertion
158 -- of tx_channel_up last ensures that the simplex-TX core transmits the Aurora
159 -- initialization sequence when the simplex-RX core is ready.
160 
161  process (init_clk) begin
162  if rising_edge(init_clk) then
163  if ((BTN0 = '1') and (btn_samp1 = '0')) then btn_samp1 <= '1';
164  elsif ((BTN0 = '0') and (btn_samp1 = '1')) then start_seq <= '1';
165  end if;
166 
167  if (start_seq ='1') then
168  btn_samp1 <= '0';
169  start_seq <= '0';
170  end if;
171  end if;
172  end process;
173 
174 
175  process (init_clk) begin
176  if rising_edge(init_clk) then
177  if (start_seq = '1') then count <= X"FFFF";
178  elsif (start_seq = '0' and count = X"0000") then count <= X"0000";
179  else count <= (count - '1');
180  end if;
181  end if;
182  end process;
183 
184  process (init_clk) begin
185  if rising_edge(init_clk) then
186  if (start_seq = '1') then
187  rx_btn_reset <= '1';
188  tx_btn_reset <= '1';
189 
190  elsif (count = X"FEFF") then
191  tx_btn_reset <='1';
192 
193  elsif (count = X"FDFF") then
194  tx_btn_GTReset <='1';
195 
196  elsif (count = X"FDF0") then
197  tx_btn_GTReset <='0';
198 
199  elsif (count = X"FDE0") then
200  rx_btn_GTReset <='1';
201 
202  elsif (count = X"FDD0") then
203  rx_btn_GTReset <='0';
204 
205  elsif (count = X"0040") then
206  tx_btn_reset <='0';
207 
208 --3. rx_system_reset is deasserted (or) released after tx_system_reset is deasserted.
209 
210  elsif (count = X"0020") then
211 
212  rx_btn_reset <='0';
213  end if;
214  end if;
215  end process;
216 
217 
218  tx_reset <= tx_pwr_reset or tx_btn_reset;
219  rx_reset <= rx_pwr_reset or rx_btn_reset;
220  tx_GTReset <= tx_pwr_GTReset or tx_btn_GTReset;
221  rx_GTReset <= rx_pwr_GTReset or rx_btn_GTReset;
222 
223 
224 end RTL;