- Scoreboard
- Reporting printer
- Using create
Scoreboard
- Scoreboard could hold the entire self-checking structure including the transfer function or reference model, the expected data storage mechanism and the output comparison function . It could also be limited to the data structure used to hold the expected data for ease of comparison against the monitored output values.
- Stimulus Generator or Sequencer
- DUT -> Response Monitor
- TLM or transfer function
- Output from the DUT responses are compared with expected result from transfer model
class scoreboard extends uvm_agent;
`uvm_component_utils(scoreboard)
virtual interface mem_if vif;
logic [15:0] exp [2**16-1:0];
function new (string name = "scoreboard", uvm_component parent = null);
super.new (name, parent);
endfunction : new
task run_phase (uvm_phase phase);
forever begin
@ (vif.cb)
if (vif.rd) begin
#`UNIT_DELAY
assert (vif.data === exp[vif.addr]) else
uvm_report_error ("run",
$psprintf("expected %0h actual: %0h",
exp[vif.addr], vif.data));
end
if (vif.wr) begin
exp[vif.addr] = vif.data;
end
end
endtask : run_phase
Reporting
class reporter extends uvm_agent;
`uvm_component_utils (reporter)
virtual interface mem_if vif;
function new (string name = "reporter", uvm_component parent = null);
super.new (name parent);
endfunction : new
task run_phase (uvm_phase phase);
forever begin
@(vif.cb);
uvm_report_info ("run",
$psprintf ("addr: %1h data:%4h rd:%1b wr: %1b",
vif.addr, vif.data, vif.rd, vif.wr));
end
endtask : run_phase
endclass : reporter
class bucket extends reporter;
`uvm_component_util(bucket)
function new ...
task run_phase (uvm_phase phase); // override to do nothing
endtask : run_phase
endclass : bucket
Create Tests
// In the test class file
class test1 extends uvm_test;
`uvm component_utils(test1)
test_env tenv;
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
virtual function void build_phase (uvm_phase phase);
tenv = test_env::type_id::create("tenv", this);
endfunction : build_phase
endclass
class test2 extends uvm_test;
`uvm component_utils(test2)
test_env tenv;
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
virtual function void build_phase (uvm_phase phase);
// When you call the overriding run_phase in bucket,
// the test will run without printing line by line data in
// in default reporter.run_phase
reporter::type_id::set_type_override(bucket::get_type());
tenv = test_env::type_id::create("tenv", this);
endfunction : build_phase
endclass : test2
class test_env extends uvm_env;
`uvm_component_utils (test_env)
driver drv;
scoreboard sb;
reporter rpt;
function new ...
virtual function void build_phase (uvm_phase phase);
drv = driver::type_id::create("drv", this);
sb = scoreboard::type_id::create("sb", this);
rpt = reporter::type_id::create("rpt", this);
endfunction : build_phase
endclass
No comments:
Post a Comment