diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-11-05 18:59:04 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-11-05 18:59:04 +0100 |
commit | 7359cb0eba5d395062bdb8dd587d09f1db544f05 (patch) | |
tree | 3d5be99c9570d3c38d766589f1ac3f26345260ea /src/synth/netlists-builders.adb | |
parent | ecc117b872aec5b4673de32028a7c36060d05eec (diff) | |
download | ghdl-7359cb0eba5d395062bdb8dd587d09f1db544f05.tar.gz ghdl-7359cb0eba5d395062bdb8dd587d09f1db544f05.tar.bz2 ghdl-7359cb0eba5d395062bdb8dd587d09f1db544f05.zip |
synth: extract netlists-folds from netlists-builders.
Diffstat (limited to 'src/synth/netlists-builders.adb')
-rw-r--r-- | src/synth/netlists-builders.adb | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index b1f9eb826..d7bb2c117 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -21,7 +21,6 @@ with Types_Utils; use Types_Utils; with Name_Table; use Name_Table; with Std_Names; use Std_Names; -with Netlists.Locations; package body Netlists.Builders is function Create_Input (Id : String; W : Width := 0) return Port_Desc is @@ -831,69 +830,6 @@ package body Netlists.Builders is return Inst; end Build_Const_Log; - function Build2_Const_Uns (Ctxt : Context_Acc; Val : Uns64; W : Width) - return Net is - begin - if Val < 2**32 then - return Build_Const_UB32 (Ctxt, Uns32 (Val), W); - else - pragma Assert (W > 32); - declare - Inst : Instance; - begin - Inst := Build_Const_Bit (Ctxt, W); - Set_Param_Uns32 (Inst, 0, Uns32 (Val and 16#ffff_ffff#)); - Set_Param_Uns32 (Inst, 1, Uns32 (Shift_Right (Val, 32))); - for I in 2 .. (W + 31) / 32 loop - Set_Param_Uns32 (Inst, Param_Idx (I), 0); - end loop; - return Get_Output (Inst, 0); - end; - end if; - end Build2_Const_Uns; - - function Build2_Const_Vec (Ctxt : Context_Acc; W : Width; V : Uns32_Arr) - return Net is - begin - if W <= 32 then - return Build_Const_UB32 (Ctxt, V (V'First), W); - else - declare - Inst : Instance; - begin - Inst := Build_Const_Bit (Ctxt, W); - for I in V'Range loop - Set_Param_Uns32 (Inst, Param_Idx (I - V'First), V (I)); - end loop; - return Get_Output (Inst, 0); - end; - end if; - end Build2_Const_Vec; - - function Build2_Const_Int (Ctxt : Context_Acc; Val : Int64; W : Width) - return Net is - begin - if Val in -2**31 .. 2**31 - 1 then - return Build_Const_SB32 (Ctxt, Int32 (Val), W); - else - pragma Assert (W > 32); - declare - V : constant Uns64 := To_Uns64 (Val); - S : constant Uns32 := - Uns32 (Shift_Right_Arithmetic (V, 63) and 16#ffff_ffff#); - Inst : Instance; - begin - Inst := Build_Const_Bit (Ctxt, W); - Set_Param_Uns32 (Inst, 0, Uns32 (V and 16#ffff_ffff#)); - Set_Param_Uns32 (Inst, 1, Uns32 (Shift_Right (V, 32))); - for I in 2 .. (W + 31) / 32 loop - Set_Param_Uns32 (Inst, Param_Idx (I), S); - end loop; - return Get_Output (Inst, 0); - end; - end if; - end Build2_Const_Int; - function Build_Edge (Ctxt : Context_Acc; Src : Net) return Net is pragma Assert (Get_Width (Src) = 1); @@ -1012,42 +948,6 @@ package body Netlists.Builders is return O; end Build_Concatn; - function Build2_Concat (Ctxt : Context_Acc; Els : Net_Array) return Net - is - F : constant Int32 := Els'First; - Len : constant Natural := Els'Length; - Wd : Width; - Inst : Instance; - N : Net; - begin - case Len is - when 0 => - raise Internal_Error; - when 1 => - N := Els (F); - when 2 => - N := Build_Concat2 (Ctxt, Els (F + 1), Els (F)); - when 3 => - N := Build_Concat3 (Ctxt, Els (F + 2), Els (F + 1), Els (F)); - when 4 => - N := Build_Concat4 - (Ctxt, Els (F + 3), Els (F + 2), Els (F + 1), Els (F)); - when 5 .. Natural'Last => - -- Compute length. - Wd := 0; - for I in Els'Range loop - Wd := Wd + Get_Width (Els (I)); - end loop; - - N := Build_Concatn (Ctxt, Wd, Uns32 (Len)); - Inst := Get_Net_Parent (N); - for I in Els'Range loop - Connect (Get_Input (Inst, Port_Idx (Els'Last - I)), Els (I)); - end loop; - end case; - return N; - end Build2_Concat; - function Build_Trunc (Ctxt : Context_Acc; Id : Module_Id; I : Net; W : Width) return Net is @@ -1076,29 +976,6 @@ package body Netlists.Builders is return O; end Build_Extend; - function Build2_Uresize (Ctxt : Context_Acc; - I : Net; - W : Width; - Loc : Location_Type := No_Location) - return Net - is - Wn : constant Width := Get_Width (I); - Res : Net; - begin - if Wn = W then - return I; - else - if Wn > W then - Res := Build_Trunc (Ctxt, Id_Utrunc, I, W); - else - pragma Assert (Wn < W); - Res := Build_Extend (Ctxt, Id_Uextend, I, W); - end if; - Locations.Set_Location (Res, Loc); - return Res; - end if; - end Build2_Uresize; - function Build_Dyn_Insert (Ctxt : Context_Acc; I : Net; V : Net; P : Net; Off : Uns32) return Net is @@ -1410,16 +1287,6 @@ package body Netlists.Builders is return O; end Build_Extract; - function Build2_Extract - (Ctxt : Context_Acc; I : Net; Off, W : Width) return Net is - begin - if Off = 0 and then W = Get_Width (I) then - return I; - else - return Build_Extract (Ctxt, I, Off, W); - end if; - end Build2_Extract; - function Build_Dyn_Extract (Ctxt : Context_Acc; I : Net; P : Net; Off : Uns32; W : Width) return Net is |