diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-05-06 18:38:36 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-05-06 18:38:36 +0200 |
commit | 9ebdd46defd0c2ce54d0e04c293e9d5a5b111026 (patch) | |
tree | bc2efdc6d7ffa1f8fb1409c4ee37d7a1c15f7c69 /src/synth | |
parent | 4e6760203fc2b88567ac37fd6054c5a684d099ca (diff) | |
download | ghdl-9ebdd46defd0c2ce54d0e04c293e9d5a5b111026.tar.gz ghdl-9ebdd46defd0c2ce54d0e04c293e9d5a5b111026.tar.bz2 ghdl-9ebdd46defd0c2ce54d0e04c293e9d5a5b111026.zip |
synth: revert a previous commit: remove the En parameter.
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-aggr.adb | 28 | ||||
-rw-r--r-- | src/synth/synth-aggr.ads | 3 | ||||
-rw-r--r-- | src/synth/synth-decls.adb | 56 | ||||
-rw-r--r-- | src/synth/synth-decls.ads | 13 | ||||
-rw-r--r-- | src/synth/synth-expr.adb | 103 | ||||
-rw-r--r-- | src/synth/synth-expr.ads | 10 | ||||
-rw-r--r-- | src/synth/synth-files_operations.adb | 7 | ||||
-rw-r--r-- | src/synth/synth-insts.adb | 41 | ||||
-rw-r--r-- | src/synth/synth-oper.adb | 26 | ||||
-rw-r--r-- | src/synth/synth-oper.ads | 12 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 226 | ||||
-rw-r--r-- | src/synth/synth-stmts.ads | 12 |
12 files changed, 226 insertions, 311 deletions
diff --git a/src/synth/synth-aggr.adb b/src/synth/synth-aggr.adb index f7cd5278d..0437bb3fb 100644 --- a/src/synth/synth-aggr.adb +++ b/src/synth/synth-aggr.adb @@ -20,6 +20,7 @@ with Types; use Types; +with Netlists; use Netlists; with Netlists.Utils; use Netlists.Utils; with Netlists.Builders; use Netlists.Builders; @@ -98,7 +99,6 @@ package body Synth.Aggr is procedure Fill_Array_Aggregate (Syn_Inst : Synth_Instance_Acc; Aggr : Node; - En : Net; Res : Valtyp_Array_Acc; Typ : Type_Acc; First_Pos : Nat32; @@ -125,7 +125,7 @@ package body Synth.Aggr is Nbr_Els := Nbr_Els + 1; if Dim = Strides'Last then - Val := Synth_Expression_With_Type (Syn_Inst, Value, El_Typ, En); + Val := Synth_Expression_With_Type (Syn_Inst, Value, El_Typ); Val := Synth_Subtype_Conversion (Ctxt, Val, El_Typ, False, Value); pragma Assert (Res (Pos) = No_Valtyp); Res (Pos) := Val; @@ -138,7 +138,7 @@ package body Synth.Aggr is end if; else Fill_Array_Aggregate - (Syn_Inst, Value, En, Res, Typ, Pos, Strides, Dim + 1, + (Syn_Inst, Value, Res, Typ, Pos, Strides, Dim + 1, Sub_Const, Sub_Err); Const_P := Const_P and Sub_Const; Err_P := Err_P or Sub_Err; @@ -192,7 +192,7 @@ package body Synth.Aggr is Val_Len : Uns32; begin Val := Synth_Expression_With_Basetype - (Syn_Inst, Value, En); + (Syn_Inst, Value); Val_Len := Get_Bound_Length (Val.Typ, 1); pragma Assert (Stride = 1); if Pos - First_Pos > Nat32 (Bound.Len - Val_Len) then @@ -226,7 +226,7 @@ package body Synth.Aggr is Idx : Valtyp; Off : Uns32; begin - Idx := Synth_Expression (Syn_Inst, Ch, No_Net); + Idx := Synth_Expression (Syn_Inst, Ch); if not Is_Static (Idx.Val) then Error_Msg_Synth (+Ch, "choice is not static"); else @@ -267,7 +267,7 @@ package body Synth.Aggr is end if; -- FIXME: can the expression be unbounded ? Val := Synth_Expression_With_Basetype - (Syn_Inst, Value, En); + (Syn_Inst, Value); -- The length must match the range. Rng_Len := Get_Range_Length (Rng); if Get_Bound_Length (Val.Typ, 1) /= Rng_Len then @@ -302,7 +302,6 @@ package body Synth.Aggr is procedure Fill_Record_Aggregate (Syn_Inst : Synth_Instance_Acc; Aggr : Node; Aggr_Typ : Type_Acc; - En : Net; Rec : Valtyp_Array_Acc; Err_P : out Boolean; Const_P : out Boolean) @@ -319,7 +318,7 @@ package body Synth.Aggr is El_Type : Type_Acc; begin El_Type := Aggr_Typ.Rec.E (Iir_Index32 (Pos + 1)).Typ; - Val := Synth_Expression_With_Type (Syn_Inst, Value, El_Type, En); + Val := Synth_Expression_With_Type (Syn_Inst, Value, El_Type); if Const_P and not Is_Static (Val.Val) then Const_P := False; end if; @@ -388,7 +387,6 @@ package body Synth.Aggr is function Synth_Aggregate_Array (Syn_Inst : Synth_Instance_Acc; Aggr : Node; - En : Net; Aggr_Type : Type_Acc) return Valtyp is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); @@ -401,7 +399,7 @@ package body Synth.Aggr is begin Tab_Res := new Valtyp_Array'(1 .. Nat32 (Flen) => No_Valtyp); - Fill_Array_Aggregate (Syn_Inst, Aggr, En, Tab_Res, + Fill_Array_Aggregate (Syn_Inst, Aggr, Tab_Res, Aggr_Type, 1, Strides, 1, Const_P, Err_P); if Err_P then return No_Valtyp; @@ -436,7 +434,6 @@ package body Synth.Aggr is function Synth_Aggregate_Record (Syn_Inst : Synth_Instance_Acc; Aggr : Node; - En : Net; Aggr_Type : Type_Acc) return Valtyp is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); @@ -450,7 +447,7 @@ package body Synth.Aggr is new Valtyp_Array'(1 .. Nat32 (Aggr_Type.Rec.Len) => No_Valtyp); Fill_Record_Aggregate - (Syn_Inst, Aggr, Aggr_Type, En, Tab_Res, Err_P, Const_P); + (Syn_Inst, Aggr, Aggr_Type, Tab_Res, Err_P, Const_P); if Err_P then Res := No_Valtyp; @@ -473,7 +470,6 @@ package body Synth.Aggr is -- Aggr_Type is the type from the context. function Synth_Aggregate (Syn_Inst : Synth_Instance_Acc; Aggr : Node; - En : Net; Aggr_Type : Type_Acc) return Valtyp is begin case Aggr_Type.Kind is @@ -483,14 +479,14 @@ package body Synth.Aggr is begin Res_Type := Decls.Synth_Array_Subtype_Indication (Syn_Inst, Get_Type (Aggr)); - return Synth_Aggregate_Array (Syn_Inst, Aggr, En, Res_Type); + return Synth_Aggregate_Array (Syn_Inst, Aggr, Res_Type); end; when Type_Vector | Type_Array => - return Synth_Aggregate_Array (Syn_Inst, Aggr, En, Aggr_Type); + return Synth_Aggregate_Array (Syn_Inst, Aggr, Aggr_Type); when Type_Record | Type_Unbounded_Record => - return Synth_Aggregate_Record (Syn_Inst, Aggr, En, Aggr_Type); + return Synth_Aggregate_Record (Syn_Inst, Aggr, Aggr_Type); when others => raise Internal_Error; end case; diff --git a/src/synth/synth-aggr.ads b/src/synth/synth-aggr.ads index 1d700c620..009ad2100 100644 --- a/src/synth/synth-aggr.ads +++ b/src/synth/synth-aggr.ads @@ -20,8 +20,6 @@ with Vhdl.Nodes; use Vhdl.Nodes; -with Netlists; use Netlists; - with Synth.Objtypes; use Synth.Objtypes; with Synth.Values; use Synth.Values; with Synth.Context; use Synth.Context; @@ -30,6 +28,5 @@ package Synth.Aggr is -- Aggr_Type is the type from the context. function Synth_Aggregate (Syn_Inst : Synth_Instance_Acc; Aggr : Node; - En : Net; Aggr_Type : Type_Acc) return Valtyp; end Synth.Aggr; diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index 9e0ce30c1..378921c45 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -21,6 +21,7 @@ with Types; use Types; with Mutils; use Mutils; +with Netlists; use Netlists; with Netlists.Builders; use Netlists.Builders; with Netlists.Folds; use Netlists.Folds; with Netlists.Utils; use Netlists.Utils; @@ -218,7 +219,7 @@ package body Synth.Decls is Synth_Record_Elements_Definition (Syn_Inst, Def); Typ := Synth_Record_Type_Definition (Syn_Inst, Def); when Iir_Kind_Protected_Type_Declaration => - Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Def), No_Net); + Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Def)); when others => Vhdl.Errors.Error_Kind ("synth_type_definition", Def); end case; @@ -465,7 +466,6 @@ package body Synth.Decls is procedure Synth_Constant_Declaration (Syn_Inst : Synth_Instance_Acc; Decl : Node; - En : Net; Is_Subprg : Boolean; Last_Type : in out Node) is @@ -512,7 +512,7 @@ package body Synth.Decls is end if; Obj_Type := Get_Subtype_Object (Syn_Inst, Decl_Type); Val := Synth_Expression_With_Type - (Syn_Inst, Get_Default_Value (Decl), Obj_Type, En); + (Syn_Inst, Get_Default_Value (Decl), Obj_Type); if Val = No_Valtyp then Set_Error (Syn_Inst); return; @@ -542,7 +542,7 @@ package body Synth.Decls is end Synth_Constant_Declaration; procedure Synth_Attribute_Specification - (Syn_Inst : Synth_Instance_Acc; Spec : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Spec : Node) is Decl : constant Node := Get_Attribute_Designator (Spec); Value : Iir_Attribute_Value; @@ -562,7 +562,7 @@ package body Synth.Decls is -- unless the attribute's subtype indication denotes an -- unconstrained array type. Val := Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Spec), Val_Type, En); + (Syn_Inst, Get_Expression (Spec), Val_Type); -- Check_Constraints (Instance, Val, Attr_Type, Decl); -- 3. A new instance of the designated attribute is created @@ -624,7 +624,7 @@ package body Synth.Decls is end Create_Package_Instance; procedure Synth_Package_Declaration - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; En : Net) + (Parent_Inst : Synth_Instance_Acc; Pkg : Node) is Syn_Inst : Synth_Instance_Acc; begin @@ -635,14 +635,14 @@ package body Synth.Decls is Syn_Inst := Create_Package_Instance (Parent_Inst, Pkg); - Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Pkg), En); + Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Pkg)); if Pkg = Vhdl.Std_Package.Standard_Package then Synth_Convertible_Declarations (Syn_Inst); end if; end Synth_Package_Declaration; procedure Synth_Package_Body - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; Bod : Node; En : Net) + (Parent_Inst : Synth_Instance_Acc; Pkg : Node; Bod : Node) is Pkg_Inst : Synth_Instance_Acc; begin @@ -653,14 +653,13 @@ package body Synth.Decls is Pkg_Inst := Get_Package_Object (Parent_Inst, Pkg); - Synth_Declarations (Pkg_Inst, Get_Declaration_Chain (Bod), En); + Synth_Declarations (Pkg_Inst, Get_Declaration_Chain (Bod)); end Synth_Package_Body; procedure Synth_Generics_Association (Sub_Inst : Synth_Instance_Acc; Syn_Inst : Synth_Instance_Acc; Inter_Chain : Node; - Assoc_Chain : Node; - En : Net) + Assoc_Chain : Node) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Inter : Node; @@ -683,11 +682,11 @@ package body Synth.Decls is when Iir_Kind_Association_Element_Open => Actual := Get_Default_Value (Inter); Val := Synth_Expression_With_Type - (Sub_Inst, Actual, Inter_Type, En); + (Sub_Inst, Actual, Inter_Type); when Iir_Kind_Association_Element_By_Expression => Actual := Get_Actual (Assoc); Val := Synth_Expression_With_Type - (Syn_Inst, Actual, Inter_Type, En); + (Syn_Inst, Actual, Inter_Type); when others => raise Internal_Error; end case; @@ -703,7 +702,7 @@ package body Synth.Decls is end Synth_Generics_Association; procedure Synth_Package_Instantiation - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; En : Net) + (Parent_Inst : Synth_Instance_Acc; Pkg : Node) is Bod : constant Node := Get_Instance_Package_Body (Pkg); Sub_Inst : Synth_Instance_Acc; @@ -712,9 +711,9 @@ package body Synth.Decls is Synth_Generics_Association (Sub_Inst, Parent_Inst, - Get_Generic_Chain (Pkg), Get_Generic_Map_Aspect_Chain (Pkg), En); + Get_Generic_Chain (Pkg), Get_Generic_Map_Aspect_Chain (Pkg)); - Synth_Declarations (Sub_Inst, Get_Declaration_Chain (Pkg), En); + Synth_Declarations (Sub_Inst, Get_Declaration_Chain (Pkg)); if Bod /= Null_Node then -- Macro expended package instantiation. @@ -729,7 +728,7 @@ package body Synth.Decls is -- Synth declarations of (optional) body. if Uninst_Bod /= Null_Node then Synth_Declarations - (Sub_Inst, Get_Declaration_Chain (Uninst_Bod), En); + (Sub_Inst, Get_Declaration_Chain (Uninst_Bod)); end if; end; end if; @@ -737,7 +736,6 @@ package body Synth.Decls is procedure Synth_Variable_Declaration (Syn_Inst : Synth_Instance_Acc; Decl : Node; - En : Net; Is_Subprg : Boolean) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); @@ -766,7 +764,7 @@ package body Synth.Decls is Create_Object (Syn_Inst, Decl, Create_Value_Default (Obj_Typ)); else if Is_Valid (Def) then - Init := Synth_Expression_With_Type (Syn_Inst, Def, Obj_Typ, En); + Init := Synth_Expression_With_Type (Syn_Inst, Def, Obj_Typ); Init := Synth_Subtype_Conversion (Ctxt, Init, Obj_Typ, False, Decl); if not Is_Subprg @@ -810,7 +808,7 @@ package body Synth.Decls is Create_Wire_Object (Syn_Inst, Wire_Signal, Decl); if Is_Valid (Def) then Obj_Typ := Get_Subtype_Object (Syn_Inst, Get_Type (Decl)); - Init := Synth_Expression_With_Type (Syn_Inst, Def, Obj_Typ, No_Net); + Init := Synth_Expression_With_Type (Syn_Inst, Def, Obj_Typ); Init := Synth_Subtype_Conversion (Ctxt, Init, Obj_Typ, False, Decl); if not Is_Static (Init.Val) then Error_Msg_Synth (+Decl, "signals cannot be used in default value " @@ -823,7 +821,7 @@ package body Synth.Decls is end Synth_Signal_Declaration; procedure Synth_Object_Alias_Declaration - (Syn_Inst : Synth_Instance_Acc; Decl : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Decl : Node) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Atype : constant Node := Get_Declaration_Type (Decl); @@ -842,7 +840,7 @@ package body Synth.Decls is Obj_Typ := null; end if; - Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl), En, + Stmts.Synth_Assignment_Prefix (Syn_Inst, Get_Name (Decl), Base, Typ, Off, Dyn); pragma Assert (Dyn.Voff = No_Net); if Base.Val.Kind = Value_Net then @@ -862,26 +860,23 @@ package body Synth.Decls is procedure Synth_Declaration (Syn_Inst : Synth_Instance_Acc; Decl : Node; - En : Net; Is_Subprg : Boolean; Last_Type : in out Node) is begin case Get_Kind (Decl) is when Iir_Kind_Variable_Declaration => - Synth_Variable_Declaration (Syn_Inst, Decl, En, Is_Subprg); + Synth_Variable_Declaration (Syn_Inst, Decl, Is_Subprg); when Iir_Kind_Interface_Variable_Declaration => -- Ignore default value. Create_Wire_Object (Syn_Inst, Wire_Variable, Decl); Create_Var_Wire (Syn_Inst, Decl, No_Valtyp); when Iir_Kind_Constant_Declaration => - Synth_Constant_Declaration - (Syn_Inst, Decl, En, Is_Subprg, Last_Type); + Synth_Constant_Declaration (Syn_Inst, Decl, Is_Subprg, Last_Type); when Iir_Kind_Signal_Declaration => pragma Assert (not Is_Subprg); - pragma Assert (En = No_Net); Synth_Signal_Declaration (Syn_Inst, Decl); when Iir_Kind_Object_Alias_Declaration => - Synth_Object_Alias_Declaration (Syn_Inst, Decl, En); + Synth_Object_Alias_Declaration (Syn_Inst, Decl); when Iir_Kind_Anonymous_Signal_Declaration => -- Anonymous signals created by inertial associations are -- simply ignored. @@ -899,7 +894,7 @@ package body Synth.Decls is -- indication. null; when Iir_Kind_Attribute_Specification => - Synth_Attribute_Specification (Syn_Inst, Decl, En); + Synth_Attribute_Specification (Syn_Inst, Decl); when Iir_Kind_Type_Declaration => Synth_Type_Definition (Syn_Inst, Get_Type_Definition (Decl)); when Iir_Kind_Anonymous_Type_Declaration => @@ -941,7 +936,6 @@ package body Synth.Decls is procedure Synth_Declarations (Syn_Inst : Synth_Instance_Acc; Decls : Iir; - En : Net; Is_Subprg : Boolean := False) is Decl : Node; @@ -950,7 +944,7 @@ package body Synth.Decls is Last_Type := Null_Node; Decl := Decls; while Is_Valid (Decl) loop - Synth_Declaration (Syn_Inst, Decl, En, Is_Subprg, Last_Type); + Synth_Declaration (Syn_Inst, Decl, Is_Subprg, Last_Type); exit when Is_Error (Syn_Inst); diff --git a/src/synth/synth-decls.ads b/src/synth/synth-decls.ads index a42305771..68b7fea08 100644 --- a/src/synth/synth-decls.ads +++ b/src/synth/synth-decls.ads @@ -20,8 +20,6 @@ with Vhdl.Nodes; use Vhdl.Nodes; -with Netlists; use Netlists; - with Synth.Context; use Synth.Context; with Synth.Objtypes; use Synth.Objtypes; @@ -44,13 +42,11 @@ package Synth.Decls is procedure Synth_Declaration (Syn_Inst : Synth_Instance_Acc; Decl : Node; - En : Net; Is_Subprg : Boolean; Last_Type : in out Node); procedure Synth_Declarations (Syn_Inst : Synth_Instance_Acc; Decls : Iir; - En : Net; Is_Subprg : Boolean := False); procedure Finalize_Declarations (Syn_Inst : Synth_Instance_Acc; @@ -58,16 +54,15 @@ package Synth.Decls is Is_Subprg : Boolean := False); procedure Synth_Package_Declaration - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; En : Net); + (Parent_Inst : Synth_Instance_Acc; Pkg : Node); procedure Synth_Package_Body - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; Bod : Node; En : Net); + (Parent_Inst : Synth_Instance_Acc; Pkg : Node; Bod : Node); procedure Synth_Generics_Association (Sub_Inst : Synth_Instance_Acc; Syn_Inst : Synth_Instance_Acc; Inter_Chain : Node; - Assoc_Chain : Node; - En : Net); + Assoc_Chain : Node); procedure Synth_Package_Instantiation - (Parent_Inst : Synth_Instance_Acc; Pkg : Node; En : Net); + (Parent_Inst : Synth_Instance_Acc; Pkg : Node); end Synth.Decls; diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb index c8bfd6b24..bbaf4d6a4 100644 --- a/src/synth/synth-expr.adb +++ b/src/synth/synth-expr.adb @@ -433,10 +433,8 @@ package body Synth.Expr is Lval, Rval : Int64; begin -- Static values. - L := Synth_Expression_With_Basetype - (Syn_Inst, Get_Left_Limit (Rng), No_Net); - R := Synth_Expression_With_Basetype - (Syn_Inst, Get_Right_Limit (Rng), No_Net); + L := Synth_Expression_With_Basetype (Syn_Inst, Get_Left_Limit (Rng)); + R := Synth_Expression_With_Basetype (Syn_Inst, Get_Right_Limit (Rng)); Strip_Const (L); Strip_Const (R); @@ -459,8 +457,8 @@ package body Synth.Expr is L, R : Valtyp; begin -- Static values (so no enable). - L := Synth_Expression (Syn_Inst, Get_Left_Limit (Rng), No_Net); - R := Synth_Expression (Syn_Inst, Get_Right_Limit (Rng), No_Net); + L := Synth_Expression (Syn_Inst, Get_Left_Limit (Rng)); + R := Synth_Expression (Syn_Inst, Get_Right_Limit (Rng)); return (Get_Direction (Rng), Read_Fp64 (L), Read_Fp64 (R)); end Synth_Float_Range_Expression; @@ -488,7 +486,7 @@ package body Synth.Expr is begin Pfx_Typ := Synth_Type_Of_Object (Syn_Inst, Get_Prefix (Expr)); Get_Onedimensional_Array_Bounds (Pfx_Typ, Pfx_Bnd, El_Typ); - Synth_Slice_Suffix (Syn_Inst, Expr, No_Net, Pfx_Bnd, El_Typ, + Synth_Slice_Suffix (Syn_Inst, Expr, Pfx_Bnd, El_Typ, Res_Bnd, Sl_Voff, Sl_Off); if Sl_Voff /= No_Net then @@ -520,7 +518,7 @@ package body Synth.Expr is Res : Valtyp; begin -- Maybe do not dereference it if its type is known ? - Val := Synth_Expression (Syn_Inst, Get_Prefix (Expr), No_Net); + Val := Synth_Expression (Syn_Inst, Get_Prefix (Expr)); Res := Heap.Synth_Dereference (Read_Access (Val)); return Res.Typ; end; @@ -687,7 +685,7 @@ package body Synth.Expr is for I in Flist_First .. Last loop -- Elements are supposed to be static, so no need for enable. Val := Synth_Expression_With_Type - (Syn_Inst, Get_Nth_Element (Els, I), El_Typ, No_Net); + (Syn_Inst, Get_Nth_Element (Els, I), El_Typ); pragma Assert (Is_Static (Val.Val)); Write_Value (Res.Val.Mem + Size_Type (I) * El_Typ.Sz, Val); end loop; @@ -847,7 +845,7 @@ package body Synth.Expr is Dtype : Type_Acc; begin -- The value is supposed to be static. - V := Synth_Expression (Syn_Inst, Param, No_Net); + V := Synth_Expression (Syn_Inst, Param); if V = No_Valtyp then return No_Valtyp; end if; @@ -960,7 +958,7 @@ package body Synth.Expr is Dtype : Type_Acc; begin -- The parameter is expected to be static. - V := Synth_Expression (Syn_Inst, Param, No_Net); + V := Synth_Expression (Syn_Inst, Param); if V = No_Valtyp then return No_Valtyp; end if; @@ -1016,7 +1014,7 @@ package body Synth.Expr is declare Val : Valtyp; begin - Val := Synth_Expression (Syn_Inst, Get_Prefix (Name), No_Net); + Val := Synth_Expression (Syn_Inst, Get_Prefix (Name)); return Heap.Synth_Dereference (Read_Access (Val)); end; when others => @@ -1139,7 +1137,6 @@ package body Synth.Expr is procedure Synth_Indexed_Name (Syn_Inst : Synth_Instance_Acc; Name : Node; - En : Net; Pfx_Type : Type_Acc; Voff : out Net; Off : out Value_Offsets) @@ -1168,7 +1165,7 @@ package body Synth.Expr is end loop; -- Use the base type as the subtype of the index is not synth-ed. - Idx_Val := Synth_Expression_With_Basetype (Syn_Inst, Idx_Expr, En); + Idx_Val := Synth_Expression_With_Basetype (Syn_Inst, Idx_Expr); Strip_Const (Idx_Val); Bnd := Get_Array_Bound (Pfx_Type, Dim_Type (I + 1)); @@ -1427,7 +1424,6 @@ package body Synth.Expr is procedure Synth_Slice_Suffix (Syn_Inst : Synth_Instance_Acc; Name : Node; - En : Net; Pfx_Bnd : Bound_Type; El_Typ : Type_Acc; Res_Bnd : out Bound_Type; @@ -1449,9 +1445,9 @@ package body Synth.Expr is when Iir_Kind_Range_Expression => -- As the range may be dynamic, cannot use synth_discrete_range. Left := Synth_Expression_With_Basetype - (Syn_Inst, Get_Left_Limit (Expr), En); + (Syn_Inst, Get_Left_Limit (Expr)); Right := Synth_Expression_With_Basetype - (Syn_Inst, Get_Right_Limit (Expr), En); + (Syn_Inst, Get_Right_Limit (Expr)); Dir := Get_Direction (Expr); when Iir_Kind_Range_Array_Attribute @@ -1633,14 +1629,14 @@ package body Synth.Expr is end Synth_Clock_Edge; function Synth_Type_Conversion - (Syn_Inst : Synth_Instance_Acc; Conv : Node; En : Net) return Valtyp + (Syn_Inst : Synth_Instance_Acc; Conv : Node) return Valtyp is Expr : constant Node := Get_Expression (Conv); Conv_Type : constant Node := Get_Type (Conv); Conv_Typ : constant Type_Acc := Get_Subtype_Object (Syn_Inst, Conv_Type); Val : Valtyp; begin - Val := Synth_Expression_With_Basetype (Syn_Inst, Expr, En); + Val := Synth_Expression_With_Basetype (Syn_Inst, Expr); if Val = No_Valtyp then return No_Valtyp; end if; @@ -1775,8 +1771,7 @@ package body Synth.Expr is Left_Expr : Node; Right_Expr : Node; Typ : Type_Acc; - Expr : Node; - En : Net) return Valtyp + Expr : Node) return Valtyp is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Left : Valtyp; @@ -1792,7 +1787,7 @@ package body Synth.Expr is Val := 1; end case; - Left := Synth_Expression_With_Type (Syn_Inst, Left_Expr, Typ, En); + Left := Synth_Expression_With_Type (Syn_Inst, Left_Expr, Typ); if Left = No_Valtyp then return No_Valtyp; end if; @@ -1803,7 +1798,7 @@ package body Synth.Expr is end if; Strip_Const (Left); - Right := Synth_Expression_With_Type (Syn_Inst, Right_Expr, Typ, En); + Right := Synth_Expression_With_Type (Syn_Inst, Right_Expr, Typ); if Right = No_Valtyp then return No_Valtyp; end if; @@ -1824,8 +1819,7 @@ package body Synth.Expr is function Synth_Expression_With_Type (Syn_Inst : Synth_Instance_Acc; Expr : Node; - Expr_Type : Type_Acc; - En : Net) return Valtyp is + Expr_Type : Type_Acc) return Valtyp is begin case Get_Kind (Expr) is when Iir_Kinds_Dyadic_Operator => @@ -1849,27 +1843,27 @@ package body Synth.Expr is when Iir_Predefined_Boolean_And => return Synth_Short_Circuit (Syn_Inst, Id_And, Get_Left (Expr), Get_Right (Expr), - Boolean_Type, Expr, En); + Boolean_Type, Expr); when Iir_Predefined_Boolean_Or => return Synth_Short_Circuit (Syn_Inst, Id_Or, Get_Left (Expr), Get_Right (Expr), - Boolean_Type, Expr, En); + Boolean_Type, Expr); when Iir_Predefined_Bit_And => return Synth_Short_Circuit (Syn_Inst, Id_And, Get_Left (Expr), Get_Right (Expr), - Bit_Type, Expr, En); + Bit_Type, Expr); when Iir_Predefined_Bit_Or => return Synth_Short_Circuit (Syn_Inst, Id_Or, Get_Left (Expr), Get_Right (Expr), - Bit_Type, Expr, En); + Bit_Type, Expr); when Iir_Predefined_None => Error_Ieee_Operator (Imp, Expr); return Synth_User_Operator - (Syn_Inst, Get_Left (Expr), Get_Right (Expr), Expr, En); + (Syn_Inst, Get_Left (Expr), Get_Right (Expr), Expr); when others => return Synth_Dyadic_Operation (Syn_Inst, Imp, - Get_Left (Expr), Get_Right (Expr), Expr, En); + Get_Left (Expr), Get_Right (Expr), Expr); end case; end; when Iir_Kinds_Monadic_Operator => @@ -1881,10 +1875,10 @@ package body Synth.Expr is if Def = Iir_Predefined_None then Error_Ieee_Operator (Imp, Expr); return Synth_User_Operator - (Syn_Inst, Get_Operand (Expr), Null_Node, Expr, En); + (Syn_Inst, Get_Operand (Expr), Null_Node, Expr); else return Synth_Monadic_Operation - (Syn_Inst, Imp, Get_Operand (Expr), Expr, En); + (Syn_Inst, Imp, Get_Operand (Expr), Expr); end if; end; when Iir_Kind_Simple_Name @@ -1897,10 +1891,10 @@ package body Synth.Expr is when Iir_Kind_Reference_Name => -- Only used for anonymous signals in internal association. return Synth_Expression_With_Type - (Syn_Inst, Get_Named_Entity (Expr), Expr_Type, En); + (Syn_Inst, Get_Named_Entity (Expr), Expr_Type); when Iir_Kind_Anonymous_Signal_Declaration => return Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Expr), Expr_Type, En); + (Syn_Inst, Get_Expression (Expr), Expr_Type); when Iir_Kind_Indexed_Name | Iir_Kind_Slice_Name => declare @@ -1911,8 +1905,7 @@ package body Synth.Expr is Dyn : Dyn_Name; begin - Synth_Assignment_Prefix - (Syn_Inst, Expr, En, Base, Typ, Off, Dyn); + Synth_Assignment_Prefix (Syn_Inst, Expr, Base, Typ, Off, Dyn); if Dyn.Voff = No_Net and then Is_Static (Base.Val) then Res := Create_Value_Memory (Typ); Copy_Memory @@ -1933,7 +1926,7 @@ package body Synth.Expr is Val : Valtyp; Res : Valtyp; begin - Val := Synth_Expression (Syn_Inst, Pfx, En); + Val := Synth_Expression (Syn_Inst, Pfx); Strip_Const (Val); Res_Typ := Val.Typ.Rec.E (Idx + 1).Typ; if Is_Static (Val.Val) then @@ -1952,7 +1945,7 @@ package body Synth.Expr is end; when Iir_Kind_Character_Literal => return Synth_Expression_With_Type - (Syn_Inst, Get_Named_Entity (Expr), Expr_Type, No_Net); + (Syn_Inst, Get_Named_Entity (Expr), Expr_Type); when Iir_Kind_Integer_Literal => declare Res : Valtyp; @@ -1972,33 +1965,31 @@ package body Synth.Expr is when Iir_Kind_Enumeration_Literal => return Synth_Name (Syn_Inst, Expr); when Iir_Kind_Type_Conversion => - return Synth_Type_Conversion (Syn_Inst, Expr, En); + return Synth_Type_Conversion (Syn_Inst, Expr); when Iir_Kind_Qualified_Expression => return Synth_Expression_With_Type (Syn_Inst, Get_Expression (Expr), - Get_Subtype_Object (Syn_Inst, Get_Type (Get_Type_Mark (Expr))), - En); + Get_Subtype_Object (Syn_Inst, Get_Type (Get_Type_Mark (Expr)))); when Iir_Kind_Function_Call => declare Imp : constant Node := Get_Implementation (Expr); begin case Get_Implicit_Definition (Imp) is when Iir_Predefined_Pure_Functions => - return Synth_Operator_Function_Call (Syn_Inst, Expr, En); + return Synth_Operator_Function_Call (Syn_Inst, Expr); when Iir_Predefined_None => - return Synth_User_Function_Call (Syn_Inst, Expr, En); + return Synth_User_Function_Call (Syn_Inst, Expr); when others => - return Synth_Predefined_Function_Call - (Syn_Inst, Expr, En); + return Synth_Predefined_Function_Call (Syn_Inst, Expr); end case; end; when Iir_Kind_Aggregate => - return Synth.Aggr.Synth_Aggregate (Syn_Inst, Expr, En, Expr_Type); + return Synth.Aggr.Synth_Aggregate (Syn_Inst, Expr, Expr_Type); when Iir_Kind_Simple_Aggregate => return Synth_Simple_Aggregate (Syn_Inst, Expr); when Iir_Kind_Parenthesis_Expression => return Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Expr), Expr_Type, En); + (Syn_Inst, Get_Expression (Expr), Expr_Type); when Iir_Kind_Left_Array_Attribute => declare B : Bound_Type; @@ -2056,7 +2047,7 @@ package body Synth.Expr is V : Valtyp; Dtype : Type_Acc; begin - V := Synth_Expression (Syn_Inst, Param, En); + V := Synth_Expression (Syn_Inst, Param); Dtype := Get_Subtype_Object (Syn_Inst, Get_Type (Expr)); -- FIXME: to be generalized. Not always as simple as a -- subtype conversion. @@ -2077,7 +2068,6 @@ package body Synth.Expr is T : Type_Acc; Acc : Heap_Index; begin - pragma Assert (En = No_Net); T := Synth.Decls.Synth_Subtype_Indication (Syn_Inst, Get_Subtype_Indication (Expr)); Acc := Allocate_By_Type (T); @@ -2088,9 +2078,8 @@ package body Synth.Expr is V : Valtyp; Acc : Heap_Index; begin - pragma Assert (En = No_Net); V := Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Expr), Expr_Type.Acc_Acc, No_Net); + (Syn_Inst, Get_Expression (Expr), Expr_Type.Acc_Acc); Acc := Allocate_By_Value (V); return Create_Value_Access (Acc, Expr_Type); end; @@ -2105,8 +2094,8 @@ package body Synth.Expr is end case; end Synth_Expression_With_Type; - function Synth_Expression - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp + function Synth_Expression (Syn_Inst : Synth_Instance_Acc; Expr : Node) + return Valtyp is Etype : Node; begin @@ -2126,16 +2115,16 @@ package body Synth.Expr is end case; return Synth_Expression_With_Type - (Syn_Inst, Expr, Get_Subtype_Object (Syn_Inst, Etype), En); + (Syn_Inst, Expr, Get_Subtype_Object (Syn_Inst, Etype)); end Synth_Expression; function Synth_Expression_With_Basetype - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp is Basetype : Type_Acc; begin Basetype := Get_Subtype_Object (Syn_Inst, Get_Base_Type (Get_Type (Expr))); - return Synth_Expression_With_Type (Syn_Inst, Expr, Basetype, En); + return Synth_Expression_With_Type (Syn_Inst, Expr, Basetype); end Synth_Expression_With_Basetype; end Synth.Expr; diff --git a/src/synth/synth-expr.ads b/src/synth/synth-expr.ads index e54e0c7b8..1da15ce29 100644 --- a/src/synth/synth-expr.ads +++ b/src/synth/synth-expr.ads @@ -77,20 +77,18 @@ package Synth.Expr is -- If EN is not No_Net, the execution is controlled by EN. This is used -- for assertions and checks. function Synth_Expression - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp; + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp; -- Same as Synth_Expression, but the expression may be constrained by -- EXPR_TYPE. function Synth_Expression_With_Type (Syn_Inst : Synth_Instance_Acc; Expr : Node; - Expr_Type : Type_Acc; - En : Net) return Valtyp; + Expr_Type : Type_Acc) return Valtyp; -- Use base type of EXPR to synthesize EXPR. Useful when the type of -- EXPR is defined by itself or a range. function Synth_Expression_With_Basetype (Syn_Inst : Synth_Instance_Acc; - Expr : Node; - En : Net) return Valtyp; + Expr : Node) return Valtyp; function Synth_Bounds_From_Range (Syn_Inst : Synth_Instance_Acc; Atype : Node) return Bound_Type; @@ -112,7 +110,6 @@ package Synth.Expr is procedure Synth_Slice_Suffix (Syn_Inst : Synth_Instance_Acc; Name : Node; - En : Net; Pfx_Bnd : Bound_Type; El_Typ : Type_Acc; Res_Bnd : out Bound_Type; @@ -123,7 +120,6 @@ package Synth.Expr is -- OFF is 0. procedure Synth_Indexed_Name (Syn_Inst : Synth_Instance_Acc; Name : Node; - En : Net; Pfx_Type : Type_Acc; Voff : out Net; Off : out Value_Offsets); diff --git a/src/synth/synth-files_operations.adb b/src/synth/synth-files_operations.adb index 52abbd7aa..98fa6a5b8 100644 --- a/src/synth/synth-files_operations.adb +++ b/src/synth/synth-files_operations.adb @@ -28,8 +28,6 @@ with Grt.Stdio; with Vhdl.Annotations; -with Netlists; use Netlists; - with Synth.Objtypes; use Synth.Objtypes; with Synth.Expr; use Synth.Expr; with Synth.Errors; use Synth.Errors; @@ -216,11 +214,10 @@ package body Synth.Files_Operations is return F; end if; - File_Name := Synth_Expression_With_Basetype - (Syn_Inst, External_Name, No_Net); + File_Name := Synth_Expression_With_Basetype (Syn_Inst, External_Name); if Open_Kind /= Null_Node then - Mode := Synth_Expression (Syn_Inst, Open_Kind, No_Net); + Mode := Synth_Expression (Syn_Inst, Open_Kind); File_Mode := Ghdl_I32 (Read_Discrete (Mode)); else case Get_Mode (Decl) is diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb index 060defa32..ab6ef4133 100644 --- a/src/synth/synth-insts.adb +++ b/src/synth/synth-insts.adb @@ -563,8 +563,7 @@ package body Synth.Insts is begin Synth_Individual_Prefix (Syn_Inst, Inter_Inst, Get_Prefix (Formal), Off, Typ); - Synth_Indexed_Name - (Syn_Inst, Formal, No_Net, Typ, Voff, Arr_Off); + Synth_Indexed_Name (Syn_Inst, Formal, Typ, Voff, Arr_Off); if Voff /= No_Net then raise Internal_Error; end if; @@ -583,7 +582,7 @@ package body Synth.Insts is (Syn_Inst, Inter_Inst, Get_Prefix (Formal), Off, Typ); Get_Onedimensional_Array_Bounds (Typ, Pfx_Bnd, El_Typ); - Synth_Slice_Suffix (Syn_Inst, Formal, No_Net, Pfx_Bnd, El_Typ, + Synth_Slice_Suffix (Syn_Inst, Formal, Pfx_Bnd, El_Typ, Res_Bnd, Sl_Voff, Sl_Off); if Sl_Voff /= No_Net then raise Internal_Error; @@ -654,8 +653,7 @@ package body Synth.Insts is (Syn_Inst, Inter_Inst, Get_Formal (Iassoc), Off, Typ); -- 2. synth expression - V := Synth_Expression_With_Type - (Syn_Inst, Get_Actual (Iassoc), Typ, No_Net); + V := Synth_Expression_With_Type (Syn_Inst, Get_Actual (Iassoc), Typ); -- 3. save in a table Value_Offset_Tables.Append (Els, (Off, V)); @@ -716,8 +714,7 @@ package body Synth.Insts is Formal_Typ := Get_Subtype_Object (Inter_Inst, Get_Type (Inter)); - Act := Synth_Expression_With_Type - (Act_Inst, Actual, Formal_Typ, No_Net); + Act := Synth_Expression_With_Type (Act_Inst, Actual, Formal_Typ); return Get_Net (Ctxt, Act); end Synth_Input_Assoc; @@ -749,7 +746,7 @@ package body Synth.Insts is V := Create_Value_Net (O, Typ); -- 3. Assign. - Synth_Assignment (Syn_Inst, Get_Actual (Iassoc), V, Iassoc, No_Net); + Synth_Assignment (Syn_Inst, Get_Actual (Iassoc), V, Iassoc); Iassoc := Get_Chain (Iassoc); end loop; @@ -784,7 +781,7 @@ package body Synth.Insts is Port := Builders.Build_Port (Get_Build (Syn_Inst), Outp); O := Create_Value_Net (Port, Formal_Typ); -- Assign the port output to the actual (a net). - Synth_Assignment (Syn_Inst, Actual, O, Assoc, No_Net); + Synth_Assignment (Syn_Inst, Actual, O, Assoc); end Synth_Output_Assoc; -- Subprogram used for instantiation (direct or by component). @@ -944,8 +941,7 @@ package body Synth.Insts is Synth_Generics_Association (Sub_Inst, Syn_Inst, Get_Generic_Chain (Ent), - Get_Generic_Map_Aspect_Chain (Stmt), - No_Net); + Get_Generic_Map_Aspect_Chain (Stmt)); -- Elaborate port types. Synth_Ports_Association_Type (Sub_Inst, Syn_Inst, @@ -1081,8 +1077,7 @@ package body Synth.Insts is Synth_Generics_Association (Comp_Inst, Syn_Inst, Get_Generic_Chain (Component), - Get_Generic_Map_Aspect_Chain (Stmt), - No_Net); + Get_Generic_Map_Aspect_Chain (Stmt)); -- Create objects for the inputs and the outputs of the component, -- assign inputs (that's nets) and create wires for outputs. @@ -1145,8 +1140,7 @@ package body Synth.Insts is (Comp_Inst, Ent, New_Sname_User (Get_Identifier (Ent), No_Sname)); Synth_Generics_Association (Sub_Inst, Comp_Inst, Get_Generic_Chain (Ent), - Get_Generic_Map_Aspect_Chain (Bind), - No_Net); + Get_Generic_Map_Aspect_Chain (Bind)); Synth_Ports_Association_Type (Sub_Inst, Comp_Inst, Get_Port_Chain (Ent), @@ -1231,8 +1225,7 @@ package body Synth.Insts is Bod : constant Node := Get_Package_Body (Dep_Unit); Bod_Unit : Node; begin - Synth_Package_Declaration - (Parent_Inst, Dep_Unit, No_Net); + Synth_Package_Declaration (Parent_Inst, Dep_Unit); -- Do not try to elaborate math_real body: there are -- functions with loop. Currently, try create signals, -- which is not possible during package elaboration. @@ -1241,12 +1234,11 @@ package body Synth.Insts is then Bod_Unit := Get_Design_Unit (Bod); Synth_Dependencies (Parent_Inst, Bod_Unit); - Synth_Package_Body - (Parent_Inst, Dep_Unit, Bod, No_Net); + Synth_Package_Body (Parent_Inst, Dep_Unit, Bod); end if; end; when Iir_Kind_Package_Instantiation_Declaration => - Synth_Package_Instantiation (Parent_Inst, Dep_Unit, No_Net); + Synth_Package_Instantiation (Parent_Inst, Dep_Unit); when Iir_Kind_Package_Body => null; when Iir_Kind_Architecture_Body => @@ -1298,7 +1290,7 @@ package body Synth.Insts is begin Inter_Typ := Get_Subtype_Object (Syn_Inst, Get_Type (Inter)); Val := Synth_Expression_With_Type - (Syn_Inst, Get_Default_Value (Inter), Inter_Typ, No_Net); + (Syn_Inst, Get_Default_Value (Inter), Inter_Typ); pragma Assert (Is_Static (Val.Val)); Create_Object (Syn_Inst, Inter, Val); end; @@ -1389,8 +1381,7 @@ package body Synth.Insts is else if Default /= Null_Node then Inter_Typ := Get_Subtype_Object (Syn_Inst, Get_Type (Inter)); - Init := Synth_Expression_With_Type - (Syn_Inst, Default, Inter_Typ, No_Net); + Init := Synth_Expression_With_Type (Syn_Inst, Default, Inter_Typ); Init := Synth_Subtype_Conversion (Ctxt, Init, Inter_Typ, False, Inter); Value := Builders.Build_Ioutput (Ctxt, Get_Net (Ctxt, Init)); @@ -1525,14 +1516,14 @@ package body Synth.Insts is pragma Assert (Get_Kind (Inst.Config) = Iir_Kind_Block_Configuration); Apply_Block_Configuration (Inst.Config, Arch); - Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Entity), No_Net); + Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Entity)); if not Is_Error (Syn_Inst) then Synth_Concurrent_Statements (Syn_Inst, Get_Concurrent_Statement_Chain (Entity)); end if; if not Is_Error (Syn_Inst) then - Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Arch), No_Net); + Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Arch)); end if; if not Is_Error (Syn_Inst) then Synth_Concurrent_Statements diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb index 760ef8fd5..4e1c16cb8 100644 --- a/src/synth/synth-oper.adb +++ b/src/synth/synth-oper.adb @@ -28,6 +28,7 @@ with Vhdl.Utils; use Vhdl.Utils; with Areapools; +with Netlists; use Netlists; with Netlists.Gates; use Netlists.Gates; with Netlists.Builders; use Netlists.Builders; with Netlists.Folds; use Netlists.Folds; @@ -380,8 +381,7 @@ package body Synth.Oper is Imp : Node; Left_Expr : Node; Right_Expr : Node; - Expr : Node; - En : Net) return Valtyp + Expr : Node) return Valtyp is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Def : constant Iir_Predefined_Functions := @@ -677,14 +677,12 @@ package body Synth.Oper is return Create_Value_Net (N, Create_Res_Bound (Left)); end Synth_Rotation; begin - Left := Synth_Expression_With_Type - (Syn_Inst, Left_Expr, Left_Typ, En); + Left := Synth_Expression_With_Type (Syn_Inst, Left_Expr, Left_Typ); if Left = No_Valtyp then return No_Valtyp; end if; Left := Synth_Subtype_Conversion (Ctxt, Left, Left_Typ, False, Expr); - Right := Synth_Expression_With_Type - (Syn_Inst, Right_Expr, Right_Typ, En); + Right := Synth_Expression_With_Type (Syn_Inst, Right_Expr, Right_Typ); if Right = No_Valtyp then return No_Valtyp; end if; @@ -1400,8 +1398,7 @@ package body Synth.Oper is function Synth_Monadic_Operation (Syn_Inst : Synth_Instance_Acc; Imp : Node; Operand_Expr : Node; - Loc : Node; - En : Net) return Valtyp + Loc : Node) return Valtyp is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Def : constant Iir_Predefined_Functions := @@ -1441,8 +1438,7 @@ package body Synth.Oper is return Create_Value_Net (N, Operand.Typ.Vec_El); end Synth_Vec_Reduce_Monadic; begin - Operand := Synth_Expression_With_Type - (Syn_Inst, Operand_Expr, Oper_Typ, En); + Operand := Synth_Expression_With_Type (Syn_Inst, Operand_Expr, Oper_Typ); if Operand = No_Valtyp then return No_Valtyp; end if; @@ -1728,7 +1724,7 @@ package body Synth.Oper is end Synth_Dynamic_Predefined_Function_Call; function Synth_Predefined_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp is Imp : constant Node := Get_Implementation (Expr); Assoc_Chain : constant Node := Get_Parameter_Association_Chain (Expr); @@ -1743,7 +1739,7 @@ package body Synth.Oper is Subprg_Inst := Make_Instance (Syn_Inst, Imp); Synth_Subprogram_Association - (Subprg_Inst, Syn_Inst, Inter_Chain, Assoc_Chain, En); + (Subprg_Inst, Syn_Inst, Inter_Chain, Assoc_Chain); if Is_Error (Subprg_Inst) then Res := No_Valtyp; @@ -1774,7 +1770,7 @@ package body Synth.Oper is end Synth_Predefined_Function_Call; function Synth_Operator_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp is Imp : constant Node := Get_Implementation (Expr); Assoc : Node; @@ -1786,10 +1782,10 @@ package body Synth.Oper is Op1 := Get_Actual (Assoc); if Get_Chain (Inter) = Null_Node then - return Synth_Monadic_Operation (Syn_Inst, Imp, Op1, Expr, En); + return Synth_Monadic_Operation (Syn_Inst, Imp, Op1, Expr); else Op2 := Get_Actual (Get_Chain (Assoc)); - return Synth_Dyadic_Operation (Syn_Inst, Imp, Op1, Op2, Expr, En); + return Synth_Dyadic_Operation (Syn_Inst, Imp, Op1, Op2, Expr); end if; end Synth_Operator_Function_Call; end Synth.Oper; diff --git a/src/synth/synth-oper.ads b/src/synth/synth-oper.ads index 6ec51fbc6..9d4fe8d88 100644 --- a/src/synth/synth-oper.ads +++ b/src/synth/synth-oper.ads @@ -20,30 +20,26 @@ with Vhdl.Nodes; use Vhdl.Nodes; -with Netlists; use Netlists; - with Synth.Objtypes; use Synth.Objtypes; with Synth.Values; use Synth.Values; with Synth.Context; use Synth.Context; package Synth.Oper is function Synth_Predefined_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp; + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp; function Synth_Operator_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp; + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp; function Synth_Dyadic_Operation (Syn_Inst : Synth_Instance_Acc; Imp : Node; Left_Expr : Node; Right_Expr : Node; - Expr : Node; - En : Net) return Valtyp; + Expr : Node) return Valtyp; function Synth_Monadic_Operation (Syn_Inst : Synth_Instance_Acc; Imp : Node; Operand_Expr : Node; - Loc : Node; - En : Net) return Valtyp; + Loc : Node) return Valtyp; function Create_Bounds_From_Length (Syn_Inst : Synth_Instance_Acc; Atype : Iir; Len : Iir_Index32) diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb index 10261bfa6..cfb632f53 100644 --- a/src/synth/synth-stmts.adb +++ b/src/synth/synth-stmts.adb @@ -68,8 +68,7 @@ package body Synth.Stmts is function Synth_Waveform (Syn_Inst : Synth_Instance_Acc; Wf : Node; - Targ_Type : Type_Acc; - En : Net) return Valtyp is + Targ_Type : Type_Acc) return Valtyp is begin if Get_Kind (Wf) = Iir_Kind_Unaffected_Waveform then -- TODO @@ -84,16 +83,15 @@ package body Synth.Stmts is null; end if; if Targ_Type = null then - return Synth_Expression (Syn_Inst, Get_We_Value (Wf), En); + return Synth_Expression (Syn_Inst, Get_We_Value (Wf)); else return Synth_Expression_With_Type - (Syn_Inst, Get_We_Value (Wf), Targ_Type, En); + (Syn_Inst, Get_We_Value (Wf), Targ_Type); end if; end Synth_Waveform; procedure Synth_Assignment_Prefix (Syn_Inst : Synth_Instance_Acc; Pfx : Node; - En : Net; Dest_Base : out Valtyp; Dest_Typ : out Type_Acc; Dest_Off : out Value_Offsets; @@ -101,7 +99,7 @@ package body Synth.Stmts is begin case Get_Kind (Pfx) is when Iir_Kind_Simple_Name => - Synth_Assignment_Prefix (Syn_Inst, Get_Named_Entity (Pfx), En, + Synth_Assignment_Prefix (Syn_Inst, Get_Named_Entity (Pfx), Dest_Base, Dest_Typ, Dest_Off, Dest_Dyn); when Iir_Kind_Interface_Signal_Declaration | Iir_Kind_Variable_Declaration @@ -129,7 +127,7 @@ package body Synth.Stmts is end if; end; when Iir_Kind_Function_Call => - Dest_Base := Synth_Expression (Syn_Inst, Pfx, En); + Dest_Base := Synth_Expression (Syn_Inst, Pfx); Dest_Typ := Dest_Base.Typ; Dest_Off := (0, 0); Dest_Dyn := No_Dyn_Name; @@ -140,10 +138,10 @@ package body Synth.Stmts is Off : Value_Offsets; begin Synth_Assignment_Prefix - (Syn_Inst, Get_Prefix (Pfx), En, + (Syn_Inst, Get_Prefix (Pfx), Dest_Base, Dest_Typ, Dest_Off, Dest_Dyn); Strip_Const (Dest_Base); - Synth_Indexed_Name (Syn_Inst, Pfx, En, Dest_Typ, Voff, Off); + Synth_Indexed_Name (Syn_Inst, Pfx, Dest_Typ, Voff, Off); if Voff = No_Net then -- Static index. @@ -178,7 +176,7 @@ package body Synth.Stmts is Get_Element_Position (Get_Named_Entity (Pfx)); begin Synth_Assignment_Prefix - (Syn_Inst, Get_Prefix (Pfx), En, + (Syn_Inst, Get_Prefix (Pfx), Dest_Base, Dest_Typ, Dest_Off, Dest_Dyn); Dest_Off.Net_Off := Dest_Off.Net_Off + Dest_Typ.Rec.E (Idx + 1).Boff; @@ -197,12 +195,12 @@ package body Synth.Stmts is Sl_Off : Value_Offsets; begin Synth_Assignment_Prefix - (Syn_Inst, Get_Prefix (Pfx), En, + (Syn_Inst, Get_Prefix (Pfx), Dest_Base, Dest_Typ, Dest_Off, Dest_Dyn); Strip_Const (Dest_Base); Get_Onedimensional_Array_Bounds (Dest_Typ, Pfx_Bnd, El_Typ); - Synth_Slice_Suffix (Syn_Inst, Pfx, En, Pfx_Bnd, El_Typ, + Synth_Slice_Suffix (Syn_Inst, Pfx, Pfx_Bnd, El_Typ, Res_Bnd, Sl_Voff, Sl_Off); @@ -236,7 +234,7 @@ package body Synth.Stmts is when Iir_Kind_Implicit_Dereference | Iir_Kind_Dereference => Synth_Assignment_Prefix - (Syn_Inst, Get_Prefix (Pfx), En, + (Syn_Inst, Get_Prefix (Pfx), Dest_Base, Dest_Typ, Dest_Off, Dest_Dyn); if Dest_Off /= (0, 0) and then Dest_Dyn.Voff /= No_Net then raise Internal_Error; @@ -354,8 +352,7 @@ package body Synth.Stmts is end Synth_Aggregate_Target_Type; function Synth_Target (Syn_Inst : Synth_Instance_Acc; - Target : Node; - En : Net) return Target_Info is + Target : Node) return Target_Info is begin case Get_Kind (Target) is when Iir_Kind_Aggregate => @@ -379,8 +376,7 @@ package body Synth.Stmts is Dyn : Dyn_Name; begin - Synth_Assignment_Prefix - (Syn_Inst, Target, En, Base, Typ, Off, Dyn); + Synth_Assignment_Prefix (Syn_Inst, Target, Base, Typ, Off, Dyn); if Dyn.Voff = No_Net then -- FIXME: check index. return Target_Info'(Kind => Target_Simple, @@ -403,8 +399,7 @@ package body Synth.Stmts is procedure Synth_Assignment (Syn_Inst : Synth_Instance_Acc; Target : Target_Info; Val : Valtyp; - Loc : Node; - En : Net); + Loc : Node); -- Extract a part of VAL from a target aggregate at offset OFF (offset -- in the array). @@ -448,8 +443,7 @@ package body Synth.Stmts is Target : Node; Target_Typ : Type_Acc; Val : Valtyp; - Loc : Node; - En : Net) + Loc : Node) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Targ_Bnd : constant Bound_Type := Get_Array_Bound (Target_Typ, 1); @@ -464,7 +458,7 @@ package body Synth.Stmts is Assoc := Get_Associated_Expr (Choice); case Get_Kind (Choice) is when Iir_Kind_Choice_By_None => - Targ_Info := Synth_Target (Syn_Inst, Assoc, En); + Targ_Info := Synth_Target (Syn_Inst, Assoc); if Get_Element_Type_Flag (Choice) then Pos := Pos - 1; else @@ -474,7 +468,7 @@ package body Synth.Stmts is (Syn_Inst, Targ_Info, Aggregate_Extract (Ctxt, Val, Pos, Targ_Info.Targ_Type, Assoc), - Loc, En); + Loc); when others => Error_Kind ("synth_assignment_aggregate", Choice); end case; @@ -485,8 +479,7 @@ package body Synth.Stmts is procedure Synth_Assignment (Syn_Inst : Synth_Instance_Acc; Target : Target_Info; Val : Valtyp; - Loc : Node; - En : Net) + Loc : Node) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); V : Valtyp; @@ -501,7 +494,7 @@ package body Synth.Stmts is case Target.Kind is when Target_Aggregate => Synth_Assignment_Aggregate - (Syn_Inst, Target.Aggr, Target.Targ_Type, V, Loc, En); + (Syn_Inst, Target.Aggr, Target.Targ_Type, V, Loc); when Target_Simple => if V.Typ.Sz = 0 then -- If there is nothing to assign (like a null slice), @@ -555,13 +548,12 @@ package body Synth.Stmts is procedure Synth_Assignment (Syn_Inst : Synth_Instance_Acc; Target : Node; Val : Valtyp; - Loc : Node; - En : Net) + Loc : Node) is Info : Target_Info; begin - Info := Synth_Target (Syn_Inst, Target, En); - Synth_Assignment (Syn_Inst, Info, Val, Loc, En); + Info := Synth_Target (Syn_Inst, Target); + Synth_Assignment (Syn_Inst, Info, Val, Loc); end Synth_Assignment; function Synth_Read_Memory (Syn_Inst : Synth_Instance_Acc; @@ -610,19 +602,19 @@ package body Synth.Stmts is -- Concurrent or sequential simple signal assignment procedure Synth_Simple_Signal_Assignment - (Syn_Inst : Synth_Instance_Acc; Stmt : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Targ : Target_Info; Val : Valtyp; begin - Targ := Synth_Target (Syn_Inst, Get_Target (Stmt), En); + Targ := Synth_Target (Syn_Inst, Get_Target (Stmt)); Val := Synth_Waveform - (Syn_Inst, Get_Waveform_Chain (Stmt), Targ.Targ_Type, En); - Synth_Assignment (Syn_Inst, Targ, Val, Stmt, En); + (Syn_Inst, Get_Waveform_Chain (Stmt), Targ.Targ_Type); + Synth_Assignment (Syn_Inst, Targ, Val, Stmt); end Synth_Simple_Signal_Assignment; procedure Synth_Conditional_Signal_Assignment - (Syn_Inst : Synth_Instance_Acc; Stmt : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Ctxt : constant Context_Acc := Get_Build (Syn_Inst); Targ : Target_Info; @@ -634,13 +626,13 @@ package body Synth.Stmts is First, Last : Net; V : Net; begin - Targ := Synth_Target (Syn_Inst, Get_Target (Stmt), En); + Targ := Synth_Target (Syn_Inst, Get_Target (Stmt)); Last := No_Net; Cwf := Get_Conditional_Waveform_Chain (Stmt); Cond := Null_Node; while Cwf /= Null_Node loop Val := Synth_Waveform - (Syn_Inst, Get_Waveform_Chain (Cwf), Targ.Targ_Type, En); + (Syn_Inst, Get_Waveform_Chain (Cwf), Targ.Targ_Type); if Val = No_Valtyp then -- Mark the error, but try to continue. Set_Error (Syn_Inst); @@ -648,7 +640,7 @@ package body Synth.Stmts is V := Get_Net (Ctxt, Val); Cond := Get_Condition (Cwf); if Cond /= Null_Node then - Cond_Val := Synth_Expression (Syn_Inst, Cond, En); + Cond_Val := Synth_Expression (Syn_Inst, Cond); if Cond_Val = No_Valtyp then Cond_Net := Build_Const_UB32 (Ctxt, 0, 1); else @@ -679,23 +671,22 @@ package body Synth.Stmts is end if; end if; Val := Create_Value_Net (First, Targ.Targ_Type); - Synth_Assignment (Syn_Inst, Targ, Val, Stmt, En); + Synth_Assignment (Syn_Inst, Targ, Val, Stmt); end Synth_Conditional_Signal_Assignment; procedure Synth_Variable_Assignment (C : Seq_Context; Stmt : Node) is - En : constant Net := No_Net; Targ : Target_Info; Val : Valtyp; begin - Targ := Synth_Target (C.Inst, Get_Target (Stmt), En); + Targ := Synth_Target (C.Inst, Get_Target (Stmt)); Val := Synth_Expression_With_Type - (C.Inst, Get_Expression (Stmt), Targ.Targ_Type, En); + (C.Inst, Get_Expression (Stmt), Targ.Targ_Type); if Val = No_Valtyp then Set_Error (C.Inst); return; end if; - Synth_Assignment (C.Inst, Targ, Val, Stmt, En); + Synth_Assignment (C.Inst, Targ, Val, Stmt); end Synth_Variable_Assignment; procedure Synth_Conditional_Variable_Assignment @@ -703,7 +694,6 @@ package body Synth.Stmts is is Ctxt : constant Context_Acc := Get_Build (C.Inst); Target : constant Node := Get_Target (Stmt); - En : constant Net := No_Net; Targ_Type : Type_Acc; Cond : Node; Ce : Node; @@ -716,11 +706,11 @@ package body Synth.Stmts is Ce := Get_Conditional_Expression_Chain (Stmt); while Ce /= Null_Node loop Val := Synth_Expression_With_Type - (C.Inst, Get_Expression (Ce), Targ_Type, En); + (C.Inst, Get_Expression (Ce), Targ_Type); V := Get_Net (Ctxt, Val); Cond := Get_Condition (Ce); if Cond /= Null_Node then - Cond_Val := Synth_Expression (C.Inst, Cond, En); + Cond_Val := Synth_Expression (C.Inst, Cond); V := Build_Mux2 (Ctxt, Get_Net (Ctxt, Cond_Val), No_Net, V); Set_Location (V, Ce); end if; @@ -734,7 +724,7 @@ package body Synth.Stmts is Ce := Get_Chain (Ce); end loop; Val := Create_Value_Net (First, Targ_Type); - Synth_Assignment (C.Inst, Target, Val, Stmt, En); + Synth_Assignment (C.Inst, Target, Val, Stmt); end Synth_Conditional_Variable_Assignment; procedure Synth_If_Statement (C : in out Seq_Context; Stmt : Node) @@ -747,7 +737,7 @@ package body Synth.Stmts is Phi_True : Phi_Type; Phi_False : Phi_Type; begin - Cond_Val := Synth_Expression (C.Inst, Cond, No_Net); + Cond_Val := Synth_Expression (C.Inst, Cond); if Cond_Val = No_Valtyp then Set_Error (C.Inst); return; @@ -800,15 +790,15 @@ package body Synth.Stmts is end Synth_If_Statement; -- EXPR is a choice, so a locally static literal. - function Convert_To_Uns64 - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Uns64 + function Convert_To_Uns64 (Syn_Inst : Synth_Instance_Acc; Expr : Node) + return Uns64 is Expr_Val : Valtyp; Vec : Logvec_Array (0 .. 1); Off : Uns32; Has_Zx : Boolean; begin - Expr_Val := Synth_Expression_With_Basetype (Syn_Inst, Expr, En); + Expr_Val := Synth_Expression_With_Basetype (Syn_Inst, Expr); Off := 0; Has_Zx := False; Vec := (others => (0, 0)); @@ -1008,8 +998,7 @@ package body Synth.Stmts is Annex_Arr (Choice_Idx) := Int32 (Choice_Idx); Choice_Data (Choice_Idx) := (Val => Convert_To_Uns64 (C.Inst, - Get_Choice_Expression (Choice), - No_Net), + Get_Choice_Expression (Choice)), Alt => Alt_Idx); when Iir_Kind_Choice_By_Others => Others_Alt_Idx := Alt_Idx; @@ -1163,8 +1152,7 @@ package body Synth.Stmts is case Get_Kind (Choice) is when Iir_Kind_Choice_By_Expression => Sel_Expr := Get_Choice_Expression (Choice); - Sel_Val := Synth_Expression_With_Basetype - (C.Inst, Sel_Expr, No_Net); + Sel_Val := Synth_Expression_With_Basetype (C.Inst, Sel_Expr); if Is_Equal (Sel_Val, Sel) then Synth_Sequential_Statements (C, Stmts); exit; @@ -1236,7 +1224,7 @@ package body Synth.Stmts is Expr : constant Node := Get_Expression (Stmt); Sel : Valtyp; begin - Sel := Synth_Expression_With_Basetype (C.Inst, Expr, No_Net); + Sel := Synth_Expression_With_Basetype (C.Inst, Expr); Strip_Const (Sel); if Is_Static (Sel.Val) then case Sel.Typ.Kind is @@ -1257,7 +1245,7 @@ package body Synth.Stmts is end Synth_Case_Statement; procedure Synth_Selected_Signal_Assignment - (Syn_Inst : Synth_Instance_Acc; Stmt : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is use Vhdl.Sem_Expr; Ctxt : constant Context_Acc := Get_Build (Syn_Inst); @@ -1286,11 +1274,11 @@ package body Synth.Stmts is Sel : Valtyp; Sel_Net : Net; begin - Targ := Synth_Target (Syn_Inst, Get_Target (Stmt), En); + Targ := Synth_Target (Syn_Inst, Get_Target (Stmt)); Targ_Type := Targ.Targ_Type; -- Create a net for the expression. - Sel := Synth_Expression_With_Basetype (Syn_Inst, Expr, En); + Sel := Synth_Expression_With_Basetype (Syn_Inst, Expr); -- Count choices and alternatives. Count_Choices (Case_Info, Choices); @@ -1316,7 +1304,7 @@ package body Synth.Stmts is Alts (Alt_Idx).Val := Get_Net (Ctxt, Synth_Waveform - (Syn_Inst, Get_Associated_Chain (Choice), Targ_Type, En)); + (Syn_Inst, Get_Associated_Chain (Choice), Targ_Type)); end if; case Get_Kind (Choice) is @@ -1325,8 +1313,7 @@ package body Synth.Stmts is Annex_Arr (Choice_Idx) := Int32 (Choice_Idx); Choice_Data (Choice_Idx) := (Val => Convert_To_Uns64 (Syn_Inst, - Get_Choice_Expression (Choice), - No_Net), + Get_Choice_Expression (Choice)), Alt => Alt_Idx); when Iir_Kind_Choice_By_Others => Others_Alt_Idx := Alt_Idx; @@ -1375,7 +1362,7 @@ package body Synth.Stmts is Sel_Net, Case_El.all, Default, Res, Get_Location (Expr)); Synth_Assignment - (Syn_Inst, Targ, Create_Value_Net (Res, Targ_Type), Stmt, En); + (Syn_Inst, Targ, Create_Value_Net (Res, Targ_Type), Stmt); end; -- free. @@ -1570,7 +1557,6 @@ package body Synth.Stmts is procedure Synth_Subprogram_Association (Subprg_Inst : Synth_Instance_Acc; Caller_Inst : Synth_Instance_Acc; - En : Net; Init : Association_Iterator_Init; Infos : out Target_Info_Array) is @@ -1604,7 +1590,7 @@ package body Synth.Stmts is then Actual := Get_Default_Value (Inter); Val := Synth_Expression_With_Type - (Subprg_Inst, Actual, Inter_Type, En); + (Subprg_Inst, Actual, Inter_Type); else if Get_Kind (Assoc) = Iir_Kind_Association_Element_By_Expression @@ -1614,11 +1600,11 @@ package body Synth.Stmts is Actual := Assoc; end if; Val := Synth_Expression_With_Type - (Caller_Inst, Actual, Inter_Type, En); + (Caller_Inst, Actual, Inter_Type); end if; when Iir_Out_Mode | Iir_Inout_Mode => Actual := Get_Actual (Assoc); - Info := Synth_Target (Caller_Inst, Actual, En); + Info := Synth_Target (Caller_Inst, Actual); case Iir_Kinds_Interface_Object_Declaration (Get_Kind (Inter)) is @@ -1692,15 +1678,14 @@ package body Synth.Stmts is procedure Synth_Subprogram_Association (Subprg_Inst : Synth_Instance_Acc; Caller_Inst : Synth_Instance_Acc; Inter_Chain : Node; - Assoc_Chain : Node; - En : Net) + Assoc_Chain : Node) is Infos : Target_Info_Array (1 .. 0); pragma Unreferenced (Infos); Init : Association_Iterator_Init; begin Init := Association_Iterator_Build (Inter_Chain, Assoc_Chain); - Synth_Subprogram_Association (Subprg_Inst, Caller_Inst, En, Init, Infos); + Synth_Subprogram_Association (Subprg_Inst, Caller_Inst, Init, Infos); end Synth_Subprogram_Association; -- Create wires for out and inout interface variables. @@ -1738,7 +1723,6 @@ package body Synth.Stmts is procedure Synth_Subprogram_Back_Association (Subprg_Inst : Synth_Instance_Acc; Caller_Inst : Synth_Instance_Acc; - En : Net; Init : Association_Iterator_Init; Infos : Target_Info_Array) is @@ -1762,7 +1746,7 @@ package body Synth.Stmts is end if; Nbr_Inout := Nbr_Inout + 1; Val := Get_Value (Subprg_Inst, Inter); - Synth_Assignment (Caller_Inst, Infos (Nbr_Inout), Val, Assoc, En); + Synth_Assignment (Caller_Inst, Infos (Nbr_Inout), Val, Assoc); -- Free wire used for out/inout interface variables. if Val.Val.Kind = Value_Wire then @@ -1791,7 +1775,6 @@ package body Synth.Stmts is function Synth_Dynamic_Subprogram_Call (Syn_Inst : Synth_Instance_Acc; Sub_Inst : Synth_Instance_Acc; Call : Node; - En : Net; Init : Association_Iterator_Init; Infos : Target_Info_Array) return Valtyp @@ -1847,7 +1830,7 @@ package body Synth.Stmts is (C.W_Ret, Build_Control_Signal (Sub_Inst, 1, Imp)); Phi_Assign_Static (C.W_Ret, Bit1); - Decls.Synth_Declarations (C.Inst, Get_Declaration_Chain (Bod), En, True); + Decls.Synth_Declarations (C.Inst, Get_Declaration_Chain (Bod), True); if not Is_Error (C.Inst) then Synth_Sequential_Statements (C, Get_Sequential_Statement_Chain (Bod)); end if; @@ -1866,8 +1849,7 @@ package body Synth.Stmts is end if; else Res := No_Valtyp; - Synth_Subprogram_Back_Association - (C.Inst, Syn_Inst, En, Init, Infos); + Synth_Subprogram_Back_Association (C.Inst, Syn_Inst, Init, Infos); end if; end if; @@ -1923,7 +1905,7 @@ package body Synth.Stmts is C.Ret_Typ := Get_Subtype_Object (Syn_Inst, Get_Return_Type (Imp)); end if; - Synth_Declarations (C.Inst, Get_Declaration_Chain (Bod), No_Net, True); + Synth_Declarations (C.Inst, Get_Declaration_Chain (Bod), True); if not Is_Error (C.Inst) then Synth_Sequential_Statements (C, Get_Sequential_Statement_Chain (Bod)); @@ -1944,8 +1926,7 @@ package body Synth.Stmts is end if; else Res := No_Valtyp; - Synth_Subprogram_Back_Association - (C.Inst, Syn_Inst, No_Net, Init, Infos); + Synth_Subprogram_Back_Association (C.Inst, Syn_Inst, Init, Infos); end if; end if; @@ -1957,7 +1938,6 @@ package body Synth.Stmts is function Synth_Subprogram_Call (Syn_Inst : Synth_Instance_Acc; Call : Node; - En : Net; Init : Association_Iterator_Init) return Valtyp is @@ -1978,7 +1958,7 @@ package body Synth.Stmts is Sub_Inst := Make_Instance (Up_Inst, Bod, New_Internal_Name (Ctxt)); Set_Instance_Base (Sub_Inst, Syn_Inst); - Synth_Subprogram_Association (Sub_Inst, Syn_Inst, En, Init, Infos); + Synth_Subprogram_Association (Sub_Inst, Syn_Inst, Init, Infos); if Is_Error (Sub_Inst) then Res := No_Valtyp; @@ -1994,7 +1974,7 @@ package body Synth.Stmts is (Syn_Inst, Sub_Inst, Call, Init, Infos); else Res := Synth_Dynamic_Subprogram_Call - (Syn_Inst, Sub_Inst, Call, En, Init, Infos); + (Syn_Inst, Sub_Inst, Call, Init, Infos); end if; end if; @@ -2014,7 +1994,7 @@ package body Synth.Stmts is end Synth_Subprogram_Call; function Synth_Subprogram_Call - (Syn_Inst : Synth_Instance_Acc; Call : Node; En : Net) return Valtyp + (Syn_Inst : Synth_Instance_Acc; Call : Node) return Valtyp is Imp : constant Node := Get_Implementation (Call); Assoc_Chain : constant Node := Get_Parameter_Association_Chain (Call); @@ -2022,21 +2002,20 @@ package body Synth.Stmts is Init : Association_Iterator_Init; begin Init := Association_Iterator_Build (Inter_Chain, Assoc_Chain); - return Synth_Subprogram_Call (Syn_Inst, Call, En, Init); + return Synth_Subprogram_Call (Syn_Inst, Call, Init); end Synth_Subprogram_Call; function Synth_User_Operator (Syn_Inst : Synth_Instance_Acc; Left_Expr : Node; Right_Expr : Node; - Expr : Node; - En : Net) return Valtyp + Expr : Node) return Valtyp is Imp : constant Node := Get_Implementation (Expr); Inter_Chain : constant Node := Get_Interface_Declaration_Chain (Imp); Init : Association_Iterator_Init; begin Init := Association_Iterator_Build (Inter_Chain, Left_Expr, Right_Expr); - return Synth_Subprogram_Call (Syn_Inst, Expr, En, Init); + return Synth_Subprogram_Call (Syn_Inst, Expr, Init); end Synth_User_Operator; procedure Synth_Implicit_Procedure_Call @@ -2056,19 +2035,18 @@ package body Synth.Stmts is Areapools.Mark (Area_Mark, Instance_Pool.all); Sub_Inst := Make_Instance (Syn_Inst, Imp, New_Internal_Name (Ctxt)); - Synth_Subprogram_Association (Sub_Inst, Syn_Inst, No_Net, Init, Infos); + Synth_Subprogram_Association (Sub_Inst, Syn_Inst, Init, Infos); Synth.Static_Proc.Synth_Static_Procedure (Sub_Inst, Imp, Call); - Synth_Subprogram_Back_Association - (Sub_Inst, Syn_Inst, No_Net, Init, Infos); + Synth_Subprogram_Back_Association (Sub_Inst, Syn_Inst, Init, Infos); Free_Instance (Sub_Inst); Areapools.Release (Area_Mark, Instance_Pool.all); end Synth_Implicit_Procedure_Call; procedure Synth_Procedure_Call - (Syn_Inst : Synth_Instance_Acc; Stmt : Node; En : Net) + (Syn_Inst : Synth_Instance_Acc; Stmt : Node) is Call : constant Node := Get_Procedure_Call (Stmt); Imp : constant Node := Get_Implementation (Call); @@ -2080,7 +2058,7 @@ package body Synth.Stmts is Error_Msg_Synth (+Stmt, "call to foreign %n is not supported", +Imp); else - Res := Synth_Subprogram_Call (Syn_Inst, Call, En); + Res := Synth_Subprogram_Call (Syn_Inst, Call); pragma Assert (Res = No_Valtyp); end if; when others => @@ -2274,7 +2252,7 @@ package body Synth.Stmts is Phi_False : Phi_Type; begin if Cond /= Null_Node then - Cond_Val := Synth_Expression (C.Inst, Cond, No_Net); + Cond_Val := Synth_Expression (C.Inst, Cond); Static_Cond := Is_Static_Val (Cond_Val.Val); if Static_Cond then if Get_Static_Discrete (Cond_Val) = 0 then @@ -2337,7 +2315,7 @@ package body Synth.Stmts is Cond_Val : Valtyp; begin if Cond /= Null_Node then - Cond_Val := Synth_Expression (C.Inst, Cond, No_Net); + Cond_Val := Synth_Expression (C.Inst, Cond); if Cond_Val = No_Valtyp then Set_Error (C.Inst); return; @@ -2498,8 +2476,7 @@ package body Synth.Stmts is loop if Cond /= Null_Node then - Val := Synth_Expression_With_Type - (C.Inst, Cond, Boolean_Type, No_Net); + Val := Synth_Expression_With_Type (C.Inst, Cond, Boolean_Type); if not Is_Static (Val.Val) then Error_Msg_Synth (+Cond, "loop condition must be static"); exit; @@ -2546,8 +2523,7 @@ package body Synth.Stmts is loop if Cond /= Null_Node then - Val := Synth_Expression_With_Type - (C.Inst, Cond, Boolean_Type, No_Net); + Val := Synth_Expression_With_Type (C.Inst, Cond, Boolean_Type); pragma Assert (Is_Static (Val.Val)); exit when Read_Discrete (Val) = 0; end if; @@ -2571,8 +2547,7 @@ package body Synth.Stmts is begin if Expr /= Null_Node then -- Return in function. - Val := Synth_Expression_With_Type - (C.Inst, Expr, C.Ret_Typ, No_Net); + Val := Synth_Expression_With_Type (C.Inst, Expr, C.Ret_Typ); if Val = No_Valtyp then Set_Error (C.Inst); return; @@ -2624,7 +2599,7 @@ package body Synth.Stmts is Sev_V : Natural; begin if Rep_Expr /= Null_Node then - Rep := Synth_Expression_With_Basetype (C.Inst, Rep_Expr, No_Net); + Rep := Synth_Expression_With_Basetype (C.Inst, Rep_Expr); if Rep = No_Valtyp then Set_Error (C.Inst); return; @@ -2632,7 +2607,7 @@ package body Synth.Stmts is Strip_Const (Rep); end if; if Sev_Expr /= Null_Node then - Sev := Synth_Expression (C.Inst, Sev_Expr, No_Net); + Sev := Synth_Expression (C.Inst, Sev_Expr); if Sev = No_Valtyp then Set_Error (C.Inst); return; @@ -2683,8 +2658,7 @@ package body Synth.Stmts is is Cond : Valtyp; begin - Cond := Synth_Expression - (C.Inst, Get_Assertion_Condition (Stmt), No_Net); + Cond := Synth_Expression (C.Inst, Get_Assertion_Condition (Stmt)); if Cond = No_Valtyp then Set_Error (C.Inst); return; @@ -2706,8 +2680,7 @@ package body Synth.Stmts is En : Net; Inst : Instance; begin - Cond := Synth_Expression - (C.Inst, Get_Assertion_Condition (Stmt), No_Net); + Cond := Synth_Expression (C.Inst, Get_Assertion_Condition (Stmt)); if Cond = No_Valtyp then Set_Error (C.Inst); return; @@ -2762,9 +2735,9 @@ package body Synth.Stmts is when Iir_Kind_If_Statement => Synth_If_Statement (C, Stmt); when Iir_Kind_Simple_Signal_Assignment_Statement => - Synth_Simple_Signal_Assignment (C.Inst, Stmt, No_Net); + Synth_Simple_Signal_Assignment (C.Inst, Stmt); when Iir_Kind_Conditional_Signal_Assignment_Statement => - Synth_Conditional_Signal_Assignment (C.Inst, Stmt, No_Net); + Synth_Conditional_Signal_Assignment (C.Inst, Stmt); when Iir_Kind_Variable_Assignment_Statement => Synth_Variable_Assignment (C, Stmt); when Iir_Kind_Conditional_Variable_Assignment_Statement => @@ -2789,7 +2762,7 @@ package body Synth.Stmts is when Iir_Kind_Return_Statement => Synth_Return_Statement (C, Stmt); when Iir_Kind_Procedure_Call_Statement => - Synth_Procedure_Call (C.Inst, Stmt, No_Net); + Synth_Procedure_Call (C.Inst, Stmt); when Iir_Kind_Report_Statement => if not Is_Dyn then Synth_Static_Report_Statement (C, Stmt); @@ -2858,7 +2831,7 @@ package body Synth.Stmts is Error_Msg_Synth (+Stmt, "expect wait condition"); return; end if; - Cond_Val := Synth_Expression (C.Inst, Cond, No_Net); + Cond_Val := Synth_Expression (C.Inst, Cond); Push_Phi; Synth_Sequential_Statements (C, Get_Chain (Stmt)); @@ -2897,12 +2870,11 @@ package body Synth.Stmts is Ret_Typ => null, Nbr_Ret => 0); - Mark (M, Proc_Pool); Instance_Pool := Proc_Pool'Access; if Is_Valid (Decls_Chain) then - Synth_Declarations (C.Inst, Decls_Chain, No_Net); + Synth_Declarations (C.Inst, Decls_Chain); end if; Set_Wire_Gate (C.W_En, Build_Control_Signal (Syn_Inst, 1, Proc)); @@ -2925,7 +2897,7 @@ package body Synth.Stmts is end Synth_Process_Statement; function Synth_User_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp is + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp is begin -- Is it a call to an ieee function ? declare @@ -2950,7 +2922,7 @@ package body Synth.Stmts is end if; end; - return Synth_Subprogram_Call (Syn_Inst, Expr, En); + return Synth_Subprogram_Call (Syn_Inst, Expr); end Synth_User_Function_Call; -- Report an assertion failure (that is known to failed). @@ -2961,7 +2933,7 @@ package body Synth.Stmts is Str : Valtyp; begin if Msg /= Null_Node then - Str := Synth_Expression_With_Basetype (Syn_Inst, Msg, No_Net); + Str := Synth_Expression_With_Basetype (Syn_Inst, Msg); else Str := No_Valtyp; end if; @@ -2981,7 +2953,7 @@ package body Synth.Stmts is Val : Valtyp; Inst : Instance; begin - Val := Synth_Expression (Syn_Inst, Cond, No_Net); + Val := Synth_Expression (Syn_Inst, Cond); if Val = No_Valtyp then Set_Error (Syn_Inst); return; @@ -3019,7 +2991,7 @@ package body Synth.Stmts is Mark (M, Proc_Pool); Instance_Pool := Proc_Pool'Access; - Synth_Declarations (Blk_Inst, Get_Declaration_Chain (Blk), No_Net); + Synth_Declarations (Blk_Inst, Get_Declaration_Chain (Blk)); Synth_Concurrent_Statements (Blk_Inst, Get_Concurrent_Statement_Chain (Blk)); @@ -3043,7 +3015,7 @@ package body Synth.Stmts is declare E : constant Vhdl.Types.Vhdl_Node := Get_HDL_Node (Expr); begin - return Get_Net (Ctxt, Synth_Expression (Syn_Inst, E, No_Net)); + return Get_Net (Ctxt, Synth_Expression (Syn_Inst, E)); end; when N_Not_Bool => pragma Assert (Loc /= No_Location); @@ -3335,7 +3307,7 @@ package body Synth.Stmts is Create_Object (Bod_Inst, Iterator, Iterator_Val); end if; - Synth_Declarations (Bod_Inst, Decls_Chain, No_Net); + Synth_Declarations (Bod_Inst, Decls_Chain); Synth_Concurrent_Statements (Bod_Inst, Get_Concurrent_Statement_Chain (Bod)); @@ -3359,7 +3331,7 @@ package body Synth.Stmts is loop Icond := Get_Condition (Gen); if Icond /= Null_Node then - Cond := Synth_Expression (Syn_Inst, Icond, No_Net); + Cond := Synth_Expression (Syn_Inst, Icond); Strip_Const (Cond); else -- It is the else generate. @@ -3438,19 +3410,19 @@ package body Synth.Stmts is case Get_Kind (Stmt) is when Iir_Kind_Concurrent_Simple_Signal_Assignment => Push_Phi; - Synth_Simple_Signal_Assignment (Syn_Inst, Stmt, No_Net); + Synth_Simple_Signal_Assignment (Syn_Inst, Stmt); Pop_And_Merge_Phi (Ctxt, Stmt); when Iir_Kind_Concurrent_Conditional_Signal_Assignment => Push_Phi; - Synth_Conditional_Signal_Assignment (Syn_Inst, Stmt, No_Net); + Synth_Conditional_Signal_Assignment (Syn_Inst, Stmt); Pop_And_Merge_Phi (Ctxt, Stmt); when Iir_Kind_Concurrent_Selected_Signal_Assignment => Push_Phi; - Synth_Selected_Signal_Assignment (Syn_Inst, Stmt, No_Net); + Synth_Selected_Signal_Assignment (Syn_Inst, Stmt); Pop_And_Merge_Phi (Ctxt, Stmt); when Iir_Kind_Concurrent_Procedure_Call_Statement => Push_Phi; - Synth_Procedure_Call (Syn_Inst, Stmt, No_Net); + Synth_Procedure_Call (Syn_Inst, Stmt); Pop_And_Merge_Phi (Ctxt, Stmt); when Iir_Kinds_Process_Statement => Push_Phi; @@ -3539,7 +3511,7 @@ package body Synth.Stmts is -- The value must be true V := Synth_Expression_With_Type - (Syn_Inst, Get_Expression (Spec), Boolean_Type, No_Net); + (Syn_Inst, Get_Expression (Spec), Boolean_Type); if Read_Discrete (V) /= 1 then return; end if; @@ -3551,7 +3523,7 @@ package body Synth.Stmts is Base : Valtyp; Typ : Type_Acc; begin - Synth_Assignment_Prefix (Syn_Inst, Sig, No_Net, Base, Typ, Off, Dyn); + Synth_Assignment_Prefix (Syn_Inst, Sig, Base, Typ, Off, Dyn); pragma Assert (Off = (0, 0)); pragma Assert (Dyn.Voff = No_Net); pragma Assert (Base.Val.Kind = Value_Wire); @@ -3629,7 +3601,7 @@ package body Synth.Stmts is | Iir_Kind_Procedure_Body | Iir_Kind_Attribute_Declaration | Iir_Kind_Attribute_Specification => - Synth_Declaration (Unit_Inst, Item, No_Net, False, Last_Type); + Synth_Declaration (Unit_Inst, Item, False, Last_Type); when Iir_Kind_Concurrent_Simple_Signal_Assignment => Synth_Concurrent_Statement (Unit_Inst, Item); when others => diff --git a/src/synth/synth-stmts.ads b/src/synth/synth-stmts.ads index 330cf156e..db536e02d 100644 --- a/src/synth/synth-stmts.ads +++ b/src/synth/synth-stmts.ads @@ -32,8 +32,7 @@ package Synth.Stmts is procedure Synth_Subprogram_Association (Subprg_Inst : Synth_Instance_Acc; Caller_Inst : Synth_Instance_Acc; Inter_Chain : Node; - Assoc_Chain : Node; - En : Net); + Assoc_Chain : Node); -- Dynamic index for Synth_Assignment_Prefix. -- As dynamic is about dynamic (!) index, the index is a net. @@ -59,7 +58,6 @@ package Synth.Stmts is -- DEST_DYN is set (Voff field set) when there is a non-static index. procedure Synth_Assignment_Prefix (Syn_Inst : Synth_Instance_Acc; Pfx : Node; - En : Net; Dest_Base : out Valtyp; Dest_Typ : out Type_Acc; Dest_Off : out Value_Offsets; @@ -68,8 +66,7 @@ package Synth.Stmts is procedure Synth_Assignment (Syn_Inst : Synth_Instance_Acc; Target : Node; Val : Valtyp; - Loc : Node; - En : Net); + Loc : Node); function Synth_Read_Memory (Syn_Inst : Synth_Instance_Acc; Obj : Valtyp; @@ -79,14 +76,13 @@ package Synth.Stmts is Loc : Node) return Valtyp; function Synth_User_Function_Call - (Syn_Inst : Synth_Instance_Acc; Expr : Node; En : Net) return Valtyp; + (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Valtyp; -- Operation implemented by a user function. function Synth_User_Operator (Syn_Inst : Synth_Instance_Acc; Left_Expr : Node; Right_Expr : Node; - Expr : Node; - En : Net) return Valtyp; + Expr : Node) return Valtyp; -- Generate netlists for concurrent statements STMTS. procedure Synth_Concurrent_Statements |