Jump to content

How to make coverage model reusable for multiple port devices?


Recommended Posts

Suppose I have a 4 port device.  Each port in the device has a register object.  I want to write a functional coverage model to make sure that I test the registers in each port.  I write the following code:

 

covergroup cg;
 
   myreg_port_0: coverpoint top_reg_obj.port[0].myreg;
   myreg_port_1: coverpoint top_reg_obj.port[1].myreg;
   myreg_port_2: coverpoint top_reg_obj.port[2].myreg;
   myreg_port_3: coverpoint top_reg_obj.port[3].myreg;
 

endgroup

 

However, this is not reusable.  The next chip planned is an 8-port device.  I have to manually modify this coverage model each time the number of ports change.  I would like to write the coverpoints using a for-loop to iterate over all the ports.

 

What is the best way to do this?  It doesn't seem possible to use "for" or "foreach" inside a covergroup.

 

Thanks in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...