1 ------------------------------------------------------------------------------- 2 -- File : SsiPrbsTxOld.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-04-02 5 -- Last update: 2014-11-07 6 ------------------------------------------------------------------------------- 7 -- Description: This module generates 8 -- PseudoRandom Binary Sequence (PRBS) on Virtual Channel Lane. 9 ------------------------------------------------------------------------------- 10 -- This file is part of 'SLAC Firmware Standard Library'. 11 -- It is subject to the license terms in the LICENSE.txt file found in the 12 -- top-level directory of this distribution and at: 13 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 14 -- No part of 'SLAC Firmware Standard Library', including this file, 15 -- may be copied, modified, propagated, or distributed except according to 16 -- the terms contained in the LICENSE.txt file. 17 ------------------------------------------------------------------------------- 20 use ieee.std_logic_1164.
all;
21 use ieee.std_logic_unsigned.
all;
22 use ieee.std_logic_arith.
all;
29 --! @ingroup protocols_ssi 32 -- General Configurations 34 -- FIFO Configurations 44 -- PRBS Configurations 47 -- AXI Stream Configurations 51 -- Master Port (mAxisClk) 56 -- Trigger Signal (locClk domain) 58 locRst :
in sl := '0';
70 constant PRBS_SSI_CONFIG_C : AxiStreamConfigType := ssiAxiStreamConfig(PRBS_BYTES_C, TKEEP_COMP_C);
78 type RegType is record 82 dataCnt : slv(31 downto 0);
89 constant REG_INIT_C : RegType := ( 99 signal r : RegType := REG_INIT_C;
100 signal rin : RegType;
106 assert (PRBS_SEED_SIZE_G mod 8 = 0) report "PRBS_SEED_SIZE_G must be a multiple of 8" severity failure;
109 variable v : RegType;
111 -- Latch the current value 114 -- Reset strobing signals 115 ssiResetFlags(v.txMaster);
116 v.txMaster.tData := (others => '0');
118 -- Check for overflow condition or forced EOFE 120 -- Latch the overflow error bit for the data packet 126 ---------------------------------------------------------------------- 128 -- Reset the busy flag 130 -- Check for a trigger 132 -- Latch the generator seed 133 v.randomData := r.eventCnt;
136 -- Reset the overflow flag 138 -- Latch the configuration 141 -- Check the packet length request value 143 -- Force minimum packet length of 2 (+1) 146 -- Force minimum packet length of 2 (+1) 149 -- Latch the packet length 153 v.state := SEED_RAND_S;
155 ---------------------------------------------------------------------- 157 -- Check if the FIFO is ready 158 if txCtrl.pause = '0' then 159 -- Send the random seed word 160 v.txMaster.tvalid := '1';
162 -- Generate the next random data word 163 v.randomData := lfsrShift(r.randomData, PRBS_TAPS_G);
164 -- Increment the counter 165 v.eventCnt := r.eventCnt + 1;
166 -- Increment the counter 167 v.dataCnt := r.dataCnt + 1;
169 ssiSetUserSof(PRBS_SSI_CONFIG_C, v.txMaster, '1');
173 ---------------------------------------------------------------------- 175 -- Check if the FIFO is ready 176 if txCtrl.pause = '0' then 177 -- Send the upper packetLength value 178 v.txMaster.tvalid := '1';
180 -- Increment the counter 181 v.dataCnt := r.dataCnt + 1;
185 ---------------------------------------------------------------------- 187 -- Check if the FIFO is ready 188 if txCtrl.pause = '0' then 189 -- Send the random data word 192 -- Generate the next random data word 193 v.randomData := lfsrShift(r.randomData, PRBS_TAPS_G);
194 -- Increment the counter 195 v.dataCnt := r.dataCnt + 1;
199 v.dataCnt := (others => '0');
201 v.txMaster.tLast := '1';
203 ssiSetUserEofe(PRBS_SSI_CONFIG_C, v.txMaster, r.overflow);
204 -- Reset the busy flag 210 ---------------------------------------------------------------------- 218 -- Register the variable for next clock cycle 228 if rising_edge(locClk) then 229 r <= rin after TPD_G;
235 -- General Configurations 240 -- FIFO configurations 252 -- AXI Stream Port Configurations
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
out sAxisCtrlAxiStreamCtrlType
ALTERA_RAM_Gstring := "M9K"
MASTER_AXI_STREAM_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 16, TKEEP_COMP_C)
in packetLengthslv( 31 downto 0) := X"FFFFFFFF"
PIPE_STAGES_Gnatural range 0 to 16:= 1
FIFO_ADDR_WIDTH_Gnatural range 4 to 48:= 9
AxiStreamMasterType :=(tValid => '0',tData =>( others => '0'),tStrb =>( others => '1'),tKeep =>( others => '1'),tLast => '0',tDest =>( others => '0'),tId =>( others => '0'),tUser =>( others => '0')) AXI_STREAM_MASTER_INIT_C
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
PRBS_TAPS_GNaturalArray :=( 0=> 31, 1=> 6, 2=> 2, 3=> 1)
SLAVE_READY_EN_Gboolean := true
FIFO_FIXED_THRESH_Gboolean := true
CASCADE_SIZE_Gnatural range 1 to ( 2** 24):= 1
XIL_DEVICE_Gstring := "7SERIES"
GEN_SYNC_FIFO_Gboolean := false
in tDestslv( 7 downto 0) := X"00"
XIL_DEVICE_Gstring := "7SERIES"
PRBS_SEED_SIZE_Gnatural range 32 to 128:= 32
out mAxisMasterAxiStreamMasterType
FIFO_PAUSE_THRESH_Gnatural range 1 to ( 2** 24):= 2** 8
array(natural range <> ) of natural NaturalArray
ALTERA_SYN_Gboolean := false
out sAxisSlaveAxiStreamSlaveType
in mAxisSlaveAxiStreamSlaveType
USE_BUILT_IN_Gboolean := false
ALTERA_SYN_Gboolean := false
GEN_SYNC_FIFO_Gboolean := false
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
in tIdslv( 7 downto 0) := X"00"
in mAxisSlaveAxiStreamSlaveType
MASTER_AXI_PIPE_STAGES_Gnatural range 0 to 16:= 0
CASCADE_SIZE_Ginteger range 1 to ( 2** 24):= 1
USE_BUILT_IN_Gboolean := false
FIFO_PAUSE_THRESH_Ginteger range 1 to ( 2** 24):= 1
VALID_THOLD_Ginteger range 0 to ( 2** 24):= 1
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
CASCADE_PAUSE_SEL_Ginteger range 0 to ( 2** 24):= 0
ALTERA_RAM_Gstring := "M9K"