diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-03-29 09:57:01 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-03-29 09:57:01 +0200 |
commit | 49858bd37724c2e1f8aba208fbc7b92a54cbe46a (patch) | |
tree | c43260b2c258750bab91cb3bfc529dafd7ebcb3c /src/synth/netlists-memories.adb | |
parent | c742f92ae4a1f8363a3a9df34f7ba3f251b3c971 (diff) | |
download | ghdl-49858bd37724c2e1f8aba208fbc7b92a54cbe46a.tar.gz ghdl-49858bd37724c2e1f8aba208fbc7b92a54cbe46a.tar.bz2 ghdl-49858bd37724c2e1f8aba208fbc7b92a54cbe46a.zip |
synth: improve output of memory initial value.
Diffstat (limited to 'src/synth/netlists-memories.adb')
-rw-r--r-- | src/synth/netlists-memories.adb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index 38e1e4b64..4833f16f0 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -977,11 +977,16 @@ package body Netlists.Memories is N : Net; begin N := Build_Const_UB32 (Ctxt, 0, Mem_Wd); - Copy_Const_Content - (Cst, Off, Cst_Wd, Get_Net_Parent (N), Wd, Depth, - Copy_Mode_Bit); + -- 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); + end if; return N; end; + when Id_Const_X => + return Build_Const_X (Ctxt, Mem_Wd); when others => raise Internal_Error; end case; |