aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/evaluation.adb17
-rw-r--r--src/vhdl/iirs.adb16
-rw-r--r--src/vhdl/iirs.ads113
-rw-r--r--src/vhdl/iirs_utils.adb21
-rw-r--r--src/vhdl/iirs_utils.ads9
-rw-r--r--src/vhdl/nodes_meta.adb338
-rw-r--r--src/vhdl/nodes_meta.ads2
-rw-r--r--src/vhdl/sem_decls.adb6
-rw-r--r--src/vhdl/sem_scopes.adb134
-rw-r--r--src/vhdl/translate/trans-chap7.adb19
10 files changed, 444 insertions, 231 deletions
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb
index 850691045..bd3b9e286 100644
--- a/src/vhdl/evaluation.adb
+++ b/src/vhdl/evaluation.adb
@@ -1380,23 +1380,6 @@ package body Evaluation is
| Iir_Predefined_File_Open_Status
| Iir_Predefined_File_Close
| Iir_Predefined_Endfile
- | Iir_Predefined_Attribute_Image
- | Iir_Predefined_Attribute_Value
- | Iir_Predefined_Attribute_Pos
- | Iir_Predefined_Attribute_Val
- | Iir_Predefined_Attribute_Succ
- | Iir_Predefined_Attribute_Pred
- | Iir_Predefined_Attribute_Rightof
- | Iir_Predefined_Attribute_Leftof
- | Iir_Predefined_Attribute_Left
- | Iir_Predefined_Attribute_Right
- | Iir_Predefined_Attribute_Event
- | Iir_Predefined_Attribute_Active
- | Iir_Predefined_Attribute_Last_Value
- | Iir_Predefined_Attribute_Last_Event
- | Iir_Predefined_Attribute_Last_Active
- | Iir_Predefined_Attribute_Driving
- | Iir_Predefined_Attribute_Driving_Value
| Iir_Predefined_Array_Char_To_String
| Iir_Predefined_Bit_Vector_To_Ostring
| Iir_Predefined_Bit_Vector_To_Hstring =>
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index b2ed4ac5a..6f2ce5aa4 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -3394,6 +3394,22 @@ package body Iirs is
Set_Flag4 (Atype, Flag);
end Set_Index_Constraint_Flag;
+ function Get_Hide_Implicit_Flag (Subprg : Iir) return Boolean is
+ begin
+ pragma Assert (Subprg /= Null_Iir);
+ pragma Assert (Has_Hide_Implicit_Flag (Get_Kind (Subprg)),
+ "no field Hide_Implicit_Flag");
+ return Get_Flag12 (Subprg);
+ end Get_Hide_Implicit_Flag;
+
+ procedure Set_Hide_Implicit_Flag (Subprg : Iir; Flag : Boolean) is
+ begin
+ pragma Assert (Subprg /= Null_Iir);
+ pragma Assert (Has_Hide_Implicit_Flag (Get_Kind (Subprg)),
+ "no field Hide_Implicit_Flag");
+ Set_Flag12 (Subprg, Flag);
+ end Set_Hide_Implicit_Flag;
+
function Get_Assertion_Condition (Target : Iir) return Iir is
begin
pragma Assert (Target /= Null_Iir);
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 4f954a1eb..408687925 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -1294,6 +1294,10 @@ package Iirs is
-- Only for Iir_Kind_Procedure_Declaration:
-- Get/Set_Suspend_Flag (Flag11)
--
+ -- For an explicit subprogram: true if the declaration is an homograph of
+ -- an implicit operation of a type.
+ -- Get/Set_Hide_Implicit_Flag (Flag12)
+ --
-- Get/Set_Wait_State (State1)
--
-- Only for Iir_Kind_Procedure_Declaration:
@@ -3985,7 +3989,9 @@ package Iirs is
(
Iir_Predefined_Error,
- -- Predefined operators for BOOLEAN type.
+ -- Predefined operators for BOOLEAN type
+
+ -- LRM08 9.2.2 Logical Operators
Iir_Predefined_Boolean_And,
Iir_Predefined_Boolean_Or,
Iir_Predefined_Boolean_Nand,
@@ -3994,10 +4000,13 @@ package Iirs is
Iir_Predefined_Boolean_Xnor,
Iir_Predefined_Boolean_Not,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Boolean_Rising_Edge,
Iir_Predefined_Boolean_Falling_Edge,
-- Predefined operators for any enumeration type.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Enum_Equality,
Iir_Predefined_Enum_Inequality,
Iir_Predefined_Enum_Less,
@@ -4005,11 +4014,14 @@ package Iirs is
Iir_Predefined_Enum_Greater,
Iir_Predefined_Enum_Greater_Equal,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Enum_Minimum,
Iir_Predefined_Enum_Maximum,
Iir_Predefined_Enum_To_String,
-- Predefined operators for BIT type.
+
+ -- LRM08 9.2.2 Logical Operators
Iir_Predefined_Bit_And,
Iir_Predefined_Bit_Or,
Iir_Predefined_Bit_Nand,
@@ -4018,6 +4030,7 @@ package Iirs is
Iir_Predefined_Bit_Xnor,
Iir_Predefined_Bit_Not,
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Bit_Match_Equality,
Iir_Predefined_Bit_Match_Inequality,
Iir_Predefined_Bit_Match_Less,
@@ -4025,12 +4038,16 @@ package Iirs is
Iir_Predefined_Bit_Match_Greater,
Iir_Predefined_Bit_Match_Greater_Equal,
+ -- LRM08 9.2.9 Condition operator
Iir_Predefined_Bit_Condition,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Bit_Rising_Edge,
Iir_Predefined_Bit_Falling_Edge,
-- Predefined operators for any integer type.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Integer_Equality,
Iir_Predefined_Integer_Inequality,
Iir_Predefined_Integer_Less,
@@ -4038,24 +4055,34 @@ package Iirs is
Iir_Predefined_Integer_Greater,
Iir_Predefined_Integer_Greater_Equal,
+ -- LRM08 9.2.6 Sign operators
Iir_Predefined_Integer_Identity,
Iir_Predefined_Integer_Negation,
+
+ -- LRM08 9.2.8 Miscellaneous operators
Iir_Predefined_Integer_Absolute,
+ -- LRM08 9.2.5 Adding operators
Iir_Predefined_Integer_Plus,
Iir_Predefined_Integer_Minus,
+
+ -- LRM08 9.2.7 Multiplying operators
Iir_Predefined_Integer_Mul,
Iir_Predefined_Integer_Div,
Iir_Predefined_Integer_Mod,
Iir_Predefined_Integer_Rem,
+ -- LRM08 9.2.8 Miscellaneous operators
Iir_Predefined_Integer_Exp,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Integer_Minimum,
Iir_Predefined_Integer_Maximum,
Iir_Predefined_Integer_To_String,
-- Predefined operators for any floating type.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Floating_Equality,
Iir_Predefined_Floating_Inequality,
Iir_Predefined_Floating_Less,
@@ -4063,30 +4090,41 @@ package Iirs is
Iir_Predefined_Floating_Greater,
Iir_Predefined_Floating_Greater_Equal,
+ -- LRM08 9.2.6 Sign operators
Iir_Predefined_Floating_Identity,
Iir_Predefined_Floating_Negation,
+
+ -- LRM08 9.2.8 Miscellaneous operators
Iir_Predefined_Floating_Absolute,
+ -- LRM08 9.2.5 Adding operators
Iir_Predefined_Floating_Plus,
Iir_Predefined_Floating_Minus,
+
+ -- LRM08 9.2.7 Multiplying operators
Iir_Predefined_Floating_Mul,
Iir_Predefined_Floating_Div,
+ -- LRM08 9.2.8 Miscellaneous operators
Iir_Predefined_Floating_Exp,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Floating_Minimum,
Iir_Predefined_Floating_Maximum,
Iir_Predefined_Floating_To_String,
-
Iir_Predefined_Real_To_String_Digits,
Iir_Predefined_Real_To_String_Format,
-- Predefined operator for universal types.
+
+ -- LRM08 9.2.7 Multiplying operators
Iir_Predefined_Universal_R_I_Mul,
Iir_Predefined_Universal_I_R_Mul,
Iir_Predefined_Universal_R_I_Div,
-- Predefined operators for physical types.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Physical_Equality,
Iir_Predefined_Physical_Inequality,
Iir_Predefined_Physical_Less,
@@ -4094,13 +4132,18 @@ package Iirs is
Iir_Predefined_Physical_Greater,
Iir_Predefined_Physical_Greater_Equal,
+ -- LRM08 9.2.6 Sign operators
Iir_Predefined_Physical_Identity,
Iir_Predefined_Physical_Negation,
+
+ -- LRM08 9.2.8 Miscellaneous operators
Iir_Predefined_Physical_Absolute,
+ -- LRM08 9.2.5 Adding operators
Iir_Predefined_Physical_Plus,
Iir_Predefined_Physical_Minus,
+ -- LRM08 9.2.7 Multiplying operators
Iir_Predefined_Physical_Integer_Mul,
Iir_Predefined_Physical_Real_Mul,
Iir_Predefined_Integer_Physical_Mul,
@@ -4109,21 +4152,27 @@ package Iirs is
Iir_Predefined_Physical_Real_Div,
Iir_Predefined_Physical_Physical_Div,
+ -- LRM08 5.2.6 Predefined operations on scalar types.
Iir_Predefined_Physical_Minimum,
Iir_Predefined_Physical_Maximum,
Iir_Predefined_Physical_To_String,
-
Iir_Predefined_Time_To_String_Unit,
-- Predefined operators for access.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Access_Equality,
Iir_Predefined_Access_Inequality,
-- Predefined operators for record.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Record_Equality,
Iir_Predefined_Record_Inequality,
-- Predefined operators for array.
+
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Array_Equality,
Iir_Predefined_Array_Inequality,
Iir_Predefined_Array_Less,
@@ -4131,17 +4180,19 @@ package Iirs is
Iir_Predefined_Array_Greater,
Iir_Predefined_Array_Greater_Equal,
+ -- LRM08 9.2.5 Adding operators
Iir_Predefined_Array_Array_Concat,
Iir_Predefined_Array_Element_Concat,
Iir_Predefined_Element_Array_Concat,
Iir_Predefined_Element_Element_Concat,
+ -- LRM08 5.3.2.4 Predefined operations on array types
Iir_Predefined_Array_Minimum,
Iir_Predefined_Array_Maximum,
Iir_Predefined_Vector_Minimum,
Iir_Predefined_Vector_Maximum,
- -- Predefined shift operators.
+ -- LRM08 9.2.4 Shift operators
Iir_Predefined_Array_Sll,
Iir_Predefined_Array_Srl,
Iir_Predefined_Array_Sla,
@@ -4149,6 +4200,7 @@ package Iirs is
Iir_Predefined_Array_Rol,
Iir_Predefined_Array_Ror,
+ -- LRM08 9.2.2 Logical operators
-- Predefined operators for one dimensional array.
-- For bit and boolean type, the operations are the same. To be
-- neutral, we use TF (for True/False) instead of Bit, Boolean or
@@ -4161,6 +4213,7 @@ package Iirs is
Iir_Predefined_TF_Array_Xnor,
Iir_Predefined_TF_Array_Not,
+ -- LRM08 9.2.2 Logical operators
Iir_Predefined_TF_Reduction_And,
Iir_Predefined_TF_Reduction_Or,
Iir_Predefined_TF_Reduction_Nand,
@@ -4169,6 +4222,7 @@ package Iirs is
Iir_Predefined_TF_Reduction_Xnor,
Iir_Predefined_TF_Reduction_Not,
+ -- LRM08 9.2.2 Logical operators
Iir_Predefined_TF_Array_Element_And,
Iir_Predefined_TF_Element_Array_And,
Iir_Predefined_TF_Array_Element_Or,
@@ -4182,33 +4236,16 @@ package Iirs is
Iir_Predefined_TF_Array_Element_Xnor,
Iir_Predefined_TF_Element_Array_Xnor,
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Bit_Array_Match_Equality,
Iir_Predefined_Bit_Array_Match_Inequality,
- -- Predefined attribute functions.
- Iir_Predefined_Attribute_Image,
- Iir_Predefined_Attribute_Value,
- Iir_Predefined_Attribute_Pos,
- Iir_Predefined_Attribute_Val,
- Iir_Predefined_Attribute_Succ,
- Iir_Predefined_Attribute_Pred,
- Iir_Predefined_Attribute_Leftof,
- Iir_Predefined_Attribute_Rightof,
- Iir_Predefined_Attribute_Left,
- Iir_Predefined_Attribute_Right,
- Iir_Predefined_Attribute_Event,
- Iir_Predefined_Attribute_Active,
- Iir_Predefined_Attribute_Last_Event,
- Iir_Predefined_Attribute_Last_Active,
- Iir_Predefined_Attribute_Last_Value,
- Iir_Predefined_Attribute_Driving,
- Iir_Predefined_Attribute_Driving_Value,
-
- -- To_String
+ -- LRM08 5.3.2.4 Predefined operations on array types
Iir_Predefined_Array_Char_To_String,
Iir_Predefined_Bit_Vector_To_Ostring,
Iir_Predefined_Bit_Vector_To_Hstring,
+ -- LRM08 9.2.3 Relational Operators
-- IEEE.Std_Logic_1164.Std_Ulogic
Iir_Predefined_Std_Ulogic_Match_Equality,
Iir_Predefined_Std_Ulogic_Match_Inequality,
@@ -4217,15 +4254,35 @@ package Iirs is
Iir_Predefined_Std_Ulogic_Match_Greater,
Iir_Predefined_Std_Ulogic_Match_Greater_Equal,
+ -- LRM08 9.2.3 Relational Operators
Iir_Predefined_Std_Ulogic_Array_Match_Equality,
Iir_Predefined_Std_Ulogic_Array_Match_Inequality,
+ -- -- Predefined attribute functions.
+ -- Iir_Predefined_Attribute_Image,
+ -- Iir_Predefined_Attribute_Value,
+ -- Iir_Predefined_Attribute_Pos,
+ -- Iir_Predefined_Attribute_Val,
+ -- Iir_Predefined_Attribute_Succ,
+ -- Iir_Predefined_Attribute_Pred,
+ -- Iir_Predefined_Attribute_Leftof,
+ -- Iir_Predefined_Attribute_Rightof,
+ -- Iir_Predefined_Attribute_Left,
+ -- Iir_Predefined_Attribute_Right,
+ -- Iir_Predefined_Attribute_Event,
+ -- Iir_Predefined_Attribute_Active,
+ -- Iir_Predefined_Attribute_Last_Event,
+ -- Iir_Predefined_Attribute_Last_Active,
+ -- Iir_Predefined_Attribute_Last_Value,
+ -- Iir_Predefined_Attribute_Driving,
+ -- Iir_Predefined_Attribute_Driving_Value,
+
-- Impure subprograms.
- -- Access procedure
+ -- LRM08 5.4.3 Allocation and deallocation of objects
Iir_Predefined_Deallocate,
- -- File function / procedures.
+ -- LRM08 5.5.2 File operations
Iir_Predefined_File_Open,
Iir_Predefined_File_Open_Status,
Iir_Predefined_File_Close,
@@ -6101,6 +6158,10 @@ package Iirs is
function Get_Index_Constraint_Flag (Atype : Iir) return Boolean;
procedure Set_Index_Constraint_Flag (Atype : Iir; Flag : Boolean);
+ -- Field: Flag12
+ function Get_Hide_Implicit_Flag (Subprg : Iir) return Boolean;
+ procedure Set_Hide_Implicit_Flag (Subprg : Iir; Flag : Boolean);
+
-- Condition of an assertion.
-- Field: Field1
function Get_Assertion_Condition (Target : Iir) return Iir;
diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb
index cf12e556a..e5e9a5acf 100644
--- a/src/vhdl/iirs_utils.adb
+++ b/src/vhdl/iirs_utils.adb
@@ -945,6 +945,27 @@ package body Iirs_Utils is
return True;
end Is_Same_Profile;
+ function Is_Operation_For_Type (Subprg : Iir; Atype : Iir) return Boolean
+ is
+ pragma Assert (Get_Kind (Subprg) in Iir_Kinds_Subprogram_Declaration);
+ Base_Type : constant Iir := Get_Base_Type (Atype);
+ Inter : Iir;
+ begin
+ Inter := Get_Interface_Declaration_Chain (Subprg);
+ while Inter /= Null_Iir loop
+ if Get_Base_Type (Get_Type (Inter)) = Base_Type then
+ return True;
+ end if;
+ Inter := Get_Chain (Inter);
+ end loop;
+ if Get_Kind (Subprg) = Iir_Kind_Function_Declaration
+ and then Get_Base_Type (Get_Return_Type (Subprg)) = Base_Type
+ then
+ return True;
+ end if;
+ return False;
+ end Is_Operation_For_Type;
+
-- From a block_specification, returns the block.
function Get_Block_From_Block_Specification (Block_Spec : Iir)
return Iir
diff --git a/src/vhdl/iirs_utils.ads b/src/vhdl/iirs_utils.ads
index d92f7aa63..de63f5af4 100644
--- a/src/vhdl/iirs_utils.ads
+++ b/src/vhdl/iirs_utils.ads
@@ -185,6 +185,15 @@ package Iirs_Utils is
-- L and R must be subprograms specification (or spec_body).
function Is_Same_Profile (L, R: Iir) return Boolean;
+ -- Return true iff FUNC is an operation for ATYPE.
+ --
+ -- LRM08 5.1 Types
+ -- The set of operations of a type includes the explicitely declared
+ -- subprograms that have a parameter or result of the type. The remaining
+ -- operations of a type are the base operations and the predefined
+ -- operations.
+ function Is_Operation_For_Type (Subprg : Iir; Atype : Iir) return Boolean;
+
-- From a block_specification, returns the block.
-- Roughly speaking, this get prefix of indexed and sliced name.
function Get_Block_From_Block_Specification (Block_Spec : Iir)
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index c97e24ca4..c49975a73 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -198,6 +198,7 @@ package body Nodes_Meta is
Field_Purity_State => Type_Iir_Pure_State,
Field_Elab_Flag => Type_Boolean,
Field_Index_Constraint_Flag => Type_Boolean,
+ Field_Hide_Implicit_Flag => Type_Boolean,
Field_Assertion_Condition => Type_Iir,
Field_Report_Expression => Type_Iir,
Field_Severity_Expression => Type_Iir,
@@ -689,6 +690,8 @@ package body Nodes_Meta is
return "elab_flag";
when Field_Index_Constraint_Flag =>
return "index_constraint_flag";
+ when Field_Hide_Implicit_Flag =>
+ return "hide_implicit_flag";
when Field_Assertion_Condition =>
return "assertion_condition";
when Field_Report_Expression =>
@@ -1815,6 +1818,8 @@ package body Nodes_Meta is
return Attr_None;
when Field_Index_Constraint_Flag =>
return Attr_None;
+ when Field_Hide_Implicit_Flag =>
+ return Attr_None;
when Field_Assertion_Condition =>
return Attr_None;
when Field_Report_Expression =>
@@ -2810,6 +2815,7 @@ package body Nodes_Meta is
Field_Subprogram_Hash,
Field_Implicit_Definition,
Field_Seen_Flag,
+ Field_Hide_Implicit_Flag,
Field_Pure_Flag,
Field_Foreign_Flag,
Field_Visible_Flag,
@@ -2836,6 +2842,7 @@ package body Nodes_Meta is
Field_Implicit_Definition,
Field_Seen_Flag,
Field_Suspend_Flag,
+ Field_Hide_Implicit_Flag,
Field_Passive_Flag,
Field_Foreign_Flag,
Field_Visible_Flag,
@@ -4162,164 +4169,164 @@ package body Nodes_Meta is
Iir_Kind_Across_Quantity_Declaration => 616,
Iir_Kind_Through_Quantity_Declaration => 628,
Iir_Kind_Enumeration_Literal => 639,
- Iir_Kind_Function_Declaration => 663,
- Iir_Kind_Procedure_Declaration => 686,
- Iir_Kind_Function_Body => 696,
- Iir_Kind_Procedure_Body => 707,
- Iir_Kind_Object_Alias_Declaration => 719,
- Iir_Kind_File_Declaration => 734,
- Iir_Kind_Guard_Signal_Declaration => 747,
- Iir_Kind_Signal_Declaration => 764,
- Iir_Kind_Variable_Declaration => 777,
- Iir_Kind_Constant_Declaration => 791,
- Iir_Kind_Iterator_Declaration => 803,
- Iir_Kind_Interface_Constant_Declaration => 819,
- Iir_Kind_Interface_Variable_Declaration => 835,
- Iir_Kind_Interface_Signal_Declaration => 856,
- Iir_Kind_Interface_File_Declaration => 872,
- Iir_Kind_Interface_Package_Declaration => 881,
- Iir_Kind_Identity_Operator => 885,
- Iir_Kind_Negation_Operator => 889,
- Iir_Kind_Absolute_Operator => 893,
- Iir_Kind_Not_Operator => 897,
- Iir_Kind_Condition_Operator => 901,
- Iir_Kind_Reduction_And_Operator => 905,
- Iir_Kind_Reduction_Or_Operator => 909,
- Iir_Kind_Reduction_Nand_Operator => 913,
- Iir_Kind_Reduction_Nor_Operator => 917,
- Iir_Kind_Reduction_Xor_Operator => 921,
- Iir_Kind_Reduction_Xnor_Operator => 925,
- Iir_Kind_And_Operator => 930,
- Iir_Kind_Or_Operator => 935,
- Iir_Kind_Nand_Operator => 940,
- Iir_Kind_Nor_Operator => 945,
- Iir_Kind_Xor_Operator => 950,
- Iir_Kind_Xnor_Operator => 955,
- Iir_Kind_Equality_Operator => 960,
- Iir_Kind_Inequality_Operator => 965,
- Iir_Kind_Less_Than_Operator => 970,
- Iir_Kind_Less_Than_Or_Equal_Operator => 975,
- Iir_Kind_Greater_Than_Operator => 980,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 985,
- Iir_Kind_Match_Equality_Operator => 990,
- Iir_Kind_Match_Inequality_Operator => 995,
- Iir_Kind_Match_Less_Than_Operator => 1000,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1005,
- Iir_Kind_Match_Greater_Than_Operator => 1010,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1015,
- Iir_Kind_Sll_Operator => 1020,
- Iir_Kind_Sla_Operator => 1025,
- Iir_Kind_Srl_Operator => 1030,
- Iir_Kind_Sra_Operator => 1035,
- Iir_Kind_Rol_Operator => 1040,
- Iir_Kind_Ror_Operator => 1045,
- Iir_Kind_Addition_Operator => 1050,
- Iir_Kind_Substraction_Operator => 1055,
- Iir_Kind_Concatenation_Operator => 1060,
- Iir_Kind_Multiplication_Operator => 1065,
- Iir_Kind_Division_Operator => 1070,
- Iir_Kind_Modulus_Operator => 1075,
- Iir_Kind_Remainder_Operator => 1080,
- Iir_Kind_Exponentiation_Operator => 1085,
- Iir_Kind_Function_Call => 1093,
- Iir_Kind_Aggregate => 1099,
- Iir_Kind_Parenthesis_Expression => 1102,
- Iir_Kind_Qualified_Expression => 1106,
- Iir_Kind_Type_Conversion => 1111,
- Iir_Kind_Allocator_By_Expression => 1115,
- Iir_Kind_Allocator_By_Subtype => 1121,
- Iir_Kind_Selected_Element => 1127,
- Iir_Kind_Dereference => 1132,
- Iir_Kind_Implicit_Dereference => 1137,
- Iir_Kind_Slice_Name => 1144,
- Iir_Kind_Indexed_Name => 1150,
- Iir_Kind_Psl_Expression => 1152,
- Iir_Kind_Sensitized_Process_Statement => 1172,
- Iir_Kind_Process_Statement => 1192,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1203,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1214,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1226,
- Iir_Kind_Concurrent_Assertion_Statement => 1234,
- Iir_Kind_Psl_Default_Clock => 1238,
- Iir_Kind_Psl_Assert_Statement => 1250,
- Iir_Kind_Psl_Cover_Statement => 1262,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1269,
- Iir_Kind_Block_Statement => 1282,
- Iir_Kind_If_Generate_Statement => 1292,
- Iir_Kind_For_Generate_Statement => 1301,
- Iir_Kind_Component_Instantiation_Statement => 1311,
- Iir_Kind_Simple_Simultaneous_Statement => 1318,
- Iir_Kind_Generate_Statement_Body => 1329,
- Iir_Kind_If_Generate_Else_Clause => 1334,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1343,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1352,
- Iir_Kind_Null_Statement => 1356,
- Iir_Kind_Assertion_Statement => 1363,
- Iir_Kind_Report_Statement => 1369,
- Iir_Kind_Wait_Statement => 1376,
- Iir_Kind_Variable_Assignment_Statement => 1382,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1388,
- Iir_Kind_Return_Statement => 1394,
- Iir_Kind_For_Loop_Statement => 1403,
- Iir_Kind_While_Loop_Statement => 1411,
- Iir_Kind_Next_Statement => 1417,
- Iir_Kind_Exit_Statement => 1423,
- Iir_Kind_Case_Statement => 1431,
- Iir_Kind_Procedure_Call_Statement => 1437,
- Iir_Kind_If_Statement => 1446,
- Iir_Kind_Elsif => 1451,
- Iir_Kind_Character_Literal => 1458,
- Iir_Kind_Simple_Name => 1465,
- Iir_Kind_Selected_Name => 1473,
- Iir_Kind_Operator_Symbol => 1478,
- Iir_Kind_Selected_By_All_Name => 1483,
- Iir_Kind_Parenthesis_Name => 1487,
- Iir_Kind_External_Constant_Name => 1496,
- Iir_Kind_External_Signal_Name => 1505,
- Iir_Kind_External_Variable_Name => 1514,
- Iir_Kind_Package_Pathname => 1517,
- Iir_Kind_Absolute_Pathname => 1518,
- Iir_Kind_Relative_Pathname => 1519,
- Iir_Kind_Pathname_Element => 1523,
- Iir_Kind_Base_Attribute => 1525,
- Iir_Kind_Left_Type_Attribute => 1530,
- Iir_Kind_Right_Type_Attribute => 1535,
- Iir_Kind_High_Type_Attribute => 1540,
- Iir_Kind_Low_Type_Attribute => 1545,
- Iir_Kind_Ascending_Type_Attribute => 1550,
- Iir_Kind_Image_Attribute => 1556,
- Iir_Kind_Value_Attribute => 1562,
- Iir_Kind_Pos_Attribute => 1568,
- Iir_Kind_Val_Attribute => 1574,
- Iir_Kind_Succ_Attribute => 1580,
- Iir_Kind_Pred_Attribute => 1586,
- Iir_Kind_Leftof_Attribute => 1592,
- Iir_Kind_Rightof_Attribute => 1598,
- Iir_Kind_Delayed_Attribute => 1606,
- Iir_Kind_Stable_Attribute => 1614,
- Iir_Kind_Quiet_Attribute => 1622,
- Iir_Kind_Transaction_Attribute => 1630,
- Iir_Kind_Event_Attribute => 1634,
- Iir_Kind_Active_Attribute => 1638,
- Iir_Kind_Last_Event_Attribute => 1642,
- Iir_Kind_Last_Active_Attribute => 1646,
- Iir_Kind_Last_Value_Attribute => 1650,
- Iir_Kind_Driving_Attribute => 1654,
- Iir_Kind_Driving_Value_Attribute => 1658,
- Iir_Kind_Behavior_Attribute => 1658,
- Iir_Kind_Structure_Attribute => 1658,
- Iir_Kind_Simple_Name_Attribute => 1665,
- Iir_Kind_Instance_Name_Attribute => 1670,
- Iir_Kind_Path_Name_Attribute => 1675,
- Iir_Kind_Left_Array_Attribute => 1682,
- Iir_Kind_Right_Array_Attribute => 1689,
- Iir_Kind_High_Array_Attribute => 1696,
- Iir_Kind_Low_Array_Attribute => 1703,
- Iir_Kind_Length_Array_Attribute => 1710,
- Iir_Kind_Ascending_Array_Attribute => 1717,
- Iir_Kind_Range_Array_Attribute => 1724,
- Iir_Kind_Reverse_Range_Array_Attribute => 1731,
- Iir_Kind_Attribute_Name => 1739
+ Iir_Kind_Function_Declaration => 664,
+ Iir_Kind_Procedure_Declaration => 688,
+ Iir_Kind_Function_Body => 698,
+ Iir_Kind_Procedure_Body => 709,
+ Iir_Kind_Object_Alias_Declaration => 721,
+ Iir_Kind_File_Declaration => 736,
+ Iir_Kind_Guard_Signal_Declaration => 749,
+ Iir_Kind_Signal_Declaration => 766,
+ Iir_Kind_Variable_Declaration => 779,
+ Iir_Kind_Constant_Declaration => 793,
+ Iir_Kind_Iterator_Declaration => 805,
+ Iir_Kind_Interface_Constant_Declaration => 821,
+ Iir_Kind_Interface_Variable_Declaration => 837,
+ Iir_Kind_Interface_Signal_Declaration => 858,
+ Iir_Kind_Interface_File_Declaration => 874,
+ Iir_Kind_Interface_Package_Declaration => 883,
+ Iir_Kind_Identity_Operator => 887,
+ Iir_Kind_Negation_Operator => 891,
+ Iir_Kind_Absolute_Operator => 895,
+ Iir_Kind_Not_Operator => 899,
+ Iir_Kind_Condition_Operator => 903,
+ Iir_Kind_Reduction_And_Operator => 907,
+ Iir_Kind_Reduction_Or_Operator => 911,
+ Iir_Kind_Reduction_Nand_Operator => 915,
+ Iir_Kind_Reduction_Nor_Operator => 919,
+ Iir_Kind_Reduction_Xor_Operator => 923,
+ Iir_Kind_Reduction_Xnor_Operator => 927,
+ Iir_Kind_And_Operator => 932,
+ Iir_Kind_Or_Operator => 937,
+ Iir_Kind_Nand_Operator => 942,
+ Iir_Kind_Nor_Operator => 947,
+ Iir_Kind_Xor_Operator => 952,
+ Iir_Kind_Xnor_Operator => 957,
+ Iir_Kind_Equality_Operator => 962,
+ Iir_Kind_Inequality_Operator => 967,
+ Iir_Kind_Less_Than_Operator => 972,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 977,
+ Iir_Kind_Greater_Than_Operator => 982,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 987,
+ Iir_Kind_Match_Equality_Operator => 992,
+ Iir_Kind_Match_Inequality_Operator => 997,
+ Iir_Kind_Match_Less_Than_Operator => 1002,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1007,
+ Iir_Kind_Match_Greater_Than_Operator => 1012,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1017,
+ Iir_Kind_Sll_Operator => 1022,
+ Iir_Kind_Sla_Operator => 1027,
+ Iir_Kind_Srl_Operator => 1032,
+ Iir_Kind_Sra_Operator => 1037,
+ Iir_Kind_Rol_Operator => 1042,
+ Iir_Kind_Ror_Operator => 1047,
+ Iir_Kind_Addition_Operator => 1052,
+ Iir_Kind_Substraction_Operator => 1057,
+ Iir_Kind_Concatenation_Operator => 1062,
+ Iir_Kind_Multiplication_Operator => 1067,
+ Iir_Kind_Division_Operator => 1072,
+ Iir_Kind_Modulus_Operator => 1077,
+ Iir_Kind_Remainder_Operator => 1082,
+ Iir_Kind_Exponentiation_Operator => 1087,
+ Iir_Kind_Function_Call => 1095,
+ Iir_Kind_Aggregate => 1101,
+ Iir_Kind_Parenthesis_Expression => 1104,
+ Iir_Kind_Qualified_Expression => 1108,
+ Iir_Kind_Type_Conversion => 1113,
+ Iir_Kind_Allocator_By_Expression => 1117,
+ Iir_Kind_Allocator_By_Subtype => 1123,
+ Iir_Kind_Selected_Element => 1129,
+ Iir_Kind_Dereference => 1134,
+ Iir_Kind_Implicit_Dereference => 1139,
+ Iir_Kind_Slice_Name => 1146,
+ Iir_Kind_Indexed_Name => 1152,
+ Iir_Kind_Psl_Expression => 1154,
+ Iir_Kind_Sensitized_Process_Statement => 1174,
+ Iir_Kind_Process_Statement => 1194,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1205,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1216,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1228,
+ Iir_Kind_Concurrent_Assertion_Statement => 1236,
+ Iir_Kind_Psl_Default_Clock => 1240,
+ Iir_Kind_Psl_Assert_Statement => 1252,
+ Iir_Kind_Psl_Cover_Statement => 1264,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1271,
+ Iir_Kind_Block_Statement => 1284,
+ Iir_Kind_If_Generate_Statement => 1294,
+ Iir_Kind_For_Generate_Statement => 1303,
+ Iir_Kind_Component_Instantiation_Statement => 1313,
+ Iir_Kind_Simple_Simultaneous_Statement => 1320,
+ Iir_Kind_Generate_Statement_Body => 1331,
+ Iir_Kind_If_Generate_Else_Clause => 1336,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1345,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1354,
+ Iir_Kind_Null_Statement => 1358,
+ Iir_Kind_Assertion_Statement => 1365,
+ Iir_Kind_Report_Statement => 1371,
+ Iir_Kind_Wait_Statement => 1378,
+ Iir_Kind_Variable_Assignment_Statement => 1384,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1390,
+ Iir_Kind_Return_Statement => 1396,
+ Iir_Kind_For_Loop_Statement => 1405,
+ Iir_Kind_While_Loop_Statement => 1413,
+ Iir_Kind_Next_Statement => 1419,
+ Iir_Kind_Exit_Statement => 1425,
+ Iir_Kind_Case_Statement => 1433,
+ Iir_Kind_Procedure_Call_Statement => 1439,
+ Iir_Kind_If_Statement => 1448,
+ Iir_Kind_Elsif => 1453,
+ Iir_Kind_Character_Literal => 1460,
+ Iir_Kind_Simple_Name => 1467,
+ Iir_Kind_Selected_Name => 1475,
+ Iir_Kind_Operator_Symbol => 1480,
+ Iir_Kind_Selected_By_All_Name => 1485,
+ Iir_Kind_Parenthesis_Name => 1489,
+ Iir_Kind_External_Constant_Name => 1498,
+ Iir_Kind_External_Signal_Name => 1507,
+ Iir_Kind_External_Variable_Name => 1516,
+ Iir_Kind_Package_Pathname => 1519,
+ Iir_Kind_Absolute_Pathname => 1520,
+ Iir_Kind_Relative_Pathname => 1521,
+ Iir_Kind_Pathname_Element => 1525,
+ Iir_Kind_Base_Attribute => 1527,
+ Iir_Kind_Left_Type_Attribute => 1532,
+ Iir_Kind_Right_Type_Attribute => 1537,
+ Iir_Kind_High_Type_Attribute => 1542,
+ Iir_Kind_Low_Type_Attribute => 1547,
+ Iir_Kind_Ascending_Type_Attribute => 1552,
+ Iir_Kind_Image_Attribute => 1558,
+ Iir_Kind_Value_Attribute => 1564,
+ Iir_Kind_Pos_Attribute => 1570,
+ Iir_Kind_Val_Attribute => 1576,
+ Iir_Kind_Succ_Attribute => 1582,
+ Iir_Kind_Pred_Attribute => 1588,
+ Iir_Kind_Leftof_Attribute => 1594,
+ Iir_Kind_Rightof_Attribute => 1600,
+ Iir_Kind_Delayed_Attribute => 1608,
+ Iir_Kind_Stable_Attribute => 1616,
+ Iir_Kind_Quiet_Attribute => 1624,
+ Iir_Kind_Transaction_Attribute => 1632,
+ Iir_Kind_Event_Attribute => 1636,
+ Iir_Kind_Active_Attribute => 1640,
+ Iir_Kind_Last_Event_Attribute => 1644,
+ Iir_Kind_Last_Active_Attribute => 1648,
+ Iir_Kind_Last_Value_Attribute => 1652,
+ Iir_Kind_Driving_Attribute => 1656,
+ Iir_Kind_Driving_Value_Attribute => 1660,
+ Iir_Kind_Behavior_Attribute => 1660,
+ Iir_Kind_Structure_Attribute => 1660,
+ Iir_Kind_Simple_Name_Attribute => 1667,
+ Iir_Kind_Instance_Name_Attribute => 1672,
+ Iir_Kind_Path_Name_Attribute => 1677,
+ Iir_Kind_Left_Array_Attribute => 1684,
+ Iir_Kind_Right_Array_Attribute => 1691,
+ Iir_Kind_High_Array_Attribute => 1698,
+ Iir_Kind_Low_Array_Attribute => 1705,
+ Iir_Kind_Length_Array_Attribute => 1712,
+ Iir_Kind_Ascending_Array_Attribute => 1719,
+ Iir_Kind_Range_Array_Attribute => 1726,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1733,
+ Iir_Kind_Attribute_Name => 1741
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -4419,6 +4426,8 @@ package body Nodes_Meta is
return Get_Elab_Flag (N);
when Field_Index_Constraint_Flag =>
return Get_Index_Constraint_Flag (N);
+ when Field_Hide_Implicit_Flag =>
+ return Get_Hide_Implicit_Flag (N);
when Field_Aggr_Dynamic_Flag =>
return Get_Aggr_Dynamic_Flag (N);
when Field_Aggr_Others_Flag =>
@@ -4529,6 +4538,8 @@ package body Nodes_Meta is
Set_Elab_Flag (N, V);
when Field_Index_Constraint_Flag =>
Set_Index_Constraint_Flag (N, V);
+ when Field_Hide_Implicit_Flag =>
+ Set_Hide_Implicit_Flag (N, V);
when Field_Aggr_Dynamic_Flag =>
Set_Aggr_Dynamic_Flag (N, V);
when Field_Aggr_Others_Flag =>
@@ -8254,6 +8265,17 @@ package body Nodes_Meta is
end case;
end Has_Index_Constraint_Flag;
+ function Has_Hide_Implicit_Flag (K : Iir_Kind) return Boolean is
+ begin
+ case K is
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Procedure_Declaration =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Has_Hide_Implicit_Flag;
+
function Has_Assertion_Condition (K : Iir_Kind) return Boolean is
begin
case K is
diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads
index 19b5930a6..49c77db6a 100644
--- a/src/vhdl/nodes_meta.ads
+++ b/src/vhdl/nodes_meta.ads
@@ -238,6 +238,7 @@ package Nodes_Meta is
Field_Purity_State,
Field_Elab_Flag,
Field_Index_Constraint_Flag,
+ Field_Hide_Implicit_Flag,
Field_Assertion_Condition,
Field_Report_Expression,
Field_Severity_Expression,
@@ -725,6 +726,7 @@ package Nodes_Meta is
function Has_Purity_State (K : Iir_Kind) return Boolean;
function Has_Elab_Flag (K : Iir_Kind) return Boolean;
function Has_Index_Constraint_Flag (K : Iir_Kind) return Boolean;
+ function Has_Hide_Implicit_Flag (K : Iir_Kind) return Boolean;
function Has_Assertion_Condition (K : Iir_Kind) return Boolean;
function Has_Report_Expression (K : Iir_Kind) return Boolean;
function Has_Severity_Expression (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index f70566ace..d065b4c1f 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -2320,9 +2320,9 @@ package body Sem_Decls is
-- declaration for the enumeration type; [...]
--
-- LRM08 6.6.3 Nonobject aliases
- -- c) If the name denotes an enumeration type of a subtype of an
+ -- c) If the name denotes an enumeration type or a subtype of an
-- enumeration type, then one implicit alias declaration for each
- -- of the litereals of the base type immediately follows the
+ -- of the literals of the base type immediately follows the
-- alias declaration for the enumeration type; [...]
Enum_List := Get_Enumeration_Literal_List (Def);
for I in Natural loop
@@ -2399,7 +2399,7 @@ package body Sem_Decls is
El := Get_Chain (Type_Decl);
while El /= Null_Iir loop
if Is_Implicit_Subprogram (El)
- and then Get_Type_Reference (El) = Type_Decl
+ and then Is_Operation_For_Type (El, Def)
then
Add_Implicit_Alias (El);
El := Get_Chain (El);
diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb
index a31279cc9..6ee061de6 100644
--- a/src/vhdl/sem_scopes.adb
+++ b/src/vhdl/sem_scopes.adb
@@ -765,8 +765,13 @@ package body Sem_Scopes is
-- within the entire scope of the other declaration
-- (regardless of which declaration occurs first);
-- the implicit declaration is visible neither by
- -- selected nor directly.
+ -- selection nor directly.
Set_Visible_Flag (Current_Decl, False);
+ if Get_Kind (Decl)
+ in Iir_Kinds_Subprogram_Declaration
+ then
+ Set_Hide_Implicit_Flag (Decl, True);
+ end if;
end if;
end;
else
@@ -957,12 +962,10 @@ package body Sem_Scopes is
end if;
when Iir_Kind_Type_Declaration =>
declare
- Def : Iir;
+ Def : constant Iir := Get_Type_Definition (Decl);
List : Iir_List;
El : Iir;
begin
- Def := Get_Type_Definition (Decl);
-
-- Handle incomplete type declaration.
if Get_Kind (Def) = Iir_Kind_Incomplete_Type_Definition then
return;
@@ -983,11 +986,9 @@ package body Sem_Scopes is
Handle_Decl (Decl, Arg);
declare
- Def : Iir;
+ Def : constant Iir := Get_Type_Definition (Decl);
El : Iir;
begin
- Def := Get_Type_Definition (Decl);
-
if Get_Kind (Def) = Iir_Kind_Physical_Type_Definition then
El := Get_Unit_Chain (Def);
while El /= Null_Iir loop
@@ -1257,6 +1258,109 @@ package body Sem_Scopes is
end loop;
end Use_Library_All;
+ procedure Potentially_Add_Name (Name : Iir) is
+ begin
+ Add_Name (Name, Get_Identifier (Name), True);
+ end Potentially_Add_Name;
+
+ -- LRM08 12.4 Use clauses
+ -- Moreover, the following declarations, if any, that occurs immediately
+ -- within the package denoted by the prefix of the selected name, are also
+ -- identifier:
+ procedure Use_Selected_Type_Name (Name : Iir)
+ is
+ Type_Def : constant Iir := Get_Type (Name);
+ Base_Type : constant Iir := Get_Base_Type (Type_Def);
+ begin
+ case Get_Kind (Base_Type) is
+ when Iir_Kind_Enumeration_Type_Definition =>
+ -- LRM08 12.4 Use clauses
+ -- - If the type mark denotes an enumeration type of a subtype of
+ -- an enumeration type, the enumeration literals of the base
+ -- type
+ declare
+ List : constant Iir_List :=
+ Get_Enumeration_Literal_List (Base_Type);
+ El : Iir;
+ begin
+ for I in Natural loop
+ El := Get_Nth_Element (List, I);
+ exit when El = Null_Iir;
+ Potentially_Add_Name (El);
+ end loop;
+ end;
+ when Iir_Kind_Physical_Type_Definition =>
+ -- LRM08 12.4 Use clauses
+ -- - If the type mark denotes a subtype of a physical type, the
+ -- units of the base type
+ declare
+ El : Iir;
+ begin
+ El := Get_Unit_Chain (Base_Type);
+ while El /= Null_Iir loop
+ Potentially_Add_Name (El);
+ El := Get_Chain (El);
+ end loop;
+ end;
+ when others =>
+ null;
+ end case;
+
+ -- LRM08 12.4 Use clauses
+ -- - The implicit declarations of predefined operations for the type
+ -- that are not hidden by homographs explicitely declared immediately
+ -- within the package denoted by the prefix of the selected name
+ -- - The declarations of homographs, explicitely declared immediately
+ -- within the package denotes by the prefix of the selected name,
+ -- that hide implicit declarations of predefined operations for the
+ -- type
+ declare
+ Type_Decl : constant Iir := Get_Type_Declarator (Base_Type);
+ El : Iir;
+ Has_Override : Boolean;
+ begin
+ Has_Override := False;
+ El := Get_Chain (Type_Decl);
+ while El /= Null_Iir loop
+ if Is_Implicit_Subprogram (El)
+ and then Is_Operation_For_Type (El, Base_Type)
+ then
+ if Get_Visible_Flag (El) then
+ -- Implicit declaration EL was overriden by a user
+ -- declaration. Don't make it visible.
+ Potentially_Add_Name (El);
+ else
+ Has_Override := True;
+ end if;
+ El := Get_Chain (El);
+ else
+ exit;
+ end if;
+ end loop;
+
+ -- Explicitely declared homograph.
+ if Has_Override then
+ while El /= Null_Iir loop
+ if Get_Kind (El) in Iir_Kinds_Subprogram_Declaration
+ and then Get_Hide_Implicit_Flag (El)
+ and then Is_Operation_For_Type (El, Base_Type)
+ then
+ Potentially_Add_Name (El);
+ end if;
+ El := Get_Chain (El);
+ end loop;
+ end if;
+ end;
+ end Use_Selected_Type_Name;
+
+ -- LRM02 10.4 Use clauses
+ -- Each selected name in a use clause identifiers one or more declarations
+ -- that will potentially become directly visible. If the suffix of the
+ -- selected name is a simple name, a character literal, or operator
+ -- symbol, then the selected name identifiers only the declarations(s) of
+ -- that simple name, character literal, or operator symbol contained
+ -- within the package or library denoted by the prefix of the selected
+ -- name.
procedure Use_Selected_Name (Name : Iir) is
begin
case Get_Kind (Name) is
@@ -1265,10 +1369,24 @@ package body Sem_Scopes is
when Iir_Kind_Error =>
null;
when others =>
- Add_Declaration (Name, True);
+ Potentially_Add_Name (Name);
+
+ -- LRM08 12.4 Use clauses
+ -- If the suffix of the selected name is a type mark, then the
+ -- declaration of the type or subtype denoted by the type mark
+ -- is identified. Moreover [...]
+ if (Vhdl_Std >= Vhdl_08 or else Flag_Relaxed_Rules)
+ and then Get_Kind (Name) in Iir_Kinds_Type_Declaration
+ then
+ Use_Selected_Type_Name (Name);
+ end if;
end case;
end Use_Selected_Name;
+ -- LRM93 10.4 Use clauses
+ -- If the suffix is the reserved word ALL, then all the selected name
+ -- identifies all declaration that are contained within the package or
+ -- library denotes by te prefix of the selected name.
procedure Use_All_Names (Name: Iir) is
begin
case Get_Kind (Name) is
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 5c9fc35bc..6b375d71c 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -5705,25 +5705,6 @@ package body Trans.Chap7 is
end if;
end;
- when Iir_Predefined_Attribute_Image
- | Iir_Predefined_Attribute_Value
- | Iir_Predefined_Attribute_Pos
- | Iir_Predefined_Attribute_Val
- | Iir_Predefined_Attribute_Succ
- | Iir_Predefined_Attribute_Pred
- | Iir_Predefined_Attribute_Leftof
- | Iir_Predefined_Attribute_Rightof
- | Iir_Predefined_Attribute_Left
- | Iir_Predefined_Attribute_Right
- | Iir_Predefined_Attribute_Event
- | Iir_Predefined_Attribute_Active
- | Iir_Predefined_Attribute_Last_Event
- | Iir_Predefined_Attribute_Last_Active
- | Iir_Predefined_Attribute_Last_Value
- | Iir_Predefined_Attribute_Driving
- | Iir_Predefined_Attribute_Driving_Value =>
- raise Internal_Error;
-
when Iir_Predefined_Array_Char_To_String
| Iir_Predefined_Bit_Vector_To_Ostring
| Iir_Predefined_Bit_Vector_To_Hstring