1 ------------------------------------------------------------------------------- 2 -- File : AxiStreamMon.vhd 3 -- Company : SLAC National Accelerator Laboratory 4 -- Created : 2016-07-14 5 -- Last update: 2017-01-26 6 ------------------------------------------------------------------------------- 7 -- Description: AXI Stream Monitor 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;
35 -- AXIS Stream Interface 56 type RegType is record 63 timer : range 0 to TIMEOUT_C;
64 accum : slv(39 downto 0);
70 constant REG_INIT_C : RegType := ( 74 tKeep => (others => '0'), 78 accum => (others => '0'), 83 signal r : RegType := REG_INIT_C;
86 signal bw : slv(39 downto 0);
87 signal bwMax : slv(39 downto 0);
88 signal bwMin : slv(39 downto 0);
90 -- attribute dont_touch : string; 91 -- attribute dont_touch of r : signal is "true"; 103 -- Trigger Input (locClk domain) 105 -- Trigger Rate Output (locClk domain) 116 variable v : RegType;
118 -- Latch the current value 121 -- Reset strobing signals 126 -- Check for end of frame 129 -- Check for data moving 137 -- Check if last cycle had data moving 139 -- Update the accumulator 140 v.accum := r.accum + getTKeep(r.tKeep);
143 -- Increment the timer 144 v.timer := r.timer + 1;
147 if r.timer = TIMEOUT_C then 150 -- Update the bandwidth measurement 153 -- Reset the accumulator 155 v.accum := (others => '0');
157 v.accum := toSlv(getTKeep(r.tKeep), 40);
161 -- Check for update previous clock cycle 162 if (r.updated = '1') then 165 -- Check if first time after reset 166 if (r.armed = '0') then 169 -- Pass the current values to the statistics measurements 173 -- Compare for max. value 175 -- Update the statistics measurement 178 -- Compare for min. value 180 -- Update the statistics measurement 188 -- Re-arm and reset statistics measurements only 194 -- Register the variable for next clock cycle 202 r <= rin after TPD_G;
225 wr_en => r.updateStat,
226 din => r.bandwidthMax,
237 wr_en => r.updateStat,
238 din => r.bandwidthMin,
COMMON_CLK_Gboolean := false
in axisSlaveAxiStreamSlaveType
out bandwidthMaxslv( 63 downto 0)
AXIS_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
in dinslv( DATA_WIDTH_G- 1 downto 0)
out bandwidthMinslv( 63 downto 0)
out frameRateslv( 31 downto 0)
natural range 1 to 16 TDATA_BYTES_C
out doutslv( DATA_WIDTH_G- 1 downto 0)
REFRESH_RATE_Greal := 1.0E+0
COMMON_CLK_Gboolean := false
COMMON_CLK_Gboolean := false
out frameRateMaxslv( 31 downto 0)
out trigRateOutMinslv( CNT_WIDTH_G- 1 downto 0)
CNT_WIDTH_Gpositive := 32
out bandwidthslv( 63 downto 0)
AXIS_CLK_FREQ_Greal := 156.25E+6
out trigRateOutMaxslv( CNT_WIDTH_G- 1 downto 0)
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
REF_CLK_FREQ_Greal := 200.0E+6
in axisMasterAxiStreamMasterType
out frameRateMinslv( 31 downto 0)
out trigRateOutslv( CNT_WIDTH_G- 1 downto 0)
DATA_WIDTH_Ginteger range 1 to ( 2** 24):= 16