From cd8e491028e18bf9c7d4f5297ae03e618a10be4f Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 19 Jul 2001 04:55:06 +0000 Subject: [PATCH] Support calculated delays in vvp.tgt. --- ivl_target.h | 10 +++++++--- t-dll-api.cc | 10 +++++++++- t-dll-proc.cc | 10 +++++++++- t-dll.h | 7 +++++-- tgt-vvp/vvp_process.c | 32 +++++++++++++++++++++++++++++++- 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/ivl_target.h b/ivl_target.h index bbd472cd6..6077d0e97 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.71 2001/07/04 22:59:25 steve Exp $" +#ident "$Id: ivl_target.h,v 1.72 2001/07/19 04:55:06 steve Exp $" #endif #ifdef __cplusplus @@ -850,7 +850,7 @@ extern ivl_expr_t ivl_stmt_cond_expr(ivl_statement_t net); extern ivl_statement_t ivl_stmt_cond_false(ivl_statement_t net); /* IVL_ST_CONDIT */ extern ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net); - /* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB */ + /* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB IVL_ST_DELAYX */ extern ivl_expr_t ivl_stmt_delay_expr(ivl_statement_t net); /* IVL_ST_DELAY */ extern unsigned long ivl_stmt_delay_val(ivl_statement_t net); @@ -870,7 +870,8 @@ extern ivl_expr_t ivl_stmt_parm(ivl_statement_t net, unsigned idx); extern unsigned ivl_stmt_parm_count(ivl_statement_t net); /* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB */ extern ivl_expr_t ivl_stmt_rval(ivl_statement_t net); - /* IVL_ST_DELAY, IVL_ST_FOREVER, IVL_ST_REPEAT IVL_ST_WAIT, IVL_ST_WHILE */ + /* IVL_ST_DELAY, IVL_ST_DELAYX, IVL_ST_FOREVER, IVL_ST_REPEAT + IVL_ST_WAIT, IVL_ST_WHILE */ extern ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net); @@ -891,6 +892,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.72 2001/07/19 04:55:06 steve + * Support calculated delays in vvp.tgt. + * * Revision 1.71 2001/07/04 22:59:25 steve * handle left shifter in dll output. * diff --git a/t-dll-api.cc b/t-dll-api.cc index fd24d65b7..28b8d711d 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.55 2001/07/07 20:20:10 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.56 2001/07/19 04:55:06 steve Exp $" #endif # include "t-dll.h" @@ -1111,6 +1111,9 @@ extern "C" ivl_expr_t ivl_stmt_delay_expr(ivl_statement_t net) case IVL_ST_ASSIGN_NB: return net->u_.assign_.delay; + case IVL_ST_DELAYX: + return net->u_.delayx_.expr; + default: assert(0); return 0; @@ -1241,6 +1244,8 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) switch (net->type_) { case IVL_ST_DELAY: return net->u_.delay_.stmt_; + case IVL_ST_DELAYX: + return net->u_.delayx_.stmt_; case IVL_ST_FOREVER: return net->u_.forever_.stmt_; case IVL_ST_WAIT: @@ -1257,6 +1262,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.56 2001/07/19 04:55:06 steve + * Support calculated delays in vvp.tgt. + * * Revision 1.55 2001/07/07 20:20:10 steve * Pass parameters to system functions. * diff --git a/t-dll-proc.cc b/t-dll-proc.cc index 643d66360..32cb7455f 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-proc.cc,v 1.30 2001/06/21 23:23:14 steve Exp $" +#ident "$Id: t-dll-proc.cc,v 1.31 2001/07/19 04:55:06 steve Exp $" #endif # include "target.h" @@ -444,6 +444,11 @@ bool dll_target::proc_delay(const NetPDelay*net) if (const NetExpr*expr = net->expr()) { stmt_cur_->type_ = IVL_ST_DELAYX; + assert(expr_ == 0); + expr->expr_scan(this); + stmt_cur_->u_.delayx_.expr = expr_; + expr_ = 0; + stmt_cur_->u_.delayx_.stmt_ = tmp; } else { @@ -684,6 +689,9 @@ void dll_target::proc_while(const NetWhile*net) /* * $Log: t-dll-proc.cc,v $ + * Revision 1.31 2001/07/19 04:55:06 steve + * Support calculated delays in vvp.tgt. + * * Revision 1.30 2001/06/21 23:23:14 steve * Initialize stmt_cur_ substatements during dll case building. * diff --git a/t-dll.h b/t-dll.h index eb0c0809d..c97f92ff1 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.54 2001/07/07 20:20:10 steve Exp $" +#ident "$Id: t-dll.h,v 1.55 2001/07/19 04:55:06 steve Exp $" #endif # include "target.h" @@ -512,7 +512,7 @@ struct ivl_statement_s { } delay_; struct { /* IVL_ST_DELAYX */ - int expr_; /* XXXX */ + ivl_expr_t expr; /* XXXX */ ivl_statement_t stmt_; } delayx_; @@ -552,6 +552,9 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.55 2001/07/19 04:55:06 steve + * Support calculated delays in vvp.tgt. + * * Revision 1.54 2001/07/07 20:20:10 steve * Pass parameters to system functions. * diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index 6a457ed60..a935144a2 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.38 2001/06/29 02:41:05 steve Exp $" +#ident "$Id: vvp_process.c,v 1.39 2001/07/19 04:55:06 steve Exp $" #endif # include "vvp_priv.h" @@ -453,6 +453,29 @@ static int show_stmt_delay(ivl_statement_t net, ivl_scope_t sscope) return rc; } +/* + * The delayx statement is slightly more complex in that it is + * necessary to calculate the delay first. Load the calculated delay + * into and index register and use the %delayx instruction to do the + * actual delay. + */ +static int show_stmt_delayx(ivl_statement_t net, ivl_scope_t sscope) +{ + int rc = 0; + ivl_expr_t exp = ivl_stmt_delay_expr(net); + ivl_statement_t stmt = ivl_stmt_sub_stmt(net); + + { struct vector_info del = draw_eval_expr(exp); + fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", del.base, del.wid); + clr_vector(del); + } + + fprintf(vvp_out, " %%delayx 0;\n"); + + rc += show_statement(stmt, sscope); + return rc; +} + static int show_stmt_disable(ivl_statement_t net, ivl_scope_t sscope) { int rc = 0; @@ -755,6 +778,10 @@ static int show_statement(ivl_statement_t net, ivl_scope_t sscope) rc += show_stmt_delay(net, sscope); break; + case IVL_ST_DELAYX: + rc += show_stmt_delayx(net, sscope); + break; + case IVL_ST_DISABLE: rc += show_stmt_disable(net, sscope); break; @@ -887,6 +914,9 @@ int draw_func_definition(ivl_scope_t scope) /* * $Log: vvp_process.c,v $ + * Revision 1.39 2001/07/19 04:55:06 steve + * Support calculated delays in vvp.tgt. + * * Revision 1.38 2001/06/29 02:41:05 steve * Handle null parameters to system tasks. *