unification of the testbench
This commit is contained in:
@@ -7,7 +7,7 @@ module tb_accumulator_top;
|
|||||||
localparam RW_WIDTH = 32;
|
localparam RW_WIDTH = 32;
|
||||||
localparam N_MAX = 4096;
|
localparam N_MAX = 4096;
|
||||||
localparam MAX_WINDOW_SIZE = 65;
|
localparam MAX_WINDOW_SIZE = 65;
|
||||||
localparam PACKET_SIZE = 32;
|
localparam PACKET_SIZE = 64;
|
||||||
localparam READ_BATCH_SIZE = (PACKET_SIZE*8)/ACCUM_WIDTH;
|
localparam READ_BATCH_SIZE = (PACKET_SIZE*8)/ACCUM_WIDTH;
|
||||||
localparam MAX_WORDS = N_MAX;
|
localparam MAX_WORDS = N_MAX;
|
||||||
localparam MAX_SEQ_NUM = 256;
|
localparam MAX_SEQ_NUM = 256;
|
||||||
@@ -29,8 +29,7 @@ module tb_accumulator_top;
|
|||||||
logic [15:0] seq_num;
|
logic [15:0] seq_num;
|
||||||
logic [31:0] window_size;
|
logic [31:0] window_size;
|
||||||
|
|
||||||
logic req_ready;
|
logic accum_done;
|
||||||
wire send_req;
|
|
||||||
|
|
||||||
wire [RW_WIDTH-1:0] m_axis_tdata;
|
wire [RW_WIDTH-1:0] m_axis_tdata;
|
||||||
wire m_axis_tvalid;
|
wire m_axis_tvalid;
|
||||||
@@ -69,14 +68,14 @@ module tb_accumulator_top;
|
|||||||
.smp_num(smp_num),
|
.smp_num(smp_num),
|
||||||
.seq_num(seq_num),
|
.seq_num(seq_num),
|
||||||
.window_size(window_size),
|
.window_size(window_size),
|
||||||
.eth_clk_in(eth_clk_in),
|
.dma_clk_in(eth_clk_in),
|
||||||
.req_ready(1'b1),
|
.req_ready(1'b1),
|
||||||
.send_req(send_req),
|
|
||||||
.m_axis_tdata(m_axis_tdata),
|
.m_axis_tdata(m_axis_tdata),
|
||||||
.m_axis_tvalid(m_axis_tvalid),
|
.m_axis_tvalid(m_axis_tvalid),
|
||||||
.m_axis_tready(m_axis_tready),
|
.m_axis_tready(m_axis_tready),
|
||||||
.m_axis_tlast(m_axis_tlast),
|
.m_axis_tlast(m_axis_tlast),
|
||||||
.finish(finish)
|
.finish(finish),
|
||||||
|
.accum_done(accum_done)
|
||||||
);
|
);
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
@@ -114,7 +113,6 @@ module tb_accumulator_top;
|
|||||||
smp_num = '0;
|
smp_num = '0;
|
||||||
seq_num = '0;
|
seq_num = '0;
|
||||||
window_size = 32'd1;
|
window_size = 32'd1;
|
||||||
req_ready = 1'b0;
|
|
||||||
m_axis_tready = 1'b1;
|
m_axis_tready = 1'b1;
|
||||||
clear_scoreboard();
|
clear_scoreboard();
|
||||||
|
|
||||||
@@ -192,7 +190,6 @@ module tb_accumulator_top;
|
|||||||
smp_num = smp_num_i;
|
smp_num = smp_num_i;
|
||||||
seq_num = seq_num_i;
|
seq_num = seq_num_i;
|
||||||
window_size = window_size_i;
|
window_size = window_size_i;
|
||||||
req_ready = 1'b1; // ïðèåìíèê ãîòîâ çàðàíåå
|
|
||||||
|
|
||||||
exp_word_count = smp_num_i / window_size_i;
|
exp_word_count = smp_num_i / window_size_i;
|
||||||
exp_packet_count = (exp_word_count + READ_BATCH_SIZE - 1) / READ_BATCH_SIZE;
|
exp_packet_count = (exp_word_count + READ_BATCH_SIZE - 1) / READ_BATCH_SIZE;
|
||||||
@@ -274,43 +271,70 @@ module tb_accumulator_top;
|
|||||||
$display("TEST %0d FAILED: %0s", test_id, test_name);
|
$display("TEST %0d FAILED: %0s", test_id, test_name);
|
||||||
end
|
end
|
||||||
|
|
||||||
req_ready = 1'b0;
|
|
||||||
repeat(10) @(posedge clk_in);
|
repeat(10) @(posedge clk_in);
|
||||||
end
|
end
|
||||||
endtask
|
endtask
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
localparam int PACK_RATIO = ACCUM_WIDTH / RW_WIDTH;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
if (ACCUM_WIDTH % RW_WIDTH != 0)
|
||||||
|
$fatal("ACCUM_WIDTH (%0d) must be multiple of RW_WIDTH (%0d)",
|
||||||
|
ACCUM_WIDTH, RW_WIDTH);
|
||||||
|
end
|
||||||
|
|
||||||
always @(posedge eth_clk_in) begin : CAPTURE_AXIS
|
always @(posedge eth_clk_in) begin : CAPTURE_AXIS
|
||||||
|
integer idx;
|
||||||
|
integer b;
|
||||||
|
logic [ACCUM_WIDTH-1:0] tmp_le;
|
||||||
|
logic [ACCUM_WIDTH-1:0] tmp_be;
|
||||||
|
|
||||||
if (rst) begin
|
if (rst) begin
|
||||||
current_packet_word_count <= 0;
|
current_packet_word_count = 0;
|
||||||
total_words_captured <= 0;
|
|
||||||
end
|
end
|
||||||
else if (m_axis_tvalid && m_axis_tready) begin
|
else if (m_axis_tvalid && m_axis_tready) begin
|
||||||
|
|
||||||
// Ñîõðàíÿåì î÷åðåäíîå ñëîâî
|
if (current_packet_word_count < PACKET_RD_WORDS)
|
||||||
if (total_words_captured < MAX_WORDS) begin
|
packet_bytes[current_packet_word_count] = m_axis_tdata;
|
||||||
captured_words_le[total_words_captured] <= m_axis_tdata;
|
|
||||||
captured_words_be[total_words_captured] <= {
|
|
||||||
m_axis_tdata[7:0],
|
|
||||||
m_axis_tdata[15:8],
|
|
||||||
m_axis_tdata[23:16],
|
|
||||||
m_axis_tdata[31:24]
|
|
||||||
};
|
|
||||||
end
|
|
||||||
|
|
||||||
total_words_captured <= total_words_captured + 1;
|
current_packet_word_count = current_packet_word_count + 1;
|
||||||
current_packet_word_count <= current_packet_word_count + 1;
|
|
||||||
|
|
||||||
if (m_axis_tlast) begin
|
if (m_axis_tlast) begin
|
||||||
packets_seen <= packets_seen + 1;
|
|
||||||
|
|
||||||
if (current_packet_word_count + 1 != PACKET_RD_WORDS) begin
|
packets_seen = packets_seen + 1;
|
||||||
|
|
||||||
|
if (current_packet_word_count != PACKET_RD_WORDS) begin
|
||||||
$display("[packet] ERROR: packet size=%0d expected=%0d",
|
$display("[packet] ERROR: packet size=%0d expected=%0d",
|
||||||
current_packet_word_count + 1,
|
current_packet_word_count,
|
||||||
PACKET_RD_WORDS);
|
PACKET_RD_WORDS);
|
||||||
total_errors <= total_errors + 1;
|
total_errors = total_errors + 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
current_packet_word_count <= 0;
|
for (idx = 0; idx < READ_BATCH_SIZE; idx = idx + 1) begin
|
||||||
|
|
||||||
|
tmp_le = '0;
|
||||||
|
tmp_be = '0;
|
||||||
|
|
||||||
|
for (b = 0; b < PACK_RATIO; b = b + 1) begin
|
||||||
|
|
||||||
|
// Little Endian
|
||||||
|
tmp_le[b*RW_WIDTH +: RW_WIDTH] =
|
||||||
|
packet_bytes[idx*PACK_RATIO + b];
|
||||||
|
|
||||||
|
// Big Endian
|
||||||
|
tmp_be[(PACK_RATIO-1-b)*RW_WIDTH +: RW_WIDTH] =
|
||||||
|
packet_bytes[idx*PACK_RATIO + b];
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if (total_words_captured + idx < MAX_WORDS) begin
|
||||||
|
captured_words_le[total_words_captured + idx] = tmp_le;
|
||||||
|
captured_words_be[total_words_captured + idx] = tmp_be;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
total_words_captured = total_words_captured + READ_BATCH_SIZE;
|
||||||
|
current_packet_word_count = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,15 +11,15 @@
|
|||||||
</db_ref>
|
</db_ref>
|
||||||
</db_ref_list>
|
</db_ref_list>
|
||||||
<zoom_setting>
|
<zoom_setting>
|
||||||
<ZoomStartTime time="0.000 ns"></ZoomStartTime>
|
<ZoomStartTime time="876,743.000 ns"></ZoomStartTime>
|
||||||
<ZoomEndTime time="2,960.001 ns"></ZoomEndTime>
|
<ZoomEndTime time="876,817.401 ns"></ZoomEndTime>
|
||||||
<Cursor1Time time="300.000 ns"></Cursor1Time>
|
<Cursor1Time time="876,805.000 ns"></Cursor1Time>
|
||||||
</zoom_setting>
|
</zoom_setting>
|
||||||
<column_width_setting>
|
<column_width_setting>
|
||||||
<NameColumnWidth column_width="539"></NameColumnWidth>
|
<NameColumnWidth column_width="531"></NameColumnWidth>
|
||||||
<ValueColumnWidth column_width="116"></ValueColumnWidth>
|
<ValueColumnWidth column_width="116"></ValueColumnWidth>
|
||||||
</column_width_setting>
|
</column_width_setting>
|
||||||
<WVObjectSize size="18" />
|
<WVObjectSize size="19" />
|
||||||
<wvobject fp_name="/tb_accumulator_top/clk_in" type="logic">
|
<wvobject fp_name="/tb_accumulator_top/clk_in" type="logic">
|
||||||
<obj_property name="ElementShortName">clk_in</obj_property>
|
<obj_property name="ElementShortName">clk_in</obj_property>
|
||||||
<obj_property name="ObjectShortName">clk_in</obj_property>
|
<obj_property name="ObjectShortName">clk_in</obj_property>
|
||||||
@@ -64,9 +64,15 @@
|
|||||||
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
<obj_property name="CustomSignalColor">#E0FFFF</obj_property>
|
||||||
<obj_property name="UseCustomSignalColor">true</obj_property>
|
<obj_property name="UseCustomSignalColor">true</obj_property>
|
||||||
</wvobject>
|
</wvobject>
|
||||||
|
<wvobject fp_name="/tb_accumulator_top/accum_done" type="logic">
|
||||||
|
<obj_property name="ElementShortName">accum_done</obj_property>
|
||||||
|
<obj_property name="ObjectShortName">accum_done</obj_property>
|
||||||
|
<obj_property name="CustomSignalColor">#FF0080</obj_property>
|
||||||
|
<obj_property name="UseCustomSignalColor">true</obj_property>
|
||||||
|
</wvobject>
|
||||||
<wvobject fp_name="/tb_accumulator_top/m_axis_tdata" type="array">
|
<wvobject fp_name="/tb_accumulator_top/m_axis_tdata" type="array">
|
||||||
<obj_property name="ElementShortName">m_axis_tdata[7:0]</obj_property>
|
<obj_property name="ElementShortName">m_axis_tdata[31:0]</obj_property>
|
||||||
<obj_property name="ObjectShortName">m_axis_tdata[7:0]</obj_property>
|
<obj_property name="ObjectShortName">m_axis_tdata[31:0]</obj_property>
|
||||||
<obj_property name="CustomSignalColor">#008080</obj_property>
|
<obj_property name="CustomSignalColor">#008080</obj_property>
|
||||||
<obj_property name="UseCustomSignalColor">true</obj_property>
|
<obj_property name="UseCustomSignalColor">true</obj_property>
|
||||||
</wvobject>
|
</wvobject>
|
||||||
@@ -170,13 +176,13 @@
|
|||||||
<obj_property name="ObjectShortName">PROG_FULL_THRESH[31:0]</obj_property>
|
<obj_property name="ObjectShortName">PROG_FULL_THRESH[31:0]</obj_property>
|
||||||
</wvobject>
|
</wvobject>
|
||||||
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/xpm_fifo_async_inst/wr_data_count" type="array">
|
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/xpm_fifo_async_inst/wr_data_count" type="array">
|
||||||
<obj_property name="ElementShortName">wr_data_count[7:0]</obj_property>
|
<obj_property name="ElementShortName">wr_data_count[5:0]</obj_property>
|
||||||
<obj_property name="ObjectShortName">wr_data_count[7:0]</obj_property>
|
<obj_property name="ObjectShortName">wr_data_count[5:0]</obj_property>
|
||||||
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
||||||
</wvobject>
|
</wvobject>
|
||||||
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/xpm_fifo_async_inst/rd_data_count" type="array">
|
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/xpm_fifo_async_inst/rd_data_count" type="array">
|
||||||
<obj_property name="ElementShortName">rd_data_count[7:0]</obj_property>
|
<obj_property name="ElementShortName">rd_data_count[5:0]</obj_property>
|
||||||
<obj_property name="ObjectShortName">rd_data_count[7:0]</obj_property>
|
<obj_property name="ObjectShortName">rd_data_count[5:0]</obj_property>
|
||||||
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
<obj_property name="Radix">UNSIGNEDDECRADIX</obj_property>
|
||||||
</wvobject>
|
</wvobject>
|
||||||
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/fifo_wr_en_r" type="logic">
|
<wvobject fp_name="/tb_accumulator_top/dut/output_async_fifo/fifo_wr_en_r" type="logic">
|
||||||
|
|||||||
Reference in New Issue
Block a user