VHDL Issue Number: 1028 Classification: Language Definition Problem Language Version: VHDL-93 Summary: Is the entity identifier directly visible in architecture bodies and configuration declarations? Related Issues: Supersedes IR 0135 Relevant LRM Sections: 1.2, 1.3, 10.3 Key Words and Phrases: Architecture Bodies, Configuration Declarations, Visibility Rules Current Status: Analyzed ?? IN PROGRESS ?? 1076-1993 Disposition: N/A Disposition Rationale: N/A Superseded By: N/A ----------------------- Date Submitted: 1994/03/30 Author of Submission: Andy S. Tsay Author's Affiliation: Fintronic USA, Inc. Author's Post Address: 1360 Willow Road, Suite 205 Menlo Park, CA 94025 Author's Phone Number: 415-325-4474 X121 Author's Fax Number: 415-325-4940 Author's Net Address: tsay@fintronic.com ----------------------- Date Analyzed: 1995/03/10 (?? IN PROGRESS ??) Author of Analysis: Daniel S. Barclay Revision Number: $Revision: 1.11 $ Date Last Revised: $Date: 1995/05/15 20:07:17 $ Description of Problem ---------------------- According to LRM 10.1, the following text forms a single declarative region: An entity declaration, together with a corresponding architecture body. LRM 10.2 says the immediate scope of a declaration extends from the beginning of the declaration to the end of the declarative region. LRM 10.3 says a declaration is said to be directly visible within a certain part of its immediate scope; this parts extends to the end of the immediate scope of the declaration, but excludes places where the declaration is hidden. The entity declaration should be directly visible in the corresponding architecture body according to the above rules. However, a strict reading of the LRM indicates that the entity identifier in a configuration declaration must be referred to as WORK.entityName rather than just entityName according to the visibility rules of the language unless there is a "USE WORK.ALL" clause in effect. LRM 1.3.1 associates the visibility of the declarative part of a block with the corresponding block configuration. But this does not solve the direct visibility of the entity identifier in the configuration declaration. LRM 1.3 says that "For a configuration of a given design entity, both the configuration declaration and the corresponding entity declaration must reside in the same library." A strict adherence to the LRM does not change the interpretation of any correct construction, it would only have the effect of saying that some constructions that are completely clear and unambiguous should be flagged as an error. Proposed Resolution ------------------- The above entity should be directly visible, and that the LRM be changed to clarify this. VASG-ISAC Analysis & Rationale ------------------------------ ?? IN PROGRESS ?? There are two issues: Whether the simple name of the entity can be used as the entity name in the architecture, and whether a selected name for the entity is allowed. Whether the simple name can be used in architecture devolves to whether the entity declaration (and its name) is directly visible at the place of the entity name in the architecture. Let's consider the visibility of an entity declaration and its name: Section 10.1 defines the term declarative region and defines which constructs are declaration regions: A declarative region is a portion of the text of the description. A single declarative region is formed by the text of each of the following: a) An entity declaration, together with a corresponding architecture body. b) A configuration declaration. c) A subprogram declaration, together with the corresponding subprogram body. d) A package declaration, together with the corresponding body (if any). e) A record type declaration. f) A component declaration. g) A block statement. h) A process statement. i) A loop statement. j) A block configuration. k) A component configuration. l) A generate statement. In each of these cases, the declarative region is said to be associated with the corresponding declaration or statement. A declaration is said to occur immediately within a declarative region if this region is the innermost region that encloses the declaration, not counting the declarative region (if any) associated with the declaration itself. Note the last sentence. Obviously, an entity declaration never occurs inside any of these constructs. By the last sentence, an entity declaration does occur immediately within itself, so an entity declaration never occurs immediately within a declarative region. In section 10.2, the second paragraph defines the scope and the immediate scope of certain declarations: The scope of a declaration that occurs immediately within a declarative region extends from the beginning of the declaration to the end of the declarative region; this part of the scope of a declaration is called the immediate scope. ... Given that an entity declaration does not occur immediately within a declarative region, this paragraph does not apply to entity declarations. There is no additional definition of immediate scope. Therefore, an entity declaration has no immediate scope. No other definition of scope applies to entity declarations with respect to architecture bodies. Section 10.3 defines the visibility of declarations and names. The fifth paragraph says: A declaration is only visible within a certain part of its scope; this part starts at the end of the declaration except in the declaration of a design unit, in which case it starts immediately after the reserved word is occuring after the identifier of the design unit. ... Given that an declaration entity has no scope, it is not visible anywhere. Even more specifically, the twentieth paragraph begins to define direct visibility: Where it is not visible by selection, a visible declaration is said to be directly visible. A declaration is said to be directly visible within a certain part of its immediate scope; this part extends to the end of the immediate scope of the declaration but excludes places where the declaration is hidden as explained in the following paragraphs. ... Given that an entity declaration has no immediate scope, it is not directly visible anywhere. Given that an entity declaration is not directly visible anywhere, a simple name cannot be used to denote an entity declaration. Given that an entity declaration is not visible at all anywhere, no name at all can be used to denote an entity declaration. Therefore, no name is legal to be the entity name in an architecture body, so no legal architecture bodies exist. Obviously, this is not the intent of VHDL. The problem appears to be in the wording "that occurs immediately within a declarative region" in the second paragraph in section 10.2: The scope of a declaration that occurs immediately within a declarative region extends from the beginning of the declaration to the end of the declarative region; this part of the scope of a declaration is called the immediate scope. ... Because design units are not defined to occur in any declarative region, design units that are declarations are not covered by the above paragraph, so no scope is ever defined for them. This problem results from the change between Ada and VHDL. In Ada, all library units were considered to be declared in package Standard. Therefore, in Ada, they occurred immediately within a declarative region and this wording covered them. It is not clear how to fix this problem. How it is fixed affects whether an entity declaration is visible in its architectures. Given that the scope of a declaration normally extends from the beginning of the declaration to the end of the enclosing declarative region, the scope extends from the beginning of the declaration to at least the end of the declaration. In section 10.2, the last paragraph says: Certain declarative regions include disjoint parts. Each declarative region is nevertheless considered as a (logically) continuous portion of the description text. Hence, if any rule defines a portion of text as the text that extends from some specific point of a declarative region to the end of this region, then this portion is the corre- sponding subset of the declarative region (thus, it does not include intermediate declarative items between the interface declaration and a corresponding body declaration). The intent appears to be that separate constructs that make up a single declarative region be treated as much as possible as a single unit. (?? need a little supporting evidence ??) Therefore, since the scope of an entity declaration includes the entire entity declaration, is should also include the entire architecture body, since the architecture body is part of the same declarative region. (Recall that the scope of an entity declaration extends from the beginning of the entity declaration. Recall that an entity declaration along with a corresponding architecture body is a declarative region. Therefore, the beginning of the entity declaration is "a specific point of a declarative region". (Well, the beginning of a declaration is a point in the immediate context of the declaration as well as the very first point in the declaration itself, so this is still fuzzy.)) ... TBD TBD ... ?? IN PROGRESS ?? VASG-ISAC Recommendation for IEEE Std 1076-1993 ----------------------------------------------- TBD VASG-ISAC Recommendation for Future Revisions --------------------------------------------- TBD