From 0370f30b2043ab5b3879b9ec3f35d99c2f041b05 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 15 Jan 2008 15:25:27 -0800 Subject: [PATCH] Support variable delay of a variable selected assignment. This patch adds support for the following statement: [] <= # . It is a copy with slight modification of code from the next else/if clause. --- tgt-vvp/vvp_process.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 153add4b0..a28a16224 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -236,14 +236,28 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit, if (part_off_ex) { unsigned skip_assign = transient_id++; - assert(dexp == 0); - draw_eval_expr_into_integer(part_off_ex, 1); - /* If the index expression has XZ bits, skip the assign. */ - fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_assign); - fprintf(vvp_out, " %%ix/load 0, %u;\n", width); - fprintf(vvp_out, " %%assign/v0/x1 v%p_%lu, %u, %u;\n", - sig, use_word, delay, bit); - fprintf(vvp_out, "t_%u ;\n", skip_assign); + if (dexp == 0) { + /* Constant delay... */ + draw_eval_expr_into_integer(part_off_ex, 1); + /* If the index expression has XZ bits, skip the assign. */ + fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_assign); + fprintf(vvp_out, " %%ix/load 0, %u;\n", width); + fprintf(vvp_out, " %%assign/v0/x1 v%p_%lu, %u, %u;\n", + sig, use_word, delay, bit); + fprintf(vvp_out, "t_%u ;\n", skip_assign); + } else { + /* Calculated delay... */ + int delay_index = allocate_word(); + draw_eval_expr_into_integer(dexp, delay_index); + draw_eval_expr_into_integer(part_off_ex, 1); + /* If the index expression has XZ bits, skip the assign. */ + fprintf(vvp_out, " %%jmp/1 t_%u, 4;\n", skip_assign); + fprintf(vvp_out, " %%ix/load 0, %u;\n", width); + fprintf(vvp_out, " %%assign/v0/x1 v%p_%lu, %u, %u;\n", + sig, use_word, delay_index, bit); + fprintf(vvp_out, "t_%u ;\n", skip_assign); + clr_word(delay_index); + } } else if (part_off>0 || ivl_lval_width(lval)!=ivl_signal_width(sig)) { /* There is no mux expression, but a constant part