`timescale 1ns/1ps
`include "uvm_macros.svh"
import uvm_pkg::*;
class report_payload extends uvm_object;
`uvm_object_utils(report_payload)
function new(string name="report_payload"); super.new(name); endfunction
endclass
class report_probe_catcher extends uvm_report_catcher;
int summary_seen, summary_action, type_errors;
function new(); super.new("catcher"); endfunction
function action_e catch();
if (get_id() == "UVM/REPORT/SERVER") begin
summary_seen++;
summary_action=get_action();
return CAUGHT;
end
if (get_id() == "TYPNTF") begin type_errors++; return CAUGHT; end
return THROW;
endfunction
endclass
class lazy_reporter extends uvm_report_object;
function new(); super.new("lazy"); endfunction
function bit has_handler(); return m_rh != null; endfunction
endclass
module report_probe;
initial begin
report_probe_catcher catcher = new();
lazy_reporter reporter = new();
uvm_report_server server = uvm_report_server::get_server();
uvm_root top = uvm_root::get();
uvm_factory factory = uvm_factory::get();
uvm_object_wrapper wrapper;
int count, file_a, file_b;
uvm_report_handler handler;
#1;
$display("REVIEW|handler_before_api|%0d", reporter.has_handler());
handler = reporter.get_report_handler();
$display("REVIEW|handler_after_api|%0d", handler != null);
uvm_report_cb::add(null, catcher);
top.set_report_verbosity_level(UVM_LOW);
server.report_summarize(0);
$display("REVIEW|summary_zero_display|%0d", (catcher.summary_action & UVM_DISPLAY) != 0);
$display("REVIEW|summary_zero_log|%0d", (catcher.summary_action & UVM_LOG) != 0);
file_a = $fopen("original-summary.log", "w");
file_b = $fopen("requested-summary.log", "w");
top.set_report_id_file("UVM/REPORT/SERVER", file_a);
server.report_summarize(file_b);
$display("REVIEW|summary_file_persists|%0d", top.get_report_file_handle(UVM_INFO, "UVM/REPORT/SERVER") == file_b);
top.set_report_id_file("UVM/REPORT/SERVER", file_a);
$display("REVIEW|summary_file_restored|%0d", top.get_report_file_handle(UVM_INFO, "UVM/REPORT/SERVER") == file_a);
top.set_report_verbosity_level(UVM_NONE);
count = catcher.summary_seen;
server.report_summarize();
$display("REVIEW|summary_at_none|%0d", catcher.summary_seen-count);
factory.set_type_override_by_name("report_payload", "unregistered_override");
$display("REVIEW|factory_set_errors|%0d", catcher.type_errors);
count = catcher.type_errors;
wrapper = factory.find_override_by_name("report_payload", "");
$display("REVIEW|factory_resolve_errors|%0d", catcher.type_errors-count);
$fclose(file_a);
$fclose(file_b);
$display("REVIEW|done|1");
$finish;
end
endmodule