From 2693a758811ab7d55b71cfc7347451fe5dc8cda1 Mon Sep 17 00:00:00 2001 From: Istvan-Zsolt Szekely Date: Wed, 22 Jan 2025 13:11:47 +0200 Subject: [PATCH] util_axis_fifo_asym: Updates and fixes - Extended the ADI agent with additional functions - Fixes issues with the AXIS VIP sequencer - Updated the testbench Signed-off-by: Istvan-Zsolt Szekely --- library/vip/amd/axis/adi_axis_agent.sv | 48 ++++ library/vip/amd/axis/adi_axis_monitor.sv | 22 +- library/vip/amd/axis/m_axis_sequencer.sv | 72 +++--- .../ip/util_axis_fifo_asym/environment.sv | 16 +- .../util_axis_fifo_asym/tests/test_program.sv | 3 +- .../util_axis_fifo_asym/waves/cfg_rand.wcfg | 210 ++++++------------ 6 files changed, 193 insertions(+), 178 deletions(-) diff --git a/library/vip/amd/axis/adi_axis_agent.sv b/library/vip/amd/axis/adi_axis_agent.sv index 621ff43f..3fd767db 100644 --- a/library/vip/amd/axis/adi_axis_agent.sv +++ b/library/vip/amd/axis/adi_axis_agent.sv @@ -64,6 +64,21 @@ package adi_axis_agent_pkg; this.monitor = new("Monitor", this.agent.monitor, this); endfunction: new + task start(); + this.agent.start_master(); + endtask: start + + task run(); + this.sequencer.run(); + this.monitor.run(); + endtask: run + + task stop(); + this.monitor.stop(); + this.sequencer.stop(); + this.agent.stop_master(); + endtask: stop + endclass: adi_axis_master_agent @@ -85,12 +100,28 @@ package adi_axis_agent_pkg; this.monitor = new("Monitor", this.agent.monitor, this); endfunction: new + task start(); + this.agent.start_slave(); + endtask: start + + task run(); + this.sequencer.run(); + this.monitor.run(); + endtask: run + + task stop(); + this.monitor.stop(); + this.agent.stop_slave(); + endtask: stop + endclass: adi_axis_slave_agent class adi_axis_passthrough_mem_agent #(`AXIS_VIP_PARAM_DECL(passthrough)) extends adi_agent; axi4stream_passthrough_agent #(`AXIS_VIP_IF_PARAMS(passthrough)) agent; + m_axis_sequencer #(`AXIS_VIP_PARAM_ORDER(passthrough)) master_sequencer; + s_axis_sequencer #(`AXIS_VIP_PARAM_ORDER(passthrough)) slave_sequencer; adi_axis_monitor #(`AXIS_VIP_PARAM_ORDER(passthrough)) monitor; function new( @@ -104,6 +135,23 @@ package adi_axis_agent_pkg; this.monitor = new("Monitor", this.agent.monitor, this); endfunction: new + task start(); + this.warning($sformatf("Start must called manually in the test program or environment")); + endtask: start + + task run(); + this.master_sequencer.run(); + this.slave_sequencer.run(); + this.monitor.run(); + endtask: run + + task stop(); + this.monitor.stop(); + this.master_sequencer.stop(); + this.agent.stop_slave(); + this.agent.stop_master(); + endtask: stop + endclass: adi_axis_passthrough_mem_agent endpackage diff --git a/library/vip/amd/axis/adi_axis_monitor.sv b/library/vip/amd/axis/adi_axis_monitor.sv index e2a4ba55..77b5d3a5 100644 --- a/library/vip/amd/axis/adi_axis_monitor.sv +++ b/library/vip/amd/axis/adi_axis_monitor.sv @@ -15,6 +15,7 @@ package adi_axis_monitor_pkg; adi_publisher #(logic [7:0]) publisher; protected bit enabled; + protected event enable_ev; // constructor function new( @@ -37,14 +38,27 @@ package adi_axis_monitor_pkg; return; end - fork - this.get_transaction(); - join_none - this.enabled = 1; this.info($sformatf("Monitor enabled"), ADI_VERBOSITY_MEDIUM); + + fork + begin + this.get_transaction(); + end + begin + if (this.enabled == 1) begin + @enable_ev; + end + disable fork; + end + join_none endtask: run + function void stop(); + this.enabled = 0; + -> enable_ev; + endfunction: stop + // collect data from the AXI4Strean interface of the stub, this task // handles both ONESHOT and CYCLIC scenarios task get_transaction(); diff --git a/library/vip/amd/axis/m_axis_sequencer.sv b/library/vip/amd/axis/m_axis_sequencer.sv index 8a3155ef..3cc86628 100644 --- a/library/vip/amd/axis/m_axis_sequencer.sv +++ b/library/vip/amd/axis/m_axis_sequencer.sv @@ -49,7 +49,6 @@ package m_axis_sequencer_pkg; } data_gen_mode_t; typedef enum bit [1:0] { - STOP_POLICY_IMMEDIATE = 2'h0, // disable as soon as possible STOP_POLICY_DATA_BEAT = 2'h1, // disable after the data beat has been transferred STOP_POLICY_PACKET = 2'h2, // disable after the packet has been transferred STOP_POLICY_DESCRIPTOR_QUEUE = 2'h3 // disable after the packet queue has been transferred @@ -117,21 +116,26 @@ package m_axis_sequencer_pkg; // set vif proxy to drive outputs with 0 when inactive virtual task set_inactive_drive_output_0(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endtask: set_inactive_drive_output_0 // check if ready is asserted virtual function bit check_ready_asserted(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endfunction: check_ready_asserted // wait for set amount of clock cycles virtual task wait_clk_count(input int wait_clocks); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endtask: wait_clk_count // pack the byte stream into transfers(beats) then in packets by setting the tlast virtual protected task packetize(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endtask: packetize virtual protected task sender(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endtask: sender // create transfer based on data beats per packet @@ -139,8 +143,20 @@ package m_axis_sequencer_pkg; input int data_beats_per_packet, input int gen_tlast = 1, input int gen_sync = 1); + + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); endfunction: add_xfer_descriptor_packet_size + // wait until data beat is sent + virtual task beat_sent(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); + endtask: beat_sent + + // wait until packet is sent + virtual task packet_sent(); + this.fatal($sformatf("Base class was instantiated instead of the inherited class!")); + endtask: packet_sent + // set disable policy function void set_stop_policy(input stop_policy_t stop_policy); @@ -216,16 +232,6 @@ package m_axis_sequencer_pkg; wait_clk_count(descriptor_delay); endtask: descriptor_delay_subroutine - // wait until data beat is sent - task beat_sent(); - @beat_done; - endtask: beat_sent - - // wait until packet is sent - task packet_sent(); - @packet_done; - endtask: packet_sent - // wait until queue is empty task wait_empty_descriptor_queue(); if (this.queue_empty_sig) @@ -249,13 +255,11 @@ package m_axis_sequencer_pkg; fork begin @disable_ev; - if (this.queue_empty_sig == 0) - case (stop_policy) - STOP_POLICY_DESCRIPTOR_QUEUE: @queue_empty; - STOP_POLICY_PACKET: @packet_done; - STOP_POLICY_DATA_BEAT: @beat_done; - STOP_POLICY_IMMEDIATE: ; - endcase + case (stop_policy) + STOP_POLICY_DESCRIPTOR_QUEUE: wait_empty_descriptor_queue(); + STOP_POLICY_PACKET: packet_sent(); + STOP_POLICY_DATA_BEAT: beat_sent(); + endcase end forever begin if (descriptor_q.size() > 0) begin @@ -330,6 +334,22 @@ package m_axis_sequencer_pkg; endfunction: new + // wait until data beat is sent + virtual task beat_sent(); + if (this.driver.is_driver_idle()) begin + return; + end + @beat_done; + endtask: beat_sent + + // wait until packet is sent + virtual task packet_sent(); + if (this.driver.is_driver_idle() && this.trans.get_last()) begin + return; + end + @packet_done; + endtask: packet_sent + // create transfer based on data beats per packet virtual function void add_xfer_descriptor_packet_size( input int data_beats_per_packet, @@ -443,7 +463,6 @@ package m_axis_sequencer_pkg; this.info($sformatf("waiting transfer to complete"), ADI_VERBOSITY_HIGH); @beat_done; end - ->> packet_done; endtask: packetize // packet sender function @@ -457,19 +476,20 @@ package m_axis_sequencer_pkg; fork begin @disable_ev; - if (this.queue_empty_sig == 0) - case (stop_policy) - STOP_POLICY_DESCRIPTOR_QUEUE: @queue_empty; - STOP_POLICY_PACKET: @packet_done; - STOP_POLICY_DATA_BEAT: @beat_done; - STOP_POLICY_IMMEDIATE: ; - endcase + case (stop_policy) + STOP_POLICY_DESCRIPTOR_QUEUE: wait_empty_descriptor_queue(); + STOP_POLICY_PACKET: packet_sent(); + STOP_POLICY_DATA_BEAT: beat_sent(); + endcase end forever begin @data_av_ev; this.info($sformatf("sending axis transaction"), ADI_VERBOSITY_HIGH); this.driver.send(trans); ->> beat_done; + if (this.trans.get_last()) begin + ->> packet_done; + end end join_any disable fork; diff --git a/testbenches/ip/util_axis_fifo_asym/environment.sv b/testbenches/ip/util_axis_fifo_asym/environment.sv index cff284f7..3c5d6372 100644 --- a/testbenches/ip/util_axis_fifo_asym/environment.sv +++ b/testbenches/ip/util_axis_fifo_asym/environment.sv @@ -78,8 +78,8 @@ package environment_pkg; this.input_clk_vip_if.start_clock(); this.output_clk_vip_if.start_clock(); - this.input_axis_agent.agent.start_master(); - this.output_axis_agent.agent.start_slave(); + this.input_axis_agent.start(); + this.output_axis_agent.start(); this.input_axis_agent.monitor.publisher.subscribe(this.scoreboard_inst.subscriber_source); this.output_axis_agent.monitor.publisher.subscribe(this.scoreboard_inst.subscriber_sink); @@ -90,11 +90,8 @@ package environment_pkg; //============================================================================ task run(); fork - this.input_axis_agent.sequencer.run(); - this.output_axis_agent.sequencer.run(); - - this.input_axis_agent.monitor.run(); - this.output_axis_agent.monitor.run(); + this.input_axis_agent.run(); + this.output_axis_agent.run(); this.scoreboard_inst.run(); join_none @@ -104,9 +101,8 @@ package environment_pkg; // Stop subroutine //============================================================================ task stop(); - this.input_axis_agent.sequencer.stop(); - this.input_axis_agent.agent.stop_master(); - this.output_axis_agent.agent.stop_slave(); + this.input_axis_agent.stop(); + this.output_axis_agent.stop(); endtask endclass diff --git a/testbenches/ip/util_axis_fifo_asym/tests/test_program.sv b/testbenches/ip/util_axis_fifo_asym/tests/test_program.sv index 8608bb06..a2fc7226 100644 --- a/testbenches/ip/util_axis_fifo_asym/tests/test_program.sv +++ b/testbenches/ip/util_axis_fifo_asym/tests/test_program.sv @@ -109,8 +109,7 @@ program test_program (); #($urandom_range(1,10)*1us); uaf_env.input_axis_agent.sequencer.clear_descriptor_queue(); - - #1us; + uaf_env.input_axis_agent.sequencer.wait_empty_descriptor_queue(); uaf_env.scoreboard_inst.wait_until_complete(); diff --git a/testbenches/ip/util_axis_fifo_asym/waves/cfg_rand.wcfg b/testbenches/ip/util_axis_fifo_asym/waves/cfg_rand.wcfg index 235e962d..d6014f4b 100644 --- a/testbenches/ip/util_axis_fifo_asym/waves/cfg_rand.wcfg +++ b/testbenches/ip/util_axis_fifo_asym/waves/cfg_rand.wcfg @@ -6,6 +6,11 @@ + + + + + @@ -14,34 +19,30 @@ - + - - - - - + - - - + + + - - + + - + m_axis_aclk m_axis_aclk @@ -118,20 +119,20 @@ s_axis_valid - s_axis_data[63:0] - s_axis_data[63:0] + s_axis_data[127:0] + s_axis_data[127:0] - s_axis_tkeep[7:0] - s_axis_tkeep[7:0] + s_axis_tkeep[15:0] + s_axis_tkeep[15:0] s_axis_tlast s_axis_tlast - s_axis_room[4:0] - s_axis_room[4:0] + s_axis_room[2:0] + s_axis_room[2:0] s_axis_full @@ -145,61 +146,21 @@ Blk1 label - - s_axis_aclk - s_axis_aclk - - - s_axis_aresetn - s_axis_aresetn - - - s_axis_ready - s_axis_ready - - - s_axis_valid - s_axis_valid - - - s_axis_data[63:0] - s_axis_data[63:0] - - - s_axis_tkeep[7:0] - s_axis_tkeep[7:0] - - - s_axis_tlast - s_axis_tlast - - - s_axis_room[4:0] - s_axis_room[4:0] - - - s_axis_full - s_axis_full - - - s_axis_almost_full - s_axis_almost_full - Higher label - s_axis_counter[0:0] - s_axis_counter[0:0] + s_axis_counter[-1:0] + s_axis_counter[-1:0] - s_axis_ready_int_s[1:0] - s_axis_ready_int_s[1:0] + s_axis_ready_int_s[0:0] + s_axis_ready_int_s[0:0] - s_axis_valid_int_s[1:0] - s_axis_valid_int_s[1:0] + s_axis_valid_int_s[0:0] + s_axis_valid_int_s[0:0] s_axis_data_int_s[127:0] @@ -210,24 +171,20 @@ s_axis_tkeep_int_s[15:0] - s_axis_tlast_int_s[1:0] - s_axis_tlast_int_s[1:0] + s_axis_tlast_int_s[0:0] + s_axis_tlast_int_s[0:0] - s_axis_full_int_s[1:0] - s_axis_full_int_s[1:0] + s_axis_full_int_s[0:0] + s_axis_full_int_s[0:0] - s_axis_almost_full_int_s[1:0] - s_axis_almost_full_int_s[1:0] + s_axis_almost_full_int_s[0:0] + s_axis_almost_full_int_s[0:0] - s_axis_room_int_s[9:0] - s_axis_room_int_s[9:0] - - - \small_slave.s_axis_valid_int_d [1:0] - \small_slave.s_axis_valid_int_d [1:0] + s_axis_room_int_s[2:0] + s_axis_room_int_s[2:0] @@ -258,20 +215,20 @@ m_axis_valid - m_axis_data[63:0] - m_axis_data[63:0] + m_axis_data[127:0] + m_axis_data[127:0] - m_axis_tkeep[7:0] - m_axis_tkeep[7:0] + m_axis_tkeep[15:0] + m_axis_tkeep[15:0] m_axis_tlast m_axis_tlast - m_axis_level[4:0] - m_axis_level[4:0] + m_axis_level[2:0] + m_axis_level[2:0] m_axis_empty @@ -285,61 +242,21 @@ Blk1 label - - m_axis_aclk - m_axis_aclk - - - m_axis_aresetn - m_axis_aresetn - - - m_axis_ready - m_axis_ready - - - m_axis_valid - m_axis_valid - - - m_axis_data[63:0] - m_axis_data[63:0] - - - m_axis_tkeep[7:0] - m_axis_tkeep[7:0] - - - m_axis_tlast - m_axis_tlast - - - m_axis_level[4:0] - m_axis_level[4:0] - - - m_axis_empty - m_axis_empty - - - m_axis_almost_empty - m_axis_almost_empty - Higher label - m_axis_counter[0:0] - m_axis_counter[0:0] + m_axis_counter[-1:0] + m_axis_counter[-1:0] - m_axis_ready_int_s[1:0] - m_axis_ready_int_s[1:0] + m_axis_ready_int_s[0:0] + m_axis_ready_int_s[0:0] - m_axis_valid_int_s[1:0] - m_axis_valid_int_s[1:0] + m_axis_valid_int_s[0:0] + m_axis_valid_int_s[0:0] m_axis_data_int_s[127:0] @@ -350,20 +267,41 @@ m_axis_tkeep_int_s[15:0] - m_axis_tlast_int_s[1:0] - m_axis_tlast_int_s[1:0] + m_axis_tlast_int_s[0:0] + m_axis_tlast_int_s[0:0] - m_axis_empty_int_s[1:0] - m_axis_empty_int_s[1:0] + m_axis_empty_int_s[0:0] + m_axis_empty_int_s[0:0] - m_axis_almost_empty_int_s[1:0] - m_axis_almost_empty_int_s[1:0] + m_axis_almost_empty_int_s[0:0] + m_axis_almost_empty_int_s[0:0] - m_axis_level_int_s[9:0] - m_axis_level_int_s[9:0] + m_axis_level_int_s[2:0] + m_axis_level_int_s[2:0] + + true + STYLE_ENUM_TRANSACTION + fff,fff=blank + true + #00E600 + /system_tb/test_harness/util_axis_fifo_asym_DUT/s_axis.streamWaveData + 2 + /system_tb/test_harness/util_axis_fifo_asym_DUT/s_axis.linkStarve + #99E600 + /system_tb/test_harness/util_axis_fifo_asym_DUT/s_axis.linkStall + #E64C00 + /system_tb/test_harness/util_axis_fifo_asym_DUT/s_axis.streamTooltipData + s_axis + s_axis + + + + m_axis + m_axis +