Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions library/drivers/common/scoreboard.sv
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ package scoreboard_pkg;

virtual function void update(input data_type data [$]);
this.info($sformatf("Data received: %d", data.size()), ADI_VERBOSITY_MEDIUM);
while (data.size()) begin
this.byte_stream.push_back(data.pop_front());
end

if (this.scoreboard_ref.get_enabled()) begin
while (data.size()) begin
this.byte_stream.push_back(data.pop_front());
end

this.scoreboard_ref.compare_transaction();
end
endfunction: update
Expand Down Expand Up @@ -168,12 +169,13 @@ package scoreboard_pkg;
data_type source_byte;
data_type sink_byte;

this.byte_streams_empty_sig = 0;

if (this.enabled == 0)
return;

while ((this.subscriber_source.get_size() > 0) &&
(this.subscriber_sink.get_size() > 0)) begin
byte_streams_empty_sig = 0;
source_byte = this.subscriber_source.get_data();
if (this.sink_type == CYCLIC)
this.subscriber_source.put_data(source_byte);
Expand Down
3 changes: 2 additions & 1 deletion library/drivers/common/scoreboard_pack.sv
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ package scoreboard_pack_pkg;
int outer_loop = (this.mode == CPACK) ? this.channels : this.samples;
int inner_loop = (this.mode == CPACK) ? this.samples : this.channels;

this.byte_streams_empty_sig = 0;

if (this.enabled == 0)
return;

while ((this.subscriber_source.get_size() > 0) &&
(this.subscriber_sink.get_size() >= this.channels*this.samples*this.width/8)) begin
byte_streams_empty_sig = 0;
for (int i=0; i<this.channels*this.samples*this.width/8; i++) begin
sink_byte_stream_block[i] = this.subscriber_sink.get_data();
end
Expand Down
1 change: 1 addition & 0 deletions library/includes/Makeinclude_axi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
####################################################################################

# All test-bench dependencies except test programs
SV_DEPS += $(TB_LIBRARY_PATH)/vip/vip_agent_typedef_pkg.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axi/adi_axi_agent.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axi/m_axi_sequencer.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axi/s_axi_sequencer.sv
Expand Down
1 change: 1 addition & 0 deletions library/includes/Makeinclude_axis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
####################################################################################

# All test-bench dependencies except test programs
SV_DEPS += $(TB_LIBRARY_PATH)/vip/vip_agent_typedef_pkg.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axis/adi_axis_agent.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axis/m_axis_sequencer.sv
SV_DEPS += $(TB_LIBRARY_PATH)/vip/amd/axis/s_axis_sequencer.sv
Expand Down
1 change: 1 addition & 0 deletions library/includes/sp_include_axi.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

