Bitwise toggle coverage for a bitvector

In reply to dave_59:

Hi Dave,

Thanks for the reply. Yes i did see that warning.

Actually in the function I have calculated the range of address which i want to use in my covergroup.
Basically i want to do this

memory_range : coverpoint range {bins addr = {[base_addr, final_addr]};}

which will be dependant on the size of the memory for which i have defined a function. The size and base_addr are read from registers inside the function.

function void calc();

bit [3:0] size;

register read to get size;
register read to get base_addr;
case(size)
4’b0000: begin
Max_addr = ‘h10000;
Final_addr= base_addr+max_addr;
covergroup.sample();
end

4’b0001: …….

endfunction

How should I access the base addr and final addr from the function in my covergroup?