diff --git a/tgt-vvp/vvp_priv.h b/tgt-vvp/vvp_priv.h index 9873cae32..88f62abac 100644 --- a/tgt-vvp/vvp_priv.h +++ b/tgt-vvp/vvp_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvp_priv.h,v 1.11 2001/06/18 03:10:34 steve Exp $" +#ident "$Id: vvp_priv.h,v 1.12 2001/11/01 04:26:57 steve Exp $" #endif # include "ivl_target.h" @@ -57,6 +57,7 @@ extern int draw_scope(ivl_scope_t scope, ivl_scope_t parent); */ extern void draw_nexus_input(ivl_nexus_t nex); +extern const char* draw_net_input(ivl_nexus_t nex); /* * The draw_eval_expr function writes out the code to evaluate a @@ -87,6 +88,9 @@ extern unsigned thread_count; /* * $Log: vvp_priv.h,v $ + * Revision 1.12 2001/11/01 04:26:57 steve + * Generate code for deassign and cassign. + * * Revision 1.11 2001/06/18 03:10:34 steve * 1. Logic with more than 4 inputs * 2. Id and name mangling diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 330e088e2..ea09ffea9 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 */ #if !defined(WINNT) -#ident "$Id: vvp_process.c,v 1.46 2001/10/19 23:52:36 steve Exp $" +#ident "$Id: vvp_process.c,v 1.47 2001/11/01 04:26:57 steve Exp $" #endif # include "vvp_priv.h" @@ -451,6 +451,51 @@ static int show_stmt_case(ivl_statement_t net, ivl_scope_t sscope) return 0; } +static int show_stmt_cassign(ivl_statement_t net) +{ + ivl_lval_t lval; + ivl_signal_t lsig; + unsigned idx; + + assert(ivl_stmt_lvals(net) == 1); + lval = ivl_stmt_lval(net, 0); + + lsig = ivl_lval_sig(lval); + assert(lsig != 0); + assert(ivl_lval_mux(lval) == 0); + assert(ivl_signal_pins(lsig) == ivl_stmt_nexus_count(net)); + assert(ivl_lval_part_off(lval) == 0); + + for (idx = 0 ; idx < ivl_stmt_nexus_count(net) ; idx += 1) { + fprintf(vvp_out, " %%cassign V_%s[%u], %s;\n", + vvp_mangle_id(ivl_signal_name(lsig)), idx, + draw_net_input(ivl_stmt_nexus(net, idx))); + } + + return 0; +} + +static int show_stmt_deassign(ivl_statement_t net) +{ + ivl_lval_t lval; + ivl_signal_t lsig; + unsigned idx; + + assert(ivl_stmt_lvals(net) == 1); + lval = ivl_stmt_lval(net, 0); + + lsig = ivl_lval_sig(lval); + assert(lsig != 0); + assert(ivl_lval_mux(lval) == 0); + assert(ivl_lval_part_off(lval) == 0); + + for (idx = 0 ; idx < ivl_lval_pins(lval) ; idx += 1) { + fprintf(vvp_out, " %%deassign V_%s[%u], 1;\n", + vvp_mangle_id(ivl_signal_name(lsig)), idx); + } + return 0; +} + static int show_stmt_condit(ivl_statement_t net, ivl_scope_t sscope) { int rc = 0; @@ -840,10 +885,18 @@ static int show_statement(ivl_statement_t net, ivl_scope_t sscope) rc += show_stmt_case(net, sscope); break; + case IVL_ST_CASSIGN: + rc += show_stmt_cassign(net); + break; + case IVL_ST_CONDIT: rc += show_stmt_condit(net, sscope); break; + case IVL_ST_DEASSIGN: + rc += show_stmt_deassign(net); + break; + case IVL_ST_DELAY: rc += show_stmt_delay(net, sscope); break; @@ -984,6 +1037,9 @@ int draw_func_definition(ivl_scope_t scope) /* * $Log: vvp_process.c,v $ + * Revision 1.47 2001/11/01 04:26:57 steve + * Generate code for deassign and cassign. + * * Revision 1.46 2001/10/19 23:52:36 steve * Add trailing ; to fork-join out labels. * diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 960f05921..03e0dc149 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vvp_scope.c,v 1.55 2001/10/24 03:43:45 steve Exp $" +#ident "$Id: vvp_scope.c,v 1.56 2001/11/01 04:26:57 steve Exp $" #endif # include "vvp_priv.h" @@ -132,7 +132,6 @@ const char *vvp_mangle_name(const char *id) * other functions in this file are in support of that task. */ -static const char* draw_net_input(ivl_nexus_t nex); /* * NEXUS @@ -269,7 +268,7 @@ static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) * The string that this returns is bound to the nexus, so the pointer * remains valid. */ -static const char* draw_net_input(ivl_nexus_t nex) +const char* draw_net_input(ivl_nexus_t nex) { char result[512]; unsigned idx; @@ -1218,6 +1217,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent) /* * $Log: vvp_scope.c,v $ + * Revision 1.56 2001/11/01 04:26:57 steve + * Generate code for deassign and cassign. + * * Revision 1.55 2001/10/24 03:43:45 steve * Write resolvers before the .functor (PR#300) *