From dd9836c89f15039137442ad0d882a403b96d89ff Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 7 Dec 2017 05:58:08 +0100 Subject: simul: fix annotation of macro-expanded package instantiation. --- src/vhdl/simulate/simul-annotations.adb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/vhdl/simulate') diff --git a/src/vhdl/simulate/simul-annotations.adb b/src/vhdl/simulate/simul-annotations.adb index 920501744..6a21d3382 100644 --- a/src/vhdl/simulate/simul-annotations.adb +++ b/src/vhdl/simulate/simul-annotations.adb @@ -573,12 +573,23 @@ package body Simul.Annotations is if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then declare - Uninst : constant Iir := Get_Uninstantiated_Package_Decl (Decl); - Uninst_Info : constant Sim_Info_Acc := Get_Info (Uninst); + Bod : constant Iir := Get_Package_Body (Decl); begin - -- There is not corresponding body for an instantiation, so - -- also add objects for the shared body. - Package_Info.Nbr_Objects := Uninst_Info.Nbr_Objects; + if Bod /= Null_Iir then + Set_Info (Bod, Package_Info); + Annotate_Declaration_List + (Package_Info, Get_Declaration_Chain (Bod)); + else + declare + Uninst : constant Iir := + Get_Uninstantiated_Package_Decl (Decl); + Uninst_Info : constant Sim_Info_Acc := Get_Info (Uninst); + begin + -- There is not corresponding body for an instantiation, so + -- also add objects for the shared body. + Package_Info.Nbr_Objects := Uninst_Info.Nbr_Objects; + end; + end if; end; end if; end Annotate_Package_Declaration; -- cgit v1.2.3