How to receive expected packet in Scoreboard

Hi,
In my environment, I need to implement uvm scoreboard logic.
Getting actual data from monitor, but how should I get expected data, so that comparison can be possible ? any idea ? As I don’t have access to driver class, & don’t have any other monitor class(like in active/passive agent). I can’t mimic the RTL also.

I’m aware of general UVM scoreboard logic, but this scenario is new to me & don’t know how we can receive the expected transaction in SCB

In reply to deeksha123:

  • Where do you sample the input interface of dut?
  • Do you have reference model implemented?

In reply to bdreku:

  1. I have agent monitor, through which sampling is done
  2. Yes, I have C code implemented, that act as reference model & this C code we convert into hex files & then preload into the memory.

In reply to deeksha123:

Then the C code should give you back the expected packet. If not accessible you could use the dpi c to interface with it and you will get the packet. Alternatively you could implement you own model though.

Another easy way could be write all the expected output vector into a file and make you scoreboard capable to read it back to make comparisons. Regards

In reply to Rsignori92:

Thankyou for guiding, I’ll try to implement this

In reply to Rsignori92:

I’m able to implement the 2nd approach, writing expected value to file & reading back & comparison. Hence, my scoreboard logic is working for single testcase only

Now got stuck, as I have different testcases & giving different expected value, so how should I take that particular testcase expected value from file.
Is any ifdef/define macros I can use in file or in SCB or any switch kind of mechanism?

TIA

In reply to deeksha123:

Dealing with file I/O is always non-flexible solution.
You can insert your C-model a the reference model into your UVM testbench. Always you are getting a transaction from your monitor you can send the input transactiob to the ref model. In 0 time you get the expected value. That’s it.

In reply to chr_sue:

Is any snippet code or reference available for implementing like this ? So that I’ll get an idea on that
TIA

In reply to deeksha123:

Of course. Please give a few hours.

In reply to chr_sue:

OK. Talking first about the architecture.
When using randomized input pattern it is costly to generate them seperately and store them in a file.
What I proposing is the following:
(1) We are using sequences to generate seq_items with randomized data (constrained). These data will be used in the driver to stimulate the DUT. Additionally we are sending these patterns through an analysis port in the driver to the scoreboard.
(2) In the scoreboard we are storing these input seq_items/transaction in an analysis fifo. This fifo stores the input transactions in the right order.
(3) in the scoreboard component we are instantiating the reference model which is C-/C++ code. If we get a transaction from the DUT we do a get/try_get on the fifo with the input transactions and sending these dara to the reference model. The expected data will be generated in 0 time and can be compared with the data from the DUT.
The scoreboard code could look like this:

import "DPI-C" function void ref_model( <arguments>, inputs/outputs);

//------------------------------------------------------------------------------
class my_sb extends uvm_subscriber #(out_item);  // out_item comes from the DUT
//------------------------------------------------------------------------------

  `uvm_component_utils(my_sb)
  
  uvm_tlm_analysis_fifo #(in_item) in_fifo;  // connected to the drivers analysis_port
.....
  virtual function void process_refs(output ref_item);
......
 if (fifo.try_get(i_item)) begin   // try_get is not blocking
....
 ref_model(<arguments>);
end
  endfunction
  virtual function void write(img_out_item t);
    <data type> result;
...
    process_refs(result);
...
endfunction
endclass 

I know this is very rudimentary code. If you have more questions or need help you can share your code privately to me by email:
christoph@christoph-suehnel.de

In reply to chr_sue:

Thankyou so much christoph. I’ll try to implement this :)

In reply to chr_sue:
Hi, why you are parameterizing the scoreboard class with the DUT-output? in_item must be the sequence_item,please correct me if I am wrong

In reply to Deepti Tripathi:

You are right the uvm_subscriber class has to be parameterized with the in_item. You are sending the in_item to the ref_model to generate the expected values.

In reply to chr_sue:

In reply to Deepti Tripathi:
You are right the uvm_subscriber class has to be parameterized with the in_item. You are sending the in_item to the ref_model to generate the expected values.

Okay, what is out_item and img_out_item in the code? I have sent an updated scoreboard code to the given mail-ID. Please check.

In reply to Rsignori92:

hi,
i tried to implement second method,by using output text file in run_phase of scoreboard

  fd1=$fopen("out.txt","r");
       for (int i=0; i<8;i=i++)
        foreach(exp_data[i])
     begin
       $fscanf(fd1,"%x",exp_data[i]);   
       ffread1=$fscanf(fd1,"%p",exp_data[i]);
       $display("data[%0d]=%h",i,exp_data[i]);
      begin
        `uvm_info(get_full_name() ,$sformatf("ffread1=%0d  exp_data=%0d",ffread1,exp_data),UVM_LOW)
   
    `uvm_info("run a scoreboard", "waiting for expexted output",UVM_LOW)
       //exp_fifo.get(exp_tr);
      end
        
   `uvm_info("run a scoreboard", "waiting for actual output",UVM_LOW)
      act_fifo.get(act_tr);
       if (act_tr.compare(exp_data)) 
       // if (act_tr== exp_tr) 
        begin
        
        `uvm_info("scoreboard pass",$sformatf("data=%0d hash=%0d", exp_data,act_tr.hash),UVM_LOW)
      end
                                             
 else
          begin

            `uvm_info("scoreboard fail",$sformatf("data=%0d",act_tr.hash),UVM_LOW)
end
end
      end
endtask

/but im getting an error at scoreboard,please help me to sortout

In reply to naadiya:

What is the second method and how does your error look like?

In reply to deeksha123:

//Another easy way could be write all the expected output vector into a file and make you scoreboard capable to read it back to make comparisons//

//my code snippet
function void write_mon( input sha_seq_item1 act_tr);
//how to store actual data"?
fd1= $fopen(“out.txt”,“r”);
$fscanf(fd1,“%x”,exp_data);//exp_data is not a class based ,so when i compare getting an error
exp_queue.push_back(exp_data);
if(exp_queue.size()>0)
exp_tr=exp_queue.pop_front();

if(act_tr == exp_tr)
begin
$display(“pass”);
end
else
begin
$display(“fail”);
end

check my code once

In reply to naadiya:

This is the critical line:

if(act_tr == exp_tr)

You are compairing the whole transactions. This does not include only the data members. It compares any other data belonging to the transaction. To see them you can print the transaction using the format identifier %p.
But in reality you want to compare only the data memebers of the transaction class. This requires an appropriate compare/do_compare function.

1 Like