Predictor issue

UVM_ERROR /proj/navi12-dv12-nobackup/soc_regrsys/navi12/soc_dcn_deploy_342/out/linux_3.10.0_64/navi12/config/dc_chip/pub/sim/fake_v_incl/hubpret_cursor_unpack_scb.svh(298) @ 2492415100: uvm_test_top.tb_env_h.core_env.dchub_env.env_hubpret[0].cursor_env0.unpack_scb [HUBPRET_CURSOR_UNPACK_SCB] Underflow: data_before_fifo (predictor) not empty : residual [153]

In reply to koushik hk:

how to debug this error
ifndef __DCHUBP__HUBPRET_CURSOR_UNPACK_SCB__SVH_ define _DCHUBP__HUBPRET_CURSOR_UNPACK_SCB__SVH

// File: hubpret_cursor_unpack_scb.svh
// Contains: hubpret_cursor_unpack_scb

/*
Class: hubpret_cursor_unpack_scb

Scoreboard for cursor unpacking.

Properties:
    unpack_ap - uvm_analysis_port #(<hubpret_cursor_unpack_txn>)
    mode_export - uvm_analysis_export #(<hubpret_cursor_mode_txn>)
    data_export - uvm_analysis_export #(<hubpret_cursor_data_txn>)
    comparator - uvm_in_order_class_comparator#(<hubpret_cursor_unpack_txn>) 

*/
class hubpret_cursor_unpack_scb extends uvm_scoreboard;

`uvm_component_utils(hubpret_cursor_unpack_scb)

localparam report_id = "HUBPRET_CURSOR_UNPACK_SCB";

`uvm_analysis_imp_decl(_pdctr_data)
`uvm_analysis_imp_decl(_rtl_data)
`uvm_analysis_imp_decl(_mode)
`uvm_analysis_imp_decl(_gs)
`uvm_analysis_imp_decl(_reqctrl)


uvm_analysis_export #(hubpret_cursor_mode_txn) mode_export;
uvm_analysis_export #(hubpret_cursor_unpack_txn) pdctr_data_export;
uvm_analysis_export #(hubpret_cursor_unpack_txn) rtl_data_export;
uvm_analysis_export #(hubpret_gs_txn) gs_export;

uvm_tlm_analysis_fifo #(hubpret_cursor_unpack_txn) data_before_fifo;
uvm_tlm_analysis_fifo #(hubpret_cursor_unpack_txn) data_after_fifo;
uvm_tlm_analysis_fifo #(hubpret_cursor_mode_txn) mode_fifo;

protected uvm_analysis_imp_pdctr_data #(
    hubpret_cursor_unpack_txn, hubpret_cursor_unpack_scb
) pdctr_data_imp;

protected uvm_analysis_imp_rtl_data #(
    hubpret_cursor_unpack_txn, hubpret_cursor_unpack_scb
) rtl_data_imp;

protected uvm_analysis_imp_mode #(
    hubpret_cursor_mode_txn, hubpret_cursor_unpack_scb
) mode_imp;

protected uvm_analysis_imp_gs#(
  hubpret_gs_txn, hubpret_cursor_unpack_scb
) gs_imp;

uvm_analysis_imp_reqctrl #(
    hubpret_cursor_reqctrl_txn,
    hubpret_cursor_unpack_scb
) reqctrl_export;

protected hubpret_cursor_unpack_scb_cfg cfg;

protected int m_matches, m_mismatches;
int num_rtl_data_received, num_pdctr_data_received;
protected uvm_phase runphase;
protected bit vstart;
bit frame_abort = 0;
int num_total_data = 0;
protected bit cursor_en = 0;
protected int output_rectangle_width = 0;
protected int output_rectangle_height = 0;
protected int unsigned frame_count = 0;

// any frame id set as underflow will be ignored from checking
protected int unsigned underflow_frame_id [$]; 
extern function bit scb_check_en();
extern function void set_underflow_frame_id(int val);


uvm_event #(uvm_sequence_item) frame__eof;
protected bit eof_flags;
extern protected virtual function void update_frame_eof(
    uvm_sequence_item t
);
extern virtual function void check_frame_start(bit ignore_outstanding = 0);
extern virtual function void flush();

// Method: new
extern function new (string name, uvm_component parent);
extern function void build_phase(uvm_phase phase);
extern function void connect_phase(uvm_phase phase);
extern task run_phase(uvm_phase phase);
extern virtual function void check_phase(uvm_phase phase);
extern function void report_phase(uvm_phase phase);

extern function void write_reqctrl(hubpret_cursor_reqctrl_txn t);
extern function void write_rtl_data(hubpret_cursor_unpack_txn t);
extern function void write_pdctr_data(hubpret_cursor_unpack_txn t);
extern function void write_mode(hubpret_cursor_mode_txn t);
extern function void write_gs(hubpret_gs_txn t);

endclass : hubpret_cursor_unpack_scb

