Hello,
In the preferred functional coverage code below, I have many different sequence items in our environment as they are generated from scripts, then how do we go-ahead to implement the functional coverage class?
Any other ways to implement?
class my_coverage_collector extends uvm_subscriber #([b]my_tx[/b]);
my_tx tx; // the transaction object on which value changes will be covered
covergroup dut_inputs;
option.per_instance = 1; // track coverage for each instance
Opc: coverpoint tx.opcode;
Opa: coverpoint tx.operand_a;
Opb: coverpoint tx.operand_b;
endgroup
`uvm_component_utils(my_coverage_collector)
function new(string name, uvm_component parent );
super.new(name, parent);
dut_inputs = new(); // construct the covergroup
endfunction: new
function void write(my_tx t);
tx = t; // copy transaction handle received from the monitor
dut_inputs.sample();
endfunction: write
function void report_phase(uvm_phase phase);
`uvm_info("DEBUG", $sformatf("\n\n Coverage for instance %s = %2.2f%%\n\n",
this.get_full_name(), this.dut_inputs.get_inst_coverage()), UVM_HIGH)
endfunction: report_phase
endclass: my_coverage_collector