1 ------------------------------------------------------------------------------- 2 -- File : SsiFrameLimiter.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2016-05-20 5 -- Last update: 2017-06-18 6 ------------------------------------------------------------------------------- 7 -- Description: Limits the amount of data being sent across a SSI AXIS bus 8 ------------------------------------------------------------------------------- 9 -- This file is part of 'SLAC Firmware Standard Library'. 10 -- It is subject to the license terms in the LICENSE.txt file found in the 11 -- top-level directory of this distribution and at: 12 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 13 -- No part of 'SLAC Firmware Standard Library', including this file, 14 -- may be copied, modified, propagated, or distributed except according to 15 -- the terms contained in the LICENSE.txt file. 16 ------------------------------------------------------------------------------- 19 use ieee.std_logic_1164.
all;
20 use ieee.std_logic_unsigned.
all;
21 use ieee.std_logic_arith.
all;
28 --! @ingroup protocols_ssi 35 FRAME_LIMIT_G : positive := 1024;
-- In units of MASTER_AXI_CONFIG_G.TDATA_BYTES_C 36 COMMON_CLK_G : := false;
-- True if sAxisClk and mAxisClk are the same clock 63 type RegType is record 65 timer : range 0 to TIMEOUT_C-1;
70 constant REG_INIT_C : RegType := ( 77 signal r : RegType := REG_INIT_C;
95 -- General Configurations 100 -- FIFO configurations 106 -- AXI Stream Port Configurations 122 comb :
process (
mAxisRst, r, rxMaster, txSlave)
is 123 variable v : RegType;
126 -- Latch the current value 137 ---------------------------------------------------------------------- 139 -- Preset the counter 141 -- Check if ready to move data 142 if (v.txMaster.tValid = '0') and (rxMaster.tValid = '1') then 148 v.txMaster := rxMaster;
150 if rxMaster.tLast = '0' then 156 ---------------------------------------------------------------------- 158 -- Check if ready to move data 159 if (v.txMaster.tValid = '0') and (rxMaster.tValid = '1') then 163 v.txMaster := rxMaster;
165 if rxMaster.tLast = '1' then 168 -- Check if reach limiter value 171 v.txMaster.tLast := '1';
176 -- Increment the counter 180 ---------------------------------------------------------------------- 183 -- Check if timeout is enabled 185 -- Check if in (or going into) IDLE state 186 if (r.state = IDLE_S) or (v.state = IDLE_S) then 191 if (r.timer /= (TIMEOUT_C-1)) then 192 -- Increment the timer 193 v.timer := r.timer + 1;
195 -- Check ready to move data 196 if (v.txMaster.tValid = '0') then 199 v.txMaster.tLast := '1';
208 -- Check if using tReady 218 -- Register the variable for next clock cycle 222 rxSlave <= v.rxSlave;
223 txMaster <= r.txMaster;
230 r <= rin after TPD_G;
242 -- General Configurations 247 -- FIFO configurations 253 -- AXI Stream Port Configurations
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
FRAME_LIMIT_Gpositive := 1024
in mAxisSlaveAxiStreamSlaveType
SLAVE_FIFO_Gboolean := false
out mAxisMasterAxiStreamMasterType
PIPE_STAGES_Gnatural range 0 to 16:= 1
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
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
SLAVE_READY_EN_Gboolean := true
COMMON_CLK_Gboolean := false
GEN_SYNC_FIFO_Gboolean := false
in sAxisMasterAxiStreamMasterType
AxiStreamSlaveType :=(tReady => '0') AXI_STREAM_SLAVE_INIT_C
SLAVE_READY_EN_Gboolean := true
out sAxisSlaveAxiStreamSlaveType
out sAxisSlaveAxiStreamSlaveType
AxiStreamConfigType :=(TSTRB_EN_C => false,TDATA_BYTES_C => 16,TDEST_BITS_C => 4,TID_BITS_C => 0,TKEEP_MODE_C => TKEEP_NORMAL_C,TUSER_BITS_C => 4,TUSER_MODE_C => TUSER_NORMAL_C) AXI_STREAM_CONFIG_INIT_C
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
in mAxisSlaveAxiStreamSlaveType
CASCADE_SIZE_Ginteger range 1 to ( 2** 24):= 1
USE_BUILT_IN_Gboolean := false
EN_TIMEOUT_Gboolean := true
VALID_THOLD_Ginteger range 0 to ( 2** 24):= 1
MAXIS_CLK_FREQ_Greal := 156.25E+06
MASTER_FIFO_Gboolean := false
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C