[sv-ec] new-ing of class embedded covergroup

From: Neil Korpusik <Neil.Korpusik_at_.....>
Date: Fri Jul 31 2009 - 18:24:52 PDT
Forwarding email from a non-member (Devraj Goyal)

-------- Original Message --------
Date: Fri, 31 Jul 2009 16:39:37 +0530
From: Devraj Goyal <devrajg@cadence.com>
To: <sv-ec@server.eda.org>
Subject: new-ing of class embedded covergroup

Hi,

We have a query regarding new-ing of class embedded covergroup.

Ae per LRM (section 19.4):
"An embedded covergroup variable may only be assigned in the new method.
An embedded coverage group can be explicitly instantiated in the new
method. If it is not, then the coverage group is not created and no data
will be sampled."

This doesn't explicitly prohibit new-ing of one embedded covergroup in
another new method (example1 and example2, below), but it appears that
covergroup declared inside one class should be new-ed in the constructor
of the same class.

Please let us know your view on this.

Thanks,
Devraj

=========
Example1
=========
module top;
  class c1 ;
   reg m;
       covergroup cg;
                 coverpoint m;
       endgroup
   endclass

    class c2;
      c1 c1_obj;
      function new;
         c1_obj = new;
         c1_obj.cg = new;                    //Should this be allowed ?
      endfunction
    endclass

c2 c2_obj = new;
endmodule

=============
Example 2
=============
module top;
         reg clk;
         class c2;
               reg [4:0]p1;
         covergroup cg @clk;
            coverpoint p1;
         endgroup

         endclass
         class c1 extends c2;
               reg [4:0]p2;
               covergroup cg @clk;
                  coverpoint p1;
               endgroup
               function new(); p1 = 3;
                  super.cg = new ;               // Should this be allowed ?
              endfunction
         endclass
     c1 pc1;

endmodule



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Jul 31 18:25:50 2009

This archive was generated by hypermail 2.1.8 : Fri Jul 31 2009 - 18:26:42 PDT