aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-12-21 18:54:54 +0100
committerTristan Gingold <tgingold@free.fr>2017-12-21 18:54:54 +0100
commit0077cb6ed63946940700bbfd60518b0d28bc3ce2 (patch)
treefdad4be06f42dd2ef4c72665aa60a574a4676484 /src
parent9c79e3faf7ba29c9767fed41f0c7840bdedea3e9 (diff)
downloadghdl-0077cb6ed63946940700bbfd60518b0d28bc3ce2.tar.gz
ghdl-0077cb6ed63946940700bbfd60518b0d28bc3ce2.tar.bz2
ghdl-0077cb6ed63946940700bbfd60518b0d28bc3ce2.zip
simul: add Kind_Protected instead of reusing Kind_Frame.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/simulate/simul-annotations.adb8
-rw-r--r--src/vhdl/simulate/simul-environments.ads3
-rw-r--r--src/vhdl/simulate/simul-execution.adb24
3 files changed, 24 insertions, 11 deletions
diff --git a/src/vhdl/simulate/simul-annotations.adb b/src/vhdl/simulate/simul-annotations.adb
index 1b8182d07..7c19e3b35 100644
--- a/src/vhdl/simulate/simul-annotations.adb
+++ b/src/vhdl/simulate/simul-annotations.adb
@@ -83,6 +83,7 @@ package body Simul.Annotations is
when Kind_Block
| Kind_Process
| Kind_Frame
+ | Kind_Protected
| Kind_Package
| Kind_Scalar_Type
| Kind_File_Type
@@ -223,7 +224,10 @@ package body Simul.Annotations is
Decl := Get_Chain (Decl);
end loop;
- Prot_Info := new Sim_Info_Type'(Kind => Kind_Frame,
+ -- Note: if this protected type declaration appears in a generic
+ -- package declaration that is shared, the instances will always get
+ -- Nbr_Objects as 0...
+ Prot_Info := new Sim_Info_Type'(Kind => Kind_Protected,
Nbr_Objects => 0);
Set_Info (Prot, Prot_Info);
@@ -1184,6 +1188,7 @@ package body Simul.Annotations is
("-- nbr objects:" & Object_Slot_Type'Image (Info.Nbr_Objects));
when Kind_Frame
+ | Kind_Protected
| Kind_Process
| Kind_Package =>
Put_Line
@@ -1215,6 +1220,7 @@ package body Simul.Annotations is
case Info.Kind is
when Kind_Block
| Kind_Frame
+ | Kind_Protected
| Kind_Process
| Kind_Package =>
Put_Line ("nbr objects:"
diff --git a/src/vhdl/simulate/simul-environments.ads b/src/vhdl/simulate/simul-environments.ads
index f8104e096..bc2414be0 100644
--- a/src/vhdl/simulate/simul-environments.ads
+++ b/src/vhdl/simulate/simul-environments.ads
@@ -229,7 +229,7 @@ package Simul.Environments is
-- The annotation depends on the kind of the node.
type Sim_Info_Kind is
- (Kind_Block, Kind_Process, Kind_Frame, Kind_Package,
+ (Kind_Block, Kind_Process, Kind_Frame, Kind_Protected, Kind_Package,
Kind_Scalar_Type, Kind_File_Type,
Kind_Object, Kind_Signal,
Kind_File,
@@ -248,6 +248,7 @@ package Simul.Environments is
case Kind is
when Kind_Block
| Kind_Frame
+ | Kind_Protected
| Kind_Process
| Kind_Package =>
-- Number of objects/signals.
diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb
index 2cd3ab2f5..47b79b369 100644
--- a/src/vhdl/simulate/simul-execution.adb
+++ b/src/vhdl/simulate/simul-execution.adb
@@ -74,23 +74,29 @@ package body Simul.Execution is
| Kind_Process =>
declare
Current : Block_Instance_Acc;
- -- Last : Block_Instance_Acc;
begin
Current := Instance;
while Current /= null loop
if Current.Block_Scope = Scope then
return Current;
end if;
- -- Last := Current;
Current := Current.Up_Block;
end loop;
- -- if Scope.Frame_Scope.Depth = 0
- -- and then (Last.Block_Scope.Frame_Scope.Kind
- -- = Scope_Kind_Package)
- -- then
- -- -- For instantiated packages.
- -- return Last;
- -- end if;
+ raise Internal_Error;
+ end;
+ when Kind_Protected =>
+ declare
+ Current : Block_Instance_Acc;
+ begin
+ Current := Instance;
+ while Current /= null loop
+ if Current.Block_Scope = Scope
+ or Current.Uninst_Scope = Scope
+ then
+ return Current;
+ end if;
+ Current := Current.Up_Block;
+ end loop;
raise Internal_Error;
end;
when Kind_Package =>