vvp: Handle fully out-of-bounds write for `%assign/vec4/a/{d,e}`

The `%assign/vec4/a/{d,e}` instructions, when checking for a full
out-of-bounds write on the low side, uses the target signal width, while it
should use the assigned value width.

This can lead to a fully out-of-bounds write to be assumed to be a partial
out-of-bounds access, which will trigger an assert later on.

E.g.

```
integer a[1:0];
integer i = -4;
a[0][i+:4] <= 4'h0; // Triggers assert
```

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-05-28 10:16:13 +02:00
parent 2693dd32b0
commit eab37efb56
1 changed files with 2 additions and 2 deletions

View File

@ -1159,7 +1159,7 @@ bool of_ASSIGN_VEC4_A_D(vthread_t thr, vvp_code_t cp)
if (off >= (long)array_wid)
return true;
if (off < 0) {
if ((unsigned)-off >= array_wid)
if ((unsigned)-off >= wid)
return true;
int use_off = -off;
@ -1201,7 +1201,7 @@ bool of_ASSIGN_VEC4_A_E(vthread_t thr, vvp_code_t cp)
if (off >= (long)array_wid)
return true;
if (off < 0) {
if ((unsigned)-off >= array_wid)
if ((unsigned)-off >= wid)
return true;
int use_off = -off;