From 7491d9ff10c9ae17d917832d9e1b25a84af94e06 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 5 Dec 2019 22:34:38 +0100 Subject: netlists-memories: avoid a crash when no read. Fix #1018 --- src/synth/netlists-memories.adb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3