SURF  1.0
RssiCoreWrapper.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : RssiCoreWrapper.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2016-02-25
5 -- Last update: 2017-05-09
6 -------------------------------------------------------------------------------
7 -- Description: Wrapper for RSSI + AXIS packetizer
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 -------------------------------------------------------------------------------
17 
18 library ieee;
19 use ieee.std_logic_1164.all;
20 
21 use work.StdRtlPkg.all;
22 use work.RssiPkg.all;
23 use work.SsiPkg.all;
24 use work.AxiStreamPkg.all;
25 use work.AxiLitePkg.all;
26 
27 --! @see entity
28  --! @ingroup protocols_rssi
29 entity RssiCoreWrapper is
30  generic (
31  TPD_G : time := 1 ns;
32  CLK_FREQUENCY_G : real := 100.0E+6; -- In units of Hz
33  TIMEOUT_UNIT_G : real := 1.0E-6; -- In units of seconds
34  SERVER_G : boolean := true; -- Module is server or client
35  RETRANSMIT_ENABLE_G : boolean := true; -- Enable/Disable retransmissions in tx module
36  WINDOW_ADDR_SIZE_G : positive := 3; -- 2^WINDOW_ADDR_SIZE_G = Max number of segments in buffer
37  SEGMENT_ADDR_SIZE_G : positive := 7; -- 2^SEGMENT_ADDR_SIZE_G = Number of 64 bit wide data words
38  BYPASS_CHUNKER_G : boolean := false; -- Bypass the AXIS chunker layer
39  PIPE_STAGES_G : natural := 0;
40  APP_STREAMS_G : positive := 1;
41  APP_STREAM_ROUTES_G : Slv8Array := (0 => "--------");
43  -- AXIS Configurations
44  APP_AXIS_CONFIG_G : AxiStreamConfigArray := (0 => ssiAxiStreamConfig(8, TKEEP_NORMAL_C));
45  TSP_AXIS_CONFIG_G : AxiStreamConfigType := ssiAxiStreamConfig(16, TKEEP_NORMAL_C);
46  -- Version and connection ID
47  INIT_SEQ_N_G : natural := 16#80#;
48  CONN_ID_G : positive := 16#12345678#;
49  VERSION_G : positive := 1;
50  HEADER_CHKSUM_EN_G : boolean := true;
51  -- Window parameters of receiver module
52  MAX_NUM_OUTS_SEG_G : positive := 8; -- <=(2**WINDOW_ADDR_SIZE_G)
53  MAX_SEG_SIZE_G : positive := 1024; -- <= (2**SEGMENT_ADDR_SIZE_G)*8 Number of bytes
54  -- RSSI Timeouts
55  ACK_TOUT_G : positive := 25; -- unit depends on TIMEOUT_UNIT_G
56  RETRANS_TOUT_G : positive := 50; -- unit depends on TIMEOUT_UNIT_G (Recommended >= MAX_NUM_OUTS_SEG_G*Data segment transmission time)
57  NULL_TOUT_G : positive := 200; -- unit depends on TIMEOUT_UNIT_G (Recommended >= 4*RETRANS_TOUT_G)
58  -- Counters
59  MAX_RETRANS_CNT_G : positive := 2;
60  MAX_CUM_ACK_CNT_G : positive := 3);
61  port (
62  -- Clock and Reset
63  clk_i : in sl;
64  rst_i : in sl;
65  -- SSI Application side
68  mAppAxisMasters_o : out AxiStreamMasterArray(APP_STREAMS_G-1 downto 0);
69  mAppAxisSlaves_i : in AxiStreamSlaveArray(APP_STREAMS_G-1 downto 0);
70  -- SSI Transport side
75  -- High level Application side interface
76  openRq_i : in sl := '0';
77  closeRq_i : in sl := '0';
78  inject_i : in sl := '0';
79  -- AXI-Lite Register Interface
80  axiClk_i : in sl := '0';
81  axiRst_i : in sl := '0';
86  -- Internal statuses
87  statusReg_o : out slv(6 downto 0));
88 end entity RssiCoreWrapper;
89 
90 architecture mapping of RssiCoreWrapper is
91 
94 
97 
99  signal packetizerSlaves : AxiStreamSlaveArray(1 downto 0);
100 
103 
104  signal statusReg : slv(6 downto 0);
106 
107  -- This should really go in a AxiStreamPacketizerPkg
109  TSTRB_EN_C => false,
110  TDATA_BYTES_C => 8,
111  TDEST_BITS_C => 8,
112  TID_BITS_C => 8,
113  TKEEP_MODE_C => TKEEP_COMP_C,
114  TUSER_BITS_C => 8,
115  TUSER_MODE_C => TUSER_FIRST_LAST_C);
116 
117  -- If bypassing chunker, convert directly to RSSI AXIS config
118  -- else use Packetizer AXIS format. Packetizer will then convert to RSSI config.
120 
121 begin
122 
123  GEN_RX :
124  for i in (APP_STREAMS_G-1) downto 0 generate
125  U_RxFifo : entity work.AxiStreamFifoV2
126  generic map (
127  TPD_G => TPD_G,
128  SLAVE_READY_EN_G => true,
129  BRAM_EN_G => false,
130  GEN_SYNC_FIFO_G => true,
131  FIFO_ADDR_WIDTH_G => 4,
132  INT_PIPE_STAGES_G => 0,
133  PIPE_STAGES_G => 1,
136  port map (
137  sAxisClk => clk_i,
138  sAxisRst => rst_i,
141  mAxisClk => clk_i,
142  mAxisRst => rst_i,
143  mAxisMaster => rxMasters(i),
144  mAxisSlave => rxSlaves(i));
145  end generate GEN_RX;
146 
147  U_AxiStreamMux : entity work.AxiStreamMux
148  generic map (
149  TPD_G => TPD_G,
151  MODE_G => "ROUTED",
153  PIPE_STAGES_G => 1)
154  port map (
155  -- Clock and reset
156  axisClk => clk_i,
157  axisRst => rst_i,
158  -- Slaves
161  -- Master
164 
165  GEN_PACKER : if (BYPASS_CHUNKER_G = false) generate
166  U_Packetizer : entity work.AxiStreamPacketizer
167  generic map (
168  TPD_G => TPD_G,
170  INPUT_PIPE_STAGES_G => 0,
172  port map (
173  axisClk => clk_i,
174  axisRst => rst_i,
179  end generate;
180 
181  BYPASS_PACKER : if (BYPASS_CHUNKER_G = true) generate
184  end generate;
185 
186  U_RssiCore : entity work.RssiCore
187  generic map (
188  TPD_G => TPD_G,
191  SERVER_G => SERVER_G,
196  -- AXIS Configurations
199  -- Version and connection ID
201  CONN_ID_G => CONN_ID_G,
202  VERSION_G => VERSION_G,
204  -- Window parameters of receiver module
207  -- RSSI Timeouts
211  -- Counters
214  port map (
215  -- Clock and Reset
216  clk_i => clk_i,
217  rst_i => rst_i,
218  -- SSI Application side
223  -- SSI Transport side
228  -- High level Application side interface
229  openRq_i => openRq_i,
230  closeRq_i => closeRq_i,
231  inject_i => inject_i,
232  -- AXI-Lite Register Interface
233  axiClk_i => axiClk_i,
234  axiRst_i => axiRst_i,
239  -- Internal statuses
241 
243  rssiNotConnected <= not statusReg(0);
244 
245  GEN_DEPACKER : if (BYPASS_CHUNKER_G = false) generate
246  U_Depacketizer : entity work.AxiStreamDepacketizer
247  generic map (
248  TPD_G => TPD_G,
249  INPUT_PIPE_STAGES_G => 0, -- No need for input stage, RSSI output is already pipelined
251  port map (
252  axisClk => clk_i,
253  axisRst => rst_i,
259  end generate;
260 
261  BYPASS_DEPACKER : if (BYPASS_CHUNKER_G = true) generate
264  end generate;
265 
266  U_AxiStreamDeMux : entity work.AxiStreamDeMux
267  generic map (
268  TPD_G => TPD_G,
270  MODE_G => "ROUTED",
272  port map (
273  -- Clock and reset
274  axisClk => clk_i,
275  axisRst => rst_i,
276  -- Slaves
279  -- Master
281  mAxisSlaves => txSlaves);
282 
283  GEN_TX :
284  for i in (APP_STREAMS_G-1) downto 0 generate
285  U_TxFifo : entity work.AxiStreamFifoV2
286  generic map (
287  TPD_G => TPD_G,
288  SLAVE_READY_EN_G => true,
289  BRAM_EN_G => false,
290  GEN_SYNC_FIFO_G => true,
291  FIFO_ADDR_WIDTH_G => 4,
292  INT_PIPE_STAGES_G => 0,
296  port map (
297  sAxisClk => clk_i,
298  sAxisRst => rst_i,
299  sAxisMaster => txMasters(i),
300  sAxisSlave => txSlaves(i),
301  mAxisClk => clk_i,
302  mAxisRst => rst_i,
305  end generate GEN_TX;
306 
307 end architecture mapping;
MAX_SEG_SIZE_Gpositive := 1024
AxiStreamSlaveArray( 1 downto 0) packetizerSlaves
out mAxisMasterAxiStreamMasterType
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
natural range 0 to 8 TDEST_BITS_C
TPD_Gtime := 1 ns
AxiStreamConfigType :=ssiAxiStreamConfig(dataBytes => RSSI_WORD_WIDTH_C,tKeepMode => TKEEP_COMP_C,tUserMode => TUSER_FIRST_LAST_C,tDestBits => 0,tUserBits => 2) RSSI_AXIS_CONFIG_C
Definition: RssiPkg.vhd:33
NULL_TOUT_Gpositive := 200
array(natural range <> ) of AxiStreamSlaveType AxiStreamSlaveArray
in mTspAxisSlave_iAxiStreamSlaveType
VERSION_Gpositive := 1
Definition: RssiCore.vhd:75
SEGMENT_ADDR_SIZE_Gpositive := 7
MAX_SEG_SIZE_Gpositive := 1024
Definition: RssiCore.vhd:80
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
in sAppAxisMasters_iAxiStreamMasterArray( APP_STREAMS_G- 1 downto 0)
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
Definition: RssiCore.vhd:115
PIPE_STAGES_Gnatural range 0 to 16:= 1
in sTspAxisMaster_iAxiStreamMasterType
AxiStreamMasterArray( APP_STREAMS_G- 1 downto 0) rxMasters
out mTspAxisMaster_oAxiStreamMasterType
out sAppAxisSlaves_oAxiStreamSlaveArray( APP_STREAMS_G- 1 downto 0)
out sAxisSlaveAxiStreamSlaveType
SERVER_Gboolean := true
Definition: RssiCore.vhd:57
VERSION_Gpositive := 1
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
out mTspAxisMaster_oAxiStreamMasterType
Definition: RssiCore.vhd:109
out mAppAxisMaster_oAxiStreamMasterType
Definition: RssiCore.vhd:103
MAX_PACKET_BYTES_Ginteger := 1440
ACK_TOUT_Gpositive := 25
Definition: RssiCore.vhd:83
WINDOW_ADDR_SIZE_Gpositive := 3
APP_STREAM_ROUTES_GSlv8Array :=( 0=> "--------")
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
TDEST_ROUTES_GSlv8Array :=( 0=> "--------")
in sTspAxisMaster_iAxiStreamMasterType
Definition: RssiCore.vhd:107
out mAxisMastersAxiStreamMasterArray( NUM_MASTERS_G- 1 downto 0)
AxiStreamSlaveArray( APP_STREAMS_G- 1 downto 0) rxSlaves
AxiStreamMasterArray( 1 downto 0) packetizerMasters
CONN_ID_Gpositive := 16#12345678#
SLAVE_READY_EN_Gboolean := true
out statusReg_oslv( 6 downto 0)
Definition: RssiCore.vhd:121
WINDOW_ADDR_SIZE_Gpositive range 1 to 10:= 3
Definition: RssiCore.vhd:61
_library_ ieeeieee
Definition: RssiCore.vhd:37
out sTspAxisSlave_oAxiStreamSlaveType
CONN_ID_Gpositive := 16#12345678#
Definition: RssiCore.vhd:74
in openRq_isl := '0'
natural range 1 to 16 TDATA_BYTES_C
out sTspAxisSlave_oAxiStreamSlaveType
Definition: RssiCore.vhd:108
out axilReadSlaveAxiLiteReadSlaveType
in openRq_isl
Definition: RssiCore.vhd:96
GEN_SYNC_FIFO_Gboolean := false
in sAxisMasterAxiStreamMasterType
MAX_NUM_OUTS_SEG_Gpositive := 8
MODE_Gstring := "INDEXED"
in sAppAxisMaster_iAxiStreamMasterType
Definition: RssiCore.vhd:101
TkeepModeType TKEEP_MODE_C
out mAxisMasterAxiStreamMasterType
SERVER_Gboolean := true
out sAxisSlaveAxiStreamSlaveType
MAX_NUM_OUTS_SEG_Gpositive range 2 to 1024:= 8
Definition: RssiCore.vhd:79
natural range 0 to 8 TID_BITS_C
NULL_TOUT_Gpositive := 200
Definition: RssiCore.vhd:85
in inject_isl := '0'
Definition: RssiCore.vhd:98
in sAxisMasterAxiStreamMasterType
INIT_SEQ_N_Gnatural := 16#80#
array(natural range <> ) of AxiStreamConfigType AxiStreamConfigArray
APP_AXIS_CONFIG_GAxiStreamConfigArray :=( 0=> ssiAxiStreamConfig( 8, TKEEP_NORMAL_C))
RETRANSMIT_ENABLE_Gboolean := true
in axiClk_isl := '0'
Definition: RssiCore.vhd:113
TIMEOUT_UNIT_Greal := 1.0E-6
out sAxisSlaveAxiStreamSlaveType
in axiRst_isl := '0'
HEADER_CHKSUM_EN_Gboolean := true
Definition: RssiCore.vhd:76
slv( 1 downto 0) := "11" AXI_RESP_DECERR_C
Definition: AxiLitePkg.vhd:49
in closeRq_isl := '0'
AXI_ERROR_RESP_Gslv( 1 downto 0) := AXI_RESP_DECERR_C
Definition: RssiCore.vhd:64
AxiStreamSlaveArray( 1 downto 0) depacketizerSlaves
out mAxisMasterAxiStreamMasterType
RETRANS_TOUT_Gpositive := 50
Definition: RssiCore.vhd:84
NUM_SLAVES_Ginteger range 1 to 32:= 4
INT_PIPE_STAGES_Gnatural range 0 to 16:= 0
CLK_FREQUENCY_Greal := 100.0E+6
RETRANSMIT_ENABLE_Gboolean := true
Definition: RssiCore.vhd:59
in mAxisSlaveAxiStreamSlaveType
AxiStreamConfigType :=(TSTRB_EN_C => false,TDATA_BYTES_C => 8,TDEST_BITS_C => 8,TID_BITS_C => 8,TKEEP_MODE_C => TKEEP_COMP_C,TUSER_BITS_C => 8,TUSER_MODE_C => TUSER_FIRST_LAST_C) PACKETIZER_AXIS_CONFIG_C
MAX_RETRANS_CNT_Gpositive := 2
MAX_RETRANS_CNT_Gpositive := 2
Definition: RssiCore.vhd:88
in mTspAxisSlave_iAxiStreamSlaveType
Definition: RssiCore.vhd:110
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
BRAM_EN_Gboolean := true
APP_AXIS_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 4, TKEEP_NORMAL_C)
Definition: RssiCore.vhd:67
PIPE_STAGES_Gnatural := 0
AxiStreamMasterArray( 1 downto 0) depacketizerMasters
TPD_Gtime := 1 ns
in sAxisMastersAxiStreamMasterArray( NUM_SLAVES_G- 1 downto 0)
in sAxisMasterAxiStreamMasterType
boolean TSTRB_EN_C
in mAppAxisSlaves_iAxiStreamSlaveArray( APP_STREAMS_G- 1 downto 0)
TPD_Gtime := 1 ns
Definition: RssiCore.vhd:53
in axiClk_isl := '0'
slv( 6 downto 0) statusReg
out axilWriteSlaveAxiLiteWriteSlaveType
Definition: RssiCore.vhd:118
TUserModeType TUSER_MODE_C
TIMEOUT_UNIT_Greal := 1.0E-6
Definition: RssiCore.vhd:55
TPD_Gtime := 1 ns
in mAxisSlaveAxiStreamSlaveType
array(natural range <> ) of AxiStreamMasterType AxiStreamMasterArray
out sAxisSlavesAxiStreamSlaveArray( NUM_SLAVES_G- 1 downto 0)
natural range 0 to 8 TUSER_BITS_C
out sAxisSlaveAxiStreamSlaveType
in mAppAxisSlave_iAxiStreamSlaveType
Definition: RssiCore.vhd:104
TSP_AXIS_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 16, TKEEP_NORMAL_C)
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
Definition: AxiLitePkg.vhd:69
OUTPUT_PIPE_STAGES_Ginteger := 0
APP_STREAMS_Gpositive := 1
in axilReadMasterAxiLiteReadMasterType := AXI_LITE_READ_MASTER_INIT_C
AxiStreamConfigType := ite( BYPASS_CHUNKER_G, RSSI_AXIS_CONFIG_C, PACKETIZER_AXIS_CONFIG_C) CONV_AXIS_CONFIG_C
BYPASS_CHUNKER_Gboolean := false
out mAppAxisMasters_oAxiStreamMasterArray( APP_STREAMS_G- 1 downto 0)
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
HEADER_CHKSUM_EN_Gboolean := true
in mAxisSlavesAxiStreamSlaveArray( NUM_MASTERS_G- 1 downto 0)
AxiStreamSlaveArray( APP_STREAMS_G- 1 downto 0) txSlaves
AxiLiteWriteMasterType :=(awaddr =>( others => '0'),awprot =>( others => '0'),awvalid => '0',wdata =>( others => '0'),wstrb =>( others => '1'),wvalid => '0',bready => '1') AXI_LITE_WRITE_MASTER_INIT_C
Definition: AxiLitePkg.vhd:125
in sAxisMasterAxiStreamMasterType
SEGMENT_ADDR_SIZE_Gpositive := 7
Definition: RssiCore.vhd:62
in axiRst_isl := '0'
Definition: RssiCore.vhd:114
out mAxisMasterAxiStreamMasterType
AxiStreamMasterArray( APP_STREAMS_G- 1 downto 0) txMasters
MAX_CUM_ACK_CNT_Gpositive := 3
out sAppAxisSlave_oAxiStreamSlaveType
Definition: RssiCore.vhd:102
in closeRq_isl
Definition: RssiCore.vhd:97
INIT_SEQ_N_Gnatural := 16#80#
Definition: RssiCore.vhd:73
RETRANS_TOUT_Gpositive := 50
in axilWriteMasterAxiLiteWriteMasterType := AXI_LITE_WRITE_MASTER_INIT_C
Definition: RssiCore.vhd:117
in mAxisSlaveAxiStreamSlaveType
out axilReadSlaveAxiLiteReadSlaveType
Definition: RssiCore.vhd:116
out axilWriteSlaveAxiLiteWriteSlaveType
TPD_Gtime := 1 ns
array(natural range <> ) of slv( 7 downto 0) Slv8Array
Definition: StdRtlPkg.vhd:403
in rst_isl
Definition: RssiCore.vhd:93
TSP_AXIS_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 16, TKEEP_NORMAL_C)
Definition: RssiCore.vhd:68
MAX_CUM_ACK_CNT_Gpositive := 3
Definition: RssiCore.vhd:90
TDEST_ROUTES_Gslv8Array :=( 0=> "--------")
CLK_FREQUENCY_Greal := 100.0E6
Definition: RssiCore.vhd:54
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
in mAxisSlaveAxiStreamSlaveType
NUM_MASTERS_Ginteger range 1 to 32:= 12
out statusReg_oslv( 6 downto 0)
in inject_isl := '0'
std_logic_vector slv
Definition: StdRtlPkg.vhd:29
PIPE_STAGES_Ginteger range 0 to 16:= 0
MODE_Gstring := "INDEXED"
ACK_TOUT_Gpositive := 25
in clk_isl
Definition: RssiCore.vhd:92