diff options
-rw-r--r-- | src/vhdl/simulate/annotations.adb | 143 | ||||
-rw-r--r-- | src/vhdl/simulate/annotations.ads | 53 | ||||
-rw-r--r-- | src/vhdl/simulate/debugger.adb | 2 | ||||
-rw-r--r-- | src/vhdl/simulate/elaboration.adb | 19 | ||||
-rw-r--r-- | src/vhdl/simulate/elaboration.ads | 4 | ||||
-rw-r--r-- | src/vhdl/simulate/execution.adb | 30 |
6 files changed, 118 insertions, 133 deletions
diff --git a/src/vhdl/simulate/annotations.adb b/src/vhdl/simulate/annotations.adb index d36a469..6548236 100644 --- a/src/vhdl/simulate/annotations.adb +++ b/src/vhdl/simulate/annotations.adb @@ -23,8 +23,9 @@ with Errorout; use Errorout; with Iirs_Utils; use Iirs_Utils; package body Annotations is - -- Current scope level. - Current_Scope_Level: Scope_Level_Type := (Kind => Scope_Kind_None); + -- Current scope. Used when an object is created to indicate which scope + -- it belongs to. + Current_Scope: Scope_Type := (Kind => Scope_Kind_None); procedure Annotate_Declaration_List (Block_Info: Sim_Info_Acc; Decl_Chain: Iir); @@ -45,21 +46,21 @@ package body Annotations is procedure Annotate_Anonymous_Type_Definition (Block_Info: Sim_Info_Acc; Def: Iir); - procedure Increment_Current_Scope_Level is + procedure Increment_Current_Scope is begin - case Current_Scope_Level.Kind is + case Current_Scope.Kind is when Scope_Kind_None | Scope_Kind_Package | Scope_Kind_Pkg_Inst => -- For a subprogram in a package - Current_Scope_Level := (Scope_Kind_Frame, Scope_Depth_Type'First); + Current_Scope := (Scope_Kind_Frame, Scope_Depth_Type'First); when Scope_Kind_Frame => - Current_Scope_Level := (Scope_Kind_Frame, - Current_Scope_Level.Depth + 1); + Current_Scope := (Scope_Kind_Frame, + Current_Scope.Depth + 1); when Scope_Kind_Component => raise Internal_Error; end case; - end Increment_Current_Scope_Level; + end Increment_Current_Scope; -- Add an annotation to object OBJ. procedure Create_Object_Info @@ -73,25 +74,25 @@ package body Annotations is case Obj_Kind is when Kind_Object => Info := new Sim_Info_Type'(Kind => Kind_Object, - Scope_Level => Current_Scope_Level, + Obj_Scope => Current_Scope, Slot => Block_Info.Nbr_Objects); when Kind_File => Info := new Sim_Info_Type'(Kind => Kind_File, - Scope_Level => Current_Scope_Level, + Obj_Scope => Current_Scope, Slot => Block_Info.Nbr_Objects); when Kind_Signal => Info := new Sim_Info_Type'(Kind => Kind_Signal, - Scope_Level => Current_Scope_Level, + Obj_Scope => Current_Scope, Slot => Block_Info.Nbr_Objects); -- Reserve one more slot for default value. Block_Info.Nbr_Objects := Block_Info.Nbr_Objects + 1; when Kind_Terminal => Info := new Sim_Info_Type'(Kind => Kind_Terminal, - Scope_Level => Current_Scope_Level, + Obj_Scope => Current_Scope, Slot => Block_Info.Nbr_Objects); when Kind_Quantity => Info := new Sim_Info_Type'(Kind => Kind_Quantity, - Scope_Level => Current_Scope_Level, + Obj_Scope => Current_Scope, Slot => Block_Info.Nbr_Objects); when others => raise Internal_Error; @@ -213,7 +214,7 @@ package body Annotations is procedure Annotate_Protected_Type_Declaration (Block_Info : Sim_Info_Acc; Prot: Iir) is - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; Decl : Iir; Prot_Info: Sim_Info_Acc; begin @@ -235,12 +236,12 @@ package body Annotations is -- Then the interfaces object. Increment the scope to reserve a scope -- for the protected object. - Increment_Current_Scope_Level; + Increment_Current_Scope; Prot_Info := new Sim_Info_Type'(Kind => Kind_Frame, Inst_Slot => 0, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Prot, Prot_Info); @@ -259,7 +260,7 @@ package body Annotations is Decl := Get_Chain (Decl); end loop; - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Protected_Type_Declaration; procedure Annotate_Protected_Type_Body (Block_Info : Sim_Info_Acc; @@ -267,17 +268,17 @@ package body Annotations is is pragma Unreferenced (Block_Info); Prot_Info: Sim_Info_Acc; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin Prot_Info := Get_Info (Get_Protected_Type_Declaration (Prot)); Set_Info (Prot, Prot_Info); - Current_Scope_Level := Prot_Info.Frame_Scope_Level; + Current_Scope := Prot_Info.Frame_Scope; Annotate_Declaration_List (Prot_Info, Get_Declaration_Chain (Prot)); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Protected_Type_Body; procedure Annotate_Type_Definition (Block_Info: Sim_Info_Acc; Def: Iir) @@ -494,21 +495,21 @@ package body Annotations is pragma Unreferenced (Block_Info); Subprg_Info: Sim_Info_Acc; Interfaces : constant Iir := Get_Interface_Declaration_Chain (Subprg); - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Increment_Current_Scope_Level; + Increment_Current_Scope; Subprg_Info := new Sim_Info_Type'(Kind => Kind_Frame, Inst_Slot => 0, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Subprg, Subprg_Info); Annotate_Create_Interface_List (Subprg_Info, Interfaces, False); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Subprogram_Specification; procedure Annotate_Subprogram_Body @@ -517,7 +518,7 @@ package body Annotations is pragma Unreferenced (Block_Info); Spec : constant Iir := Get_Subprogram_Specification (Subprg); Subprg_Info : constant Sim_Info_Acc := Get_Info (Spec); - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin -- Do not annotate body of foreign subprograms. if Get_Foreign_Flag (Spec) then @@ -526,7 +527,7 @@ package body Annotations is Set_Info (Subprg, Subprg_Info); - Current_Scope_Level := Subprg_Info.Frame_Scope_Level; + Current_Scope := Subprg_Info.Frame_Scope; Annotate_Declaration_List (Subprg_Info, Get_Declaration_Chain (Subprg)); @@ -534,20 +535,20 @@ package body Annotations is Annotate_Sequential_Statement_Chain (Subprg_Info, Get_Sequential_Statement_Chain (Subprg)); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Subprogram_Body; procedure Annotate_Component_Declaration (Comp: Iir_Component_Declaration) is Info: Sim_Info_Acc; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Current_Scope_Level := (Kind => Scope_Kind_Component); + Current_Scope := (Kind => Scope_Kind_Component); Info := new Sim_Info_Type'(Kind => Kind_Frame, Inst_Slot => Invalid_Instance_Slot, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 1); -- For the instance. Set_Info (Comp, Info); @@ -555,7 +556,7 @@ package body Annotations is Annotate_Create_Interface_List (Info, Get_Generic_Chain (Comp), True); Annotate_Create_Interface_List (Info, Get_Port_Chain (Comp), True); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Component_Declaration; procedure Annotate_Declaration (Block_Info: Sim_Info_Acc; Decl: Iir) is @@ -781,13 +782,13 @@ package body Annotations is Info : Sim_Info_Acc; Header : Iir_Block_Header; Guard : Iir; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Increment_Current_Scope_Level; + Increment_Current_Scope; Info := new Sim_Info_Type'(Kind => Kind_Block, Inst_Slot => Block_Info.Nbr_Instances, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Block, Info); @@ -809,20 +810,20 @@ package body Annotations is Annotate_Concurrent_Statements_List (Info, Get_Concurrent_Statement_Chain (Block)); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Block_Statement; procedure Annotate_Generate_Statement_Body (Block_Info : Sim_Info_Acc; Bod : Iir; It : Iir) is Info : Sim_Info_Acc; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Increment_Current_Scope_Level; + Increment_Current_Scope; Info := new Sim_Info_Type'(Kind => Kind_Block, Inst_Slot => Block_Info.Nbr_Instances, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Bod, Info); @@ -836,7 +837,7 @@ package body Annotations is Annotate_Concurrent_Statements_List (Info, Get_Concurrent_Statement_Chain (Bod)); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Generate_Statement_Body; procedure Annotate_If_Generate_Statement @@ -865,33 +866,33 @@ package body Annotations is (Block_Info : Sim_Info_Acc; Stmt : Iir) is Info: Sim_Info_Acc; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Increment_Current_Scope_Level; + Increment_Current_Scope; -- Add a slot just to put the instance. Info := new Sim_Info_Type'(Kind => Kind_Block, Inst_Slot => Block_Info.Nbr_Instances, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 1); Set_Info (Stmt, Info); Block_Info.Nbr_Instances := Block_Info.Nbr_Instances + 1; - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Component_Instantiation_Statement; procedure Annotate_Process_Statement (Block_Info : Sim_Info_Acc; Stmt : Iir) is pragma Unreferenced (Block_Info); Info: Sim_Info_Acc; - Prev_Scope_Level : constant Scope_Level_Type := Current_Scope_Level; + Prev_Scope : constant Scope_Type := Current_Scope; begin - Increment_Current_Scope_Level; + Increment_Current_Scope; Info := new Sim_Info_Type'(Kind => Kind_Process, Inst_Slot => Invalid_Instance_Slot, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Stmt, Info); @@ -901,7 +902,7 @@ package body Annotations is Annotate_Sequential_Statement_Chain (Info, Get_Sequential_Statement_Chain (Stmt)); - Current_Scope_Level := Prev_Scope_Level; + Current_Scope := Prev_Scope; end Annotate_Process_Statement; procedure Annotate_Concurrent_Statements_List @@ -941,13 +942,13 @@ package body Annotations is is Entity_Info: Sim_Info_Acc; begin - pragma Assert (Current_Scope_Level.Kind = Scope_Kind_None); - Increment_Current_Scope_Level; + pragma Assert (Current_Scope.Kind = Scope_Kind_None); + Increment_Current_Scope; Entity_Info := new Sim_Info_Type'(Kind => Kind_Block, Inst_Slot => Invalid_Instance_Slot, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Set_Info (Decl, Entity_Info); @@ -967,7 +968,7 @@ package body Annotations is Annotate_Concurrent_Statements_List (Entity_Info, Get_Concurrent_Statement_Chain (Decl)); - Current_Scope_Level := (Kind => Scope_Kind_None); + Current_Scope := (Kind => Scope_Kind_None); end Annotate_Entity; procedure Annotate_Architecture (Decl: Iir_Architecture_Body) @@ -975,13 +976,13 @@ package body Annotations is Entity_Info : constant Sim_Info_Acc := Get_Info (Get_Entity (Decl)); Arch_Info: Sim_Info_Acc; begin - pragma Assert (Current_Scope_Level.Kind = Scope_Kind_None); - Current_Scope_Level := Entity_Info.Frame_Scope_Level; + pragma Assert (Current_Scope.Kind = Scope_Kind_None); + Current_Scope := Entity_Info.Frame_Scope; Arch_Info := new Sim_Info_Type' (Kind => Kind_Block, Inst_Slot => 0, -- Slot for a component - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => Entity_Info.Nbr_Objects, Nbr_Instances => Entity_Info.Nbr_Instances); -- Should be 0. Set_Info (Decl, Arch_Info); @@ -995,22 +996,22 @@ package body Annotations is Annotate_Concurrent_Statements_List (Arch_Info, Get_Concurrent_Statement_Chain (Decl)); - Current_Scope_Level := (Kind => Scope_Kind_None); + Current_Scope := (Kind => Scope_Kind_None); end Annotate_Architecture; procedure Annotate_Package (Decl: Iir_Package_Declaration) is Package_Info: Sim_Info_Acc; begin - pragma Assert (Current_Scope_Level.Kind = Scope_Kind_None); + pragma Assert (Current_Scope.Kind = Scope_Kind_None); Nbr_Packages := Nbr_Packages + 1; - Current_Scope_Level := (Scope_Kind_Package, Nbr_Packages); + Current_Scope := (Scope_Kind_Package, Nbr_Packages); Package_Info := new Sim_Info_Type' (Kind => Kind_Block, Inst_Slot => Instance_Slot_Type (Nbr_Packages), - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); @@ -1019,25 +1020,25 @@ package body Annotations is -- declarations Annotate_Declaration_List (Package_Info, Get_Declaration_Chain (Decl)); - Current_Scope_Level := (Kind => Scope_Kind_None); + Current_Scope := (Kind => Scope_Kind_None); end Annotate_Package; procedure Annotate_Package_Body (Decl: Iir) is Package_Info: Sim_Info_Acc; begin - pragma Assert (Current_Scope_Level.Kind = Scope_Kind_None); + pragma Assert (Current_Scope.Kind = Scope_Kind_None); -- Set info field of package body declaration. Package_Info := Get_Info (Get_Package (Decl)); Set_Info (Decl, Package_Info); - Current_Scope_Level := Package_Info.Frame_Scope_Level; + Current_Scope := Package_Info.Frame_Scope; -- declarations Annotate_Declaration_List (Package_Info, Get_Declaration_Chain (Decl)); - Current_Scope_Level := (Kind => Scope_Kind_None); + Current_Scope := (Kind => Scope_Kind_None); end Annotate_Package_Body; procedure Annotate_Component_Configuration @@ -1076,20 +1077,20 @@ package body Annotations is is Config_Info: Sim_Info_Acc; begin - pragma Assert (Current_Scope_Level.Kind = Scope_Kind_None); - Increment_Current_Scope_Level; + pragma Assert (Current_Scope.Kind = Scope_Kind_None); + Increment_Current_Scope; Config_Info := new Sim_Info_Type' (Kind => Kind_Block, Inst_Slot => Invalid_Instance_Slot, - Frame_Scope_Level => Current_Scope_Level, + Frame_Scope => Current_Scope, Nbr_Objects => 0, Nbr_Instances => 0); Annotate_Declaration_List (Config_Info, Get_Declaration_Chain (Decl)); Annotate_Block_Configuration (Get_Block_Configuration (Decl)); - Current_Scope_Level := (Kind => Scope_Kind_None); + Current_Scope := (Kind => Scope_Kind_None); end Annotate_Configuration_Declaration; package Info_Node is new GNAT.Table @@ -1150,7 +1151,7 @@ package body Annotations is end case; end Annotate; - function Image (Scope : Scope_Level_Type) return String is + function Image (Scope : Scope_Type) return String is begin case Scope.Kind is when Scope_Kind_None => @@ -1180,7 +1181,7 @@ package body Annotations is ("-- nbr objects:" & Object_Slot_Type'Image (Info.Nbr_Objects)); when Kind_Frame | Kind_Process => - Put_Line ("-- scope:" & Image (Info.Frame_Scope_Level)); + Put_Line ("-- scope:" & Image (Info.Frame_Scope)); Set_Col (Indent); Put_Line ("-- nbr objects:" & Object_Slot_Type'Image (Info.Nbr_Objects)); @@ -1188,7 +1189,7 @@ package body Annotations is when Kind_Object | Kind_Signal | Kind_File | Kind_Terminal | Kind_Quantity => Put_Line ("-- slot:" & Object_Slot_Type'Image (Info.Slot) - & ", scope:" & Image (Info.Scope_Level)); + & ", scope:" & Image (Info.Obj_Scope)); when Kind_Scalar_Type | Kind_File_Type => null; @@ -1212,7 +1213,7 @@ package body Annotations is end if; case Info.Kind is when Kind_Block | Kind_Frame | Kind_Process => - Put_Line ("scope:" & Image (Info.Frame_Scope_Level)); + Put_Line ("scope:" & Image (Info.Frame_Scope)); Set_Col (Indent); Put_Line ("inst_slot:" & Instance_Slot_Type'Image (Info.Inst_Slot)); @@ -1225,7 +1226,7 @@ package body Annotations is when Kind_Object | Kind_Signal | Kind_File | Kind_Terminal | Kind_Quantity => Put_Line ("slot:" & Object_Slot_Type'Image (Info.Slot) - & ", scope:" & Image (Info.Scope_Level)); + & ", scope:" & Image (Info.Obj_Scope)); when Kind_Range => Put_Line ("range slot:" & Object_Slot_Type'Image (Info.Slot)); when Kind_Scalar_Type => diff --git a/src/vhdl/simulate/annotations.ads b/src/vhdl/simulate/annotations.ads index 482edd3..cb0d94a 100644 --- a/src/vhdl/simulate/annotations.ads +++ b/src/vhdl/simulate/annotations.ads @@ -40,19 +40,7 @@ package Annotations is -- locate iir_value_literal for signals, variables or constants. -- Scope corresponding to an object. - -- Scope_level_global is for objects that can be instancied only one - -- time, ie shared signals or constants declared in a package. - -- - -- Scope_Level_Process is for objects declared in an entity, architecture, - -- process, bloc (but not generated bloc). These are static objects, that - -- can be instancied several times. - -- - -- Scope_Level_First_Function and above are for dynamic objects declared - -- in a subprogram. The level is also the nest level. - -- - -- Scope_Level_Component is set to a maximum, since there is at - -- most one scope after it (the next one is an entity). - type Scope_Level_Kind is + type Scope_Kind_Type is ( -- For a package, the depth is Scope_Kind_Package, @@ -62,21 +50,20 @@ package Annotations is Scope_Kind_None ); type Scope_Depth_Type is range 0 .. 2**15; - type Scope_Level_Type (Kind : Scope_Level_Kind := Scope_Kind_None) is - record - case Kind is - when Scope_Kind_Package => - Pkg_Index : Pkg_Index_Type; - when Scope_Kind_Component => - null; - when Scope_Kind_Frame => - Depth : Scope_Depth_Type; - when Scope_Kind_Pkg_Inst => - Pkg_Inst : Parameter_Slot_Type; - when Scope_Kind_None => - null; - end case; - end record; + type Scope_Type (Kind : Scope_Kind_Type := Scope_Kind_None) is record + case Kind is + when Scope_Kind_Package => + Pkg_Index : Pkg_Index_Type; + when Scope_Kind_Component => + null; + when Scope_Kind_Frame => + Depth : Scope_Depth_Type; + when Scope_Kind_Pkg_Inst => + Pkg_Inst : Parameter_Slot_Type; + when Scope_Kind_None => + null; + end case; + end record; type Instance_Slot_Type is new Integer; Invalid_Instance_Slot : constant Instance_Slot_Type := -1; @@ -102,7 +89,7 @@ package Annotations is Inst_Slot : Instance_Slot_Type; -- scope level for this frame. - Frame_Scope_Level: Scope_Level_Type; + Frame_Scope : Scope_Type; -- Number of objects/signals. Nbr_Objects : Object_Slot_Type; @@ -116,10 +103,10 @@ package Annotations is | Kind_File | Kind_Terminal | Kind_Quantity => - -- block considered (hierarchy). - Scope_Level: Scope_Level_Type; + -- Block in which this object is declared in. + Obj_Scope : Scope_Type; - -- Variable index. + -- Variable index in the block. Slot: Object_Slot_Type; when Kind_Scalar_Type => @@ -141,5 +128,5 @@ package Annotations is procedure Annotate_Expand_Table; -- For debugging. - function Image (Scope : Scope_Level_Type) return String; + function Image (Scope : Scope_Type) return String; end Annotations; diff --git a/src/vhdl/simulate/debugger.adb b/src/vhdl/simulate/debugger.adb index 5966fc3..87cef49 100644 --- a/src/vhdl/simulate/debugger.adb +++ b/src/vhdl/simulate/debugger.adb @@ -274,7 +274,7 @@ package body Debugger is -- Used to debug. procedure Disp_Block_Instance (Instance: Block_Instance_Acc) is begin - Put_Line ("scope:" & Image (Instance.Scope_Level)); + Put_Line ("scope:" & Image (Instance.Block_Scope)); Put_Line ("Objects:"); for I in Instance.Objects'Range loop Put (Object_Slot_Type'Image (I) & ": "); diff --git a/src/vhdl/simulate/elaboration.adb b/src/vhdl/simulate/elaboration.adb index 25bc7ff..0deb329 100644 --- a/src/vhdl/simulate/elaboration.adb +++ b/src/vhdl/simulate/elaboration.adb @@ -251,7 +251,7 @@ package body Elaboration is begin Instance := new Block_Instance_Type' (Max_Objs => Package_Info.Nbr_Objects, - Scope_Level => Package_Info.Frame_Scope_Level, + Block_Scope => Package_Info.Frame_Scope, Up_Block => null, Label => Decl, Stmt => Null_Iir, @@ -265,7 +265,7 @@ package body Elaboration is Actuals_Ref => null, Result => null); - Package_Instances (Package_Info.Frame_Scope_Level.Pkg_Index) := Instance; + Package_Instances (Package_Info.Frame_Scope.Pkg_Index) := Instance; if Trace_Elaboration then Ada.Text_IO.Put_Line ("elaborating " & Disp_Node (Decl)); @@ -280,7 +280,7 @@ package body Elaboration is Package_Info : constant Sim_Info_Acc := Get_Info (Decl); Instance : Block_Instance_Acc; begin - Instance := Package_Instances (Package_Info.Frame_Scope_Level.Pkg_Index); + Instance := Package_Instances (Package_Info.Frame_Scope.Pkg_Index); if Trace_Elaboration then Ada.Text_IO.Put_Line ("elaborating " & Disp_Node (Decl)); @@ -322,8 +322,7 @@ package body Elaboration is Info : constant Sim_Info_Acc := Get_Info (Library_Unit); Body_Design: Iir_Design_Unit; begin - if Package_Instances (Info.Frame_Scope_Level.Pkg_Index) - = null + if Package_Instances (Info.Frame_Scope.Pkg_Index) = null then -- Package not yet elaborated. @@ -380,7 +379,7 @@ package body Elaboration is begin Res := new Block_Instance_Type' (Max_Objs => Obj_Info.Nbr_Objects, - Scope_Level => Obj_Info.Frame_Scope_Level, + Block_Scope => Obj_Info.Frame_Scope, Up_Block => Father, Label => Stmt, Stmt => Obj, @@ -527,7 +526,7 @@ package body Elaboration is Slot : constant Object_Slot_Type := Info.Slot; begin if Slot /= Instance.Elab_Objects - or else Info.Scope_Level /= Instance.Scope_Level + or else Info.Obj_Scope /= Instance.Block_Scope then Error_Msg_Elab ("bad destroy order"); raise Internal_Error; @@ -650,7 +649,7 @@ package body Elaboration is Range_Info : constant Sim_Info_Acc := Get_Info (Rc); Val : Iir_Value_Literal_Acc; begin - if Range_Info.Scope_Level /= Instance.Scope_Level + if Range_Info.Obj_Scope /= Instance.Block_Scope or else Instance.Objects (Range_Info.Slot) /= null then -- A range expression may have already been created, for example @@ -659,7 +658,7 @@ package body Elaboration is return; end if; if False - and then (Range_Info.Scope_Level /= Instance.Scope_Level + and then (Range_Info.Obj_Scope /= Instance.Block_Scope or else Range_Info.Slot < Instance.Elab_Objects) then -- FIXME: the test is wrong for packages. @@ -2381,7 +2380,7 @@ package body Elaboration is return; end if; Cons_Info := Get_Info (Constraint); - if Cons_Info.Scope_Level = Instance.Scope_Level + if Cons_Info.Obj_Scope = Instance.Block_Scope and then Cons_Info.Slot = Instance.Elab_Objects then Destroy_Object (Instance, Constraint); diff --git a/src/vhdl/simulate/elaboration.ads b/src/vhdl/simulate/elaboration.ads index 8d6afc8..e203826 100644 --- a/src/vhdl/simulate/elaboration.ads +++ b/src/vhdl/simulate/elaboration.ads @@ -47,8 +47,8 @@ package Elaboration is -- Useful informations for a dynamic block (ie, a frame). -- The scope level and an access to the block of upper scope level. - Scope_Level: Scope_Level_Type; - Up_Block: Block_Instance_Acc; + Block_Scope : Scope_Type; + Up_Block : Block_Instance_Acc; -- Block, architecture, package, process, component instantiation for -- this instance. diff --git a/src/vhdl/simulate/execution.adb b/src/vhdl/simulate/execution.adb index 85a2d55..41a80ef 100644 --- a/src/vhdl/simulate/execution.adb +++ b/src/vhdl/simulate/execution.adb @@ -60,16 +60,16 @@ package body Execution is Severity : Natural; Stmt: Iir); - function Get_Instance_By_Scope_Level - (Instance: Block_Instance_Acc; Scope_Level: Scope_Level_Type) + function Get_Instance_By_Scope + (Instance: Block_Instance_Acc; Scope: Scope_Type) return Block_Instance_Acc is Current: Block_Instance_Acc := Instance; begin - case Scope_Level.Kind is + case Scope.Kind is when Scope_Kind_Frame => while Current /= null loop - if Current.Scope_Level = Scope_Level then + if Current.Block_Scope = Scope then return Current; end if; Current := Current.Up_Block; @@ -77,7 +77,7 @@ package body Execution is raise Internal_Error; when Scope_Kind_Package => -- Global scope (packages) - return Package_Instances (Scope_Level.Pkg_Index); + return Package_Instances (Scope.Pkg_Index); when Scope_Kind_Component => pragma Assert (Current_Component /= null); return Current_Component; @@ -86,13 +86,12 @@ package body Execution is when Scope_Kind_Pkg_Inst => raise Internal_Error; end case; - end Get_Instance_By_Scope_Level; + end Get_Instance_By_Scope; function Get_Instance_For_Slot (Instance: Block_Instance_Acc; Decl: Iir) return Block_Instance_Acc is begin - return Get_Instance_By_Scope_Level (Instance, - Get_Info (Decl).Scope_Level); + return Get_Instance_By_Scope (Instance, Get_Info (Decl).Obj_Scope); end Get_Instance_For_Slot; procedure Create_Right_Bound_From_Length @@ -2366,7 +2365,7 @@ package body Execution is Res : Iir_Value_Literal_Acc; Is_Sig : Boolean; begin - Bblk := Get_Instance_By_Scope_Level (Block, Info.Scope_Level); + Bblk := Get_Instance_By_Scope (Block, Info.Obj_Scope); Base_Val := Bblk.Objects (Info.Slot + 1); Execute_Name_With_Base (Block, Expr, Base_Val, Res, Is_Sig); pragma Assert (Is_Sig); @@ -2430,8 +2429,7 @@ package body Execution is declare Info : constant Sim_Info_Acc := Get_Info (Expr); begin - Slot_Block := - Get_Instance_By_Scope_Level (Block, Info.Scope_Level); + Slot_Block := Get_Instance_By_Scope (Block, Info.Obj_Scope); Res := Slot_Block.Objects (Info.Slot); end; end if; @@ -2735,8 +2733,8 @@ package body Execution is return String_To_Iir_Value (Name.Suffix); end if; - Instance := Get_Instance_By_Scope_Level - (Block, Get_Info (Name.Path_Instance).Frame_Scope_Level); + Instance := Get_Instance_By_Scope + (Block, Get_Info (Name.Path_Instance).Frame_Scope); loop case Get_Kind (Instance.Label) is @@ -3225,14 +3223,14 @@ package body Execution is begin pragma Assert (Get_Kind (Imp) in Iir_Kinds_Subprogram_Declaration or else Get_Kind (Imp) = Iir_Kind_Protected_Type_Body); - Up_Block := Get_Instance_By_Scope_Level - (Instance, Get_Info (Get_Parent (Imp)).Frame_Scope_Level); + Up_Block := Get_Instance_By_Scope + (Instance, Get_Info (Get_Parent (Imp)).Frame_Scope); Res := To_Block_Instance_Acc (Alloc_Block_Instance (Instance_Pool, Block_Instance_Type'(Max_Objs => Func_Info.Nbr_Objects, - Scope_Level => Func_Info.Frame_Scope_Level, + Block_Scope => Func_Info.Frame_Scope, Up_Block => Up_Block, Label => Imp, Stmt => Null_Iir, |