From 1b3915222c3755692ae1693ef1bb8f9d3dc52172 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 14 Jan 2022 06:24:33 +0100 Subject: synth: handle macro-expanded package body. Fix #1948 --- src/synth/elab-vhdl_insts.adb | 3 ++- src/synth/synth-vhdl_decls.adb | 3 ++- src/vhdl/vhdl-annotations.adb | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb index 5192046b1..cb7a6bd9e 100644 --- a/src/synth/elab-vhdl_insts.adb +++ b/src/synth/elab-vhdl_insts.adb @@ -183,7 +183,8 @@ package body Elab.Vhdl_Insts is if Bod /= Null_Node then -- Macro expanded package instantiation. - raise Internal_Error; + Elab_Declarations + (Sub_Inst, Get_Declaration_Chain (Bod)); else -- Shared body declare diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb index 5eefbdaef..c7ab62d8e 100644 --- a/src/synth/synth-vhdl_decls.adb +++ b/src/synth/synth-vhdl_decls.adb @@ -341,7 +341,8 @@ package body Synth.Vhdl_Decls is if Bod /= Null_Node then -- Macro expanded package instantiation. - raise Internal_Error; + Synth_Concurrent_Declarations + (Sub_Inst, Get_Declaration_Chain (Bod)); else -- Shared body declare diff --git a/src/vhdl/vhdl-annotations.adb b/src/vhdl/vhdl-annotations.adb index ec6efd46a..43477c1d2 100644 --- a/src/vhdl/vhdl-annotations.adb +++ b/src/vhdl/vhdl-annotations.adb @@ -665,15 +665,23 @@ package body Vhdl.Annotations is end if; end Annotate_Package_Declaration; - procedure Annotate_Package_Body (Decl: Iir) + procedure Annotate_Package_Body (Bod: Iir) is - Package_Info : constant Sim_Info_Acc := Get_Info (Get_Package (Decl)); + Pkg : constant Node := Get_Package (Bod); + Package_Info : constant Sim_Info_Acc := Get_Info (Pkg); begin + if Is_Uninstantiated_Package (Pkg) + and then Get_Macro_Expanded_Flag (Pkg) + then + -- The body of a macro-expanded flag. + return; + end if; + -- Set info field of package body declaration. - Set_Info (Decl, Package_Info); + Set_Info (Bod, Package_Info); -- declarations - Annotate_Declaration_List (Package_Info, Get_Declaration_Chain (Decl)); + Annotate_Declaration_List (Package_Info, Get_Declaration_Chain (Bod)); end Annotate_Package_Body; procedure Annotate_Declaration_Type (Block_Info: Sim_Info_Acc; Decl: Iir) -- cgit v1.2.3