Customizing UVMF scoreboard

In the UVMF base scoreboard, dut outputs and predictor outputs are compared in order. But it is not deterministic when the design output is valid. In other words, the outputs of the dut after a while are the same as the outputs of the predictor. So we need to compare every output of design to all of the output of predictor and then compare dut outputs and predictor in order. How can we do this?

In reply to Moein75:

If you can’t determine when the design output is valid, how can you decide if the design is working correctly? The monitor should only send valid outputs to the scoreboard. This is the GIGO principle.

In reply to chrisspear:

the design has a valid_out signal. This is not problem.
Let me give an example. The 11th output of the predictor is the same as the first output of the design. and so on. ( second of design == 12th of predictor, Third of design == 13th of predictor, 4th of design == 14th of predictor , …)
But in the monitor we can not determine how many shifts there are. So at first, we should compare the output of the design with some outputs of predictor not just the first one.

The UVMF base library contains multiple scoreboard variants.

If the transactions coming out of the DUT are not in the same order as the transactions coming from the predictor, then you need to use the out_of_order_scoreboard

If the transactions are in order (e.g. you always get a DUT output TXN that corresponds to the current predicotr TXN), but you cannot guarantee which TXN comes first, then you use the in_order_race_scoreboard.

Look in the UVMF User guide, section 1.4.7 for details of each available scoreboard. (in UVMF 2023.1 docs)

In reply to graeme_jessiman:

Start by having a look at the UVMF source code in $QUESTA_HOME/examples/UVM_Framework/UVMF_2023.1/uvmf_base_pkg/src

The scoreboards store the handles to the transactions in arrays. For example, Graeme’s favorite, uvmf_out_of_order_scoreboard has expected_hash. The virtual function write_actual() does the comparison of expected to actual. The key code is shown below. You can extend this and add your own comparison that walks through the expect array.

virtual function void write_actual (input T t);
  // Test if matching item exists in expected hash
  if ( expected_hash.exists(t.get_key()) ) begin
    T expected_item;

    expected_item = expected_hash[t.get_key()];
    expected_hash.delete(t.get_key());

    // Compare actual transaction to expected transaction
    if ( t.compare(expected_item) ) begin
      match_count++;
      `uvm_info("SCBD",compare_message("MATCH! - ",expected_item,t),UVM_MEDIUM)
    end
    else begin
      mismatch_count++;
      `uvm_error("SCBD",compare_message("MISMATCH! - ",expected_item,t))
    end
  end
endfunction