diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-10-03 07:51:38 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-10-03 07:51:38 +0200 |
commit | a5a6341a06540617f2dc45521c92a5f1c88fb9e6 (patch) | |
tree | d384f1c0fc8b64012c4de4192d34272c20ed6f01 /src/synth/netlists-builders.adb | |
parent | 1f9df2cb2c21dc8be2f1dfd76919575afe814264 (diff) | |
download | ghdl-a5a6341a06540617f2dc45521c92a5f1c88fb9e6.tar.gz ghdl-a5a6341a06540617f2dc45521c92a5f1c88fb9e6.tar.bz2 ghdl-a5a6341a06540617f2dc45521c92a5f1c88fb9e6.zip |
synth: replace memidx2 by addidx; handle some 2d arrays.
Diffstat (limited to 'src/synth/netlists-builders.adb')
-rw-r--r-- | src/synth/netlists-builders.adb | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 7c95fd68c..73c86929b 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -264,21 +264,23 @@ package body Netlists.Builders is Typ => Param_Uns32), 1 => (New_Sname_Artificial (Get_Identifier ("max")), Typ => Param_Uns32))); + end Create_Memidx_Module; + procedure Create_Addidx_Module (Ctxt : Context_Acc) + is + Outputs : Port_Desc_Array (0 .. 0); + Inputs : Port_Desc_Array (0 .. 1); + Res : Module; + begin Res := New_User_Module - (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("memidx2")), - Id_Memidx2, 2, 1, 2); - Ctxt.M_Memidx2 := Res; + (Ctxt.Design, New_Sname_Artificial (Get_Identifier ("addidx")), + Id_Addidx, 2, 1, 0); + Ctxt.M_Addidx := Res; Outputs := (0 => Create_Output ("o")); - Inputs := (0 => Create_Input ("i"), - 1 => Create_Input ("add")); + Inputs := (0 => Create_Input ("i0"), + 1 => Create_Input ("i1")); Set_Port_Desc (Res, Inputs, Outputs); - Set_Param_Desc - (Res, (0 => (New_Sname_Artificial (Get_Identifier ("step")), - Typ => Param_Uns32), - 1 => (New_Sname_Artificial (Get_Identifier ("max")), - Typ => Param_Uns32))); - end Create_Memidx_Module; + end Create_Addidx_Module; procedure Create_Edge_Module (Ctxt : Context_Acc; Res : out Module; @@ -512,6 +514,7 @@ package body Netlists.Builders is Create_Dyn_Extract_Module (Res); Create_Dyn_Insert_Module (Res); Create_Memidx_Module (Res); + Create_Addidx_Module (Res); Create_Monadic_Module (Design, Res.M_Truncate (Id_Utrunc), Get_Identifier ("utrunc"), Id_Utrunc); @@ -993,26 +996,22 @@ package body Netlists.Builders is return O; end Build_Memidx1; - function Build_Memidx2 - (Ctxt : Context_Acc; - I : Net; Add : Net; Step : Uns32; Max : Uns32; W : Width) return Net + function Build_Addidx (Ctxt : Context_Acc; L, R : Net) return Net is - pragma Assert (Get_Width (I) /= No_Width); - pragma Assert (Get_Width (Add) /= No_Width); - pragma Assert (Step > 0); - pragma Assert (W > 0); + Wl : constant Width := Get_Width (L); + Wr : constant Width := Get_Width (R); + pragma Assert (Wl > 0); + pragma Assert (Wr > 0); Inst : Instance; O : Net; begin - Inst := New_Internal_Instance (Ctxt, Ctxt.M_Memidx2); + Inst := New_Internal_Instance (Ctxt, Ctxt.M_Addidx); O := Get_Output (Inst, 0); - Set_Width (O, W); - Connect (Get_Input (Inst, 0), I); - Connect (Get_Input (Inst, 1), Add); - Set_Param_Uns32 (Inst, 0, Step); - Set_Param_Uns32 (Inst, 1, Max); + Set_Width (O, Width'Max (Wl, Wr)); + Connect (Get_Input (Inst, 0), L); + Connect (Get_Input (Inst, 1), R); return O; - end Build_Memidx2; + end Build_Addidx; function Build_Object (Ctxt : Context_Acc; M : Module; W : Width) return Net is |