diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-12-05 22:34:38 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-12-05 22:34:46 +0100 |
commit | 7491d9ff10c9ae17d917832d9e1b25a84af94e06 (patch) | |
tree | 8add53f62cf9687a0fa0815ad565cd0f61666350 /src | |
parent | 82581d8eb3b76543f96fbfc3354ab256b3de54ee (diff) | |
download | ghdl-7491d9ff10c9ae17d917832d9e1b25a84af94e06.tar.gz ghdl-7491d9ff10c9ae17d917832d9e1b25a84af94e06.tar.bz2 ghdl-7491d9ff10c9ae17d917832d9e1b25a84af94e06.zip |
netlists-memories: avoid a crash when no read. Fix #1018
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/netlists-memories.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/synth/netlists-memories.adb b/src/synth/netlists-memories.adb index b658d8aa1..1f3bfa45e 100644 --- a/src/synth/netlists-memories.adb +++ b/src/synth/netlists-memories.adb @@ -165,6 +165,7 @@ package body Netlists.Memories is -- Check data width. W := Get_Width (Get_Output (Extr_Inst, 0)); if Data_W = 0 then + pragma Assert (W /= 0); Data_W := W; elsif Data_W /= W then Info_Msg_Synth @@ -190,7 +191,12 @@ package body Netlists.Memories is end loop; end; - Size := Get_Width (Orig_Net) / Data_W; + if Data_W = 0 then + Info_Msg_Synth (+Orig, "memory %n is never read", (1 => +Orig)); + Data_W := 0; + else + Size := Get_Width (Orig_Net) / Data_W; + end if; end Check_Memory_Read_Ports; procedure Check_Memory_Write_Ports (Orig : Instance; |