1 ------------------------------------------------------------------------------- 2 -- File : Jesd204bRxGthUltra.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-14 5 -- Last update: 2015-04-14 6 ------------------------------------------------------------------------------- 7 -- Description: JESD204b receiver module containing the GTH Ultrascale MGT 8 -- Wrapper module for JESD receiver. 9 -- GTH coregen generated core 2 GTH modules 10 -- Note: Intended only for two serial lanes L_G=2. 11 -- 7.4 GHz lane rate and 370MHz reference, Freerunning clk 185 MHz 12 -- If different amount of lanes or freq is required the Core has to be regenerated 14 ------------------------------------------------------------------------------- 15 -- This file is part of 'SLAC Firmware Standard Library'. 16 -- It is subject to the license terms in the LICENSE.txt file found in the 17 -- top-level directory of this distribution and at: 18 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 19 -- No part of 'SLAC Firmware Standard Library', including this file, 20 -- may be copied, modified, propagated, or distributed except according to 21 -- the terms contained in the LICENSE.txt file. 22 ------------------------------------------------------------------------------- 26 use unisim.vcomponents.
all;
28 use ieee.std_logic_1164.
all;
29 use ieee.std_logic_arith.
all;
30 use ieee.std_logic_unsigned.
all;
43 -- Test tx module instead of GTX 46 -- Internal SYSREF SYSREF_GEN_G= TRUE else 50 -- AXI Lite and AXI stream generics 51 ---------------------------------------------------------------------------------------------- 55 ---------------------------------------------------------------------------------------------- 63 ---------------------------------------------------------------------------------------------- 65 stableClk : in sl;
-- GT needs a stable clock to "boot up"(buffered refClkDiv2) 66 refClk : in sl;
-- GT Reference clock directly from GT GTH diff. input buffer 68 gtTxP : out slv(L_G-1 downto 0);
-- GT Serial Transmit Positive 69 gtTxN : out slv(L_G-1 downto 0);
-- GT Serial Transmit Negative 73 -- User clocks and resets 74 ---------------------------------------------------------------------------------------------- 75 devClk_i : in sl;
-- Device clock also rxUsrClkIn for MGT 76 devClk2_i : in sl;
-- Device clock divided by 2 also rxUsrClk2In for MGT 80 ------------------------------------------------------------------------------------------------ 84 -- AXI-Lite Register Interface 90 -- AXI Streaming Interface 95 ------------------------------------------------------------------------------------------------ 97 -- SYSREF for subclass 1 fixed latency 100 -- SYSREF out when it is generated internally SYSREF_GEN_G=True 103 -- Synchronization output combined from all receivers 109 -- Rising edge pulses for test 115 end Jesd204bRxGthUltra;
118 --------------------------------------- 119 component gthultrascalejesdcoregen
121 gtwiz_userclk_tx_reset_in :
in slv(
0 downto 0);
122 gtwiz_userclk_tx_active_in :
in slv(
0 downto 0);
123 gtwiz_userclk_rx_active_in :
in slv(
0 downto 0);
124 gtwiz_reset_clk_freerun_in :
in slv(
0 downto 0);
125 gtwiz_reset_all_in :
in slv(
0 downto 0);
126 gtwiz_reset_tx_pll_and_datapath_in :
in slv(
0 downto 0);
127 gtwiz_reset_tx_datapath_in :
in slv(
0 downto 0);
128 gtwiz_reset_rx_pll_and_datapath_in :
in slv(
0 downto 0);
129 gtwiz_reset_rx_datapath_in :
in slv(
0 downto 0);
130 gtwiz_reset_rx_cdr_stable_out :
out slv(
0 downto 0);
131 gtwiz_reset_tx_done_out :
out slv(
0 downto 0);
132 gtwiz_reset_rx_done_out :
out slv(
0 downto 0);
133 gtwiz_userdata_tx_in :
in slv((
2*GT_WORD_SIZE_C*
8)
-1 downto 0);
134 gtwiz_userdata_rx_out :
out slv((
2*GT_WORD_SIZE_C*
8)
-1 downto 0);
135 drpclk_in :
in slv(
1 downto 0);
136 gthrxn_in :
in slv(
1 downto 0);
137 gthrxp_in :
in slv(
1 downto 0);
138 gtrefclk0_in :
in slv(
1 downto 0);
139 rx8b10ben_in :
in slv(
1 downto 0);
140 rxcommadeten_in :
in slv(
1 downto 0);
141 rxmcommaalignen_in :
in slv(
1 downto 0);
142 rxpcommaalignen_in :
in slv(
1 downto 0);
143 rxpolarity_in :
in slv(
1 downto 0);
144 rxusrclk_in :
in slv(
1 downto 0);
145 rxusrclk2_in :
in slv(
1 downto 0);
146 tx8b10ben_in :
in slv(
1 downto 0);
147 rxbufreset_in :
in slv(
1 downto 0);
148 txctrl0_in :
in slv(
31 downto 0);
149 txctrl1_in :
in slv(
31 downto 0);
150 txctrl2_in :
in slv(
15 downto 0);
151 txpolarity_in :
in slv(
1 downto 0);
152 txusrclk_in :
in slv(
1 downto 0);
153 txusrclk2_in :
in slv(
1 downto 0);
154 gthtxn_out :
out slv(
1 downto 0);
155 gthtxp_out :
out slv(
1 downto 0);
156 rxbyteisaligned_out :
out slv(
1 downto 0);
157 rxbyterealign_out :
out slv(
1 downto 0);
158 rxcommadet_out :
out slv(
1 downto 0);
159 rxctrl0_out :
out slv(
31 downto 0);
160 rxctrl1_out :
out slv(
31 downto 0);
161 rxctrl2_out :
out slv(
15 downto 0);
162 rxctrl3_out :
out slv(
15 downto 0);
163 rxoutclk_out :
out slv(
1 downto 0);
164 rxpmaresetdone_out :
out slv(
1 downto 0);
165 txoutclk_out :
out slv(
1 downto 0);
166 txpmaresetdone_out :
out slv(
1 downto 0)
169 ------------------------------------- 174 -- Rx Channel Bonding 175 -- signal rxChBondLevel : slv(2 downto 0); 180 signal s_gtUserReset : slv(L_G-1 downto 0);
181 signal s_gtReset : sl;
183 -- Generated or external 184 signal s_sysRef, s_sysRefDbg : sl;
187 signal s_rxctrl0 : slv(31 downto 0);
188 signal s_rxctrl1 : slv(31 downto 0);
189 signal s_rxctrl2 : slv(15 downto 0);
190 signal s_rxctrl3 : slv(15 downto 0);
194 signal s_devClkVec : slv(1 downto 0);
195 signal s_devClk2Vec : slv(1 downto 0);
196 signal s_stableClkVec : slv(1 downto 0);
197 signal s_gtRefClkVec : slv(1 downto 0);
198 signal s_rxDone : sl;
201 signal s_validVec : slv(1 downto 0);
202 signal s_allignEnVec : slv(1 downto 0);
206 s_allignEnVec <= not s_validVec;
208 -------------------------------------------------------------------------------------------------- 209 -- JESD receiver core 210 -------------------------------------------------------------------------------------------------- 240 -------------------------------------------------------------------------------------------------- 241 -- Generate the internal or external SYSREF depending on SYSREF_GEN_G 242 -------------------------------------------------------------------------------------------------- 243 -- IF DEF SYSREF_GEN_G 245 -- Generate the sysref internally 246 -- Sysref period will be 8x K_G. 247 SysrefGen_INST:
entity work.LmfcGen
260 end generate SELF_TEST_GEN;
265 end generate OPER_GEN;
267 -------------------------------------------------------------------------------------------------- 268 -- GTH signals assignments. Only for L_G = 2 269 -------------------------------------------------------------------------------------------------- 270 s_gtReset <= devRst_i or uOr(s_gtUserReset);
284 r_jesdGtRxArr(0).rstDone <= s_rxDone;
285 r_jesdGtRxArr(1).rstDone <= s_rxDone;
294 -------------------------------------------------------------------------------------------------- 295 -- Include Core from Coregen Vivado 15.1 297 -- - Lane rate 7.4 GHz 298 -- - Reference freq 184 MHz 300 -- - 32b/40b word datapath 301 -- - Comma detection has to be enabled to any byte boundary - IMPORTANT 302 -------------------------------------------------------------------------------------------------- 303 GT_OPER_GEN: if TEST_G = false generate 304 GthUltrascaleJesdCoregen_INST: GthUltrascaleJesdCoregen
307 gtwiz_userclk_tx_reset_in
(0) => s_gtReset,
308 gtwiz_userclk_tx_active_in
(0) => '1',
309 gtwiz_userclk_rx_active_in
(0) => '1',
310 gtwiz_reset_clk_freerun_in
(0) =>
stableClk,
312 gtwiz_reset_all_in
(0) => '0',
313 gtwiz_reset_tx_pll_and_datapath_in
(0) => '0',
314 gtwiz_reset_tx_datapath_in
(0) => s_gtReset,
315 gtwiz_reset_rx_pll_and_datapath_in
(0) => '0',
316 gtwiz_reset_rx_datapath_in
(0) => s_gtReset,
317 gtwiz_reset_rx_cdr_stable_out =>
open,
318 gtwiz_reset_tx_done_out =>
open,
319 gtwiz_reset_rx_done_out
(0) => s_rxDone,
320 gtwiz_userdata_tx_in =>
(s_data'range =>'0'
),
321 gtwiz_userdata_rx_out => s_data,
322 drpclk_in => s_stableClkVec,
325 gtrefclk0_in => s_gtRefClkVec,
327 tx8b10ben_in => "
00",
328 txctrl0_in => X"0000_0000",
329 txctrl1_in => X"0000_0000",
330 txctrl2_in => X"0000",
331 txpolarity_in => "
00",
332 txusrclk_in => s_devClkVec,
333 txusrclk2_in => s_devClk2Vec,
336 txoutclk_out =>
open,
337 txpmaresetdone_out =>
open,
340 rx8b10ben_in => "
11",
341 rxbufreset_in => "
00",
342 rxcommadeten_in => "
11",
343 rxmcommaalignen_in => s_allignEnVec,
344 rxpcommaalignen_in => s_allignEnVec,
345 rxpolarity_in => "
11",
-- TODO Check 346 rxusrclk_in => s_devClkVec,
347 rxusrclk2_in => s_devClk2Vec,
349 rxbyteisaligned_out =>
open,
350 rxbyterealign_out =>
open,
351 rxcommadet_out =>
open,
352 rxctrl0_out => s_rxctrl0,
-- x"000" & r_jesdGtRxArr(1).dataK & X"000" & r_jesdGtRxArr(0).dataK, 353 rxctrl1_out => s_rxctrl1,
-- x"000" & r_jesdGtRxArr(1).dispErr & X"000" & r_jesdGtRxArr(0).dispErr, 354 rxctrl2_out => s_rxctrl2,
-- open -- comma detected on corresponding byte 355 rxctrl3_out => s_rxctrl3,
-- x"0" & r_jesdGtRxArr(1).decErr & X"0" & r_jesdGtRxArr(0).decErr, 356 rxoutclk_out =>
open,
357 rxpmaresetdone_out =>
open 359 ----------------------------------------- 360 end generate GT_OPER_GEN;
361 -----------------------------------------------------
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out pulse_oslv( L_G- 1 downto 0)
out axilReadSlaveAxiLiteReadSlaveType
out rxAxisMasterArrAxiStreamMasterArray( L_G- 1 downto 0)
SYSREF_GEN_Gboolean := false
in gtRxNslv( L_G- 1 downto 0)
L_Gpositive range 1 to 32:= 2
out dataValidVec_oslv( L_G- 1 downto 0)
out rxAxisMasterArr_oAxiStreamMasterArray( L_G- 1 downto 0)
in rxCtrlArrAxiStreamCtrlArray( L_G- 1 downto 0)
slv( GT_WORD_SIZE_C- 1 downto 0) dataK
out axilWriteSlaveAxiLiteWriteSlaveType
in axilReadMasterAxiLiteReadMasterType
out sampleDataArr_osampleDataArray( L_G- 1 downto 0)
in axilReadMasterAxiLiteReadMasterType
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out axilReadSlaveAxiLiteReadSlaveType
slv( GT_WORD_SIZE_C- 1 downto 0) dispErr
out leds_oslv( 1 downto 0)
positive := 4 GT_WORD_SIZE_C
array(natural range <> ) of AxiStreamCtrlType AxiStreamCtrlArray
out pulse_oslv( L_G- 1 downto 0)
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
out gtRxReset_oslv( L_G- 1 downto 0)
in axilWriteMasterAxiLiteWriteMasterType
array(natural range <> ) of slv( 4 downto 0) Slv5Array
in r_jesdGtRxArrjesdGtRxLaneTypeArray( L_G- 1 downto 0)
out gtTxPslv( L_G- 1 downto 0)
out gtTxNslv( L_G- 1 downto 0)
slv( GT_WORD_SIZE_C- 1 downto 0) decErr
array(natural range <> ) of jesdGtRxLaneType jesdGtRxLaneTypeArray
out leds_oslv( 1 downto 0)
in rxCtrlArr_iAxiStreamCtrlArray( L_G- 1 downto 0) :=( others => AXI_STREAM_CTRL_UNUSED_C)
out axilWriteSlaveAxiLiteWriteSlaveType
in axilWriteMasterAxiLiteWriteMasterType
in gtRxPslv( L_G- 1 downto 0)