# Add test files to the project
adi_sim_project_files [list \
"$ad_tb_dir/library/vip/vip_agent_typedef_pkg.sv" \
"$ad_tb_dir/library/vip/amd/axi/adi_axi_agent.sv" \
"$ad_tb_dir/library/vip/amd/axi/m_axi_sequencer.sv" \
"$ad_tb_dir/library/vip/amd/axi/s_axi_sequencer.sv" \
Expand Down
1 change: 1 addition & 0 deletions library/includes/sp_include_axis.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

# Add test files to the project
adi_sim_project_files [list \
"$ad_tb_dir/library/vip/vip_agent_typedef_pkg.sv" \
"$ad_tb_dir/library/vip/amd/axis/adi_axis_agent.sv" \
"$ad_tb_dir/library/vip/amd/axis/m_axis_sequencer.sv" \
"$ad_tb_dir/library/vip/amd/axis/s_axis_sequencer.sv" \
Expand Down
10 changes: 5 additions & 5 deletions library/utilities/test_harness_env.sv
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ package test_harness_env_pkg;
import watchdog_pkg::*;


class test_harness_env #(int `AXI_VIP_PARAM_ORDER(mng), int `AXI_VIP_PARAM_ORDER(ddr)) extends adi_environment;
class test_harness_env #(`AXI_VIP_PARAM_DECL(mng), `AXI_VIP_PARAM_DECL(ddr)) extends adi_environment;

// Agents
adi_axi_master_agent #(`AXI_VIP_PARAM_ORDER(mng)) mng;
Expand Down Expand Up @@ -95,8 +95,8 @@ package test_harness_env_pkg;
task start();
this.simulation_watchdog.start();

this.mng.agent.start_master();
this.ddr.agent.start_slave();
this.mng.start_master();
this.ddr.start_slave();

this.sys_clk_vip_if.start_clock();
this.dma_clk_vip_if.start_clock();
Expand All @@ -107,8 +107,8 @@ package test_harness_env_pkg;
// Stop subroutine
//============================================================================
task stop();
this.mng.agent.stop_master();
this.ddr.agent.stop_slave();
this.mng.stop_master();
this.ddr.stop_slave();

this.sys_clk_vip_if.stop_clock();
this.dma_clk_vip_if.stop_clock();
Expand Down
6 changes: 6 additions & 0 deletions library/utilities/utils.svh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
// Help build VIP parameter name e.g. test_harness_dst_axis_vip_0_VIP_DATA_WIDTH
`define GETPARAM(th,vip,param) th``_``vip``_0_``param

// Help link AMD AXI and AXIS VIPs to ADI Environment VIPs
`define LINK(top,env,inst) \
top``.pre_link_agent(``env``.``inst``); \
env``.``inst`` = ``top``; \
top``.post_link_agent(``env``.``inst``);

// Macros used in Simulation files during simulation
`define INFO(m,v) \
PrintInfo($sformatf("%s", \
Expand Down
184 changes: 146 additions & 38 deletions library/vip/amd/axi/adi_axi_agent.sv
Original file line number Diff line number Diff line change
Expand Up @@ -45,77 +45,152 @@ package adi_axi_agent_pkg;
import m_axi_sequencer_pkg::*;
import s_axi_sequencer_pkg::*;
import adi_axi_monitor_pkg::*;
import vip_agent_typedef_pkg::*;

class adi_axi_agent_base extends adi_agent;

class adi_axi_master_agent #(int `AXI_VIP_PARAM_ORDER(master)) extends adi_agent;
m_axi_sequencer_base master_sequencer;
s_axi_sequencer_base slave_sequencer;
adi_axi_monitor_base monitor;

local agent_typedef agent_type;

function new(
input string name,
input agent_typedef agent_type,
input adi_environment parent = null);

super.new(name, parent);

this.agent_type = agent_type;
endfunction: new

virtual task start_master();
if (agent_type == SLAVE) begin
this.fatal($sformatf("Agent is in slave mode!"));
end
endtask: start_master

virtual task start_slave();
if (agent_type == MASTER) begin
this.fatal($sformatf("Agent is in master mode!"));
end
endtask: start_slave

virtual task start_monitor();
if (agent_type != PASSTHROUGH) begin
this.fatal($sformatf("Agent is not in passthrough mode!"));
end
endtask: start_monitor

virtual task stop_master();
if (agent_type == SLAVE) begin
this.fatal($sformatf("Agent is in slave mode!"));
end
endtask: stop_master

virtual task stop_slave();
if (agent_type == MASTER) begin
this.fatal($sformatf("Agent is in master mode!"));
end
endtask: stop_slave

virtual task stop_monitor();
if (agent_type != PASSTHROUGH) begin
this.fatal($sformatf("Agent is not in passthrough mode!"));
end
endtask: stop_monitor

endclass: adi_axi_agent_base


class adi_axi_master_agent #(int `AXI_VIP_PARAM_ORDER(master)) extends adi_axi_agent_base;

axi_mst_agent #(`AXI_VIP_PARAM_ORDER(master)) agent;
m_axi_sequencer #(`AXI_VIP_PARAM_ORDER(master)) sequencer;
m_axi_sequencer #(`AXI_VIP_PARAM_ORDER(master)) master_sequencer;
adi_axi_monitor #(`AXI_VIP_PARAM_ORDER(master)) monitor;

function new(
input string name,
virtual interface axi_vip_if #(`AXI_VIP_IF_PARAMS(master)) master_vip_if,
input adi_environment parent = null);

super.new(name, parent);
super.new(name, MASTER, parent);

this.agent = new("Agent", master_vip_if);
this.sequencer = new("Sequencer", this.agent.wr_driver, this.agent.rd_driver, this);
this.master_sequencer = new("Master Sequencer", this.agent.wr_driver, this.agent.rd_driver, this);
this.monitor = new("Monitor TX", this.agent.monitor, this);
endfunction: new

task start();
this.agent.start_master();
endtask: start
function void pre_link_agent(adi_axi_agent_base adi_axi_agent);
this.name = adi_axi_agent.name;
this.parent = adi_axi_agent.parent;
endfunction: pre_link_agent

task run();
this.monitor.run();
endtask: run
function void post_link_agent(adi_axi_agent_base adi_axi_agent);
adi_axi_agent.master_sequencer = this.master_sequencer;
adi_axi_agent.monitor = this.monitor;
endfunction: post_link_agent

task stop();
this.monitor.stop();
virtual task start_master();
super.start_master();
this.agent.start_master();
this.monitor.start();
endtask: start_master

virtual task stop_master();
super.stop_master();
this.agent.stop_master();
endtask: stop
this.monitor.stop();
endtask: stop_master

endclass: adi_axi_master_agent


class adi_axi_slave_mem_agent #(int `AXI_VIP_PARAM_ORDER(slave)) extends adi_agent;
class adi_axi_slave_mem_agent #(int `AXI_VIP_PARAM_ORDER(slave)) extends adi_axi_agent_base;

axi_slv_mem_agent #(`AXI_VIP_PARAM_ORDER(slave)) agent;
s_axi_sequencer #(`AXI_VIP_PARAM_ORDER(slave)) sequencer;
s_axi_sequencer #(`AXI_VIP_PARAM_ORDER(slave)) slave_sequencer;
adi_axi_monitor #(`AXI_VIP_PARAM_ORDER(slave)) monitor;

function new(
input string name,
virtual interface axi_vip_if #(`AXI_VIP_IF_PARAMS(slave)) slave_vip_if,
input adi_environment parent = null);

super.new(name, parent);
super.new(name, SLAVE, parent);

this.agent = new("Agent", slave_vip_if);
this.sequencer = new("Sequencer", this.agent.mem_model, this);
this.slave_sequencer = new("Slave Sequencer", this.agent.mem_model, this);
this.monitor = new("Monitor TX", this.agent.monitor, this);
endfunction: new

task start();
this.agent.start_slave();
endtask: start
function void pre_link_agent(adi_axi_agent_base adi_axi_agent);
this.name = adi_axi_agent.name;
this.parent = adi_axi_agent.parent;
endfunction: pre_link_agent

task run();
this.monitor.run();
endtask: run
function void post_link_agent(adi_axi_agent_base adi_axi_agent);
adi_axi_agent.slave_sequencer = this.slave_sequencer;
adi_axi_agent.monitor = this.monitor;
endfunction: post_link_agent

task stop();
this.monitor.stop();
virtual task start_slave();
super.start_slave();
this.agent.start_slave();
this.monitor.start();
endtask: start_slave

virtual task stop_slave();
super.stop_slave();
this.agent.stop_slave();
endtask: stop
this.monitor.stop();
endtask: stop_slave

endclass: adi_axi_slave_mem_agent


class adi_axi_passthrough_mem_agent #(int `AXI_VIP_PARAM_ORDER(passthrough)) extends adi_agent;
class adi_axi_passthrough_mem_agent #(int `AXI_VIP_PARAM_ORDER(passthrough)) extends adi_axi_agent_base;

axi_passthrough_mem_agent #(`AXI_VIP_PARAM_ORDER(passthrough)) agent;
m_axi_sequencer #(`AXI_VIP_PARAM_ORDER(passthrough)) master_sequencer;
Expand All @@ -127,27 +202,60 @@ package adi_axi_agent_pkg;
virtual interface axi_vip_if #(`AXI_VIP_IF_PARAMS(passthrough)) passthrough_vip_if,
input adi_environment parent = null);

