1 ------------------------------------------------------------------------------- 2 -- File : JesdTxTest.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-04-14 5 -- Last update: 2015-04-24 6 ------------------------------------------------------------------------------- 7 -- Description: JesdTx simple module for testing RX 8 -- Transmitter module for testing JESD RX module. 9 -- - it replaces GT core and generates a dummy data stream for JESD Rx testing. 10 ------------------------------------------------------------------------------- 11 -- This file is part of 'SLAC Firmware Standard Library'. 12 -- It is subject to the license terms in the LICENSE.txt file found in the 13 -- top-level directory of this distribution and at: 14 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 15 -- No part of 'SLAC Firmware Standard Library', including this file, 16 -- may be copied, modified, propagated, or distributed except according to 17 -- the terms contained in the LICENSE.txt file. 18 ------------------------------------------------------------------------------- 21 use ieee.std_logic_1164.
all;
22 use ieee.std_logic_arith.
all;
23 use ieee.std_logic_unsigned.
all;
29 --! @ingroup protocols_jesd204b 41 -- JESD subclass selection: '0' or '1'(default) 44 -- Control and status register records 47 -- Local multi frame clock 50 -- Synchronization request input 59 -- Data and character output and GT signals (simple generated) 69 type RegType is record 74 constant REG_INIT_C : RegType := ( 75 dataD1 => (others => '0'), 76 dataKD1 => (others => '0') 79 signal r : RegType := REG_INIT_C;
84 -- Control signals from FSM 85 signal s_testCntr : slv(7 downto 0);
86 signal s_dataValid : sl;
88 signal s_lmfc_dly : sl;
89 signal s_nsync_dly : sl;
92 signal s_data_sel : slv(1 downto 0);
96 -- Delay lmfc input (for 1 to 16 c-c) to 110 -- Delay nsync input (for 1 to 16 c-c) to 124 -- Synchronization FSM 140 comb :
process (r,
devRst_i,s_dataK,s_data)
is 141 variable v : RegType;
145 -- Buffer data and char one clock cycle 146 v.dataKD1 := s_dataK;
160 r <= rin after TPD_G;
165 s_data_sel <= s_dataValid & s_align;
167 --GT output generation (depending on GT_WORD_SIZE_C) 169 ---------------------------------------------------- 170 with s_data_sel select 171 s_dataK <= "1111" when "00", 175 with s_data_sel select 177 ( (s_testCntr+3) & (s_testCntr+2) & (s_testCntr+1) & R_CHAR_C) when "01", 178 ( (s_testCntr+3) & (s_testCntr+2) & (s_testCntr+1) & (s_testCntr)) when others;
182 s_dataK(2 downto 0) & r.dataKD1(3) when "0010", 183 s_dataK(1 downto 0) & r.dataKD1(3 downto 2) when "0100", 184 s_dataK(0) & r.dataKD1(3 downto 1) when "1000", 189 s_data(23 downto 0) & r.dataD1(31 downto 24) when "0010", 190 s_data(15 downto 0) & r.dataD1(31 downto 16) when "0100", 191 s_data(7 downto 0) & r.dataD1(31 downto 8) when "1000", 197 ----------------------------------------------- 198 end generate SIZE_4_GEN;
200 -- GT output generation (depending on GT_WORD_SIZE_C) 201 -- SIZE_2_GEN: if GT_WORD_SIZE_C = 2 generate 202 -- ---------------------------------------------------- 203 -- s_dataK <= "11" when (s_dataValid = '0' and s_align = '0') else 205 -- s_data <= (K_CHAR_C & K_CHAR_C) when (s_dataValid = '0' and s_align = '0') else 206 -- ((s_testCntr+1) & (s_testCntr)); 208 -- with align_i select 209 -- r_jesdGtRx.dataK <= s_dataK when "01", 210 -- s_dataK(0) & r.dataKD1(1) when "10", 211 -- s_dataK when others; 213 -- with align_i select 214 -- r_jesdGtRx.data <= s_data when "01", 215 -- s_data(7 downto 0) & r.dataD1(15 downto 8) when "10", 216 -- s_data when others; 218 -- r_jesdGtRx.dispErr <= "00"; 219 -- r_jesdGtRx.decErr <= "00"; 220 -- r_jesdGtRx.rstDone <= '1'; 221 -- ----------------------------------------------- 222 -- end generate SIZE_2_GEN; 227 --------------------------------------------
slv( GT_WORD_SIZE_C- 1 downto 0) dataK
in delay_islv( 3 downto 0)
in dly_islv( DLY_WIDTH_G- 1 downto 0)
slv( 7 downto 0) := x"1C" R_CHAR_C
slv( 7 downto 0) := x"BC" K_CHAR_C
slv( GT_WORD_SIZE_C- 1 downto 0) dispErr
positive := 4 GT_WORD_SIZE_C
out r_jesdGtRxjesdGtRxLaneType
in align_islv( GT_WORD_SIZE_C- 1 downto 0)
slv( GT_WORD_SIZE_C- 1 downto 0) decErr
out testCntr_oslv( 7 downto 0)
slv(( GT_WORD_SIZE_C* 8)- 1 downto 0) data