1 ------------------------------------------------------------------------------- 2 -- File : AxiLiteSrpV0.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2014-04-09 5 -- Last update: 2016-06-09 6 ------------------------------------------------------------------------------- 7 -- Description: SLAC Register Protocol Version 0, AXI-Lite Interface 9 -- Documentation: https://confluence.slac.stanford.edu/x/aRmVD 11 -- Note: This module only supports 32-bit aligned addresses and 32-bit transactions. 13 ------------------------------------------------------------------------------- 14 -- This file is part of 'SLAC Firmware Standard Library'. 15 -- It is subject to the license terms in the LICENSE.txt file found in the 16 -- top-level directory of this distribution and at: 17 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. 18 -- No part of 'SLAC Firmware Standard Library', including this file, 19 -- may be copied, modified, propagated, or distributed except according to 20 -- the terms contained in the LICENSE.txt file. 21 ------------------------------------------------------------------------------- 24 use ieee.std_logic_1164.
all;
25 use ieee.std_logic_arith.
all;
26 use ieee.std_logic_unsigned.
all;
34 --! @ingroup protocols_srp 47 USE_BUILT_IN_G : := false;
--if set to true, this module is only Xilinx compatible only!!! 54 -- AXI Stream IO Config 58 -- Streaming Master (Tx) Data Interface (mAxisClk domain) 64 -- Streaming Slave (Rx) Interface (sAxisClk domain) 71 -- AXI Lite Bus Slave (axiLiteClk domain) 86 constant TIMEOUT_COUNT_C : := 156250000;
94 type StateType is (WAIT_AXIL_REQ_S, WAIT_AXIS_RESP_S, BLEED_S);
96 type RegType is record 98 txnCount : slv(31 downto 0);
99 timeoutCount : slv(31 downto 0);
106 constant REG_INIT_C : RegType := ( 107 state => WAIT_AXIL_REQ_S, 108 txnCount => (others => '0'), 109 timeoutCount => (others => '0'), 116 signal r : RegType := REG_INIT_C;
117 signal rin : RegType;
119 -- attribute dont_touch : string; 120 -- attribute dont_touch of r : signal is "TRUE"; 121 -- attribute dont_touch of rxFifoAxisMaster : signal is "TRUE"; 122 -- attribute dont_touch of rxFifoAxisSlave : signal is "TRUE"; 123 -- attribute dont_touch of txFifoAxisMaster : signal is "TRUE"; 124 -- attribute dont_touch of txFifoAxisSlave : signal is "TRUE"; 128 ---------------------------------- 130 ---------------------------------- 160 ---------------------------------- 162 ---------------------------------- 192 ------------------------------------- 193 -- Master State Machine 194 ------------------------------------- 197 variable v : RegType;
202 v.rxFifoAxisSlave.tReady := '0';
204 if (txFifoAxisSlave.tReady = '1') then 205 v.txFifoAxisMaster.tValid := '0';
212 when WAIT_AXIL_REQ_S => 213 v.timeoutCount := (others => '0');
215 v.txFifoAxisMaster.tData(31 downto 0) := r.txnCount;
217 v.txFifoAxisMaster.tData(63 downto 62) := "01";
219 v.txFifoAxisMaster.tData(127 downto 96) := (others => '0');
220 v.txFifoAxisMaster.tKeep := X"FFFF";
221 v.txFifoAxisMaster.tValid := '1';
222 v.txFifoAxisMaster.tLast := '1';
223 ssiSetUserSof(INTERNAL_AXIS_CFG_C, v.txFifoAxisMaster, '1');
224 v.state := WAIT_AXIS_RESP_S;
226 v.txFifoAxisMaster.tData(31 downto 0) := r.txnCount;
228 v.txFifoAxisMaster.tData(63 downto 62) := "00";
229 v.txFifoAxisMaster.tData(95 downto 64) := (others => '0');
230 v.txFifoAxisMaster.tData(127 downto 96) := (others => '0');
231 v.txFifoAxisMaster.tKeep := X"FFFF";
232 v.txFifoAxisMaster.tValid := '1';
233 v.txFifoAxisMaster.tLast := '1';
234 ssiSetUserSof(INTERNAL_AXIS_CFG_C, v.txFifoAxisMaster, '1');
235 v.state := WAIT_AXIS_RESP_S;
238 when WAIT_AXIS_RESP_S => 239 v.timeoutCount := r.timeoutCount + 1;
240 if (rxFifoAxisMaster.tValid = '1') then 241 v.txnCount := r.txnCount + 1;
242 v.rxFifoAxisSlave.tReady := '1';
244 -- Check write response 246 if (rxFifoAxisMaster.tData(31 downto 0) = r.txnCount and 248 rxFifoAxisMaster.tData(63 downto 62) = "01" and 250 rxFifoAxisMaster.tData(127 downto 96) = 0 and 251 rxFifoAxisMaster.tKeep = X"FFFF" and 252 rxFifoAxisMaster.tLast = '1' and 253 ssiGetUserSof(INTERNAL_AXIS_CFG_C, rxFifoAxisMaster) = '1') 256 v.state := WAIT_AXIL_REQ_S;
257 elsif (rxFifoAxisMaster.tLast = '0') then 262 v.state := WAIT_AXIL_REQ_S;
265 -- Check read response 267 if (rxFifoAxisMaster.tData(31 downto 0) = r.txnCount and 269 rxFifoAxisMaster.tData(63 downto 62) = "00" and 270 rxFifoAxisMaster.tData(127 downto 96) = 0 and 271 rxFifoAxisMaster.tKeep = X"FFFF" and 272 rxFifoAxisMaster.tLast = '1' and 273 ssiGetUserSof(INTERNAL_AXIS_CFG_C, rxFifoAxisMaster) = '1') 277 v.state := WAIT_AXIL_REQ_S;
278 elsif (rxFifoAxisMaster.tLast = '0') then 285 v.state := WAIT_AXIL_REQ_S;
290 elsif (r.timeoutCount = TIMEOUT_COUNT_C) then 300 v.rxFifoAxisSlave.tReady := '1';
301 if (rxFifoAxisMaster.tValid = '1' and rxFifoAxisMaster.tLast = '1') then 302 v.state := WAIT_AXIL_REQ_S;
315 txFifoAxisMaster <= r.txFifoAxisMaster;
316 rxFifoAxisSlave <= v.rxFifoAxisSlave;
324 r <= rin after TPD_G;
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
out sAxisCtrlAxiStreamCtrlType
ALTERA_RAM_Gstring := "M9K"
AXI_STREAM_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
SLAVE_READY_EN_Gboolean := false
PIPE_STAGES_Gnatural range 0 to 16:= 1
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
in sAxilReadMasterAxiLiteReadMasterType
AXIL_ERR_RESP_Gslv( 1 downto 0) := AXI_RESP_SLVERR_C
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
out sAxilWriteSlaveAxiLiteWriteSlaveType
SLAVE_READY_EN_Gboolean := true
FIFO_FIXED_THRESH_Gboolean := true
ALTERA_SYN_Gboolean := false
GEN_SYNC_FIFO_Gboolean := false
out sAxisCtrlAxiStreamCtrlType
XIL_DEVICE_Gstring := "7SERIES"
in sAxilWriteMasterAxiLiteWriteMasterType
GEN_SYNC_FIFO_Gboolean := false
slv( 1 downto 0) := "10" AXI_RESP_SLVERR_C
out sAxilReadSlaveAxiLiteReadSlaveType
INT_PIPE_STAGES_Gnatural range 0 to 16:= 0
AxiStreamSlaveType :=(tReady => '0') AXI_STREAM_SLAVE_INIT_C
out mAxisMasterAxiStreamMasterType
in mAxisSlaveAxiStreamSlaveType
AxiLiteReadSlaveType :=(arready => '0',rdata =>( others => '0'),rresp =>( others => '0'),rvalid => '0') AXI_LITE_READ_SLAVE_INIT_C
in sAxisMasterAxiStreamMasterType
out sAxisSlaveAxiStreamSlaveType
ALTERA_SYN_Gboolean := false
FIFO_PAUSE_THRESH_Ginteger range 1 to ( 2** 24):= 2** 8
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
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
slv( 1 downto 0) := "00" AXI_RESP_OK_C
in mAxisSlaveAxiStreamSlaveType
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
AxiLiteWriteSlaveType :=(awready => '0',wready => '0',bresp =>( others => '0'),bvalid => '0') AXI_LITE_WRITE_SLAVE_INIT_C
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
RESP_THOLD_Ginteger range 0 to ( 2** 24):= 1
XIL_DEVICE_Gstring := "7SERIES"
ALTERA_RAM_Gstring := "M9K"
USE_BUILT_IN_Gboolean := false
out sAxisSlaveAxiStreamSlaveType