tgt-vvp: Fix vector assignment with undefined delay

Assignments with an undefined intra-assignment delay should be treated like
assignments with zero delay. For the most part this is implemented
correctly, except for assignments to a part of a vector where the offset
inside the vector is an immediate value. E.g.
```
reg [1:0] x;
integer d = 'x;
...
x[0] <= #d 1'b1
```

Here when loading the delay into the index register flag 4 is updated, but
never cleared afterwards. As a result, if the delay is undefined, the vector
assignment will be skipped. Fix this by making sure flag 4 is always
cleared before the vector assignment instruction.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2024-09-02 09:10:10 +02:00
parent cbdaa865a1
commit 80fd301fc1
1 changed files with 2 additions and 2 deletions

View File

@ -317,14 +317,14 @@ static void assign_to_lvector(ivl_lval_t lval,
// instruction to handle this case.
int offset_index = allocate_word();
int delay_index = allocate_word();
fprintf(vvp_out, " %%ix/load %d, %lu, 0;\n", offset_index, part_off);
if (dexp) {
draw_eval_expr_into_integer(dexp,delay_index);
} else {
fprintf(vvp_out, " %%ix/load %d, %lu, %lu;\n",
delay_index, low_d, hig_d);
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
}
fprintf(vvp_out, " %%ix/load %d, %lu, 0;\n", offset_index, part_off);
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
fprintf(vvp_out, " %s/vec4/off/d v%p_%lu, %d, %d;\n",
assign_op, sig, use_word, offset_index, delay_index);
clr_word(offset_index);