function bit
hubpret_cursor_unpack_scb::scb_check_en();

// global disable for scb_checks
if (frame_abort) return 0;

// First frame
if (frame_count == 0) return 0;

// underflow frames
if(underflow_frame_id.size() > 0) begin
    foreach(underflow_frame_id[i]) begin
        if(underflow_frame_id[i] == frame_count) begin
            return 0;
        end
    end
end

return 1;

endfunction : scb_check_en

function void
hubpret_cursor_unpack_scb::set_underflow_frame_id(int val);
underflow_frame_id.push_back(val);
endfunction : set_underflow_frame_id

function hubpret_cursor_unpack_scb::new (string name, uvm_component parent);
super.new(name, parent);
frame__eof = new(“frame__eof”);
mode_export = new(“mode_export”, this);
pdctr_data_export = new(“pdctr_data_export”, this);
rtl_data_export = new(“rtl_data_export”, this);
gs_export = new(“gs_export”, this);
pdctr_data_imp = new(“pdctr_data_imp”, this);
rtl_data_imp = new(“rtl_data_imp”, this);
mode_imp = new(“mode_imp”, this);
gs_imp = new(“gs_imp”, this);
reqctrl_export = new(“reqctrl_export” , this);

mode_fifo     = new("mode_fifo", this);
data_before_fifo = new("data_before_fifo", this);
data_after_fifo = new("data_after_fifo", this);
m_matches = 0;
m_mismatches = 0;

endfunction : new

function void hubpret_cursor_unpack_scb::build_phase(uvm_phase phase);

super.build_phase(phase);
if (
! uvm_config_db#(hubpret_cursor_unpack_scb_cfg)::get(
this, “”, “scb_config”, cfg
)
) begin
`uvm_fatal(report_id, “could not retrieve cfg from config db”)
end

endfunction : build_phase

function void hubpret_cursor_unpack_scb::connect_phase(uvm_phase phase);
pdctr_data_export .connect( data_before_fifo.analysis_export );
rtl_data_export .connect( data_after_fifo.analysis_export);
mode_export .connect( mode_fifo.analysis_export);

pdctr_data_export .connect( pdctr_data_imp);
rtl_data_export .connect( rtl_data_imp);
mode_export .connect( mode_imp);
gs_export .connect( gs_imp);
endfunction : connect_phase

task hubpret_cursor_unpack_scb::run_phase(uvm_phase phase);
string s;
hubpret_cursor_unpack_txn data_before_txn, data_after_txn;

runphase = phase;
forever begin
data_before_fifo.peek(data_before_txn);
data_after_fifo .peek(data_after_txn);

if (data_before_fifo.is_empty() || data_after_fifo.is_empty())
  continue;
void'(data_before_fifo.try_get(data_before_txn));
void'(data_after_fifo.try_get(data_after_txn));

if(!data_before_txn.compare(data_after_txn)) begin
  m_mismatches++;
  $sformat(s, "\npredictor:\n%s \nrtl:\n%s does not match. m_mismatches(%0d)", data_before_txn.convert2string(), data_after_txn.convert2string(), m_mismatches );
  uvm_report_error("Comparator Mismatch", s); 
end else begin
  m_matches++;
  $sformat(s, "%s matches %s m_matches(%0d)", data_before_txn.convert2string(), data_after_txn.convert2string(), m_matches );
  uvm_report_info("Comparator Match", s, UVM_DEBUG); 
end

end

endtask : run_phase

function void hubpret_cursor_unpack_scb::write_reqctrl(hubpret_cursor_reqctrl_txn t);
uvm_info(report_id, "write_rtl_data", UVM_DEBUG) if(cursor_en===0 && (t.wr_pulse || t.wr_ptr || t.new_entry_received) && !cfg.disable_scb_check) uvm_error(report_id, “detected crq transaction while cursor is disalbed!”)
endfunction : write_reqctrl

function void hubpret_cursor_unpack_scb::write_rtl_data(hubpret_cursor_unpack_txn t);
uvm_info(report_id, "write_rtl_data", UVM_DEBUG) // if(cursor_en===0) // uvm_error(report_id, “detected dpp transaction while cursor is disalbed!”)

num_rtl_data_received ++ ;
`uvm_info(report_id, $sformatf("num_rtl_data_received %0d/%0d", num_rtl_data_received, num_total_data), UVM_DEBUG)

if (|t.data.eol) begin
    `uvm_info(report_id, "rtl data eol", UVM_HIGH)
    if (t.data.eof) begin
        `uvm_info(report_id, "rtl data eof", UVM_MEDIUM)
        eof_flags = 1;
        update_frame_eof(t);
    end
end

endfunction : write_rtl_data

