aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-11 08:16:19 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-11 08:16:19 +0200
commit51e2d7200ee3a3b609b99f5433f79c3b1d18e9e6 (patch)
tree1be9a23bf6c64999d1269c2b1e7b073cf629cae1
parentc5fbc11795004074b9f2f52e94e13d5907f1c95b (diff)
downloadghdl-51e2d7200ee3a3b609b99f5433f79c3b1d18e9e6.tar.gz
ghdl-51e2d7200ee3a3b609b99f5433f79c3b1d18e9e6.tar.bz2
ghdl-51e2d7200ee3a3b609b99f5433f79c3b1d18e9e6.zip
synth: handle conditional generate process.
-rw-r--r--src/synth/synth-stmts.adb46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 760057f7c..94b824d89 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -806,7 +806,6 @@ package body Synth.Stmts is
(Syn_Inst : Synth_Instance_Acc; Sim_Inst : Block_Instance_Acc; Proc : Iir)
is
use Areapools;
- pragma Assert (Sim_Inst.Label = Proc);
Decls_Chain : constant Iir := Get_Declaration_Chain (Proc);
Proc_Inst : Synth_Instance_Acc;
M : Areapools.Mark_Type;
@@ -814,6 +813,8 @@ package body Synth.Stmts is
Proc_Inst := Make_Instance (Sim_Inst);
Mark (M, Proc_Pool);
Instance_Pool := Proc_Pool'Access;
+
+ -- Processes were not elaborated.
Elaborate_Declarative_Part (Sim_Inst, Decls_Chain);
if Is_Valid (Decls_Chain) then
@@ -829,6 +830,31 @@ package body Synth.Stmts is
Instance_Pool := null;
end Synth_Process_Statement;
+ procedure Synth_Generate_Statement_Body
+ (Syn_Inst : Synth_Instance_Acc; Sim_Inst : Block_Instance_Acc; Bod : Iir)
+ is
+ use Areapools;
+ Decls_Chain : constant Iir := Get_Declaration_Chain (Bod);
+ Bod_Inst : Synth_Instance_Acc;
+ M : Areapools.Mark_Type;
+ begin
+ Bod_Inst := Make_Instance (Sim_Inst);
+ Mark (M, Proc_Pool);
+ Instance_Pool := Proc_Pool'Access;
+
+ if Is_Valid (Decls_Chain) then
+ Bod_Inst.Name := New_Sname (Syn_Inst.Name, Get_Identifier (Bod));
+ Synth_Declarations (Bod_Inst, Decls_Chain);
+ end if;
+
+ Synth_Concurrent_Statements
+ (Bod_Inst, Get_Concurrent_Statement_Chain (Bod));
+
+ Free_Instance (Bod_Inst);
+ Release (M, Proc_Pool);
+ Instance_Pool := null;
+ end Synth_Generate_Statement_Body;
+
procedure Synth_Concurrent_Statements
(Syn_Inst : Synth_Instance_Acc; Stmts : Iir)
is
@@ -845,8 +871,26 @@ package body Synth.Stmts is
when Iir_Kind_Concurrent_Conditional_Signal_Assignment =>
Synth_Conditional_Signal_Assignment (Syn_Inst, Stmt);
when Iir_Kind_Sensitized_Process_Statement =>
+ pragma Assert (Sim_Child.Label = Stmt);
Synth_Process_Statement (Syn_Inst, Sim_Child, Stmt);
Sim_Child := Sim_Child.Brother;
+ when Iir_Kind_If_Generate_Statement =>
+ declare
+ Gen : Node;
+ Bod : Node;
+ begin
+ Gen := Stmt;
+ while Gen /= Null_Node loop
+ Bod := Get_Generate_Statement_Body (Gen);
+ if Sim_Child.Label = Bod then
+ Synth_Generate_Statement_Body
+ (Syn_Inst, Sim_Child, Bod);
+ Sim_Child := Sim_Child.Brother;
+ exit;
+ end if;
+ Gen := Get_Generate_Else_Clause (Gen);
+ end loop;
+ end;
when Iir_Kind_Component_Instantiation_Statement =>
-- TODO.
null;