Register
Login
Update Profile
Home
About Us
Forum
Tips & Tricks
You are here:
Forum
SVUG Community Forum
Unanswered
Active Topics
Forums
Search
Forums
>
General Discussion
>
Main Discussion Area
Subject: Access types from within packages
Prev
Next
You are not authorized to post a reply.
Author
Messages
Oldest First
Newest First
GHERVASE
Posts:2
11/28/2008 4:14 AM
Hello.
Does anyone know if there is a solution for accessing global types from within packages?
For example:
class Test;
endclass
package p;
class MyTest extends Test;
endclass
endpackage
I know there are constructs such as "$unit" and "$root" but these can't be used for accessing types.
Thank you very much.
SHALOM
Posts:43
11/30/2008 6:04 AM
Who said $unit cannot be used for accessing types?
I know there are constructs such as "$unit" and "$root" but these can't be used for accessing types.
Shalom Bresticker
GHERVASE
Posts:2
12/02/2008 2:29 AM
Hi.
$unit can't be used for accessing types from packages.
class Test;
endclass
package p;
class MyTest extends $unit::Test;
endclass
endpackage
I have tried both VCS (from Synopsis) and Questasim.
In VCS, $unit is not implemented, and in questasim I get "unit cannot be used from packages".
SHALOM
Posts:43
12/02/2008 3:19 AM
The restriction that $unit cannot be accessed from packages was clarified in Mantis 1484 (http://www.eda-stds.org/svdb/view.php?id=1484 (login guest/guest)), and the draft of the new LRM says, "A package shall not refer to items defined in the compilation unit scope."
However, you could declare class Test in another package and then refer to it this way:
package q;
class Test;
endclass
endpackage
package p;
class MyTest extends q::Test;
endclass
endpackage
or this way:
package p;
import q::*;
class MyTest extends Test;
endclass
endpackage
Shalom
SHALOM
Posts:43
12/02/2008 3:20 AM
However, in the general case, "$unit::" can be used to refer to a type name declared in $unit.
Shalom
You are not authorized to post a reply.
General Discussion
--Main Discussion Area
--News & Events
SVUG Archive
--Archive
----Queue as Function/Task Argument (ref)
----How to call Verilog tasks (Test bench) inside a Sy
----Modelling memory
----Ports in Interfaces
----FEM-BEM coupling in ANSYS
----Is semaphore put a task?
----checkpoint vs constraint??
----Hierarchical interfaces
----Using SVA inside classes, a possibility?
----Any suggestions for SVA of Finite State Machine
----What is the process for standardizing base classes
----Looking for reviewers for our new book
----AVM or VMM?
----New to SV
----Interface Wires(??)
----SV modport/clocking block: reading output port
----"Scoreboard" - where did this name come from??
----DPI: passing a list between C and system Verilog
--Cliff-Notes
Forums
>
General Discussion
>
Main Discussion Area
> Access types from within packages
ActiveForums 3.7
Copyright 2008 by SystemVerilog User Group
Contact Us
Privacy Statement