diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-09-12 04:51:13 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-09-12 04:51:13 +0200 |
commit | 2f50d278e367f64e1cd53b248c38c27add86981f (patch) | |
tree | 92d9a2d2321b1dfbdd7b05014d0e53e6b5d32ac3 | |
parent | 43f89567b80e89dfcec9392552cc80e97a322230 (diff) | |
download | ghdl-2f50d278e367f64e1cd53b248c38c27add86981f.tar.gz ghdl-2f50d278e367f64e1cd53b248c38c27add86981f.tar.bz2 ghdl-2f50d278e367f64e1cd53b248c38c27add86981f.zip |
synth: allow empty string literal.
-rw-r--r-- | src/synth/netlists-builders.adb | 1 | ||||
-rw-r--r-- | src/synth/synth-context.adb | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/synth/netlists-builders.adb b/src/synth/netlists-builders.adb index 418daf308..f8c28eb01 100644 --- a/src/synth/netlists-builders.adb +++ b/src/synth/netlists-builders.adb @@ -620,7 +620,6 @@ package body Netlists.Builders is Val : Uns32; W : Width) return Net is - pragma Assert (W > 0); Inst : Instance; O : Net; begin diff --git a/src/synth/synth-context.adb b/src/synth/synth-context.adb index 77ed71856..bced2e633 100644 --- a/src/synth/synth-context.adb +++ b/src/synth/synth-context.adb @@ -329,7 +329,10 @@ package body Synth.Context is Has_Zx := False; Off := 0; Value2net (Val, Vec, Off, Has_Zx); - if W <= 32 then + if W = 0 then + -- For null range (like the null string literal "") + Res := Build_Const_UB32 (Build_Context, 0, 0); + elsif W <= 32 then -- 32 bit result. if not Has_Zx then Res := Build_Const_UB32 (Build_Context, Vec (0).Val, W); |