From 36cf92801b25119b12b300eef517e7e85c796efb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 29 May 2020 18:39:34 +0200 Subject: netlists: handle UL32 in memory initial value. --- src/synth/netlists-disp_vhdl.adb | 12 +++++++++++- src/synth/netlists-memories.adb | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb index 513dadbbb..6a013ed93 100644 --- a/src/synth/netlists-disp_vhdl.adb +++ b/src/synth/netlists-disp_vhdl.adb @@ -432,10 +432,20 @@ package body Netlists.Disp_Vhdl is Zx := 0; if Off < 32 then Val := Get_Param_Uns32 (Inst, 0); + Val := Shift_Right (Val, Natural (Off mod 32)) and 1; else Val := 0; end if; - Val := Shift_Right (Val, Natural (Off mod 32)) and 1; + when Id_Const_UL32 => + if Off < 32 then + Val := Get_Param_Uns32 (Inst, 0); + Val := Shift_Right (Val, Natural (Off mod 32)) and 1; + Zx := Get_Param_Uns32 (Inst, 1); + Zx := Shift_Right (Zx, Natural (Off mod 32)) and 1; + else + Val := 0; + Zx := 0; + end if; when Id_Const_X => Zx := 1; Val := 1; diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index e4e4115ed..8129c7968 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -1326,12 +1326,25 @@ package body Netlists.Memories is N := Build_Const_UB32 (Ctxt, 0, Mem_Wd); -- Optimize: no need to copy if the value is 0. if Get_Param_Uns32 (Cst, 0) /= 0 then - Copy_Const_Content - (Cst, Off, Cst_Wd, Get_Net_Parent (N), Wd, Depth, - Copy_Mode_Bit); + Res := Get_Net_Parent (N); + Copy_Const_Content (Cst, Off, Cst_Wd, Res, Wd, Depth, + Copy_Mode_Bit); end if; return N; end; + when Id_Const_UL32 => + declare + N : Net; + begin + N := Build_Const_UL32 (Ctxt, 0, 0, Mem_Wd); + -- Optimize: no need to copy if the value is 0. + Res := Get_Net_Parent (N); + Copy_Const_Content (Cst, Off, Cst_Wd, Res, Wd, Depth, + Copy_Mode_Val); + Copy_Const_Content (Cst, Off, Cst_Wd, Res, Wd, Depth, + Copy_Mode_Zx); + return N; + end; when Id_Const_X => return Build_Const_X (Ctxt, Mem_Wd); when others => -- cgit v1.2.3