aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-05-29 18:39:34 +0200
committerTristan Gingold <tgingold@free.fr>2020-05-29 18:56:33 +0200
commit36cf92801b25119b12b300eef517e7e85c796efb (patch)
tree6806cb5369c5b1619a9d801f907b2a9b8c242c62 /src
parent633f76ee936e55de71262a2eba164e8abfe8fa26 (diff)
downloadghdl-36cf92801b25119b12b300eef517e7e85c796efb.tar.gz
ghdl-36cf92801b25119b12b300eef517e7e85c796efb.tar.bz2
ghdl-36cf92801b25119b12b300eef517e7e85c796efb.zip
netlists: handle UL32 in memory initial value.
Diffstat (limited to 'src')
-rw-r--r--src/synth/netlists-disp_vhdl.adb12
-rw-r--r--src/synth/netlists-memories.adb19
2 files changed, 27 insertions, 4 deletions
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 =>