From 418800b56e3296eec94e56707ebad7dcd1d1c6ee Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 18 Jan 2023 21:32:59 +0100 Subject: synth: create sub-instace for processes --- src/simul/simul-vhdl_elab.adb | 1 + src/synth/elab-vhdl_annotations.adb | 6 +----- src/synth/elab-vhdl_context.adb | 10 ++++++++++ src/synth/elab-vhdl_context.ads | 5 +++++ src/synth/elab-vhdl_stmts.adb | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb index eb481479b..8e2db63ad 100644 --- a/src/simul/simul-vhdl_elab.adb +++ b/src/simul/simul-vhdl_elab.adb @@ -1125,6 +1125,7 @@ package body Simul.Vhdl_Elab is if Get_Kind (Proc) in Iir_Kinds_Process_Statement then Proc_Inst := Make_Elab_Instance (Processes_Table.Table (I).Inst, Proc, Proc, Null_Node); + Set_Sub_Instance (Processes_Table.Table (I).Inst, Proc, Proc_Inst); Processes_Table.Table (I).Inst := Proc_Inst; Set_Instance_Const (Proc_Inst, True); Synth.Vhdl_Decls.Synth_Declarations diff --git a/src/synth/elab-vhdl_annotations.adb b/src/synth/elab-vhdl_annotations.adb index 0d7af8c79..3a076cde2 100644 --- a/src/synth/elab-vhdl_annotations.adb +++ b/src/synth/elab-vhdl_annotations.adb @@ -983,13 +983,9 @@ package body Elab.Vhdl_Annotations is procedure Annotate_Process_Statement (Block_Info : Sim_Info_Acc; Stmt : Iir) is - pragma Unreferenced (Block_Info); Info : Sim_Info_Acc; begin - Info := new Sim_Info_Type'(Kind => Kind_Process, - Ref => Stmt, - Nbr_Objects => 0); - Set_Ann (Stmt, Info); + Info := Create_Block_Info (Block_Info, Stmt); Annotate_Declaration_List (Info, Get_Declaration_Chain (Stmt)); diff --git a/src/synth/elab-vhdl_context.adb b/src/synth/elab-vhdl_context.adb index 99f3efb1d..7b905f663 100644 --- a/src/synth/elab-vhdl_context.adb +++ b/src/synth/elab-vhdl_context.adb @@ -484,6 +484,16 @@ package body Elab.Vhdl_Context is return Syn_Inst.Objects (Info.Inst_Slot).I_Inst; end Get_Sub_Instance; + procedure Set_Sub_Instance (Syn_Inst : Synth_Instance_Acc; + Stmt : Node; + Sub_Inst : Synth_Instance_Acc) + is + Info : constant Sim_Info_Acc := Get_Ann (Stmt); + begin + pragma Assert (Syn_Inst.Objects (Info.Inst_Slot).I_Inst = null); + Syn_Inst.Objects (Info.Inst_Slot).I_Inst := Sub_Inst; + end Set_Sub_Instance; + function Get_Component_Instance (Syn_Inst : Synth_Instance_Acc) return Synth_Instance_Acc is diff --git a/src/synth/elab-vhdl_context.ads b/src/synth/elab-vhdl_context.ads index 13fe8bb49..69435d283 100644 --- a/src/synth/elab-vhdl_context.ads +++ b/src/synth/elab-vhdl_context.ads @@ -194,6 +194,11 @@ package Elab.Vhdl_Context is function Get_Component_Instance (Syn_Inst : Synth_Instance_Acc) return Synth_Instance_Acc; + -- For processes, whose instance is not set during elaboration. + procedure Set_Sub_Instance (Syn_Inst : Synth_Instance_Acc; + Stmt : Node; + Sub_Inst : Synth_Instance_Acc); + -- Return the scope of BLK. Deals with architecture bodies. function Get_Info_Scope (Blk : Node) return Sim_Info_Acc; diff --git a/src/synth/elab-vhdl_stmts.adb b/src/synth/elab-vhdl_stmts.adb index 6f0339534..ebb2380b2 100644 --- a/src/synth/elab-vhdl_stmts.adb +++ b/src/synth/elab-vhdl_stmts.adb @@ -268,7 +268,7 @@ package body Elab.Vhdl_Stmts is begin case Get_Kind (Stmt) is when Iir_Kinds_Process_Statement => - null; + Create_Sub_Instance (Syn_Inst, Stmt, null); when Iir_Kind_Concurrent_Simple_Signal_Assignment | Iir_Kind_Concurrent_Selected_Signal_Assignment | Iir_Kind_Concurrent_Conditional_Signal_Assignment -- cgit v1.2.3