From e0f954c28665d40f070b6ec753d1ed04fdb202d0 Mon Sep 17 00:00:00 2001 From: mkwiatko Date: Tue, 5 Nov 2019 13:59:25 -0800 Subject: [PATCH 1/8] Fixing saciClk not present (when SACI_CLK_HALF_PERIOD_C=64) --- protocols/saci/rtl/SaciMaster2.vhd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/saci/rtl/SaciMaster2.vhd b/protocols/saci/rtl/SaciMaster2.vhd index a840fac45e..63697558e4 100644 --- a/protocols/saci/rtl/SaciMaster2.vhd +++ b/protocols/saci/rtl/SaciMaster2.vhd @@ -68,7 +68,7 @@ architecture rtl of SaciMaster2 is shiftCount : slv(5 downto 0); --Saci clk gen - clkCount : slv(SACI_CLK_COUNTER_SIZE_C-1 downto 0); + clkCount : slv(SACI_CLK_COUNTER_SIZE_C downto 0); saciClkRising : sl; saciClkFalling : sl; From 8257415bef6b570523ac4b13ad84fc91db2f7418 Mon Sep 17 00:00:00 2001 From: mkwiatko Date: Mon, 11 Nov 2019 18:23:47 -0800 Subject: [PATCH 2/8] help to close timing at higher clock frequency --- .../ad9249/7Series/rtl/Ad9249ReadoutGroup.vhd | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/devices/AnalogDevices/ad9249/7Series/rtl/Ad9249ReadoutGroup.vhd b/devices/AnalogDevices/ad9249/7Series/rtl/Ad9249ReadoutGroup.vhd index f0dfb8fca5..1bb59834c0 100644 --- a/devices/AnalogDevices/ad9249/7Series/rtl/Ad9249ReadoutGroup.vhd +++ b/devices/AnalogDevices/ad9249/7Series/rtl/Ad9249ReadoutGroup.vhd @@ -77,6 +77,8 @@ architecture rtl of Ad9249ReadoutGroup is readoutDebug1 : slv16Array(NUM_CHANNELS_G-1 downto 0); lockedCountRst : sl; invert : sl; + curDelayFrame : slv(4 downto 0); + curDelayData : slv5Array(NUM_CHANNELS_G-1 downto 0); end record; constant AXIL_REG_INIT_C : AxilRegType := ( @@ -89,7 +91,9 @@ architecture rtl of Ad9249ReadoutGroup is readoutDebug0 => (others => (others => '0')), readoutDebug1 => (others => (others => '0')), lockedCountRst => '0', - invert => '0' + invert => '0', + curDelayFrame => (others => '0'), + curDelayData => (others => (others => '0')) ); signal lockedSync : sl; @@ -211,7 +215,9 @@ begin v.dataDelaySet := (others => '0'); v.frameDelaySet := '0'; - v.axilReadSlave.rdata := (others => '0'); + + v.curDelayFrame := curDelayFrame; + v.curDelayData := curDelayData; -- Store last two samples read from ADC if (debugDataValid = '1' and axilR.freezeDebug = '0') then @@ -234,9 +240,9 @@ begin -- Override read from r.delay and use curDealy output from delay primative instead for i in 0 to NUM_CHANNELS_G-1 loop - axiSlaveRegisterR(axilEp, X"00"+toSlv((i*4), 8), 0, curDelayData(i)); + axiSlaveRegisterR(axilEp, X"00"+toSlv((i*4), 8), 0, axilR.curDelayData(i)); end loop; - axiSlaveRegisterR(axilEp, X"20", 0, curDelayFrame); + axiSlaveRegisterR(axilEp, X"20", 0, axilR.curDelayFrame); -- Debug output to see how many times the shift has needed a relock From 3d9e4024eadb2634bcc2cb4a5435723f937fc58a Mon Sep 17 00:00:00 2001 From: mkwiatko Date: Tue, 19 Nov 2019 16:32:29 -0800 Subject: [PATCH 3/8] Microblaze cannot make 1 byte writes to the AxiDualPortRam anymore. Fixing in the ssi_printf by changingXil_Out8 to Xil_Out32. --- xilinx/general/sdk/common/ssi_printf.c | 7 ++++++- xilinx/general/sdk/common/ssi_printf.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xilinx/general/sdk/common/ssi_printf.c b/xilinx/general/sdk/common/ssi_printf.c index 62669ec137..f95471c7b8 100644 --- a/xilinx/general/sdk/common/ssi_printf.c +++ b/xilinx/general/sdk/common/ssi_printf.c @@ -35,7 +35,12 @@ void ssi_putc ( void* p, char c) { // Dual port ram buffer if enabled if ( pp->buffSize > 0 ) { - Xil_Out8(pp->buffBase+4+pp->buffPtr, c); + //Xil_Out8(pp->buffBase+4+pp->buffPtr, c); + if (pp->buffPtr%4 == 0) + pp->buffWord = c; + else + pp->buffWord |= (c << (pp->buffPtr%4)*8); + Xil_Out32(pp->buffBase+4+(pp->buffPtr/4)*4, pp->buffWord); // Adjust pointer pp->buffPtr++; diff --git a/xilinx/general/sdk/common/ssi_printf.h b/xilinx/general/sdk/common/ssi_printf.h index 9f1bf4b2a3..c28aa6402d 100644 --- a/xilinx/general/sdk/common/ssi_printf.h +++ b/xilinx/general/sdk/common/ssi_printf.h @@ -22,6 +22,7 @@ struct ssi_printf_type { uint16_t buffSize; uint16_t buffPtr; uint16_t buffTot; + uint32_t buffWord; }; void ssi_putc ( void* p, const char c); From 7f3b23c85646cfe804a0582f0edc27e4a4fd44e9 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Tue, 7 Jan 2020 12:58:19 -0800 Subject: [PATCH 4/8] adding FrameSize support to AxiStreamMon --- axi/axi-stream/rtl/AxiStreamMon.vhd | 88 ++++++++++++++++++------- axi/axi-stream/rtl/AxiStreamMonAxiL.vhd | 50 +++++++++----- python/surf/axi/_AxiStreamMonitoring.py | 38 ++++++++++- 3 files changed, 137 insertions(+), 39 deletions(-) diff --git a/axi/axi-stream/rtl/AxiStreamMon.vhd b/axi/axi-stream/rtl/AxiStreamMon.vhd index 42cca81c37..2d1660f804 100644 --- a/axi/axi-stream/rtl/AxiStreamMon.vhd +++ b/axi/axi-stream/rtl/AxiStreamMon.vhd @@ -17,7 +17,6 @@ use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; - library surf; use surf.StdRtlPkg.all; use surf.AxiStreamPkg.all; @@ -38,6 +37,9 @@ entity AxiStreamMon is statusClk : in sl; statusRst : in sl; frameCnt : out slv(63 downto 0); -- units of frames + frameSize : out slv(31 downto 0); -- units of Byte + frameSizeMax : out slv(31 downto 0); -- units of Byte + frameSizeMin : out slv(31 downto 0); -- units of Byte frameRate : out slv(31 downto 0); -- units of Hz frameRateMax : out slv(31 downto 0); -- units of Hz frameRateMin : out slv(31 downto 0); -- units of Hz @@ -52,25 +54,33 @@ architecture rtl of AxiStreamMon is constant TIMEOUT_C : natural := getTimeRatio(AXIS_CLK_FREQ_G, 1.0)-1; type RegType is record - frameSent : sl; - tValid : sl; - tKeep : slv(AXI_STREAM_MAX_TKEEP_WIDTH_C-1 downto 0); - updated : sl; - timer : natural range 0 to TIMEOUT_C; - accum : slv(39 downto 0); - bandwidth : slv(39 downto 0); - frameCnt : slv(63 downto 0); + frameSent : sl; + sizeValid : sl; + armed : sl; + tValid : sl; + tKeep : slv(AXI_STREAM_MAX_TKEEP_WIDTH_C-1 downto 0); + updated : sl; + timer : natural range 0 to TIMEOUT_C; + accum : slv(39 downto 0); + bandwidth : slv(39 downto 0); + frameAccum : slv(31 downto 0); + frameSize : slv(31 downto 0); + frameCnt : slv(63 downto 0); end record; constant REG_INIT_C : RegType := ( - frameSent => '0', - tValid => '0', - tKeep => (others => '0'), - updated => '0', - timer => 0, - accum => (others => '0'), - bandwidth => (others => '0'), - frameCnt => (others => '0')); + frameSent => '0', + sizeValid => '0', + armed => '0', + tValid => '0', + tKeep => (others => '0'), + updated => '0', + timer => 0, + accum => (others => '0'), + bandwidth => (others => '0'), + frameAccum => (others => '0'), + frameSize => (others => '0'), + frameCnt => (others => '0')); signal r : RegType := REG_INIT_C; signal rin : RegType; @@ -164,8 +174,9 @@ begin v := r; -- Reset strobing signals - v.tValid := '0'; - v.updated := '0'; + v.tValid := '0'; + v.updated := '0'; + v.sizeValid := '0'; -- Check for end of frame v.frameSent := axisMaster.tValid and axisMaster.tLast and axisSlave.tReady; @@ -184,13 +195,28 @@ begin end if; -- Check if last cycle had data moving - if r.tValid = '1' then + if (r.tValid = '1') then + -- Update the accumulator if (AXIS_CONFIG_G.TKEEP_MODE_C = TKEEP_COUNT_C) then - v.accum := r.accum + conv_integer(r.tKeep(bitSize(AXIS_CONFIG_G.TDATA_BYTES_C)-1 downto 0)); + v.accum := r.accum + conv_integer(r.tKeep(bitSize(AXIS_CONFIG_G.TDATA_BYTES_C)-1 downto 0)); + v.frameAccum := r.frameAccum + conv_integer(r.tKeep(bitSize(AXIS_CONFIG_G.TDATA_BYTES_C)-1 downto 0)); else - v.accum := r.accum + getTKeep(r.tKeep, AXIS_CONFIG_G); + v.accum := r.accum + getTKeep(r.tKeep, AXIS_CONFIG_G); + v.frameAccum := r.frameAccum + getTKeep(r.tKeep, AXIS_CONFIG_G); + end if; + + -- Check for end of frame + if (r.frameSent = '1') then + -- Set the flag + v.sizeValid := r.armed; + v.frameSize := v.frameAccum; + -- Reset the accumulator + v.frameAccum := (others => '0'); + -- Confirmed that not in the middle of a frame since reset + v.armed := '1'; end if; + end if; -- Increment the timer @@ -232,6 +258,24 @@ begin end if; end process seq; + Sync_frameSize : entity surf.SyncMinMax + generic map ( + TPD_G => TPD_G, + COMMON_CLK_G => COMMON_CLK_G, + WIDTH_G => 32) + port map ( + -- ASYNC statistics reset + rstStat => axisRst, + -- Write Interface (wrClk domain) + wrClk => axisClk, + wrEn => r.sizeValid, + dataIn => r.frameSize, + -- Read Interface (rdClk domain) + rdClk => statusClk, + dataOut => frameSize, + dataMin => frameSizeMin, + dataMax => frameSizeMax); + Sync_bandwidth : entity surf.SyncMinMax generic map ( TPD_G => TPD_G, diff --git a/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd b/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd index 96073110a9..14093c6f8e 100644 --- a/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd +++ b/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd @@ -71,10 +71,16 @@ architecture rtl of AxiStreamMonAxiL is signal localReset : sl; signal axisReset : sl; - signal frameCnt : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); + signal frameCnt : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); + + signal frameSize : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); + signal frameSizeMax : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); + signal frameSizeMin : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); + signal frameRate : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); signal frameRateMax : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); signal frameRateMin : Slv32Array(AXIS_NUM_SLOTS_G-1 downto 0); + signal bandwidth : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); signal bandwidthMax : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); signal bandwidthMin : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); @@ -112,13 +118,20 @@ begin axisRst => axisReset, axisMaster => axisMasters(i), axisSlave => axisSlaves(i), - -- Status Interface + -- Status Clock and reset statusClk => axisClk, statusRst => axisReset, + -- Status: Total number of frame received since statusRst frameCnt => frameCnt(i), + -- Status: Frame Size (units of Byte) + frameSize => frameSize(i), + frameSizeMax => frameSizeMax(i), + frameSizeMin => frameSizeMin(i), + -- Status: Frame rate (units of Hz) frameRate => frameRate(i), frameRateMax => frameRateMax(i), frameRateMin => frameRateMin(i), + -- Status: Bandwidth (units of Byte/s) bandwidth => bandwidth(i), bandwidthMax => bandwidthMax(i), bandwidthMin => bandwidthMin(i)); @@ -152,7 +165,8 @@ begin din => r.data); comb : process (axisRst, bandwidth, bandwidthMax, bandwidthMin, frameCnt, - frameRate, frameRateMax, frameRateMin, r) is + frameRate, frameRateMax, frameRateMin, frameSize, + frameSizeMax, frameSizeMin, r) is variable v : RegType; begin -- Latch the current value @@ -162,19 +176,23 @@ begin v.we := '1'; v.addr := r.addr + 1; case (r.wrd) is - ---------------------------------------------------------------------- - when 1 => v.data := frameCnt(r.ch)(31 downto 0); -- i*0x40 + 0x04 - when 2 => v.data := frameCnt(r.ch)(63 downto 32); -- i*0x40 + 0x08 - when 3 => v.data := frameRate(r.ch); -- i*0x40 + 0x0C - when 4 => v.data := frameRateMax(r.ch); -- i*0x40 + 0x10 - when 5 => v.data := frameRateMin(r.ch); -- i*0x40 + 0x14 - when 6 => v.data := bandwidth(r.ch)(31 downto 0); -- i*0x40 + 0x18 - when 7 => v.data := bandwidth(r.ch)(63 downto 32); -- i*0x40 + 0x1C - when 8 => v.data := bandwidthMax(r.ch)(31 downto 0); -- i*0x40 + 0x20 - when 9 => v.data := bandwidthMax(r.ch)(63 downto 32); -- i*0x40 + 0x24 - when 10 => v.data := bandwidthMin(r.ch)(31 downto 0); -- i*0x40 + 0x28 - when 11 => v.data := bandwidthMin(r.ch)(63 downto 32); -- i*0x40 + 0x2C - when others => v.we := '0'; + ---------------------------------------------------------------------- + when 0 => v.we := '0'; -- i*0x40 + 0x00: dedicated for counter reset + when 1 => v.data := frameCnt(r.ch)(31 downto 0); -- i*0x40 + 0x04 + when 2 => v.data := frameCnt(r.ch)(63 downto 32); -- i*0x40 + 0x08 + when 3 => v.data := frameRate(r.ch); -- i*0x40 + 0x0C + when 4 => v.data := frameRateMax(r.ch); -- i*0x40 + 0x10 + when 5 => v.data := frameRateMin(r.ch); -- i*0x40 + 0x14 + when 6 => v.data := bandwidth(r.ch)(31 downto 0); -- i*0x40 + 0x18 + when 7 => v.data := bandwidth(r.ch)(63 downto 32); -- i*0x40 + 0x1C + when 8 => v.data := bandwidthMax(r.ch)(31 downto 0); -- i*0x40 + 0x20 + when 9 => v.data := bandwidthMax(r.ch)(63 downto 32); -- i*0x40 + 0x24 + when 10 => v.data := bandwidthMin(r.ch)(31 downto 0); -- i*0x40 + 0x28 + when 11 => v.data := bandwidthMin(r.ch)(63 downto 32); -- i*0x40 + 0x2C + when 12 => v.data := frameSize(r.ch); -- i*0x40 + 0x30 + when 13 => v.data := frameSizeMax(r.ch); -- i*0x40 + 0x34 + when 14 => v.data := frameSizeMin(r.ch); -- i*0x40 + 0x38 + when 15 => v.we := '0'; -- i*0x40 + 0x3C: Spare ---------------------------------------------------------------------- end case; diff --git a/python/surf/axi/_AxiStreamMonitoring.py b/python/surf/axi/_AxiStreamMonitoring.py index 407190ef6e..6464366e2e 100644 --- a/python/surf/axi/_AxiStreamMonitoring.py +++ b/python/surf/axi/_AxiStreamMonitoring.py @@ -139,7 +139,43 @@ def addPair(name,offset,bitSize,units,bitOffset,description,function,pollInterva units = 'Mbps', pollInterval = 1, ) - + + self.add(pr.RemoteVariable( + name = f'FrameSize[{i}]', + description = 'Current Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = (i*0x40 + 0x30), + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = f'FrameSizeMax[{i}]', + description = 'Max Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = (i*0x40 + 0x34), + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = f'FrameSizeMin[{i}]', + description = 'Min Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = (i*0x40 + 0x38), + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + @staticmethod def convMbps(var): return var.dependencies[0].value() * 8e-6 From 6f787c9d33b32903bd1ec5c4c172ccbed84049cf Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Thu, 9 Jan 2020 08:20:40 -0800 Subject: [PATCH 5/8] python reorg --- .../surf/axi/{_AxiStreamMonitoring.py => _AxiStreamMonAxiL.py} | 0 python/surf/axi/__init__.py | 2 +- python/{ => tools}/apply_slac_license.py | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename python/surf/axi/{_AxiStreamMonitoring.py => _AxiStreamMonAxiL.py} (100%) rename python/{ => tools}/apply_slac_license.py (100%) diff --git a/python/surf/axi/_AxiStreamMonitoring.py b/python/surf/axi/_AxiStreamMonAxiL.py similarity index 100% rename from python/surf/axi/_AxiStreamMonitoring.py rename to python/surf/axi/_AxiStreamMonAxiL.py diff --git a/python/surf/axi/__init__.py b/python/surf/axi/__init__.py index f5cd817f0f..a63af75243 100644 --- a/python/surf/axi/__init__.py +++ b/python/surf/axi/__init__.py @@ -12,7 +12,7 @@ from surf.axi._AxiLiteRingBuffer import * from surf.axi._AxiMemTester import * from surf.axi._AxiStreamDmaRingWrite import * -from surf.axi._AxiStreamMonitoring import * +from surf.axi._AxiStreamMonAxiL import * from surf.axi._AxiVersion import * from surf.axi._AxiVersionLegacy import * from surf.axi._AxiStreamDmaFifo import * diff --git a/python/apply_slac_license.py b/python/tools/apply_slac_license.py similarity index 100% rename from python/apply_slac_license.py rename to python/tools/apply_slac_license.py From f9ceeb1a7a68eef981396caa31f2be5c159f84c7 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Thu, 9 Jan 2020 09:43:10 -0800 Subject: [PATCH 6/8] bug fix + exposing AXIS_CONFIG_G to register space --- axi/axi-stream/rtl/AxiStreamMonAxiL.vhd | 123 +++++++++++++++++------- 1 file changed, 88 insertions(+), 35 deletions(-) diff --git a/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd b/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd index 14093c6f8e..8e089b02ed 100644 --- a/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd +++ b/axi/axi-stream/rtl/AxiStreamMonAxiL.vhd @@ -17,7 +17,6 @@ use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; - library surf; use surf.StdRtlPkg.all; use surf.AxiStreamPkg.all; @@ -52,17 +51,17 @@ architecture rtl of AxiStreamMonAxiL is type RegType is record we : sl; data : slv(31 downto 0); + cnt : slv(ADDR_WIDTH_C-1 downto 0); addr : slv(ADDR_WIDTH_C-1 downto 0); ch : natural range 0 to AXIS_NUM_SLOTS_G-1; - wrd : natural range 0 to 15; end record; constant REG_INIT_C : RegType := ( we => '0', data => (others => '0'), + cnt => (others => '1'), -- pre-set to all ones so 1st write after reset is address=0x0 addr => (others => '1'), -- pre-set to all ones so 1st write after reset is address=0x0 - ch => 0, - wrd => 0); + ch => 0); signal r : RegType := REG_INIT_C; signal rin : RegType; @@ -85,8 +84,21 @@ architecture rtl of AxiStreamMonAxiL is signal bandwidthMax : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); signal bandwidthMin : Slv64Array(AXIS_NUM_SLOTS_G-1 downto 0); - -- attribute dont_touch : string; - -- attribute dont_touch of r : signal is "true"; + -- attribute dont_touch : string; + -- attribute dont_touch of r : signal is "true"; + -- attribute dont_touch of rstCnt : signal is "true"; + -- attribute dont_touch of localReset : signal is "true"; + -- attribute dont_touch of axisReset : signal is "true"; + -- attribute dont_touch of frameCnt : signal is "true"; + -- attribute dont_touch of frameSize : signal is "true"; + -- attribute dont_touch of frameSizeMax : signal is "true"; + -- attribute dont_touch of frameSizeMin : signal is "true"; + -- attribute dont_touch of frameRate : signal is "true"; + -- attribute dont_touch of frameRateMax : signal is "true"; + -- attribute dont_touch of frameRateMin : signal is "true"; + -- attribute dont_touch of bandwidth : signal is "true"; + -- attribute dont_touch of bandwidthMax : signal is "true"; + -- attribute dont_touch of bandwidthMin : signal is "true"; begin @@ -167,53 +179,94 @@ begin comb : process (axisRst, bandwidth, bandwidthMax, bandwidthMin, frameCnt, frameRate, frameRateMax, frameRateMin, frameSize, frameSizeMax, frameSizeMin, r) is - variable v : RegType; + variable v : RegType; + variable wrd : slv(3 downto 0); begin -- Latch the current value v := r; + -- Increment the counter + v.cnt := r.cnt + 1; + -- Write the status counter to RAM v.we := '1'; - v.addr := r.addr + 1; - case (r.wrd) is + v.addr := v.cnt; + + -- Case on the word index + wrd := v.addr(3 downto 0); + case (wrd) is + ---------------------------------------------------------------------- + when x"0" => -- i*0x40 + 0x00: DMA AXI Stream Configuration (debugging) + + v.data(31 downto 24) := toSlv(AXIS_CONFIG_G.TDATA_BYTES_C, 8); + v.data(23 downto 20) := toSlv(AXIS_CONFIG_G.TDEST_BITS_C, 4); + v.data(19 downto 16) := toSlv(AXIS_CONFIG_G.TUSER_BITS_C, 4); + v.data(15 downto 12) := toSlv(AXIS_CONFIG_G.TID_BITS_C, 4); + + case AXIS_CONFIG_G.TKEEP_MODE_C is + when TKEEP_NORMAL_C => v.data(11 downto 8) := x"0"; + when TKEEP_COMP_C => v.data(11 downto 8) := x"1"; + when TKEEP_FIXED_C => v.data(11 downto 8) := x"2"; + when TKEEP_COUNT_C => v.data(11 downto 8) := x"3"; + when others => v.data(11 downto 8) := x"F"; + end case; + + case AXIS_CONFIG_G.TUSER_MODE_C is + when TUSER_NORMAL_C => v.data(7 downto 4) := x"0"; + when TUSER_FIRST_LAST_C => v.data(7 downto 4) := x"1"; + when TUSER_LAST_C => v.data(7 downto 4) := x"2"; + when TUSER_NONE_C => v.data(7 downto 4) := x"3"; + when others => v.data(7 downto 4) := x"F"; + end case; + + v.data(3) := '0'; + v.data(2) := '0'; + v.data(1) := ite(AXIS_CONFIG_G.TSTRB_EN_C, '1', '0'); + v.data(0) := ite(COMMON_CLK_G, '1', '0'); + ---------------------------------------------------------------------- - when 0 => v.we := '0'; -- i*0x40 + 0x00: dedicated for counter reset - when 1 => v.data := frameCnt(r.ch)(31 downto 0); -- i*0x40 + 0x04 - when 2 => v.data := frameCnt(r.ch)(63 downto 32); -- i*0x40 + 0x08 - when 3 => v.data := frameRate(r.ch); -- i*0x40 + 0x0C - when 4 => v.data := frameRateMax(r.ch); -- i*0x40 + 0x10 - when 5 => v.data := frameRateMin(r.ch); -- i*0x40 + 0x14 - when 6 => v.data := bandwidth(r.ch)(31 downto 0); -- i*0x40 + 0x18 - when 7 => v.data := bandwidth(r.ch)(63 downto 32); -- i*0x40 + 0x1C - when 8 => v.data := bandwidthMax(r.ch)(31 downto 0); -- i*0x40 + 0x20 - when 9 => v.data := bandwidthMax(r.ch)(63 downto 32); -- i*0x40 + 0x24 - when 10 => v.data := bandwidthMin(r.ch)(31 downto 0); -- i*0x40 + 0x28 - when 11 => v.data := bandwidthMin(r.ch)(63 downto 32); -- i*0x40 + 0x2C - when 12 => v.data := frameSize(r.ch); -- i*0x40 + 0x30 - when 13 => v.data := frameSizeMax(r.ch); -- i*0x40 + 0x34 - when 14 => v.data := frameSizeMin(r.ch); -- i*0x40 + 0x38 - when 15 => v.we := '0'; -- i*0x40 + 0x3C: Spare - ---------------------------------------------------------------------- + when x"1" => v.data := frameCnt(r.ch)(31 downto 0); -- i*0x40 + 0x04 + when x"2" => v.data := frameCnt(r.ch)(63 downto 32); -- i*0x40 + 0x08 + ---------------------------------------------------------------------- + when x"3" => v.data := frameRate(r.ch); -- i*0x40 + 0x0C + when x"4" => v.data := frameRateMax(r.ch); -- i*0x40 + 0x10 + when x"5" => v.data := frameRateMin(r.ch); -- i*0x40 + 0x14 + ---------------------------------------------------------------------- + when x"6" => v.data := bandwidth(r.ch)(31 downto 0); -- i*0x40 + 0x18 + when x"7" => v.data := bandwidth(r.ch)(63 downto 32); -- i*0x40 + 0x1C + when x"8" => v.data := bandwidthMax(r.ch)(31 downto 0); -- i*0x40 + 0x20 + when x"9" => v.data := bandwidthMax(r.ch)(63 downto 32); -- i*0x40 + 0x24 + when x"A" => v.data := bandwidthMin(r.ch)(31 downto 0); -- i*0x40 + 0x28 + when x"B" => v.data := bandwidthMin(r.ch)(63 downto 32); -- i*0x40 + 0x2C + ---------------------------------------------------------------------- + when x"C" => v.data := frameSize(r.ch); -- i*0x40 + 0x30 + when x"D" => v.data := frameSizeMax(r.ch); -- i*0x40 + 0x34 + when x"E" => v.data := frameSizeMin(r.ch); -- i*0x40 + 0x38 + ---------------------------------------------------------------------- + when x"F" => -- i*0x40 + 0x3C: Debugging + v.data(7 downto 0) := toSlv(AXIS_NUM_SLOTS_G, 8); + v.data(15 downto 8) := toSlv(ADDR_WIDTH_C, 8); + v.data(23 downto 16) := toSlv(r.ch, 8); + v.data(31 downto 16) := (others => '0'); + ----------------------------------------------------------------------- + when others => + v.we := '0'; + ----------------------------------------------------------------------- end case; -- Check for last word - if (r.wrd = 15) then - - -- Reset the counter - v.wrd := 0; + if (wrd = x"F") then -- Check for last word if (r.ch = AXIS_NUM_SLOTS_G-1) then - -- Reset the counter - v.ch := 0; + -- Reset the counters + v.ch := 0; + v.cnt := (others => '1'); -- pre-set to all ones so 1st write after reset is address=0x0 else -- Increment the counters v.ch := r.ch + 1; end if; - else - -- Increment the counters - v.wrd := r.wrd + 1; end if; -- Synchronous Reset From bd5437ec0f66a7baf45626e4e2c8c8477b16fa96 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Thu, 9 Jan 2020 09:43:39 -0800 Subject: [PATCH 7/8] deprecating AxiStreamMonitoring and reorg of register space --- python/surf/axi/_AxiStreamMonAxiL.py | 376 ++++++++++++++++++--------- 1 file changed, 246 insertions(+), 130 deletions(-) diff --git a/python/surf/axi/_AxiStreamMonAxiL.py b/python/surf/axi/_AxiStreamMonAxiL.py index 6464366e2e..42eff191aa 100644 --- a/python/surf/axi/_AxiStreamMonAxiL.py +++ b/python/surf/axi/_AxiStreamMonAxiL.py @@ -19,22 +19,13 @@ import pyrogue as pr -class AxiStreamMonitoring(pr.Device): +class AxiStreamMonChannel(pr.Device): def __init__(self, - name = "AxiStreamMonitoring", - description = "AxiStreamMonitoring Container", - numberLanes = 1, + name = "AxiStreamMonChannel", + description = "AxiStreamMonChannel Container", **kwargs): super().__init__(name=name, description=description, **kwargs) - - self.add(pr.RemoteCommand( - name = 'CntRst', - description = "Counter Reset", - offset = 0x0, - bitSize = 1, - function = lambda cmd: cmd.post(1), - )) - + def addPair(name,offset,bitSize,units,bitOffset,description,function,pollInterval = 0,): self.add(pr.RemoteVariable( name = ("Raw"+name), @@ -55,130 +46,239 @@ def addPair(name,offset,bitSize,units,bitOffset,description,function,pollInterva disp = '{:1.1f}', dependencies = [self.variables["Raw"+name]], )) + + self.add(pr.RemoteVariable( + name = 'FrameCnt', + description = 'Increments every time a tValid + tLast + tReady detected', + offset = 0x04, + bitSize = 64, + mode = 'RO', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = 'FrameRate', + description = "Current Frame Rate", + offset = 0x0C, + bitSize = 32, + bitOffset = 0, + mode = "RO", + base = pr.Int, + units = 'Hz', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = 'FrameRateMax', + description = "Max Frame Rate", + offset = 0x10, + bitSize = 32, + bitOffset = 0, + mode = "RO", + base = pr.Int, + units = 'Hz', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = 'FrameRateMin', + description = "Min Frame Rate", + offset = 0x14, + bitSize = 32, + bitOffset = 0, + mode = "RO", + base = pr.Int, + units = 'Hz', + pollInterval = 1, + )) - ############################################# - # Create block / variable combinations - ############################################# + addPair( + name = 'Bandwidth', + description = "Current Bandwidth", + offset = 0x18, + bitSize = 64, + bitOffset = 0, + function = self.convMbps, + units = 'Mbps', + pollInterval = 1, + ) + + addPair( + name = 'BandwidthMax', + description = "Max Bandwidth", + offset = 0x20, + bitSize = 64, + bitOffset = 0, + function = self.convMbps, + units = 'Mbps', + pollInterval = 1, + ) + + addPair( + name = 'BandwidthMin', + description = "Min Bandwidth", + offset = 0x28, + bitSize = 64, + bitOffset = 0, + function = self.convMbps, + units = 'Mbps', + pollInterval = 1, + ) + + self.add(pr.RemoteVariable( + name = 'FrameSize', + description = 'Current Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = 0x30, + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = 'FrameSizeMax', + description = 'Max Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = 0x34, + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + + self.add(pr.RemoteVariable( + name = 'FrameSizeMin', + description = 'Min Frame Size. Note: Only valid for non-interleaved AXI stream frames', + offset = 0x38, + bitSize = 32, + bitOffset = 0, + mode = 'RO', + base = pr.Int, + units = 'Byte', + pollInterval = 1, + )) + + @staticmethod + def convMbps(var): + return var.dependencies[0].value() * 8e-6 - for i in range(numberLanes): +class AxiStreamMonAxiL(pr.Device): + def __init__(self, + name = "AxiStreamMonitoring", + description = "AxiStreamMonitoring Container", + numberLanes = 1, + **kwargs): + super().__init__(name=name, description=description, **kwargs) - self.add(pr.RemoteVariable( - name = f'FrameCnt[{i}]', - description = 'Increments every time a tValid + tLast + tReady detected', - offset = (i*0x40 + 0x04), - bitSize = 64, - mode = 'RO', - pollInterval = 1, - )) + self.add(pr.RemoteCommand( + name = 'CntRst', + description = "Counter Reset", + offset = 0x0, + bitSize = 1, + function = lambda cmd: cmd.post(1), + overlapEn = True, + )) - self.add(pr.RemoteVariable( - name = f'FrameRate[{i}]', - description = "Current Frame Rate", - offset = (i*0x40 + 0x0C), - bitSize = 32, - bitOffset = 0, - mode = "RO", - base = pr.Int, - units = 'Hz', - pollInterval = 1, - )) - - self.add(pr.RemoteVariable( - name = f'FrameRateMax[{i}]', - description = "Max Frame Rate", - offset = (i*0x40 + 0x10), - bitSize = 32, - bitOffset = 0, - mode = "RO", - base = pr.Int, - units = 'Hz', - pollInterval = 1, - )) - - self.add(pr.RemoteVariable( - name = f'FrameRateMin[{i}]', - description = "Min Frame Rate", - offset = (i*0x40 + 0x14), - bitSize = 32, - bitOffset = 0, - mode = "RO", - base = pr.Int, - units = 'Hz', - pollInterval = 1, - )) - - addPair( - name = f'Bandwidth[{i}]', - description = "Current Bandwidth", - offset = (i*0x40 + 0x18), - bitSize = 64, - bitOffset = 0, - function = self.convMbps, - units = 'Mbps', - pollInterval = 1, - ) - - addPair( - name = f'BandwidthMax[{i}]', - description = "Max Bandwidth", - offset = (i*0x40 + 0x20), - bitSize = 64, - bitOffset = 0, - function = self.convMbps, - units = 'Mbps', - pollInterval = 1, - ) - - addPair( - name = f'BandwidthMin[{i}]', - description = "Min Bandwidth", - offset = (i*0x40 + 0x28), - bitSize = 64, - bitOffset = 0, - function = self.convMbps, - units = 'Mbps', - pollInterval = 1, - ) - - self.add(pr.RemoteVariable( - name = f'FrameSize[{i}]', - description = 'Current Frame Size. Note: Only valid for non-interleaved AXI stream frames', - offset = (i*0x40 + 0x30), - bitSize = 32, - bitOffset = 0, - mode = 'RO', - base = pr.Int, - units = 'Byte', - pollInterval = 1, - )) + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TDATA_BYTES_C', + offset = 0x0, + bitSize = 8, + bitOffset = 24, + mode = 'RO', + disp = '{:d}', + overlapEn = True, + )) - self.add(pr.RemoteVariable( - name = f'FrameSizeMax[{i}]', - description = 'Max Frame Size. Note: Only valid for non-interleaved AXI stream frames', - offset = (i*0x40 + 0x34), - bitSize = 32, - bitOffset = 0, - mode = 'RO', - base = pr.Int, - units = 'Byte', - pollInterval = 1, - )) + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TDEST_BITS_C', + offset = 0x0, + bitSize = 4, + bitOffset = 20, + mode = 'RO', + disp = '{:d}', + overlapEn = True, + )) - self.add(pr.RemoteVariable( - name = f'FrameSizeMin[{i}]', - description = 'Min Frame Size. Note: Only valid for non-interleaved AXI stream frames', - offset = (i*0x40 + 0x38), - bitSize = 32, - bitOffset = 0, - mode = 'RO', - base = pr.Int, - units = 'Byte', - pollInterval = 1, - )) + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TUSER_BITS_C', + offset = 0x0, + bitSize = 4, + bitOffset = 16, + mode = 'RO', + disp = '{:d}', + overlapEn = True, + )) - @staticmethod - def convMbps(var): - return var.dependencies[0].value() * 8e-6 + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TID_BITS_C', + offset = 0x0, + bitSize = 4, + bitOffset = 12, + mode = 'RO', + overlapEn = True, + )) + + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TKEEP_MODE_C', + offset = 0x0, + bitSize = 4, + bitOffset = 8, + mode = 'RO', + enum = { + 0x0: 'TKEEP_NORMAL_C', + 0x1: 'TKEEP_COMP_C', + 0x2: 'TKEEP_FIXED_C', + 0x3: 'TKEEP_COUNT_C', + 0xF: 'UNDEFINED', + }, + overlapEn = True, + )) + + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TUSER_MODE_C', + offset = 0x0, + bitSize = 4, + bitOffset = 4, + mode = 'RO', + enum = { + 0x0: 'TUSER_NORMAL_C', + 0x1: 'TUSER_FIRST_LAST_C', + 0x2: 'TUSER_LAST_C', + 0x3: 'TUSER_NONE_C', + 0xF: 'UNDEFINED', + }, + overlapEn = True, + )) + + self.add(pr.RemoteVariable( + name = 'AXIS_CONFIG_G_TSTRB_EN_C', + offset = 0x0, + bitSize = 1, + bitOffset = 1, + mode = 'RO', + base = pr.Bool, + overlapEn = True, + )) + + self.add(pr.RemoteVariable( + name = 'COMMON_CLK_G', + offset = 0x0, + bitSize = 1, + bitOffset = 0, + mode = 'RO', + base = pr.Bool, + overlapEn = True, + )) + + for i in range(numberLanes): + self.add(AxiStreamMonChannel( + name = f'Ch[{i}]', + offset = (i*0x40), + expand = True, + )) def hardReset(self): self.CntRst() @@ -188,3 +288,19 @@ def initialize(self): def countReset(self): self.CntRst() + +class AxiStreamMonitoring(AxiStreamMonAxiL): + def __init__(self, + name = "AxiStreamMonitoring", + description = "AxiStreamMonitoring Container", + numberLanes = 1, + **kwargs + ): + super().__init__( + name = name, + description = description, + numberLanes = numberLanes, + **kwargs + ) + print( f'{self.path}: AxiStreamMonitoring device is now deprecated. Please use AxiStreamMonAxiL instead' ) + \ No newline at end of file From f0212af596636bcc59dd26f5a60c879ae8feaa24 Mon Sep 17 00:00:00 2001 From: Larry Ruckman Date: Thu, 9 Jan 2020 12:02:19 -0800 Subject: [PATCH 8/8] Fixed copy+paste bug --- python/surf/axi/_AxiStreamMonAxiL.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/surf/axi/_AxiStreamMonAxiL.py b/python/surf/axi/_AxiStreamMonAxiL.py index 42eff191aa..9090126d3e 100644 --- a/python/surf/axi/_AxiStreamMonAxiL.py +++ b/python/surf/axi/_AxiStreamMonAxiL.py @@ -167,8 +167,8 @@ def convMbps(var): class AxiStreamMonAxiL(pr.Device): def __init__(self, - name = "AxiStreamMonitoring", - description = "AxiStreamMonitoring Container", + name = "AxiStreamMonAxiL", + description = "AxiStreamMonAxiL Container", numberLanes = 1, **kwargs): super().__init__(name=name, description=description, **kwargs) @@ -303,4 +303,4 @@ def __init__(self, **kwargs ) print( f'{self.path}: AxiStreamMonitoring device is now deprecated. Please use AxiStreamMonAxiL instead' ) - \ No newline at end of file +