diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index e8b656fb5..3db57127d 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: draw_vpi.c,v 1.3 2003/03/10 23:40:54 steve Exp $" +#ident "$Id: draw_vpi.c,v 1.4 2003/03/15 04:45:18 steve Exp $" #endif # include "vvp_priv.h" @@ -47,14 +47,14 @@ static int is_magic_sfunc(const char*name) } -struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet, - ivl_expr_t fnet, unsigned wid) +static void draw_vpi_taskfunc_args(const char*call_string, + ivl_statement_t tnet, + ivl_expr_t fnet) { unsigned idx; unsigned parm_count = tnet ? ivl_stmt_parm_count(tnet) : ivl_expr_parms(fnet); - struct vector_info res; struct vector_info *vec = 0x0; unsigned int vecs= 0; unsigned int veci= 0; @@ -131,18 +131,7 @@ struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet, vecs++; } - if (tnet != 0) { - /* for task calls, the res vector is not used. */ - res.base = 0; - res.wid = 0; - fprintf(vvp_out, " %%vpi_call \"%s\"", ivl_stmt_name(tnet)); - - } else { - res.base = allocate_vector(wid); - res.wid = wid; - fprintf(vvp_out, " %%vpi_func \"%s\", %u, %u", - ivl_expr_name(fnet), res.base, res.wid); - } + fprintf(vvp_out, "%s", call_string); for (idx = 0 ; idx < parm_count ; idx += 1) { ivl_expr_t expr = tnet @@ -247,12 +236,48 @@ struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet, } fprintf(vvp_out, ";\n"); +} + +void draw_vpi_task_call(ivl_statement_t tnet) +{ + char call_string[1024]; + sprintf(call_string, " %%vpi_call \"%s\"", ivl_stmt_name(tnet)); + draw_vpi_taskfunc_args(call_string, tnet, 0); +} + +struct vector_info draw_vpi_func_call(ivl_expr_t fnet, unsigned wid) +{ + char call_string[1024]; + struct vector_info res; + + res.base = allocate_vector(wid); + res.wid = wid; + sprintf(call_string, " %%vpi_func \"%s\", %u, %u", + ivl_expr_name(fnet), res.base, res.wid); + + draw_vpi_taskfunc_args(call_string, 0, fnet); + + return res; +} + +int draw_vpi_rfunc_call(ivl_expr_t fnet) +{ + char call_string[1024]; + int res = allocate_word(); + + sprintf(call_string, " %%vpi_func/r \"%s\", %d", + ivl_expr_name(fnet), res); + + draw_vpi_taskfunc_args(call_string, 0, fnet); return res; } /* * $Log: draw_vpi.c,v $ + * Revision 1.4 2003/03/15 04:45:18 steve + * Allow real-valued vpi functions to have arguments. + * * Revision 1.3 2003/03/10 23:40:54 steve * Keep parameter constants for the ivl_target API. * diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index 69e02eb1a..d7120a710 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval_expr.c,v 1.92 2003/02/28 20:21:13 steve Exp $" +#ident "$Id: eval_expr.c,v 1.93 2003/03/15 04:45:18 steve Exp $" #endif # include "vvp_priv.h" @@ -1619,7 +1619,7 @@ static struct vector_info draw_sfunc_expr(ivl_expr_t exp, unsigned wid) } - res = draw_vpi_taskfunc_call(0, exp, wid); + res = draw_vpi_func_call(exp, wid); /* New basic block starts after VPI calls. */ clear_expression_lookaside(); @@ -2002,6 +2002,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp, int stuff_ok_flag) /* * $Log: eval_expr.c,v $ + * Revision 1.93 2003/03/15 04:45:18 steve + * Allow real-valued vpi functions to have arguments. + * * Revision 1.92 2003/02/28 20:21:13 steve * Merge vpi_call and vpi_func draw functions. * diff --git a/tgt-vvp/eval_real.c b/tgt-vvp/eval_real.c index 902b7ae85..616ca989e 100644 --- a/tgt-vvp/eval_real.c +++ b/tgt-vvp/eval_real.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval_real.c,v 1.5 2003/03/08 01:04:01 steve Exp $" +#ident "$Id: eval_real.c,v 1.6 2003/03/15 04:45:18 steve Exp $" #endif /* @@ -172,15 +172,19 @@ static int draw_sfunc_real(ivl_expr_t exp) { struct vector_info sv; int res; - assert(ivl_expr_parms(exp) == 0); switch (ivl_expr_value(exp)) { - case IVL_VT_REAL: - res = allocate_word(); - fprintf(vvp_out, " %%vpi_func/r \"%s\", %d;\n", - ivl_expr_name(exp), res); - return res; + case IVL_VT_REAL: + if (ivl_expr_parms(exp) == 0) { + res = allocate_word(); + fprintf(vvp_out, " %%vpi_func/r \"%s\", %d;\n", + ivl_expr_name(exp), res); + + } else { + res = draw_vpi_rfunc_call(exp); + } + break; case IVL_VT_VECTOR: /* If the value of the sfunc is a vector, then evaluate @@ -194,13 +198,14 @@ static int draw_sfunc_real(ivl_expr_t exp) res, sv.base, sv.wid); fprintf(vvp_out, " %%cvt/ri %d, %d;\n", res, res); - return res; + break; default: assert(0); + res = -1; } - return -1; + return res; } /* @@ -278,6 +283,9 @@ int draw_eval_real(ivl_expr_t exp) /* * $Log: eval_real.c,v $ + * Revision 1.6 2003/03/15 04:45:18 steve + * Allow real-valued vpi functions to have arguments. + * * Revision 1.5 2003/03/08 01:04:01 steve * Excess precision breaks some targets. * diff --git a/tgt-vvp/vvp_priv.h b/tgt-vvp/vvp_priv.h index 17a8289d9..c6378c991 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 */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vvp_priv.h,v 1.24 2003/02/28 20:21:13 steve Exp $" +#ident "$Id: vvp_priv.h,v 1.25 2003/03/15 04:45:18 steve Exp $" #endif # include "ivl_target.h" @@ -70,9 +70,11 @@ extern void draw_lpm_mux(ivl_lpm_t net); * statement handle, it will generate a %vpi_call * instruction. Otherwise, it will generate a %vpi_func instruction. */ -extern struct vector_info draw_vpi_taskfunc_call(ivl_statement_t net, - ivl_expr_t exp, - unsigned wid); +extern void draw_vpi_task_call(ivl_statement_t net); + +extern struct vector_info draw_vpi_func_call(ivl_expr_t exp, + unsigned wid); +extern int draw_vpi_rfunc_call(ivl_expr_t exp); /* * Given a nexus, draw a string that represents the functor output @@ -191,6 +193,9 @@ extern unsigned thread_count; /* * $Log: vvp_priv.h,v $ + * Revision 1.25 2003/03/15 04:45:18 steve + * Allow real-valued vpi functions to have arguments. + * * Revision 1.24 2003/02/28 20:21:13 steve * Merge vpi_call and vpi_func draw functions. * diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 16a2c30d1..4e1fa2bf8 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.82 2003/03/06 01:17:46 steve Exp $" +#ident "$Id: vvp_process.c,v 1.83 2003/03/15 04:45:18 steve Exp $" #endif # include "vvp_priv.h" @@ -1230,7 +1230,7 @@ static int show_system_task_call(ivl_statement_t net) return 0; } - (void) draw_vpi_taskfunc_call(net, 0, 0); + draw_vpi_task_call(net); /* VPI calls can manipulate anything, so clear the expression lookahead table after the call. */ @@ -1435,6 +1435,9 @@ int draw_func_definition(ivl_scope_t scope) /* * $Log: vvp_process.c,v $ + * Revision 1.83 2003/03/15 04:45:18 steve + * Allow real-valued vpi functions to have arguments. + * * Revision 1.82 2003/03/06 01:17:46 steve * Use number for event labels. *