diff options
-rw-r--r-- | src/synth/netlists.adb | 4 | ||||
-rw-r--r-- | src/synth/synth-decls.adb | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb index 5a8b6e38d..18ca51992 100644 --- a/src/synth/netlists.adb +++ b/src/synth/netlists.adb @@ -1106,7 +1106,6 @@ package body Netlists is function Create_Pval4 (Len : Uns32) return Pval is - pragma Assert (Len > 0); Nwords : constant Uns32 := (Len + 31) / 32; Idx : constant Uns32 := Pval_Word_Table.Last + 1; Res : Uns32; @@ -1121,7 +1120,6 @@ package body Netlists is function Create_Pval2 (Len : Uns32) return Pval is - pragma Assert (Len > 0); Nwords : constant Uns32 := (Len + 31) / 32; Idx : constant Uns32 := Pval_Word_Table.Last + 1; Res : Uns32; @@ -1145,6 +1143,7 @@ package body Netlists is is pragma Assert (P <= Pval_Table.Last); Pval_Rec : Pval_Record renames Pval_Table.Table (P); + pragma Assert (Pval_Rec.Len > 0); pragma Assert (Off <= (Pval_Rec.Len - 1) / 32); Res : Logic_32; begin @@ -1161,6 +1160,7 @@ package body Netlists is is pragma Assert (P <= Pval_Table.Last); Pval_Rec : Pval_Record renames Pval_Table.Table (P); + pragma Assert (Pval_Rec.Len > 0); pragma Assert (Off <= (Pval_Rec.Len - 1) / 32); begin Pval_Word_Table.Table (Pval_Rec.Va_Idx + Off) := Val.Val; diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb index f1835e5b9..d3a903b00 100644 --- a/src/synth/synth-decls.adb +++ b/src/synth/synth-decls.adb @@ -93,12 +93,15 @@ package body Synth.Decls is function Memtyp_To_Pval (Mt : Memtyp) return Pval is Len : constant Uns32 := (Mt.Typ.W + 31) / 32; - pragma Assert (Len > 0); Vec : Logvec_Array_Acc; Off : Uns32; Has_Zx : Boolean; Pv : Pval; begin + if Len = 0 then + return Create_Pval2 (0); + end if; + Vec := new Logvec_Array'(0 .. Digit_Index (Len - 1) => (0, 0)); Off := 0; Has_Zx := False; |