aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/translate/trans-chap5.adb30
-rw-r--r--src/vhdl/vhdl-nodes.adb16
-rw-r--r--src/vhdl/vhdl-nodes.ads12
-rw-r--r--src/vhdl/vhdl-nodes_meta.adb549
-rw-r--r--src/vhdl/vhdl-nodes_meta.ads2
-rw-r--r--src/vhdl/vhdl-sem.adb2
-rw-r--r--src/vhdl/vhdl-sem_names.adb11
-rw-r--r--src/vhdl/vhdl-sem_specs.adb5
8 files changed, 348 insertions, 279 deletions
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb
index 990392dea..60c44b208 100644
--- a/src/vhdl/translate/trans-chap5.adb
+++ b/src/vhdl/translate/trans-chap5.adb
@@ -61,13 +61,14 @@ package body Trans.Chap5 is
is
Spec_Expr : constant Iir := Get_Expression (Spec);
Spec_Type : constant Iir := Get_Type (Spec_Expr);
- Attr : constant Iir_Attribute_Declaration :=
+ Attr : constant Iir_Attribute_Declaration :=
Get_Named_Entity (Get_Attribute_Designator (Spec));
- Mark : Id_Mark_Type;
- Mark2 : Id_Mark_Type;
- Info : Object_Info_Acc;
- Val : Iir;
- Num : Natural;
+ Mark : Id_Mark_Type;
+ Mark2 : Id_Mark_Type;
+ Info : Object_Info_Acc;
+ Val : Iir;
+ Num : Natural;
+ Vtype : O_Tnode;
begin
Push_Identifier_Prefix_Uniq (Mark);
if Is_Anonymous_Type_Definition (Spec_Type) then
@@ -80,10 +81,19 @@ package body Trans.Chap5 is
Val := Get_Attribute_Value_Spec_Chain (Spec);
while Is_Valid (Val) loop
Info := Add_Info (Val, Kind_Object);
- Info.Object_Var := Create_Var
- (Create_Var_Identifier (Attr, "V", Num),
- Chap4.Get_Object_Type (Get_Info (Spec_Type), Mode_Value),
- Global_Storage);
+ Vtype := Chap4.Get_Object_Type (Get_Info (Spec_Type), Mode_Value);
+ if Get_Static_Attribute_Flag (Spec)
+ and then Get_Expr_Staticness (Spec_Expr) = Locally
+ then
+ -- Create a global var so that the attribute can be referenced
+ -- from outside. This is possible only if the attribute is
+ -- locally static.
+ Info.Object_Var := Create_Global_Var
+ (Create_Identifier (Attr, "V"), Vtype, Global_Storage);
+ else
+ Info.Object_Var := Create_Var
+ (Create_Var_Identifier (Attr, "V", Num), Vtype, Global_Storage);
+ end if;
-- Create only one object if the expression is static.
exit when Get_Expr_Staticness (Spec_Expr) /= None;
diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb
index 5425a4a34..f02857bd4 100644
--- a/src/vhdl/vhdl-nodes.adb
+++ b/src/vhdl/vhdl-nodes.adb
@@ -2090,6 +2090,22 @@ package body Vhdl.Nodes is
Set_Field4 (Val, Attr);
end Set_Attribute_Specification;
+ function Get_Static_Attribute_Flag (Attr : Iir) return Boolean is
+ begin
+ pragma Assert (Attr /= Null_Iir);
+ pragma Assert (Has_Static_Attribute_Flag (Get_Kind (Attr)),
+ "no field Static_Attribute_Flag");
+ return Get_Flag2 (Attr);
+ end Get_Static_Attribute_Flag;
+
+ procedure Set_Static_Attribute_Flag (Attr : Iir; Flag : Boolean) is
+ begin
+ pragma Assert (Attr /= Null_Iir);
+ pragma Assert (Has_Static_Attribute_Flag (Get_Kind (Attr)),
+ "no field Static_Attribute_Flag");
+ Set_Flag2 (Attr, Flag);
+ end Set_Static_Attribute_Flag;
+
function Get_Signal_List (Target : Iir) return Iir_Flist is
begin
pragma Assert (Target /= Null_Iir);
diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads
index 8e1d98c0b..fb92c5882 100644
--- a/src/vhdl/vhdl-nodes.ads
+++ b/src/vhdl/vhdl-nodes.ads
@@ -811,6 +811,8 @@ package Vhdl.Nodes is
-- Get/Set_Attribute_Designator (Field6)
--
-- Get/Set_Attribute_Specification_Chain (Field7)
+ --
+ -- Get/Set_Static_Attribute_Flag (Flag2)
-- Iir_Kind_Attribute_Value (Short)
-- An attribute value is the element of the chain of attribute of an
@@ -974,6 +976,8 @@ package Vhdl.Nodes is
--
-- Get/Set_Visible_Flag (Flag4)
--
+ -- Get/Set_Is_Within_Flag (Flag5)
+ --
-- Get/Set_End_Has_Reserved_Id (Flag8)
--
-- Get/Set_End_Has_Identifier (Flag9)
@@ -7580,6 +7584,14 @@ package Vhdl.Nodes is
function Get_Attribute_Specification (Val : Iir) return Iir;
procedure Set_Attribute_Specification (Val : Iir; Attr : Iir);
+ -- True for attributes on entity, configuration and architecture. They
+ -- are expected to be read from anywhere so the value is expected to be
+ -- locally static, but this is not followed by many users and
+ -- implementations.
+ -- Field: Flag2
+ function Get_Static_Attribute_Flag (Attr : Iir) return Boolean;
+ procedure Set_Static_Attribute_Flag (Attr : Iir; Flag : Boolean);
+
-- Field: Field3 Of_Maybe_Ref (uc)
function Get_Signal_List (Target : Iir) return Iir_Flist;
procedure Set_Signal_List (Target : Iir; List : Iir_Flist);
diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb
index e455c6840..6989c840a 100644
--- a/src/vhdl/vhdl-nodes_meta.adb
+++ b/src/vhdl/vhdl-nodes_meta.adb
@@ -64,6 +64,7 @@ package body Vhdl.Nodes_Meta is
Field_Attribute_Designator => Type_Iir,
Field_Attribute_Specification_Chain => Type_Iir,
Field_Attribute_Specification => Type_Iir,
+ Field_Static_Attribute_Flag => Type_Boolean,
Field_Signal_List => Type_Iir_Flist,
Field_Quantity_List => Type_Iir_Flist,
Field_Designated_Entity => Type_Iir,
@@ -486,6 +487,8 @@ package body Vhdl.Nodes_Meta is
return "attribute_specification_chain";
when Field_Attribute_Specification =>
return "attribute_specification";
+ when Field_Static_Attribute_Flag =>
+ return "static_attribute_flag";
when Field_Signal_List =>
return "signal_list";
when Field_Quantity_List =>
@@ -1862,6 +1865,8 @@ package body Vhdl.Nodes_Meta is
return Attr_Ref;
when Field_Attribute_Specification =>
return Attr_Ref;
+ when Field_Static_Attribute_Flag =>
+ return Attr_None;
when Field_Signal_List =>
return Attr_Of_Maybe_Ref;
when Field_Quantity_List =>
@@ -2816,6 +2821,7 @@ package body Vhdl.Nodes_Meta is
Field_Expression,
-- Iir_Kind_Attribute_Specification
Field_Entity_Class,
+ Field_Static_Attribute_Flag,
Field_Parent,
Field_Chain,
Field_Entity_Name_List,
@@ -3137,6 +3143,7 @@ package body Vhdl.Nodes_Meta is
-- Iir_Kind_Configuration_Declaration
Field_Identifier,
Field_Visible_Flag,
+ Field_Is_Within_Flag,
Field_End_Has_Reserved_Id,
Field_End_Has_Identifier,
Field_Parent,
@@ -5248,272 +5255,272 @@ package body Vhdl.Nodes_Meta is
Iir_Kind_Record_Resolution => 246,
Iir_Kind_Record_Element_Resolution => 249,
Iir_Kind_Break_Element => 253,
- Iir_Kind_Attribute_Specification => 261,
- Iir_Kind_Disconnection_Specification => 267,
- Iir_Kind_Step_Limit_Specification => 273,
- Iir_Kind_Configuration_Specification => 279,
- Iir_Kind_Access_Type_Definition => 286,
- Iir_Kind_Incomplete_Type_Definition => 293,
- Iir_Kind_Interface_Type_Definition => 299,
- Iir_Kind_File_Type_Definition => 305,
- Iir_Kind_Protected_Type_Declaration => 314,
- Iir_Kind_Record_Type_Definition => 324,
- Iir_Kind_Array_Type_Definition => 335,
- Iir_Kind_Array_Subtype_Definition => 350,
- Iir_Kind_Record_Subtype_Definition => 363,
- Iir_Kind_Access_Subtype_Definition => 371,
- Iir_Kind_Physical_Subtype_Definition => 381,
- Iir_Kind_Floating_Subtype_Definition => 392,
- Iir_Kind_Integer_Subtype_Definition => 402,
- Iir_Kind_Enumeration_Subtype_Definition => 412,
- Iir_Kind_Enumeration_Type_Definition => 423,
- Iir_Kind_Integer_Type_Definition => 431,
- Iir_Kind_Floating_Type_Definition => 439,
- Iir_Kind_Physical_Type_Definition => 450,
- Iir_Kind_Range_Expression => 458,
- Iir_Kind_Protected_Type_Body => 466,
- Iir_Kind_Wildcard_Type_Definition => 470,
- Iir_Kind_Subtype_Definition => 477,
- Iir_Kind_Scalar_Nature_Definition => 485,
- Iir_Kind_Record_Nature_Definition => 498,
- Iir_Kind_Array_Nature_Definition => 512,
- Iir_Kind_Array_Subnature_Definition => 527,
- Iir_Kind_Overload_List => 528,
- Iir_Kind_Entity_Declaration => 541,
- Iir_Kind_Configuration_Declaration => 550,
- Iir_Kind_Context_Declaration => 556,
- Iir_Kind_Package_Declaration => 571,
- Iir_Kind_Package_Instantiation_Declaration => 585,
- Iir_Kind_Vmode_Declaration => 597,
- Iir_Kind_Vprop_Declaration => 609,
- Iir_Kind_Vunit_Declaration => 622,
- Iir_Kind_Package_Body => 630,
- Iir_Kind_Architecture_Body => 643,
- Iir_Kind_Type_Declaration => 650,
- Iir_Kind_Anonymous_Type_Declaration => 656,
- Iir_Kind_Subtype_Declaration => 664,
- Iir_Kind_Nature_Declaration => 670,
- Iir_Kind_Subnature_Declaration => 677,
- Iir_Kind_Package_Header => 679,
- Iir_Kind_Unit_Declaration => 688,
- Iir_Kind_Library_Declaration => 696,
- Iir_Kind_Component_Declaration => 706,
- Iir_Kind_Attribute_Declaration => 713,
- Iir_Kind_Group_Template_Declaration => 719,
- Iir_Kind_Group_Declaration => 726,
- Iir_Kind_Element_Declaration => 734,
- Iir_Kind_Nature_Element_Declaration => 741,
- Iir_Kind_Non_Object_Alias_Declaration => 749,
- Iir_Kind_Psl_Declaration => 757,
- Iir_Kind_Psl_Endpoint_Declaration => 771,
- Iir_Kind_Enumeration_Literal => 782,
- Iir_Kind_Function_Declaration => 807,
- Iir_Kind_Procedure_Declaration => 831,
- Iir_Kind_Function_Body => 841,
- Iir_Kind_Procedure_Body => 852,
- Iir_Kind_Function_Instantiation_Declaration => 863,
- Iir_Kind_Procedure_Instantiation_Declaration => 873,
- Iir_Kind_Terminal_Declaration => 882,
- Iir_Kind_Object_Alias_Declaration => 894,
- Iir_Kind_Free_Quantity_Declaration => 906,
- Iir_Kind_Spectrum_Quantity_Declaration => 919,
- Iir_Kind_Noise_Quantity_Declaration => 931,
- Iir_Kind_Across_Quantity_Declaration => 947,
- Iir_Kind_Through_Quantity_Declaration => 963,
- Iir_Kind_File_Declaration => 978,
- Iir_Kind_Guard_Signal_Declaration => 992,
- Iir_Kind_Signal_Declaration => 1009,
- Iir_Kind_Variable_Declaration => 1022,
- Iir_Kind_Constant_Declaration => 1036,
- Iir_Kind_Iterator_Declaration => 1048,
- Iir_Kind_Interface_Constant_Declaration => 1065,
- Iir_Kind_Interface_Variable_Declaration => 1081,
- Iir_Kind_Interface_Signal_Declaration => 1102,
- Iir_Kind_Interface_File_Declaration => 1118,
- Iir_Kind_Interface_Quantity_Declaration => 1134,
- Iir_Kind_Interface_Terminal_Declaration => 1146,
- Iir_Kind_Interface_Type_Declaration => 1157,
- Iir_Kind_Interface_Package_Declaration => 1170,
- Iir_Kind_Interface_Function_Declaration => 1188,
- Iir_Kind_Interface_Procedure_Declaration => 1202,
- Iir_Kind_Anonymous_Signal_Declaration => 1211,
- Iir_Kind_Signal_Attribute_Declaration => 1214,
- Iir_Kind_Identity_Operator => 1218,
- Iir_Kind_Negation_Operator => 1222,
- Iir_Kind_Absolute_Operator => 1226,
- Iir_Kind_Not_Operator => 1230,
- Iir_Kind_Implicit_Condition_Operator => 1234,
- Iir_Kind_Condition_Operator => 1238,
- Iir_Kind_Reduction_And_Operator => 1242,
- Iir_Kind_Reduction_Or_Operator => 1246,
- Iir_Kind_Reduction_Nand_Operator => 1250,
- Iir_Kind_Reduction_Nor_Operator => 1254,
- Iir_Kind_Reduction_Xor_Operator => 1258,
- Iir_Kind_Reduction_Xnor_Operator => 1262,
- Iir_Kind_And_Operator => 1267,
- Iir_Kind_Or_Operator => 1272,
- Iir_Kind_Nand_Operator => 1277,
- Iir_Kind_Nor_Operator => 1282,
- Iir_Kind_Xor_Operator => 1287,
- Iir_Kind_Xnor_Operator => 1292,
- Iir_Kind_Equality_Operator => 1297,
- Iir_Kind_Inequality_Operator => 1302,
- Iir_Kind_Less_Than_Operator => 1307,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1312,
- Iir_Kind_Greater_Than_Operator => 1317,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1322,
- Iir_Kind_Match_Equality_Operator => 1327,
- Iir_Kind_Match_Inequality_Operator => 1332,
- Iir_Kind_Match_Less_Than_Operator => 1337,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1342,
- Iir_Kind_Match_Greater_Than_Operator => 1347,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1352,
- Iir_Kind_Sll_Operator => 1357,
- Iir_Kind_Sla_Operator => 1362,
- Iir_Kind_Srl_Operator => 1367,
- Iir_Kind_Sra_Operator => 1372,
- Iir_Kind_Rol_Operator => 1377,
- Iir_Kind_Ror_Operator => 1382,
- Iir_Kind_Addition_Operator => 1387,
- Iir_Kind_Substraction_Operator => 1392,
- Iir_Kind_Concatenation_Operator => 1397,
- Iir_Kind_Multiplication_Operator => 1402,
- Iir_Kind_Division_Operator => 1407,
- Iir_Kind_Modulus_Operator => 1412,
- Iir_Kind_Remainder_Operator => 1417,
- Iir_Kind_Exponentiation_Operator => 1422,
- Iir_Kind_Function_Call => 1430,
- Iir_Kind_Aggregate => 1437,
- Iir_Kind_Parenthesis_Expression => 1440,
- Iir_Kind_Qualified_Expression => 1444,
- Iir_Kind_Type_Conversion => 1449,
- Iir_Kind_Allocator_By_Expression => 1454,
- Iir_Kind_Allocator_By_Subtype => 1460,
- Iir_Kind_Selected_Element => 1468,
- Iir_Kind_Dereference => 1473,
- Iir_Kind_Implicit_Dereference => 1478,
- Iir_Kind_Slice_Name => 1485,
- Iir_Kind_Indexed_Name => 1491,
- Iir_Kind_Psl_Prev => 1497,
- Iir_Kind_Psl_Stable => 1502,
- Iir_Kind_Psl_Rose => 1507,
- Iir_Kind_Psl_Fell => 1512,
- Iir_Kind_Psl_Expression => 1514,
- Iir_Kind_Sensitized_Process_Statement => 1535,
- Iir_Kind_Process_Statement => 1555,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1568,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1581,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1595,
- Iir_Kind_Concurrent_Assertion_Statement => 1603,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1610,
- Iir_Kind_Concurrent_Break_Statement => 1618,
- Iir_Kind_Psl_Assert_Directive => 1631,
- Iir_Kind_Psl_Assume_Directive => 1642,
- Iir_Kind_Psl_Cover_Directive => 1654,
- Iir_Kind_Psl_Restrict_Directive => 1665,
- Iir_Kind_Block_Statement => 1679,
- Iir_Kind_If_Generate_Statement => 1690,
- Iir_Kind_Case_Generate_Statement => 1699,
- Iir_Kind_For_Generate_Statement => 1708,
- Iir_Kind_Component_Instantiation_Statement => 1719,
- Iir_Kind_Psl_Default_Clock => 1723,
- Iir_Kind_Generate_Statement_Body => 1734,
- Iir_Kind_If_Generate_Else_Clause => 1740,
- Iir_Kind_Simple_Simultaneous_Statement => 1747,
- Iir_Kind_Simultaneous_Null_Statement => 1751,
- Iir_Kind_Simultaneous_Procedural_Statement => 1762,
- Iir_Kind_Simultaneous_Case_Statement => 1771,
- Iir_Kind_Simultaneous_If_Statement => 1780,
- Iir_Kind_Simultaneous_Elsif => 1786,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1797,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1808,
- Iir_Kind_Selected_Waveform_Assignment_Statement => 1820,
- Iir_Kind_Signal_Force_Assignment_Statement => 1830,
- Iir_Kind_Signal_Release_Assignment_Statement => 1839,
- Iir_Kind_Null_Statement => 1843,
- Iir_Kind_Assertion_Statement => 1850,
- Iir_Kind_Report_Statement => 1856,
- Iir_Kind_Wait_Statement => 1864,
- Iir_Kind_Variable_Assignment_Statement => 1871,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1878,
- Iir_Kind_Return_Statement => 1884,
- Iir_Kind_For_Loop_Statement => 1895,
- Iir_Kind_While_Loop_Statement => 1906,
- Iir_Kind_Next_Statement => 1913,
- Iir_Kind_Exit_Statement => 1920,
- Iir_Kind_Case_Statement => 1928,
- Iir_Kind_Procedure_Call_Statement => 1934,
- Iir_Kind_Break_Statement => 1941,
- Iir_Kind_If_Statement => 1951,
- Iir_Kind_Elsif => 1957,
- Iir_Kind_Character_Literal => 1965,
- Iir_Kind_Simple_Name => 1973,
- Iir_Kind_Selected_Name => 1982,
- Iir_Kind_Operator_Symbol => 1988,
- Iir_Kind_Reference_Name => 1993,
- Iir_Kind_External_Constant_Name => 2002,
- Iir_Kind_External_Signal_Name => 2011,
- Iir_Kind_External_Variable_Name => 2021,
- Iir_Kind_Selected_By_All_Name => 2027,
- Iir_Kind_Parenthesis_Name => 2032,
- Iir_Kind_Package_Pathname => 2036,
- Iir_Kind_Absolute_Pathname => 2037,
- Iir_Kind_Relative_Pathname => 2038,
- Iir_Kind_Pathname_Element => 2043,
- Iir_Kind_Base_Attribute => 2045,
- Iir_Kind_Subtype_Attribute => 2050,
- Iir_Kind_Element_Attribute => 2055,
- Iir_Kind_Across_Attribute => 2060,
- Iir_Kind_Through_Attribute => 2065,
- Iir_Kind_Nature_Reference_Attribute => 2069,
- Iir_Kind_Left_Type_Attribute => 2074,
- Iir_Kind_Right_Type_Attribute => 2079,
- Iir_Kind_High_Type_Attribute => 2084,
- Iir_Kind_Low_Type_Attribute => 2089,
- Iir_Kind_Ascending_Type_Attribute => 2094,
- Iir_Kind_Image_Attribute => 2100,
- Iir_Kind_Value_Attribute => 2106,
- Iir_Kind_Pos_Attribute => 2112,
- Iir_Kind_Val_Attribute => 2118,
- Iir_Kind_Succ_Attribute => 2124,
- Iir_Kind_Pred_Attribute => 2130,
- Iir_Kind_Leftof_Attribute => 2136,
- Iir_Kind_Rightof_Attribute => 2142,
- Iir_Kind_Signal_Slew_Attribute => 2150,
- Iir_Kind_Quantity_Slew_Attribute => 2158,
- Iir_Kind_Ramp_Attribute => 2166,
- Iir_Kind_Zoh_Attribute => 2174,
- Iir_Kind_Ltf_Attribute => 2182,
- Iir_Kind_Ztf_Attribute => 2192,
- Iir_Kind_Dot_Attribute => 2199,
- Iir_Kind_Integ_Attribute => 2206,
- Iir_Kind_Above_Attribute => 2214,
- Iir_Kind_Quantity_Delayed_Attribute => 2222,
- Iir_Kind_Delayed_Attribute => 2231,
- Iir_Kind_Stable_Attribute => 2240,
- Iir_Kind_Quiet_Attribute => 2249,
- Iir_Kind_Transaction_Attribute => 2258,
- Iir_Kind_Event_Attribute => 2262,
- Iir_Kind_Active_Attribute => 2266,
- Iir_Kind_Last_Event_Attribute => 2270,
- Iir_Kind_Last_Active_Attribute => 2274,
- Iir_Kind_Last_Value_Attribute => 2278,
- Iir_Kind_Driving_Attribute => 2282,
- Iir_Kind_Driving_Value_Attribute => 2286,
- Iir_Kind_Behavior_Attribute => 2286,
- Iir_Kind_Structure_Attribute => 2286,
- Iir_Kind_Simple_Name_Attribute => 2293,
- Iir_Kind_Instance_Name_Attribute => 2298,
- Iir_Kind_Path_Name_Attribute => 2303,
- Iir_Kind_Left_Array_Attribute => 2310,
- Iir_Kind_Right_Array_Attribute => 2317,
- Iir_Kind_High_Array_Attribute => 2324,
- Iir_Kind_Low_Array_Attribute => 2331,
- Iir_Kind_Length_Array_Attribute => 2338,
- Iir_Kind_Ascending_Array_Attribute => 2345,
- Iir_Kind_Range_Array_Attribute => 2352,
- Iir_Kind_Reverse_Range_Array_Attribute => 2359,
- Iir_Kind_Attribute_Name => 2368
+ Iir_Kind_Attribute_Specification => 262,
+ Iir_Kind_Disconnection_Specification => 268,
+ Iir_Kind_Step_Limit_Specification => 274,
+ Iir_Kind_Configuration_Specification => 280,
+ Iir_Kind_Access_Type_Definition => 287,
+ Iir_Kind_Incomplete_Type_Definition => 294,
+ Iir_Kind_Interface_Type_Definition => 300,
+ Iir_Kind_File_Type_Definition => 306,
+ Iir_Kind_Protected_Type_Declaration => 315,
+ Iir_Kind_Record_Type_Definition => 325,
+ Iir_Kind_Array_Type_Definition => 336,
+ Iir_Kind_Array_Subtype_Definition => 351,
+ Iir_Kind_Record_Subtype_Definition => 364,
+ Iir_Kind_Access_Subtype_Definition => 372,
+ Iir_Kind_Physical_Subtype_Definition => 382,
+ Iir_Kind_Floating_Subtype_Definition => 393,
+ Iir_Kind_Integer_Subtype_Definition => 403,
+ Iir_Kind_Enumeration_Subtype_Definition => 413,
+ Iir_Kind_Enumeration_Type_Definition => 424,
+ Iir_Kind_Integer_Type_Definition => 432,
+ Iir_Kind_Floating_Type_Definition => 440,
+ Iir_Kind_Physical_Type_Definition => 451,
+ Iir_Kind_Range_Expression => 459,
+ Iir_Kind_Protected_Type_Body => 467,
+ Iir_Kind_Wildcard_Type_Definition => 471,
+ Iir_Kind_Subtype_Definition => 478,
+ Iir_Kind_Scalar_Nature_Definition => 486,
+ Iir_Kind_Record_Nature_Definition => 499,
+ Iir_Kind_Array_Nature_Definition => 513,
+ Iir_Kind_Array_Subnature_Definition => 528,
+ Iir_Kind_Overload_List => 529,
+ Iir_Kind_Entity_Declaration => 542,
+ Iir_Kind_Configuration_Declaration => 552,
+ Iir_Kind_Context_Declaration => 558,
+ Iir_Kind_Package_Declaration => 573,
+ Iir_Kind_Package_Instantiation_Declaration => 587,
+ Iir_Kind_Vmode_Declaration => 599,
+ Iir_Kind_Vprop_Declaration => 611,
+ Iir_Kind_Vunit_Declaration => 624,
+ Iir_Kind_Package_Body => 632,
+ Iir_Kind_Architecture_Body => 645,
+ Iir_Kind_Type_Declaration => 652,
+ Iir_Kind_Anonymous_Type_Declaration => 658,
+ Iir_Kind_Subtype_Declaration => 666,
+ Iir_Kind_Nature_Declaration => 672,
+ Iir_Kind_Subnature_Declaration => 679,
+ Iir_Kind_Package_Header => 681,
+ Iir_Kind_Unit_Declaration => 690,
+ Iir_Kind_Library_Declaration => 698,
+ Iir_Kind_Component_Declaration => 708,
+ Iir_Kind_Attribute_Declaration => 715,
+ Iir_Kind_Group_Template_Declaration => 721,
+ Iir_Kind_Group_Declaration => 728,
+ Iir_Kind_Element_Declaration => 736,
+ Iir_Kind_Nature_Element_Declaration => 743,
+ Iir_Kind_Non_Object_Alias_Declaration => 751,
+ Iir_Kind_Psl_Declaration => 759,
+ Iir_Kind_Psl_Endpoint_Declaration => 773,
+ Iir_Kind_Enumeration_Literal => 784,
+ Iir_Kind_Function_Declaration => 809,
+ Iir_Kind_Procedure_Declaration => 833,
+ Iir_Kind_Function_Body => 843,
+ Iir_Kind_Procedure_Body => 854,
+ Iir_Kind_Function_Instantiation_Declaration => 865,
+ Iir_Kind_Procedure_Instantiation_Declaration => 875,
+ Iir_Kind_Terminal_Declaration => 884,
+ Iir_Kind_Object_Alias_Declaration => 896,
+ Iir_Kind_Free_Quantity_Declaration => 908,
+ Iir_Kind_Spectrum_Quantity_Declaration => 921,
+ Iir_Kind_Noise_Quantity_Declaration => 933,
+ Iir_Kind_Across_Quantity_Declaration => 949,
+ Iir_Kind_Through_Quantity_Declaration => 965,
+ Iir_Kind_File_Declaration => 980,
+ Iir_Kind_Guard_Signal_Declaration => 994,
+ Iir_Kind_Signal_Declaration => 1011,
+ Iir_Kind_Variable_Declaration => 1024,
+ Iir_Kind_Constant_Declaration => 1038,
+ Iir_Kind_Iterator_Declaration => 1050,
+ Iir_Kind_Interface_Constant_Declaration => 1067,
+ Iir_Kind_Interface_Variable_Declaration => 1083,
+ Iir_Kind_Interface_Signal_Declaration => 1104,
+ Iir_Kind_Interface_File_Declaration => 1120,
+ Iir_Kind_Interface_Quantity_Declaration => 1136,
+ Iir_Kind_Interface_Terminal_Declaration => 1148,
+ Iir_Kind_Interface_Type_Declaration => 1159,
+ Iir_Kind_Interface_Package_Declaration => 1172,
+ Iir_Kind_Interface_Function_Declaration => 1190,
+ Iir_Kind_Interface_Procedure_Declaration => 1204,
+ Iir_Kind_Anonymous_Signal_Declaration => 1213,
+ Iir_Kind_Signal_Attribute_Declaration => 1216,
+ Iir_Kind_Identity_Operator => 1220,
+ Iir_Kind_Negation_Operator => 1224,
+ Iir_Kind_Absolute_Operator => 1228,
+ Iir_Kind_Not_Operator => 1232,
+ Iir_Kind_Implicit_Condition_Operator => 1236,
+ Iir_Kind_Condition_Operator => 1240,
+ Iir_Kind_Reduction_And_Operator => 1244,
+ Iir_Kind_Reduction_Or_Operator => 1248,
+ Iir_Kind_Reduction_Nand_Operator => 1252,
+ Iir_Kind_Reduction_Nor_Operator => 1256,
+ Iir_Kind_Reduction_Xor_Operator => 1260,
+ Iir_Kind_Reduction_Xnor_Operator => 1264,
+ Iir_Kind_And_Operator => 1269,
+ Iir_Kind_Or_Operator => 1274,
+ Iir_Kind_Nand_Operator => 1279,
+ Iir_Kind_Nor_Operator => 1284,
+ Iir_Kind_Xor_Operator => 1289,
+ Iir_Kind_Xnor_Operator => 1294,
+ Iir_Kind_Equality_Operator => 1299,
+ Iir_Kind_Inequality_Operator => 1304,
+ Iir_Kind_Less_Than_Operator => 1309,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1314,
+ Iir_Kind_Greater_Than_Operator => 1319,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1324,
+ Iir_Kind_Match_Equality_Operator => 1329,
+ Iir_Kind_Match_Inequality_Operator => 1334,
+ Iir_Kind_Match_Less_Than_Operator => 1339,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1344,
+ Iir_Kind_Match_Greater_Than_Operator => 1349,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1354,
+ Iir_Kind_Sll_Operator => 1359,
+ Iir_Kind_Sla_Operator => 1364,
+ Iir_Kind_Srl_Operator => 1369,
+ Iir_Kind_Sra_Operator => 1374,
+ Iir_Kind_Rol_Operator => 1379,
+ Iir_Kind_Ror_Operator => 1384,
+ Iir_Kind_Addition_Operator => 1389,
+ Iir_Kind_Substraction_Operator => 1394,
+ Iir_Kind_Concatenation_Operator => 1399,
+ Iir_Kind_Multiplication_Operator => 1404,
+ Iir_Kind_Division_Operator => 1409,
+ Iir_Kind_Modulus_Operator => 1414,
+ Iir_Kind_Remainder_Operator => 1419,
+ Iir_Kind_Exponentiation_Operator => 1424,
+ Iir_Kind_Function_Call => 1432,
+ Iir_Kind_Aggregate => 1439,
+ Iir_Kind_Parenthesis_Expression => 1442,
+ Iir_Kind_Qualified_Expression => 1446,
+ Iir_Kind_Type_Conversion => 1451,
+ Iir_Kind_Allocator_By_Expression => 1456,
+ Iir_Kind_Allocator_By_Subtype => 1462,
+ Iir_Kind_Selected_Element => 1470,
+ Iir_Kind_Dereference => 1475,
+ Iir_Kind_Implicit_Dereference => 1480,
+ Iir_Kind_Slice_Name => 1487,
+ Iir_Kind_Indexed_Name => 1493,
+ Iir_Kind_Psl_Prev => 1499,
+ Iir_Kind_Psl_Stable => 1504,
+ Iir_Kind_Psl_Rose => 1509,
+ Iir_Kind_Psl_Fell => 1514,
+ Iir_Kind_Psl_Expression => 1516,
+ Iir_Kind_Sensitized_Process_Statement => 1537,
+ Iir_Kind_Process_Statement => 1557,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1570,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1583,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1597,
+ Iir_Kind_Concurrent_Assertion_Statement => 1605,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1612,
+ Iir_Kind_Concurrent_Break_Statement => 1620,
+ Iir_Kind_Psl_Assert_Directive => 1633,
+ Iir_Kind_Psl_Assume_Directive => 1644,
+ Iir_Kind_Psl_Cover_Directive => 1656,
+ Iir_Kind_Psl_Restrict_Directive => 1667,
+ Iir_Kind_Block_Statement => 1681,
+ Iir_Kind_If_Generate_Statement => 1692,
+ Iir_Kind_Case_Generate_Statement => 1701,
+ Iir_Kind_For_Generate_Statement => 1710,
+ Iir_Kind_Component_Instantiation_Statement => 1721,
+ Iir_Kind_Psl_Default_Clock => 1725,
+ Iir_Kind_Generate_Statement_Body => 1736,
+ Iir_Kind_If_Generate_Else_Clause => 1742,
+ Iir_Kind_Simple_Simultaneous_Statement => 1749,
+ Iir_Kind_Simultaneous_Null_Statement => 1753,
+ Iir_Kind_Simultaneous_Procedural_Statement => 1764,
+ Iir_Kind_Simultaneous_Case_Statement => 1773,
+ Iir_Kind_Simultaneous_If_Statement => 1782,
+ Iir_Kind_Simultaneous_Elsif => 1788,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1799,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1810,
+ Iir_Kind_Selected_Waveform_Assignment_Statement => 1822,
+ Iir_Kind_Signal_Force_Assignment_Statement => 1832,
+ Iir_Kind_Signal_Release_Assignment_Statement => 1841,
+ Iir_Kind_Null_Statement => 1845,
+ Iir_Kind_Assertion_Statement => 1852,
+ Iir_Kind_Report_Statement => 1858,
+ Iir_Kind_Wait_Statement => 1866,
+ Iir_Kind_Variable_Assignment_Statement => 1873,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1880,
+ Iir_Kind_Return_Statement => 1886,
+ Iir_Kind_For_Loop_Statement => 1897,
+ Iir_Kind_While_Loop_Statement => 1908,
+ Iir_Kind_Next_Statement => 1915,
+ Iir_Kind_Exit_Statement => 1922,
+ Iir_Kind_Case_Statement => 1930,
+ Iir_Kind_Procedure_Call_Statement => 1936,
+ Iir_Kind_Break_Statement => 1943,
+ Iir_Kind_If_Statement => 1953,
+ Iir_Kind_Elsif => 1959,
+ Iir_Kind_Character_Literal => 1967,
+ Iir_Kind_Simple_Name => 1975,
+ Iir_Kind_Selected_Name => 1984,
+ Iir_Kind_Operator_Symbol => 1990,
+ Iir_Kind_Reference_Name => 1995,
+ Iir_Kind_External_Constant_Name => 2004,
+ Iir_Kind_External_Signal_Name => 2013,
+ Iir_Kind_External_Variable_Name => 2023,
+ Iir_Kind_Selected_By_All_Name => 2029,
+ Iir_Kind_Parenthesis_Name => 2034,
+ Iir_Kind_Package_Pathname => 2038,
+ Iir_Kind_Absolute_Pathname => 2039,
+ Iir_Kind_Relative_Pathname => 2040,
+ Iir_Kind_Pathname_Element => 2045,
+ Iir_Kind_Base_Attribute => 2047,
+ Iir_Kind_Subtype_Attribute => 2052,
+ Iir_Kind_Element_Attribute => 2057,
+ Iir_Kind_Across_Attribute => 2062,
+ Iir_Kind_Through_Attribute => 2067,
+ Iir_Kind_Nature_Reference_Attribute => 2071,
+ Iir_Kind_Left_Type_Attribute => 2076,
+ Iir_Kind_Right_Type_Attribute => 2081,
+ Iir_Kind_High_Type_Attribute => 2086,
+ Iir_Kind_Low_Type_Attribute => 2091,
+ Iir_Kind_Ascending_Type_Attribute => 2096,
+ Iir_Kind_Image_Attribute => 2102,
+ Iir_Kind_Value_Attribute => 2108,
+ Iir_Kind_Pos_Attribute => 2114,
+ Iir_Kind_Val_Attribute => 2120,
+ Iir_Kind_Succ_Attribute => 2126,
+ Iir_Kind_Pred_Attribute => 2132,
+ Iir_Kind_Leftof_Attribute => 2138,
+ Iir_Kind_Rightof_Attribute => 2144,
+ Iir_Kind_Signal_Slew_Attribute => 2152,
+ Iir_Kind_Quantity_Slew_Attribute => 2160,
+ Iir_Kind_Ramp_Attribute => 2168,
+ Iir_Kind_Zoh_Attribute => 2176,
+ Iir_Kind_Ltf_Attribute => 2184,
+ Iir_Kind_Ztf_Attribute => 2194,
+ Iir_Kind_Dot_Attribute => 2201,
+ Iir_Kind_Integ_Attribute => 2208,
+ Iir_Kind_Above_Attribute => 2216,
+ Iir_Kind_Quantity_Delayed_Attribute => 2224,
+ Iir_Kind_Delayed_Attribute => 2233,
+ Iir_Kind_Stable_Attribute => 2242,
+ Iir_Kind_Quiet_Attribute => 2251,
+ Iir_Kind_Transaction_Attribute => 2260,
+ Iir_Kind_Event_Attribute => 2264,
+ Iir_Kind_Active_Attribute => 2268,
+ Iir_Kind_Last_Event_Attribute => 2272,
+ Iir_Kind_Last_Active_Attribute => 2276,
+ Iir_Kind_Last_Value_Attribute => 2280,
+ Iir_Kind_Driving_Attribute => 2284,
+ Iir_Kind_Driving_Value_Attribute => 2288,
+ Iir_Kind_Behavior_Attribute => 2288,
+ Iir_Kind_Structure_Attribute => 2288,
+ Iir_Kind_Simple_Name_Attribute => 2295,
+ Iir_Kind_Instance_Name_Attribute => 2300,
+ Iir_Kind_Path_Name_Attribute => 2305,
+ Iir_Kind_Left_Array_Attribute => 2312,
+ Iir_Kind_Right_Array_Attribute => 2319,
+ Iir_Kind_High_Array_Attribute => 2326,
+ Iir_Kind_Low_Array_Attribute => 2333,
+ Iir_Kind_Length_Array_Attribute => 2340,
+ Iir_Kind_Ascending_Array_Attribute => 2347,
+ Iir_Kind_Range_Array_Attribute => 2354,
+ Iir_Kind_Reverse_Range_Array_Attribute => 2361,
+ Iir_Kind_Attribute_Name => 2370
);
function Get_Fields_First (K : Iir_Kind) return Fields_Index is
@@ -5554,6 +5561,8 @@ package body Vhdl.Nodes_Meta is
return Get_Has_Sign (N);
when Field_Has_Length =>
return Get_Has_Length (N);
+ when Field_Static_Attribute_Flag =>
+ return Get_Static_Attribute_Flag (N);
when Field_Whole_Association_Flag =>
return Get_Whole_Association_Flag (N);
when Field_Collapse_Signal_Flag =>
@@ -5698,6 +5707,8 @@ package body Vhdl.Nodes_Meta is
Set_Has_Sign (N, V);
when Field_Has_Length =>
Set_Has_Length (N, V);
+ when Field_Static_Attribute_Flag =>
+ Set_Static_Attribute_Flag (N, V);
when Field_Whole_Association_Flag =>
Set_Whole_Association_Flag (N, V);
when Field_Collapse_Signal_Flag =>
@@ -7968,6 +7979,11 @@ package body Vhdl.Nodes_Meta is
return K = Iir_Kind_Attribute_Value;
end Has_Attribute_Specification;
+ function Has_Static_Attribute_Flag (K : Iir_Kind) return Boolean is
+ begin
+ return K = Iir_Kind_Attribute_Specification;
+ end Has_Static_Attribute_Flag;
+
function Has_Signal_List (K : Iir_Kind) return Boolean is
begin
return K = Iir_Kind_Disconnection_Specification;
@@ -11983,6 +11999,7 @@ package body Vhdl.Nodes_Meta is
begin
case K is
when Iir_Kind_Entity_Declaration
+ | Iir_Kind_Configuration_Declaration
| Iir_Kind_Package_Declaration
| Iir_Kind_Vmode_Declaration
| Iir_Kind_Vprop_Declaration
diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads
index c71c85928..cbfe0ac3b 100644
--- a/src/vhdl/vhdl-nodes_meta.ads
+++ b/src/vhdl/vhdl-nodes_meta.ads
@@ -108,6 +108,7 @@ package Vhdl.Nodes_Meta is
Field_Attribute_Designator,
Field_Attribute_Specification_Chain,
Field_Attribute_Specification,
+ Field_Static_Attribute_Flag,
Field_Signal_List,
Field_Quantity_List,
Field_Designated_Entity,
@@ -687,6 +688,7 @@ package Vhdl.Nodes_Meta is
function Has_Attribute_Specification_Chain (K : Iir_Kind)
return Boolean;
function Has_Attribute_Specification (K : Iir_Kind) return Boolean;
+ function Has_Static_Attribute_Flag (K : Iir_Kind) return Boolean;
function Has_Signal_List (K : Iir_Kind) return Boolean;
function Has_Quantity_List (K : Iir_Kind) return Boolean;
function Has_Designated_Entity (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb
index f0934de0b..595f5d494 100644
--- a/src/vhdl/vhdl-sem.adb
+++ b/src/vhdl/vhdl-sem.adb
@@ -720,6 +720,7 @@ package body Vhdl.Sem is
Entity_Unit : Iir_Design_Unit;
begin
Xref_Decl (Decl);
+ Set_Is_Within_Flag (Decl, True);
-- LRM 1.3
-- The entity name identifies the name of the entity declaration that
@@ -758,6 +759,7 @@ package body Vhdl.Sem is
Sem_Block_Configuration (Get_Block_Configuration (Decl), Decl);
Close_Declarative_Region;
+ Set_Is_Within_Flag (Decl, False);
end Sem_Configuration_Declaration;
-- Analyze the block specification of a block statement or of a generate
diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb
index 636979880..17db8ba99 100644
--- a/src/vhdl/vhdl-sem_names.adb
+++ b/src/vhdl/vhdl-sem_names.adb
@@ -3315,7 +3315,7 @@ package body Vhdl.Sem_Names is
| Iir_Kind_Unit_Declaration
| Iir_Kind_Component_Declaration
| Iir_Kinds_Library_Unit =>
- -- FIXME: to complete
+ -- FIXME: complete
null;
when Iir_Kinds_Sequential_Statement
| Iir_Kinds_Concurrent_Statement =>
@@ -3341,6 +3341,15 @@ package body Vhdl.Sem_Names is
Xref_Ref (Attr, Value);
+ if Get_Static_Attribute_Flag (Get_Attribute_Specification (Value))
+ and then not Get_Is_Within_Flag (Prefix)
+ and then Get_Expr_Staticness (Value) /= Locally
+ then
+ Error_Msg_Sem
+ (+Attr, "non-locally static attribute cannot be referenced here");
+ return Error_Mark;
+ end if;
+
return Value;
end Sem_User_Attribute;
diff --git a/src/vhdl/vhdl-sem_specs.adb b/src/vhdl/vhdl-sem_specs.adb
index 47db19ff7..5b1f54a67 100644
--- a/src/vhdl/vhdl-sem_specs.adb
+++ b/src/vhdl/vhdl-sem_specs.adb
@@ -836,8 +836,9 @@ package body Vhdl.Sem_Specs is
-- GHDL: test based on the entity_class.
case Get_Entity_Class (Spec) is
when Tok_Entity
- | Tok_Architecture
- | Tok_Configuration =>
+ | Tok_Architecture
+ | Tok_Configuration =>
+ Set_Static_Attribute_Flag (Spec, True);
if Get_Expr_Staticness (Expr) /= Locally then
Error_Msg_Sem_Relaxed
(Spec, Warnid_Attribute,