summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/canon.adb128
-rw-r--r--src/vhdl/canon.ads8
-rw-r--r--src/vhdl/disp_tree.adb16
-rw-r--r--src/vhdl/disp_vhdl.adb118
-rw-r--r--src/vhdl/errorout.adb16
-rw-r--r--src/vhdl/iir_chains.ads4
-rw-r--r--src/vhdl/iirs.adb32
-rw-r--r--src/vhdl/iirs.adb.in5
-rw-r--r--src/vhdl/iirs.ads91
-rw-r--r--src/vhdl/iirs_walk.adb6
-rw-r--r--src/vhdl/nodes_meta.adb625
-rw-r--r--src/vhdl/nodes_meta.ads2
-rw-r--r--src/vhdl/parse.adb247
-rw-r--r--src/vhdl/sem_expr.adb364
-rw-r--r--src/vhdl/sem_expr.ads31
-rw-r--r--src/vhdl/sem_names.adb8
-rw-r--r--src/vhdl/sem_names.ads4
-rw-r--r--src/vhdl/sem_specs.adb14
-rw-r--r--src/vhdl/sem_stmts.adb619
-rw-r--r--src/vhdl/std_package.adb70
-rw-r--r--src/vhdl/std_package.ads17
-rw-r--r--src/vhdl/translate/trans-chap7.adb18
-rw-r--r--src/vhdl/translate/trans-chap8.adb26
-rw-r--r--src/vhdl/translate/trans_analyzes.adb39
24 files changed, 1747 insertions, 761 deletions
diff --git a/src/vhdl/canon.adb b/src/vhdl/canon.adb
index 9108ece..951a78d 100644
--- a/src/vhdl/canon.adb
+++ b/src/vhdl/canon.adb
@@ -66,6 +66,9 @@ package body Canon is
procedure Canon_Subtype_Indication (Def : Iir);
procedure Canon_Subtype_Indication_If_Anonymous (Def : Iir);
+ function Canon_Conditional_Signal_Assignment
+ (Conc_Stmt : Iir; Proc : Iir; Parent : Iir) return Iir;
+
procedure Canon_Extract_Sensitivity_Aggregate
(Aggr : Iir;
Sensitivity_List : Iir_List;
@@ -341,7 +344,7 @@ package body Canon is
-- the target, and construct the union of the resulting sets.
Canon_Extract_Sensitivity (Get_Target (Stmt), List, True);
Canon_Extract_Sensitivity (Get_Expression (Stmt), List, False);
- when Iir_Kind_Signal_Assignment_Statement =>
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
-- LRM08 11.3
-- See variable assignment statement case.
Canon_Extract_Sensitivity (Get_Target (Stmt), List, True);
@@ -998,6 +1001,60 @@ package body Canon is
-- return Res;
-- end Canon_Default_Map_Association_List;
+ function Canon_Conditional_Variable_Assignment_Statement (Stmt : Iir)
+ return Iir
+ is
+ Target : constant Iir := Get_Target (Stmt);
+ Cond_Expr : Iir;
+ Expr : Iir;
+ Asgn : Iir;
+ Res : Iir;
+ El, N_El : Iir;
+ begin
+ Cond_Expr := Get_Conditional_Expression (Stmt);
+ Res := Create_Iir (Iir_Kind_If_Statement);
+ Set_Label (Res, Get_Label (Stmt));
+ Set_Suspend_Flag (Res, False);
+ El := Res;
+
+ loop
+ -- Fill if/elsif statement.
+ Set_Parent (El, Get_Parent (Stmt));
+ Location_Copy (El, Cond_Expr);
+ Set_Condition (El, Get_Condition (Cond_Expr));
+
+ -- Create simple variable assignment.
+ Asgn := Create_Iir (Iir_Kind_Variable_Assignment_Statement);
+ Location_Copy (Asgn, Cond_Expr);
+ Set_Parent (Asgn, El);
+ Set_Target (Asgn, Target);
+ Expr := Get_Expression (Cond_Expr);
+ if Canon_Flag_Expressions then
+ Canon_Expression (Expr);
+ end if;
+ Set_Expression (Asgn, Expr);
+
+ Set_Sequential_Statement_Chain (El, Asgn);
+
+ -- Next condition.
+ Cond_Expr := Get_Chain (Cond_Expr);
+ exit when Cond_Expr = Null_Iir;
+
+ N_El := Create_Iir (Iir_Kind_Elsif);
+ Set_Else_Clause (El, N_El);
+ El := N_El;
+ end loop;
+
+ return Res;
+ end Canon_Conditional_Variable_Assignment_Statement;
+
+ function Canon_Conditional_Signal_Assignment_Statement (Stmt : Iir)
+ return Iir is
+ begin
+ return Canon_Conditional_Signal_Assignment
+ (Stmt, Null_Iir, Get_Parent (Stmt));
+ end Canon_Conditional_Signal_Assignment_Statement;
+
-- Inner loop if any; used to canonicalize exit/next statement.
Cur_Loop : Iir;
@@ -1026,7 +1083,7 @@ package body Canon is
end loop;
end;
- when Iir_Kind_Signal_Assignment_Statement =>
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
Canon_Expression (Get_Target (Stmt));
Canon_Waveform_Chain (Get_Waveform_Chain (Stmt), Null_Iir_List);
@@ -1207,7 +1264,8 @@ package body Canon is
Else_Clause := Create_Iir (Iir_Kind_Elsif);
Location_Copy (Else_Clause, Stmt);
Set_Else_Clause (If_Stmt, Else_Clause);
- Dis_Stmt := Create_Iir (Iir_Kind_Signal_Assignment_Statement);
+ Dis_Stmt :=
+ Create_Iir (Iir_Kind_Simple_Signal_Assignment_Statement);
Location_Copy (Dis_Stmt, Stmt);
Set_Parent (Dis_Stmt, If_Stmt);
Set_Target (Dis_Stmt, Target);
@@ -1329,6 +1387,7 @@ package body Canon is
return Iir
is
Stmt : Iir;
+ Sensitivity_List : Iir_List;
begin
if Waveform_Chain = Null_Iir then
-- LRM 9.5.1 Conditionnal Signal Assignment
@@ -1349,9 +1408,14 @@ package body Canon is
-- of the form:
-- target <= [ delay_mechanism ] waveform_element1,
-- waveform_element2, ..., waveform_elementN;
- Stmt := Create_Iir (Iir_Kind_Signal_Assignment_Statement);
+ Stmt := Create_Iir (Iir_Kind_Simple_Signal_Assignment_Statement);
Set_Target (Stmt, Get_Target (Orig_Stmt));
- Canon_Waveform_Chain (Waveform_Chain, Get_Sensitivity_List (Proc));
+ if Proc = Null_Iir then
+ Sensitivity_List := Null_Iir_List;
+ else
+ Sensitivity_List := Get_Sensitivity_List (Proc);
+ end if;
+ Canon_Waveform_Chain (Waveform_Chain, Sensitivity_List);
Set_Waveform_Chain (Stmt, Waveform_Chain);
Set_Delay_Mechanism (Stmt, Get_Delay_Mechanism (Orig_Stmt));
Set_Reject_Time_Expression
@@ -1361,10 +1425,22 @@ package body Canon is
return Stmt;
end Canon_Wave_Transform;
- -- Create signal_transform for a conditional concurrent signal assignment.
- procedure Canon_Conditional_Concurrent_Signal_Assigment
+ -- Create signal_transform for a concurrent simple signal assignment.
+ procedure Canon_Concurrent_Simple_Signal_Assignment
(Conc_Stmt : Iir; Proc : Iir; Parent : Iir)
is
+ Stmt : Iir;
+ begin
+ Stmt := Canon_Wave_Transform
+ (Conc_Stmt, Get_Waveform_Chain (Conc_Stmt), Proc);
+ Set_Parent (Stmt, Parent);
+ Set_Sequential_Statement_Chain (Parent, Stmt);
+ end Canon_Concurrent_Simple_Signal_Assignment;
+
+ -- Create signal_transform for a concurrent conditional signal assignment.
+ function Canon_Conditional_Signal_Assignment
+ (Conc_Stmt : Iir; Proc : Iir; Parent : Iir) return Iir
+ is
Expr : Iir;
Stmt : Iir;
Res1 : Iir;
@@ -1380,8 +1456,8 @@ package body Canon is
while Cond_Wf /= Null_Iir loop
Expr := Get_Condition (Cond_Wf);
- Wf := Canon_Wave_Transform
- (Conc_Stmt, Get_Waveform_Chain (Cond_Wf), Proc);
+ Wf := Get_Waveform_Chain (Cond_Wf);
+ Wf := Canon_Wave_Transform (Conc_Stmt, Wf, Proc);
Set_Parent (Wf, Parent);
if Expr = Null_Iir and Cond_Wf = Cond_Wf_Chain then
Res1 := Wf;
@@ -1390,8 +1466,10 @@ package body Canon is
if Canon_Flag_Expressions then
Canon_Expression (Expr);
end if;
- Canon_Extract_Sensitivity
- (Expr, Get_Sensitivity_List (Proc), False);
+ if Proc /= Null_Iir then
+ Canon_Extract_Sensitivity
+ (Expr, Get_Sensitivity_List (Proc), False);
+ end if;
end if;
if Stmt = Null_Iir then
Res1 := Create_Iir (Iir_Kind_If_Statement);
@@ -1411,10 +1489,20 @@ package body Canon is
Last_Res := Res1;
Cond_Wf := Get_Chain (Cond_Wf);
end loop;
+ return Stmt;
+ end Canon_Conditional_Signal_Assignment;
+
+ -- Create signal_transform for a concurrent conditional signal assignment.
+ procedure Canon_Concurrent_Conditional_Signal_Assignment
+ (Conc_Stmt : Iir; Proc : Iir; Parent : Iir)
+ is
+ Stmt : Iir;
+ begin
+ Stmt := Canon_Conditional_Signal_Assignment (Conc_Stmt, Proc, Parent);
Set_Sequential_Statement_Chain (Parent, Stmt);
- end Canon_Conditional_Concurrent_Signal_Assigment;
+ end Canon_Concurrent_Conditional_Signal_Assignment;
- procedure Canon_Selected_Concurrent_Signal_Assignment
+ procedure Canon_Concurrent_Selected_Signal_Assignment
(Conc_Stmt : Iir; Proc : Iir; Parent : Iir)
is
Selected_Waveform : Iir;
@@ -1446,7 +1534,7 @@ package body Canon is
end if;
Selected_Waveform := Get_Chain (Selected_Waveform);
end loop;
- end Canon_Selected_Concurrent_Signal_Assignment;
+ end Canon_Concurrent_Selected_Signal_Assignment;
procedure Canon_Generate_Statement_Body
(Top : Iir_Design_Unit; Bod : Iir) is
@@ -1505,10 +1593,18 @@ package body Canon is
end if;
case Get_Kind (El) is
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment =>
+ Canon_Concurrent_Signal_Assignment (El, Proc, Sub_Chain);
+
+ Canon_Concurrent_Simple_Signal_Assignment (El, Proc, Sub_Chain);
+
+ Replace_Stmt (Proc);
+ El := Proc;
+
when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
Canon_Concurrent_Signal_Assignment (El, Proc, Sub_Chain);
- Canon_Conditional_Concurrent_Signal_Assigment
+ Canon_Concurrent_Conditional_Signal_Assignment
(El, Proc, Sub_Chain);
Replace_Stmt (Proc);
@@ -1517,7 +1613,7 @@ package body Canon is
when Iir_Kind_Concurrent_Selected_Signal_Assignment =>
Canon_Concurrent_Signal_Assignment (El, Proc, Sub_Chain);
- Canon_Selected_Concurrent_Signal_Assignment
+ Canon_Concurrent_Selected_Signal_Assignment
(El, Proc, Sub_Chain);
Replace_Stmt (Proc);
diff --git a/src/vhdl/canon.ads b/src/vhdl/canon.ads
index 8e56793..7481fe0 100644
--- a/src/vhdl/canon.ads
+++ b/src/vhdl/canon.ads
@@ -58,6 +58,14 @@ package Canon is
-- Canon on expressions, mainly for function calls.
procedure Canon_Expression (Expr: Iir);
+ -- Canon a conditional variable assignment into a conditional statement.
+ function Canon_Conditional_Variable_Assignment_Statement (Stmt : Iir)
+ return Iir;
+
+ -- Canon a conditional signal assignment into a conditional statement.
+ function Canon_Conditional_Signal_Assignment_Statement (Stmt : Iir)
+ return Iir;
+
-- Compute the sensivity list of EXPR and add it to SENSIVITY_LIST.
-- If IS_TARGET is true, the longuest static prefix of the signal name
-- is not added to the sensitivity list, but other static prefix (such
diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb
index 3685800..a56198a 100644
--- a/src/vhdl/disp_tree.adb
+++ b/src/vhdl/disp_tree.adb
@@ -346,6 +346,22 @@ package body Disp_Tree is
Put (' ');
Disp_Iir_Number (N);
+ -- Be nice: print type name for a type definition.
+ if K in Iir_Kinds_Type_And_Subtype_Definition
+ or K = Iir_Kind_Wildcard_Type_Definition
+ then
+ declare
+ Decl : constant Iir := Get_Type_Declarator (N);
+ begin
+ if Decl /= Null_Iir
+ and then Get_Identifier (Decl) /= Null_Identifier
+ then
+ Put (' ');
+ Put (Image_Name_Id (Get_Identifier (Decl)));
+ end if;
+ end;
+ end if;
+
New_Line;
end Disp_Header;
diff --git a/src/vhdl/disp_vhdl.adb b/src/vhdl/disp_vhdl.adb
index 7dcdef3..9872ff8 100644
--- a/src/vhdl/disp_vhdl.adb
+++ b/src/vhdl/disp_vhdl.adb
@@ -1772,14 +1772,45 @@ package body Disp_Vhdl is
end case;
end Disp_Delay_Mechanism;
- procedure Disp_Signal_Assignment (Stmt: Iir) is
+ procedure Disp_Simple_Signal_Assignment (Stmt: Iir) is
begin
Disp_Expression (Get_Target (Stmt));
Put (" <= ");
Disp_Delay_Mechanism (Stmt);
Disp_Waveform (Get_Waveform_Chain (Stmt));
Put_Line (";");
- end Disp_Signal_Assignment;
+ end Disp_Simple_Signal_Assignment;
+
+ procedure Disp_Conditional_Waveform (Chain : Iir)
+ is
+ Cond_Wf : Iir;
+ Indent : Count;
+ Expr : Iir;
+ begin
+ Indent := Col;
+ Set_Col (Indent);
+ Cond_Wf := Chain;
+ while Cond_Wf /= Null_Iir loop
+ Disp_Waveform (Get_Waveform_Chain (Cond_Wf));
+ Expr := Get_Condition (Cond_Wf);
+ if Expr /= Null_Iir then
+ Put (" when ");
+ Disp_Expression (Expr);
+ Put_Line (" else");
+ Set_Col (Indent);
+ end if;
+ Cond_Wf := Get_Chain (Cond_Wf);
+ end loop;
+ end Disp_Conditional_Waveform;
+
+ procedure Disp_Conditional_Signal_Assignment (Stmt: Iir) is
+ begin
+ Disp_Expression (Get_Target (Stmt));
+ Put (" <= ");
+ Disp_Delay_Mechanism (Stmt);
+ Disp_Conditional_Waveform (Get_Conditional_Waveform_Chain (Stmt));
+ Put_Line (";");
+ end Disp_Conditional_Signal_Assignment;
procedure Disp_Variable_Assignment (Stmt: Iir) is
begin
@@ -1789,6 +1820,33 @@ package body Disp_Vhdl is
Put_Line (";");
end Disp_Variable_Assignment;
+ procedure Disp_Conditional_Expression (Exprs : Iir)
+ is
+ Expr : Iir;
+ Cond : Iir;
+ begin
+ Expr := Exprs;
+ loop
+ Disp_Expression (Get_Expression (Expr));
+ Cond := Get_Condition (Expr);
+ if Cond /= Null_Iir then
+ Put (" when ");
+ Disp_Expression (Cond);
+ end if;
+ Expr := Get_Chain (Expr);
+ exit when Expr = Null_Iir;
+ Put (" else ");
+ end loop;
+ end Disp_Conditional_Expression;
+
+ procedure Disp_Conditional_Variable_Assignment (Stmt: Iir) is
+ begin
+ Disp_Expression (Get_Target (Stmt));
+ Put (" := ");
+ Disp_Conditional_Expression (Get_Conditional_Expression (Stmt));
+ Put_Line (";");
+ end Disp_Conditional_Variable_Assignment;
+
procedure Disp_Label (Stmt : Iir)
is
Label: constant Name_Id := Get_Label (Stmt);
@@ -1806,6 +1864,25 @@ package body Disp_Vhdl is
end if;
end Disp_Postponed;
+ procedure Disp_Concurrent_Simple_Signal_Assignment (Stmt: Iir)
+ is
+ Indent: Count;
+ begin
+ Disp_Label (Stmt);
+ Disp_Postponed (Stmt);
+ Disp_Expression (Get_Target (Stmt));
+ Put (" <= ");
+ if Get_Guard (Stmt) /= Null_Iir then
+ Put ("guarded ");
+ end if;
+ Disp_Delay_Mechanism (Stmt);
+ Indent := Col;
+ Set_Col (Indent);
+ Disp_Waveform (Get_Waveform_Chain (Stmt));
+
+ Put_Line (";");
+ end Disp_Concurrent_Simple_Signal_Assignment;
+
procedure Disp_Concurrent_Selected_Signal_Assignment (Stmt: Iir)
is
Indent: constant Count := Col;
@@ -1838,11 +1915,7 @@ package body Disp_Vhdl is
Put_Line (";");
end Disp_Concurrent_Selected_Signal_Assignment;
- procedure Disp_Concurrent_Conditional_Signal_Assignment (Stmt: Iir)
- is
- Indent: Count;
- Cond_Wf : Iir_Conditional_Waveform;
- Expr : Iir;
+ procedure Disp_Concurrent_Conditional_Signal_Assignment (Stmt: Iir) is
begin
Disp_Label (Stmt);
Disp_Postponed (Stmt);
@@ -1852,21 +1925,7 @@ package body Disp_Vhdl is
Put ("guarded ");
end if;
Disp_Delay_Mechanism (Stmt);
- Indent := Col;
- Set_Col (Indent);
- Cond_Wf := Get_Conditional_Waveform_Chain (Stmt);
- while Cond_Wf /= Null_Iir loop
- Disp_Waveform (Get_Waveform_Chain (Cond_Wf));
- Expr := Get_Condition (Cond_Wf);
- if Expr /= Null_Iir then
- Put (" when ");
- Disp_Expression (Expr);
- Put_Line (" else");
- Set_Col (Indent);
- end if;
- Cond_Wf := Get_Chain (Cond_Wf);
- end loop;
-
+ Disp_Conditional_Waveform (Get_Conditional_Waveform_Chain (Stmt));
Put_Line (";");
end Disp_Concurrent_Conditional_Signal_Assignment;
@@ -2057,7 +2116,7 @@ package body Disp_Vhdl is
while Stmt /= Null_Iir loop
Set_Col (Start);
Disp_Label (Stmt);
- case Get_Kind (Stmt) is
+ case Iir_Kinds_Sequential_Statement (Get_Kind (Stmt)) is
when Iir_Kind_Null_Statement =>
Put_Line ("null;");
when Iir_Kind_If_Statement =>
@@ -2084,10 +2143,14 @@ package body Disp_Vhdl is
(Get_Sequential_Statement_Chain (Stmt));
Set_Col (Start);
Disp_End_Label (Stmt, "loop");
- when Iir_Kind_Signal_Assignment_Statement =>
- Disp_Signal_Assignment (Stmt);
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
+ Disp_Simple_Signal_Assignment (Stmt);
+ when Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ Disp_Conditional_Signal_Assignment (Stmt);
when Iir_Kind_Variable_Assignment_Statement =>
Disp_Variable_Assignment (Stmt);
+ when Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ Disp_Conditional_Variable_Assignment (Stmt);
when Iir_Kind_Assertion_Statement =>
Disp_Assertion_Statement (Stmt);
when Iir_Kind_Report_Statement =>
@@ -2127,9 +2190,6 @@ package body Disp_Vhdl is
end if;
Put_Line (";");
end;
-
- when others =>
- Error_Kind ("disp_sequential_statements", Stmt);
end case;
Stmt := Get_Chain (Stmt);
end loop;
@@ -2985,6 +3045,8 @@ package body Disp_Vhdl is
procedure Disp_Concurrent_Statement (Stmt: Iir) is
begin
case Get_Kind (Stmt) is
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment =>
+ Disp_Concurrent_Simple_Signal_Assignment (Stmt);
when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
Disp_Concurrent_Conditional_Signal_Assignment (Stmt);
when Iir_Kind_Concurrent_Selected_Signal_Assignment =>
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index 0bf2b7f..c46f3a4 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -436,6 +436,8 @@ package body Errorout is
return "waveform element";
when Iir_Kind_Conditional_Waveform =>
return "conditional waveform";
+ when Iir_Kind_Conditional_Expression =>
+ return "conditional expression";
when Iir_Kind_Association_Element_Open =>
return "open association element";
when Iir_Kind_Association_Element_By_Individual =>
@@ -447,7 +449,8 @@ package body Errorout is
return "overloaded name or expression";
when Iir_Kind_Integer_Type_Definition
- | Iir_Kind_Enumeration_Type_Definition =>
+ | Iir_Kind_Enumeration_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return Image_Identifier (Get_Type_Declarator (Node));
when Iir_Kind_Array_Type_Definition =>
return Disp_Type (Node, "array type");
@@ -823,6 +826,9 @@ package body Errorout is
return Disp_Label (Node, "block statement");
when Iir_Kind_Block_Header =>
return "block header";
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment =>
+ return Disp_Label
+ (Node, "concurrent simple signal assignment");
when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
return Disp_Label
(Node, "concurrent conditional signal assignment");
@@ -850,10 +856,16 @@ package body Errorout is
return Disp_Label (Node, "case statement");
when Iir_Kind_Return_Statement =>
return Disp_Label (Node, "return statement");
- when Iir_Kind_Signal_Assignment_Statement =>
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
return Disp_Label (Node, "signal assignment statement");
+ when Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ return Disp_Label
+ (Node, "conditional signal assignment statement");
when Iir_Kind_Variable_Assignment_Statement =>
return Disp_Label (Node, "variable assignment statement");
+ when Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ return Disp_Label
+ (Node, "conditional variable assignment statement");
when Iir_Kind_Null_Statement =>
return Disp_Label (Node, "null statement");
when Iir_Kind_Wait_Statement =>
diff --git a/src/vhdl/iir_chains.ads b/src/vhdl/iir_chains.ads
index 9d61752..85746f1 100644
--- a/src/vhdl/iir_chains.ads
+++ b/src/vhdl/iir_chains.ads
@@ -68,10 +68,6 @@ package Iir_Chains is
(Get_Chain_Start => Get_Entity_Class_Entry_Chain,
Set_Chain_Start => Set_Entity_Class_Entry_Chain);
- package Conditional_Waveform_Chain_Handling is new Iir_Chain_Handling
- (Get_Chain_Start => Get_Conditional_Waveform_Chain,
- Set_Chain_Start => Set_Conditional_Waveform_Chain);
-
package Selected_Waveform_Chain_Handling is new Iir_Chain_Handling
(Get_Chain_Start => Get_Selected_Waveform_Chain,
Set_Chain_Start => Set_Selected_Waveform_Chain);
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index d6cd6eb..4bb4fef 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -93,6 +93,11 @@ package body Iirs is
end loop;
end Disp_Stats;
+ function Kind_In (K : Iir_Kind; K1, K2 : Iir_Kind) return Boolean is
+ begin
+ return K = K1 or K = K2;
+ end Kind_In;
+
function Iir_Predefined_Shortcut_P (Func : Iir_Predefined_Functions)
return Boolean is
begin
@@ -256,6 +261,7 @@ package body Iirs is
| Iir_Kind_Overflow_Literal
| Iir_Kind_Waveform_Element
| Iir_Kind_Conditional_Waveform
+ | Iir_Kind_Conditional_Expression
| Iir_Kind_Association_Element_By_Expression
| Iir_Kind_Association_Element_By_Individual
| Iir_Kind_Association_Element_Open
@@ -295,6 +301,7 @@ package body Iirs is
| Iir_Kind_Physical_Type_Definition
| Iir_Kind_Range_Expression
| Iir_Kind_Protected_Type_Body
+ | Iir_Kind_Wildcard_Type_Definition
| Iir_Kind_Overload_List
| Iir_Kind_Type_Declaration
| Iir_Kind_Anonymous_Type_Declaration
@@ -386,11 +393,13 @@ package body Iirs is
| Iir_Kind_For_Generate_Statement
| Iir_Kind_Generate_Statement_Body
| Iir_Kind_If_Generate_Else_Clause
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
@@ -483,6 +492,7 @@ package body Iirs is
| Iir_Kind_Interface_Package_Declaration
| Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Psl_Assert_Statement
@@ -3576,6 +3586,22 @@ package body Iirs is
Set_Field5 (Target, Expr);
end Set_Expression;
+ function Get_Conditional_Expression (Target : Iir) return Iir is
+ begin
+ pragma Assert (Target /= Null_Iir);
+ pragma Assert (Has_Conditional_Expression (Get_Kind (Target)),
+ "no field Conditional_Expression");
+ return Get_Field5 (Target);
+ end Get_Conditional_Expression;
+
+ procedure Set_Conditional_Expression (Target : Iir; Expr : Iir) is
+ begin
+ pragma Assert (Target /= Null_Iir);
+ pragma Assert (Has_Conditional_Expression (Get_Kind (Target)),
+ "no field Conditional_Expression");
+ Set_Field5 (Target, Expr);
+ end Set_Conditional_Expression;
+
function Get_Allocator_Designated_Type (Target : Iir) return Iir is
begin
pragma Assert (Target /= Null_Iir);
@@ -3613,7 +3639,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Conditional_Waveform_Chain (Get_Kind (Target)),
"no field Conditional_Waveform_Chain");
- return Get_Field7 (Target);
+ return Get_Field5 (Target);
end Get_Conditional_Waveform_Chain;
procedure Set_Conditional_Waveform_Chain (Target : Iir; Chain : Iir) is
@@ -3621,7 +3647,7 @@ package body Iirs is
pragma Assert (Target /= Null_Iir);
pragma Assert (Has_Conditional_Waveform_Chain (Get_Kind (Target)),
"no field Conditional_Waveform_Chain");
- Set_Field7 (Target, Chain);
+ Set_Field5 (Target, Chain);
end Set_Conditional_Waveform_Chain;
function Get_Guard_Expression (Target : Iir) return Iir is
diff --git a/src/vhdl/iirs.adb.in b/src/vhdl/iirs.adb.in
index 40c9d68..2c776ab 100644
--- a/src/vhdl/iirs.adb.in
+++ b/src/vhdl/iirs.adb.in
@@ -93,6 +93,11 @@ package body Iirs is
end loop;
end Disp_Stats;
+ function Kind_In (K : Iir_Kind; K1, K2 : Iir_Kind) return Boolean is
+ begin
+ return K = K1 or K = K2;
+ end Kind_In;
+
function Iir_Predefined_Shortcut_P (Func : Iir_Predefined_Functions)
return Boolean is
begin
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index d3522af..cc7eb83 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -443,6 +443,19 @@ package Iirs is
--
-- Get/Set_Chain (Field2)
+ -- Iir_Kind_Conditional_Expression (Short)
+ -- LRM08 10.5.3
+ -- conditional_expressions ::=
+ -- expression WHEN condition
+ -- { ELSE expression WHEN condition }
+ -- [ ELSE expression ]
+ --
+ -- Get/Set_Condition (Field1)
+ --
+ -- Get/Set_Expression (Field5)
+ --
+ -- Get/Set_Chain (Field2)
+
-- Iir_Kind_Choice_By_Others (Short)
-- Iir_Kind_Choice_By_None (Short)
-- Iir_Kind_Choice_By_Range (Short)
@@ -2076,6 +2089,25 @@ package Iirs is
--
-- Get/Set_End_Has_Identifier (Flag9)
+ -- Iir_Kind_Wildcard_Type_Definition (Short)
+ -- A wildcard type doesn't correspond to a type defined by VHDL. It
+ -- is used only during analysis to temporary set the type of an entity
+ -- when the type is not precisely known but restricted to some class of
+ -- types. Eg: the type of an aggregate is not known before being
+ -- determined by the context, but can only be an array or a record.
+ -- Wildcard types are statically created by std_package and the set of
+ -- restrictions depends on the node. See std_package.ads
+ --
+ -- Get/Set_Type_Declarator (Field3)
+ --
+ -- Get/Set_Base_Type (Field4)
+ --
+ -- Get/Set_Resolved_Flag (Flag1)
+ --
+ -- Get/Set_Signal_Type_Flag (Flag2)
+ --
+ -- Get/Set_Type_Staticness (State1)
+
--------------------------
-- subtype definitions --
--------------------------
@@ -2349,6 +2381,7 @@ package Iirs is
-- Iir_Kind_Concurrent_Conditional_Signal_Assignment (Medium)
-- Iir_Kind_Concurrent_Selected_Signal_Assignment (Medium)
+ -- Iir_Kind_Concurrent_Simple_Signal_Assignment (Medium)
--
-- Get/Set_Parent (Field0)
--
@@ -2361,11 +2394,14 @@ package Iirs is
--
-- Get/Set_Reject_Time_Expression (Field4)
--
+ -- Only for Iir_Kind_Concurrent_Simple_Signal_Assignment:
+ -- Get/Set_Waveform_Chain (Field5)
+ --
-- Only for Iir_Kind_Concurrent_Selected_Signal_Assignment:
-- Get/Set_Expression (Field5)
--
-- Only for Iir_Kind_Concurrent_Conditional_Signal_Assignment:
- -- Get/Set_Conditional_Waveform_Chain (Field7)
+ -- Get/Set_Conditional_Waveform_Chain (Field5)
--
-- Only for Iir_Kind_Concurrent_Selected_Signal_Assignment:
-- Get/Set_Selected_Waveform_Chain (Field7)
@@ -2791,7 +2827,8 @@ package Iirs is
--
-- Get/Set_Visible_Flag (Flag4)
- -- Iir_Kind_Signal_Assignment_Statement (Short)
+ -- Iir_Kind_Simple_Signal_Assignment_Statement (Short)
+ -- Iir_Kind_Conditional_Signal_Assignment_Statement (Short)
--
-- Get/Set_Parent (Field0)
--
@@ -2804,12 +2841,16 @@ package Iirs is
--
-- Get/Set_Reject_Time_Expression (Field4)
--
+ -- Only for Iir_Kind_Simple_Signal_Assignment_Statement:
-- The waveform.
-- If the waveform_chain is null_iir, then the signal assignment is a
-- disconnection statement, ie TARGET <= null_iir after disconection_time,
-- where disconnection_time is specified by a disconnection specification.
-- Get/Set_Waveform_Chain (Field5)
--
+ -- Only for Iir_Kind_Conditional_Signal_Assignment_Statement:
+ -- Get/Set_Conditional_Waveform_Chain (Field5)
+ --
-- Get/Set_Delay_Mechanism (Flag1)
--
-- Get/Set_Visible_Flag (Flag4)
@@ -2832,6 +2873,21 @@ package Iirs is
--
-- Get/Set_Visible_Flag (Flag4)
+ -- Iir_Kind_Conditional_Variable_Assignment_Statement (Short)
+ --
+ -- Get/Set_Parent (Field0)
+ --
+ -- Get/Set_Target (Field1)
+ --
+ -- Get/Set_Chain (Field2)
+ --
+ -- Get/Set_Label (Field3)
+ -- Get/Set_Identifier (Alias Field3)
+ --
+ -- Get/Set_Conditional_Expression (Field5)
+ --
+ -- Get/Set_Visible_Flag (Flag4)
+
-- Iir_Kind_Assertion_Statement (Short)
--
-- Get/Set_Parent (Field0)
@@ -3551,6 +3607,7 @@ package Iirs is
-- Tuple,
Iir_Kind_Waveform_Element,
Iir_Kind_Conditional_Waveform,
+ Iir_Kind_Conditional_Expression,
Iir_Kind_Association_Element_By_Expression,
Iir_Kind_Association_Element_By_Individual,
Iir_Kind_Association_Element_Open,
@@ -3603,6 +3660,7 @@ package Iirs is
Iir_Kind_Physical_Type_Definition, -- scalar
Iir_Kind_Range_Expression,
Iir_Kind_Protected_Type_Body,
+ Iir_Kind_Wildcard_Type_Definition,
Iir_Kind_Subtype_Definition, -- temporary (must not appear after sem).
-- Nature definition
@@ -3720,6 +3778,7 @@ package Iirs is
-- Concurrent statements.
Iir_Kind_Sensitized_Process_Statement,
Iir_Kind_Process_Statement,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment,
Iir_Kind_Concurrent_Conditional_Signal_Assignment,
Iir_Kind_Concurrent_Selected_Signal_Assignment,
Iir_Kind_Concurrent_Assertion_Statement,
@@ -3738,12 +3797,14 @@ package Iirs is
Iir_Kind_If_Generate_Else_Clause,
-- Iir_Kind_Sequential_Statement
- Iir_Kind_Signal_Assignment_Statement,
+ Iir_Kind_Simple_Signal_Assignment_Statement,
+ Iir_Kind_Conditional_Signal_Assignment_Statement,
Iir_Kind_Null_Statement,
Iir_Kind_Assertion_Statement,
Iir_Kind_Report_Statement,
Iir_Kind_Wait_Statement,
Iir_Kind_Variable_Assignment_Statement,
+ Iir_Kind_Conditional_Variable_Assignment_Statement,
Iir_Kind_Return_Statement,
Iir_Kind_For_Loop_Statement,
Iir_Kind_While_Loop_Statement,
@@ -3815,6 +3876,10 @@ package Iirs is
Iir_Kind_Attribute_Name
);
+ -- Return TRUE iif K is K1 or K is K2.
+ function Kind_In (K : Iir_Kind; K1, K2 : Iir_Kind) return Boolean;
+ pragma Inline (Kind_In);
+
type Iir_Signal_Kind is
(
Iir_Register_Kind,
@@ -4605,6 +4670,7 @@ package Iirs is
subtype Iir_Kinds_Concurrent_Statement is Iir_Kind range
Iir_Kind_Sensitized_Process_Statement ..
--Iir_Kind_Process_Statement
+ --Iir_Kind_Concurrent_Simple_Signal_Assignment
--Iir_Kind_Concurrent_Conditional_Signal_Assignment
--Iir_Kind_Concurrent_Selected_Signal_Assignment
--Iir_Kind_Concurrent_Assertion_Statement
@@ -4618,16 +4684,19 @@ package Iirs is
Iir_Kind_Component_Instantiation_Statement;
subtype Iir_Kinds_Concurrent_Signal_Assignment is Iir_Kind range
- Iir_Kind_Concurrent_Conditional_Signal_Assignment ..
+ Iir_Kind_Concurrent_Simple_Signal_Assignment ..
+ --Iir_Kind_Concurrent_Conditional_Signal_Assignment
Iir_Kind_Concurrent_Selected_Signal_Assignment;
subtype Iir_Kinds_Sequential_Statement is Iir_Kind range
- Iir_Kind_Signal_Assignment_Statement ..
+ Iir_Kind_Simple_Signal_Assignment_Statement ..
+ --Iir_Kind_Conditional_Signal_Assignment_Statement
--Iir_Kind_Null_Statement
--Iir_Kind_Assertion_Statement
--Iir_Kind_Report_Statement
--Iir_Kind_Wait_Statement
--Iir_Kind_Variable_Assignment_Statement
+ --Iir_Kind_Conditional_Variable_Assignment_Statement
--Iir_Kind_Return_Statement
--Iir_Kind_For_Loop_Statement
--Iir_Kind_While_Loop_Statement
@@ -4637,6 +4706,10 @@ package Iirs is
--Iir_Kind_Procedure_Call_Statement
Iir_Kind_If_Statement;
+ subtype Iir_Kinds_Variable_Assignment_Statement is Iir_Kind range
+ Iir_Kind_Variable_Assignment_Statement ..
+ Iir_Kind_Conditional_Variable_Assignment_Statement;
+
subtype Iir_Kinds_Allocator is Iir_Kind range
Iir_Kind_Allocator_By_Expression ..
Iir_Kind_Allocator_By_Subtype;
@@ -6041,6 +6114,12 @@ package Iirs is
function Get_Expression (Target : Iir) return Iir;
procedure Set_Expression (Target : Iir; Expr : Iir);
+ -- A conditional expression.
+ -- Node kind is a Iir_Kind_Conditional_Expression.
+ -- Field: Field5
+ function Get_Conditional_Expression (Target : Iir) return Iir;
+ procedure Set_Conditional_Expression (Target : Iir; Expr : Iir);
+
-- Set to the designated type (either the type of the expression or the
-- subtype) when the expression is analyzed.
-- Field: Field2 Ref
@@ -6051,7 +6130,7 @@ package Iirs is
function Get_Selected_Waveform_Chain (Target : Iir) return Iir;
procedure Set_Selected_Waveform_Chain (Target : Iir; Chain : Iir);
- -- Field: Field7 Chain
+ -- Field: Field5 Chain
function Get_Conditional_Waveform_Chain (Target : Iir) return Iir;
procedure Set_Conditional_Waveform_Chain (Target : Iir; Chain : Iir);
diff --git a/src/vhdl/iirs_walk.adb b/src/vhdl/iirs_walk.adb
index 3998329..7d6d91a 100644
--- a/src/vhdl/iirs_walk.adb
+++ b/src/vhdl/iirs_walk.adb
@@ -57,7 +57,8 @@ package body Iirs_Walk is
Chain : Iir;
begin
case Iir_Kinds_Sequential_Statement (Get_Kind (Stmt)) is
- when Iir_Kind_Signal_Assignment_Statement
+ when Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
@@ -66,7 +67,8 @@ package body Iirs_Walk is
| Iir_Kind_Procedure_Call_Statement
| Iir_Kind_Next_Statement
| Iir_Kind_Exit_Statement
- | Iir_Kind_Variable_Assignment_Statement =>
+ | Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement =>
null;
when Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement =>
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index 0f8b5bf..6c2ccd5 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -210,6 +210,7 @@ package body Nodes_Meta is
Field_Default_Binding_Indication => Type_Iir,
Field_Default_Configuration_Declaration => Type_Iir,
Field_Expression => Type_Iir,
+ Field_Conditional_Expression => Type_Iir,
Field_Allocator_Designated_Type => Type_Iir,
Field_Selected_Waveform_Chain => Type_Iir,
Field_Conditional_Waveform_Chain => Type_Iir,
@@ -708,6 +709,8 @@ package body Nodes_Meta is
return "default_configuration_declaration";
when Field_Expression =>
return "expression";
+ when Field_Conditional_Expression =>
+ return "conditional_expression";
when Field_Allocator_Designated_Type =>
return "allocator_designated_type";
when Field_Selected_Waveform_Chain =>
@@ -960,6 +963,8 @@ package body Nodes_Meta is
return "waveform_element";
when Iir_Kind_Conditional_Waveform =>
return "conditional_waveform";
+ when Iir_Kind_Conditional_Expression =>
+ return "conditional_expression";
when Iir_Kind_Association_Element_By_Expression =>
return "association_element_by_expression";
when Iir_Kind_Association_Element_By_Individual =>
@@ -1054,6 +1059,8 @@ package body Nodes_Meta is
return "range_expression";
when Iir_Kind_Protected_Type_Body =>
return "protected_type_body";
+ when Iir_Kind_Wildcard_Type_Definition =>
+ return "wildcard_type_definition";
when Iir_Kind_Subtype_Definition =>
return "subtype_definition";
when Iir_Kind_Scalar_Nature_Definition =>
@@ -1262,6 +1269,8 @@ package body Nodes_Meta is
return "sensitized_process_statement";
when Iir_Kind_Process_Statement =>
return "process_statement";
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment =>
+ return "concurrent_simple_signal_assignment";
when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
return "concurrent_conditional_signal_assignment";
when Iir_Kind_Concurrent_Selected_Signal_Assignment =>
@@ -1290,8 +1299,10 @@ package body Nodes_Meta is
return "generate_statement_body";
when Iir_Kind_If_Generate_Else_Clause =>
return "if_generate_else_clause";
- when Iir_Kind_Signal_Assignment_Statement =>
- return "signal_assignment_statement";
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
+ return "simple_signal_assignment_statement";
+ when Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ return "conditional_signal_assignment_statement";
when Iir_Kind_Null_Statement =>
return "null_statement";
when Iir_Kind_Assertion_Statement =>
@@ -1302,6 +1313,8 @@ package body Nodes_Meta is
return "wait_statement";
when Iir_Kind_Variable_Assignment_Statement =>
return "variable_assignment_statement";
+ when Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ return "conditional_variable_assignment_statement";
when Iir_Kind_Return_Statement =>
return "return_statement";
when Iir_Kind_For_Loop_Statement =>
@@ -1812,6 +1825,8 @@ package body Nodes_Meta is
return Attr_None;
when Field_Expression =>
return Attr_None;
+ when Field_Conditional_Expression =>
+ return Attr_None;
when Field_Allocator_Designated_Type =>
return Attr_Ref;
when Field_Selected_Waveform_Chain =>
@@ -2136,6 +2151,10 @@ package body Nodes_Meta is
Field_Condition,
Field_Chain,
Field_Waveform_Chain,
+ -- Iir_Kind_Conditional_Expression
+ Field_Condition,
+ Field_Chain,
+ Field_Expression,
-- Iir_Kind_Association_Element_By_Expression
Field_Whole_Association_Flag,
Field_Collapse_Signal_Flag,
@@ -2483,6 +2502,12 @@ package body Nodes_Meta is
Field_Chain,
Field_Protected_Type_Declaration,
Field_Parent,
+ -- Iir_Kind_Wildcard_Type_Definition
+ Field_Resolved_Flag,
+ Field_Signal_Type_Flag,
+ Field_Type_Staticness,
+ Field_Type_Declarator,
+ Field_Base_Type,
-- Iir_Kind_Subtype_Definition
Field_Range_Constraint,
Field_Subtype_Type_Mark,
@@ -3368,6 +3393,18 @@ package body Nodes_Meta is
Field_Process_Origin,
Field_Parent,
Field_Callees_List,
+ -- Iir_Kind_Concurrent_Simple_Signal_Assignment
+ Field_Label,
+ Field_Delay_Mechanism,
+ Field_Postponed_Flag,
+ Field_Visible_Flag,
+ Field_Guarded_Target_State,
+ Field_Target,
+ Field_Chain,
+ Field_Reject_Time_Expression,
+ Field_Waveform_Chain,
+ Field_Guard,
+ Field_Parent,
-- Iir_Kind_Concurrent_Conditional_Signal_Assignment
Field_Label,
Field_Delay_Mechanism,
@@ -3507,7 +3544,7 @@ package body Nodes_Meta is
Field_Generate_Statement_Body,
Field_Generate_Else_Clause,
Field_Parent,
- -- Iir_Kind_Signal_Assignment_Statement
+ -- Iir_Kind_Simple_Signal_Assignment_Statement
Field_Label,
Field_Delay_Mechanism,
Field_Visible_Flag,
@@ -3517,6 +3554,16 @@ package body Nodes_Meta is
Field_Reject_Time_Expression,
Field_Waveform_Chain,
Field_Parent,
+ -- Iir_Kind_Conditional_Signal_Assignment_Statement
+ Field_Label,
+ Field_Delay_Mechanism,
+ Field_Visible_Flag,
+ Field_Guarded_Target_State,
+ Field_Target,
+ Field_Chain,
+ Field_Reject_Time_Expression,
+ Field_Conditional_Waveform_Chain,
+ Field_Parent,
-- Iir_Kind_Null_Statement
Field_Label,
Field_Visible_Flag,
@@ -3552,6 +3599,13 @@ package body Nodes_Meta is
Field_Chain,
Field_Expression,
Field_Parent,
+ -- Iir_Kind_Conditional_Variable_Assignment_Statement
+ Field_Label,
+ Field_Visible_Flag,
+ Field_Target,
+ Field_Chain,
+ Field_Conditional_Expression,
+ Field_Parent,
-- Iir_Kind_Return_Statement
Field_Label,
Field_Visible_Flag,
@@ -3985,238 +4039,243 @@ package body Nodes_Meta is
Iir_Kind_Overflow_Literal => 83,
Iir_Kind_Waveform_Element => 86,
Iir_Kind_Conditional_Waveform => 89,
- Iir_Kind_Association_Element_By_Expression => 96,
- Iir_Kind_Association_Element_By_Individual => 103,
- Iir_Kind_Association_Element_Open => 108,
- Iir_Kind_Association_Element_Package => 114,
- Iir_Kind_Choice_By_Others => 119,
- Iir_Kind_Choice_By_Expression => 126,
- Iir_Kind_Choice_By_Range => 133,
- Iir_Kind_Choice_By_None => 138,
- Iir_Kind_Choice_By_Name => 144,
- Iir_Kind_Entity_Aspect_Entity => 146,
- Iir_Kind_Entity_Aspect_Configuration => 147,
- Iir_Kind_Entity_Aspect_Open => 147,
- Iir_Kind_Block_Configuration => 153,
- Iir_Kind_Block_Header => 157,
- Iir_Kind_Component_Configuration => 163,
- Iir_Kind_Binding_Indication => 169,
- Iir_Kind_Entity_Class => 171,
- Iir_Kind_Attribute_Value => 179,
- Iir_Kind_Signature => 182,
- Iir_Kind_Aggregate_Info => 189,
- Iir_Kind_Procedure_Call => 193,
- Iir_Kind_Record_Element_Constraint => 199,
- Iir_Kind_Array_Element_Resolution => 200,
- Iir_Kind_Record_Resolution => 201,
- Iir_Kind_Record_Element_Resolution => 204,
- Iir_Kind_Attribute_Specification => 213,
- Iir_Kind_Disconnection_Specification => 218,
- Iir_Kind_Configuration_Specification => 223,
- Iir_Kind_Access_Type_Definition => 230,
- Iir_Kind_Incomplete_Type_Definition => 237,
- Iir_Kind_File_Type_Definition => 244,
- Iir_Kind_Protected_Type_Declaration => 253,
- Iir_Kind_Record_Type_Definition => 263,
- Iir_Kind_Array_Type_Definition => 275,
- Iir_Kind_Array_Subtype_Definition => 290,
- Iir_Kind_Record_Subtype_Definition => 301,
- Iir_Kind_Access_Subtype_Definition => 309,
- Iir_Kind_Physical_Subtype_Definition => 318,
- Iir_Kind_Floating_Subtype_Definition => 328,
- Iir_Kind_Integer_Subtype_Definition => 337,
- Iir_Kind_Enumeration_Subtype_Definition => 346,
- Iir_Kind_Enumeration_Type_Definition => 355,
- Iir_Kind_Integer_Type_Definition => 361,
- Iir_Kind_Floating_Type_Definition => 367,
- Iir_Kind_Physical_Type_Definition => 376,
- Iir_Kind_Range_Expression => 382,
- Iir_Kind_Protected_Type_Body => 389,
- Iir_Kind_Subtype_Definition => 393,
- Iir_Kind_Scalar_Nature_Definition => 397,
- Iir_Kind_Overload_List => 398,
- Iir_Kind_Type_Declaration => 404,
- Iir_Kind_Anonymous_Type_Declaration => 409,
- Iir_Kind_Subtype_Declaration => 417,
- Iir_Kind_Nature_Declaration => 423,
- Iir_Kind_Subnature_Declaration => 429,
- Iir_Kind_Package_Declaration => 439,
- Iir_Kind_Package_Instantiation_Declaration => 450,
- Iir_Kind_Package_Body => 457,
- Iir_Kind_Configuration_Declaration => 466,
- Iir_Kind_Entity_Declaration => 478,
- Iir_Kind_Architecture_Body => 490,
- Iir_Kind_Context_Declaration => 496,
- Iir_Kind_Package_Header => 498,
- Iir_Kind_Unit_Declaration => 507,
- Iir_Kind_Library_Declaration => 514,
- Iir_Kind_Component_Declaration => 524,
- Iir_Kind_Attribute_Declaration => 531,
- Iir_Kind_Group_Template_Declaration => 537,
- Iir_Kind_Group_Declaration => 544,
- Iir_Kind_Element_Declaration => 551,
- Iir_Kind_Non_Object_Alias_Declaration => 559,
- Iir_Kind_Psl_Declaration => 567,
- Iir_Kind_Terminal_Declaration => 573,
- Iir_Kind_Free_Quantity_Declaration => 582,
- Iir_Kind_Across_Quantity_Declaration => 594,
- Iir_Kind_Through_Quantity_Declaration => 606,
- Iir_Kind_Enumeration_Literal => 617,
- Iir_Kind_Function_Declaration => 641,
- Iir_Kind_Procedure_Declaration => 664,
- Iir_Kind_Function_Body => 674,
- Iir_Kind_Procedure_Body => 685,
- Iir_Kind_Object_Alias_Declaration => 697,
- Iir_Kind_File_Declaration => 712,
- Iir_Kind_Guard_Signal_Declaration => 725,
- Iir_Kind_Signal_Declaration => 742,
- Iir_Kind_Variable_Declaration => 755,
- Iir_Kind_Constant_Declaration => 769,
- Iir_Kind_Iterator_Declaration => 781,
- Iir_Kind_Interface_Constant_Declaration => 797,
- Iir_Kind_Interface_Variable_Declaration => 813,
- Iir_Kind_Interface_Signal_Declaration => 834,
- Iir_Kind_Interface_File_Declaration => 850,
- Iir_Kind_Interface_Package_Declaration => 859,
- Iir_Kind_Identity_Operator => 863,
- Iir_Kind_Negation_Operator => 867,
- Iir_Kind_Absolute_Operator => 871,
- Iir_Kind_Not_Operator => 875,
- Iir_Kind_Condition_Operator => 879,
- Iir_Kind_Reduction_And_Operator => 883,
- Iir_Kind_Reduction_Or_Operator => 887,
- Iir_Kind_Reduction_Nand_Operator => 891,
- Iir_Kind_Reduction_Nor_Operator => 895,
- Iir_Kind_Reduction_Xor_Operator => 899,
- Iir_Kind_Reduction_Xnor_Operator => 903,
- Iir_Kind_And_Operator => 908,
- Iir_Kind_Or_Operator => 913,
- Iir_Kind_Nand_Operator => 918,
- Iir_Kind_Nor_Operator => 923,
- Iir_Kind_Xor_Operator => 928,
- Iir_Kind_Xnor_Operator => 933,
- Iir_Kind_Equality_Operator => 938,
- Iir_Kind_Inequality_Operator => 943,
- Iir_Kind_Less_Than_Operator => 948,
- Iir_Kind_Less_Than_Or_Equal_Operator => 953,
- Iir_Kind_Greater_Than_Operator => 958,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 963,
- Iir_Kind_Match_Equality_Operator => 968,
- Iir_Kind_Match_Inequality_Operator => 973,
- Iir_Kind_Match_Less_Than_Operator => 978,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 983,
- Iir_Kind_Match_Greater_Than_Operator => 988,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 993,
- Iir_Kind_Sll_Operator => 998,
- Iir_Kind_Sla_Operator => 1003,
- Iir_Kind_Srl_Operator => 1008,
- Iir_Kind_Sra_Operator => 1013,
- Iir_Kind_Rol_Operator => 1018,
- Iir_Kind_Ror_Operator => 1023,
- Iir_Kind_Addition_Operator => 1028,
- Iir_Kind_Substraction_Operator => 1033,
- Iir_Kind_Concatenation_Operator => 1038,
- Iir_Kind_Multiplication_Operator => 1043,
- Iir_Kind_Division_Operator => 1048,
- Iir_Kind_Modulus_Operator => 1053,
- Iir_Kind_Remainder_Operator => 1058,
- Iir_Kind_Exponentiation_Operator => 1063,
- Iir_Kind_Function_Call => 1071,
- Iir_Kind_Aggregate => 1077,
- Iir_Kind_Parenthesis_Expression => 1080,
- Iir_Kind_Qualified_Expression => 1084,
- Iir_Kind_Type_Conversion => 1089,
- Iir_Kind_Allocator_By_Expression => 1093,
- Iir_Kind_Allocator_By_Subtype => 1099,
- Iir_Kind_Selected_Element => 1105,
- Iir_Kind_Dereference => 1110,
- Iir_Kind_Implicit_Dereference => 1115,
- Iir_Kind_Slice_Name => 1122,
- Iir_Kind_Indexed_Name => 1128,
- Iir_Kind_Psl_Expression => 1130,
- Iir_Kind_Sensitized_Process_Statement => 1150,
- Iir_Kind_Process_Statement => 1170,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1181,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1193,
- Iir_Kind_Concurrent_Assertion_Statement => 1201,
- Iir_Kind_Psl_Default_Clock => 1205,
- Iir_Kind_Psl_Assert_Statement => 1214,
- Iir_Kind_Psl_Cover_Statement => 1223,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1230,
- Iir_Kind_Block_Statement => 1243,
- Iir_Kind_If_Generate_Statement => 1253,
- Iir_Kind_For_Generate_Statement => 1262,
- Iir_Kind_Component_Instantiation_Statement => 1272,
- Iir_Kind_Simple_Simultaneous_Statement => 1279,
- Iir_Kind_Generate_Statement_Body => 1290,
- Iir_Kind_If_Generate_Else_Clause => 1295,
- Iir_Kind_Signal_Assignment_Statement => 1304,
- Iir_Kind_Null_Statement => 1308,
- Iir_Kind_Assertion_Statement => 1315,
- Iir_Kind_Report_Statement => 1321,
- Iir_Kind_Wait_Statement => 1328,
- Iir_Kind_Variable_Assignment_Statement => 1334,
- Iir_Kind_Return_Statement => 1340,
- Iir_Kind_For_Loop_Statement => 1349,
- Iir_Kind_While_Loop_Statement => 1357,
- Iir_Kind_Next_Statement => 1363,
- Iir_Kind_Exit_Statement => 1369,
- Iir_Kind_Case_Statement => 1377,
- Iir_Kind_Procedure_Call_Statement => 1383,
- Iir_Kind_If_Statement => 1392,
- Iir_Kind_Elsif => 1397,
- Iir_Kind_Character_Literal => 1404,
- Iir_Kind_Simple_Name => 1411,
- Iir_Kind_Selected_Name => 1419,
- Iir_Kind_Operator_Symbol => 1424,
- Iir_Kind_Selected_By_All_Name => 1429,
- Iir_Kind_Parenthesis_Name => 1433,
- Iir_Kind_External_Constant_Name => 1442,
- Iir_Kind_External_Signal_Name => 1451,
- Iir_Kind_External_Variable_Name => 1460,
- Iir_Kind_Package_Pathname => 1463,
- Iir_Kind_Absolute_Pathname => 1464,
- Iir_Kind_Relative_Pathname => 1465,
- Iir_Kind_Pathname_Element => 1469,
- Iir_Kind_Base_Attribute => 1471,
- Iir_Kind_Left_Type_Attribute => 1476,
- Iir_Kind_Right_Type_Attribute => 1481,
- Iir_Kind_High_Type_Attribute => 1486,
- Iir_Kind_Low_Type_Attribute => 1491,
- Iir_Kind_Ascending_Type_Attribute => 1496,
- Iir_Kind_Image_Attribute => 1502,
- Iir_Kind_Value_Attribute => 1508,
- Iir_Kind_Pos_Attribute => 1514,
- Iir_Kind_Val_Attribute => 1520,
- Iir_Kind_Succ_Attribute => 1526,
- Iir_Kind_Pred_Attribute => 1532,
- Iir_Kind_Leftof_Attribute => 1538,
- Iir_Kind_Rightof_Attribute => 1544,
- Iir_Kind_Delayed_Attribute => 1552,
- Iir_Kind_Stable_Attribute => 1560,
- Iir_Kind_Quiet_Attribute => 1568,
- Iir_Kind_Transaction_Attribute => 1576,
- Iir_Kind_Event_Attribute => 1580,
- Iir_Kind_Active_Attribute => 1584,
- Iir_Kind_Last_Event_Attribute => 1588,
- Iir_Kind_Last_Active_Attribute => 1592,
- Iir_Kind_Last_Value_Attribute => 1596,
- Iir_Kind_Driving_Attribute => 1600,
- Iir_Kind_Driving_Value_Attribute => 1604,
- Iir_Kind_Behavior_Attribute => 1604,
- Iir_Kind_Structure_Attribute => 1604,
- Iir_Kind_Simple_Name_Attribute => 1611,
- Iir_Kind_Instance_Name_Attribute => 1616,
- Iir_Kind_Path_Name_Attribute => 1621,
- Iir_Kind_Left_Array_Attribute => 1628,
- Iir_Kind_Right_Array_Attribute => 1635,
- Iir_Kind_High_Array_Attribute => 1642,
- Iir_Kind_Low_Array_Attribute => 1649,
- Iir_Kind_Length_Array_Attribute => 1656,
- Iir_Kind_Ascending_Array_Attribute => 1663,
- Iir_Kind_Range_Array_Attribute => 1670,
- Iir_Kind_Reverse_Range_Array_Attribute => 1677,
- Iir_Kind_Attribute_Name => 1685
+ Iir_Kind_Conditional_Expression => 92,
+ Iir_Kind_Association_Element_By_Expression => 99,
+ Iir_Kind_Association_Element_By_Individual => 106,
+ Iir_Kind_Association_Element_Open => 111,
+ Iir_Kind_Association_Element_Package => 117,
+ Iir_Kind_Choice_By_Others => 122,
+ Iir_Kind_Choice_By_Expression => 129,
+ Iir_Kind_Choice_By_Range => 136,
+ Iir_Kind_Choice_By_None => 141,
+ Iir_Kind_Choice_By_Name => 147,
+ Iir_Kind_Entity_Aspect_Entity => 149,
+ Iir_Kind_Entity_Aspect_Configuration => 150,
+ Iir_Kind_Entity_Aspect_Open => 150,
+ Iir_Kind_Block_Configuration => 156,
+ Iir_Kind_Block_Header => 160,
+ Iir_Kind_Component_Configuration => 166,
+ Iir_Kind_Binding_Indication => 172,
+ Iir_Kind_Entity_Class => 174,
+ Iir_Kind_Attribute_Value => 182,
+ Iir_Kind_Signature => 185,
+ Iir_Kind_Aggregate_Info => 192,
+ Iir_Kind_Procedure_Call => 196,
+ Iir_Kind_Record_Element_Constraint => 202,
+ Iir_Kind_Array_Element_Resolution => 203,
+ Iir_Kind_Record_Resolution => 204,
+ Iir_Kind_Record_Element_Resolution => 207,
+ Iir_Kind_Attribute_Specification => 216,
+ Iir_Kind_Disconnection_Specification => 221,
+ Iir_Kind_Configuration_Specification => 226,
+ Iir_Kind_Access_Type_Definition => 233,
+ Iir_Kind_Incomplete_Type_Definition => 240,
+ Iir_Kind_File_Type_Definition => 247,
+ Iir_Kind_Protected_Type_Declaration => 256,
+ Iir_Kind_Record_Type_Definition => 266,
+ Iir_Kind_Array_Type_Definition => 278,
+ Iir_Kind_Array_Subtype_Definition => 293,
+ Iir_Kind_Record_Subtype_Definition => 304,
+ Iir_Kind_Access_Subtype_Definition => 312,
+ Iir_Kind_Physical_Subtype_Definition => 321,
+ Iir_Kind_Floating_Subtype_Definition => 331,
+ Iir_Kind_Integer_Subtype_Definition => 340,
+ Iir_Kind_Enumeration_Subtype_Definition => 349,
+ Iir_Kind_Enumeration_Type_Definition => 358,
+ Iir_Kind_Integer_Type_Definition => 364,
+ Iir_Kind_Floating_Type_Definition => 370,
+ Iir_Kind_Physical_Type_Definition => 379,
+ Iir_Kind_Range_Expression => 385,
+ Iir_Kind_Protected_Type_Body => 392,
+ Iir_Kind_Wildcard_Type_Definition => 397,
+ Iir_Kind_Subtype_Definition => 401,
+ Iir_Kind_Scalar_Nature_Definition => 405,
+ Iir_Kind_Overload_List => 406,
+ Iir_Kind_Type_Declaration => 412,
+ Iir_Kind_Anonymous_Type_Declaration => 417,
+ Iir_Kind_Subtype_Declaration => 425,
+ Iir_Kind_Nature_Declaration => 431,
+ Iir_Kind_Subnature_Declaration => 437,
+ Iir_Kind_Package_Declaration => 447,
+ Iir_Kind_Package_Instantiation_Declaration => 458,
+ Iir_Kind_Package_Body => 465,
+ Iir_Kind_Configuration_Declaration => 474,
+ Iir_Kind_Entity_Declaration => 486,
+ Iir_Kind_Architecture_Body => 498,
+ Iir_Kind_Context_Declaration => 504,
+ Iir_Kind_Package_Header => 506,
+ Iir_Kind_Unit_Declaration => 515,
+ Iir_Kind_Library_Declaration => 522,
+ Iir_Kind_Component_Declaration => 532,
+ Iir_Kind_Attribute_Declaration => 539,
+ Iir_Kind_Group_Template_Declaration => 545,
+ Iir_Kind_Group_Declaration => 552,
+ Iir_Kind_Element_Declaration => 559,
+ Iir_Kind_Non_Object_Alias_Declaration => 567,
+ Iir_Kind_Psl_Declaration => 575,
+ Iir_Kind_Terminal_Declaration => 581,
+ Iir_Kind_Free_Quantity_Declaration => 590,
+ Iir_Kind_Across_Quantity_Declaration => 602,
+ Iir_Kind_Through_Quantity_Declaration => 614,
+ Iir_Kind_Enumeration_Literal => 625,
+ Iir_Kind_Function_Declaration => 649,
+ Iir_Kind_Procedure_Declaration => 672,
+ Iir_Kind_Function_Body => 682,
+ Iir_Kind_Procedure_Body => 693,
+ Iir_Kind_Object_Alias_Declaration => 705,
+ Iir_Kind_File_Declaration => 720,
+ Iir_Kind_Guard_Signal_Declaration => 733,
+ Iir_Kind_Signal_Declaration => 750,
+ Iir_Kind_Variable_Declaration => 763,
+ Iir_Kind_Constant_Declaration => 777,
+ Iir_Kind_Iterator_Declaration => 789,
+ Iir_Kind_Interface_Constant_Declaration => 805,
+ Iir_Kind_Interface_Variable_Declaration => 821,
+ Iir_Kind_Interface_Signal_Declaration => 842,
+ Iir_Kind_Interface_File_Declaration => 858,
+ Iir_Kind_Interface_Package_Declaration => 867,
+ Iir_Kind_Identity_Operator => 871,
+ Iir_Kind_Negation_Operator => 875,
+ Iir_Kind_Absolute_Operator => 879,
+ Iir_Kind_Not_Operator => 883,
+ Iir_Kind_Condition_Operator => 887,
+ Iir_Kind_Reduction_And_Operator => 891,
+ Iir_Kind_Reduction_Or_Operator => 895,
+ Iir_Kind_Reduction_Nand_Operator => 899,
+ Iir_Kind_Reduction_Nor_Operator => 903,
+ Iir_Kind_Reduction_Xor_Operator => 907,
+ Iir_Kind_Reduction_Xnor_Operator => 911,
+ Iir_Kind_And_Operator => 916,
+ Iir_Kind_Or_Operator => 921,
+ Iir_Kind_Nand_Operator => 926,
+ Iir_Kind_Nor_Operator => 931,
+ Iir_Kind_Xor_Operator => 936,
+ Iir_Kind_Xnor_Operator => 941,
+ Iir_Kind_Equality_Operator => 946,
+ Iir_Kind_Inequality_Operator => 951,
+ Iir_Kind_Less_Than_Operator => 956,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 961,
+ Iir_Kind_Greater_Than_Operator => 966,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 971,
+ Iir_Kind_Match_Equality_Operator => 976,
+ Iir_Kind_Match_Inequality_Operator => 981,
+ Iir_Kind_Match_Less_Than_Operator => 986,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 991,
+ Iir_Kind_Match_Greater_Than_Operator => 996,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1001,
+ Iir_Kind_Sll_Operator => 1006,
+ Iir_Kind_Sla_Operator => 1011,
+ Iir_Kind_Srl_Operator => 1016,
+ Iir_Kind_Sra_Operator => 1021,
+ Iir_Kind_Rol_Operator => 1026,
+ Iir_Kind_Ror_Operator => 1031,
+ Iir_Kind_Addition_Operator => 1036,
+ Iir_Kind_Substraction_Operator => 1041,
+ Iir_Kind_Concatenation_Operator => 1046,
+ Iir_Kind_Multiplication_Operator => 1051,
+ Iir_Kind_Division_Operator => 1056,
+ Iir_Kind_Modulus_Operator => 1061,
+ Iir_Kind_Remainder_Operator => 1066,
+ Iir_Kind_Exponentiation_Operator => 1071,
+ Iir_Kind_Function_Call => 1079,
+ Iir_Kind_Aggregate => 1085,
+ Iir_Kind_Parenthesis_Expression => 1088,
+ Iir_Kind_Qualified_Expression => 1092,
+ Iir_Kind_Type_Conversion => 1097,
+ Iir_Kind_Allocator_By_Expression => 1101,
+ Iir_Kind_Allocator_By_Subtype => 1107,
+ Iir_Kind_Selected_Element => 1113,
+ Iir_Kind_Dereference => 1118,
+ Iir_Kind_Implicit_Dereference => 1123,
+ Iir_Kind_Slice_Name => 1130,
+ Iir_Kind_Indexed_Name => 1136,
+ Iir_Kind_Psl_Expression => 1138,
+ Iir_Kind_Sensitized_Process_Statement => 1158,
+ Iir_Kind_Process_Statement => 1178,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1189,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1200,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1212,
+ Iir_Kind_Concurrent_Assertion_Statement => 1220,
+ Iir_Kind_Psl_Default_Clock => 1224,
+ Iir_Kind_Psl_Assert_Statement => 1233,
+ Iir_Kind_Psl_Cover_Statement => 1242,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1249,
+ Iir_Kind_Block_Statement => 1262,
+ Iir_Kind_If_Generate_Statement => 1272,
+ Iir_Kind_For_Generate_Statement => 1281,
+ Iir_Kind_Component_Instantiation_Statement => 1291,
+ Iir_Kind_Simple_Simultaneous_Statement => 1298,
+ Iir_Kind_Generate_Statement_Body => 1309,
+ Iir_Kind_If_Generate_Else_Clause => 1314,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1323,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1332,
+ Iir_Kind_Null_Statement => 1336,
+ Iir_Kind_Assertion_Statement => 1343,
+ Iir_Kind_Report_Statement => 1349,
+ Iir_Kind_Wait_Statement => 1356,
+ Iir_Kind_Variable_Assignment_Statement => 1362,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1368,
+ Iir_Kind_Return_Statement => 1374,
+ Iir_Kind_For_Loop_Statement => 1383,
+ Iir_Kind_While_Loop_Statement => 1391,
+ Iir_Kind_Next_Statement => 1397,
+ Iir_Kind_Exit_Statement => 1403,
+ Iir_Kind_Case_Statement => 1411,
+ Iir_Kind_Procedure_Call_Statement => 1417,
+ Iir_Kind_If_Statement => 1426,
+ Iir_Kind_Elsif => 1431,
+ Iir_Kind_Character_Literal => 1438,
+ Iir_Kind_Simple_Name => 1445,
+ Iir_Kind_Selected_Name => 1453,
+ Iir_Kind_Operator_Symbol => 1458,
+ Iir_Kind_Selected_By_All_Name => 1463,
+ Iir_Kind_Parenthesis_Name => 1467,
+ Iir_Kind_External_Constant_Name => 1476,
+ Iir_Kind_External_Signal_Name => 1485,
+ Iir_Kind_External_Variable_Name => 1494,
+ Iir_Kind_Package_Pathname => 1497,
+ Iir_Kind_Absolute_Pathname => 1498,
+ Iir_Kind_Relative_Pathname => 1499,
+ Iir_Kind_Pathname_Element => 1503,
+ Iir_Kind_Base_Attribute => 1505,
+ Iir_Kind_Left_Type_Attribute => 1510,
+ Iir_Kind_Right_Type_Attribute => 1515,
+ Iir_Kind_High_Type_Attribute => 1520,
+ Iir_Kind_Low_Type_Attribute => 1525,
+ Iir_Kind_Ascending_Type_Attribute => 1530,
+ Iir_Kind_Image_Attribute => 1536,
+ Iir_Kind_Value_Attribute => 1542,
+ Iir_Kind_Pos_Attribute => 1548,
+ Iir_Kind_Val_Attribute => 1554,
+ Iir_Kind_Succ_Attribute => 1560,
+ Iir_Kind_Pred_Attribute => 1566,
+ Iir_Kind_Leftof_Attribute => 1572,
+ Iir_Kind_Rightof_Attribute => 1578,
+ Iir_Kind_Delayed_Attribute => 1586,
+ Iir_Kind_Stable_Attribute => 1594,
+ Iir_Kind_Quiet_Attribute => 1602,
+ Iir_Kind_Transaction_Attribute => 1610,
+ Iir_Kind_Event_Attribute => 1614,
+ Iir_Kind_Active_Attribute => 1618,
+ Iir_Kind_Last_Event_Attribute => 1622,
+ Iir_Kind_Last_Active_Attribute => 1626,
+ Iir_Kind_Last_Value_Attribute => 1630,
+ Iir_Kind_Driving_Attribute => 1634,
+ Iir_Kind_Driving_Value_Attribute => 1638,
+ Iir_Kind_Behavior_Attribute => 1638,
+ Iir_Kind_Structure_Attribute => 1638,
+ Iir_Kind_Simple_Name_Attribute => 1645,
+ Iir_Kind_Instance_Name_Attribute => 1650,
+ Iir_Kind_Path_Name_Attribute => 1655,
+ Iir_Kind_Left_Array_Attribute => 1662,
+ Iir_Kind_Right_Array_Attribute => 1669,
+ Iir_Kind_High_Array_Attribute => 1676,
+ Iir_Kind_Low_Array_Attribute => 1683,
+ Iir_Kind_Length_Array_Attribute => 1690,
+ Iir_Kind_Ascending_Array_Attribute => 1697,
+ Iir_Kind_Range_Array_Attribute => 1704,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1711,
+ Iir_Kind_Attribute_Name => 1719
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -4778,6 +4837,8 @@ package body Nodes_Meta is
return Get_Default_Configuration_Declaration (N);
when Field_Expression =>
return Get_Expression (N);
+ when Field_Conditional_Expression =>
+ return Get_Conditional_Expression (N);
when Field_Allocator_Designated_Type =>
return Get_Allocator_Designated_Type (N);
when Field_Selected_Waveform_Chain =>
@@ -5146,6 +5207,8 @@ package body Nodes_Meta is
Set_Default_Configuration_Declaration (N, V);
when Field_Expression =>
Set_Expression (N, V);
+ when Field_Conditional_Expression =>
+ Set_Conditional_Expression (N, V);
when Field_Allocator_Designated_Type =>
Set_Allocator_Designated_Type (N, V);
when Field_Selected_Waveform_Chain =>
@@ -6121,9 +6184,11 @@ package body Nodes_Meta is
function Has_Guarded_Target_State (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
- | Iir_Kind_Signal_Assignment_Statement =>
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
return True;
when others =>
return False;
@@ -6579,6 +6644,7 @@ package body Nodes_Meta is
| Iir_Kind_Context_Reference
| Iir_Kind_Waveform_Element
| Iir_Kind_Conditional_Waveform
+ | Iir_Kind_Conditional_Expression
| Iir_Kind_Association_Element_By_Expression
| Iir_Kind_Association_Element_By_Individual
| Iir_Kind_Association_Element_Open
@@ -6631,6 +6697,7 @@ package body Nodes_Meta is
| Iir_Kind_Interface_Package_Declaration
| Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -6643,12 +6710,14 @@ package body Nodes_Meta is
| Iir_Kind_For_Generate_Statement
| Iir_Kind_Component_Instantiation_Statement
| Iir_Kind_Simple_Simultaneous_Statement
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Wait_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
@@ -7285,7 +7354,8 @@ package body Nodes_Meta is
| Iir_Kind_Enumeration_Type_Definition
| Iir_Kind_Integer_Type_Definition
| Iir_Kind_Floating_Type_Definition
- | Iir_Kind_Physical_Type_Definition =>
+ | Iir_Kind_Physical_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return True;
when others =>
return False;
@@ -7367,6 +7437,7 @@ package body Nodes_Meta is
| Iir_Kind_Interface_Package_Declaration
| Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -7380,12 +7451,14 @@ package body Nodes_Meta is
| Iir_Kind_Component_Instantiation_Statement
| Iir_Kind_Simple_Simultaneous_Statement
| Iir_Kind_Generate_Statement_Body
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Wait_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
@@ -7412,6 +7485,7 @@ package body Nodes_Meta is
case K is
when Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -7424,12 +7498,14 @@ package body Nodes_Meta is
| Iir_Kind_For_Generate_Statement
| Iir_Kind_Component_Instantiation_Statement
| Iir_Kind_Simple_Simultaneous_Statement
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Wait_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
@@ -7488,6 +7564,7 @@ package body Nodes_Meta is
| Iir_Kind_Interface_Package_Declaration
| Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -7500,12 +7577,14 @@ package body Nodes_Meta is
| Iir_Kind_Component_Instantiation_Statement
| Iir_Kind_Simple_Simultaneous_Statement
| Iir_Kind_If_Generate_Else_Clause
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Wait_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
@@ -7570,7 +7649,8 @@ package body Nodes_Meta is
| Iir_Kind_Enumeration_Type_Definition
| Iir_Kind_Integer_Type_Definition
| Iir_Kind_Floating_Type_Definition
- | Iir_Kind_Physical_Type_Definition =>
+ | Iir_Kind_Physical_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return True;
when others =>
return False;
@@ -7679,7 +7759,8 @@ package body Nodes_Meta is
| Iir_Kind_Enumeration_Type_Definition
| Iir_Kind_Integer_Type_Definition
| Iir_Kind_Floating_Type_Definition
- | Iir_Kind_Physical_Type_Definition =>
+ | Iir_Kind_Physical_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return True;
when others =>
return False;
@@ -7804,10 +7885,13 @@ package body Nodes_Meta is
function Has_Target (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
- | Iir_Kind_Signal_Assignment_Statement
- | Iir_Kind_Variable_Assignment_Statement =>
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
+ | Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement =>
return True;
when others =>
return False;
@@ -7818,7 +7902,8 @@ package body Nodes_Meta is
begin
case K is
when Iir_Kind_Conditional_Waveform
- | Iir_Kind_Signal_Assignment_Statement =>
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Simple_Signal_Assignment_Statement =>
return True;
when others =>
return False;
@@ -7828,7 +7913,8 @@ package body Nodes_Meta is
function Has_Guard (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment =>
return True;
when others =>
@@ -7839,9 +7925,11 @@ package body Nodes_Meta is
function Has_Delay_Mechanism (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
- | Iir_Kind_Signal_Assignment_Statement =>
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
return True;
when others =>
return False;
@@ -7851,9 +7939,11 @@ package body Nodes_Meta is
function Has_Reject_Time_Expression (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
- | Iir_Kind_Signal_Assignment_Statement =>
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
return True;
when others =>
return False;
@@ -7897,6 +7987,7 @@ package body Nodes_Meta is
case K is
when Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -8012,7 +8103,8 @@ package body Nodes_Meta is
| Iir_Kind_Enumeration_Type_Definition
| Iir_Kind_Integer_Type_Definition
| Iir_Kind_Floating_Type_Definition
- | Iir_Kind_Physical_Type_Definition =>
+ | Iir_Kind_Physical_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return True;
when others =>
return False;
@@ -8039,7 +8131,8 @@ package body Nodes_Meta is
| Iir_Kind_Enumeration_Type_Definition
| Iir_Kind_Integer_Type_Definition
| Iir_Kind_Floating_Type_Definition
- | Iir_Kind_Physical_Type_Definition =>
+ | Iir_Kind_Physical_Type_Definition
+ | Iir_Kind_Wildcard_Type_Definition =>
return True;
when others =>
return False;
@@ -8197,7 +8290,8 @@ package body Nodes_Meta is
function Has_Expression (K : Iir_Kind) return Boolean is
begin
case K is
- when Iir_Kind_Attribute_Specification
+ when Iir_Kind_Conditional_Expression
+ | Iir_Kind_Attribute_Specification
| Iir_Kind_Disconnection_Specification
| Iir_Kind_Parenthesis_Expression
| Iir_Kind_Qualified_Expression
@@ -8213,6 +8307,11 @@ package body Nodes_Meta is
end case;
end Has_Expression;
+ function Has_Conditional_Expression (K : Iir_Kind) return Boolean is
+ begin
+ return K = Iir_Kind_Conditional_Variable_Assignment_Statement;
+ end Has_Conditional_Expression;
+
function Has_Allocator_Designated_Type (K : Iir_Kind) return Boolean is
begin
case K is
@@ -8231,7 +8330,13 @@ package body Nodes_Meta is
function Has_Conditional_Waveform_Chain (K : Iir_Kind) return Boolean is
begin
- return K = Iir_Kind_Concurrent_Conditional_Signal_Assignment;
+ case K is
+ when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ return True;
+ when others =>
+ return False;
+ end case;
end Has_Conditional_Waveform_Chain;
function Has_Guard_Expression (K : Iir_Kind) return Boolean is
@@ -8312,6 +8417,7 @@ package body Nodes_Meta is
begin
case K is
when Iir_Kind_Conditional_Waveform
+ | Iir_Kind_Conditional_Expression
| Iir_Kind_If_Generate_Statement
| Iir_Kind_If_Generate_Else_Clause
| Iir_Kind_While_Loop_Statement
@@ -8409,6 +8515,7 @@ package body Nodes_Meta is
| Iir_Kind_Interface_Package_Declaration
| Iir_Kind_Sensitized_Process_Statement
| Iir_Kind_Process_Statement
+ | Iir_Kind_Concurrent_Simple_Signal_Assignment
| Iir_Kind_Concurrent_Conditional_Signal_Assignment
| Iir_Kind_Concurrent_Selected_Signal_Assignment
| Iir_Kind_Concurrent_Assertion_Statement
@@ -8423,12 +8530,14 @@ package body Nodes_Meta is
| Iir_Kind_Simple_Simultaneous_Statement
| Iir_Kind_Generate_Statement_Body
| Iir_Kind_If_Generate_Else_Clause
- | Iir_Kind_Signal_Assignment_Statement
+ | Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement
| Iir_Kind_Null_Statement
| Iir_Kind_Assertion_Statement
| Iir_Kind_Report_Statement
| Iir_Kind_Wait_Statement
| Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement
| Iir_Kind_Return_Statement
| Iir_Kind_For_Loop_Statement
| Iir_Kind_While_Loop_Statement
diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads
index 844fee1..f688d52 100644
--- a/src/vhdl/nodes_meta.ads
+++ b/src/vhdl/nodes_meta.ads
@@ -250,6 +250,7 @@ package Nodes_Meta is
Field_Default_Binding_Indication,
Field_Default_Configuration_Declaration,
Field_Expression,
+ Field_Conditional_Expression,
Field_Allocator_Designated_Type,
Field_Selected_Waveform_Chain,
Field_Conditional_Waveform_Chain,
@@ -733,6 +734,7 @@ package Nodes_Meta is
function Has_Default_Configuration_Declaration (K : Iir_Kind)
return Boolean;
function Has_Expression (K : Iir_Kind) return Boolean;
+ function Has_Conditional_Expression (K : Iir_Kind) return Boolean;
function Has_Allocator_Designated_Type (K : Iir_Kind) return Boolean;
function Has_Selected_Waveform_Chain (K : Iir_Kind) return Boolean;
function Has_Conditional_Waveform_Chain (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index edcdb7a..2991e07 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -4935,7 +4935,7 @@ package body Parse is
-- precond : next token
-- postcond: next token
--
- -- [ §9.5 ]
+ -- [ LRM93 9.5 ]
-- options ::= [ GUARDED ] [ delay_mechanism ]
procedure Parse_Options (Stmt : Iir) is
begin
@@ -4947,26 +4947,75 @@ package body Parse is
end Parse_Options;
-- precond : next tkoen
- -- postcond: ';'
- --
- -- [ §9.5.1 ]
- -- conditional_signal_assignment ::=
- -- target <= options conditional_waveforms ;
+ -- postcond: next token (';')
--
- -- [ §9.5.1 ]
+ -- [ LRM93 9.5.1 ]
-- conditional_waveforms ::=
-- { waveform WHEN condition ELSE }
-- waveform [ WHEN condition ]
- function Parse_Conditional_Signal_Assignment (Target: Iir) return Iir
+ function Parse_Conditional_Waveforms return Iir
is
- use Iir_Chains.Conditional_Waveform_Chain_Handling;
- Res: Iir;
- Cond_Wf, Last_Cond_Wf : Iir_Conditional_Waveform;
+ Wf : Iir;
+ Res : Iir;
+ Cond_Wf, N_Cond_Wf : Iir_Conditional_Waveform;
begin
- Res := Create_Iir (Iir_Kind_Concurrent_Conditional_Signal_Assignment);
- Set_Target (Res, Target);
- Location_Copy (Res, Get_Target (Res));
+ Wf := Parse_Waveform;
+ if Current_Token /= Tok_When then
+ return Wf;
+ else
+ Res := Create_Iir (Iir_Kind_Conditional_Waveform);
+ Set_Location (Res);
+ Set_Waveform_Chain (Res, Wf);
+
+ Cond_Wf := Res;
+ loop
+ -- Eat 'when'
+ Scan;
+
+ Set_Condition (Cond_Wf, Parse_Expression);
+
+ if Current_Token /= Tok_Else then
+ if Flags.Vhdl_Std = Vhdl_87 then
+ Error_Msg_Parse ("else missing in vhdl 87");
+ end if;
+ exit;
+ end if;
+
+ N_Cond_Wf := Create_Iir (Iir_Kind_Conditional_Waveform);
+ Set_Location (N_Cond_Wf);
+ Set_Chain (Cond_Wf, N_Cond_Wf);
+ Cond_Wf := N_Cond_Wf;
+
+ -- Eat 'else'
+ Scan;
+
+ Set_Waveform_Chain (Cond_Wf, Parse_Waveform);
+
+ exit when Current_Token /= Tok_When;
+ end loop;
+ return Res;
+ end if;
+ end Parse_Conditional_Waveforms;
+ -- precond : '<=' (or ':=')
+ -- postcond: ';'
+ --
+ -- [ LRM93 9.5.1 ]
+ -- concurrent_conditional_signal_assignment ::=
+ -- target <= [ GUARDED ] [ delay_mechanism ] conditional_waveforms ;
+ --
+ -- [ LRM08 10.5.2.1 ]
+ -- concurrent_simple_waveform_assignment ::=
+ -- target <= [ GUARDED ] [ delay_mechanism ] waveform ;
+ function Parse_Concurrent_Conditional_Signal_Assignment (Target: Iir)
+ return Iir
+ is
+ Res: Iir;
+ Loc : Location_Type;
+ N_Res : Iir;
+ Wf : Iir;
+ begin
+ Loc := Get_Token_Location;
case Current_Token is
when Tok_Less_Equal =>
null;
@@ -4976,30 +5025,34 @@ package body Parse is
when others =>
Expect (Tok_Less_Equal);
end case;
+
+ -- Eat '<='.
Scan;
+ -- Assume simple signal assignment.
+ Res := Create_Iir (Iir_Kind_Concurrent_Simple_Signal_Assignment);
Parse_Options (Res);
- Build_Init (Last_Cond_Wf);
- loop
- Cond_Wf := Create_Iir (Iir_Kind_Conditional_Waveform);
- Append (Last_Cond_Wf, Res, Cond_Wf);
- Set_Location (Cond_Wf);
- Set_Waveform_Chain (Cond_Wf, Parse_Waveform);
- exit when Current_Token /= Tok_When;
- Scan;
- Set_Condition (Cond_Wf, Parse_Expression);
- if Current_Token /= Tok_Else then
- if Flags.Vhdl_Std = Vhdl_87 then
- Error_Msg_Parse ("else missing in vhdl 87");
- end if;
- exit;
+ Wf := Parse_Conditional_Waveforms;
+ if Get_Kind (Wf) = Iir_Kind_Conditional_Waveform then
+ N_Res :=
+ Create_Iir (Iir_Kind_Concurrent_Conditional_Signal_Assignment);
+ if Get_Guard (Res) /= Null_Iir then
+ Set_Guard (N_Res, N_Res);
end if;
- Scan;
- end loop;
+ Set_Delay_Mechanism (N_Res, Get_Delay_Mechanism (Res));
+ Set_Reject_Time_Expression (N_Res, Get_Reject_Time_Expression (Res));
+ Free_Iir (Res);
+ Res := N_Res;
+ Set_Conditional_Waveform_Chain (Res, Wf);
+ else
+ Set_Waveform_Chain (Res, Wf);
+ end if;
+ Set_Location (Res, Loc);
+ Set_Target (Res, Target);
Expect (Tok_Semi_Colon);
return Res;
- end Parse_Conditional_Signal_Assignment;
+ end Parse_Concurrent_Conditional_Signal_Assignment;
-- precond : WITH
-- postcond: ';'
@@ -5336,53 +5389,145 @@ package body Parse is
-- precond: '<='
-- postcond: next token
--
- -- [ §8.4 ]
+ -- [ LRM93 8.4 ]
-- signal_assignment_statement ::=
-- [ label : ] target <= [ delay_mechanism ] waveform ;
+ --
+ -- [ LRM08 10.5 Signal assignment statement ]
+ -- signal_assignement_statement ::=
+ -- [ label : ] simple_signal_assignement
+ -- | [ label : ] conditional_signal_assignement
+ -- | [ label : ] selected_signal_assignement (TODO)
function Parse_Signal_Assignment_Statement (Target : Iir) return Iir
is
Stmt : Iir;
- Wave_Chain : Iir_Waveform_Element;
+ N_Stmt : Iir;
+ Wave_Chain : Iir;
begin
- Stmt := Create_Iir (Iir_Kind_Signal_Assignment_Statement);
- Location_Copy (Stmt, Target);
+ Stmt := Create_Iir (Iir_Kind_Simple_Signal_Assignment_Statement);
+ Set_Location (Stmt);
Set_Target (Stmt, Target);
+
+ -- Eat '<='.
Scan;
+
Parse_Delay_Mechanism (Stmt);
- Wave_Chain := Parse_Waveform;
+
+ Wave_Chain := Parse_Conditional_Waveforms;
+
-- LRM 8.4 Signal assignment statement
-- It is an error is the reserved word UNAFFECTED appears as a
- -- waveform in a (sequential) signa assignment statement.
+ -- waveform in a (sequential) signal assignment statement.
if Wave_Chain = Null_Iir then
Error_Msg_Parse
("'unaffected' is not allowed in a sequential statement");
+ elsif Get_Kind (Wave_Chain) = Iir_Kind_Conditional_Waveform then
+ if Flags.Vhdl_Std < Vhdl_08 then
+ Error_Msg_Parse
+ ("conditional signal assignment not allowed in before vhdl08");
+ end if;
+ N_Stmt :=
+ Create_Iir (Iir_Kind_Conditional_Signal_Assignment_Statement);
+ Location_Copy (N_Stmt, Stmt);
+ Set_Target (N_Stmt, Target);
+ Set_Delay_Mechanism (N_Stmt, Get_Delay_Mechanism (Stmt));
+ Set_Reject_Time_Expression
+ (N_Stmt, Get_Reject_Time_Expression (Stmt));
+ Set_Conditional_Waveform_Chain (N_Stmt, Wave_Chain);
+ Free_Iir (Stmt);
+ Stmt := N_Stmt;
+ else
+ Set_Waveform_Chain (Stmt, Wave_Chain);
end if;
- Set_Waveform_Chain (Stmt, Wave_Chain);
+
return Stmt;
end Parse_Signal_Assignment_Statement;
+ -- precond: WHEN
+ -- postcond: next token
+ --
+ -- [ LRM08 10.5.3 Conditional signal assignments ]
+ -- conditional_expressions ::=
+ -- expression WHEN condition
+ -- { ELSE expression WHEN condition }
+ -- [ ELSE expression ]
+ function Parse_Conditional_Expression (Expr : Iir) return Iir
+ is
+ Res : Iir;
+ El, N_El : Iir;
+ begin
+ Res := Create_Iir (Iir_Kind_Conditional_Expression);
+ Set_Location (Res);
+ Set_Expression (Res, Expr);
+ El := Res;
+
+ loop
+ -- Eat 'when'
+ Scan;
+
+ Set_Condition (El, Parse_Expression);
+
+ exit when Current_Token /= Tok_Else;
+
+ N_El := Create_Iir (Iir_Kind_Conditional_Expression);
+ Set_Location (N_El);
+ Set_Chain (El, N_El);
+ El := N_El;
+
+ -- Eat 'else'
+ Scan;
+
+ Set_Expression (N_El, Parse_Expression);
+
+ exit when Current_Token /= Tok_When;
+ end loop;
+
+ return Res;
+ end Parse_Conditional_Expression;
+
-- precond: ':='
-- postcond: next token
--
- -- [ §8.5 ]
+ -- [ LRM93 8.5 ]
-- variable_assignment_statement ::=
-- [ label : ] target := expression ;
function Parse_Variable_Assignment_Statement (Target : Iir) return Iir
is
Stmt : Iir;
+ Loc : Location_Type;
+ Expr : Iir;
begin
- Stmt := Create_Iir (Iir_Kind_Variable_Assignment_Statement);
- Location_Copy (Stmt, Target);
- Set_Target (Stmt, Target);
+ Loc := Get_Token_Location;
+
+ -- Eat ':='
Scan;
- Set_Expression (Stmt, Parse_Expression);
+
+ Expr := Parse_Expression;
+
+ if Current_Token = Tok_When then
+ if Flags.Vhdl_Std < Vhdl_08 then
+ Error_Msg_Parse
+ ("conditional variable assignment not allowed before vhdl08");
+ end if;
+ Stmt :=
+ Create_Iir (Iir_Kind_Conditional_Variable_Assignment_Statement);
+ Set_Location (Stmt, Loc);
+ Set_Target (Stmt, Target);
+ Set_Conditional_Expression
+ (Stmt, Parse_Conditional_Expression (Expr));
+ else
+ Stmt := Create_Iir (Iir_Kind_Variable_Assignment_Statement);
+ Set_Location (Stmt, Loc);
+ Set_Target (Stmt, Target);
+ Set_Expression (Stmt, Expr);
+ end if;
return Stmt;
end Parse_Variable_Assignment_Statement;
-- precond: next token
-- postcond: next token
--
- -- [ 8 ]
+ -- [ LRM93 8 ]
-- sequence_of_statement ::= { sequential_statement }
--
-- [ 8 ]
@@ -6641,7 +6786,7 @@ package body Parse is
-- precond : first token
-- postcond: END
--
- -- [ §9 ]
+ -- [ LRM93 9 ]
-- concurrent_statement ::= block_statement
-- | process_statement
-- | concurrent_procedure_call_statement
@@ -6650,15 +6795,15 @@ package body Parse is
-- | component_instantiation_statement
-- | generate_statement
--
- -- [ §9.4 ]
+ -- [ LRM93 9.4 ]
-- concurrent_assertion_statement ::=
-- [ label : ] [ POSTPONED ] assertion ;
--
- -- [ §9.3 ]
+ -- [ LRM93 9.3 ]
-- concurrent_procedure_call_statement ::=
-- [ label : ] [ POSTPONED ] procedure_call ;
--
- -- [ §9.5 ]
+ -- [ LRM93 9.5 ]
-- concurrent_signal_assignment_statement ::=
-- [ label : ] [ POSTPONED ] conditional_signal_assignment
-- | [ label : ] [ POSTPONED ] selected_signal_assignment
@@ -6671,7 +6816,7 @@ package body Parse is
| Tok_Assign =>
-- This is a conditional signal assignment.
-- Error for ':=' is handled by the subprogram.
- return Parse_Conditional_Signal_Assignment (Target);
+ return Parse_Concurrent_Conditional_Signal_Assignment (Target);
when Tok_Semi_Colon =>
-- a procedure call or a component instantiation.
-- Parse it as a procedure call, may be revert to a
@@ -6698,7 +6843,7 @@ package body Parse is
Expect (Tok_Semi_Colon);
return Res;
else
- return Parse_Conditional_Signal_Assignment
+ return Parse_Concurrent_Conditional_Signal_Assignment
(Parse_Simple_Expression (Target));
end if;
end case;
@@ -6878,7 +7023,7 @@ package body Parse is
Id := Parse_Aggregate;
if Current_Token = Tok_Less_Equal then
-- This is a conditional signal assignment.
- Stmt := Parse_Conditional_Signal_Assignment (Id);
+ Stmt := Parse_Concurrent_Conditional_Signal_Assignment (Id);
else
Error_Msg_Parse ("'<=' expected after aggregate");
Eat_Tokens_Until_Semi_Colon;
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index bbd68d4..df2f68d 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -32,6 +32,7 @@ with Sem_Assocs; use Sem_Assocs;
with Xrefs; use Xrefs;
package body Sem_Expr is
+
procedure Not_Match (Expr: Iir; A_Type: Iir)
is
pragma Inline (Not_Match);
@@ -60,9 +61,12 @@ package body Sem_Expr is
-- A_TYPE can't be an overload list.
--
-- This procedure can be called in the second pass, when the type is known.
- procedure Replace_Type (Target: Iir; A_Type: Iir) is
+ procedure Replace_Type (Target: Iir; A_Type: Iir)
+ is
Old_Type: Iir;
begin
+ pragma Assert (not Is_Overload_List (A_Type));
+
Old_Type := Get_Type (Target);
if Old_Type /= Null_Iir then
if Is_Overload_List (Old_Type) then
@@ -70,16 +74,13 @@ package body Sem_Expr is
elsif Old_Type = A_Type then
return;
else
- -- Cannot replace a type.
+ -- Cannot replace an existing type by another one.
raise Internal_Error;
end if;
end if;
if A_Type = Null_Iir then
return;
end if;
- if Is_Overload_List (A_Type) then
- raise Internal_Error;
- end if;
Set_Type (Target, A_Type);
end Replace_Type;
@@ -91,11 +92,11 @@ package body Sem_Expr is
return Expr_Type = Null_Iir or else Is_Overload_List (Expr_Type);
end Is_Overloaded;
- -- Return the common type of base types LEFT and RIGHT.
- -- LEFT are RIGHT must be really base types (not subtypes).
- -- Roughly speaking, it returns LEFT (= RIGHT) if LEFT = RIGHT (ie, same
- -- type), null otherwise.
- -- However, it handles implicite conversions of universal types.
+ -- Return the common type of base types LEFT and RIGHT.
+ -- LEFT are RIGHT must be really base types (not subtypes).
+ -- Roughly speaking, it returns LEFT (= RIGHT) if LEFT = RIGHT (ie, same
+ -- type), null otherwise.
+ -- However, it handles implicite conversions of universal types.
function Get_Common_Basetype (Left: Iir; Right: Iir)
return Iir is
begin
@@ -220,11 +221,9 @@ package body Sem_Expr is
function Compatibility_Nodes (Left : Iir; Right : Iir)
return Compatibility_Level
is
- Left_Type, Right_Type : Iir;
+ Left_Type : constant Iir := Get_Base_Type (Get_Type (Left));
+ Right_Type : constant Iir := Get_Type (Right);
begin
- Left_Type := Get_Base_Type (Get_Type (Left));
- Right_Type := Get_Type (Right);
-
-- Check.
case Get_Kind (Left_Type) is
when Iir_Kind_Floating_Type_Definition
@@ -237,16 +236,13 @@ package body Sem_Expr is
| Iir_Kind_Array_Type_Definition =>
null;
when others =>
- Error_Kind ("are_node_compatible_ov", Left_Type);
+ Error_Kind ("compatibility_nodes", Left_Type);
end case;
return Compatibility_Types1 (Left_Type, Right_Type);
end Compatibility_Nodes;
- -- Return TRUE iff A_TYPE can be the type of string or bit string literal
- -- EXPR. EXPR is needed to distinguish between string and bit string
- -- for VHDL87 rule about the type of a bit string.
- function Is_String_Literal_Type (A_Type : Iir; Expr : Iir) return Boolean
+ function Is_String_Type (A_Type : Iir) return Boolean
is
Base_Type : constant Iir := Get_Base_Type (A_Type);
El_Bt : Iir;
@@ -262,6 +258,21 @@ package body Sem_Expr is
if Get_Kind (El_Bt) /= Iir_Kind_Enumeration_Type_Definition then
return False;
end if;
+ -- FIXME: character type
+ return True;
+ end Is_String_Type;
+
+ -- Return TRUE iff A_TYPE can be the type of string or bit string literal
+ -- EXPR. EXPR is needed to distinguish between string and bit string
+ -- for VHDL87 rule about the type of a bit string.
+ function Is_String_Literal_Type (A_Type : Iir; Expr : Iir) return Boolean
+ is
+ El_Bt : Iir;
+ begin
+ if not Is_String_Type (A_Type) then
+ return False;
+ end if;
+ El_Bt := Get_Base_Type (Get_Element_Subtype (A_Type));
-- LRM87 7.3.1
-- ... (for string literals) or of type BIT (for bit string literals).
if Flags.Vhdl_Std = Vhdl_87
@@ -4204,6 +4215,317 @@ package body Sem_Expr is
end case;
end Sem_Expression_Ov;
+ function Is_Expr_Not_Analyzed (Expr : Iir) return Boolean is
+ begin
+ return Get_Type (Expr) = Null_Iir;
+ end Is_Expr_Not_Analyzed;
+
+ function Is_Expr_Fully_Analyzed (Expr : Iir) return Boolean is
+ begin
+ return Is_Defined_Type (Get_Type (Expr));
+ end Is_Expr_Fully_Analyzed;
+
+ function Get_Wildcard_Type (Wildcard : Iir; Atype : Iir) return Iir is
+ begin
+ if Atype in Iir_Wildcard_Types then
+ -- Special wildcard vs wildcard.
+ case Iir_Wildcard_Types (Wildcard) is
+ when Wildcard_Any_Type =>
+ return Atype;
+ when Wildcard_Any_Aggregate_Type =>
+ case Iir_Wildcard_Types (Atype) is
+ when Wildcard_Any_Type
+ | Wildcard_Any_Aggregate_Type =>
+ return Wildcard_Any_Aggregate_Type;
+ when Wildcard_Any_String_Type =>
+ return Wildcard_Any_String_Type;
+ when Wildcard_Any_Access_Type =>
+ return Null_Iir;
+ end case;
+ when Wildcard_Any_String_Type =>
+ case Iir_Wildcard_Types (Atype) is
+ when Wildcard_Any_Type
+ | Wildcard_Any_Aggregate_Type
+ | Wildcard_Any_String_Type =>
+ return Wildcard_Any_String_Type;
+ when Wildcard_Any_Access_Type =>
+ return Null_Iir;
+ end case;
+ when Wildcard_Any_Access_Type =>
+ case Iir_Wildcard_Types (Atype) is
+ when Wildcard_Any_Type
+ | Wildcard_Any_Access_Type =>
+ return Wildcard_Any_Access_Type;
+ when Wildcard_Any_Aggregate_Type
+ | Wildcard_Any_String_Type =>
+ return Null_Iir;
+ end case;
+ end case;
+ else
+ case Iir_Wildcard_Types (Wildcard) is
+ when Wildcard_Any_Type =>
+ -- Match with any type.
+ return Atype;
+ when Wildcard_Any_Aggregate_Type =>
+ if Is_Aggregate_Type (Atype) then
+ return Atype;
+ end if;
+ when Wildcard_Any_String_Type =>
+ if Is_String_Type (Atype) then
+ return Atype;
+ end if;
+ when Wildcard_Any_Access_Type =>
+ if Get_Kind (Get_Base_Type (Atype))
+ = Iir_Kind_Access_Type_Definition
+ then
+ return Atype;
+ end if;
+ end case;
+ return Null_Iir;
+ end if;
+ end Get_Wildcard_Type;
+
+ function Compatible_Types_Intersect_Single (T1, T2 : Iir) return Iir is
+ begin
+ if T1 = T2 then
+ return T1;
+ end if;
+ if T1 in Iir_Wildcard_Types then
+ return Get_Wildcard_Type (T1, T2);
+ elsif T2 in Iir_Wildcard_Types then
+ return Get_Wildcard_Type (T2, T1);
+ else
+ return Get_Common_Basetype (Get_Base_Type (T1), Get_Base_Type (T2));
+ end if;
+ end Compatible_Types_Intersect_Single;
+
+ function Compatible_Types_Intersect_Single_List (A_Type, Types_List : Iir)
+ return Iir
+ is
+ Types_List_List : Iir_List;
+ El: Iir;
+ Com : Iir;
+ Res : Iir;
+ begin
+ if not Is_Overload_List (Types_List) then
+ return Compatible_Types_Intersect_Single (A_Type, Types_List);
+ else
+ Types_List_List := Get_Overload_List (Types_List);
+ Res := Null_Iir;
+ for I in Natural loop
+ El := Get_Nth_Element (Types_List_List, I);
+ exit when El = Null_Iir;
+ Com := Compatible_Types_Intersect_Single (El, A_Type);
+ if Com /= Null_Iir then
+ Add_Result (Res, Com);
+ end if;
+ end loop;
+ return Res;
+ end if;
+ end Compatible_Types_Intersect_Single_List;
+
+ function Compatible_Types_Intersect (List1, List2 : Iir) return Iir
+ is
+ List1_List : Iir_List;
+ Res : Iir;
+ El : Iir;
+ Tmp : Iir;
+ begin
+ if List1 = Null_Iir or else List2 = Null_Iir then
+ return Null_Iir;
+ end if;
+
+ if Is_Overload_List (List1) then
+ List1_List := Get_Overload_List (List1);
+ Res := Null_Iir;
+ for I in Natural loop
+ El := Get_Nth_Element (List1_List, I);
+ exit when El = Null_Iir;
+ Tmp := Compatible_Types_Intersect_Single_List (El, List2);
+ if Tmp /= Null_Iir then
+ Add_Result (Res, Tmp);
+ end if;
+ end loop;
+ return Res;
+ else
+ return Compatible_Types_Intersect_Single_List (List1, List2);
+ end if;
+ end Compatible_Types_Intersect;
+
+ function Sem_Expression_Wildcard (Expr : Iir; Atype : Iir) return Iir
+ is
+ Expr_Type : constant Iir := Get_Type (Expr);
+ Atype_Defined : constant Boolean := Is_Defined_Type (Atype);
+ Expr_Type_Defined : constant Boolean := Is_Defined_Type (Expr_Type);
+ begin
+ if Expr_Type /= Null_Iir then
+ -- EXPR is at least partially analyzed.
+ if Expr_Type_Defined or else not Atype_Defined then
+ -- Nothing to do if:
+ -- - Expression is already fully analyzed: caller has to merge
+ -- types
+ -- - Expression is partially analyzed but ATYPE is not defined:
+ -- caller has to merge types.
+ return Expr;
+ end if;
+ end if;
+
+ case Get_Kind (Expr) is
+ when Iir_Kind_Aggregate =>
+ if Atype_Defined then
+ return Sem_Aggregate (Expr, Atype);
+ else
+ pragma Assert (Expr_Type = Null_Iir);
+ Set_Type (Expr, Wildcard_Any_Aggregate_Type);
+ end if;
+ return Expr;
+
+ when Iir_Kind_String_Literal8 =>
+ if Atype_Defined then
+ if not Is_String_Literal_Type (Atype, Expr) then
+ Not_Match (Expr, Atype);
+ Set_Type (Expr, Error_Type);
+ else
+ Set_Type (Expr, Atype);
+ Sem_String_Literal (Expr);
+ end if;
+ else
+ pragma Assert (Expr_Type = Null_Iir);
+ Set_Type (Expr, Wildcard_Any_String_Type);
+ end if;
+ return Expr;
+
+ when Iir_Kind_Null_Literal =>
+ if Atype_Defined then
+ if not Is_Null_Literal_Type (Atype) then
+ Not_Match (Expr, Atype);
+ Set_Type (Expr, Error_Type);
+ else
+ Set_Type (Expr, Atype);
+ Set_Expr_Staticness (Expr, Locally);
+ end if;
+ else
+ pragma Assert (Expr_Type = Null_Iir);
+ Set_Type (Expr, Wildcard_Any_Access_Type);
+ end if;
+ return Expr;
+
+ when Iir_Kind_Allocator_By_Expression
+ | Iir_Kind_Allocator_By_Subtype =>
+ if Atype_Defined then
+ if not Is_Null_Literal_Type (Atype) then
+ Not_Match (Expr, Atype);
+ Set_Type (Expr, Error_Type);
+ else
+ return Sem_Allocator (Expr, Atype);
+ end if;
+ else
+ pragma Assert (Expr_Type = Null_Iir);
+ Set_Type (Expr, Wildcard_Any_Access_Type);
+ end if;
+ return Expr;
+
+ when Iir_Kind_Parenthesis_Expression =>
+ declare
+ Sub_Expr : Iir;
+ Ntype : Iir;
+ begin
+ Sub_Expr := Get_Expression (Expr);
+ if Atype_Defined then
+ -- Very important: loose the subtype due to
+ -- LRM93 7.3.2.2 Array aggregate.
+ Ntype := Get_Base_Type (Atype);
+ else
+ Ntype := Atype;
+ end if;
+ Sub_Expr := Sem_Expression_Wildcard (Sub_Expr, Ntype);
+ if Sub_Expr /= Null_Iir then
+ Set_Expression (Expr, Sub_Expr);
+ Set_Type (Expr, Get_Type (Sub_Expr));
+ Set_Expr_Staticness (Expr, Get_Expr_Staticness (Sub_Expr));
+ else
+ Set_Type (Expr, Error_Type);
+ end if;
+ end;
+ return Expr;
+
+ when others =>
+ if Atype_Defined then
+ return Sem_Expression_Ov (Expr, Get_Base_Type (Atype));
+ else
+ declare
+ Res : Iir;
+ Res_Type : Iir;
+ Prev_Res_Type : Iir;
+ begin
+ pragma Assert (Expr_Type = Null_Iir);
+ if Atype in Iir_Wildcard_Types then
+ -- Analyze without known type.
+ Res := Sem_Expression_Ov (Expr, Null_Iir);
+ if Res = Null_Iir then
+ Set_Type (Expr, Error_Type);
+ return Expr;
+ end if;
+ Prev_Res_Type := Get_Type (Res);
+
+ -- Filter possible type.
+ Res_Type := Compatible_Types_Intersect_Single_List
+ (Atype, Prev_Res_Type);
+
+ if Res_Type = Null_Iir then
+ -- No matching type. This is an error.
+ Not_Match (Expr, Atype);
+ Set_Type (Expr, Error_Type);
+ elsif Is_Defined_Type (Res_Type) then
+ -- Known and defined matching type.
+ if Res_Type /= Prev_Res_Type then
+ -- Need to refine analysis.
+ Res := Sem_Expression_Ov (Expr, Res_Type);
+ end if;
+ else
+ -- Matching but not defined type (overload).
+ Set_Type (Expr, Res_Type);
+ end if;
+ if Is_Overload_List (Prev_Res_Type) then
+ Free_Overload_List (Prev_Res_Type);
+ end if;
+ return Res;
+ else
+ pragma Assert (Atype = Null_Iir);
+ return Sem_Expression_Ov (Expr, Atype);
+ end if;
+ end;
+ end if;
+ end case;
+ end Sem_Expression_Wildcard;
+
+ procedure Merge_Wildcard_Type (Expr : Iir; Atype : in out Iir)
+ is
+ Result_Type : Iir;
+ Expr_Type : Iir;
+ begin
+ if Expr = Null_Iir then
+ return;
+ end if;
+ Expr_Type := Get_Type (Expr);
+ pragma Assert (Expr_Type /= Null_Iir);
+ Result_Type := Compatible_Types_Intersect (Atype, Expr_Type);
+ if Is_Overload_List (Atype) then
+ Free_Overload_List (Atype);
+ end if;
+ if Result_Type /= Null_Iir then
+ if Is_Defined_Type (Atype) then
+ -- If ATYPE was already defined, keep it. So that subtypes
+ -- are kept (this is needed for aggregates and always helpful).
+ null;
+ else
+ Atype := Result_Type;
+ end if;
+ else
+ Atype := Result_Type;
+ end if;
+ end Merge_Wildcard_Type;
+
-- If A_TYPE is not null, then EXPR must be of type A_TYPE.
-- Return null in case of error.
function Sem_Expression (Expr: Iir; A_Type: Iir) return Iir
@@ -4447,6 +4769,10 @@ package body Sem_Expr is
is
Res : Iir;
begin
+ -- This function fully analyze COND, so it supposes COND is not yet
+ -- analyzed.
+ pragma Assert (Is_Expr_Not_Analyzed (Cond));
+
if Vhdl_Std < Vhdl_08 then
Res := Sem_Expression (Cond, Boolean_Type_Definition);
diff --git a/src/vhdl/sem_expr.ads b/src/vhdl/sem_expr.ads
index 523ace9..40fa06f 100644
--- a/src/vhdl/sem_expr.ads
+++ b/src/vhdl/sem_expr.ads
@@ -63,7 +63,7 @@ package Sem_Expr is
-- (Handle specific overloading rules).
function Sem_Case_Expression (Expr : Iir) return Iir;
- -- Sem COND as a condition.
+ -- Sem COND as a condition. COND must have not been analyzed.
-- In VHDL08, this follows 9.2.9 Condition operator.
-- In VHDL87 and 93, type of COND must be a boolean.
-- A check is made that COND can be read.
@@ -204,4 +204,33 @@ package Sem_Expr is
-- Return THE type which is compatible with LIST1 are LIST2.
-- Return null_iir if there is no such type or if there are several types.
function Search_Compatible_Type (List1, List2 : Iir) return Iir;
+
+ -- Return the intersection of LIST1 and LIST2.
+ -- This function accept wildcard types.
+ function Compatible_Types_Intersect (List1, List2 : Iir) return Iir;
+
+ -- Return True if an expression is not analyzed (its type is not set).
+ -- All expressions from the parser are not analyzed.
+ function Is_Expr_Not_Analyzed (Expr : Iir) return Boolean;
+ pragma Inline (Is_Expr_Not_Analyzed);
+
+ -- Return True if an expression is fully analyzed: its type is set to
+ -- either a type definition, or to an error type.
+ -- Some expressions can be partially analyzed: either set to an overload
+ -- list or to a wildcard type.
+ function Is_Expr_Fully_Analyzed (Expr : Iir) return Boolean;
+ pragma Inline (Is_Expr_Fully_Analyzed);
+
+ -- Analyze EXPR using ATYPE.
+ -- If EXPR is not analyzed, EXPR is analyzed using type constraints from
+ -- ATYPE.
+ -- If ATYPE is a defined type (neither an overload list nor a wildcard
+ -- type), EXPR will be fully analyzed (possibly with an error).
+ -- If EXPR is partially or fully analyzed, ATYPE must not be null_iir and
+ -- it is checked with the types of EXPR. EXPR may become fully analyzed.
+ function Sem_Expression_Wildcard (Expr : Iir; Atype : Iir) return Iir;
+
+ -- To be used after Sem_Expression_Wildcard to update list ATYPE of
+ -- possible types.
+ procedure Merge_Wildcard_Type (Expr : Iir; Atype : in out Iir);
end Sem_Expr;
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 114bb68..a65fd54 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -125,6 +125,14 @@ package body Sem_Names is
return Get_Kind (An_Iir) = Iir_Kind_Overload_List;
end Is_Overload_List;
+ function Is_Defined_Type (Atype : Iir) return Boolean is
+ begin
+ return Atype /= Null_Iir
+ and then not Kind_In (Get_Kind (Atype),
+ Iir_Kind_Overload_List,
+ Iir_Kind_Wildcard_Type_Definition);
+ end Is_Defined_Type;
+
-- From the list LIST of function or enumeration literal, extract the
-- list of (return) types.
-- If there is only one type, return it.
diff --git a/src/vhdl/sem_names.ads b/src/vhdl/sem_names.ads
index d20c4cf..afd2b97 100644
--- a/src/vhdl/sem_names.ads
+++ b/src/vhdl/sem_names.ads
@@ -118,6 +118,10 @@ package Sem_Names is
-- Before the first call, RES should be set to NULL_IIR.
procedure Add_Result (Res : in out Iir; Decl : Iir);
+ -- Return TRUE if ATYPE is defined: not Null_Iir, not an overload list and
+ -- not a wildcard.
+ function Is_Defined_Type (Atype : Iir) return Boolean;
+
-- Free a Parenthesis_Name. This is a special case as in general the
-- Association_Chain field must be freed too.
procedure Free_Parenthesis_Name (Name : Iir; Res : Iir);
diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb
index c6bb1e9..d7280a8 100644
--- a/src/vhdl/sem_specs.adb
+++ b/src/vhdl/sem_specs.adb
@@ -76,20 +76,8 @@ package body Sem_Specs is
| Iir_Kind_Block_Statement
| Iir_Kind_If_Generate_Statement
| Iir_Kind_For_Generate_Statement
- | Iir_Kind_If_Statement
- | Iir_Kind_For_Loop_Statement
- | Iir_Kind_While_Loop_Statement
- | Iir_Kind_Next_Statement
- | Iir_Kind_Exit_Statement
- | Iir_Kind_Signal_Assignment_Statement
- | Iir_Kind_Variable_Assignment_Statement
- | Iir_Kind_Assertion_Statement
- | Iir_Kind_Wait_Statement
- | Iir_Kind_Return_Statement
- | Iir_Kind_Case_Statement
- | Iir_Kind_Procedure_Call_Statement
| Iir_Kind_Concurrent_Procedure_Call_Statement
- | Iir_Kind_Null_Statement =>
+ | Iir_Kinds_Sequential_Statement =>
return Tok_Label;
when Iir_Kind_Enumeration_Literal =>
return Tok_Literal;
diff --git a/src/vhdl/sem_stmts.adb b/src/vhdl/sem_stmts.adb
index 4541be4..6f93041 100644
--- a/src/vhdl/sem_stmts.adb
+++ b/src/vhdl/sem_stmts.adb
@@ -408,68 +408,57 @@ package body Sem_Stmts is
Check_Aggregate_Target (Stmt, Target, Nbr);
Check_Uniq_Aggregate_Associated (Target, Nbr);
else
- if Get_Kind (Stmt) = Iir_Kind_Variable_Assignment_Statement then
- Check_Simple_Variable_Target (Stmt, Target, None);
- else
- Check_Simple_Signal_Target (Stmt, Target, None);
- end if;
+ case Get_Kind (Stmt) is
+ when Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ Check_Simple_Variable_Target (Stmt, Target, None);
+ when others =>
+ Check_Simple_Signal_Target (Stmt, Target, None);
+ end case;
end if;
end Check_Target;
- -- Return FALSE in case of error.
- function Sem_Signal_Assignment_Target_And_Option (Stmt: Iir; Sig_Type : Iir)
- return Boolean
+ type Resolve_Stages is (Resolve_Stage_1, Resolve_Stage_2);
+ pragma Unreferenced (Resolve_Stage_2);
+
+ procedure Sem_Signal_Assignment_Target_And_Option
+ (Stmt: Iir; Sig_Type : in out Iir)
is
-- The target of the assignment.
Target: Iir;
-- The value that will be assigned.
Expr: Iir;
- Ok : Boolean;
begin
- Ok := True;
- -- Find the signal.
Target := Get_Target (Stmt);
+ Target := Sem_Expression_Wildcard (Target, Sig_Type);
- if Sig_Type = Null_Iir
- and then Get_Kind (Target) = Iir_Kind_Aggregate
- then
- -- Do not try to analyze an aggregate if its type is unknown.
- -- A target cannot be a qualified type and its type should be
- -- determine by the context (LRM93 7.3.2 Aggregates).
- Ok := False;
- else
- -- Analyze the target
- Target := Sem_Expression (Target, Sig_Type);
- if Target /= Null_Iir then
- Set_Target (Stmt, Target);
+ if Target /= Null_Iir then
+ Set_Target (Stmt, Target);
+ if Is_Expr_Fully_Analyzed (Target) then
Check_Target (Stmt, Target);
- Sem_Types.Set_Type_Has_Signal (Get_Type (Target));
- else
- Ok := False;
+ Sig_Type := Get_Type (Target);
+ Sem_Types.Set_Type_Has_Signal (Sig_Type);
end if;
end if;
Expr := Get_Reject_Time_Expression (Stmt);
- if Expr /= Null_Iir then
+ if Expr /= Null_Iir
+ and then Is_Expr_Not_Analyzed (Expr)
+ then
Expr := Sem_Expression (Expr, Time_Type_Definition);
if Expr /= Null_Iir then
Check_Read (Expr);
Set_Reject_Time_Expression (Stmt, Expr);
- else
- Ok := False;
end if;
end if;
- return Ok;
end Sem_Signal_Assignment_Target_And_Option;
-- Semantize a waveform_list WAVEFORM_LIST that is assigned via statement
-- ASSIGN_STMT to a subelement or a slice of a signal SIGNAL_DECL.
procedure Sem_Waveform_Chain
- (Assign_Stmt: Iir;
- Waveform_Chain : Iir_Waveform_Element;
+ (Waveform_Chain : Iir_Waveform_Element;
Waveform_Type : in out Iir)
is
- pragma Unreferenced (Assign_Stmt);
Expr: Iir;
We: Iir_Waveform_Element;
Time, Last_Time : Iir_Int64;
@@ -489,62 +478,62 @@ package body Sem_Stmts is
-- sem_check_waveform_list.
null;
else
- if Get_Kind (Expr) = Iir_Kind_Aggregate
- and then Waveform_Type = Null_Iir
- then
- Error_Msg_Sem
- ("type of waveform is unknown, use qualified type", Expr);
- else
- Expr := Sem_Expression (Expr, Waveform_Type);
- if Expr /= Null_Iir then
+ Expr := Sem_Expression_Wildcard (Expr, Waveform_Type);
+
+ if Expr /= Null_Iir then
+ if Is_Expr_Fully_Analyzed (Expr) then
Check_Read (Expr);
- Set_We_Value (We, Eval_Expr_If_Static (Expr));
- if Waveform_Type = Null_Iir then
- Waveform_Type := Get_Type (Expr);
- end if;
+ Expr := Eval_Expr_If_Static (Expr);
end if;
+ Set_We_Value (We, Expr);
+
+ Merge_Wildcard_Type (Expr, Waveform_Type);
end if;
end if;
+ -- Analyze time expression.
if Get_Time (We) /= Null_Iir then
- Expr := Sem_Expression (Get_Time (We), Time_Type_Definition);
- if Expr /= Null_Iir then
- Set_Time (We, Expr);
- Check_Read (Expr);
+ Expr := Get_Time (We);
+ if Is_Expr_Not_Analyzed (Expr) then
+ Expr := Sem_Expression (Expr, Time_Type_Definition);
+ if Expr /= Null_Iir then
+ Set_Time (We, Expr);
+ Check_Read (Expr);
- if Get_Expr_Staticness (Expr) = Locally
- or else (Get_Kind (Expr) = Iir_Kind_Physical_Int_Literal
- and then Flags.Flag_Time_64)
- then
- -- LRM 8.4
- -- It is an error if the time expression in a waveform
- -- element evaluates to a negative value.
- --
- -- LRM 8.4.1
- -- It is an error if the sequence of new transactions is not
- -- in ascending order with repect to time.
- -- GHDL: this must be checked at run-time, but this is also
- -- checked now for static expressions.
- if Get_Expr_Staticness (Expr) = Locally then
- -- The expression is static, and therefore may be
- -- evaluated.
- Expr := Eval_Expr (Expr);
- Set_Time (We, Expr);
- Time := Get_Value (Expr);
- else
- -- The expression is a physical literal (common case).
- -- Extract its value.
- Time := Get_Physical_Value (Expr);
- end if;
- if Time < 0 then
- Error_Msg_Sem
- ("waveform time expression must be >= 0", Expr);
- elsif Time <= Last_Time then
- Error_Msg_Sem
- ("time must be greather than previous transaction",
- Expr);
- else
- Last_Time := Time;
+ if Get_Expr_Staticness (Expr) = Locally
+ or else (Get_Kind (Expr) = Iir_Kind_Physical_Int_Literal
+ and then Flags.Flag_Time_64)
+ then
+ -- LRM 8.4
+ -- It is an error if the time expression in a waveform
+ -- element evaluates to a negative value.
+ --
+ -- LRM 8.4.1
+ -- It is an error if the sequence of new transactions is
+ -- not in ascending order with repect to time.
+ -- GHDL: this must be checked at run-time, but this is
+ -- also checked now for static expressions.
+ if Get_Expr_Staticness (Expr) = Locally then
+ -- The expression is static, and therefore may be
+ -- evaluated.
+ Expr := Eval_Expr (Expr);
+ Set_Time (We, Expr);
+ Time := Get_Value (Expr);
+ else
+ -- The expression is a physical literal (common case).
+ -- Extract its value.
+ Time := Get_Physical_Value (Expr);
+ end if;
+ if Time < 0 then
+ Error_Msg_Sem
+ ("waveform time expression must be >= 0", Expr);
+ elsif Time <= Last_Time then
+ Error_Msg_Sem
+ ("time must be greather than previous transaction",
+ Expr);
+ else
+ Last_Time := Time;
+ end if;
end if;
end if;
end if;
@@ -555,9 +544,9 @@ package body Sem_Stmts is
end if;
-- LRM93 12.6.4
- -- It is an error if the execution of any postponed process causes
- -- a delta cycle to occur immediatly after the current simulation
- -- cycle.
+ -- It is an error if the execution of any postponed process
+ -- causes a delta cycle to occur immediatly after the current
+ -- simulation cycle.
-- GHDL: try to warn for such an error; note the context may be
-- a procedure body.
if Current_Concurrent_Statement /= Null_Iir then
@@ -569,7 +558,7 @@ package body Sem_Stmts is
if Get_Postponed_Flag (Current_Concurrent_Statement) then
Warning_Msg_Sem
("waveform may cause a delta cycle in a " &
- "postponed process", We);
+ "postponed process", We);
end if;
when others =>
-- Context is a subprogram.
@@ -579,9 +568,9 @@ package body Sem_Stmts is
Last_Time := 0;
end if;
+
We := Get_Chain (We);
end loop;
- return;
end Sem_Waveform_Chain;
-- Semantize a waveform chain WAVEFORM_CHAIN that is assigned via statement
@@ -623,46 +612,183 @@ package body Sem_Stmts is
end loop;
end Sem_Check_Waveform_Chain;
- procedure Sem_Signal_Assignment (Stmt: Iir)
+ procedure Sem_Guard (Stmt: Iir)
is
- Target : Iir;
- Waveform_Type : Iir;
+ Guard: Iir;
+ Guard_Interpretation : Name_Interpretation_Type;
begin
- Target := Get_Target (Stmt);
- if Get_Kind (Target) /= Iir_Kind_Aggregate then
- if not Sem_Signal_Assignment_Target_And_Option (Stmt, Null_Iir) then
- return;
- end if;
+ Guard := Get_Guard (Stmt);
+ if Guard = Null_Iir then
+ -- This assignment is not guarded.
- -- check the expression.
- Waveform_Type := Get_Type (Get_Target (Stmt));
- if Waveform_Type /= Null_Iir then
- Sem_Waveform_Chain
- (Stmt, Get_Waveform_Chain (Stmt), Waveform_Type);
- Sem_Check_Waveform_Chain (Stmt, Get_Waveform_Chain (Stmt));
+ -- LRM93 9.5
+ -- It is an error if a concurrent signal assignment is not a guarded
+ -- assignment, and the target of the concurrent signal assignment
+ -- is a guarded target.
+ if Get_Guarded_Target_State (Stmt) = True then
+ Error_Msg_Sem
+ ("not a guarded assignment for a guarded target", Stmt);
end if;
- else
- Waveform_Type := Null_Iir;
- Sem_Waveform_Chain (Stmt, Get_Waveform_Chain (Stmt), Waveform_Type);
- if Waveform_Type = Null_Iir
- or else
- not Sem_Signal_Assignment_Target_And_Option (Stmt, Waveform_Type)
- then
+ return;
+ end if;
+ if Guard /= Stmt then
+ -- if set, guard must be equal to stmt here.
+ raise Internal_Error;
+ end if;
+ Guard_Interpretation := Get_Interpretation (Std_Names.Name_Guard);
+ if not Valid_Interpretation (Guard_Interpretation) then
+ Error_Msg_Sem ("no guard signals for this guarded assignment", Stmt);
+ return;
+ end if;
+
+ Guard := Get_Declaration (Guard_Interpretation);
+ -- LRM93 9.5:
+ -- The signal GUARD [...] an explicitly declared signal of type
+ -- BOOLEAN that is visible at the point of the concurrent signal
+ -- assignment statement
+ -- FIXME.
+ case Get_Kind (Guard) is
+ when Iir_Kind_Signal_Declaration
+ | Iir_Kind_Interface_Signal_Declaration
+ | Iir_Kind_Guard_Signal_Declaration =>
+ null;
+ when others =>
+ Error_Msg_Sem ("visible GUARD object is not a signal", Stmt);
+ Error_Msg_Sem ("GUARD object is " & Disp_Node (Guard), Stmt);
return;
- end if;
- Sem_Check_Waveform_Chain (Stmt, Get_Waveform_Chain (Stmt));
+ end case;
+
+ if Get_Type (Guard) /= Boolean_Type_Definition then
+ Error_Msg_Sem ("GUARD is not of boolean type", Guard);
end if;
- end Sem_Signal_Assignment;
+ Set_Guard (Stmt, Guard);
+ end Sem_Guard;
- procedure Sem_Variable_Assignment (Stmt: Iir) is
- Target: Iir;
- Expr: Iir;
+ procedure Sem_Signal_Assignment (Stmt: Iir)
+ is
+ Cond_Wf : Iir_Conditional_Waveform;
+ Expr : Iir;
+ Wf_Chain : Iir_Waveform_Element;
Target_Type : Iir;
+ Done : Boolean;
begin
- -- Find the variable.
- Target := Get_Target (Stmt);
- Expr := Get_Expression (Stmt);
+ Target_Type := Wildcard_Any_Type;
+
+ Done := False;
+ for S in Resolve_Stages loop
+ Sem_Signal_Assignment_Target_And_Option (Stmt, Target_Type);
+ if Is_Defined_Type (Target_Type) then
+ Done := True;
+ end if;
+
+ case Get_Kind (Stmt) is
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Simple_Signal_Assignment_Statement =>
+ Wf_Chain := Get_Waveform_Chain (Stmt);
+ Sem_Waveform_Chain (Wf_Chain, Target_Type);
+ if Done then
+ Sem_Check_Waveform_Chain (Stmt, Wf_Chain);
+ end if;
+
+ when Iir_Kind_Concurrent_Conditional_Signal_Assignment
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ Cond_Wf := Get_Conditional_Waveform_Chain (Stmt);
+ while Cond_Wf /= Null_Iir loop
+ Wf_Chain := Get_Waveform_Chain (Cond_Wf);
+ Sem_Waveform_Chain (Wf_Chain, Target_Type);
+ if Done then
+ Sem_Check_Waveform_Chain (Stmt, Wf_Chain);
+ end if;
+ if S = Resolve_Stage_1 then
+ -- Must be analyzed only once.
+ Expr := Get_Condition (Cond_Wf);
+ if Expr /= Null_Iir then
+ Expr := Sem_Condition (Expr);
+ if Expr /= Null_Iir then
+ Set_Condition (Cond_Wf, Expr);
+ end if;
+ end if;
+ end if;
+ Cond_Wf := Get_Chain (Cond_Wf);
+ end loop;
+
+ when Iir_Kind_Concurrent_Selected_Signal_Assignment =>
+ declare
+ El : Iir;
+ begin
+ El := Get_Selected_Waveform_Chain (Stmt);
+ while El /= Null_Iir loop
+ Wf_Chain := Get_Associated_Chain (El);
+ Sem_Waveform_Chain (Wf_Chain, Target_Type);
+ if Done then
+ Sem_Check_Waveform_Chain (Stmt, Wf_Chain);
+ end if;
+ El := Get_Chain (El);
+ end loop;
+ end;
+
+ when others =>
+ raise Internal_Error;
+ end case;
+
+ exit when Done;
+ if not Is_Defined_Type (Target_Type) then
+ Error_Msg_Sem ("cannot resolve type of waveform", Stmt);
+ exit;
+ end if;
+ end loop;
+
+ case Get_Kind (Stmt) is
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
+ Sem_Guard (Stmt);
+ when others =>
+ null;
+ end case;
+ end Sem_Signal_Assignment;
+
+ procedure Sem_Conditional_Expression (Cond_Expr : Iir; Atype : in out Iir)
+ is
+ El : Iir;
+ Expr : Iir;
+ Cond : Iir;
+ begin
+ El := Cond_Expr;
+ while El /= Null_Iir loop
+ Expr := Get_Expression (El);
+ Expr := Sem_Expression_Wildcard (Expr, Atype);
+
+ if Expr /= Null_Iir then
+ Set_Expression (El, Expr);
+
+ if Is_Expr_Fully_Analyzed (Expr) then
+ Check_Read (Expr);
+ Expr := Eval_Expr_If_Static (Expr);
+ end if;
+
+ Merge_Wildcard_Type (Expr, Atype);
+ end if;
+
+ Cond := Get_Condition (El);
+ exit when Cond = Null_Iir;
+ if Is_Expr_Not_Analyzed (Cond) then
+ Cond := Sem_Condition (Cond);
+ Set_Condition (El, Cond);
+ end if;
+
+ El := Get_Chain (El);
+ end loop;
+ end Sem_Conditional_Expression;
+
+ procedure Sem_Variable_Assignment (Stmt: Iir)
+ is
+ Target : Iir;
+ Expr : Iir;
+ Target_Type : Iir;
+ Stmt_Type : Iir;
+ Done : Boolean;
+ begin
-- LRM93 8.5 Variable assignment statement
-- If the target of the variable assignment statement is in the form of
-- an aggregate, then the type of the aggregate must be determinable
@@ -673,51 +799,57 @@ package body Sem_Stmts is
--
-- GHDL: this means that the type can only be deduced from the
-- expression (and not from the target).
- if Get_Kind (Target) = Iir_Kind_Aggregate then
- if Get_Kind (Expr) = Iir_Kind_Aggregate then
- Error_Msg_Sem ("can't determine type, use type qualifier", Expr);
- return;
- end if;
- Expr := Sem_Composite_Expression (Get_Expression (Stmt));
- if Expr = Null_Iir then
- return;
- end if;
- Check_Read (Expr);
- Set_Expression (Stmt, Expr);
- Target_Type := Get_Type (Expr);
- -- An aggregate cannot be analyzed without a type.
- -- FIXME: partially analyze the aggregate ?
- if Target_Type = Null_Iir then
- return;
- end if;
+ Target := Get_Target (Stmt);
+ Stmt_Type := Wildcard_Any_Type;
+ for S in Resolve_Stages loop
+ Done := False;
- -- FIXME: check elements are identified at most once.
- else
- Target_Type := Null_Iir;
- end if;
+ Target := Sem_Expression_Wildcard (Target, Stmt_Type);
+ if Target = Null_Iir then
+ Target_Type := Stmt_Type;
+ else
+ Set_Target (Stmt, Target);
+ if Is_Expr_Fully_Analyzed (Target) then
+ Check_Target (Stmt, Target);
+ Done := True;
+ end if;
+ Target_Type := Get_Type (Target);
+ Stmt_Type := Target_Type;
+ end if;
- Target := Sem_Expression (Target, Target_Type);
- if Target = Null_Iir then
- return;
- end if;
- Set_Target (Stmt, Target);
+ case Iir_Kinds_Variable_Assignment_Statement (Get_Kind (Stmt)) is
+ when Iir_Kind_Variable_Assignment_Statement =>
+ Expr := Get_Expression (Stmt);
+ Expr := Sem_Expression_Wildcard (Expr, Stmt_Type);
+ if Expr /= Null_Iir then
+ if Is_Expr_Fully_Analyzed (Expr) then
+ Check_Read (Expr);
+ Expr := Eval_Expr_If_Static (Expr);
+ end if;
+ Set_Expression (Stmt, Expr);
+ Merge_Wildcard_Type (Expr, Stmt_Type);
+ if Done
+ and then not Check_Implicit_Conversion (Target_Type, Expr)
+ then
+ Warning_Msg_Sem
+ ("expression length does not match target length",
+ Stmt);
+ Set_Expression (Stmt, Build_Overflow (Expr, Target_Type));
+ end if;
+ end if;
- Check_Target (Stmt, Target);
+ when Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ Expr := Get_Conditional_Expression (Stmt);
+ Sem_Conditional_Expression (Expr, Stmt_Type);
+ end case;
- if Get_Kind (Target) /= Iir_Kind_Aggregate then
- Expr := Sem_Expression (Expr, Get_Type (Target));
- if Expr /= Null_Iir then
- Check_Read (Expr);
- Expr := Eval_Expr_If_Static (Expr);
- Set_Expression (Stmt, Expr);
+ exit when Done;
+ if not Is_Defined_Type (Stmt_Type) then
+ Error_Msg_Sem ("cannot resolve type", Stmt);
+ exit;
end if;
- end if;
- if not Check_Implicit_Conversion (Get_Type (Target), Expr) then
- Warning_Msg_Sem
- ("expression length does not match target length", Stmt);
- Set_Expression (Stmt, Build_Overflow (Expr, Get_Type (Target)));
- end if;
+ end loop;
end Sem_Variable_Assignment;
procedure Sem_Return_Statement (Stmt: Iir_Return_Statement) is
@@ -1217,7 +1349,8 @@ package body Sem_Stmts is
Sem_Sequential_Statements_Internal
(Get_Sequential_Statement_Chain (Stmt));
end;
- when Iir_Kind_Signal_Assignment_Statement =>
+ when Iir_Kind_Simple_Signal_Assignment_Statement
+ | Iir_Kind_Conditional_Signal_Assignment_Statement =>
Sem_Signal_Assignment (Stmt);
if Current_Concurrent_Statement /= Null_Iir and then
Get_Kind (Current_Concurrent_Statement)
@@ -1227,7 +1360,8 @@ package body Sem_Stmts is
Error_Msg_Sem
("signal statement forbidden in passive process", Stmt);
end if;
- when Iir_Kind_Variable_Assignment_Statement =>
+ when Iir_Kind_Variable_Assignment_Statement
+ | Iir_Kind_Conditional_Variable_Assignment_Statement =>
Sem_Variable_Assignment (Stmt);
when Iir_Kind_Return_Statement =>
Sem_Return_Statement (Stmt);
@@ -1648,164 +1782,23 @@ package body Sem_Stmts is
Sem_Process_Statement (Proc);
end Sem_Sensitized_Process_Statement;
- procedure Sem_Guard (Stmt: Iir)
- is
- Guard: Iir;
- Guard_Interpretation : Name_Interpretation_Type;
- begin
- Guard := Get_Guard (Stmt);
- if Guard = Null_Iir then
- -- This assignment is not guarded.
-
- -- LRM93 9.5
- -- It is an error if a concurrent signal assignment is not a guarded
- -- assignment, and the target of the concurrent signal assignment
- -- is a guarded target.
- if Get_Guarded_Target_State (Stmt) = True then
- Error_Msg_Sem
- ("not a guarded assignment for a guarded target", Stmt);
- end if;
- return;
- end if;
- if Guard /= Stmt then
- -- if set, guard must be equal to stmt here.
- raise Internal_Error;
- end if;
- Guard_Interpretation := Get_Interpretation (Std_Names.Name_Guard);
- if not Valid_Interpretation (Guard_Interpretation) then
- Error_Msg_Sem ("no guard signals for this guarded assignment", Stmt);
- return;
- end if;
-
- Guard := Get_Declaration (Guard_Interpretation);
- -- LRM93 9.5:
- -- The signal GUARD [...] an explicitly declared signal of type
- -- BOOLEAN that is visible at the point of the concurrent signal
- -- assignment statement
- -- FIXME.
- case Get_Kind (Guard) is
- when Iir_Kind_Signal_Declaration
- | Iir_Kind_Interface_Signal_Declaration
- | Iir_Kind_Guard_Signal_Declaration =>
- null;
- when others =>
- Error_Msg_Sem ("visible GUARD object is not a signal", Stmt);
- Error_Msg_Sem ("GUARD object is " & Disp_Node (Guard), Stmt);
- return;
- end case;
-
- if Get_Type (Guard) /= Boolean_Type_Definition then
- Error_Msg_Sem ("GUARD is not of boolean type", Guard);
- end if;
- Set_Guard (Stmt, Guard);
- end Sem_Guard;
-
- procedure Sem_Concurrent_Conditional_Signal_Assignment
- (Stmt: Iir_Concurrent_Conditional_Signal_Assignment)
- is
- Cond_Wf : Iir_Conditional_Waveform;
- Expr : Iir;
- Wf_Chain : Iir_Waveform_Element;
- Target_Type : Iir;
- Target : Iir;
- begin
- Target := Get_Target (Stmt);
- if Get_Kind (Target) /= Iir_Kind_Aggregate then
- if not Sem_Signal_Assignment_Target_And_Option (Stmt, Null_Iir) then
- return;
- end if;
- Target := Get_Target (Stmt);
- Target_Type := Get_Type (Target);
- else
- Target_Type := Null_Iir;
- end if;
-
- Cond_Wf := Get_Conditional_Waveform_Chain (Stmt);
- while Cond_Wf /= Null_Iir loop
- Wf_Chain := Get_Waveform_Chain (Cond_Wf);
- Sem_Waveform_Chain (Stmt, Wf_Chain, Target_Type);
- Sem_Check_Waveform_Chain (Stmt, Wf_Chain);
- Expr := Get_Condition (Cond_Wf);
- if Expr /= Null_Iir then
- Expr := Sem_Condition (Expr);
- if Expr /= Null_Iir then
- Set_Condition (Cond_Wf, Expr);
- end if;
- end if;
- Cond_Wf := Get_Chain (Cond_Wf);
- end loop;
- Sem_Guard (Stmt);
- if Get_Kind (Target) = Iir_Kind_Aggregate then
- if not Sem_Signal_Assignment_Target_And_Option (Stmt, Target_Type)
- then
- return;
- end if;
- end if;
- end Sem_Concurrent_Conditional_Signal_Assignment;
-
procedure Sem_Concurrent_Selected_Signal_Assignment (Stmt: Iir)
is
Expr: Iir;
Chain : Iir;
- El: Iir;
- Waveform_Type : Iir;
- Target : Iir;
- Assoc_El : Iir;
begin
- Target := Get_Target (Stmt);
- Chain := Get_Selected_Waveform_Chain (Stmt);
- Waveform_Type := Null_Iir;
-
- if Get_Kind (Target) = Iir_Kind_Aggregate then
- -- LRM 9.5 Concurrent Signal Assgnment Statements.
- -- The process statement equivalent to a concurrent signal assignment
- -- statement [...] is constructed as follows: [...]
- --
- -- LRM 9.5.2 Selected Signa Assignment
- -- The characteristics of the selected expression, the waveforms and
- -- the choices in the selected assignment statement must be such that
- -- the case statement in the equivalent statement is a legal
- -- statement
-
- -- Find the first waveform that will appear in the equivalent
- -- process statement, and extract type from it.
- Assoc_El := Null_Iir;
- El := Chain;
-
- while El /= Null_Iir loop
- Assoc_El := Get_Associated_Expr (El);
- exit when Assoc_El /= Null_Iir;
- El := Get_Chain (El);
- end loop;
- if Assoc_El = Null_Iir then
- Error_Msg_Sem
- ("cannot determine type of the aggregate target", Target);
- else
- Sem_Waveform_Chain (Stmt, Assoc_El, Waveform_Type);
- end if;
- if Waveform_Type = Null_Iir then
- -- Type of target still unknown.
- -- Since the target is an aggregate, we won't be able to
- -- semantize it.
- -- Avoid a crash.
- return;
- end if;
- end if;
- if not Sem_Signal_Assignment_Target_And_Option (Stmt, Waveform_Type) then
- return;
- end if;
- Waveform_Type := Get_Type (Get_Target (Stmt));
+ -- LRM 9.5 Concurrent Signal Assgnment Statements.
+ -- The process statement equivalent to a concurrent signal assignment
+ -- statement [...] is constructed as follows: [...]
+ --
+ -- LRM 9.5.2 Selected Signal Assignment
+ -- The characteristics of the selected expression, the waveforms and
+ -- the choices in the selected assignment statement must be such that
+ -- the case statement in the equivalent statement is a legal
+ -- statement
- -- Sem on associated.
- if Waveform_Type /= Null_Iir then
- El := Chain;
- while El /= Null_Iir loop
- Sem_Waveform_Chain
- (Stmt, Get_Associated_Chain (El), Waveform_Type);
- Sem_Check_Waveform_Chain (Stmt, Get_Associated_Chain (El));
- El := Get_Chain (El);
- end loop;
- end if;
+ -- Target and waveforms.
+ Sem_Signal_Assignment (Stmt);
-- The choices.
Expr := Sem_Case_Expression (Get_Expression (Stmt));
@@ -1814,6 +1807,7 @@ package body Sem_Stmts is
end if;
Check_Read (Expr);
Set_Expression (Stmt, Expr);
+ Chain := Get_Selected_Waveform_Chain (Stmt);
Sem_Case_Choices (Expr, Chain, Get_Location (Stmt));
Set_Selected_Waveform_Chain (Stmt, Chain);
@@ -1875,11 +1869,12 @@ package body Sem_Stmts is
Next_El := Get_Chain (El);
case Get_Kind (El) is
- when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
+ when Iir_Kind_Concurrent_Simple_Signal_Assignment
+ | Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
if Is_Passive then
Error_Msg_Sem ("signal assignment forbidden in entity", El);
end if;
- Sem_Concurrent_Conditional_Signal_Assignment (El);
+ Sem_Signal_Assignment (El);
when Iir_Kind_Concurrent_Selected_Signal_Assignment =>
if Is_Passive then
Error_Msg_Sem ("signal assignment forbidden in entity", El);
diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb
index cc45da9..a52c2be 100644
--- a/src/vhdl/std_package.adb
+++ b/src/vhdl/std_package.adb
@@ -65,6 +65,12 @@ package body Std_Package is
procedure Create_First_Nodes
is
+ procedure Create_Known_Iir (Kind : Iir_Kind; Val : Iir) is
+ begin
+ if Create_Std_Iir (Kind) /= Val then
+ raise Internal_Error;
+ end if;
+ end Create_Known_Iir;
begin
Std_Filename := Name_Table.Get_Identifier ("*std_standard*");
Std_Location := Files_Map.Source_File_To_Location
@@ -75,29 +81,24 @@ package body Std_Package is
end if;
Set_Location (Error_Mark, Std_Location);
- if Create_Std_Iir (Iir_Kind_Integer_Type_Definition)
- /= Universal_Integer_Type_Definition
- then
- raise Internal_Error;
- end if;
-
- if Create_Std_Iir (Iir_Kind_Floating_Type_Definition)
- /= Universal_Real_Type_Definition
- then
- raise Internal_Error;
- end if;
+ Create_Known_Iir (Iir_Kind_Integer_Type_Definition,
+ Universal_Integer_Type_Definition);
+ Create_Known_Iir (Iir_Kind_Floating_Type_Definition,
+ Universal_Real_Type_Definition);
- if Create_Std_Iir (Iir_Kind_Integer_Type_Definition)
- /= Convertible_Integer_Type_Definition
- then
- raise Internal_Error;
- end if;
+ Create_Known_Iir (Iir_Kind_Integer_Type_Definition,
+ Convertible_Integer_Type_Definition);
+ Create_Known_Iir (Iir_Kind_Floating_Type_Definition,
+ Convertible_Real_Type_Definition);
- if Create_Std_Iir (Iir_Kind_Floating_Type_Definition)
- /= Convertible_Real_Type_Definition
- then
- raise Internal_Error;
- end if;
+ Create_Known_Iir (Iir_Kind_Wildcard_Type_Definition,
+ Wildcard_Any_Type);
+ Create_Known_Iir (Iir_Kind_Wildcard_Type_Definition,
+ Wildcard_Any_Aggregate_Type);
+ Create_Known_Iir (Iir_Kind_Wildcard_Type_Definition,
+ Wildcard_Any_String_Type);
+ Create_Known_Iir (Iir_Kind_Wildcard_Type_Definition,
+ Wildcard_Any_Access_Type);
end Create_First_Nodes;
procedure Create_Std_Standard_Package (Parent : Iir_Library_Declaration)
@@ -192,10 +193,7 @@ package body Std_Package is
end loop;
end Add_Implicit_Operations;
- procedure Create_Std_Type (Decl : out Iir;
- Def : Iir;
- Name : Name_Id)
- is
+ procedure Create_Std_Type (Decl : out Iir; Def : Iir; Name : Name_Id) is
begin
Decl := Create_Std_Decl (Iir_Kind_Type_Declaration);
Set_Std_Identifier (Decl, Name);
@@ -343,6 +341,18 @@ package body Std_Package is
Add_Decl (Decl);
end Create_Edge_Function;
+ procedure Create_Wildcard_Type (Def : Iir; Name : String)
+ is
+ Decl : Iir;
+ begin
+ Decl := Create_Std_Decl (Iir_Kind_Type_Declaration);
+ Set_Identifier (Decl, Name_Table.Get_Identifier (Name));
+ Set_Base_Type (Def, Def);
+ Set_Type_Staticness (Def, None);
+ Set_Type_Definition (Decl, Def);
+ Set_Type_Declarator (Def, Decl);
+ end Create_Wildcard_Type;
+
begin
-- Create design file.
Std_Standard_File := Create_Std_Iir (Iir_Kind_Design_File);
@@ -1194,5 +1204,15 @@ package body Std_Package is
Time_Subtype_Definition);
end if;
+ -- Wilcard types.
+ -- Create the declaration and give them meaningful (and invalid) names
+ -- so that error messages are clear for the user.
+ Create_Wildcard_Type (Wildcard_Any_Type, "any type");
+ Create_Wildcard_Type (Wildcard_Any_Aggregate_Type, "any aggregate type");
+ Create_Wildcard_Type (Wildcard_Any_String_Type, "any string type");
+ Create_Wildcard_Type (Wildcard_Any_Access_Type, "any access type");
+
+ Error_Type := Iirs_Utils.Create_Error_Type (Wildcard_Any_Type);
+ Create_Wildcard_Type (Error_Type, "unknown type");
end Create_Std_Standard_Package;
end Std_Package;
diff --git a/src/vhdl/std_package.ads b/src/vhdl/std_package.ads
index 166c3c7..9ee4ca4 100644
--- a/src/vhdl/std_package.ads
+++ b/src/vhdl/std_package.ads
@@ -79,9 +79,8 @@ package Std_Package is
Integer_Subtype_Declaration : Iir_Subtype_Declaration;
Integer_Subtype_Definition : Iir_Integer_Subtype_Definition;
- -- Type used when a subtype indication cannot be semantized.
- -- FIXME: To be improved.
- Error_Type : Iir_Integer_Type_Definition renames Integer_Type_Definition;
+ -- Type used when the type of an expression is incorrect.
+ Error_Type : Iir;
-- Predefined real type.
Real_Type_Declaration : Iir_Anonymous_Type_Declaration;
@@ -161,6 +160,18 @@ package Std_Package is
Convertible_Integer_Subtype_Definition : Iir_Integer_Subtype_Definition;
Convertible_Integer_Subtype_Declaration : Iir_Subtype_Declaration;
+ -- Wilcard types.
+ -- Err, we break privacy for iir numbers, but this allow use of them in
+ -- case statements.
+ Wildcard_Any_Type : constant Iir := 7;
+ Wildcard_Any_Aggregate_Type : constant Iir := 8;
+ Wildcard_Any_String_Type : constant Iir := 9;
+ Wildcard_Any_Access_Type : constant Iir := 10;
+
+ -- Subtype for all wildcard types, so that missing choice can be detected
+ -- at compilation time.
+ subtype Iir_Wildcard_Types is Iir range 7 .. 10;
+
-- Create the first well-known nodes.
procedure Create_First_Nodes;
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 25e9ed8..2dfc6c5 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -432,6 +432,8 @@ package body Trans.Chap7 is
function Translate_String_Literal (Str : Iir; Res_Type : Iir) return O_Enode
is
Str_Type : constant Iir := Get_Type (Str);
+ Is_Static : Boolean;
+ Vtype : Iir;
Var : Var_Type;
Info : Type_Info_Acc;
Res : O_Cnode;
@@ -452,12 +454,24 @@ package body Trans.Chap7 is
when others =>
raise Internal_Error;
end case;
- Res := Translate_Static_Implicit_Conv (Res, Str_Type, Res_Type);
- Info := Get_Info (Res_Type);
+ Is_Static :=
+ Get_Type_Staticness (Get_Index_Type (Res_Type, 0)) = Locally;
+
+ if Is_Static then
+ Res := Translate_Static_Implicit_Conv (Res, Str_Type, Res_Type);
+ Vtype := Res_Type;
+ else
+ Vtype := Str_Type;
+ end if;
+ Info := Get_Info (Vtype);
Var := Create_Global_Const
(Create_Uniq_Identifier, Info.Ortho_Type (Mode_Value),
O_Storage_Private, Res);
R := New_Address (Get_Var (Var), Info.Ortho_Ptr_Type (Mode_Value));
+ if not Is_Static then
+ R := Translate_Implicit_Conv
+ (R, Str_Type, Res_Type, Mode_Value, Str);
+ end if;
return R;
else
return Translate_Implicit_Conv
diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb
index d939ce4..3ca0200 100644
--- a/src/vhdl/translate/trans-chap8.adb
+++ b/src/vhdl/translate/trans-chap8.adb
@@ -4006,7 +4006,7 @@ package body Trans.Chap8 is
Chap9.Destroy_Types (Target);
end Translate_Direct_Signal_Assignment;
- procedure Translate_Signal_Assignment_Statement (Stmt : Iir)
+ procedure Translate_Simple_Signal_Assignment_Statement (Stmt : Iir)
is
Target : constant Iir := Get_Target (Stmt);
Target_Type : constant Iir := Get_Type (Target);
@@ -4166,7 +4166,7 @@ package body Trans.Chap8 is
Close_Temp;
end;
Chap9.Destroy_Types (Target);
- end Translate_Signal_Assignment_Statement;
+ end Translate_Simple_Signal_Assignment_Statement;
procedure Translate_Statement (Stmt : Iir)
is
@@ -4194,10 +4194,28 @@ package body Trans.Chap8 is
| Iir_Kind_Exit_Statement =>
Translate_Exit_Next_Statement (Stmt);
- when Iir_Kind_Signal_Assignment_Statement =>
- Translate_Signal_Assignment_Statement (Stmt);
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
+ Translate_Simple_Signal_Assignment_Statement (Stmt);
when Iir_Kind_Variable_Assignment_Statement =>
Translate_Variable_Assignment_Statement (Stmt);
+ when Iir_Kind_Conditional_Variable_Assignment_Statement =>
+ declare
+ C_Stmt : Iir;
+ begin
+ C_Stmt :=
+ Canon.Canon_Conditional_Variable_Assignment_Statement (Stmt);
+ Trans.Update_Node_Infos;
+ Translate_If_Statement (C_Stmt);
+ end;
+ when Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ declare
+ C_Stmt : Iir;
+ begin
+ C_Stmt :=
+ Canon.Canon_Conditional_Signal_Assignment_Statement (Stmt);
+ Trans.Update_Node_Infos;
+ Translate_If_Statement (C_Stmt);
+ end;
when Iir_Kind_Null_Statement =>
-- A null statement is translated to a NOP, so that the
diff --git a/src/vhdl/translate/trans_analyzes.adb b/src/vhdl/translate/trans_analyzes.adb
index 8147e93..799930a 100644
--- a/src/vhdl/translate/trans_analyzes.adb
+++ b/src/vhdl/translate/trans_analyzes.adb
@@ -48,26 +48,41 @@ package body Trans_Analyzes is
return Walk_Continue;
end Extract_Driver_Target;
+ procedure Extract_Has_After (Wf : Iir) is
+ begin
+ if Wf /= Null_Iir
+ and then Get_Chain (Wf) = Null_Iir
+ and then Get_Time (Wf) = Null_Iir
+ and then Get_Kind (Get_We_Value (Wf)) /= Iir_Kind_Null_Literal
+ then
+ Has_After := False;
+ else
+ Has_After := True;
+ end if;
+ end Extract_Has_After;
+
function Extract_Driver_Stmt (Stmt : Iir) return Walk_Status
is
Status : Walk_Status;
pragma Unreferenced (Status);
- We : Iir;
begin
case Get_Kind (Stmt) is
- when Iir_Kind_Signal_Assignment_Statement =>
- We := Get_Waveform_Chain (Stmt);
- if We /= Null_Iir
- and then Get_Chain (We) = Null_Iir
- and then Get_Time (We) = Null_Iir
- and then Get_Kind (Get_We_Value (We)) /= Iir_Kind_Null_Literal
- then
- Has_After := False;
- else
- Has_After := True;
- end if;
+ when Iir_Kind_Simple_Signal_Assignment_Statement =>
+ Extract_Has_After (Get_Waveform_Chain (Stmt));
Status := Walk_Assignment_Target
(Get_Target (Stmt), Extract_Driver_Target'Access);
+ when Iir_Kind_Conditional_Signal_Assignment_Statement =>
+ declare
+ Cond_Wf : Iir;
+ begin
+ Cond_Wf := Get_Conditional_Waveform_Chain (Stmt);
+ while Cond_Wf /= Null_Iir loop
+ Extract_Has_After (Get_Waveform_Chain (Cond_Wf));
+ Cond_Wf := Get_Chain (Cond_Wf);
+ end loop;
+ Status := Walk_Assignment_Target
+ (Get_Target (Stmt), Extract_Driver_Target'Access);
+ end;
when Iir_Kind_Procedure_Call_Statement =>
declare
Call : constant Iir := Get_Procedure_Call (Stmt);