1 ------------------------------------------------------------------------------- 2 -- File : AxiStreamPacker 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2015-09-29 5 -- Last update: 2016-07-13 6 ------------------------------------------------------------------------------- 7 -- Description: AXI stream Packer Module 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_arith.
all;
21 use ieee.std_logic_unsigned.
all;
50 end entity AxiStreamPacker;
57 constant SIZE_DIFFERENCE_C : := STREAM_WIDTH_C-PACK_SIZE_C;
59 -- Vivado chokes if you try to calculate these on the fly inside the comb process. 60 -- Precompute all of the assignment indicies instead 62 variable ret : IntegerArray(0 to STREAM_WIDTH_C/SIZE_DIFFERENCE_C-1);
64 for i in ret'range loop 65 ret(i) := STREAM_WIDTH_C - (i*SIZE_DIFFERENCE_C);
68 end function computeIndicies;
70 constant ASSIGNMENT_INDECIES_C : IntegerArray := computeIndicies;
72 type RegType is record 75 data : slv(STREAM_WIDTH_C*2-1 downto 0);
76 index : slv(log2(STREAM_WIDTH_C/SIZE_DIFFERENCE_C)-1 downto 0);
79 constant REG_INIT_C : RegType := ( 82 data => (others => '0'), 83 index => (others => '0'));
85 signal r : RegType := REG_INIT_C;
93 -- Convert AXI-Stream signals to SSI 97 comb :
process (
axisRst, r, rawSsiMaster)
is 103 v.packedSsiMaster.sof := '0';
104 v.packedSsiMaster.eof := '0';
105 v.packedSsiMaster.eofe := '0';
106 v.packedSsiMaster.valid := '0';
108 v.rawSsiSlave.ready := '1';
109 v.rawSsiSlave.pause := '0';
113 if (rawSsiMaster.valid = '1') then 114 if (rawSsiMaster.sof = '1') then 115 -- Frame header goes through unmodified 116 v.data := (others => '0');
117 v.data(STREAM_WIDTH_C-1 downto 0) := rawSsiMaster.data(STREAM_WIDTH_C-1 downto 0);
118 v.packedSsiMaster.valid := '1';
119 v.packedSsiMaster.sof := '1';
120 v.index := (others => '0');
123 -- Pack all other txns 124 v.packedSsiMaster.eof := rawSsiMaster.eof;
125 v.packedSsiMaster.eofe := rawSsiMaster.eofe;
128 -- Shift the data over 129 v.data(STREAM_WIDTH_C-1 downto 0) := r.data(STREAM_WIDTH_C*2-1 downto STREAM_WIDTH_C);
131 -- Assign new data at proper index 132 indexInt := ASSIGNMENT_INDECIES_C(conv_integer(r.index));
135 -- Disable write until we have enough data 136 -- v.packedSsiMaster.valid := toSl(indexInt+PACK_SIZE_C >= STREAM_WIDTH_C); 137 v.packedSsiMaster.valid := toSl(r.index /= 0) or rawSsiMaster.eofe or rawSsiMaster.eof;
141 v.index := r.index + 1;
147 v.packedSsiMaster.data(STREAM_WIDTH_C-1 downto 0) := v.data(STREAM_WIDTH_C-1 downto 0);
149 ---------------------------------------------------------------------------------------------- 151 ---------------------------------------------------------------------------------------------- 158 ---------------------------------------------------------------------------------------------- 160 ---------------------------------------------------------------------------------------------- 170 r <= rin after TPD_G;
174 end architecture rtl;
RANGE_HIGH_Ginteger := 13
in rawAxisMasterAxiStreamMasterType
natural range 1 to 16 TDATA_BYTES_C
in packedAxisCtrlAxiStreamCtrlType
out packedAxisMasterAxiStreamMasterType
AxiStreamConfigType := ssiAxiStreamConfig( 16) SSI_CONFIG_INIT_C
out rawAxisSlaveAxiStreamSlaveType
out rawAxisCtrlAxiStreamCtrlType
AXI_STREAM_CONFIG_GAxiStreamConfigType := SSI_CONFIG_INIT_C
array(natural range <> ) of integer IntegerArray
in packedAxisSlaveAxiStreamSlaveType