RE: [sv-ec] $root vs $unit

From: Warmke, Doug <doug_warmke_at_.....>
Date: Tue Nov 06 2007 - 11:15:41 PST
There is still at least one use for $root:
Disambiguating names during upward searches.

module top;
    logic a = 1'b0;
    bottom top();
    initial begin
        $display("top.a = %b", top.a);                // Should print 1
        $display("$root.top.a = %b", $root.top.a);    // Should print 0
    end
endmodule

module bottom;
    logic a = 1'b1;
endmodule

Regards,
Doug

-----Original Message-----
From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org] On
Behalf Of Steven Sharp
Sent: Tuesday, November 06, 2007 10:43 AM
To: Vreugdenhil, Gordon; danielm@aldec.com.pl; Mark.Hartoog@synopsys.com
Cc: shalom.bresticker@intel.com; sv-ec@server.eda.org
Subject: RE: [sv-ec] $root vs $unit


>As Gord indicates $root.<typeName> is illegal in P1800.

The illegality goes beyond the fact that hierarchical names are
not allowed in type references.  It would also be illegal to have
$root.<varName>.  The LRM says that $root can be added to the front
of a hiearchical name.  But a hierarchical name must start with a
scope (which would have to be a top-level instance in this case).

I don't think I have ever seen this pointed out before, but it
follows from the LRM text, and neatly avoids a problem.

As Shalom pointed out, $root.<identifier> could be ambiguous if
the same identifier name appears in multiple $units.  However, this
is not a legal hierarchical name unless <identifier> is a top-level
instance.  Since top-level instance names must be unique, the problem
is avoided.

So the old meaning of $root to talk about things in the top-level
scope is completely gone, replaced by $unit.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Nov 6 11:16:02 2007

This archive was generated by hypermail 2.1.8 : Tue Nov 06 2007 - 11:16:18 PST