Assign to variable array words using array indexing.
The non-array set statements no longer work on array words. Handle the various cases properly.
This commit is contained in:
parent
6632e4c33b
commit
680d3c8a3e
|
|
@ -99,7 +99,7 @@ static void set_to_lvariable(ivl_lval_t lval,
|
||||||
if (ivl_lval_mux(lval))
|
if (ivl_lval_mux(lval))
|
||||||
part_off_ex = ivl_lval_mux(lval);
|
part_off_ex = ivl_lval_mux(lval);
|
||||||
|
|
||||||
if (part_off_ex) {
|
if (part_off_ex && ivl_signal_dimensions(sig) == 0) {
|
||||||
unsigned skip_set = transient_id++;
|
unsigned skip_set = transient_id++;
|
||||||
|
|
||||||
/* There is a mux expression, so this must be a write to
|
/* There is a mux expression, so this must be a write to
|
||||||
|
|
@ -118,6 +118,39 @@ static void set_to_lvariable(ivl_lval_t lval,
|
||||||
lookaside. */
|
lookaside. */
|
||||||
save_signal_lookaside(bit, sig, use_word, 0);
|
save_signal_lookaside(bit, sig, use_word, 0);
|
||||||
|
|
||||||
|
} else if (part_off_ex && ivl_signal_dimensions(sig) > 0) {
|
||||||
|
|
||||||
|
/* Here we have a part select write into an array word. */
|
||||||
|
unsigned skip_set = transient_id++;
|
||||||
|
if (word_ix) {
|
||||||
|
draw_eval_expr_into_integer(word_ix, 3);
|
||||||
|
fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_set);
|
||||||
|
} else {
|
||||||
|
fprintf(vvp_out, " %%ix/load 3, %lu;\n", use_word);
|
||||||
|
}
|
||||||
|
draw_eval_expr_into_integer(part_off_ex, 1);
|
||||||
|
fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_set);
|
||||||
|
fprintf(vvp_out, " %%set/av v%p, %u, %u;\n",
|
||||||
|
sig, bit, wid);
|
||||||
|
fprintf(vvp_out, "t_%u ;\n", skip_set);
|
||||||
|
|
||||||
|
} else if ((part_off>0 || ivl_lval_width(lval)!=ivl_signal_width(sig))
|
||||||
|
&& ivl_signal_dimensions(sig) > 0) {
|
||||||
|
|
||||||
|
/* Here we have a part select write into an array word. */
|
||||||
|
unsigned skip_set = transient_id++;
|
||||||
|
if (word_ix) {
|
||||||
|
draw_eval_expr_into_integer(word_ix, 3);
|
||||||
|
fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_set);
|
||||||
|
} else {
|
||||||
|
fprintf(vvp_out, " %%ix/load 3, %lu;\n", use_word);
|
||||||
|
}
|
||||||
|
fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off);
|
||||||
|
fprintf(vvp_out, " %%set/av v%p, %u, %u;\n",
|
||||||
|
sig, bit, wid);
|
||||||
|
if (word_ix) /* Only need this label if word_ix is set. */
|
||||||
|
fprintf(vvp_out, "t_%u ;\n", skip_set);
|
||||||
|
|
||||||
} else if (part_off>0 || ivl_lval_width(lval)!=ivl_signal_width(sig)) {
|
} else if (part_off>0 || ivl_lval_width(lval)!=ivl_signal_width(sig)) {
|
||||||
/* There is no mux expression, but a constant part
|
/* There is no mux expression, but a constant part
|
||||||
offset. Load that into index x0 and generate a
|
offset. Load that into index x0 and generate a
|
||||||
|
|
@ -145,7 +178,7 @@ static void set_to_lvariable(ivl_lval_t lval,
|
||||||
lookaside. */
|
lookaside. */
|
||||||
save_signal_lookaside(bit, sig, use_word, 0);
|
save_signal_lookaside(bit, sig, use_word, 0);
|
||||||
|
|
||||||
} else if (ivl_signal_array_count(sig) > 1) {
|
} else if (ivl_signal_dimensions(sig) > 0) {
|
||||||
|
|
||||||
/* If the word index is a constant, then we can write
|
/* If the word index is a constant, then we can write
|
||||||
directly to the word and save the index calculation. */
|
directly to the word and save the index calculation. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue