diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-06-06 20:55:37 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-06-07 07:55:42 +0200 |
commit | a2b6404455e9080200673ee8e723870648bceac4 (patch) | |
tree | f12295437aa9c619e2722c4efaaf44629c2a2381 /src/synth | |
parent | 1536293cf14227b0177be596d82e4ce1085fb746 (diff) | |
download | ghdl-a2b6404455e9080200673ee8e723870648bceac4.tar.gz ghdl-a2b6404455e9080200673ee8e723870648bceac4.tar.bz2 ghdl-a2b6404455e9080200673ee8e723870648bceac4.zip |
synth: add comments and refactoring.
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-context.ads | 21 | ||||
-rw-r--r-- | src/synth/synth-decls.adb | 2 | ||||
-rw-r--r-- | src/synth/synth-decls.ads | 2 | ||||
-rw-r--r-- | src/synth/synth-expr.adb | 1 | ||||
-rw-r--r-- | src/synth/synth-expr.ads | 1 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 2 | ||||
-rw-r--r-- | src/synth/synth-stmts.ads | 2 | ||||
-rw-r--r-- | src/synth/synth-types.ads | 2 | ||||
-rw-r--r-- | src/synth/synth-values.ads | 37 |
9 files changed, 45 insertions, 25 deletions
diff --git a/src/synth/synth-context.ads b/src/synth/synth-context.ads index 57a2e412d..660367f4b 100644 --- a/src/synth/synth-context.ads +++ b/src/synth/synth-context.ads @@ -26,6 +26,26 @@ with Netlists.Builders; with Vhdl.Nodes; use Vhdl.Nodes; package Synth.Context is + -- Values are stored into Synth_Instance, which is parallel to simulation + -- Block_Instance_Type. + type Objects_Array is array (Object_Slot_Type range <>) of Value_Acc; + + type Synth_Instance_Type (Max_Objs : Object_Slot_Type) is record + -- Module which owns gates created for this instance. + M : Module; + + -- Name prefix for declarations. + Name : Sname; + + -- The corresponding instance from simulation. + Sim : Block_Instance_Acc; + + -- Instance for synthesis. + Objects : Objects_Array (1 .. Max_Objs); + end record; + + type Synth_Instance_Acc is access Synth_Instance_Type; + type Instance_Map_Array is array (Block_Instance_Id range <>) of Synth_Instance_Acc; type Instance_Map_Array_Acc is access Instance_Map_Array; @@ -33,6 +53,7 @@ package Synth.Context is -- Map between simulation instance and synthesis instance. Instance_Map : Instance_Map_Array_Acc; + -- Global context. Build_Context : Netlists.Builders.Context_Acc; function Make_Instance (Sim_Inst : Block_Instance_Acc) diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index b19f40161..b3f4a8a4a 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -22,8 +22,8 @@ with Types; use Types; with Netlists; use Netlists; with Netlists.Builders; use Netlists.Builders; with Vhdl.Errors; use Vhdl.Errors; -with Synth.Context; use Synth.Context; with Synth.Types; use Synth.Types; +with Synth.Values; use Synth.Values; with Synth.Environment; use Synth.Environment; with Simul.Environments; use Simul.Environments; with Simul.Annotations; use Simul.Annotations; diff --git a/src/synth/synth-decls.ads b/src/synth/synth-decls.ads index 619737607..d608285b5 100644 --- a/src/synth/synth-decls.ads +++ b/src/synth/synth-decls.ads @@ -19,7 +19,7 @@ -- MA 02110-1301, USA. with Vhdl.Nodes; use Vhdl.Nodes; -with Synth.Values; use Synth.Values; +with Synth.Context; use Synth.Context; package Synth.Decls is procedure Synth_Declaration (Syn_Inst : Synth_Instance_Acc; Decl : Iir); diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index 74ca80a01..c398263f1 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -30,7 +30,6 @@ with Simul.Annotations; use Simul.Annotations; with Grt.Types; use Grt.Types; with Synth.Errors; use Synth.Errors; -with Synth.Context; use Synth.Context; with Synth.Types; use Synth.Types; with Netlists; use Netlists; diff --git a/src/synth/synth-expr.ads b/src/synth/synth-expr.ads index baf1f9000..496436349 100644 --- a/src/synth/synth-expr.ads +++ b/src/synth/synth-expr.ads @@ -21,6 +21,7 @@ with Types; use Types; with Simul.Environments; use Simul.Environments; with Synth.Values; use Synth.Values; +with Synth.Context; use Synth.Context; with Vhdl.Nodes; use Vhdl.Nodes; package Synth.Expr is diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 99021984a..cbb96efe9 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -34,7 +34,7 @@ with Synth.Types; use Synth.Types; with Synth.Errors; use Synth.Errors; with Synth.Decls; use Synth.Decls; with Synth.Expr; use Synth.Expr; -with Synth.Context; use Synth.Context; +with Synth.Values; use Synth.Values; with Synth.Environment; use Synth.Environment; with Simul.Environments; use Simul.Environments; diff --git a/src/synth/synth-stmts.ads b/src/synth/synth-stmts.ads index f96117bd6..97bce696d 100644 --- a/src/synth/synth-stmts.ads +++ b/src/synth/synth-stmts.ads @@ -19,7 +19,7 @@ -- MA 02110-1301, USA. with Vhdl.Nodes; use Vhdl.Nodes; -with Synth.Values; use Synth.Values; +with Synth.Context; use Synth.Context; package Synth.Stmts is -- Generate netlists for concurrent statements STMTS. diff --git a/src/synth/synth-types.ads b/src/synth/synth-types.ads index b07e22e9e..dfc9aeb15 100644 --- a/src/synth/synth-types.ads +++ b/src/synth/synth-types.ads @@ -19,7 +19,7 @@ -- MA 02110-1301, USA. with Netlists; use Netlists; -with Synth.Values; use Synth.Values; +with Synth.Context; use Synth.Context; with Vhdl.Nodes; use Vhdl.Nodes; package Synth.Types is diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads index 100af6dbb..a889c4e81 100644 --- a/src/synth/synth-values.ads +++ b/src/synth/synth-values.ads @@ -29,8 +29,24 @@ package Synth.Values is -- values in simulation, but simplified (no need to handle files, -- accesses...) - type Value_Kind is (Value_Net, Value_Wire, Value_Array, Value_Record, - Value_Lit); + type Value_Kind is + ( + -- Value is for a vector or a bit, and is the output of a gate. + Value_Net, + + -- Also a vector or a bit, but from an object. Has to be transformed + -- into a net. + Value_Wire, + + -- A non-vector array. + Value_Array, + + -- A record. + Value_Record, + + -- A known value (from simulation). + Value_Lit + ); type Value_Type (Kind : Value_Kind); @@ -98,21 +114,4 @@ package Synth.Values is function Bounds_To_Range (Val : Iir_Value_Literal_Acc) return Value_Range_Acc; - -- Values are stored into Synth_Instance, which is parallel to simulation - -- Block_Instance_Type. - type Objects_Array is array (Object_Slot_Type range <>) of Value_Acc; - - type Synth_Instance_Type (Max_Objs : Object_Slot_Type) is record - -- Module which owns gates created for this instance. - M : Module; - - -- Name prefix for declarations. - Name : Sname; - - Sim : Block_Instance_Acc; - Objects : Objects_Array (1 .. Max_Objs); - end record; - - type Synth_Instance_Acc is access Synth_Instance_Type; - end Synth.Values; |