diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-12-05 04:19:31 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-12-05 04:19:31 +0100 |
commit | 6fa695890d8ccae675f3606d25e2bb58bbfb243e (patch) | |
tree | 6b3814438df8372f66705b3426add91802f7af6a /src/vhdl/simulate/simul-execution.adb | |
parent | a3a8739ce5e5cf51e32366c8fbc6eb47ed562964 (diff) | |
download | ghdl-6fa695890d8ccae675f3606d25e2bb58bbfb243e.tar.gz ghdl-6fa695890d8ccae675f3606d25e2bb58bbfb243e.tar.bz2 ghdl-6fa695890d8ccae675f3606d25e2bb58bbfb243e.zip |
simul: handle instantiated package.
Diffstat (limited to 'src/vhdl/simulate/simul-execution.adb')
-rw-r--r-- | src/vhdl/simulate/simul-execution.adb | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb index e49ea69df..9622b98c7 100644 --- a/src/vhdl/simulate/simul-execution.adb +++ b/src/vhdl/simulate/simul-execution.adb @@ -94,12 +94,29 @@ package body Simul.Execution is raise Internal_Error; end; when Kind_Package => - declare - Parent : Block_Instance_Acc; - begin - Parent := Get_Instance_By_Scope (Instance, Scope.Pkg_Parent); - return Parent.Objects (Scope.Pkg_Slot).Instance; - end; + if Scope.Pkg_Parent = null then + -- This is a scope for an uninstantiated package. + declare + Current : Block_Instance_Acc; + begin + Current := Instance; + while Current /= null loop + if Current.Uninst_Scope = Scope then + return Current; + end if; + Current := Current.Up_Block; + end loop; + raise Internal_Error; + end; + else + -- Instantiated package. + declare + Parent : Block_Instance_Acc; + begin + Parent := Get_Instance_By_Scope (Instance, Scope.Pkg_Parent); + return Parent.Objects (Scope.Pkg_Slot).Instance; + end; + end if; when others => raise Internal_Error; end case; @@ -3309,6 +3326,7 @@ package body Simul.Execution is Block_Instance_Type'(Max_Objs => Func_Info.Nbr_Objects, Id => No_Block_Instance_Id, Block_Scope => Get_Info (Label), + Uninst_Scope => null, Up_Block => Up_Block, Label => Label, Stmt => Null_Iir, |