IEEE 200X Fast Track Change Proposal ID: FT-16 Proposer: Jim Lewis email: Jim@SynthWorks.com Status: Proposed Proposed: 12/03 Analyzed: Date Resolved: Date Enhancement Summary: The context is a design unit that contains library declarations and package references. Related issues: Relevant LRM section: Enhancement Detail: A context is a design unit that contains library declarations and package references. Referencing a context is equivalent to referencing the libraries and packages locally. Exactly one context is permitted to be referenced by a design unit. A context clause may reference other context clauses. A context is referenced by context reference: Library Lib_P1 ; context Lib_P1.project1_ctx ; There exists a context in the work library named default_context. With the perspective of the current language definition, the default_context contains: Context default_context is library std ; use std.standard.all ; library work ; end ; To promote the use of ieee standard packages, the proposal recommends that the default context be the following: Context default_context is library std ; use std.standard.all ; library work ; library ieee ; use ieee.std_logic_1164.all; use ieee.numeric_std.all ; use std.textio.all ; end; Analysis: ---------------------------- Analyzed by: Peter Ashenden Date analyzed: 24-Nov-04 Last revised: 24-Nov-04 The intention is that a context be defined as a unit in a library so that it can be referenced by other units. This suggests that a context should be a declaration, and specifically a primary unit, so that it can be referenced using a selected name like any other unit in a library and so that no other primary unit in the library can have the same name. LCS: Add context_declaration to the production for primary_unit in 11.1. As a consequence, a context declaration is considered to be a declaration, since primary_unit is included as an alternative in the production for declaration in Clause 4. It should be an error if the context clause preceding a primary unit that is a context declaration contains anything. However, a context declaration should not be considered a declarative region. It is intended to contain only library clauses, use clauses and context references that introduce names into root declarative regions. Hence, context regions should not be included in the list of declarative regions in 10.1. A context declaration may include library clauses, use clauses and references to context declarations. LCS: Insert a new subclause in Clause 11 to describe context declarations. The grammar should be context_declaration ::= context identifier is context_declarative_part end [ context ] [ context_simple_name ] ; context_declarative_part ::= { context_declarative_item } context_declarative_item ::= context_item | context_reference context_reference ::= context selected_name { , selected_name } ; Example: context project_context is use project_lib.project_defs.all; library IP_lib; use IP_lib.all; end context project_context; The proposal suggests that a default context be declared, containing library clauses naming STD and WORK and a use clause for STD.STANDARD.all. The proposal suggests that this be used if no context reference is included in a context clause. However, this admits of a model not using STD.STANDARD.all (if the model only refers to explicit context declarations that do not use that package). It would be safer to specify that, when determining the context for a design unit, the standard library and use clauses are included as a starting point. The proposal goes on to suggest that the default context be extended to include a library clause for IEEE and use clauses for the standard packages in IEEEE. However, that would break existing models that use packages containing declarations that are homographs of declarations in std_logic_1164, numeric_std, etc. If an organization or project wants to include use clauses for those packages, it can develop an appropriate context declaration for its design units. What would be appropriate would be to define a context in library IEEE that refers to the standard packages in that library. Since there are packages that declare homographs (e.g., numeric_bit.unsigned and numeric_std.unsigned), they should not be used in the same contexts. A context for std_logic based packages is as follows: context IEEE_STD_CONTEXT is use IEEE.STD_LOGIC_1164.all; use IEEE.NUMERIC_STD.all; use IEEE.FIXED_PKG.all; use ... end context IEEE_STD_CONTEXT; Note that a context declaration and a context reference use a newly introduced reserved word, context. Introduction of a new reserved word has an adverse effect on legacy models. Context clauses are described in 11.3 as defining the initial name environment in which a design unit is analyzed. This needs to be revised to allow reference to a single context declaration as an alternative. Since the context declaration may reside in a resource library, the alternative needs to allow for a library clause to define the library logical name. LCS: Change the grammar for context_clause as follows: context_clause ::= { context_item } | [ library_clause ] context_reference Clause 11.3 refers to 11.2 describing the effect of a library clause in a context clause and to 10.4 decscribing the effect of a use clause in a context clause. Clause 11.3 should be extended to describe the effect of a context reference. A context reference in a context clause should be equivalent to an expanded context clause consisting only of context items. The expanded context clause should be initially contain just the context reference. Then, each context reference in the expanded context clause should be replaced with the context declarative items in the context declaration or declarations denoted by the names in the context reference. This replacement shoudl be repeated recursively until no further context references remain in the expanded context clause. It should be an error if a library logical name in a library clause in a context declaration denotes a different design library during analysis of a design unit that references the context declaration from the design library denoted by the library logical name during analysis of the context declaration. Resolution: ---------------------------- [To be performed by the 200X Fast Track Working Group]