Covering_address with +8

Hello,
I want to cover an address with +8 every time, based on my start address. To cover 10 consecutive address how to write coverpoint.?
I feel this is more closer. but i don’t know how to bring address variable to covergroup. I tried my ways. can someone give an idea how to do it.?


covergroup cg;
	ADDRESS:coverpoint cov.address{bins seq_addr= address with (item+8);}
endgroup

In reply to abhishek403:

Hello Abhishek,
Let me see if I got your question right, you have two question

  1. You have start address and you want to cover a transition of 10 consecutive address and each one with increment of 8.
  2. You want to get address field which is outside variable into your covergroup.

So for first where you want to cover transition of 10 consecutive address I will suggest you to check this section in system verilog LRM under chapter of functional coverage named “specifying bins for transitions”. See if that helps in meeting your requirement.

For second where you want to get address in the your covergroup you can write code in following 2 ways

  1. If address field is part of some transaction that has some other field as well that you can cover Then going this way is appropriate -
    suppose trans is your transaction type.
 class trans;
   int address;
   int id ;
 endclass

then in your coverage class

class coverage_c ;   
  trans t1;
  covergroup cg(trans tran);
    ADDRESS:coverpoint tran.address; //Here from the handle of the trans you can get address.
    ID : coverpoint tran.id;
  endgroup
  function new();
    t1=new();
    cg=new(t1);
  endfunction
  function operation();
  t1.address=t1.address+8;  // operation occuring on our transaction
  t1.id=t1.id+1;
  cg.sample();      // and hence every time when id or address modifies you can sample them  
  endfunction
endclass

Here we recievied address from the handle of trans that we sent from our new function to the cg covergroup and sample them whenever we modify id and address fields.

  1. Other way to get some variable inside the covergroup is by using sample method
    so suppose that the address is field in your coverage class.
class coverage_c;
  int address;
  covergroup cg with function sample (int address=0); //passing address as sample function 
                                                      // argument 
    ADDRESS: coverpoint address;
  endgroup
  function new();
    cg =new();
  endfunction
  function logic_address() // function operating on the address.
    address = address +8;
    cg.sample(address)// from here you are passing the modified value of address while sampling 
  endfunction
endclass

So that are the two methods to send outside variable into coverage class.