diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-03-27 18:58:19 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-03-27 18:58:19 +0200 |
commit | 413db2f74665682693f899045feb4f5bdc108c03 (patch) | |
tree | 57e3e90fbf263dde6f6a61916fc8bb995672c66c /src | |
parent | 6378544fae28ee9298017a758c2844d7af86cdea (diff) | |
download | ghdl-413db2f74665682693f899045feb4f5bdc108c03.tar.gz ghdl-413db2f74665682693f899045feb4f5bdc108c03.tar.bz2 ghdl-413db2f74665682693f899045feb4f5bdc108c03.zip |
synth: adjust for iir_kind_package_instantiation_body
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/elab-vhdl_annotations.adb | 18 | ||||
-rw-r--r-- | src/synth/elab-vhdl_decls.adb | 2 | ||||
-rw-r--r-- | src/synth/elab-vhdl_insts.adb | 16 | ||||
-rw-r--r-- | src/synth/elab-vhdl_insts.ads | 2 |
4 files changed, 30 insertions, 8 deletions
diff --git a/src/synth/elab-vhdl_annotations.adb b/src/synth/elab-vhdl_annotations.adb index 83d19e225..5514df5a5 100644 --- a/src/synth/elab-vhdl_annotations.adb +++ b/src/synth/elab-vhdl_annotations.adb @@ -516,9 +516,11 @@ package body Elab.Vhdl_Annotations is Bod : constant Iir := Get_Instance_Package_Body (Decl); begin if Bod /= Null_Iir then - Set_Ann (Bod, Package_Info); - Annotate_Declaration_List - (Package_Info, Get_Declaration_Chain (Bod)); + if Get_Immediate_Body_Flag (Decl) then + Set_Ann (Bod, Package_Info); + Annotate_Declaration_List + (Package_Info, Get_Declaration_Chain (Bod)); + end if; else declare Uninst : constant Iir := @@ -538,10 +540,13 @@ package body Elab.Vhdl_Annotations is procedure Annotate_Package_Body (Bod: Iir) is + Is_Inst : constant Boolean := + Get_Kind (Bod) = Iir_Kind_Package_Instantiation_Body; Pkg : constant Node := Get_Package (Bod); Package_Info : constant Sim_Info_Acc := Get_Ann (Pkg); begin - if Is_Uninstantiated_Package (Pkg) + if not Is_Inst + and then Is_Uninstantiated_Package (Pkg) and then Get_Macro_Expanded_Flag (Pkg) then -- The body of a macro-expanded flag. @@ -568,10 +573,11 @@ package body Elab.Vhdl_Annotations is begin case Get_Kind (Decl) is when Iir_Kind_Package_Declaration - | Iir_Kind_Package_Instantiation_Declaration => + | Iir_Kind_Package_Instantiation_Declaration => Annotate_Package_Declaration (Block_Info, Decl); - when Iir_Kind_Package_Body => + when Iir_Kind_Package_Body + | Iir_Kind_Package_Instantiation_Body => Annotate_Package_Body (Decl); when Iir_Kind_Attribute_Implicit_Declaration => diff --git a/src/synth/elab-vhdl_decls.adb b/src/synth/elab-vhdl_decls.adb index 6839ed123..cfa5a8f9a 100644 --- a/src/synth/elab-vhdl_decls.adb +++ b/src/synth/elab-vhdl_decls.adb @@ -322,6 +322,8 @@ package body Elab.Vhdl_Decls is when Iir_Kind_Package_Instantiation_Declaration => Vhdl_Insts.Elab_Package_Instantiation (Syn_Inst, Decl); + when Iir_Kind_Package_Instantiation_Body => + Vhdl_Insts.Elab_Package_Instantiation_Body (Syn_Inst, Decl); when Iir_Kind_Package_Declaration => Vhdl_Insts.Elab_Package_Declaration (Syn_Inst, Decl); when Iir_Kind_Package_Body => diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb index a397c6b95..25984a8fa 100644 --- a/src/synth/elab-vhdl_insts.adb +++ b/src/synth/elab-vhdl_insts.adb @@ -270,8 +270,10 @@ package body Elab.Vhdl_Insts is if Bod /= Null_Node then -- Macro expanded package instantiation. - Elab_Declarations - (Sub_Inst, Get_Declaration_Chain (Bod)); + if Get_Immediate_Body_Flag (Pkg) then + Elab_Declarations + (Sub_Inst, Get_Declaration_Chain (Bod)); + end if; else -- Shared body declare @@ -286,6 +288,16 @@ package body Elab.Vhdl_Insts is end if; end Elab_Package_Instantiation; + procedure Elab_Package_Instantiation_Body + (Parent_Inst : Synth_Instance_Acc; Bod : Node) + is + Sub_Inst : Synth_Instance_Acc; + begin + Sub_Inst := Get_Package_Object (Parent_Inst, Bod); + Elab_Declarations + (Sub_Inst, Get_Declaration_Chain (Bod)); + end Elab_Package_Instantiation_Body; + procedure Elab_Dependencies (Parent_Inst : Synth_Instance_Acc; Unit : Node); procedure Elab_Configuration_Declaration (Parent_Inst : Synth_Instance_Acc; diff --git a/src/synth/elab-vhdl_insts.ads b/src/synth/elab-vhdl_insts.ads index 7e64bb944..1e78c3329 100644 --- a/src/synth/elab-vhdl_insts.ads +++ b/src/synth/elab-vhdl_insts.ads @@ -39,6 +39,8 @@ package Elab.Vhdl_Insts is (Parent_Inst : Synth_Instance_Acc; Pkg : Node; Bod : Node); procedure Elab_Package_Instantiation (Parent_Inst : Synth_Instance_Acc; Pkg : Node); + procedure Elab_Package_Instantiation_Body + (Parent_Inst : Synth_Instance_Acc; Bod : Node); procedure Elab_Component_Instantiation_Statement (Syn_Inst : Synth_Instance_Acc; Stmt : Node); |