function void hubpret_cursor_unpack_scb::write_pdctr_data(hubpret_cursor_unpack_txn t);
`uvm_info(report_id, $sformatf(“write_prdctr_data %s %0d %0d”, t.convert2string(), data_before_fifo.used(), data_after_fifo.used()), UVM_DEBUG)

num_pdctr_data_received ++;
`uvm_info(report_id, $sformatf(“num_pdctr_data_received %0d/%0d”, num_pdctr_data_received, num_total_data), UVM_DEBUG)
endfunction : write_pdctr_data

function void hubpret_cursor_unpack_scb::write_mode(hubpret_cursor_mode_txn t);
cursor_en = t.cursor_en;
output_rectangle_width = t.output_rectangle_width;
output_rectangle_height = t.output_rectangle_height;
endfunction : write_mode

function void hubpret_cursor_unpack_scb::write_gs(hubpret_gs_txn t);
if(!vstart && t.vstart) begin
`uvm_info(report_id, “detected rising edge of vstart”, UVM_LOW)
check_frame_start(scb_check_en());
frame_count ++;
end
vstart = t.vstart;

if(t.vready) begin
num_total_data = (cursor_en===1) ? ((output_rectangle_width+3)/4*output_rectangle_height) : 0;
num_rtl_data_received = 0;
num_pdctr_data_received = 0;
`uvm_info(report_id, $sformatf(“num_total_data %0d”, num_total_data), UVM_LOW)
end

endfunction : write_gs

function void hubpret_cursor_unpack_scb::report_phase(uvm_phase phase);
if(m_mismatches == 0)
uvm_info (report_id, $sformatf ( "Scoreboard completed with %0d matches and %0d mismatches", m_matches, m_mismatches ), UVM_LOW) else uvm_error (report_id,
$sformatf (
“Scoreboard completed with %0d matches and %0d mismatches”,
m_matches, m_mismatches
))
endfunction : report_phase

function void
hubpret_cursor_unpack_scb::update_frame_eof(uvm_sequence_item t);
if (&eof_flags) begin
`uvm_info(report_id, “frame__eof”, UVM_MEDIUM)
frame__eof.trigger(t);
eof_flags = '0;
end
endfunction : update_frame_eof

function void
hubpret_cursor_unpack_scb::check_phase(uvm_phase phase);
`uvm_info(report_id, “check_phase”, UVM_LOW)
check_frame_start(cfg.ignore_outstanding_data_in_check_phase);
endfunction : check_phase

function void
hubpret_cursor_unpack_scb::check_frame_start(bit ignore_outstanding = 0);
int residual;

residual = data_before_fifo.used();
if(residual > 0) begin
if(ignore_outstanding)
uvm_info(report_id, $sformatf("Underflow: data_before_fifo (predictor) not empty : residual [%0d] ", residual), UVM_LOW) else uvm_error(report_id, $sformatf("Underflow: data_before_fifo (predictor) not empty : residual [%0d] ", residual))
end

residual = data_after_fifo.used();
if(residual > 0) begin
if(ignore_outstanding)
uvm_info(report_id, $sformatf("Either RTL send more data or frame is too short. data_after_fifo (rtl) not empty : residual [%0d] ", residual), UVM_LOW) else uvm_error(report_id, $sformatf("Either RTL send more data or frame is too short. data_after_fifo (rtl) not empty : residual [%0d] ", residual))
end

residual = mode_fifo.used();
if(residual > 0)
`uvm_info(report_id, $sformatf(“mode_fifo has been written (%0d) times”, residual), UVM_DEBUG)

uvm_info(report_id, $sformatf("m_matches [%0d] m_mismatches [%0d] ", m_matches, m_mismatches), UVM_DEBUG) if ((m_matches + m_mismatches) == num_total_data) begin uvm_info(report_id, $sformatf(“all predicted (%0d) items checked, checking inactive”, num_total_data), UVM_LOW)
end else begin
if (ignore_outstanding)
uvm_info(report_id, $sformatf("incomplete m_matches (%0d) m_mismatches (%0d) expected (%0d), checking inactive",m_matches, m_mismatches,num_total_data), UVM_LOW) else uvm_error(report_id, $sformatf(“incomplete m_matches (%0d) m_mismatches (%0d) expected (%0d), checking inactive”,m_matches, m_mismatches,num_total_data))
end

flush();

endfunction : check_frame_start

function void
hubpret_cursor_unpack_scb::flush();
`uvm_info(report_id, “flush”, UVM_LOW)
data_before_fifo.flush();
data_after_fifo.flush();
mode_fifo.flush();

`uvm_info(report_id, $sformatf(“flush %0d %0d”, data_before_fifo.used(), data_after_fifo.used()), UVM_DEBUG)
m_matches = 0;
m_mismatches = 0;
num_total_data = 0;

if(frame_abort) begin
`uvm_info(report_id, “flush called prior to vstart reseting”, UVM_LOW)
frame_abort = 0;
end

endfunction : flush

`endif // _DCHUBP__HUBPRET_CURSOR_UNPACK_SCB__SVH

In reply to koushik hk:

It is useless to paste all your code without any format. Please use the SystemVerilog formatting.