From c138b798d1830e255b4d8a9b229fe620db363919 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 13 Mar 2020 05:32:56 +0100 Subject: netlists: handle more case of 0 sized nets. --- src/synth/netlists-builders.adb | 2 -- src/synth/netlists-disp_vhdl.adb | 1 - src/synth/netlists-expands.adb | 5 +++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 99a7563fe..812679ef1 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -818,7 +818,6 @@ package body Netlists.Builders is function Build_Const_Z (Ctxt : Context_Acc; W : Width) return Net is - pragma Assert (W > 0); Inst : Instance; O : Net; begin @@ -1422,7 +1421,6 @@ package body Netlists.Builders is (Ctxt : Context_Acc; I : Net; Off, W : Width) return Net is Wd : constant Width := Get_Width (I); - pragma Assert (Wd /= No_Width); pragma Assert (W + Off <= Wd); Inst : Instance; O : Net; diff --git a/src/synth/netlists-disp_vhdl.adb b/src/synth/netlists-disp_vhdl.adb index 4bbaaef31..387665705 100644 --- a/src/synth/netlists-disp_vhdl.adb +++ b/src/synth/netlists-disp_vhdl.adb @@ -1082,7 +1082,6 @@ package body Netlists.Disp_Vhdl is Ow : constant Width := Get_Width (Get_Output (Inst, 0)); Iw : constant Width := Get_Width (Get_Input_Net (Inst, 0)); begin - pragma Assert (Iw > 0); pragma Assert (Ow > Iw); Disp_Template (" \o0 <= ", Inst); if Iw = 1 then diff --git a/src/synth/netlists-expands.adb b/src/synth/netlists-expands.adb index 37ff24bf7..09ff5d9c4 100644 --- a/src/synth/netlists-expands.adb +++ b/src/synth/netlists-expands.adb @@ -236,6 +236,11 @@ package body Netlists.Expands is J : Int32; Step : Int32; begin + if W = 0 then + Net_Arr (0) := Build_Const_UB32 (Ctxt, 1, 1); + return; + end if; + for I in reverse 0 .. W - 1 loop V1 := Build_Extract_Bit (Ctxt, Addr, I); V0 := Build_Monadic (Ctxt, Id_Not, V1); -- cgit v1.2.3