UVM Report Catcher

The firewall for your logs. Intercept messages before they are printed or cause simulation failure. Perfect for verifying "Negative Scenarios" where errors are expected.

When do you need this?

Imagine you are testing an error condition (e.g., sending a bad CRC packet). The DUT should flag an error, and your Scoreboard might report a `UVM_ERROR`. But wait! This error is EXPECTED.

If you let it pass, the test fails (UVM counts errors). You need a way to say "I'm expecting this specific error, please ignore it or downgrade it to a warning."

Implementing a Catcher

Extend uvm_report_catcher and implement the catch() function.

class crc_error_demoter extends uvm_report_catcher;
    `uvm_object_utils(crc_error_demoter)
    function new(string name="crc_error_demoter");
        super.new(name);
    endfunction
    // This function is called for every message
    virtual function action_e catch();
        // Check if this is the error we are looking for
        if(get_severity() == UVM_ERROR && get_id() == "SCBD_CRC_MISMATCH") begin
            // 1. Demote to Warning
            set_severity(UVM_WARNING);
            // 2. Change the message
            set_message("Saw expected CRC Mismatch (Demoted)");
            // Return THROW to let the message proceed (as a Warning now)
            return THROW;
        end
        return THROW; // Pass all other messages unchanged
    endfunction
endclass

Registering the Catcher

You must attach the catcher to the component generating the messages (or globally using uvm_top).

class my_error_test extends my_base_test;
    // ...
    crc_error_demoter demoter;
    task run_phase(uvm_phase phase);
        demoter = new("demoter");
        // Attach to the whole env hierarchy
        uvm_report_cb::add(env, demoter); 
        // Start the sequence that causes errors
        seq.start(env.agent.sqr);
        // Remove catcher if needed later
        // uvm_report_cb::delete(env, demoter);
    endtask
endclass
Why not just use +uvm_set_severity?
CLI args like +uvm_set_severity affect ALL messages with that ID for the entire simulation. A Catcher allows dynamic control—you can enable it only for the duration of a specific sequence, then remove it!