Skip to content

Commit

Permalink
logger: Fixed dma_flock (#142)
Browse files Browse the repository at this point in the history
Signed-off-by: Istvan-Zsolt Szekely <[email protected]>
  • Loading branch information
IstvanZsSzekely authored Dec 10, 2024
1 parent 08af958 commit a099338
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
11 changes: 7 additions & 4 deletions testbenches/ip/dma_flock/environment.sv
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ package environment_pkg;
// Constructor
//============================================================================
function new(
input string name,

virtual interface clk_vip_if #(.C_CLK_CLOCK_PERIOD(10)) sys_clk_vip_if,
virtual interface clk_vip_if #(.C_CLK_CLOCK_PERIOD(5)) dma_clk_vip_if,
virtual interface clk_vip_if #(.C_CLK_CLOCK_PERIOD(2.5)) ddr_clk_vip_if,
Expand All @@ -83,7 +85,8 @@ package environment_pkg;
virtual interface axi4stream_vip_if #(`AXIS_VIP_IF_PARAMS(test_harness, src_axis_vip)) src_axis_vip_if,
virtual interface axi4stream_vip_if #(`AXIS_VIP_IF_PARAMS(test_harness, dst_axis_vip)) dst_axis_vip_if
);
super.new(sys_clk_vip_if,
super.new(name,
sys_clk_vip_if,
dma_clk_vip_if,
ddr_clk_vip_if,
sys_rst_vip_if,
Expand All @@ -95,10 +98,10 @@ package environment_pkg;
dst_axis_agent = new("Dest AXI stream agent", dst_axis_vip_if);

// Creating the sequencers
src_axis_seq = new(src_axis_agent);
dst_axis_seq = new(dst_axis_agent);
src_axis_seq = new("Src AXI stream sequencer", src_axis_agent, this);
dst_axis_seq = new("Dest AXI stream sequencer", dst_axis_agent, this);

scrb = new;
scrb = new("Scoreboard", this);

endfunction

Expand Down
16 changes: 10 additions & 6 deletions testbenches/ip/dma_flock/scoreboard.sv
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ package scoreboard_pkg;
import axi_vip_pkg::*;
import logger_pkg::*;

class scoreboard;
class scoreboard extends adi_component;
// List of analysis ports from the monitors
xil_analysis_port #(axi4stream_monitor_transaction) src_axis_ap;
xil_analysis_port #(axi4stream_monitor_transaction) dst_axis_ap;

protected event shutdown_event;

function new();
function new(
input string name,
input adi_component parent = null);

super.new(name, parent);
endfunction: new

function void connect(
Expand Down Expand Up @@ -99,9 +103,9 @@ package scoreboard_pkg;
if (received_tuser == 1) begin
frame_count = data_beat[7:0];
if (frame_count < prev_frame_count)
`ERROR(("Frame count out of order. Expected at least: 0x%h ; Found : 0x%h", prev_frame_count, frame_count));
this.error($sformatf("Frame count out of order. Expected at least: 0x%h ; Found : 0x%h", prev_frame_count, frame_count));
else
`INFO(("Received frame 0x%0h ", frame_count));
this.info($sformatf("Received frame 0x%0h ", frame_count), ADI_VERBOSITY_MEDIUM);
prev_frame_count = frame_count;
end
// Compare data against the frame counter; all pixels from frame
Expand All @@ -110,9 +114,9 @@ package scoreboard_pkg;
expected_byte = frame_count;
received_byte = data_beat[i*8+:8];
if (expected_byte !== received_byte)
`ERROR(("Data mismatch. Expected : 0x%h ; Found : 0x%h", expected_byte, received_byte));
this.error($sformatf("Data mismatch. Expected : 0x%h ; Found : 0x%h", expected_byte, received_byte));
else
`INFOV(("Received byte 0x%h ", received_byte), 99);
this.info($sformatf("Received byte 0x%h ", received_byte), ADI_VERBOSITY_MEDIUM);
end
end
endtask : run_dst
Expand Down
9 changes: 5 additions & 4 deletions testbenches/ip/dma_flock/tests/test_program.sv
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ program test_program;

initial begin
//creating environment
env = new(`TH.`SYS_CLK.inst.IF,
env = new("DMA Flock environment",
`TH.`SYS_CLK.inst.IF,
`TH.`DMA_CLK.inst.IF,
`TH.`DDR_CLK.inst.IF,
`TH.`SYS_RST.inst.IF,
Expand All @@ -73,7 +74,7 @@ program test_program;
has_sfsync = `M_DMA_CFG_USE_EXT_SYNC;
has_dfsync = `S_DMA_CFG_USE_EXT_SYNC;

setLoggerVerbosity(6);
setLoggerVerbosity(ADI_VERBOSITY_NONE);
env.start();
start_clocks();
env.sys_reset();
Expand Down Expand Up @@ -117,7 +118,7 @@ program test_program;
stop_clocks();
env.stop();

`INFO(("Testbench done!"));
`INFO(("Testbench done!"), ADI_VERBOSITY_NONE);
$finish();

end
Expand Down Expand Up @@ -150,7 +151,7 @@ program test_program;
length == 1024;
ylength == 8;
dst_stride == length; };
if (rand_succ == 0) `ERROR(("randomization failed"));
if (rand_succ == 0) `FATAL(("randomization failed"));

m_seg.flock_framenum = flock_framenum;
m_seg.flock_distance = flock_distance;
Expand Down
7 changes: 4 additions & 3 deletions testbenches/ip/dma_flock/tests/test_program_frame_delay.sv
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ program test_program_frame_delay;

initial begin
//creating environment
env = new(`TH.`SYS_CLK.inst.IF,
env = new("DMA Flock environment",
`TH.`SYS_CLK.inst.IF,
`TH.`DMA_CLK.inst.IF,
`TH.`DDR_CLK.inst.IF,
`TH.`SYS_RST.inst.IF,
Expand All @@ -77,7 +78,7 @@ program test_program_frame_delay;
has_m_autorun = `M_DMA_CFG_AUTORUN;
has_s_autorun = `S_DMA_CFG_AUTORUN;

setLoggerVerbosity(6);
setLoggerVerbosity(ADI_VERBOSITY_NONE);
env.start();
start_clocks();
env.sys_reset();
Expand Down Expand Up @@ -146,7 +147,7 @@ program test_program_frame_delay;
stop_clocks();
env.stop();

`INFO(("Testbench done!"));
`INFO(("Testbench done!"), ADI_VERBOSITY_NONE);
$finish();

end
Expand Down

0 comments on commit a099338

Please sign in to comment.