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 #(**my_tx**);
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
I have the same problem, I have two different “uvm_sequence_item” and I don’t know how to parameterize the coverage (which extends a “uvm_subscriber”) in order to have a coverage based on two different items.
I tried something like the code below without success, any help on that?
I do not understand why you have 2 different seq_items. Each agent should have exactly 1 seq_item.
How do you define your covergroups/coverpoints/bins having 2 different seq_items?
Because in my case I have two agents that have different seq_items, so what I need is to make a coverage based on both packets.
Right now, I only have different covergroups for each seq_item but I would like to have one depending on the other.
As I wasn’t able to find a solution using uvm_subscriber, I am going to use uvm_component with uvm_analysis_export and uvm_tlm_analysis_fifo for receive the transactions, and put them on the sample function of the covergroups when needed.
In your covergroup you are refering to data members of your seq_item. If you have different seq_items you’ll have different data members. How will you create a covergroup in this case?
In reply to chr_sue:
That’s what my original query was, as in the current SoC Environment each and every register is actually converted into individual seq item through a script.
Only thing I thought off is to create a single class comprising with all of the register data items combined together and use that even in my various test so that the coverage is sampled.
In your case when the seq_items are coming from different agents you cannot use a uvm_subscriber for the different covergroups. In general the seq_items will arrive at different times and the write functions are called from different monitors you have to use an extension of uvm_component. In there you have to define the different covergroups and to specify different write functions. To differentiate between these write functions you have to specify a suffix by using the macro `uvm_analysis_imp_decl.