1 |
11 |
N.Boukadid |
library ieee;
|
2 |
|
|
use ieee.std_logic_1164.all;
|
3 |
|
|
library work;
|
4 |
|
|
|
5 |
|
|
entity interlaken_interface is
|
6 |
|
|
generic(
|
7 |
|
|
BurstMax : positive; -- Configurable value of BurstMax
|
8 |
|
|
BurstShort : positive; -- Configurable value of BurstShort
|
9 |
|
|
PacketLength : positive -- Configurable value of PacketLength
|
10 |
|
|
);
|
11 |
|
|
port (
|
12 |
|
|
------ 200 MHz input, to clock generator -----------
|
13 |
|
|
System_Clock_In_P : in std_logic;
|
14 |
|
|
System_Clock_In_N : in std_logic;
|
15 |
|
|
|
16 |
|
|
----125/156,25 MHz input, to transceiver (SGMII/SMA clock)--
|
17 |
|
|
GTREFCLK_IN_P : in std_logic;
|
18 |
|
|
GTREFCLK_IN_N : in std_logic;
|
19 |
|
|
|
20 |
|
|
------ User clk output, to other logic -------------
|
21 |
|
|
System_Clock_Gen : out std_logic;
|
22 |
|
|
|
23 |
|
|
---------- Data signals ----------------------------
|
24 |
|
|
TX_Data : in std_logic_vector(63 downto 0); -- Data transmitted
|
25 |
|
|
RX_Data : out std_logic_vector(63 downto 0); -- Data received
|
26 |
|
|
|
27 |
|
|
---- Transceiver related transmission --------------
|
28 |
|
|
TX_Out_P : out std_logic;
|
29 |
|
|
TX_Out_N : out std_logic;
|
30 |
|
|
RX_In_P : in std_logic;
|
31 |
|
|
RX_In_N : in std_logic;
|
32 |
|
|
|
33 |
|
|
---- Transmitter input/ready signals ---------------
|
34 |
|
|
TX_SOP : in std_logic;
|
35 |
|
|
TX_EOP : in std_logic;
|
36 |
|
|
TX_EOP_Valid : in std_logic_vector(2 downto 0);
|
37 |
|
|
TX_FlowControl : in std_logic_vector(15 downto 0);
|
38 |
|
|
TX_Channel : in std_logic_vector(7 downto 0);
|
39 |
|
|
|
40 |
|
|
------ Receiver output signals ---------------------
|
41 |
|
|
RX_SOP : out std_logic; -- Start of Packet
|
42 |
|
|
RX_EOP : out std_logic; -- End of Packet
|
43 |
|
|
RX_EOP_Valid : out std_logic_vector(2 downto 0); -- Valid bytes packet contains
|
44 |
|
|
RX_FlowControl : out std_logic_vector(15 downto 0); -- Flow control data (yet unutilized)
|
45 |
|
|
RX_Channel : out std_logic_vector(7 downto 0); -- Select transmit channel (yet unutilized)
|
46 |
|
|
|
47 |
|
|
RX_Valid_Out : out std_logic;
|
48 |
|
|
|
49 |
|
|
------ Transmitter status signals-------------------
|
50 |
|
|
TX_FIFO_Full : out std_logic;
|
51 |
|
|
TX_FIFO_Write : in std_logic;
|
52 |
|
|
TX_FIFO_progfull: out std_logic;
|
53 |
|
|
|
54 |
|
|
---------- Debug signals ----------------------------
|
55 |
|
|
RX_in : out std_logic_vector(63 downto 0);
|
56 |
|
|
TX_out : out std_logic_vector(63 downto 0);
|
57 |
|
|
Data_Descrambler : out std_logic_vector(66 downto 0);
|
58 |
|
|
Data_Decoder : out std_logic_vector(66 downto 0);
|
59 |
|
|
|
60 |
|
|
------- Receiver status signals ---------------------
|
61 |
|
|
RX_FIFO_Full : out std_logic;
|
62 |
|
|
RX_FIFO_Read : in std_logic;
|
63 |
|
|
Decoder_lock : out std_logic;
|
64 |
|
|
Descrambler_lock : out std_logic;
|
65 |
|
|
CRC24_Error : out std_logic;
|
66 |
|
|
CRC32_Error : out std_logic
|
67 |
|
|
|
68 |
|
|
);
|
69 |
|
|
end entity interlaken_interface;
|
70 |
|
|
|
71 |
|
|
architecture interface of interlaken_interface is
|
72 |
|
|
|
73 |
|
|
-------------------------- Generate System Clock ---------------------------
|
74 |
|
|
component clk_40MHz
|
75 |
|
|
port (
|
76 |
|
|
--Clock in- and output signals
|
77 |
|
|
clk_in1_p : in std_logic;
|
78 |
|
|
clk_in1_n : in std_logic;
|
79 |
|
|
clk_out1 : out std_logic;
|
80 |
|
|
clk_out2 : out std_logic;
|
81 |
|
|
|
82 |
|
|
-- Status and control signals
|
83 |
|
|
reset : in std_logic;
|
84 |
|
|
locked : out std_logic
|
85 |
|
|
);
|
86 |
|
|
end component;
|
87 |
|
|
|
88 |
|
|
-------------------------- Include Transceiver -----------------------------
|
89 |
|
|
component Transceiver_10g_64b67b
|
90 |
|
|
Port (
|
91 |
|
|
SOFT_RESET_TX_IN : in STD_LOGIC;
|
92 |
|
|
SOFT_RESET_RX_IN : in STD_LOGIC;
|
93 |
|
|
DONT_RESET_ON_DATA_ERROR_IN : in STD_LOGIC;
|
94 |
|
|
Q0_CLK1_GTREFCLK_PAD_N_IN : in STD_LOGIC;
|
95 |
|
|
Q0_CLK1_GTREFCLK_PAD_P_IN : in STD_LOGIC;
|
96 |
|
|
GT0_TX_FSM_RESET_DONE_OUT : out STD_LOGIC;
|
97 |
|
|
GT0_RX_FSM_RESET_DONE_OUT : out STD_LOGIC;
|
98 |
|
|
GT0_DATA_VALID_IN : in STD_LOGIC;
|
99 |
|
|
GT0_TX_MMCM_LOCK_OUT : out STD_LOGIC;
|
100 |
|
|
GT0_RX_MMCM_LOCK_OUT : out STD_LOGIC;
|
101 |
|
|
GT0_TXUSRCLK_OUT : out STD_LOGIC;
|
102 |
|
|
GT0_TXUSRCLK2_OUT : out STD_LOGIC;
|
103 |
|
|
GT0_RXUSRCLK_OUT : out STD_LOGIC;
|
104 |
|
|
GT0_RXUSRCLK2_OUT : out STD_LOGIC;
|
105 |
|
|
gt0_drpaddr_in : in STD_LOGIC_VECTOR ( 8 downto 0 );
|
106 |
|
|
gt0_drpdi_in : in STD_LOGIC_VECTOR ( 15 downto 0 );
|
107 |
|
|
gt0_drpdo_out : out STD_LOGIC_VECTOR ( 15 downto 0 );
|
108 |
|
|
gt0_drpen_in : in STD_LOGIC;
|
109 |
|
|
gt0_drprdy_out : out STD_LOGIC;
|
110 |
|
|
gt0_drpwe_in : in STD_LOGIC;
|
111 |
|
|
gt0_dmonitorout_out : out STD_LOGIC_VECTOR ( 7 downto 0 );
|
112 |
|
|
gt0_eyescanreset_in : in STD_LOGIC;
|
113 |
|
|
gt0_rxuserrdy_in : in STD_LOGIC;
|
114 |
|
|
gt0_eyescandataerror_out : out STD_LOGIC;
|
115 |
|
|
gt0_eyescantrigger_in : in STD_LOGIC;
|
116 |
|
|
gt0_rxdata_out : out STD_LOGIC_VECTOR ( 63 downto 0 );
|
117 |
|
|
gt0_gtxrxp_in : in STD_LOGIC;
|
118 |
|
|
gt0_gtxrxn_in : in STD_LOGIC;
|
119 |
|
|
gt0_rxdfelpmreset_in : in STD_LOGIC;
|
120 |
|
|
gt0_rxmonitorout_out : out STD_LOGIC_VECTOR ( 6 downto 0 );
|
121 |
|
|
gt0_rxmonitorsel_in : in STD_LOGIC_VECTOR ( 1 downto 0 );
|
122 |
|
|
gt0_rxoutclkfabric_out : out STD_LOGIC;
|
123 |
|
|
gt0_rxdatavalid_out : out STD_LOGIC;
|
124 |
|
|
gt0_rxheader_out : out STD_LOGIC_VECTOR ( 2 downto 0 );
|
125 |
|
|
gt0_rxheadervalid_out : out STD_LOGIC;
|
126 |
|
|
gt0_rxgearboxslip_in : in STD_LOGIC;
|
127 |
|
|
gt0_gtrxreset_in : in STD_LOGIC;
|
128 |
|
|
gt0_rxpmareset_in : in STD_LOGIC;
|
129 |
|
|
gt0_rxresetdone_out : out STD_LOGIC;
|
130 |
|
|
gt0_gttxreset_in : in STD_LOGIC;
|
131 |
|
|
gt0_txuserrdy_in : in STD_LOGIC;
|
132 |
|
|
gt0_txdata_in : in STD_LOGIC_VECTOR ( 63 downto 0 );
|
133 |
|
|
gt0_gtxtxn_out : out STD_LOGIC;
|
134 |
|
|
gt0_gtxtxp_out : out STD_LOGIC;
|
135 |
|
|
gt0_txoutclkfabric_out : out STD_LOGIC;
|
136 |
|
|
gt0_txoutclkpcs_out : out STD_LOGIC;
|
137 |
|
|
gt0_txgearboxready_out : out STD_LOGIC;
|
138 |
|
|
gt0_txheader_in : in STD_LOGIC_VECTOR ( 2 downto 0 );
|
139 |
|
|
gt0_txstartseq_in : in STD_LOGIC;
|
140 |
|
|
gt0_txresetdone_out : out STD_LOGIC;
|
141 |
|
|
GT0_QPLLLOCK_OUT : out STD_LOGIC;
|
142 |
|
|
GT0_QPLLREFCLKLOST_OUT : out STD_LOGIC;
|
143 |
|
|
GT0_QPLLOUTCLK_OUT : out STD_LOGIC;
|
144 |
|
|
GT0_QPLLOUTREFCLK_OUT : out STD_LOGIC;
|
145 |
|
|
sysclk_in : in STD_LOGIC
|
146 |
|
|
);
|
147 |
|
|
end component;
|
148 |
|
|
|
149 |
|
|
signal System_Clock_40, System_Clock_user: std_logic;
|
150 |
|
|
signal TX_User_Clock, RX_User_Clock : std_logic;
|
151 |
|
|
|
152 |
|
|
signal RX_prog_full : std_logic_vector(15 downto 0);
|
153 |
|
|
signal FlowControl : std_logic_vector(15 downto 0);
|
154 |
|
|
signal RX_Datavalid_Out : std_logic;
|
155 |
|
|
signal RX_Header_Out : std_logic_vector(2 downto 0);
|
156 |
|
|
signal RX_Headervalid_Out : std_logic;
|
157 |
|
|
signal RX_Gearboxslip_In : std_logic;
|
158 |
|
|
signal RX_Resetdone_Out : std_logic;
|
159 |
|
|
|
160 |
|
|
signal TX_Gearboxready_Out : std_logic;
|
161 |
|
|
signal TX_Header_In : std_logic_vector(2 downto 0);
|
162 |
|
|
signal TX_Startseq_In : std_logic;
|
163 |
|
|
signal TX_Resetdone_Out : std_logic;
|
164 |
|
|
|
165 |
|
|
signal Data_Transceiver_In, Data_Transceiver_Out : std_logic_vector(63 downto 0);
|
166 |
|
|
signal GT0_DATA_VALID_IN : std_logic;
|
167 |
|
|
signal GT0_TX_FSM_RESET_DONE_OUT : std_logic;
|
168 |
|
|
signal locked, reset : std_logic;
|
169 |
|
|
signal link_up : std_logic;
|
170 |
|
|
signal Descrambler_Locked : std_logic;
|
171 |
|
|
|
172 |
|
|
begin
|
173 |
|
|
------------------------------ System Clock --------------------------------
|
174 |
|
|
System_Clock : clk_40MHz
|
175 |
|
|
port map (
|
176 |
|
|
clk_in1_p => System_Clock_In_P,
|
177 |
|
|
clk_in1_n => System_Clock_In_N,
|
178 |
|
|
clk_out1 => System_Clock_40,
|
179 |
|
|
clk_out2 => System_Clock_user,
|
180 |
|
|
|
181 |
|
|
reset => '0',
|
182 |
|
|
locked => locked
|
183 |
|
|
);
|
184 |
|
|
|
185 |
|
|
System_Clock_Gen <= System_Clock_user;
|
186 |
|
|
reset <= not locked;
|
187 |
|
|
|
188 |
|
|
------------------------------- Transceiver --------------------------------
|
189 |
|
|
Transceiver_10g_64b67b_i : Transceiver_10g_64b67b
|
190 |
|
|
port map (
|
191 |
|
|
SOFT_RESET_TX_IN => reset,
|
192 |
|
|
SOFT_RESET_RX_IN => reset,
|
193 |
|
|
DONT_RESET_ON_DATA_ERROR_IN => '0',
|
194 |
|
|
Q0_CLK1_GTREFCLK_PAD_N_IN => GTREFCLK_IN_N,
|
195 |
|
|
Q0_CLK1_GTREFCLK_PAD_P_IN => GTREFCLK_IN_P,
|
196 |
|
|
|
197 |
|
|
GT0_TX_FSM_RESET_DONE_OUT => GT0_TX_FSM_RESET_DONE_OUT,
|
198 |
|
|
GT0_RX_FSM_RESET_DONE_OUT => open,
|
199 |
|
|
GT0_DATA_VALID_IN => GT0_DATA_VALID_IN,
|
200 |
|
|
GT0_TX_MMCM_LOCK_OUT => open,
|
201 |
|
|
GT0_RX_MMCM_LOCK_OUT => open,
|
202 |
|
|
|
203 |
|
|
GT0_TXUSRCLK_OUT => open,
|
204 |
|
|
GT0_TXUSRCLK2_OUT => TX_User_Clock,
|
205 |
|
|
GT0_RXUSRCLK_OUT => open,
|
206 |
|
|
GT0_RXUSRCLK2_OUT => RX_User_Clock,
|
207 |
|
|
|
208 |
|
|
--_________________________________________________________________________
|
209 |
|
|
--GT0 (X0Y2)
|
210 |
|
|
--____________________________CHANNEL PORTS________________________________
|
211 |
|
|
---------------------------- Channel - DRP Ports --------------------------
|
212 |
|
|
gt0_drpaddr_in => (others => '0'),
|
213 |
|
|
gt0_drpdi_in => (others => '0'),
|
214 |
|
|
gt0_drpdo_out => open,
|
215 |
|
|
gt0_drpen_in => '0',
|
216 |
|
|
gt0_drprdy_out => open,
|
217 |
|
|
gt0_drpwe_in => '0',
|
218 |
|
|
--------------------------- Digital Monitor Ports --------------------------
|
219 |
|
|
gt0_dmonitorout_out => open,
|
220 |
|
|
|
221 |
|
|
--------------------- RX Initialization and Reset Ports --------------------
|
222 |
|
|
gt0_eyescanreset_in => '0',
|
223 |
|
|
gt0_rxuserrdy_in => '1',
|
224 |
|
|
-------------------------- RX Margin Analysis Ports ------------------------
|
225 |
|
|
gt0_eyescandataerror_out => open,
|
226 |
|
|
gt0_eyescantrigger_in => '0',
|
227 |
|
|
------------------ Receive Ports - FPGA RX interface Ports -----------------
|
228 |
|
|
gt0_rxdata_out => Data_Transceiver_Out,
|
229 |
|
|
--------------------------- Receive Ports - RX AFE -------------------------
|
230 |
|
|
gt0_gtxrxp_in => RX_In_P,
|
231 |
|
|
------------------------ Receive Ports - RX AFE Ports ----------------------
|
232 |
|
|
gt0_gtxrxn_in => RX_In_N,
|
233 |
|
|
--------------------- Receive Ports - RX Equalizer Ports -------------------
|
234 |
|
|
gt0_rxdfelpmreset_in => '0',
|
235 |
|
|
gt0_rxmonitorout_out => open,
|
236 |
|
|
gt0_rxmonitorsel_in => (others => '0'),
|
237 |
|
|
--------------- Receive Ports - RX Fabric Output Control Ports -------------
|
238 |
|
|
gt0_rxoutclkfabric_out => open,
|
239 |
|
|
---------------------- Receive Ports - RX Gearbox Ports --------------------
|
240 |
|
|
gt0_rxdatavalid_out => RX_Datavalid_Out,
|
241 |
|
|
gt0_rxheader_out => RX_Header_Out,
|
242 |
|
|
gt0_rxheadervalid_out => RX_Headervalid_Out,
|
243 |
|
|
--------------------- Receive Ports - RX Gearbox Ports --------------------
|
244 |
|
|
gt0_rxgearboxslip_in => RX_Gearboxslip_In,
|
245 |
|
|
------------- Receive Ports - RX Initialization and Reset Ports ------------
|
246 |
|
|
gt0_gtrxreset_in => reset,
|
247 |
|
|
gt0_rxpmareset_in => '0',
|
248 |
|
|
-------------- Receive Ports -RX Initialization and Reset Ports ------------
|
249 |
|
|
gt0_rxresetdone_out => RX_Resetdone_Out,
|
250 |
|
|
|
251 |
|
|
--------------------- TX Initialization and Reset Ports --------------------
|
252 |
|
|
gt0_gttxreset_in => reset,
|
253 |
|
|
gt0_txuserrdy_in => '1',
|
254 |
|
|
------------------ Transmit Ports - TX Data Path interface -----------------
|
255 |
|
|
gt0_txdata_in => Data_Transceiver_In,
|
256 |
|
|
---------------- Transmit Ports - TX Driver and OOB signaling --------------
|
257 |
|
|
gt0_gtxtxn_out => TX_Out_N,
|
258 |
|
|
gt0_gtxtxp_out => TX_Out_P,
|
259 |
|
|
----------- Transmit Ports - TX Fabric Clock Output Control Ports ----------
|
260 |
|
|
gt0_txoutclkfabric_out => open,
|
261 |
|
|
gt0_txoutclkpcs_out => open,
|
262 |
|
|
--------------------- Transmit Ports - TX Gearbox Ports --------------------
|
263 |
|
|
gt0_txgearboxready_out => TX_Gearboxready_Out,
|
264 |
|
|
gt0_txheader_in => TX_Header_In,
|
265 |
|
|
gt0_txstartseq_in => TX_Startseq_In,
|
266 |
|
|
------------- Transmit Ports - TX Initialization and Reset Ports -----------
|
267 |
|
|
gt0_txresetdone_out => TX_Resetdone_Out,
|
268 |
|
|
--____________________________COMMON PORTS________________________________
|
269 |
|
|
GT0_QPLLLOCK_OUT => open,
|
270 |
|
|
GT0_QPLLREFCLKLOST_OUT => open,
|
271 |
|
|
GT0_QPLLOUTCLK_OUT => open,
|
272 |
|
|
GT0_QPLLOUTREFCLK_OUT => open,
|
273 |
|
|
sysclk_in => System_Clock_40
|
274 |
|
|
);
|
275 |
|
|
|
276 |
|
|
startseq : process (TX_User_Clock)
|
277 |
|
|
begin
|
278 |
|
|
if rising_edge(TX_User_Clock) then
|
279 |
|
|
if (reset = '1') then
|
280 |
|
|
TX_Startseq_In <= '0';
|
281 |
|
|
elsif (TX_Gearboxready_Out = '1') then
|
282 |
|
|
TX_Startseq_In <= '1';
|
283 |
|
|
end if;
|
284 |
|
|
end if;
|
285 |
|
|
end process;
|
286 |
|
|
|
287 |
|
|
---------------------------- Transmitting side -----------------------------
|
288 |
|
|
Interlaken_TX : entity work.Interlaken_Transmitter
|
289 |
|
|
generic map(
|
290 |
|
|
BurstMax => BurstMax, -- Configurable value of BurstMax
|
291 |
|
|
BurstShort => BurstShort, -- Configurable value of BurstShort
|
292 |
|
|
PacketLength => PacketLength -- Configurable value of PacketLength
|
293 |
|
|
)
|
294 |
|
|
port map (
|
295 |
|
|
write_clk => System_Clock_user,
|
296 |
|
|
clk => TX_User_Clock,
|
297 |
|
|
reset => reset,
|
298 |
|
|
|
299 |
|
|
TX_Data_In => TX_Data,
|
300 |
|
|
TX_Data_Out(63 downto 0) => Data_Transceiver_In,
|
301 |
|
|
TX_Data_Out(66 downto 64) => TX_Header_In,
|
302 |
|
|
|
303 |
|
|
TX_SOP => TX_SOP,
|
304 |
|
|
TX_EOP_Valid => TX_EOP_Valid,
|
305 |
|
|
TX_EOP => TX_EOP,
|
306 |
|
|
TX_Channel => TX_Channel,
|
307 |
|
|
TX_Gearboxready => TX_Gearboxready_Out,
|
308 |
|
|
TX_Startseq => TX_Startseq_In,
|
309 |
|
|
|
310 |
|
|
FIFO_Write_Data => TX_FIFO_Write,
|
311 |
|
|
FIFO_prog_full => TX_FIFO_progfull,
|
312 |
|
|
|
313 |
|
|
TX_FlowControl => FlowControl,
|
314 |
|
|
RX_prog_full => RX_prog_full,
|
315 |
|
|
|
316 |
|
|
Link_up => Descrambler_locked,
|
317 |
|
|
FIFO_Full => TX_FIFO_Full,
|
318 |
|
|
|
319 |
|
|
TX_valid_out => GT0_DATA_VALID_IN
|
320 |
|
|
);
|
321 |
|
|
|
322 |
|
|
TX_out <= Data_Transceiver_In;
|
323 |
|
|
|
324 |
|
|
---------------------------- Receiving side --------------------------------
|
325 |
|
|
Interlaken_RX : entity work.Interlaken_Receiver
|
326 |
|
|
generic map (
|
327 |
|
|
PacketLength => PacketLength
|
328 |
|
|
)
|
329 |
|
|
port map (
|
330 |
|
|
fifo_read_clk => System_Clock_user,
|
331 |
|
|
clk => RX_User_Clock,
|
332 |
|
|
reset => reset,
|
333 |
|
|
|
334 |
|
|
RX_Data_In(63 downto 0) => Data_Transceiver_Out,
|
335 |
|
|
RX_Data_In(66 downto 64)=> RX_Header_Out,
|
336 |
|
|
RX_Data_Out => RX_Data,
|
337 |
|
|
--RX_Valid_Out => RX_Valid_Out,
|
338 |
|
|
|
339 |
|
|
RX_SOP => RX_SOP,
|
340 |
|
|
RX_EOP_valid => RX_EOP_Valid,
|
341 |
|
|
RX_EOP => RX_EOP,
|
342 |
|
|
RX_FlowControl => FlowControl,
|
343 |
|
|
RX_prog_full => RX_prog_full,
|
344 |
|
|
RX_Channel => RX_Channel,
|
345 |
|
|
RX_Datavalid => RX_Datavalid_Out,
|
346 |
|
|
|
347 |
|
|
Descrambler_Lock => Descrambler_Locked,
|
348 |
|
|
Decoder_Lock => Decoder_Lock,
|
349 |
|
|
CRC24_Error => CRC24_Error,
|
350 |
|
|
CRC32_Error => CRC32_Error,
|
351 |
|
|
|
352 |
|
|
Data_Descrambler => Data_Descrambler,
|
353 |
|
|
Data_Decoder => Data_Decoder,
|
354 |
|
|
|
355 |
|
|
RX_FIFO_Full => RX_FIFO_Full,
|
356 |
|
|
RX_FIFO_Read => RX_FIFO_Read,
|
357 |
|
|
|
358 |
|
|
RX_Link_Up => Link_Up,
|
359 |
|
|
Bitslip => RX_Gearboxslip_In
|
360 |
|
|
);
|
361 |
|
|
|
362 |
|
|
Descrambler_Lock <= Descrambler_locked;
|
363 |
|
|
RX_in <= Data_Transceiver_Out;
|
364 |
|
|
|
365 |
|
|
end architecture interface;
|