aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-11-24 05:44:28 +0100
committerTristan Gingold <tgingold@free.fr>2017-11-24 05:44:28 +0100
commit947d5b8876198dda1cf8e0c65a554e5dbd5e80f2 (patch)
tree67d8064b5a42ad3f1837984410022eb6018f1fb3 /src
parent345bcdbf2fbe012a8b4da772329d18757fef5594 (diff)
downloadghdl-947d5b8876198dda1cf8e0c65a554e5dbd5e80f2.tar.gz
ghdl-947d5b8876198dda1cf8e0c65a554e5dbd5e80f2.tar.bz2
ghdl-947d5b8876198dda1cf8e0c65a554e5dbd5e80f2.zip
simulation: refactoring (move block_instance to iir_values).
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-context.adb1
-rw-r--r--src/synth/synth-context.ads2
-rw-r--r--src/synth/synth-values.ads2
-rw-r--r--src/synth/synthesis.adb1
-rw-r--r--src/vhdl/simulate/annotations.adb7
-rw-r--r--src/vhdl/simulate/annotations.ads35
-rw-r--r--src/vhdl/simulate/debugger-ams.ads1
-rw-r--r--src/vhdl/simulate/debugger.adb2
-rw-r--r--src/vhdl/simulate/debugger.ads2
-rw-r--r--src/vhdl/simulate/elaboration.ads72
-rw-r--r--src/vhdl/simulate/execution.ads3
-rw-r--r--src/vhdl/simulate/file_operation.ads1
-rw-r--r--src/vhdl/simulate/iir_values.ads105
-rw-r--r--src/vhdl/simulate/simulation-main.adb1
-rw-r--r--src/vhdl/simulate/simulation.ads1
15 files changed, 115 insertions, 121 deletions
diff --git a/src/synth/synth-context.adb b/src/synth/synth-context.adb
index 92edc3e34..f5dc8ad1d 100644
--- a/src/synth/synth-context.adb
+++ b/src/synth/synth-context.adb
@@ -26,7 +26,6 @@ with Errorout; use Errorout;
with Annotations; use Annotations;
with Execution;
-with Iir_Values; use Iir_Values;
with Netlists.Builders; use Netlists.Builders;
diff --git a/src/synth/synth-context.ads b/src/synth/synth-context.ads
index ac8b881d9..52283f00d 100644
--- a/src/synth/synth-context.ads
+++ b/src/synth/synth-context.ads
@@ -20,7 +20,7 @@
with Synth.Environment; use Synth.Environment;
with Synth.Values; use Synth.Values;
-with Elaboration; use Elaboration;
+with Iir_Values; use Iir_Values;
with Netlists; use Netlists;
with Netlists.Builders;
with Iirs; use Iirs;
diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads
index 5929d6345..16ead16a1 100644
--- a/src/synth/synth-values.ads
+++ b/src/synth/synth-values.ads
@@ -21,8 +21,6 @@
with Types; use Types;
with Netlists; use Netlists;
with Synth.Environment; use Synth.Environment;
-with Annotations; use Annotations;
-with Elaboration; use Elaboration;
with Iir_Values; use Iir_Values;
with Iirs; use Iirs;
diff --git a/src/synth/synthesis.adb b/src/synth/synthesis.adb
index 6c767ce2d..3a4ca3c4d 100644
--- a/src/synth/synthesis.adb
+++ b/src/synth/synthesis.adb
@@ -25,6 +25,7 @@ with Netlists.Builders; use Netlists.Builders;
with Netlists.Utils;
with Iirs_Utils; use Iirs_Utils;
+with Iir_Values; use Iir_Values;
with Elaboration; use Elaboration;
with Synth.Environment; use Synth.Environment;
diff --git a/src/vhdl/simulate/annotations.adb b/src/vhdl/simulate/annotations.adb
index acc6e8920..c898aa01d 100644
--- a/src/vhdl/simulate/annotations.adb
+++ b/src/vhdl/simulate/annotations.adb
@@ -57,8 +57,7 @@ package body Annotations is
-- For a subprogram in a package
Current_Scope := (Scope_Kind_Frame, Scope_Depth_Type'First);
when Scope_Kind_Frame =>
- Current_Scope := (Scope_Kind_Frame,
- Current_Scope.Depth + 1);
+ Current_Scope := (Scope_Kind_Frame, Current_Scope.Depth + 1);
when Scope_Kind_Component =>
raise Internal_Error;
end case;
@@ -468,8 +467,8 @@ package body Annotations is
Package_Info := Get_Info (Inter);
Current_Scope := (Kind => Scope_Kind_Pkg_Inst,
- Pkg_Param => 0,
- Pkg_Parent => Package_Info);
+ Pkg_Param => 0);
+-- Pkg_Parent => Package_Info);
Annotate_Interface_List
(Package_Info, Get_Generic_Chain (Inter), True);
diff --git a/src/vhdl/simulate/annotations.ads b/src/vhdl/simulate/annotations.ads
index e45084079..c8519fa46 100644
--- a/src/vhdl/simulate/annotations.ads
+++ b/src/vhdl/simulate/annotations.ads
@@ -28,16 +28,12 @@ package Annotations is
procedure Disp_Vhdl_Info (Node : Iir);
procedure Disp_Tree_Info (Node : Iir);
- type Object_Slot_Type is new Natural;
- subtype Parameter_Slot_Type is Object_Slot_Type range 0 .. 2**15;
-
- type Pkg_Index_Type is new Natural;
- Nbr_Packages : Pkg_Index_Type := 0;
-
-- For Kind_Extra: a number. Kind_Extra is not used by annotations, and
-- is free for another pass like preelab.
type Extra_Slot_Type is new Natural;
+ Nbr_Packages : Pkg_Index_Type := 0;
+
-- Annotations are used to collect informations for elaboration and to
-- locate iir_value_literal for signals, variables or constants.
@@ -55,33 +51,6 @@ package Annotations is
type Sim_Info_Type (Kind : Sim_Info_Kind);
type Sim_Info_Acc is access all Sim_Info_Type;
- -- Scope corresponding to an object.
- type Scope_Kind_Type is
- (
- -- For a package, the depth is
- Scope_Kind_Package,
- Scope_Kind_Component,
- Scope_Kind_Frame,
- Scope_Kind_Pkg_Inst,
- Scope_Kind_None
- );
- type Scope_Depth_Type is range 0 .. 2**15;
- 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_Param : Parameter_Slot_Type;
- Pkg_Parent : Sim_Info_Acc;
- when Scope_Kind_None =>
- null;
- end case;
- end record;
-
type Instance_Slot_Type is new Integer;
Invalid_Instance_Slot : constant Instance_Slot_Type := -1;
diff --git a/src/vhdl/simulate/debugger-ams.ads b/src/vhdl/simulate/debugger-ams.ads
index 4b9de8fed..f89fda276 100644
--- a/src/vhdl/simulate/debugger-ams.ads
+++ b/src/vhdl/simulate/debugger-ams.ads
@@ -16,7 +16,6 @@
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
-with Iir_Values; use Iir_Values;
with Elaboration.AMS; use Elaboration.AMS;
package Debugger.AMS is
diff --git a/src/vhdl/simulate/debugger.adb b/src/vhdl/simulate/debugger.adb
index 977e6e3a3..eea71f84c 100644
--- a/src/vhdl/simulate/debugger.adb
+++ b/src/vhdl/simulate/debugger.adb
@@ -20,7 +20,6 @@ with System;
with Ada.Text_IO; use Ada.Text_IO;
with Tables;
with Types; use Types;
-with Iir_Values; use Iir_Values;
with Name_Table;
with Str_Table;
with Files_Map;
@@ -34,6 +33,7 @@ with Std_Names;
with Libraries;
with Std_Package;
with Annotations; use Annotations;
+with Elaboration; use Elaboration;
with Iirs_Utils; use Iirs_Utils;
with Errorout; use Errorout;
with Disp_Vhdl;
diff --git a/src/vhdl/simulate/debugger.ads b/src/vhdl/simulate/debugger.ads
index b8b5c8e9e..ecb170eaa 100644
--- a/src/vhdl/simulate/debugger.ads
+++ b/src/vhdl/simulate/debugger.ads
@@ -16,8 +16,8 @@
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
-with Elaboration; use Elaboration;
with Iirs; use Iirs;
+with Iir_Values; use Iir_Values;
package Debugger is
Flag_Debugger : Boolean := False;
diff --git a/src/vhdl/simulate/elaboration.ads b/src/vhdl/simulate/elaboration.ads
index 8a1fb6979..6bbb91cc1 100644
--- a/src/vhdl/simulate/elaboration.ads
+++ b/src/vhdl/simulate/elaboration.ads
@@ -16,14 +16,12 @@
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
-with Ada.Unchecked_Deallocation;
with Tables;
with Types; use Types;
with Iirs; use Iirs;
with Iir_Values; use Iir_Values;
with Grt.Types; use Grt.Types;
with Annotations; use Annotations;
-with Areapools;
-- This package elaborates design hierarchy.
@@ -31,82 +29,12 @@ package Elaboration is
Trace_Elaboration : Boolean := False;
Trace_Drivers : Boolean := False;
- -- A block instance with its architecture/entity declaration is an
- -- instancied entity.
- type Block_Instance_Type;
- type Block_Instance_Acc is access Block_Instance_Type;
-
- type Objects_Array is array (Object_Slot_Type range <>) of
- Iir_Value_Literal_Acc;
-
- type Block_Instance_Id is new Natural;
- No_Block_Instance_Id : constant Block_Instance_Id := 0;
-
-- Number of block instances and also Id of the last one.
Nbr_Block_Instances : Block_Instance_Id := 0;
-- A block instance with its architecture/entity declaration is an
-- instancied entity.
- type Block_Instance_Type (Max_Objs : Object_Slot_Type) is record
- -- Flag for wait statement: true if not yet executed.
- In_Wait_Flag : Boolean;
-
- -- Uniq number for a block instance.
- Id : Block_Instance_Id;
-
- -- Useful informations for a dynamic block (ie, a frame).
- -- The scope level and an access to the block of upper scope level.
- Block_Scope : Scope_Type;
- Up_Block : Block_Instance_Acc;
-
- -- Block, architecture, package, process, component instantiation for
- -- this instance.
- Label : Iir;
-
- -- For blocks: corresponding block (different from label for direct
- -- component instantiation statement and generate iterator).
- -- For packages: Null_Iir
- -- For subprograms and processes: statement being executed.
- Stmt : Iir;
-
- -- Instanciation tree.
-
- -- Parent is always set (but null for top-level block and packages)
- Parent: Block_Instance_Acc;
-
- -- Chain of children. They are in declaration order after elaboration.
- -- (in reverse order during elaboration).
- -- Not null only for blocks and processes.
- Children: Block_Instance_Acc;
- Brother: Block_Instance_Acc;
-
- -- Port association map for this block, if any.
- Ports_Map : Iir;
-
- -- Pool marker for the child (only for subprograms and processes).
- Marker : Areapools.Mark_Type;
-
- -- Reference to the actuals, for copy-out when returning from a
- -- procedure.
- Actuals_Ref : Value_Array_Acc;
-
- -- Only for function frame; contains the result.
- Result: Iir_Value_Literal_Acc;
-
- -- Last object elaborated (or number of objects elaborated).
- -- Note: this is generally the slot index of the next object to be
- -- elaborated (this may be wrong for dynamic objects due to execution
- -- branches).
- Elab_Objects : Object_Slot_Type := 0;
-
- -- Values of the objects in that frame.
- Objects : Objects_Array (1 .. Max_Objs);
- end record;
-
- procedure Free is new Ada.Unchecked_Deallocation
- (Object => Block_Instance_Type, Name => Block_Instance_Acc);
-
procedure Elaborate_Design (Design: Iir_Design_Unit);
procedure Elaborate_Declarative_Part
diff --git a/src/vhdl/simulate/execution.ads b/src/vhdl/simulate/execution.ads
index 40be27391..d9406be94 100644
--- a/src/vhdl/simulate/execution.ads
+++ b/src/vhdl/simulate/execution.ads
@@ -20,7 +20,6 @@ with Types; use Types;
with Iirs; use Iirs;
with Iir_Values; use Iir_Values;
with Elaboration; use Elaboration;
-with Annotations;
with Areapools; use Areapools;
package Execution is
@@ -127,7 +126,7 @@ package Execution is
return Iir_Value_Literal_Acc;
function Get_Instance_By_Scope
- (Instance: Block_Instance_Acc; Scope: Annotations.Scope_Type)
+ (Instance: Block_Instance_Acc; Scope: Scope_Type)
return Block_Instance_Acc;
function Get_Instance_For_Slot (Instance: Block_Instance_Acc; Decl: Iir)
diff --git a/src/vhdl/simulate/file_operation.ads b/src/vhdl/simulate/file_operation.ads
index ea59f60d6..ef3b8b22b 100644
--- a/src/vhdl/simulate/file_operation.ads
+++ b/src/vhdl/simulate/file_operation.ads
@@ -18,7 +18,6 @@
with Iirs; use Iirs;
with Iir_Values; use Iir_Values;
-with Elaboration; use Elaboration;
with Grt.Files; use Grt.Files;
with Grt.Types; use Grt.Types;
diff --git a/src/vhdl/simulate/iir_values.ads b/src/vhdl/simulate/iir_values.ads
index a134df438..68b6d1326 100644
--- a/src/vhdl/simulate/iir_values.ads
+++ b/src/vhdl/simulate/iir_values.ads
@@ -17,6 +17,7 @@
-- 02111-1307, USA.
with Ada.Text_IO;
+with Ada.Unchecked_Deallocation;
with Types; use Types;
with Iirs; use Iirs;
with Grt.Types; use Grt.Types;
@@ -163,6 +164,11 @@ package Iir_Values is
type Value_Array_Acc is access Value_Array;
+ -- A block instance with its architecture/entity declaration is an
+ -- instancied entity.
+ type Block_Instance_Type;
+ type Block_Instance_Acc is access Block_Instance_Type;
+
type Iir_Value_Literal (Kind: Iir_Value_Kind) is record
case Kind is
when Iir_Value_B1 =>
@@ -204,8 +210,105 @@ package Iir_Values is
end case;
end record;
+ type Object_Slot_Type is new Natural;
+ subtype Parameter_Slot_Type is Object_Slot_Type range 0 .. 2**15;
+
+ type Pkg_Index_Type is new Natural;
+
+ -- Scope corresponding to an object.
+ type Scope_Kind_Type is
+ (
+ -- For a package, the depth is
+ Scope_Kind_Package,
+ Scope_Kind_Component,
+ Scope_Kind_Frame,
+ Scope_Kind_Pkg_Inst,
+ Scope_Kind_None
+ );
+ type Scope_Depth_Type is range 0 .. 2**15;
+ 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_Param : Parameter_Slot_Type;
+ -- Pkg_Parent : Sim_Info_Acc;
+ when Scope_Kind_None =>
+ null;
+ end case;
+ end record;
+
+ type Block_Instance_Id is new Natural;
+ No_Block_Instance_Id : constant Block_Instance_Id := 0;
+
+ type Objects_Array is array (Object_Slot_Type range <>) of
+ Iir_Value_Literal_Acc;
+
+ type Block_Instance_Type (Max_Objs : Object_Slot_Type) is record
+ -- Flag for wait statement: true if not yet executed.
+ In_Wait_Flag : Boolean;
+
+ -- Uniq number for a block instance.
+ Id : Block_Instance_Id;
+
+ -- Useful informations for a dynamic block (ie, a frame).
+ -- The scope level and an access to the block of upper scope level.
+ Block_Scope : Scope_Type;
+ Up_Block : Block_Instance_Acc;
+
+ -- Block, architecture, package, process, component instantiation for
+ -- this instance.
+ Label : Iir;
+
+ -- For blocks: corresponding block (different from label for direct
+ -- component instantiation statement and generate iterator).
+ -- For packages: Null_Iir
+ -- For subprograms and processes: statement being executed.
+ Stmt : Iir;
+
+ -- Instanciation tree.
+
+ -- Parent is always set (but null for top-level block and packages)
+ Parent: Block_Instance_Acc;
+
+ -- Chain of children. They are in declaration order after elaboration.
+ -- (in reverse order during elaboration).
+ -- Not null only for blocks and processes.
+ Children: Block_Instance_Acc;
+ Brother: Block_Instance_Acc;
+
+ -- Port association map for this block, if any.
+ Ports_Map : Iir;
+
+ -- Pool marker for the child (only for subprograms and processes).
+ Marker : Areapools.Mark_Type;
+
+ -- Reference to the actuals, for copy-out when returning from a
+ -- procedure.
+ Actuals_Ref : Value_Array_Acc;
+
+ -- Only for function frame; contains the result.
+ Result: Iir_Value_Literal_Acc;
+
+ -- Last object elaborated (or number of objects elaborated).
+ -- Note: this is generally the slot index of the next object to be
+ -- elaborated (this may be wrong for dynamic objects due to execution
+ -- branches).
+ Elab_Objects : Object_Slot_Type := 0;
+
+ -- Values of the objects in that frame.
+ Objects : Objects_Array (1 .. Max_Objs);
+ end record;
+
+ procedure Free is new Ada.Unchecked_Deallocation
+ (Object => Block_Instance_Type, Name => Block_Instance_Acc);
+
+
-- What is chosen for time.
- -- Currently only int32 is available, but time should use an int64.
subtype Iir_Value_Time is Ghdl_I64;
Global_Pool : aliased Areapool;
diff --git a/src/vhdl/simulate/simulation-main.adb b/src/vhdl/simulate/simulation-main.adb
index 686ec0dc0..7c68d0b68 100644
--- a/src/vhdl/simulate/simulation-main.adb
+++ b/src/vhdl/simulate/simulation-main.adb
@@ -25,6 +25,7 @@ with PSL.Nodes;
with PSL.NFAs;
with Std_Package;
with Trans_Analyzes;
+with Elaboration; use Elaboration;
with Execution; use Execution;
with Ieee.Std_Logic_1164;
with Grt.Main;
diff --git a/src/vhdl/simulate/simulation.ads b/src/vhdl/simulate/simulation.ads
index 55af11a2e..fa3a54982 100644
--- a/src/vhdl/simulate/simulation.ads
+++ b/src/vhdl/simulate/simulation.ads
@@ -20,7 +20,6 @@ with System;
with Grt.Types; use Grt.Types;
with Iirs; use Iirs;
with Iir_Values; use Iir_Values;
-with Elaboration; use Elaboration;
package Simulation is
Trace_Simulation : Boolean := False;