From 26e2e85ffaafa5ba5aa5c55398d97cdafb2d6373 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 5 Oct 2006 01:23:53 +0000 Subject: [PATCH] Handle non-constant delays on indexed non-blocking assignments. --- tgt-vvp/vvp_process.c | 30 +++++++++++++++++++++--------- vvp/codes.h | 6 +++++- vvp/compile.cc | 6 +++++- vvp/opcodes.txt | 5 +++-- vvp/vthread.cc | 33 ++++++++++++++++++++++++++++++++- 5 files changed, 66 insertions(+), 14 deletions(-) diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 7030888f6..d6db42fbc 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_process.c,v 1.124 2006/08/08 05:11:37 steve Exp $" +#ident "$Id: vvp_process.c,v 1.125 2006/10/05 01:23:53 steve Exp $" #endif # include "vvp_priv.h" @@ -183,12 +183,24 @@ static void assign_to_lvector(ivl_lval_t lval, unsigned bit, offset. Load that into index x1 and generate a single-bit set instruction. */ assert(ivl_lval_width(lval) == width); - assert(dexp == 0); - fprintf(vvp_out, " %%ix/load 0, %u;\n", width); - fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off); - fprintf(vvp_out, " %%assign/v0/x1 V_%s, %u, %u;\n", - vvp_signal_label(sig), delay, bit); + if (dexp == 0) { + /* Constant delay... */ + fprintf(vvp_out, " %%ix/load 0, %u;\n", width); + fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off); + fprintf(vvp_out, " %%assign/v0/x1 V_%s, %u, %u;\n", + vvp_signal_label(sig), delay, bit); + + } else { + /* Calculated delay... */ + int delay_index = allocate_word(); + draw_eval_expr_into_integer(dexp, delay_index); + fprintf(vvp_out, " %%ix/load 0, %u;\n", width); + fprintf(vvp_out, " %%ix/load 1, %u;\n", part_off); + fprintf(vvp_out, " %%assign/v0/x1/d V_%s, %u, %u;\n", + vvp_signal_label(sig), delay_index, bit); + clr_word(delay_index); + } } else if (dexp != 0) { draw_eval_expr_into_integer(dexp, 1); @@ -445,9 +457,6 @@ static int show_stmt_assign_nb(ivl_statement_t net) unsigned lidx; unsigned cur_rbit = 0; - if (del != 0) - calculate_into_x1(del); - for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) { unsigned bit_limit = wid - cur_rbit; lval = ivl_stmt_lval(net, lidx); @@ -1487,6 +1496,9 @@ int draw_func_definition(ivl_scope_t scope) /* * $Log: vvp_process.c,v $ + * Revision 1.125 2006/10/05 01:23:53 steve + * Handle non-constant delays on indexed non-blocking assignments. + * * Revision 1.124 2006/08/08 05:11:37 steve * Handle 64bit delay constants. * diff --git a/vvp/codes.h b/vvp/codes.h index d226f7f9f..06b90d51a 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: codes.h,v 1.79 2006/08/09 05:19:08 steve Exp $" +#ident "$Id: codes.h,v 1.80 2006/10/05 01:23:53 steve Exp $" #endif @@ -45,6 +45,7 @@ extern bool of_ASSIGN_MV(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_V0(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_V0D(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_V0X1(vthread_t thr, vvp_code_t code); +extern bool of_ASSIGN_V0X1D(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_WR(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN_X0(vthread_t thr, vvp_code_t code); extern bool of_BLEND(vthread_t thr, vvp_code_t code); @@ -179,6 +180,9 @@ extern vvp_code_t codespace_null(void); /* * $Log: codes.h,v $ + * Revision 1.80 2006/10/05 01:23:53 steve + * Handle non-constant delays on indexed non-blocking assignments. + * * Revision 1.79 2006/08/09 05:19:08 steve * Add support for real valued modulus. * diff --git a/vvp/compile.cc b/vvp/compile.cc index 406d97874..27d2c816c 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compile.cc,v 1.225 2006/09/29 03:57:01 steve Exp $" +#ident "$Id: compile.cc,v 1.226 2006/10/05 01:23:53 steve Exp $" #endif # include "arith.h" @@ -91,6 +91,7 @@ const static struct opcode_table_s opcode_table[] = { { "%assign/v0",of_ASSIGN_V0,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} }, { "%assign/v0/d",of_ASSIGN_V0D,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} }, { "%assign/v0/x1",of_ASSIGN_V0X1,3,{OA_FUNC_PTR,OA_BIT1,OA_BIT2} }, + { "%assign/v0/x1/d",of_ASSIGN_V0X1D,3,{OA_FUNC_PTR,OA_BIT1,OA_BIT2} }, { "%assign/wr",of_ASSIGN_WR,3,{OA_VPI_PTR,OA_BIT1, OA_BIT2} }, { "%assign/x0",of_ASSIGN_X0,3,{OA_FUNC_PTR,OA_BIT1, OA_BIT2} }, { "%blend", of_BLEND, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, @@ -1534,6 +1535,9 @@ void compile_param_string(char*label, char*name, char*value) /* * $Log: compile.cc,v $ + * Revision 1.226 2006/10/05 01:23:53 steve + * Handle non-constant delays on indexed non-blocking assignments. + * * Revision 1.225 2006/09/29 03:57:01 steve * Modpath delay chooses correct delay for edge. * diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 627875f20..099252d6a 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com) * - * $Id: opcodes.txt,v 1.71 2006/08/09 05:19:08 steve Exp $ + * $Id: opcodes.txt,v 1.72 2006/10/05 01:23:54 steve Exp $ */ @@ -87,7 +87,8 @@ course, because integer 0 is taken with the vector width. The references a .var object that can receive non-blocking assignments. For blocking assignments, see %set/v. -* %assign/v0x1 , , +* %assign/v0/x1 , , +* %assign/v0/x1/d , , This is similar to the %assign/v0 instruction, but adds the index-1 index register with the canonical index of the destination where the diff --git a/vvp/vthread.cc b/vvp/vthread.cc index a977e558a..203cf5b78 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vthread.cc,v 1.156 2006/08/09 05:19:08 steve Exp $" +#ident "$Id: vthread.cc,v 1.157 2006/10/05 01:23:54 steve Exp $" #endif # include "config.h" @@ -604,6 +604,34 @@ bool of_ASSIGN_V0X1(vthread_t thr, vvp_code_t cp) return true; } +/* + * This is %assign/v0/x1