I am trying to use Report catcher to shut out UVM_WARNINGS coming from RAL.
Please find relevant code below.
function uvm_report_catcher::action_e fb_report_catcher::catch();
string ID = get_id();
string MSG = get_message();
foreach(chg_q[i]) begin
if(ID.match(chg_q[i].ID) && MSG.match(chg_q[i].MSG) && (get_severity == chg_q[i].incoming_severity)) begin
set_severity(chg_q[i].outgoing_severity);
set_verbosity(chg_q[i].outgoing_verbosity);
break;
end
end
return THROW;
endfunction
chg_severity(string ID = "", string MSG ="", uvm_severity incoming_severity = UVM_WARNING, uvm_severity outgoing_severity = UVM_INFO, uvm_verbosity outgoing_verbosity = UVM_DEBUG);
change_sev_s data;
data.ID = ID;
data.MSG = MSG;
data.incoming_severity = incoming_severity;
data.outgoing_severity = outgoing_severity;
data.outgoing_verbosity = outgoing_verbosity;
chg_q.push_back(data);
endfunction
report_catcher::chg_severity("RegModel",,,,);
report_catcher::chg_severity("RegModel",,UVM_INFO,,);
I already made sure that functions works as expected by putting $displays there, so not a good place to spend your time there.
It does not deal with UVM_WARNING at all and I see WARNINGs from that module being printed anyways.
- My expectation here was that UVM_WARNING will be demoted to UVM_INFO with verbosity UVM_DEBUG and will be filtered out. Why did it not work?
- If I just want to remove intended UVM_WARNINGs, how can I modify catch function. Maybe I dont return THROW?
In reply to sharatk:
Waht are you doing wuth your catcher? You have modified the catch method and you have to add your catcher to your environment.
In reply to sharatk:
Maybe I dont return THROW?
Return CAUGHT, conditionally when its a UVM_WARNING otherwise THROW. That works in a toy example. You can also add/try return CAUGHT if you convert a warning to info and a specific verbosity, and then return caught if the overall verbosity level is lower than the converted verbosity level. That I have not tried in my toy example.
class my_report_catcher extends uvm_report_catcher;
`uvm_object_utils(my_report_catcher)
typedef struct {
string id;
uvm_severity in_sev;
uvm_severity out_sev;
uvm_verbosity out_verb;
} req_s;
req_s reqs[$];
function new(string name = "mrc");
super.new(name);
endfunction
function void add_req(req_s r);
reqs.push_back(r);
endfunction
function action_e catch();
bit nothrow=0;
string loc_id=get_id();
uvm_severity loc_sev=get_severity();
foreach(reqs[r]) begin
if(loc_id==reqs[r].id && loc_sev==reqs[r].in_sev) begin
set_severity(reqs[r].out_sev);
if (reqs[r].out_sev==UVM_INFO) set_verbosity(reqs[r].out_verb);
if (loc_sev==UVM_WARNING) nothrow=1;
break;
end
end
return nothrow?CAUGHT:THROW;
endfunction
endclass
Then in the env -
my_report_catcher mrc
mrc=new("mrc");
mrc.add_req('{"WARNING_ID", UVM_WARNING, UVM_INFO, UVM_DEBUG});
uvm_report_cb::add(your_agent.your_component, mrc);
In reply to ab_verif:
It should be like this:
class my_report_catcher extends uvm_report_catcher;
function new (string name = "");
super.new(name);
endfunction
function action_e catch;
uvm_severity severity = get_severity();
string id = get_id();
uvm_action action = get_action();
string message = get_message();
int verbosity = get_verbosity();
if (severity == UVM_WARNING)
set_severity(UVM_INFO); // demoting
if (severity == UVM_ERROR)
return CAUGHT; //caught UVM_ERROR
return THROW; // through to ther catchers
endfunction
endclass
And then in the env:
function void end_of_elaboration_phase(uvm_phase phase);
catcher_h = new("catcher_h");
uvm_report_cb::add(null, catcher_h);
endfunction
Thanks all. I used CAUGHT to prevent WARNING from showing up. Is this a UVM issue of setting VERBOSITY to UVM_NONE even when I ask it to set to UVM_DEBUG?