From 626394d198de1db4c6208facce08217b6f5e4167 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 17 Sep 2008 17:49:45 -0700 Subject: [PATCH] Some event control assigns can be skipped so add an event clear. Since some event control assignments can be skipped we need an event control clear so that future %evctl statements do not fail their assert. This patch adds %evctl/c and uses it in the compiler as appropriate to keep the event control information in sync. --- tgt-vvp/vvp_process.c | 1 + vvp/codes.h | 1 + vvp/compile.cc | 1 + vvp/opcodes.txt | 7 +++++++ vvp/vthread.cc | 6 ++++++ 5 files changed, 16 insertions(+) diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index f3a00ac7c..c1007820a 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -349,6 +349,7 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit, fprintf(vvp_out, " %%assign/v0/x1/e v%p_%lu, %u;\n", sig, use_word, bit); fprintf(vvp_out, "t_%u ;\n", skip_assign); + fprintf(vvp_out, " %%evctl/c;\n"); } else { /* Constant delay... */ draw_eval_expr_into_integer(part_off_ex, 1); diff --git a/vvp/codes.h b/vvp/codes.h index 2b2d580a2..b524b5aad 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -82,6 +82,7 @@ extern bool of_DIV_S(vthread_t thr, vvp_code_t code); extern bool of_DIV_WR(vthread_t thr, vvp_code_t code); extern bool of_END(vthread_t thr, vvp_code_t code); extern bool of_EVCTL(vthread_t thr, vvp_code_t code); +extern bool of_EVCTLC(vthread_t thr, vvp_code_t code); extern bool of_EVCTLI(vthread_t thr, vvp_code_t code); extern bool of_EVCTLS(vthread_t thr, vvp_code_t code); extern bool of_FORCE_LINK(vthread_t thr, vvp_code_t code); diff --git a/vvp/compile.cc b/vvp/compile.cc index d1155750e..6e5e7e6c1 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -126,6 +126,7 @@ const static struct opcode_table_s opcode_table[] = { { "%div/wr", of_DIV_WR, 2, {OA_BIT1, OA_BIT2, OA_NONE} }, { "%end", of_END, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%evctl", of_EVCTL, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} }, + { "%evctl/c",of_EVCTLC, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%evctl/i",of_EVCTLI, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} }, { "%evctl/s",of_EVCTLS, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} }, { "%force/link",of_FORCE_LINK,2,{OA_FUNC_PTR,OA_FUNC_PTR2,OA_NONE} }, diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 325e5dfbd..00dcad70f 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -308,6 +308,7 @@ right operand is 0, then the result is NaN. * %evctl +* %evctl/c * %evctl/s * %evctl/i @@ -318,6 +319,12 @@ by the %assign/e instructions to do not blocking event control. The register to read the repetition count from (signed or unsigned). %evctl/i sets the repetition to an immediate unsigned value. +%evctl/c clears the event control information. This is needed if a +%assign/e may be skiped since the %assign/e statements clear the +event control information and the other %evctl statements assert +that this information has been cleared. You can get an assert if +this information is not managed correctly. + * %force/v