Construction of embedded covergroup (defined in a class)

4 posts / 0 new
Last post
ben@SystemVerilog.us
Offline
Academy Total Access User
Joined: 03/23/2010
Posts: 14
Construction of embedded covergroup (defined in a class)

Is this a tool issue or a SystemVerilog language issue?
Compilation with code below yielded the following:
"Construction of embedded covergroup (defined in a class) is not supported except in constructor 'new()' of covergroup's parent class"
virtual function void build();
super.build();
m_xactn=counter_xactn::type_id::create("m_xactn", this);
this.cntr_cvg = new(); // *** TOOL SAYS NO ON THIS *** ?Q*&&?QW?????
endfunction : build

function new(string name, uvm_component parent);
super.new(name,parent);
m_name=get_type_name();
m_name=m_name.toupper();
// m_xactn=counter_xactn::type_id::create("m_xactn", this);
// // m_aport = new("m_aport", this);
// this.cntr_cvg = new(); // *** TOOL WANTS THIS // ONLY OK ON THIS
endfunction : new

endclass : counter_monitor_cvg

dave_59
Offline
Verification Forum Moderator
Joined: 03/10/2010
Posts: 976
Re: Construction of embedded covergroup (defined in a class)
LRM 19.4 Using covergroup in classes wrote:
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.

__________________

Dave Rich
Mentor Graphics
http://go.mentor.com/drich

ben@SystemVerilog.us
Offline
Academy Total Access User
Joined: 03/23/2010
Posts: 14
Re: Construction of embedded covergroup (defined in a class)

Dave,
Thanks. Why this restriction on covergroup? Are there other things that "have to be in the new()" instead of the "build"?

dave_59
Offline
Verification Forum Moderator
Joined: 03/10/2010
Posts: 976
Re: Construction of embedded covergroup (defined in a class)

Three things that the language requires to be in new()

  • An implicit or explicit call to super.new() as the first statement to handle non-default constructor arguments.
  • Assignments to const class members that do not already have declaration initializations.
  • Embedded covergroup constructors.

I believe the embedded covergroup restriction has to do the fact that the covergroup is really part of the class type, and its construction has to be in synchronization with the class construction. And there are problems with per-class-type covergroup collection as well of the construction of all covergroups is not synchronized.

__________________

Dave Rich
Mentor Graphics
http://go.mentor.com/drich