super.new(name, parent);
super.new(name, PASSTHROUGH, parent);

this.agent = new("Agent", passthrough_vip_if);
this.master_sequencer = new("Slave Sequencer", this.agent.mst_wr_driver, this.agent.mst_rd_driver, this);
this.master_sequencer = new("Master Sequencer", this.agent.mst_wr_driver, this.agent.mst_rd_driver, this);
this.slave_sequencer = new("Slave Sequencer", this.agent.mem_model, this);
this.monitor = new("Monitor TX", this.agent.monitor, this);
endfunction: new

task start();
this.warning($sformatf("Start must called manually in the test program or environment"));
endtask: start
function void pre_link_agent(adi_axi_agent_base adi_axi_agent);
this.name = adi_axi_agent.name;
this.parent = adi_axi_agent.parent;
endfunction: pre_link_agent

task run();
this.monitor.run();
endtask: run
function void post_link_agent(adi_axi_agent_base adi_axi_agent);
adi_axi_agent.master_sequencer = this.master_sequencer;
adi_axi_agent.slave_sequencer = this.slave_sequencer;
adi_axi_agent.monitor = this.monitor;
endfunction: post_link_agent

task stop();
virtual task start_master();
super.start_master();
this.agent.start_master();
this.monitor.start();
endtask: start_master

virtual task start_slave();
super.start_slave();
this.agent.start_slave();
this.monitor.start();
endtask: start_slave

virtual task start_monitor();
super.start_monitor();
this.agent.start_monitor();
this.monitor.start();
endtask: start_monitor

virtual task stop_master();
super.stop_master();
this.agent.stop_master();
this.monitor.stop();
endtask: stop_master

virtual task stop_slave();
super.stop_slave();
this.agent.stop_slave();
this.agent.stop_master();
endtask: stop
this.monitor.stop();
endtask: stop_slave

virtual task stop_monitor();
super.stop_monitor();
this.agent.stop_monitor();
this.monitor.stop();
endtask: stop_monitor

endclass: adi_axi_passthrough_mem_agent

Expand Down
Loading