1 ------------------------------------------------------------------------------- 2 -- File : Jesd204bTxGthUltra.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-14 5 -- Last update: 2015-04-14 6 ------------------------------------------------------------------------------- 7 -- Description: JESD204b module containing the GTH Ultrascale MGT transmitter modules 8 -- Wrapper module for JESD. 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 ------------------------------------------------------------------------------- 28 use ieee.std_logic_1164.
all;
29 use ieee.std_logic_arith.
all;
30 use ieee.std_logic_unsigned.
all;
43 -- Internal SYSREF SYSREF_GEN_G= TRUE else 47 -- Simulation disconnect the GTX 52 ---------------------------------------------------------------------------------------------- 53 -- AXI Lite and AXI stream generics 54 ---------------------------------------------------------------------------------------------- 58 ---------------------------------------------------------------------------------------------- 66 ---------------------------------------------------------------------------------------------- 68 stableClk : in sl;
-- GT needs a stable clock to "boot up"(buffered refClkDiv2) 69 refClk : in sl;
-- GT Reference clock directly from GT GTH diff. input buffer 72 gtTxP : out slv(L_G-1 downto 0);
-- GT Serial Transmit Positive 73 gtTxN : out slv(L_G-1 downto 0);
-- GT Serial Transmit Negative 77 -- User clocks and resets 78 ---------------------------------------------------------------------------------------------- 79 devClk_i : in sl;
-- Device clock also rxUsrClkIn for MGT 80 devClk2_i : in sl;
-- Device clock divided by 2 also rxUsrClk2In for MGT 84 ------------------------------------------------------------------------------------------------ 88 -- AXI-Lite RX Register Interface 94 -- AXI Streaming Interface 98 -- External sample data input 102 ------------------------------------------------------------------------------------------------ 104 -- SYSREF for subcalss 1 fixed latency 107 -- SYSREF out when it is generated internally SYSREF_GEN_G=True 110 -- Synchronisation output combined from all receivers 122 end Jesd204bTxGthUltra;
126 --------------------------------------- 127 component gthultrascalejesdcoregen
129 gtwiz_userclk_rx_active_in :
in (
0 downto 0);
130 gtwiz_buffbypass_tx_reset_in :
in (
0 downto 0);
131 gtwiz_buffbypass_tx_start_user_in :
in (
0 downto 0);
132 gtwiz_buffbypass_tx_done_out :
out (
0 downto 0);
133 gtwiz_buffbypass_tx_error_out :
out (
0 downto 0);
134 gtwiz_reset_clk_freerun_in :
in (
0 downto 0);
135 gtwiz_reset_all_in :
in (
0 downto 0);
136 gtwiz_reset_tx_pll_and_datapath_in :
in (
0 downto 0);
137 gtwiz_reset_tx_datapath_in :
in (
0 downto 0);
138 gtwiz_reset_rx_pll_and_datapath_in :
in (
0 downto 0);
139 gtwiz_reset_rx_datapath_in :
in (
0 downto 0);
140 gtwiz_reset_rx_cdr_stable_out :
out (
0 downto 0);
141 gtwiz_reset_tx_done_out :
out (
0 downto 0);
142 gtwiz_reset_rx_done_out :
out (
0 downto 0);
143 gtwiz_userdata_tx_in :
in (
63 downto 0);
144 gtwiz_userdata_rx_out :
out (
63 downto 0);
145 gtrefclk00_in :
in (
0 downto 0);
146 qpll0lock_out :
out (
0 downto 0);
147 qpll0outclk_out :
out (
0 downto 0);
148 qpll0outrefclk_out :
out (
0 downto 0);
149 gthrxn_in :
in (
1 downto 0);
150 gthrxp_in :
in (
1 downto 0);
151 rx8b10ben_in :
in (
1 downto 0);
152 rxcommadeten_in :
in (
1 downto 0);
153 rxmcommaalignen_in :
in (
1 downto 0);
154 rxpcommaalignen_in :
in (
1 downto 0);
155 rxpolarity_in :
in (
1 downto 0);
156 rxusrclk_in :
in (
1 downto 0);
157 rxusrclk2_in :
in (
1 downto 0);
158 tx8b10ben_in :
in (
1 downto 0);
159 txctrl0_in :
in (
31 downto 0);
160 txctrl1_in :
in (
31 downto 0);
161 txctrl2_in :
in (
15 downto 0);
162 txpolarity_in :
in (
1 downto 0);
163 txusrclk_in :
in (
1 downto 0);
164 txusrclk2_in :
in (
1 downto 0);
165 gthtxn_out :
out (
1 downto 0);
166 gthtxp_out :
out (
1 downto 0);
167 rxbyteisaligned_out :
out (
1 downto 0);
168 rxbyterealign_out :
out (
1 downto 0);
169 rxcommadet_out :
out (
1 downto 0);
170 rxctrl0_out :
out (
31 downto 0);
171 rxctrl1_out :
out (
31 downto 0);
172 rxctrl2_out :
out (
15 downto 0);
173 rxctrl3_out :
out (
15 downto 0);
174 rxoutclk_out :
out (
1 downto 0);
175 rxpmaresetdone_out :
out (
1 downto 0);
176 txoutclk_out :
out (
1 downto 0);
177 txpmaresetdone_out :
out (
1 downto 0)
180 ------------------------------------- 185 -- Rx Channel Bonding 186 -- signal rxChBondLevel : slv(2 downto 0); 191 signal s_gtRxUserReset : slv(L_G-1 downto 0);
192 signal s_gtxRst : sl;
194 signal s_gtTxUserReset : slv(L_G-1 downto 0);
195 signal s_gtTxReset : slv(L_G-1 downto 0);
197 signal s_gtTxReady : slv(L_G-1 downto 0);
199 -- Generated or external 200 signal s_sysRef : sl;
203 signal s_data : slv(63 downto 0);
204 signal s_dataK : slv(15 downto 0);
205 signal s_devClkVec : slv(1 downto 0);
206 signal s_devClk2Vec : slv(1 downto 0);
208 signal s_txDone : sl;
212 -- Check generics TODO add others 213 assert (1 <= L_G and L_G <= 8) report "L_G must be between 1 and 8" severity failure;
215 -------------------------------------------------------------------------------------------------- 216 -- JESD transmitter core 217 -------------------------------------------------------------------------------------------------- 246 -------------------------------------------------------------------------------------------------- 247 -- Generate the internal or external SYSREF depending on SYSREF_GEN_G 248 -------------------------------------------------------------------------------------------------- 249 -- IF DEF SYSREF_GEN_G 251 -- Generate the sysref internally 252 -- Sysref period will be 8x K_G. 253 SysrefGen_INST:
entity work.LmfcGen
266 end generate SELF_TEST_GEN;
271 end generate OPER_GEN;
273 -------------------------------------------------------------------------------------------------- 274 -- GTH signals. Only for L_G = 2 275 -------------------------------------------------------------------------------------------------- 276 s_gtxRst <= devRst_i or uOr(s_gtTxUserReset);
277 s_data <= r_jesdGtTxArr(1).data & r_jesdGtTxArr(0).data;
278 s_dataK <= x"0" & r_jesdGtTxArr(1).dataK & X"0" & r_jesdGtTxArr(0).dataK;
281 s_gtTxReady <= s_txDone & s_txDone;
283 --qPllLock_o <= s_txDone; 285 -------------------------------------------------------------------------------------------------- 286 -- Include Core from Coregen Vivado 15.1 288 -- - Lane rate 7.4 GHz 289 -- - Reference freq 184 MHz 290 -- - 8b10b encription enabled 291 -- - 32b/40b word datapath 292 -- - TR buffer disabled for deterministic latency - IMPORTANT 293 -------------------------------------------------------------------------------------------------- 294 --GT_OPER_GEN: if SIM_G = false generate 295 GthUltrascaleJesdCoregen_INST: GthUltrascaleJesdCoregen
298 -- gtwiz_userclk_tx_active_in(0) => '1', 299 gtwiz_userclk_rx_active_in
(0) => '1',
301 gtwiz_buffbypass_tx_reset_in
(0) => s_gtxRst,
302 gtwiz_buffbypass_tx_start_user_in
(0) => s_gtxRst,
303 gtwiz_buffbypass_tx_done_out
(0) =>
qPllLock_o,
304 gtwiz_buffbypass_tx_error_out =>
open,
306 gtwiz_reset_clk_freerun_in
(0) =>
stableClk,
308 gtwiz_reset_all_in
(0) => s_gtxRst,
309 gtwiz_reset_tx_pll_and_datapath_in
(0) => s_gtxRst,
310 gtwiz_reset_tx_datapath_in
(0) => s_gtxRst,
311 gtwiz_reset_rx_pll_and_datapath_in
(0) => s_gtxRst,
312 gtwiz_reset_rx_datapath_in
(0) => s_gtxRst,
313 gtwiz_reset_rx_cdr_stable_out =>
open,
314 gtwiz_reset_tx_done_out
(0) => s_txDone,
315 gtwiz_reset_rx_done_out =>
open,
316 gtwiz_userdata_tx_in => s_data,
317 gtwiz_userdata_rx_out =>
open,
318 gtrefclk00_in
(0) =>
refClk,
319 qpll0outclk_out =>
open,
320 qpll0outrefclk_out =>
open,
323 qpll0lock_out =>
open,
--qPllLock_o, 324 rx8b10ben_in => "
11",
325 rxcommadeten_in => "
11",
326 rxmcommaalignen_in => "
11",
327 rxpcommaalignen_in => "
11",
328 rxpolarity_in => "
11",
-- Changed to '1' after receiving weird data (sometimes ok sometimes wrong) 329 rxusrclk_in => s_devClkVec,
330 rxusrclk2_in => s_devClk2Vec,
331 tx8b10ben_in => "
11",
332 txctrl0_in => X"0000_0000",
333 txctrl1_in => X"0000_0000",
334 txctrl2_in => s_dataK,
335 txpolarity_in => "
00",
336 txusrclk_in => s_devClkVec,
337 txusrclk2_in => s_devClk2Vec,
340 txoutclk_out =>
open,
341 txpmaresetdone_out =>
open,
344 rxbyteisaligned_out =>
open,
345 rxbyterealign_out =>
open,
346 rxcommadet_out =>
open,
347 rxctrl0_out =>
open,
-- x"000" & r_jesdGtRxArr(1).dataK & X"000" & r_jesdGtRxArr(0).dataK, 348 rxctrl1_out =>
open,
-- x"000" & r_jesdGtRxArr(1).dispErr & X"000" & r_jesdGtRxArr(0).dispErr, 349 rxctrl2_out =>
open,
-- open -- comma detected on corresponding byte 350 rxctrl3_out =>
open,
-- x"0" & r_jesdGtRxArr(1).decErr & X"0" & r_jesdGtRxArr(0).decErr, 351 rxoutclk_out =>
open,
352 rxpmaresetdone_out =>
open 354 ----------------------------------------- 355 -- end generate GT_OPER_GEN; 356 -----------------------------------------------------
array(natural range <> ) of slv(( GT_WORD_SIZE_C* 8)- 1 downto 0) sampleDataArray
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
in gtRxPslv( L_G- 1 downto 0)
in axilReadMasterAxiLiteReadMasterType
in txAxisMasterArr_iAxiStreamMasterArray( L_G- 1 downto 0)
slv( GT_WORD_SIZE_C- 1 downto 0) dataK
L_Gpositive range 1 to 32:= 2
out r_jesdGtTxArrjesdGtTxLaneTypeArray( L_G- 1 downto 0)
out axilReadSlaveTxAxiLiteReadSlaveType
in axilReadMasterTxAxiLiteReadMasterType
out gtTxReset_oslv( L_G- 1 downto 0)
out pulse_oslv( L_G- 1 downto 0)
array(natural range <> ) of jesdGtTxLaneType jesdGtTxLaneTypeArray
out axilReadSlaveAxiLiteReadSlaveType
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
out gtTxNslv( L_G- 1 downto 0)
out axilWriteSlaveTxAxiLiteWriteSlaveType
out leds_oslv( 1 downto 0)
in extSampleDataArray_isampleDataArray( L_G- 1 downto 0)
in txAxisMasterArr_iAxiStreamMasterArray( L_G- 1 downto 0) :=( others => AXI_STREAM_MASTER_INIT_C)
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
out gtTxPslv( L_G- 1 downto 0)
out pulse_oslv( L_G- 1 downto 0)
array(natural range <> ) of slv( 4 downto 0) Slv5Array
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
in axilWriteMasterAxiLiteWriteMasterType
out leds_oslv( 1 downto 0)
in gtTxReady_islv( L_G- 1 downto 0)
out txAxisSlaveArr_oAxiStreamSlaveArray( L_G- 1 downto 0)
out axilWriteSlaveAxiLiteWriteSlaveType
in axilWriteMasterTxAxiLiteWriteMasterType
in extSampleDataArray_isampleDataArray( L_G- 1 downto 0)
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
out txAxisSlaveArr_oAxiStreamSlaveArray( L_G- 1 downto 0)
SYSREF_GEN_Gboolean := false
in gtRxNslv( L_G- 1 downto 0)