aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-10-18 02:38:05 +0200
committerTristan Gingold <tgingold@free.fr>2016-10-18 02:47:52 +0200
commit3690c1da73448c3bd3d740809868c5ba6088aaeb (patch)
treeed7bbf2179123f90056c352701180d0982193621
parentdb113af86a8a7fc04775d585feb2b7b432212368 (diff)
downloadghdl-3690c1da73448c3bd3d740809868c5ba6088aaeb.tar.gz
ghdl-3690c1da73448c3bd3d740809868c5ba6088aaeb.tar.bz2
ghdl-3690c1da73448c3bd3d740809868c5ba6088aaeb.zip
ownership: fix arrays and physical types from parse.
-rw-r--r--src/vhdl/disp_vhdl.adb2
-rw-r--r--src/vhdl/evaluation.adb10
-rw-r--r--src/vhdl/iirs.adb24
-rw-r--r--src/vhdl/iirs.ads37
-rw-r--r--src/vhdl/nodes_meta.adb431
-rw-r--r--src/vhdl/nodes_meta.ads2
-rw-r--r--src/vhdl/parse.adb17
-rw-r--r--src/vhdl/sem_decls.adb2
-rw-r--r--src/vhdl/sem_expr.adb15
-rw-r--r--src/vhdl/sem_types.adb45
-rw-r--r--src/vhdl/std_package.adb9
11 files changed, 290 insertions, 304 deletions
diff --git a/src/vhdl/disp_vhdl.adb b/src/vhdl/disp_vhdl.adb
index bfa044e9c..a92fcb2b5 100644
--- a/src/vhdl/disp_vhdl.adb
+++ b/src/vhdl/disp_vhdl.adb
@@ -2123,7 +2123,7 @@ package body Disp_Vhdl is
begin
Disp_Identifier (Iterator);
Put (" in ");
- Disp_Discrete_Range (Get_Discrete_Range (Iterator));
+ Disp_Discrete_Range (Get_Subtype_Indication (Iterator));
end Disp_Parameter_Specification;
procedure Disp_Method_Object (Call : Iir)
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb
index 69d0a6dc8..07aaa0acf 100644
--- a/src/vhdl/evaluation.adb
+++ b/src/vhdl/evaluation.adb
@@ -40,7 +40,9 @@ package body Evaluation is
when Iir_Kind_Physical_Int_Literal
| Iir_Kind_Physical_Fp_Literal =>
-- Extract Unit.
- Unit := Get_Physical_Unit_Value (Get_Physical_Unit (Expr));
+ Unit := Get_Physical_Literal (Get_Physical_Unit (Expr));
+ pragma Assert (Get_Physical_Unit (Unit)
+ = Get_Primary_Unit (Get_Type (Unit)));
case Kind is
when Iir_Kind_Physical_Int_Literal =>
return Get_Value (Expr) * Get_Value (Unit);
@@ -51,7 +53,7 @@ package body Evaluation is
raise Program_Error;
end case;
when Iir_Kind_Unit_Declaration =>
- return Get_Value (Get_Physical_Unit_Value (Expr));
+ return Get_Value (Get_Physical_Literal (Expr));
when others =>
Error_Kind ("get_physical_value", Expr);
end case;
@@ -1748,7 +1750,7 @@ package body Evaluation is
return Build_Overflow (Expr);
end if;
- Mult := Get_Value (Get_Physical_Unit_Value (Unit));
+ Mult := Get_Value (Get_Physical_Literal (Unit));
if Found_Real then
return Build_Physical
(Iir_Int64 (Iir_Fp64'Value (Val (Val'First .. Sep))
@@ -2066,7 +2068,7 @@ package body Evaluation is
when Iir_Kind_Object_Alias_Declaration =>
return Eval_Static_Expr (Get_Name (Expr));
when Iir_Kind_Unit_Declaration =>
- return Get_Physical_Unit_Value (Expr);
+ return Get_Physical_Literal (Expr);
when Iir_Kind_Simple_Aggregate =>
return Expr;
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index db662b8bb..c1a733a5f 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -963,22 +963,6 @@ package body Iirs is
Set_Field4 (Unit, Lit);
end Set_Physical_Literal;
- function Get_Physical_Unit_Value (Unit : Iir) return Iir is
- begin
- pragma Assert (Unit /= Null_Iir);
- pragma Assert (Has_Physical_Unit_Value (Get_Kind (Unit)),
- "no field Physical_Unit_Value");
- return Get_Field5 (Unit);
- end Get_Physical_Unit_Value;
-
- procedure Set_Physical_Unit_Value (Unit : Iir; Lit : Iir) is
- begin
- pragma Assert (Unit /= Null_Iir);
- pragma Assert (Has_Physical_Unit_Value (Get_Kind (Unit)),
- "no field Physical_Unit_Value");
- Set_Field5 (Unit, Lit);
- end Set_Physical_Unit_Value;
-
type Iir_Fp64_Conv is record
Field4: Iir;
Field5: Iir;
@@ -2703,7 +2687,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Unit_Chain (Get_Kind (Target)),
"no field Unit_Chain");
- return Get_Field1 (Target);
+ return Get_Field2 (Target);
end Get_Unit_Chain;
procedure Set_Unit_Chain (Target : Iir; Chain : Iir) is
@@ -2711,7 +2695,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Unit_Chain (Get_Kind (Target)),
"no field Unit_Chain");
- Set_Field1 (Target, Chain);
+ Set_Field2 (Target, Chain);
end Set_Unit_Chain;
function Get_Primary_Unit (Target : Iir) return Iir is
@@ -2719,7 +2703,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Primary_Unit (Get_Kind (Target)),
"no field Primary_Unit");
- return Get_Field1 (Target);
+ return Get_Field2 (Target);
end Get_Primary_Unit;
procedure Set_Primary_Unit (Target : Iir; Unit : Iir) is
@@ -2727,7 +2711,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Primary_Unit (Get_Kind (Target)),
"no field Primary_Unit");
- Set_Field1 (Target, Unit);
+ Set_Field2 (Target, Unit);
end Set_Primary_Unit;
function Get_Identifier (Target : Iir) return Name_Id is
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 9d1ee61fe..9310185c5 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -2072,8 +2072,11 @@ package Iirs is
-- Iir_Kind_Physical_Type_Definition (Short)
--
- -- Get/Set_Unit_Chain (Field1)
- -- Get/Set_Primary_Unit (Alias Field1)
+ -- The range_constraint from the type declaration.
+ -- Get/Set_Range_Constraint (Field1)
+ --
+ -- Get/Set_Unit_Chain (Field2)
+ -- Get/Set_Primary_Unit (Alias Field2)
--
-- Get/Set_Type_Declarator (Field3)
--
@@ -2087,6 +2090,8 @@ package Iirs is
--
-- Get/Set_Type_Staticness (State1)
--
+ -- Get/Set_Is_Ref (Flag7)
+ --
-- Get/Set_End_Has_Reserved_Id (Flag8)
--
-- Get/Set_End_Has_Identifier (Flag9)
@@ -2111,12 +2116,10 @@ package Iirs is
--
-- Get/Set_Identifier (Field3)
--
- -- The value of the unit, computed from the primary unit. This is always
- -- a physical integer literal.
- -- Get/Set_Physical_Unit_Value (Field5)
- --
- -- The Physical_Literal is the expression that appear in the sources, so
- -- this is Null_Iir for a primary unit.
+ -- The Physical_Literal is the expression that defines the value of a
+ -- unit. It is evaluated during analysis and thus expressed as a multiple
+ -- of the primary unit. That's true even for the primary unit whose value
+ -- is thus 1.
-- Get/Set_Physical_Literal (Field4)
--
-- Get/Set_Expr_Staticness (State1)
@@ -2138,6 +2141,9 @@ package Iirs is
-- Iir_Kind_Integer_Type_Definition (Short)
-- Iir_Kind_Floating_Type_Definition (Short)
--
+ -- The range_constraint from the type declaration.
+ -- Get/Set_Range_Constraint (Field1)
+ --
-- The type declarator that has created this type.
-- Get/Set_Type_Declarator (Field3)
--
@@ -2151,6 +2157,8 @@ package Iirs is
-- Get/Set_Signal_Type_Flag (Flag2)
--
-- Get/Set_Has_Signal_Flag (Flag3)
+ --
+ -- Get/Set_Is_Ref (Flag7)
-- Iir_Kind_Array_Type_Definition (Medium)
--
@@ -5727,15 +5735,10 @@ package Iirs is
function Get_Enum_Pos (Lit : Iir) return Iir_Int32;
procedure Set_Enum_Pos (Lit : Iir; Val : Iir_Int32);
- -- Field: Field4 Ref
+ -- Field: Field4
function Get_Physical_Literal (Unit : Iir) return Iir;
procedure Set_Physical_Literal (Unit : Iir; Lit : Iir);
- -- Value of a physical unit declaration.
- -- Field: Field5
- function Get_Physical_Unit_Value (Unit : Iir) return Iir;
- procedure Set_Physical_Unit_Value (Unit : Iir; Lit : Iir);
-
-- Value of a floating point literal.
-- Field: Field4,Field5 (grp)
function Get_Fp_Value (Lit : Iir) return Iir_Fp64;
@@ -6033,7 +6036,7 @@ package Iirs is
-- Discrete range of an iterator. During analysis, a subtype indiciation
-- is created from this range.
- -- Field: Field6 Ref
+ -- Field: Field6
function Get_Discrete_Range (Target : Iir) return Iir;
procedure Set_Discrete_Range (Target : Iir; Rng : Iir);
@@ -6264,13 +6267,13 @@ package Iirs is
-- Chain of physical type units.
-- The first unit is the primary unit. If you really need the primary
-- unit (and not the chain), you'd better to use Get_Primary_Unit.
- -- Field: Field1 Chain
+ -- Field: Field2 Chain
function Get_Unit_Chain (Target : Iir) return Iir;
procedure Set_Unit_Chain (Target : Iir; Chain : Iir);
-- Alias of Get_Unit_Chain.
-- Return the primary unit of a physical type.
- -- Field: Field1 Ref
+ -- Field: Field2 Ref
function Get_Primary_Unit (Target : Iir) return Iir;
procedure Set_Primary_Unit (Target : Iir; Unit : Iir);
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index 8198f3194..98c34d187 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -45,7 +45,6 @@ package body Nodes_Meta is
Field_Value => Type_Iir_Int64,
Field_Enum_Pos => Type_Iir_Int32,
Field_Physical_Literal => Type_Iir,
- Field_Physical_Unit_Value => Type_Iir,
Field_Fp_Value => Type_Iir_Fp64,
Field_Simple_Aggregate_List => Type_Iir_List,
Field_String8_Id => Type_String8_Id,
@@ -407,8 +406,6 @@ package body Nodes_Meta is
return "enum_pos";
when Field_Physical_Literal =>
return "physical_literal";
- when Field_Physical_Unit_Value =>
- return "physical_unit_value";
when Field_Fp_Value =>
return "fp_value";
when Field_Simple_Aggregate_List =>
@@ -1598,8 +1595,6 @@ package body Nodes_Meta is
when Field_Enum_Pos =>
return Attr_None;
when Field_Physical_Literal =>
- return Attr_Ref;
- when Field_Physical_Unit_Value =>
return Attr_None;
when Field_Fp_Value =>
return Attr_None;
@@ -1720,7 +1715,7 @@ package body Nodes_Meta is
when Field_Subtype_Indication =>
return Attr_None;
when Field_Discrete_Range =>
- return Attr_Ref;
+ return Attr_None;
when Field_Type_Definition =>
return Attr_None;
when Field_Subtype_Definition =>
@@ -2659,23 +2654,29 @@ package body Nodes_Meta is
Field_Resolved_Flag,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Is_Ref,
Field_Type_Staticness,
+ Field_Range_Constraint,
Field_Type_Declarator,
Field_Base_Type,
-- Iir_Kind_Floating_Type_Definition
Field_Resolved_Flag,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Is_Ref,
Field_Type_Staticness,
+ Field_Range_Constraint,
Field_Type_Declarator,
Field_Base_Type,
-- Iir_Kind_Physical_Type_Definition
Field_Resolved_Flag,
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
+ Field_Is_Ref,
Field_End_Has_Reserved_Id,
Field_End_Has_Identifier,
Field_Type_Staticness,
+ Field_Range_Constraint,
Field_Unit_Chain,
Field_Type_Declarator,
Field_Base_Type,
@@ -2845,7 +2846,6 @@ package body Nodes_Meta is
Field_Parent,
Field_Type,
Field_Chain,
- Field_Physical_Unit_Value,
Field_Physical_Literal,
-- Iir_Kind_Library_Declaration
Field_Identifier,
@@ -4383,207 +4383,207 @@ package body Nodes_Meta is
Iir_Kind_Integer_Subtype_Definition => 367,
Iir_Kind_Enumeration_Subtype_Definition => 377,
Iir_Kind_Enumeration_Type_Definition => 387,
- Iir_Kind_Integer_Type_Definition => 393,
- Iir_Kind_Floating_Type_Definition => 399,
- Iir_Kind_Physical_Type_Definition => 408,
- Iir_Kind_Range_Expression => 416,
- Iir_Kind_Protected_Type_Body => 423,
- Iir_Kind_Wildcard_Type_Definition => 428,
- Iir_Kind_Subtype_Definition => 433,
- Iir_Kind_Scalar_Nature_Definition => 437,
- Iir_Kind_Overload_List => 438,
- Iir_Kind_Type_Declaration => 445,
- Iir_Kind_Anonymous_Type_Declaration => 451,
- Iir_Kind_Subtype_Declaration => 458,
- Iir_Kind_Nature_Declaration => 464,
- Iir_Kind_Subnature_Declaration => 470,
- Iir_Kind_Package_Declaration => 485,
- Iir_Kind_Package_Instantiation_Declaration => 498,
- Iir_Kind_Package_Body => 506,
- Iir_Kind_Configuration_Declaration => 515,
- Iir_Kind_Entity_Declaration => 527,
- Iir_Kind_Architecture_Body => 539,
- Iir_Kind_Context_Declaration => 545,
- Iir_Kind_Package_Header => 547,
- Iir_Kind_Unit_Declaration => 556,
- Iir_Kind_Library_Declaration => 563,
- Iir_Kind_Component_Declaration => 573,
- Iir_Kind_Attribute_Declaration => 580,
- Iir_Kind_Group_Template_Declaration => 586,
- Iir_Kind_Group_Declaration => 593,
- Iir_Kind_Element_Declaration => 600,
- Iir_Kind_Non_Object_Alias_Declaration => 608,
- Iir_Kind_Psl_Declaration => 616,
- Iir_Kind_Psl_Endpoint_Declaration => 630,
- Iir_Kind_Terminal_Declaration => 636,
- Iir_Kind_Free_Quantity_Declaration => 645,
- Iir_Kind_Across_Quantity_Declaration => 657,
- Iir_Kind_Through_Quantity_Declaration => 669,
- Iir_Kind_Enumeration_Literal => 680,
- Iir_Kind_Function_Declaration => 705,
- Iir_Kind_Procedure_Declaration => 729,
- Iir_Kind_Function_Body => 739,
- Iir_Kind_Procedure_Body => 750,
- Iir_Kind_Object_Alias_Declaration => 761,
- Iir_Kind_File_Declaration => 775,
- Iir_Kind_Guard_Signal_Declaration => 788,
- Iir_Kind_Signal_Declaration => 805,
- Iir_Kind_Variable_Declaration => 818,
- Iir_Kind_Constant_Declaration => 832,
- Iir_Kind_Iterator_Declaration => 843,
- Iir_Kind_Interface_Constant_Declaration => 859,
- Iir_Kind_Interface_Variable_Declaration => 875,
- Iir_Kind_Interface_Signal_Declaration => 896,
- Iir_Kind_Interface_File_Declaration => 912,
- Iir_Kind_Interface_Type_Declaration => 922,
- Iir_Kind_Interface_Package_Declaration => 933,
- Iir_Kind_Interface_Function_Declaration => 950,
- Iir_Kind_Interface_Procedure_Declaration => 963,
- Iir_Kind_Signal_Attribute_Declaration => 966,
- Iir_Kind_Identity_Operator => 970,
- Iir_Kind_Negation_Operator => 974,
- Iir_Kind_Absolute_Operator => 978,
- Iir_Kind_Not_Operator => 982,
- Iir_Kind_Condition_Operator => 986,
- Iir_Kind_Reduction_And_Operator => 990,
- Iir_Kind_Reduction_Or_Operator => 994,
- Iir_Kind_Reduction_Nand_Operator => 998,
- Iir_Kind_Reduction_Nor_Operator => 1002,
- Iir_Kind_Reduction_Xor_Operator => 1006,
- Iir_Kind_Reduction_Xnor_Operator => 1010,
- Iir_Kind_And_Operator => 1015,
- Iir_Kind_Or_Operator => 1020,
- Iir_Kind_Nand_Operator => 1025,
- Iir_Kind_Nor_Operator => 1030,
- Iir_Kind_Xor_Operator => 1035,
- Iir_Kind_Xnor_Operator => 1040,
- Iir_Kind_Equality_Operator => 1045,
- Iir_Kind_Inequality_Operator => 1050,
- Iir_Kind_Less_Than_Operator => 1055,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1060,
- Iir_Kind_Greater_Than_Operator => 1065,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1070,
- Iir_Kind_Match_Equality_Operator => 1075,
- Iir_Kind_Match_Inequality_Operator => 1080,
- Iir_Kind_Match_Less_Than_Operator => 1085,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1090,
- Iir_Kind_Match_Greater_Than_Operator => 1095,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1100,
- Iir_Kind_Sll_Operator => 1105,
- Iir_Kind_Sla_Operator => 1110,
- Iir_Kind_Srl_Operator => 1115,
- Iir_Kind_Sra_Operator => 1120,
- Iir_Kind_Rol_Operator => 1125,
- Iir_Kind_Ror_Operator => 1130,
- Iir_Kind_Addition_Operator => 1135,
- Iir_Kind_Substraction_Operator => 1140,
- Iir_Kind_Concatenation_Operator => 1145,
- Iir_Kind_Multiplication_Operator => 1150,
- Iir_Kind_Division_Operator => 1155,
- Iir_Kind_Modulus_Operator => 1160,
- Iir_Kind_Remainder_Operator => 1165,
- Iir_Kind_Exponentiation_Operator => 1170,
- Iir_Kind_Function_Call => 1178,
- Iir_Kind_Aggregate => 1184,
- Iir_Kind_Parenthesis_Expression => 1187,
- Iir_Kind_Qualified_Expression => 1191,
- Iir_Kind_Type_Conversion => 1196,
- Iir_Kind_Allocator_By_Expression => 1200,
- Iir_Kind_Allocator_By_Subtype => 1205,
- Iir_Kind_Selected_Element => 1211,
- Iir_Kind_Dereference => 1216,
- Iir_Kind_Implicit_Dereference => 1221,
- Iir_Kind_Slice_Name => 1228,
- Iir_Kind_Indexed_Name => 1234,
- Iir_Kind_Psl_Expression => 1236,
- Iir_Kind_Sensitized_Process_Statement => 1256,
- Iir_Kind_Process_Statement => 1276,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1287,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1298,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1310,
- Iir_Kind_Concurrent_Assertion_Statement => 1318,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1325,
- Iir_Kind_Psl_Assert_Statement => 1338,
- Iir_Kind_Psl_Cover_Statement => 1351,
- Iir_Kind_Block_Statement => 1364,
- Iir_Kind_If_Generate_Statement => 1374,
- Iir_Kind_Case_Generate_Statement => 1383,
- Iir_Kind_For_Generate_Statement => 1392,
- Iir_Kind_Component_Instantiation_Statement => 1402,
- Iir_Kind_Psl_Default_Clock => 1406,
- Iir_Kind_Simple_Simultaneous_Statement => 1413,
- Iir_Kind_Generate_Statement_Body => 1424,
- Iir_Kind_If_Generate_Else_Clause => 1429,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1438,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1447,
- Iir_Kind_Null_Statement => 1451,
- Iir_Kind_Assertion_Statement => 1458,
- Iir_Kind_Report_Statement => 1464,
- Iir_Kind_Wait_Statement => 1471,
- Iir_Kind_Variable_Assignment_Statement => 1477,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1483,
- Iir_Kind_Return_Statement => 1489,
- Iir_Kind_For_Loop_Statement => 1498,
- Iir_Kind_While_Loop_Statement => 1506,
- Iir_Kind_Next_Statement => 1512,
- Iir_Kind_Exit_Statement => 1518,
- Iir_Kind_Case_Statement => 1526,
- Iir_Kind_Procedure_Call_Statement => 1532,
- Iir_Kind_If_Statement => 1541,
- Iir_Kind_Elsif => 1546,
- Iir_Kind_Character_Literal => 1554,
- Iir_Kind_Simple_Name => 1562,
- Iir_Kind_Selected_Name => 1571,
- Iir_Kind_Operator_Symbol => 1577,
- Iir_Kind_Reference_Name => 1580,
- Iir_Kind_Selected_By_All_Name => 1586,
- Iir_Kind_Parenthesis_Name => 1591,
- Iir_Kind_External_Constant_Name => 1599,
- Iir_Kind_External_Signal_Name => 1607,
- Iir_Kind_External_Variable_Name => 1615,
- Iir_Kind_Package_Pathname => 1619,
- Iir_Kind_Absolute_Pathname => 1620,
- Iir_Kind_Relative_Pathname => 1621,
- Iir_Kind_Pathname_Element => 1626,
- Iir_Kind_Base_Attribute => 1628,
- Iir_Kind_Left_Type_Attribute => 1633,
- Iir_Kind_Right_Type_Attribute => 1638,
- Iir_Kind_High_Type_Attribute => 1643,
- Iir_Kind_Low_Type_Attribute => 1648,
- Iir_Kind_Ascending_Type_Attribute => 1653,
- Iir_Kind_Image_Attribute => 1659,
- Iir_Kind_Value_Attribute => 1665,
- Iir_Kind_Pos_Attribute => 1671,
- Iir_Kind_Val_Attribute => 1677,
- Iir_Kind_Succ_Attribute => 1683,
- Iir_Kind_Pred_Attribute => 1689,
- Iir_Kind_Leftof_Attribute => 1695,
- Iir_Kind_Rightof_Attribute => 1701,
- Iir_Kind_Delayed_Attribute => 1710,
- Iir_Kind_Stable_Attribute => 1719,
- Iir_Kind_Quiet_Attribute => 1728,
- Iir_Kind_Transaction_Attribute => 1737,
- Iir_Kind_Event_Attribute => 1741,
- Iir_Kind_Active_Attribute => 1745,
- Iir_Kind_Last_Event_Attribute => 1749,
- Iir_Kind_Last_Active_Attribute => 1753,
- Iir_Kind_Last_Value_Attribute => 1757,
- Iir_Kind_Driving_Attribute => 1761,
- Iir_Kind_Driving_Value_Attribute => 1765,
- Iir_Kind_Behavior_Attribute => 1765,
- Iir_Kind_Structure_Attribute => 1765,
- Iir_Kind_Simple_Name_Attribute => 1772,
- Iir_Kind_Instance_Name_Attribute => 1777,
- Iir_Kind_Path_Name_Attribute => 1782,
- Iir_Kind_Left_Array_Attribute => 1789,
- Iir_Kind_Right_Array_Attribute => 1796,
- Iir_Kind_High_Array_Attribute => 1803,
- Iir_Kind_Low_Array_Attribute => 1810,
- Iir_Kind_Length_Array_Attribute => 1817,
- Iir_Kind_Ascending_Array_Attribute => 1824,
- Iir_Kind_Range_Array_Attribute => 1831,
- Iir_Kind_Reverse_Range_Array_Attribute => 1838,
- Iir_Kind_Attribute_Name => 1847
+ Iir_Kind_Integer_Type_Definition => 395,
+ Iir_Kind_Floating_Type_Definition => 403,
+ Iir_Kind_Physical_Type_Definition => 414,
+ Iir_Kind_Range_Expression => 422,
+ Iir_Kind_Protected_Type_Body => 429,
+ Iir_Kind_Wildcard_Type_Definition => 434,
+ Iir_Kind_Subtype_Definition => 439,
+ Iir_Kind_Scalar_Nature_Definition => 443,
+ Iir_Kind_Overload_List => 444,
+ Iir_Kind_Type_Declaration => 451,
+ Iir_Kind_Anonymous_Type_Declaration => 457,
+ Iir_Kind_Subtype_Declaration => 464,
+ Iir_Kind_Nature_Declaration => 470,
+ Iir_Kind_Subnature_Declaration => 476,
+ Iir_Kind_Package_Declaration => 491,
+ Iir_Kind_Package_Instantiation_Declaration => 504,
+ Iir_Kind_Package_Body => 512,
+ Iir_Kind_Configuration_Declaration => 521,
+ Iir_Kind_Entity_Declaration => 533,
+ Iir_Kind_Architecture_Body => 545,
+ Iir_Kind_Context_Declaration => 551,
+ Iir_Kind_Package_Header => 553,
+ Iir_Kind_Unit_Declaration => 561,
+ Iir_Kind_Library_Declaration => 568,
+ Iir_Kind_Component_Declaration => 578,
+ Iir_Kind_Attribute_Declaration => 585,
+ Iir_Kind_Group_Template_Declaration => 591,
+ Iir_Kind_Group_Declaration => 598,
+ Iir_Kind_Element_Declaration => 605,
+ Iir_Kind_Non_Object_Alias_Declaration => 613,
+ Iir_Kind_Psl_Declaration => 621,
+ Iir_Kind_Psl_Endpoint_Declaration => 635,
+ Iir_Kind_Terminal_Declaration => 641,
+ Iir_Kind_Free_Quantity_Declaration => 650,
+ Iir_Kind_Across_Quantity_Declaration => 662,
+ Iir_Kind_Through_Quantity_Declaration => 674,
+ Iir_Kind_Enumeration_Literal => 685,
+ Iir_Kind_Function_Declaration => 710,
+ Iir_Kind_Procedure_Declaration => 734,
+ Iir_Kind_Function_Body => 744,
+ Iir_Kind_Procedure_Body => 755,
+ Iir_Kind_Object_Alias_Declaration => 766,
+ Iir_Kind_File_Declaration => 780,
+ Iir_Kind_Guard_Signal_Declaration => 793,
+ Iir_Kind_Signal_Declaration => 810,
+ Iir_Kind_Variable_Declaration => 823,
+ Iir_Kind_Constant_Declaration => 837,
+ Iir_Kind_Iterator_Declaration => 848,
+ Iir_Kind_Interface_Constant_Declaration => 864,
+ Iir_Kind_Interface_Variable_Declaration => 880,
+ Iir_Kind_Interface_Signal_Declaration => 901,
+ Iir_Kind_Interface_File_Declaration => 917,
+ Iir_Kind_Interface_Type_Declaration => 927,
+ Iir_Kind_Interface_Package_Declaration => 938,
+ Iir_Kind_Interface_Function_Declaration => 955,
+ Iir_Kind_Interface_Procedure_Declaration => 968,
+ Iir_Kind_Signal_Attribute_Declaration => 971,
+ Iir_Kind_Identity_Operator => 975,
+ Iir_Kind_Negation_Operator => 979,
+ Iir_Kind_Absolute_Operator => 983,
+ Iir_Kind_Not_Operator => 987,
+ Iir_Kind_Condition_Operator => 991,
+ Iir_Kind_Reduction_And_Operator => 995,
+ Iir_Kind_Reduction_Or_Operator => 999,
+ Iir_Kind_Reduction_Nand_Operator => 1003,
+ Iir_Kind_Reduction_Nor_Operator => 1007,
+ Iir_Kind_Reduction_Xor_Operator => 1011,
+ Iir_Kind_Reduction_Xnor_Operator => 1015,
+ Iir_Kind_And_Operator => 1020,
+ Iir_Kind_Or_Operator => 1025,
+ Iir_Kind_Nand_Operator => 1030,
+ Iir_Kind_Nor_Operator => 1035,
+ Iir_Kind_Xor_Operator => 1040,
+ Iir_Kind_Xnor_Operator => 1045,
+ Iir_Kind_Equality_Operator => 1050,
+ Iir_Kind_Inequality_Operator => 1055,
+ Iir_Kind_Less_Than_Operator => 1060,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1065,
+ Iir_Kind_Greater_Than_Operator => 1070,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1075,
+ Iir_Kind_Match_Equality_Operator => 1080,
+ Iir_Kind_Match_Inequality_Operator => 1085,
+ Iir_Kind_Match_Less_Than_Operator => 1090,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1095,
+ Iir_Kind_Match_Greater_Than_Operator => 1100,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1105,
+ Iir_Kind_Sll_Operator => 1110,
+ Iir_Kind_Sla_Operator => 1115,
+ Iir_Kind_Srl_Operator => 1120,
+ Iir_Kind_Sra_Operator => 1125,
+ Iir_Kind_Rol_Operator => 1130,
+ Iir_Kind_Ror_Operator => 1135,
+ Iir_Kind_Addition_Operator => 1140,
+ Iir_Kind_Substraction_Operator => 1145,
+ Iir_Kind_Concatenation_Operator => 1150,
+ Iir_Kind_Multiplication_Operator => 1155,
+ Iir_Kind_Division_Operator => 1160,
+ Iir_Kind_Modulus_Operator => 1165,
+ Iir_Kind_Remainder_Operator => 1170,
+ Iir_Kind_Exponentiation_Operator => 1175,
+ Iir_Kind_Function_Call => 1183,
+ Iir_Kind_Aggregate => 1189,
+ Iir_Kind_Parenthesis_Expression => 1192,
+ Iir_Kind_Qualified_Expression => 1196,
+ Iir_Kind_Type_Conversion => 1201,
+ Iir_Kind_Allocator_By_Expression => 1205,
+ Iir_Kind_Allocator_By_Subtype => 1210,
+ Iir_Kind_Selected_Element => 1216,
+ Iir_Kind_Dereference => 1221,
+ Iir_Kind_Implicit_Dereference => 1226,
+ Iir_Kind_Slice_Name => 1233,
+ Iir_Kind_Indexed_Name => 1239,
+ Iir_Kind_Psl_Expression => 1241,
+ Iir_Kind_Sensitized_Process_Statement => 1261,
+ Iir_Kind_Process_Statement => 1281,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1292,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1303,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1315,
+ Iir_Kind_Concurrent_Assertion_Statement => 1323,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1330,
+ Iir_Kind_Psl_Assert_Statement => 1343,
+ Iir_Kind_Psl_Cover_Statement => 1356,
+ Iir_Kind_Block_Statement => 1369,
+ Iir_Kind_If_Generate_Statement => 1379,
+ Iir_Kind_Case_Generate_Statement => 1388,
+ Iir_Kind_For_Generate_Statement => 1397,
+ Iir_Kind_Component_Instantiation_Statement => 1407,
+ Iir_Kind_Psl_Default_Clock => 1411,
+ Iir_Kind_Simple_Simultaneous_Statement => 1418,
+ Iir_Kind_Generate_Statement_Body => 1429,
+ Iir_Kind_If_Generate_Else_Clause => 1434,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1443,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1452,
+ Iir_Kind_Null_Statement => 1456,
+ Iir_Kind_Assertion_Statement => 1463,
+ Iir_Kind_Report_Statement => 1469,
+ Iir_Kind_Wait_Statement => 1476,
+ Iir_Kind_Variable_Assignment_Statement => 1482,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1488,
+ Iir_Kind_Return_Statement => 1494,
+ Iir_Kind_For_Loop_Statement => 1503,
+ Iir_Kind_While_Loop_Statement => 1511,
+ Iir_Kind_Next_Statement => 1517,
+ Iir_Kind_Exit_Statement => 1523,
+ Iir_Kind_Case_Statement => 1531,
+ Iir_Kind_Procedure_Call_Statement => 1537,
+ Iir_Kind_If_Statement => 1546,
+ Iir_Kind_Elsif => 1551,
+ Iir_Kind_Character_Literal => 1559,
+ Iir_Kind_Simple_Name => 1567,
+ Iir_Kind_Selected_Name => 1576,
+ Iir_Kind_Operator_Symbol => 1582,
+ Iir_Kind_Reference_Name => 1585,
+ Iir_Kind_Selected_By_All_Name => 1591,
+ Iir_Kind_Parenthesis_Name => 1596,
+ Iir_Kind_External_Constant_Name => 1604,
+ Iir_Kind_External_Signal_Name => 1612,
+ Iir_Kind_External_Variable_Name => 1620,
+ Iir_Kind_Package_Pathname => 1624,
+ Iir_Kind_Absolute_Pathname => 1625,
+ Iir_Kind_Relative_Pathname => 1626,
+ Iir_Kind_Pathname_Element => 1631,
+ Iir_Kind_Base_Attribute => 1633,
+ Iir_Kind_Left_Type_Attribute => 1638,
+ Iir_Kind_Right_Type_Attribute => 1643,
+ Iir_Kind_High_Type_Attribute => 1648,
+ Iir_Kind_Low_Type_Attribute => 1653,
+ Iir_Kind_Ascending_Type_Attribute => 1658,
+ Iir_Kind_Image_Attribute => 1664,
+ Iir_Kind_Value_Attribute => 1670,
+ Iir_Kind_Pos_Attribute => 1676,
+ Iir_Kind_Val_Attribute => 1682,
+ Iir_Kind_Succ_Attribute => 1688,
+ Iir_Kind_Pred_Attribute => 1694,
+ Iir_Kind_Leftof_Attribute => 1700,
+ Iir_Kind_Rightof_Attribute => 1706,
+ Iir_Kind_Delayed_Attribute => 1715,
+ Iir_Kind_Stable_Attribute => 1724,
+ Iir_Kind_Quiet_Attribute => 1733,
+ Iir_Kind_Transaction_Attribute => 1742,
+ Iir_Kind_Event_Attribute => 1746,
+ Iir_Kind_Active_Attribute => 1750,
+ Iir_Kind_Last_Event_Attribute => 1754,
+ Iir_Kind_Last_Active_Attribute => 1758,
+ Iir_Kind_Last_Value_Attribute => 1762,
+ Iir_Kind_Driving_Attribute => 1766,
+ Iir_Kind_Driving_Value_Attribute => 1770,
+ Iir_Kind_Behavior_Attribute => 1770,
+ Iir_Kind_Structure_Attribute => 1770,
+ Iir_Kind_Simple_Name_Attribute => 1777,
+ Iir_Kind_Instance_Name_Attribute => 1782,
+ Iir_Kind_Path_Name_Attribute => 1787,
+ Iir_Kind_Left_Array_Attribute => 1794,
+ Iir_Kind_Right_Array_Attribute => 1801,
+ Iir_Kind_High_Array_Attribute => 1808,
+ Iir_Kind_Low_Array_Attribute => 1815,
+ Iir_Kind_Length_Array_Attribute => 1822,
+ Iir_Kind_Ascending_Array_Attribute => 1829,
+ Iir_Kind_Range_Array_Attribute => 1836,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1843,
+ Iir_Kind_Attribute_Name => 1852
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -4945,8 +4945,6 @@ package body Nodes_Meta is
return Get_Hash_Chain (N);
when Field_Physical_Literal =>
return Get_Physical_Literal (N);
- when Field_Physical_Unit_Value =>
- return Get_Physical_Unit_Value (N);
when Field_Literal_Origin =>
return Get_Literal_Origin (N);
when Field_Range_Origin =>
@@ -5351,8 +5349,6 @@ package body Nodes_Meta is
Set_Hash_Chain (N, V);
when Field_Physical_Literal =>
Set_Physical_Literal (N, V);
- when Field_Physical_Unit_Value =>
- Set_Physical_Unit_Value (N, V);
when Field_Literal_Origin =>
Set_Literal_Origin (N, V);
when Field_Range_Origin =>
@@ -6661,11 +6657,6 @@ package body Nodes_Meta is
return K = Iir_Kind_Unit_Declaration;
end Has_Physical_Literal;
- function Has_Physical_Unit_Value (K : Iir_Kind) return Boolean is
- begin
- return K = Iir_Kind_Unit_Declaration;
- end Has_Physical_Unit_Value;
-
function Has_Fp_Value (K : Iir_Kind) return Boolean is
begin
case K is
@@ -8128,6 +8119,9 @@ package body Nodes_Meta is
| Iir_Kind_Integer_Subtype_Definition
| Iir_Kind_Enumeration_Subtype_Definition
| Iir_Kind_Enumeration_Type_Definition
+ | Iir_Kind_Integer_Type_Definition
+ | Iir_Kind_Floating_Type_Definition
+ | Iir_Kind_Physical_Type_Definition
| Iir_Kind_Subtype_Definition =>
return True;
when others =>
@@ -10403,6 +10397,9 @@ package body Nodes_Meta is
| Iir_Kind_Integer_Subtype_Definition
| Iir_Kind_Enumeration_Subtype_Definition
| Iir_Kind_Enumeration_Type_Definition
+ | Iir_Kind_Integer_Type_Definition
+ | Iir_Kind_Floating_Type_Definition
+ | Iir_Kind_Physical_Type_Definition
| Iir_Kind_Subtype_Definition
| Iir_Kind_Signal_Declaration
| Iir_Kind_Variable_Declaration
diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads
index c9d51c9da..ea92cb2f4 100644
--- a/src/vhdl/nodes_meta.ads
+++ b/src/vhdl/nodes_meta.ads
@@ -85,7 +85,6 @@ package Nodes_Meta is
Field_Value,
Field_Enum_Pos,
Field_Physical_Literal,
- Field_Physical_Unit_Value,
Field_Fp_Value,
Field_Simple_Aggregate_List,
Field_String8_Id,
@@ -593,7 +592,6 @@ package Nodes_Meta is
function Has_Value (K : Iir_Kind) return Boolean;
function Has_Enum_Pos (K : Iir_Kind) return Boolean;
function Has_Physical_Literal (K : Iir_Kind) return Boolean;
- function Has_Physical_Unit_Value (K : Iir_Kind) return Boolean;
function Has_Fp_Value (K : Iir_Kind) return Boolean;
function Has_Simple_Aggregate_List (K : Iir_Kind) return Boolean;
function Has_String8_Id (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 49ce426e4..7d4598a4a 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -2016,7 +2016,7 @@ package body Parse is
if Array_Constrained then
-- Sem_Type will create the array type.
Res_Type := Create_Iir (Iir_Kind_Array_Subtype_Definition);
- Set_Element_Subtype (Res_Type, Element_Subtype);
+ Set_Array_Element_Constraint (Res_Type, Element_Subtype);
Set_Index_Constraint_List (Res_Type, Index_List);
else
Res_Type := Create_Iir (Iir_Kind_Array_Type_Definition);
@@ -2045,7 +2045,7 @@ package body Parse is
-- [ LRM93 3.1.3 ]
-- secondary_unit_declaration ::= identifier = physical_literal ;
function Parse_Physical_Type_Definition (Parent : Iir)
- return Iir_Physical_Type_Definition
+ return Iir_Physical_Type_Definition
is
use Iir_Chains.Unit_Chain_Handling;
Res: Iir_Physical_Type_Definition;
@@ -2392,19 +2392,18 @@ package body Parse is
if Current_Token = Tok_Units then
-- A physical type definition.
declare
- Unit_Def : Iir;
+ Phys_Def : Iir;
begin
- Unit_Def := Parse_Physical_Type_Definition (Parent);
+ Phys_Def := Parse_Physical_Type_Definition (Parent);
if Current_Token = Tok_Identifier then
if Flags.Vhdl_Std = Vhdl_87 then
Error_Msg_Parse
("simple_name not allowed here in vhdl87");
end if;
- Check_End_Name (Get_Identifier (Decl), Unit_Def);
- end if;
- if Def /= Null_Iir then
- Set_Type (Def, Unit_Def);
+ Check_End_Name (Get_Identifier (Decl), Phys_Def);
end if;
+ Set_Range_Constraint (Phys_Def, Def);
+ Set_Type_Definition (Decl, Phys_Def);
end;
end if;
@@ -2631,7 +2630,7 @@ package body Parse is
Scan;
if Current_Token = Tok_Left_Paren then
- Set_Element_Subtype (Def, Parse_Element_Constraint);
+ Set_Array_Element_Constraint (Def, Parse_Element_Constraint);
end if;
return Def;
end Parse_Element_Constraint;
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index 20ce9aae6..9fac6d50e 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -3230,7 +3230,7 @@ package body Sem_Decls is
return;
end if;
- Set_Discrete_Range (Iterator, A_Range);
+ Set_Discrete_Range (Iterator, Null_Iir);
It_Type := Range_To_Subtype_Indication (A_Range);
Set_Subtype_Indication (Iterator, It_Type);
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 892fbfc7a..9807fc24a 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -3552,6 +3552,7 @@ package body Sem_Expr is
function Sem_Physical_Literal (Lit: Iir) return Iir
is
Unit_Name : Iir;
+ Unit : Iir;
Unit_Type : Iir;
Res: Iir;
begin
@@ -3570,9 +3571,11 @@ package body Sem_Expr is
Error_Kind ("sem_physical_literal", Lit);
end case;
Unit_Name := Sem_Denoting_Name (Unit_Name);
- if Get_Kind (Get_Named_Entity (Unit_Name)) /= Iir_Kind_Unit_Declaration
- then
- Error_Class_Match (Unit_Name, "unit");
+ Unit := Get_Named_Entity (Unit_Name);
+ if Get_Kind (Unit) /= Iir_Kind_Unit_Declaration then
+ if not Is_Error (Unit) then
+ Error_Class_Match (Unit_Name, "unit");
+ end if;
Set_Named_Entity (Unit_Name, Create_Error_Name (Unit_Name));
end if;
Set_Unit_Name (Res, Unit_Name);
@@ -4051,12 +4054,14 @@ package body Sem_Expr is
| Iir_Kind_Unit_Declaration =>
declare
Res: Iir;
+ Res_Type : Iir;
begin
Res := Sem_Physical_Literal (Expr);
- if Res = Null_Iir then
+ Res_Type := Get_Type (Res);
+ if Is_Null (Res_Type) then
return Null_Iir;
end if;
- if A_Type /= Null_Iir and then Get_Type (Res) /= A_Type then
+ if A_Type /= Null_Iir and then Res_Type /= A_Type then
Error_Not_Match (Res, A_Type);
return Null_Iir;
end if;
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb
index 4e5baa373..064648096 100644
--- a/src/vhdl/sem_types.adb
+++ b/src/vhdl/sem_types.adb
@@ -303,17 +303,17 @@ package body Sem_Types is
end Create_Physical_Literal;
-- Analyze a physical type definition. Create a subtype.
- function Sem_Physical_Type_Definition (Range_Expr: Iir; Decl : Iir)
+ function Sem_Physical_Type_Definition (Def : Iir; Decl : Iir)
return Iir_Physical_Subtype_Definition
is
Unit: Iir_Unit_Declaration;
- Def : Iir_Physical_Type_Definition;
Sub_Type: Iir_Physical_Subtype_Definition;
+ Range_Expr : Iir;
Range_Expr1: Iir;
Val : Iir;
Lit : Iir_Physical_Int_Literal;
begin
- Def := Get_Type (Range_Expr);
+ Range_Expr := Get_Range_Constraint (Def);
-- LRM93 4.1
-- The simple name declared by a type declaration denotes the
@@ -326,11 +326,6 @@ package body Sem_Types is
Set_Type_Staticness (Def, Locally);
Set_Signal_Type_Flag (Def, True);
- -- Set the type definition of the type declaration (it was currently the
- -- range expression). Do it early so that the units can be referenced
- -- by expanded names.
- Set_Type_Definition (Decl, Def);
-
-- LRM93 3.1.3
-- Each bound of a range constraint that is used in a physical type
-- definition must be a locally static expression of some integer type
@@ -367,13 +362,14 @@ package body Sem_Types is
-- Analyze the primary unit.
Unit := Get_Unit_Chain (Def);
- Lit := Create_Physical_Literal (1, Unit);
- Set_Physical_Unit_Value (Unit, Lit);
-
- Sem_Scopes.Add_Name (Unit);
+ -- Set its value to 1.
Set_Type (Unit, Def);
Set_Expr_Staticness (Unit, Locally);
Set_Name_Staticness (Unit, Locally);
+ Lit := Create_Physical_Literal (1, Unit);
+ Set_Physical_Literal (Unit, Lit);
+
+ Sem_Scopes.Add_Name (Unit);
Set_Visible_Flag (Unit, True);
Xref_Decl (Unit);
@@ -428,7 +424,7 @@ package body Sem_Types is
Val := Sem_Expression (Get_Physical_Literal (Unit), Def);
if Val /= Null_Iir then
Val := Eval_Physical_Literal (Val);
- Set_Physical_Unit_Value (Unit, Val);
+ Set_Physical_Literal (Unit, Val);
-- LRM93 §3.1
-- The position number of unit names need not lie within the range
@@ -445,8 +441,9 @@ package body Sem_Types is
end if;
else
-- Avoid errors storm.
- Set_Physical_Literal (Unit, Get_Primary_Unit (Def));
- Set_Physical_Unit_Value (Unit, Lit);
+ Val := Create_Physical_Literal (1, Get_Primary_Unit (Def));
+ Set_Literal_Origin (Val, Get_Physical_Literal (Unit));
+ Set_Physical_Literal (Unit, Val);
end if;
Set_Type (Unit, Def);
@@ -1018,11 +1015,13 @@ package body Sem_Types is
end loop;
Set_Index_Subtype_List (Def, Index_List);
- -- Element type.
- Set_Element_Subtype_Indication (Base_Type, Get_Element_Subtype (Def));
+ -- Element type. Transfer it to the base type.
+ Set_Element_Subtype_Indication
+ (Base_Type, Get_Array_Element_Constraint (Def));
Sem_Array_Element (Base_Type);
El_Type := Get_Element_Subtype (Base_Type);
Set_Element_Subtype (Def, El_Type);
+ Set_Array_Element_Constraint (Def, Null_Iir);
Set_Signal_Type_Flag (Def, Get_Signal_Type_Flag (Base_Type));
@@ -1121,12 +1120,11 @@ package body Sem_Types is
when Iir_Kind_Enumeration_Type_Definition =>
return Sem_Enumeration_Type_Definition (Def, Decl);
+ when Iir_Kind_Physical_Type_Definition =>
+ return Sem_Physical_Type_Definition (Def, Decl);
+
when Iir_Kind_Range_Expression =>
- if Get_Type (Def) /= Null_Iir then
- return Sem_Physical_Type_Definition (Def, Decl);
- else
- return Range_Expr_To_Type_Definition (Def, Decl);
- end if;
+ return Range_Expr_To_Type_Definition (Def, Decl);
when Iir_Kind_Range_Array_Attribute
| Iir_Kind_Attribute_Name
@@ -1482,6 +1480,7 @@ package body Sem_Types is
-- There is no element_constraint.
pragma Assert (Resolution /= Null_Iir);
Res := Copy_Subtype_Indication (Type_Mark);
+ El_Def := Null_Iir;
else
case Get_Kind (Def) is
when Iir_Kind_Subtype_Definition =>
@@ -1516,7 +1515,7 @@ package body Sem_Types is
Base_Type := Get_Base_Type (Type_Mark);
Set_Base_Type (Def, Base_Type);
- El_Def := Get_Element_Subtype (Def);
+ El_Def := Get_Array_Element_Constraint (Def);
Staticness := Get_Type_Staticness (El_Type);
Error_Seen := False;
diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb
index 598bdc533..0a6a847bf 100644
--- a/src/vhdl/std_package.adb
+++ b/src/vhdl/std_package.adb
@@ -798,13 +798,12 @@ package body Std_Package is
Set_Type (Unit, Time_Type_Definition);
Lit1 := Create_Std_Phys_Lit (Multiplier_Value, Multiplier);
- Set_Physical_Literal (Unit, Lit1);
Lit := Create_Std_Phys_Lit
(Multiplier_Value
- * Get_Value (Get_Physical_Unit_Value (Multiplier)),
- Get_Physical_Unit (Get_Physical_Unit_Value (Multiplier)));
+ * Get_Value (Get_Physical_Literal (Multiplier)),
+ Get_Physical_Unit (Get_Physical_Literal (Multiplier)));
Set_Literal_Origin (Lit, Lit1);
- Set_Physical_Unit_Value (Unit, Lit);
+ Set_Physical_Literal (Unit, Lit);
Set_Expr_Staticness (Unit, Time_Staticness);
Set_Name_Staticness (Unit, Locally);
@@ -843,7 +842,7 @@ package body Std_Package is
Set_Type (Time_Fs_Unit, Time_Type_Definition);
Set_Expr_Staticness (Time_Fs_Unit, Time_Staticness);
Set_Name_Staticness (Time_Fs_Unit, Locally);
- Set_Physical_Unit_Value
+ Set_Physical_Literal
(Time_Fs_Unit, Create_Std_Phys_Lit (1, Time_Fs_Unit));
Append (Last_Unit, Time_Type_Definition, Time_Fs_Unit);