diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-03 07:30:34 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-03 07:30:34 +0200 |
commit | 7e46a516106dc02905e1c85e1d653c05fbe2292a (patch) | |
tree | 46d549881d7118e5edde53fb75640302cb12365b /src/vhdl | |
parent | a11d847187413ad04a6d98c1e867ccb5e385abe5 (diff) | |
download | ghdl-7e46a516106dc02905e1c85e1d653c05fbe2292a.tar.gz ghdl-7e46a516106dc02905e1c85e1d653c05fbe2292a.tar.bz2 ghdl-7e46a516106dc02905e1c85e1d653c05fbe2292a.zip |
vhdl: add anonymous_signal_declaration.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/translate/trans-chap4.adb | 9 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 8 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 12 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap7.adb | 1 | ||||
-rw-r--r-- | src/vhdl/translate/trans-rtis.adb | 9 | ||||
-rw-r--r-- | src/vhdl/vhdl-canon.adb | 74 | ||||
-rw-r--r-- | src/vhdl/vhdl-elocations.adb | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-elocations.ads | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-errors.adb | 3 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 26 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 324 | ||||
-rw-r--r-- | src/vhdl/vhdl-prints.adb | 13 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem.adb | 45 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_decls.adb | 19 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_decls.ads | 14 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_names.adb | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 5 |
18 files changed, 384 insertions, 186 deletions
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index 419229e66..13688263c 100644 --- a/src/vhdl/translate/trans-chap4.adb +++ b/src/vhdl/translate/trans-chap4.adb @@ -229,7 +229,8 @@ package body Trans.Chap4 is when Iir_Kind_Signal_Declaration | Iir_Kind_Interface_Signal_Declaration => Rtis.Generate_Signal_Rti (Decl); - when Iir_Kind_Guard_Signal_Declaration => + when Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => -- No name created for guard signal. null; when others => @@ -1820,7 +1821,8 @@ package body Trans.Chap4 is | Iir_Kind_Constant_Declaration => Create_Object (Decl); - when Iir_Kind_Signal_Declaration => + when Iir_Kind_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => Create_Signal (Decl); when Iir_Kind_Object_Alias_Declaration => @@ -2584,7 +2586,8 @@ package body Trans.Chap4 is Need_Final := True; end if; - when Iir_Kind_Signal_Declaration => + when Iir_Kind_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => Elab_Signal_Declaration (Decl, Parent, False); when Iir_Kind_Object_Alias_Declaration => diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index 2aa7cfdea..3df3a7324 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -448,7 +448,13 @@ package body Trans.Chap5 is -- actual, but the type of the formal may be used by the actual. Set_Map_Env (Formal_Env); Chap6.Translate_Signal_Name (Formal, Formal_Sig, Formal_Val); - Actual_En := Chap7.Translate_Expression (Actual, Formal_Type); + if Get_Kind (Actual) = Iir_Kind_Reference_Name then + -- For vhdl08 association by expression. + Actual_En := Chap7.Translate_Expression + (Get_Referenced_Name (Actual), Formal_Type); + else + Actual_En := Chap7.Translate_Expression (Actual, Formal_Type); + end if; Actual_Sig := E2M (Actual_En, Get_Info (Formal_Type), Mode_Value); Mode := Connect_Value; -- raise Internal_Error; diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index a277d452b..eb757d9c7 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -1071,7 +1071,8 @@ package body Trans.Chap6 is | Iir_Kind_Quiet_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Transaction_Attribute - | Iir_Kind_Guard_Signal_Declaration => + | Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => if Mode = Mode_Signal then return Get_Var (Name_Info.Signal_Sig, Type_Info, Mode_Signal); else @@ -1180,7 +1181,8 @@ package body Trans.Chap6 is | Iir_Kind_Delayed_Attribute | Iir_Kind_Transaction_Attribute | Iir_Kind_Guard_Signal_Declaration - | Iir_Kind_Object_Alias_Declaration => + | Iir_Kind_Object_Alias_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => Translate_Signal_Base (Name, Sig, Drv); when Iir_Kind_Slice_Name => declare @@ -1231,7 +1233,8 @@ package body Trans.Chap6 is begin case Get_Kind (Name) is when Iir_Kind_Signal_Declaration - | Iir_Kind_Interface_Signal_Declaration => + | Iir_Kind_Interface_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => declare Name_Type : constant Iir := Get_Type (Name); Name_Info : constant Ortho_Info_Acc := Get_Info (Name); @@ -1290,7 +1293,8 @@ package body Trans.Chap6 is | Iir_Kind_Quiet_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Transaction_Attribute - | Iir_Kind_Guard_Signal_Declaration => + | Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => Sig := Get_Var (Name_Info.Signal_Sig, Type_Info, Mode_Signal); Val := Get_Var (Name_Info.Signal_Val, Type_Info, Mode_Value); when Iir_Kind_Interface_Signal_Declaration => diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index 3d670cf56..4d6f68fdc 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -4330,6 +4330,7 @@ package body Trans.Chap7 is | Iir_Kind_Delayed_Attribute | Iir_Kind_Transaction_Attribute | Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Attribute_Value | Iir_Kind_Attribute_Name => Res := M2E (Chap6.Translate_Name (Expr, Mode_Value)); diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb index 759a066cb..e59a12b92 100644 --- a/src/vhdl/translate/trans-rtis.adb +++ b/src/vhdl/translate/trans-rtis.adb @@ -1933,7 +1933,8 @@ package body Trans.Rtis is Start_Record_Aggr (List, Ghdl_Rtin_Object); Mode := 0; case Get_Kind (Decl) is - when Iir_Kind_Signal_Declaration => + when Iir_Kind_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => Comm := Ghdl_Rtik_Signal; Var := Info.Signal_Sig; when Iir_Kind_Interface_Signal_Declaration => @@ -2140,7 +2141,8 @@ package body Trans.Rtis is | Iir_Kind_Interface_Constant_Declaration | Iir_Kind_Variable_Declaration | Iir_Kind_File_Declaration - | Iir_Kind_Signal_Attribute_Declaration => + | Iir_Kind_Signal_Attribute_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => null; when Iir_Kind_Object_Alias_Declaration | Iir_Kind_Attribute_Declaration => @@ -2270,7 +2272,8 @@ package body Trans.Rtis is Add_Rti_Node (Info.Object_Rti); end; when Iir_Kind_Signal_Declaration - | Iir_Kind_Interface_Signal_Declaration => + | Iir_Kind_Interface_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => declare Info : constant Signal_Info_Acc := Get_Info (Decl); begin diff --git a/src/vhdl/vhdl-canon.adb b/src/vhdl/vhdl-canon.adb index 604272813..5e1011a36 100644 --- a/src/vhdl/vhdl-canon.adb +++ b/src/vhdl/vhdl-canon.adb @@ -40,13 +40,11 @@ package body Vhdl.Canon is -- Canonicalize the chain of declarations in Declaration_Chain of -- DECL_PARENT. PARENT must be the parent of the current statements chain, -- or NULL_IIR if DECL_PARENT has no corresponding current statments. + -- TOP is used to add dependencies (from binding indications). procedure Canon_Declarations (Top : Iir_Design_Unit; Decl_Parent : Iir; Parent : Iir); - function Canon_Declaration (Top : Iir_Design_Unit; - Decl : Iir; - Parent : Iir; - Decl_Parent : Iir) + function Canon_Declaration (Top : Iir_Design_Unit; Decl : Iir; Parent : Iir) return Iir; procedure Canon_Concurrent_Stmts (Top : Iir_Design_Unit; Parent : Iir); @@ -2101,8 +2099,7 @@ package body Vhdl.Canon is Decl : constant Iir := Get_Parameter_Specification (El); New_Decl : Iir; begin - New_Decl := Canon_Declaration - (Top, Decl, Null_Iir, Null_Iir); + New_Decl := Canon_Declaration (Top, Decl, Null_Iir); pragma Assert (New_Decl = Decl); Canon_Generate_Statement_Body @@ -2245,6 +2242,7 @@ package body Vhdl.Canon is end Add_Binding_Indication_Dependence; -- Canon the component_configuration or configuration_specification CFG. + -- TOP is used to add dependences. procedure Canon_Component_Configuration (Top : Iir_Design_Unit; Cfg : Iir) is -- True iff CFG is a component_configuration. @@ -2622,7 +2620,7 @@ package body Vhdl.Canon is -- Replace ALL/OTHERS with the explicit list of signals. procedure Canon_Disconnection_Specification - (Dis : Iir_Disconnection_Specification; Decl_Parent : Iir) + (Dis : Iir_Disconnection_Specification) is Signal_List : Iir_Flist; Force : Boolean; @@ -2648,7 +2646,7 @@ package body Vhdl.Canon is Dis_Type := Get_Type (Get_Type_Mark (Dis)); N_List := Create_Iir_List; Set_Is_Ref (Dis, True); - El := Get_Declaration_Chain (Decl_Parent); + El := Get_Declaration_Chain (Get_Parent (Dis)); while El /= Null_Iir loop if Get_Kind (El) = Iir_Kind_Signal_Declaration and then Get_Type (El) = Dis_Type @@ -2739,9 +2737,8 @@ package body Vhdl.Canon is return Decl; end Canon_Package_Instantiation_Declaration; - function Canon_Declaration - (Top : Iir_Design_Unit; Decl : Iir; Parent : Iir; Decl_Parent : Iir) - return Iir + function Canon_Declaration (Top : Iir_Design_Unit; Decl : Iir; Parent : Iir) + return Iir is Stmts : Iir; begin @@ -2784,6 +2781,38 @@ package body Vhdl.Canon is Canon_Expression (Get_Default_Value (Decl)); end if; + when Iir_Kind_Anonymous_Signal_Declaration => + if Canon_Flag_Expressions then + Canon_Expression (Get_Expression (Decl)); + end if; + -- Create a signal assignment. + declare + Parent : constant Node := Get_Parent (Decl); + Asgn : Iir; + We : Iir; + Name : Iir; + begin + Asgn := Create_Iir + (Iir_Kind_Concurrent_Simple_Signal_Assignment); + Location_Copy (Asgn, Decl); + Set_Parent (Asgn, Parent); + Name := Build_Simple_Name (Decl, Decl); + Set_Type (Name, Get_Type (Decl)); + Set_Target (Asgn, Name); + Set_Delay_Mechanism (Asgn, Iir_Inertial_Delay); + + We := Create_Iir (Iir_Kind_Waveform_Element); + Location_Copy (We, Decl); + Set_We_Value (We, Get_Expression (Decl)); + Set_Expression (Decl, Null_Iir); + + Set_Waveform_Chain (Asgn, We); + + -- Prepend. + Set_Chain (Asgn, Get_Concurrent_Statement_Chain (Parent)); + Set_Concurrent_Statement_Chain (Parent, Asgn); + end; + when Iir_Kind_Iterator_Declaration => null; @@ -2803,7 +2832,7 @@ package body Vhdl.Canon is Canon_Expression (Get_Expression (Decl)); end if; when Iir_Kind_Disconnection_Specification => - Canon_Disconnection_Specification (Decl, Decl_Parent); + Canon_Disconnection_Specification (Decl); when Iir_Kind_Group_Template_Declaration => null; @@ -2856,15 +2885,34 @@ package body Vhdl.Canon is Decl : Iir; Prev_Decl : Iir; New_Decl : Iir; + Anon_Label : Natural; begin if Parent /= Null_Iir then Clear_Instantiation_Configuration (Parent, True); end if; + Anon_Label := 0; + Decl := Get_Declaration_Chain (Decl_Parent); Prev_Decl := Null_Iir; while Decl /= Null_Iir loop - New_Decl := Canon_Declaration (Top, Decl, Parent, Decl_Parent); + -- Give a name to anonymous signals. + -- Ideally it should be done in Canon_Declaration, but we need + -- a counter for all the declarations. + if Get_Kind (Decl) = Iir_Kind_Anonymous_Signal_Declaration then + declare + Str : String := "ANONYMOUS" & Natural'Image (Anon_Label); + begin + -- Note: the label starts with a capitalized + -- letter, to avoid any clash with user's + -- identifiers. + Str (10) := '_'; + Set_Identifier (Decl, Name_Table.Get_Identifier (Str)); + Anon_Label := Anon_Label + 1; + end; + end if; + + New_Decl := Canon_Declaration (Top, Decl, Parent); if New_Decl /= Decl then -- Replace declaration diff --git a/src/vhdl/vhdl-elocations.adb b/src/vhdl/vhdl-elocations.adb index 8bc68245c..c08519076 100644 --- a/src/vhdl/vhdl-elocations.adb +++ b/src/vhdl/vhdl-elocations.adb @@ -282,6 +282,7 @@ package body Vhdl.Elocations is | Iir_Kind_Guard_Signal_Declaration | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Signal_Attribute_Declaration | Iir_Kind_Identity_Operator | Iir_Kind_Negation_Operator diff --git a/src/vhdl/vhdl-elocations.ads b/src/vhdl/vhdl-elocations.ads index fa895e111..643746527 100644 --- a/src/vhdl/vhdl-elocations.ads +++ b/src/vhdl/vhdl-elocations.ads @@ -259,6 +259,8 @@ package Vhdl.Elocations is -- Iir_Kind_Guard_Signal_Declaration (None) + -- Iir_Kind_Anonymous_Signal_Declaration (None) + -- Iir_Kind_Signal_Attribute_Declaration (None) -- Iir_Kind_Constant_Declaration (L1) diff --git a/src/vhdl/vhdl-errors.adb b/src/vhdl/vhdl-errors.adb index 1bed01213..db2f87601 100644 --- a/src/vhdl/vhdl-errors.adb +++ b/src/vhdl/vhdl-errors.adb @@ -455,6 +455,9 @@ package body Vhdl.Errors is when Iir_Kind_Signal_Attribute_Declaration => -- Should not appear. return "signal attribute"; + when Iir_Kind_Anonymous_Signal_Declaration => + -- Should not appear. + return "anonymous signal"; when Iir_Kind_Group_Template_Declaration => return Disp_Identifier (Node, "group template"); when Iir_Kind_Group_Declaration => diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 85755105e..ae1c2bcb0 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -1059,6 +1059,7 @@ package body Vhdl.Nodes is | Iir_Kind_Interface_Signal_Declaration | Iir_Kind_Interface_File_Declaration | Iir_Kind_Interface_Type_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Signal_Attribute_Declaration | Iir_Kind_Identity_Operator | Iir_Kind_Negation_Operator diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index ec354499d..26d9601f8 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -1625,6 +1625,29 @@ package Vhdl.Nodes is -- -- Get/Set_Name_Staticness (State2) + -- Iir_Kind_Anonymous_Signal_Declaration (Short) + -- + -- Anonymous signal created for vhdl 2008 port association with a non + -- globally static expression. + -- + -- Get/Set_Parent (Field0) + -- + -- Get/Set_Chain (Field2) + -- + -- Get/Set_Identifier (Field3) + -- + -- Must be Null. + -- Get/Set_Default_Value (Field4) + -- + -- The expression that is assigned to the signal. + -- Get/Set_Expression (Field5) + -- + -- Get/Set_Type (Field1) + -- + -- Get/Set_After_Drivers_Flag (Flag5) + -- + -- Get/Set_Is_Ref (Flag12) + -- Iir_Kind_Signal_Attribute_Declaration (Short) -- -- Chain of implicit signals created from signal attribute. This is just @@ -3701,6 +3724,8 @@ package Vhdl.Nodes is -- This doesn't correspond to a name in the sources. This is an artificial -- name in the tree which is owned and reference another name. -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Named_Entity (Field4) -- -- The name from which the reference was created. Can be Null_Iir if the @@ -4237,6 +4262,7 @@ package Vhdl.Nodes is Iir_Kind_Interface_Function_Declaration, -- interface Iir_Kind_Interface_Procedure_Declaration, -- interface + Iir_Kind_Anonymous_Signal_Declaration, Iir_Kind_Signal_Attribute_Declaration, -- Expressions. diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 5c55f608a..eea011a3f 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -1256,6 +1256,8 @@ package body Vhdl.Nodes_Meta is return "interface_function_declaration"; when Iir_Kind_Interface_Procedure_Declaration => return "interface_procedure_declaration"; + when Iir_Kind_Anonymous_Signal_Declaration => + return "anonymous_signal_declaration"; when Iir_Kind_Signal_Attribute_Declaration => return "signal_attribute_declaration"; when Iir_Kind_Identity_Operator => @@ -3344,6 +3346,15 @@ package body Vhdl.Nodes_Meta is Field_Chain, Field_Interface_Declaration_Chain, Field_Return_Type_Mark, + -- Iir_Kind_Anonymous_Signal_Declaration + Field_Identifier, + Field_Is_Ref, + Field_After_Drivers_Flag, + Field_Parent, + Field_Chain, + Field_Default_Value, + Field_Expression, + Field_Type, -- Iir_Kind_Signal_Attribute_Declaration Field_Parent, Field_Chain, @@ -4094,6 +4105,7 @@ package body Vhdl.Nodes_Meta is Field_Base_Name, -- Iir_Kind_Reference_Name Field_Is_Forward_Ref, + Field_Type, Field_Named_Entity, Field_Referenced_Name, -- Iir_Kind_External_Constant_Name @@ -4548,155 +4560,156 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Interface_Package_Declaration => 974, Iir_Kind_Interface_Function_Declaration => 991, Iir_Kind_Interface_Procedure_Declaration => 1004, - Iir_Kind_Signal_Attribute_Declaration => 1007, - Iir_Kind_Identity_Operator => 1011, - Iir_Kind_Negation_Operator => 1015, - Iir_Kind_Absolute_Operator => 1019, - Iir_Kind_Not_Operator => 1023, - Iir_Kind_Implicit_Condition_Operator => 1027, - Iir_Kind_Condition_Operator => 1031, - Iir_Kind_Reduction_And_Operator => 1035, - Iir_Kind_Reduction_Or_Operator => 1039, - Iir_Kind_Reduction_Nand_Operator => 1043, - Iir_Kind_Reduction_Nor_Operator => 1047, - Iir_Kind_Reduction_Xor_Operator => 1051, - Iir_Kind_Reduction_Xnor_Operator => 1055, - Iir_Kind_And_Operator => 1060, - Iir_Kind_Or_Operator => 1065, - Iir_Kind_Nand_Operator => 1070, - Iir_Kind_Nor_Operator => 1075, - Iir_Kind_Xor_Operator => 1080, - Iir_Kind_Xnor_Operator => 1085, - Iir_Kind_Equality_Operator => 1090, - Iir_Kind_Inequality_Operator => 1095, - Iir_Kind_Less_Than_Operator => 1100, - Iir_Kind_Less_Than_Or_Equal_Operator => 1105, - Iir_Kind_Greater_Than_Operator => 1110, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1115, - Iir_Kind_Match_Equality_Operator => 1120, - Iir_Kind_Match_Inequality_Operator => 1125, - Iir_Kind_Match_Less_Than_Operator => 1130, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1135, - Iir_Kind_Match_Greater_Than_Operator => 1140, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1145, - Iir_Kind_Sll_Operator => 1150, - Iir_Kind_Sla_Operator => 1155, - Iir_Kind_Srl_Operator => 1160, - Iir_Kind_Sra_Operator => 1165, - Iir_Kind_Rol_Operator => 1170, - Iir_Kind_Ror_Operator => 1175, - Iir_Kind_Addition_Operator => 1180, - Iir_Kind_Substraction_Operator => 1185, - Iir_Kind_Concatenation_Operator => 1190, - Iir_Kind_Multiplication_Operator => 1195, - Iir_Kind_Division_Operator => 1200, - Iir_Kind_Modulus_Operator => 1205, - Iir_Kind_Remainder_Operator => 1210, - Iir_Kind_Exponentiation_Operator => 1215, - Iir_Kind_Function_Call => 1223, - Iir_Kind_Aggregate => 1230, - Iir_Kind_Parenthesis_Expression => 1233, - Iir_Kind_Qualified_Expression => 1237, - Iir_Kind_Type_Conversion => 1242, - Iir_Kind_Allocator_By_Expression => 1246, - Iir_Kind_Allocator_By_Subtype => 1251, - Iir_Kind_Selected_Element => 1259, - Iir_Kind_Dereference => 1264, - Iir_Kind_Implicit_Dereference => 1269, - Iir_Kind_Slice_Name => 1276, - Iir_Kind_Indexed_Name => 1282, - Iir_Kind_Psl_Expression => 1284, - Iir_Kind_Sensitized_Process_Statement => 1305, - Iir_Kind_Process_Statement => 1325, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1337, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1349, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1362, - Iir_Kind_Concurrent_Assertion_Statement => 1370, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1377, - Iir_Kind_Psl_Assert_Statement => 1390, - Iir_Kind_Psl_Cover_Statement => 1403, - Iir_Kind_Block_Statement => 1417, - Iir_Kind_If_Generate_Statement => 1428, - Iir_Kind_Case_Generate_Statement => 1437, - Iir_Kind_For_Generate_Statement => 1446, - Iir_Kind_Component_Instantiation_Statement => 1457, - Iir_Kind_Psl_Default_Clock => 1461, - Iir_Kind_Simple_Simultaneous_Statement => 1468, - Iir_Kind_Generate_Statement_Body => 1479, - Iir_Kind_If_Generate_Else_Clause => 1485, - Iir_Kind_Simple_Signal_Assignment_Statement => 1495, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1505, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1516, - Iir_Kind_Null_Statement => 1520, - Iir_Kind_Assertion_Statement => 1527, - Iir_Kind_Report_Statement => 1533, - Iir_Kind_Wait_Statement => 1541, - Iir_Kind_Variable_Assignment_Statement => 1548, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1555, - Iir_Kind_Return_Statement => 1561, - Iir_Kind_For_Loop_Statement => 1570, - Iir_Kind_While_Loop_Statement => 1579, - Iir_Kind_Next_Statement => 1586, - Iir_Kind_Exit_Statement => 1593, - Iir_Kind_Case_Statement => 1601, - Iir_Kind_Procedure_Call_Statement => 1607, - Iir_Kind_If_Statement => 1617, - Iir_Kind_Elsif => 1623, - Iir_Kind_Character_Literal => 1631, - Iir_Kind_Simple_Name => 1639, - Iir_Kind_Selected_Name => 1648, - Iir_Kind_Operator_Symbol => 1654, - Iir_Kind_Reference_Name => 1657, - Iir_Kind_External_Constant_Name => 1665, - Iir_Kind_External_Signal_Name => 1673, - Iir_Kind_External_Variable_Name => 1682, - Iir_Kind_Selected_By_All_Name => 1688, - Iir_Kind_Parenthesis_Name => 1693, - Iir_Kind_Package_Pathname => 1697, - Iir_Kind_Absolute_Pathname => 1698, - Iir_Kind_Relative_Pathname => 1699, - Iir_Kind_Pathname_Element => 1704, - Iir_Kind_Base_Attribute => 1706, - Iir_Kind_Subtype_Attribute => 1711, - Iir_Kind_Element_Attribute => 1716, - Iir_Kind_Left_Type_Attribute => 1721, - Iir_Kind_Right_Type_Attribute => 1726, - Iir_Kind_High_Type_Attribute => 1731, - Iir_Kind_Low_Type_Attribute => 1736, - Iir_Kind_Ascending_Type_Attribute => 1741, - Iir_Kind_Image_Attribute => 1747, - Iir_Kind_Value_Attribute => 1753, - Iir_Kind_Pos_Attribute => 1759, - Iir_Kind_Val_Attribute => 1765, - Iir_Kind_Succ_Attribute => 1771, - Iir_Kind_Pred_Attribute => 1777, - Iir_Kind_Leftof_Attribute => 1783, - Iir_Kind_Rightof_Attribute => 1789, - Iir_Kind_Delayed_Attribute => 1798, - Iir_Kind_Stable_Attribute => 1807, - Iir_Kind_Quiet_Attribute => 1816, - Iir_Kind_Transaction_Attribute => 1825, - Iir_Kind_Event_Attribute => 1829, - Iir_Kind_Active_Attribute => 1833, - Iir_Kind_Last_Event_Attribute => 1837, - Iir_Kind_Last_Active_Attribute => 1841, - Iir_Kind_Last_Value_Attribute => 1845, - Iir_Kind_Driving_Attribute => 1849, - Iir_Kind_Driving_Value_Attribute => 1853, - Iir_Kind_Behavior_Attribute => 1853, - Iir_Kind_Structure_Attribute => 1853, - Iir_Kind_Simple_Name_Attribute => 1860, - Iir_Kind_Instance_Name_Attribute => 1865, - Iir_Kind_Path_Name_Attribute => 1870, - Iir_Kind_Left_Array_Attribute => 1877, - Iir_Kind_Right_Array_Attribute => 1884, - Iir_Kind_High_Array_Attribute => 1891, - Iir_Kind_Low_Array_Attribute => 1898, - Iir_Kind_Length_Array_Attribute => 1905, - Iir_Kind_Ascending_Array_Attribute => 1912, - Iir_Kind_Range_Array_Attribute => 1919, - Iir_Kind_Reverse_Range_Array_Attribute => 1926, - Iir_Kind_Attribute_Name => 1935 + Iir_Kind_Anonymous_Signal_Declaration => 1012, + Iir_Kind_Signal_Attribute_Declaration => 1015, + Iir_Kind_Identity_Operator => 1019, + Iir_Kind_Negation_Operator => 1023, + Iir_Kind_Absolute_Operator => 1027, + Iir_Kind_Not_Operator => 1031, + Iir_Kind_Implicit_Condition_Operator => 1035, + Iir_Kind_Condition_Operator => 1039, + Iir_Kind_Reduction_And_Operator => 1043, + Iir_Kind_Reduction_Or_Operator => 1047, + Iir_Kind_Reduction_Nand_Operator => 1051, + Iir_Kind_Reduction_Nor_Operator => 1055, + Iir_Kind_Reduction_Xor_Operator => 1059, + Iir_Kind_Reduction_Xnor_Operator => 1063, + Iir_Kind_And_Operator => 1068, + Iir_Kind_Or_Operator => 1073, + Iir_Kind_Nand_Operator => 1078, + Iir_Kind_Nor_Operator => 1083, + Iir_Kind_Xor_Operator => 1088, + Iir_Kind_Xnor_Operator => 1093, + Iir_Kind_Equality_Operator => 1098, + Iir_Kind_Inequality_Operator => 1103, + Iir_Kind_Less_Than_Operator => 1108, + Iir_Kind_Less_Than_Or_Equal_Operator => 1113, + Iir_Kind_Greater_Than_Operator => 1118, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1123, + Iir_Kind_Match_Equality_Operator => 1128, + Iir_Kind_Match_Inequality_Operator => 1133, + Iir_Kind_Match_Less_Than_Operator => 1138, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1143, + Iir_Kind_Match_Greater_Than_Operator => 1148, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1153, + Iir_Kind_Sll_Operator => 1158, + Iir_Kind_Sla_Operator => 1163, + Iir_Kind_Srl_Operator => 1168, + Iir_Kind_Sra_Operator => 1173, + Iir_Kind_Rol_Operator => 1178, + Iir_Kind_Ror_Operator => 1183, + Iir_Kind_Addition_Operator => 1188, + Iir_Kind_Substraction_Operator => 1193, + Iir_Kind_Concatenation_Operator => 1198, + Iir_Kind_Multiplication_Operator => 1203, + Iir_Kind_Division_Operator => 1208, + Iir_Kind_Modulus_Operator => 1213, + Iir_Kind_Remainder_Operator => 1218, + Iir_Kind_Exponentiation_Operator => 1223, + Iir_Kind_Function_Call => 1231, + Iir_Kind_Aggregate => 1238, + Iir_Kind_Parenthesis_Expression => 1241, + Iir_Kind_Qualified_Expression => 1245, + Iir_Kind_Type_Conversion => 1250, + Iir_Kind_Allocator_By_Expression => 1254, + Iir_Kind_Allocator_By_Subtype => 1259, + Iir_Kind_Selected_Element => 1267, + Iir_Kind_Dereference => 1272, + Iir_Kind_Implicit_Dereference => 1277, + Iir_Kind_Slice_Name => 1284, + Iir_Kind_Indexed_Name => 1290, + Iir_Kind_Psl_Expression => 1292, + Iir_Kind_Sensitized_Process_Statement => 1313, + Iir_Kind_Process_Statement => 1333, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1345, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1357, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1370, + Iir_Kind_Concurrent_Assertion_Statement => 1378, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1385, + Iir_Kind_Psl_Assert_Statement => 1398, + Iir_Kind_Psl_Cover_Statement => 1411, + Iir_Kind_Block_Statement => 1425, + Iir_Kind_If_Generate_Statement => 1436, + Iir_Kind_Case_Generate_Statement => 1445, + Iir_Kind_For_Generate_Statement => 1454, + Iir_Kind_Component_Instantiation_Statement => 1465, + Iir_Kind_Psl_Default_Clock => 1469, + Iir_Kind_Simple_Simultaneous_Statement => 1476, + Iir_Kind_Generate_Statement_Body => 1487, + Iir_Kind_If_Generate_Else_Clause => 1493, + Iir_Kind_Simple_Signal_Assignment_Statement => 1503, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1513, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1524, + Iir_Kind_Null_Statement => 1528, + Iir_Kind_Assertion_Statement => 1535, + Iir_Kind_Report_Statement => 1541, + Iir_Kind_Wait_Statement => 1549, + Iir_Kind_Variable_Assignment_Statement => 1556, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1563, + Iir_Kind_Return_Statement => 1569, + Iir_Kind_For_Loop_Statement => 1578, + Iir_Kind_While_Loop_Statement => 1587, + Iir_Kind_Next_Statement => 1594, + Iir_Kind_Exit_Statement => 1601, + Iir_Kind_Case_Statement => 1609, + Iir_Kind_Procedure_Call_Statement => 1615, + Iir_Kind_If_Statement => 1625, + Iir_Kind_Elsif => 1631, + Iir_Kind_Character_Literal => 1639, + Iir_Kind_Simple_Name => 1647, + Iir_Kind_Selected_Name => 1656, + Iir_Kind_Operator_Symbol => 1662, + Iir_Kind_Reference_Name => 1666, + Iir_Kind_External_Constant_Name => 1674, + Iir_Kind_External_Signal_Name => 1682, + Iir_Kind_External_Variable_Name => 1691, + Iir_Kind_Selected_By_All_Name => 1697, + Iir_Kind_Parenthesis_Name => 1702, + Iir_Kind_Package_Pathname => 1706, + Iir_Kind_Absolute_Pathname => 1707, + Iir_Kind_Relative_Pathname => 1708, + Iir_Kind_Pathname_Element => 1713, + Iir_Kind_Base_Attribute => 1715, + Iir_Kind_Subtype_Attribute => 1720, + Iir_Kind_Element_Attribute => 1725, + Iir_Kind_Left_Type_Attribute => 1730, + Iir_Kind_Right_Type_Attribute => 1735, + Iir_Kind_High_Type_Attribute => 1740, + Iir_Kind_Low_Type_Attribute => 1745, + Iir_Kind_Ascending_Type_Attribute => 1750, + Iir_Kind_Image_Attribute => 1756, + Iir_Kind_Value_Attribute => 1762, + Iir_Kind_Pos_Attribute => 1768, + Iir_Kind_Val_Attribute => 1774, + Iir_Kind_Succ_Attribute => 1780, + Iir_Kind_Pred_Attribute => 1786, + Iir_Kind_Leftof_Attribute => 1792, + Iir_Kind_Rightof_Attribute => 1798, + Iir_Kind_Delayed_Attribute => 1807, + Iir_Kind_Stable_Attribute => 1816, + Iir_Kind_Quiet_Attribute => 1825, + Iir_Kind_Transaction_Attribute => 1834, + Iir_Kind_Event_Attribute => 1838, + Iir_Kind_Active_Attribute => 1842, + Iir_Kind_Last_Event_Attribute => 1846, + Iir_Kind_Last_Active_Attribute => 1850, + Iir_Kind_Last_Value_Attribute => 1854, + Iir_Kind_Driving_Attribute => 1858, + Iir_Kind_Driving_Value_Attribute => 1862, + Iir_Kind_Behavior_Attribute => 1862, + Iir_Kind_Structure_Attribute => 1862, + Iir_Kind_Simple_Name_Attribute => 1869, + Iir_Kind_Instance_Name_Attribute => 1874, + Iir_Kind_Path_Name_Attribute => 1879, + Iir_Kind_Left_Array_Attribute => 1886, + Iir_Kind_Right_Array_Attribute => 1893, + Iir_Kind_High_Array_Attribute => 1900, + Iir_Kind_Low_Array_Attribute => 1907, + Iir_Kind_Length_Array_Attribute => 1914, + Iir_Kind_Ascending_Array_Attribute => 1921, + Iir_Kind_Range_Array_Attribute => 1928, + Iir_Kind_Reverse_Range_Array_Attribute => 1935, + Iir_Kind_Attribute_Name => 1944 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -7045,7 +7058,8 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Constant_Declaration | Iir_Kind_Interface_Variable_Declaration | Iir_Kind_Interface_Signal_Declaration - | Iir_Kind_Interface_File_Declaration => + | Iir_Kind_Interface_File_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => return True; when others => return False; @@ -7355,6 +7369,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Package_Declaration | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Signal_Attribute_Declaration | Iir_Kind_Sensitized_Process_Statement | Iir_Kind_Process_Statement @@ -7466,6 +7481,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_File_Declaration | Iir_Kind_Interface_Type_Declaration | Iir_Kind_Interface_Function_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Identity_Operator | Iir_Kind_Negation_Operator | Iir_Kind_Absolute_Operator @@ -7528,6 +7544,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Simple_Name | Iir_Kind_Selected_Name | Iir_Kind_Operator_Symbol + | Iir_Kind_Reference_Name | Iir_Kind_External_Constant_Name | Iir_Kind_External_Signal_Name | Iir_Kind_External_Variable_Name @@ -7879,7 +7896,8 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Constant_Declaration | Iir_Kind_Interface_Variable_Declaration | Iir_Kind_Interface_Signal_Declaration - | Iir_Kind_Interface_File_Declaration => + | Iir_Kind_Interface_File_Declaration + | Iir_Kind_Anonymous_Signal_Declaration => return True; when others => return False; @@ -8129,6 +8147,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Package_Declaration | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Selected_Element | Iir_Kind_Sensitized_Process_Statement | Iir_Kind_Process_Statement @@ -9084,6 +9103,7 @@ package body Vhdl.Nodes_Meta is when Iir_Kind_Conditional_Expression | Iir_Kind_Attribute_Specification | Iir_Kind_Disconnection_Specification + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Parenthesis_Expression | Iir_Kind_Qualified_Expression | Iir_Kind_Type_Conversion @@ -9344,6 +9364,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Package_Declaration | Iir_Kind_Interface_Function_Declaration | Iir_Kind_Interface_Procedure_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Signal_Attribute_Declaration | Iir_Kind_Sensitized_Process_Statement | Iir_Kind_Process_Statement @@ -10659,6 +10680,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Interface_Signal_Declaration | Iir_Kind_Interface_File_Declaration | Iir_Kind_Interface_Type_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Sensitized_Process_Statement | Iir_Kind_Concurrent_Simple_Signal_Assignment | Iir_Kind_Concurrent_Conditional_Signal_Assignment diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb index 634e2be3c..a1ce5f01b 100644 --- a/src/vhdl/vhdl-prints.adb +++ b/src/vhdl/vhdl-prints.adb @@ -2209,6 +2209,8 @@ package body Vhdl.Prints is Disp_Attribute_Specification (Ctxt, Decl); when Iir_Kind_Signal_Attribute_Declaration => null; + when Iir_Kind_Anonymous_Signal_Declaration => + null; when Iir_Kind_Group_Template_Declaration => Disp_Group_Template_Declaration (Ctxt, Decl); when Iir_Kind_Group_Declaration => @@ -3484,6 +3486,17 @@ package body Vhdl.Prints is when Iir_Kind_Implicit_Dereference => Print (Ctxt, Get_Prefix (Expr)); + when Iir_Kind_Anonymous_Signal_Declaration => + declare + Act : constant Iir := Get_Expression (Expr); + begin + if Act /= Null_Iir then + Print (Ctxt, Act); + else + Disp_Identifier (Ctxt, Expr); + end if; + end; + when Iir_Kind_Left_Type_Attribute => Disp_Name_Attribute (Ctxt, Expr, Name_Left); when Iir_Kind_Right_Type_Attribute => diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb index 503d43293..7e6785a2b 100644 --- a/src/vhdl/vhdl-sem.adb +++ b/src/vhdl/vhdl-sem.adb @@ -462,6 +462,31 @@ package body Vhdl.Sem is Res := Sem_Generic_Association_Chain (Inter_Parent, Assoc_Parent); end Sem_Generic_Association_Chain; + -- LRM08 6.5.6.3 Port clauses + function Sem_Insert_Anonymous_Signal (Formal : Iir; Actual : Iir) + return Iir + is + Sig : Iir; + Res : Iir; + begin + -- Create the anonymous signal. + Sig := Create_Iir (Iir_Kind_Anonymous_Signal_Declaration); + Location_Copy (Sig, Actual); + Set_Expression (Sig, Actual); + Set_Type (Sig, Get_Type (Formal)); + + -- Declare it. + Add_Implicit_Declaration (Sig); + + -- Return a reference to it. + -- FIXME: The referenced name is not a name. + Res := Create_Iir (Iir_Kind_Reference_Name); + Set_Referenced_Name (Res, Sig); + Set_Named_Entity (Res, Sig); + Set_Type (Res, Get_Type (Sig)); + return Res; + end Sem_Insert_Anonymous_Signal; + -- INTER_PARENT contains ports interfaces; -- ASSOC_PARENT constains ports map aspects. procedure Sem_Port_Association_Chain @@ -577,18 +602,24 @@ package body Vhdl.Sem is & "expression"); end if; + -- Is it possible to have a globally static name that is + -- not readable ? + Check_Read (Actual); + -- LRM93 1.1.1.2 Ports -- The actual, if an expression, must be a globally -- static expression. if Get_Expr_Staticness (Actual) < Globally then - Error_Msg_Sem - (+Actual, - "actual expression must be globally static"); + if Flags.Vhdl_Std >= Vhdl_08 then + -- LRM08 6.5.6.3 Port clauses + Actual := Sem_Insert_Anonymous_Signal (Inter, Actual); + Set_Actual (Assoc, Actual); + else + Error_Msg_Sem + (+Actual, + "actual expression must be globally static"); + end if; end if; - - -- Is it possible to have a globally static name that is - -- not readable ? - Check_Read (Actual); else Error_Msg_Sem (+Assoc, diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb index 9e98c26a3..0f173d923 100644 --- a/src/vhdl/vhdl-sem_decls.adb +++ b/src/vhdl/vhdl-sem_decls.adb @@ -116,6 +116,9 @@ package body Vhdl.Sem_Decls is if Current_Signals_Region.Decls_Parent = Parent and then Current_Signals_Region.Implicit_Decl /= Null_Iir then + -- There are pending implicit declarations. Can happen only + -- during analysis of declarations, therefore when declarations are + -- not fully analyzed. pragma Assert (not Current_Signals_Region.Decls_Analyzed); -- Add pending implicit declarations before the current one. @@ -128,6 +131,22 @@ package body Vhdl.Sem_Decls is end if; end Insert_Pending_Implicit_Declarations; + procedure Add_Implicit_Declaration (Sig : Iir) is + begin + -- Only for anonymous signals, which appear in instantiations (so + -- once the declarations have been analyzed). + pragma Assert (Get_Kind (Sig) = Iir_Kind_Anonymous_Signal_Declaration); + pragma Assert (Current_Signals_Region.Decls_Analyzed); + + if Current_Signals_Region.Last_Decl = Null_Iir then + Set_Declaration_Chain (Current_Signals_Region.Decls_Parent, Sig); + else + Set_Chain (Current_Signals_Region.Last_Decl, Sig); + end if; + Current_Signals_Region.Last_Decl := Sig; + Set_Parent (Sig, Current_Signals_Region.Decls_Parent); + end Add_Implicit_Declaration; + -- Mark the end of declaration analysis. New implicit declarations will -- simply be appended to the last declaration. procedure End_Of_Declarations_For_Implicit_Declarations diff --git a/src/vhdl/vhdl-sem_decls.ads b/src/vhdl/vhdl-sem_decls.ads index f22cd8791..3ab43adf8 100644 --- a/src/vhdl/vhdl-sem_decls.ads +++ b/src/vhdl/vhdl-sem_decls.ads @@ -75,9 +75,14 @@ package Vhdl.Sem_Decls is procedure Pop_Signals_Declarative_Part (Cell: in Implicit_Signal_Declaration_Type); - -- Declare an implicit signal. + -- Declare an implicit signal. This is called from sem_names when a + -- signal attribute is analyzed. procedure Add_Declaration_For_Implicit_Signal (Sig : Iir); + -- Append declaration SIG (for an anonymous signal) to the current + -- declarative part. + procedure Add_Implicit_Declaration (Sig : Iir); + private type Implicit_Signal_Declaration_Type is record -- Declaration or statement than will contain implicit declarations. @@ -92,10 +97,13 @@ private -- If True, declarations of DECLS_PARENT have already been analyzed. -- So implicit declarations are appended to the parent, and the last - -- declaration is LAST_DECL. + -- declaration is LAST_DECL. This is the usual case when attribute + -- signals are used in statements. -- If False, declarations are being analyzed. Implicit declarations -- are appended to IMPLICIT_DECL/LAST_ATTRIBUTE_SIGNAL and will be - -- inserted before the current declaration. + -- inserted before the current declaration. This can happen if a + -- attribute signal is used in a declaration, the attribute signal + -- must be declared before it is used. Decls_Analyzed : Boolean; -- Last declaration in the region. If an implicit_decl is createed, it diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb index 35516f6f0..fa57a0d26 100644 --- a/src/vhdl/vhdl-sem_names.adb +++ b/src/vhdl/vhdl-sem_names.adb @@ -3345,6 +3345,8 @@ package body Vhdl.Sem_Names is Prefix : Iir; begin Prefix := Get_Named_Entity (Get_Prefix (Attr)); + + -- Create the proper signal attribute node. Res := Create_Iir (Kind); Location_Copy (Res, Attr); if Kind = Iir_Kind_Delayed_Attribute then @@ -3371,6 +3373,8 @@ package body Vhdl.Sem_Names is null; end case; end if; + + -- Add a declaration for it. Sem_Decls.Add_Declaration_For_Implicit_Signal (Res); return Res; end Sem_Signal_Signal_Attribute; diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index ea269f2cc..8c550ab98 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -163,7 +163,8 @@ package body Vhdl.Utils is end case; end Get_Operator_Name; - function Get_Longuest_Static_Prefix (Expr: Iir) return Iir is + function Get_Longuest_Static_Prefix (Expr: Iir) return Iir + is Adecl: Iir; begin Adecl := Expr; @@ -177,6 +178,7 @@ package body Vhdl.Utils is return Adecl; when Iir_Kind_Signal_Declaration | Iir_Kind_Guard_Signal_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Interface_Signal_Declaration => return Adecl; when Iir_Kind_Object_Alias_Declaration => @@ -297,6 +299,7 @@ package body Vhdl.Utils is | Iir_Kind_Scalar_Nature_Definition | Iir_Kind_Group_Template_Declaration | Iir_Kind_Group_Declaration + | Iir_Kind_Anonymous_Signal_Declaration | Iir_Kind_Signal_Attribute_Declaration | Iir_Kind_Unaffected_Waveform | Iir_Kind_Waveform_Element |