Skip to content

Commit

Permalink
tgt-vvp: Fix vector assignment with undefined delay
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
larsclausen committed Sep 2, 2024
1 parent cbdaa86 commit 80fd301
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tgt-vvp/vvp_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 80fd301

Please sign in to comment.