Can I have a coverpoint for a transaction?


A customer asked me "can I have a coverpoint for a transaction?" What? Well, we might use a class to represent a transaction. So, can we have a coverpoint for that? Let's see. Suppose we have a class, eg

  class C;
    bit b1, b2;
  endclass

 
Can we do:

  covergroup CG;
    coverpoint c;
  endgroup

  
The answer is no. But we are allowed to do this:

  covergroup CG;
    coverpoint c.b1;
    coverpoint c.b2;
  endgroup


Here's what the Stack Overflow folks call an MCVE:

module M;
 
  class C;
    bit b1, b2;
  endclass
 
  C c = new;
 
  covergroup CG;
  //coverpoint c;      // THIS WON'T COMPILE
    coverpoint c.b1;
    coverpoint c.b2;
  endgroup
 
  CG cg = new;
 
endmodule


https://www.edaplayground.com/x/ZV_

A customer asked me about this. I didn't know the answer, so I wrote a few lines of code on EDA Playground. EDA Playground is great for that, because it's always on. You don't have to queue for licences, wait for EDA tools to start, create new files, fire up editors...

Comments

Popular posts from this blog

Bit Width Casting in SystemVerilog

How to convert a std_logic_vector to a hex string?

Can you add/remove more than 1 item from a queue?