Hello everyone!
My scoreboard must compare outputs from DUT with outputs taken from txt file.
The outputs are 19 bit logic unsigned and txt file has the output values written in this way:
4
16
18
16
18
14
14
24
34
30
…
but the code I wrote doesn’t work:
class scoreboard extends uvm_subscriber #(out_transaction);
`uvm_component_utils(scoreboard);
virtual edge_det_bfm bfm;
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
integer data_out ; // file handler
integer scan_file ; // file handler
parameter n_pixel_total = 1049088;
// an istance of queue for predicted output (from txt file) with integer items
integer pixel, predicted_output [$:n_pixel_total];
// an istance of queue for output from DUT
logic unsigned [18:0] outputs, output_dut [$:n_pixel_total];
integer count=0;
integer i;
// write function called by output monitor
virtual function void write(out_transaction t);
// assigns to item outputs the value of DUT's output
outputs=t.data_out;
// insert data in the queue
output_dut.push_back(outputs);
//call compare funztion that compare outputs from DUT with outputs from txt file
compare();
endfunction : write
virtual function void compare();
// open out.txt file
begin
data_out = $fopen("out.txt", "r");
if (data_out == `NULL) begin
$display("data_out handle was NULL");
$finish;
end
//assign integer values from txt file to pixel variable
while(!$feof(data_out)) begin
scan_file=$fscanf(data_out, "%d\n", pixel);
// insert pixel in predicted_output queue
predicted_output.push_back(pixel);
end
// every item of predicted_output queue compared with corrispondent item from output_dut queue
for(i=0;i<=n_pixel_totali;i++)
if (predicted_output[i]!=output_dut[i])
`uvm_error("****************************************************TEST FAILED****************************************************" , "")
else
`uvm_info ("****************************************************TEST PASSED****************************************************", "", UVM_HIGH)
end
endfunction : compare
endclass : scoreboard
Where is the problem?Can I use another approach?
During simulation Questasim brings me these warning messages:
Warning: scoreboard.sv(118): Queue operation would exceed max. right index of 1049088.
Time: 27555 ns Iteration: 1 Instance: /top_edge_detector/bfm
Why?
Thank you all!