From 15f7bb4666a446f6cd6bc3fd9cc3dab27747cf15 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 7 Dec 2017 05:34:25 +0100 Subject: simul: handle generic-mapped packages. --- src/vhdl/simulate/simul-elaboration.adb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/vhdl/simulate/simul-elaboration.adb b/src/vhdl/simulate/simul-elaboration.adb index 586549b5c..52024833b 100644 --- a/src/vhdl/simulate/simul-elaboration.adb +++ b/src/vhdl/simulate/simul-elaboration.adb @@ -378,6 +378,7 @@ package body Simul.Elaboration is is Package_Info : constant Sim_Info_Acc := Get_Info (Decl); Instance : Block_Instance_Acc; + Hdr : Iir; begin if Block /= Global_Instances then -- Packages in library unit can be elaborated in a different order. @@ -395,12 +396,18 @@ package body Simul.Elaboration is "elaborating %n", (1 => +Decl)); end if; - if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then - Elaborate_Generic_Clause (Instance, Get_Generic_Chain (Decl)); + case Iir_Kinds_Package_Declaration (Get_Kind (Decl)) is + when Iir_Kind_Package_Instantiation_Declaration => + Hdr := Decl; + when Iir_Kind_Package_Declaration => + Hdr := Get_Package_Header (Decl); + end case; + if Hdr /= Null_Iir then + Elaborate_Generic_Clause (Instance, Get_Generic_Chain (Hdr)); Elaborate_Generic_Map_Aspect (Instance, Instance, - Get_Generic_Chain (Decl), - Get_Generic_Map_Aspect_Chain (Decl)); + Get_Generic_Chain (Hdr), + Get_Generic_Map_Aspect_Chain (Hdr)); end if; -- Elaborate objects declarations. -- cgit v1.2.3