hai, folks.
please correct me if am wrong any where.
please follow the points here. 1,2,3
I have implemented the coverage inside the monitor instead of taking it in a separate class.
it is something like this
class monitor extends uvm_monitor;
// virtual interface_name h1;
function new();
//point 2
my_cov=new(); // if i do like this is throughing an error called (Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.)
endfunction
function void build_phase(uvm_phase phase);
endfunction
virtual task run_phase(uvm_phase phase);
//point 3
my_cov.sample(); // here i am calling the sample .
endtask
//point 1
covergroup my_cov @(posedge clk);
// here i have written few coverpoints
endgroup
endclass
This might result in wrong coverage values. If you want to do this you do not need to call the sample method.
I’d use the sample metod you can call it after you have assembled your transaction.
hai, chr_sue. I have gone through the same procedure but while calling the write method, it’s throwing an error saying that it’s a virtual function. Then I googled it and came to know that the subscriber write method is a pure virtual function. so declared as below
class fifo_coverage extends uvm_subcriber#(seq_item);
// …
…remaining code here
…
//
pure virtual function void write(fifo_seq_item item);
this.seq=item;
sync_fifo_cov.sample();
endfunction
A pure virtual function is a placeholder for an implementation. Normally it is used in a virtual class. A virtiual class cannot be constructed.
WRT your code:
class fifo_coverage extends uvm_subcriber#(fifo_seq_item);
// ..
fifo_seq_item item;
..remaining code here
..
//
virtual function void write(fifo_seq_item t);
item = t;
sync_fifo_cov.sample();
endfunction
endclass:fifo_coverage
sry sry… actually I have seen that later and I modified it working perfectly. but What I have noticed is.
when we are writing the write function we need to pass the argument seq_item handle as “t”.
virtual function void write(seq_item t); // here if you take any handle it is not working, we need to take only "t"
seq_item_handle =t;
cg.sample();
endfunction