vvp support for <= with internal delay.

This commit is contained in:
steve 2001-04-15 02:58:11 +00:00
parent d0d6189874
commit 70aeb980d8
5 changed files with 78 additions and 11 deletions

View File

@ -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.51 2001/04/07 19:24:36 steve Exp $"
#ident "$Id: ivl_target.h,v 1.52 2001/04/15 02:58:11 steve Exp $"
#endif
#ifdef __cplusplus
@ -161,6 +161,7 @@ typedef enum ivl_expr_type_e {
IVL_EX_STRING,
IVL_EX_SUBSIG,
IVL_EX_UFUNC,
IVL_EX_ULONG,
IVL_EX_UNARY
} ivl_expr_type_t;
@ -387,6 +388,8 @@ extern ivl_scope_t ivl_expr_scope(ivl_expr_t net);
extern int ivl_expr_signed(ivl_expr_t net);
/* IVL_EX_STRING */
extern const char* ivl_expr_string(ivl_expr_t net);
/* IVL_EX_ULONG */
extern unsigned long ivl_expr_uvalue(ivl_expr_t net);
/* any expression */
extern unsigned ivl_expr_width(ivl_expr_t net);
@ -721,6 +724,8 @@ 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 */
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);
/* IVL_ST_WAIT */
@ -760,6 +765,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.52 2001/04/15 02:58:11 steve
* vvp support for <= with internal delay.
*
* Revision 1.51 2001/04/07 19:24:36 steve
* Add the disable statemnent.
*

View File

@ -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.37 2001/04/06 02:28:02 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.38 2001/04/15 02:58:11 steve Exp $"
#endif
# include "t-dll.h"
@ -292,6 +292,12 @@ extern "C" const char* ivl_expr_string(ivl_expr_t net)
return net->u_.string_.value_;
}
extern "C" unsigned long ivl_expr_uvalue(ivl_expr_t net)
{
assert(net->type_ == IVL_EX_ULONG);
return net->u_.ulong_.value;
}
extern "C" unsigned ivl_expr_width(ivl_expr_t net)
{
assert(net);
@ -753,6 +759,19 @@ extern "C" ivl_statement_t ivl_stmt_cond_true(ivl_statement_t net)
return net->u_.condit_.stmt_ + 0;
}
extern "C" ivl_expr_t ivl_stmt_delay_expr(ivl_statement_t net)
{
switch (net->type_) {
case IVL_ST_ASSIGN:
case IVL_ST_ASSIGN_NB:
return net->u_.assign_.delay;
default:
assert(0);
return 0;
}
}
extern "C" unsigned long ivl_stmt_delay_val(ivl_statement_t net)
{
assert(net->type_ == IVL_ST_DELAY);
@ -884,6 +903,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.38 2001/04/15 02:58:11 steve
* vvp support for <= with internal delay.
*
* Revision 1.37 2001/04/06 02:28:02 steve
* Generate vvp code for functions with ports.
*

View File

@ -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.25 2001/04/07 19:26:32 steve Exp $"
#ident "$Id: t-dll-proc.cc,v 1.26 2001/04/15 02:58:11 steve Exp $"
#endif
# include "target.h"
@ -125,6 +125,7 @@ void dll_target::proc_assign(const NetAssign*net)
stmt_cur_->u_.assign_.lvals_ = cnt = net->l_val_count();
stmt_cur_->u_.assign_.lval_ = new struct ivl_lval_s[cnt];
stmt_cur_->u_.assign_.delay = 0;
for (unsigned idx = 0 ; idx < cnt ; idx += 1) {
struct ivl_lval_s*cur = stmt_cur_->u_.assign_.lval_ + idx;
@ -164,20 +165,25 @@ void dll_target::proc_assign(const NetAssign*net)
void dll_target::proc_assign_nb(const NetAssignNB*net)
{
unsigned cnt;
unsigned cnt = net->l_val_count();
unsigned long delay_val = net->l_val(0)->rise_time();
assert(stmt_cur_);
assert(stmt_cur_->type_ == IVL_ST_NONE);
stmt_cur_->type_ = IVL_ST_ASSIGN_NB;
stmt_cur_->u_.assign_.lvals_ = cnt = net->l_val_count();
stmt_cur_->u_.assign_.lval_ = new struct ivl_lval_s[cnt];
stmt_cur_->u_.assign_.lvals_ = cnt;
stmt_cur_->u_.assign_.lval_ = new struct ivl_lval_s[cnt];
stmt_cur_->u_.assign_.delay = 0;
for (unsigned idx = 0 ; idx < cnt ; idx += 1) {
struct ivl_lval_s*cur = stmt_cur_->u_.assign_.lval_ + idx;
const NetAssign_*asn = net->l_val(idx);
assert(asn->rise_time() == delay_val);
cur->width_ = asn->pin_count();
if (cur->width_ > 1) {
@ -207,6 +213,15 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
net->rval()->expr_scan(this);
stmt_cur_->u_.assign_.rval_ = expr_;
expr_ = 0;
if (delay_val > 0) {
ivl_expr_t de = new struct ivl_expr_s;
de->type_ = IVL_EX_ULONG;
de->width_ = 8 * sizeof(unsigned long);
de->signed_ = 0;
de->u_.ulong_.value = delay_val;
stmt_cur_->u_.assign_.delay = de;
}
}
@ -587,6 +602,9 @@ void dll_target::proc_while(const NetWhile*net)
/*
* $Log: t-dll-proc.cc,v $
* Revision 1.26 2001/04/15 02:58:11 steve
* vvp support for <= with internal delay.
*
* Revision 1.25 2001/04/07 19:26:32 steve
* Add the disable statemnent.
*

10
t-dll.h
View File

@ -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.37 2001/04/07 19:26:32 steve Exp $"
#ident "$Id: t-dll.h,v 1.38 2001/04/15 02:58:11 steve Exp $"
#endif
# include "target.h"
@ -172,6 +172,10 @@ struct ivl_expr_s {
unsigned short parms;
} ufunc_;
struct {
unsigned long value;
} ulong_;
struct {
char op_;
ivl_expr_t sub_;
@ -365,6 +369,7 @@ struct ivl_statement_s {
unsigned lvals_;
struct ivl_lval_s*lval_;
ivl_expr_t rval_;
ivl_expr_t delay;
} assign_;
struct { /* IVL_ST_BLOCK, IVL_ST_FORK */
@ -432,6 +437,9 @@ struct ivl_statement_s {
/*
* $Log: t-dll.h,v $
* Revision 1.38 2001/04/15 02:58:11 steve
* vvp support for <= with internal delay.
*
* Revision 1.37 2001/04/07 19:26:32 steve
* Add the disable statemnent.
*

View File

@ -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.26 2001/04/06 02:28:03 steve Exp $"
#ident "$Id: vvp_process.c,v 1.27 2001/04/15 02:58:11 steve Exp $"
#endif
# include "vvp_priv.h"
@ -156,6 +156,14 @@ static int show_stmt_assign_nb(ivl_statement_t net)
{
ivl_lval_t lval;
ivl_expr_t rval = ivl_stmt_rval(net);
ivl_expr_t del = ivl_stmt_delay_expr(net);
unsigned long delay = 0;
if (del != 0) {
/* XXXX Only support constant values. */
assert(ivl_expr_type(del) == IVL_EX_ULONG);
delay = ivl_expr_uvalue(del);
}
/* Handle the special case that the r-value is a constant. We
@ -175,7 +183,7 @@ static int show_stmt_assign_nb(ivl_statement_t net)
for (idx = 0 ; idx < ivl_lval_pins(lval) ; idx += 1)
assign_to_nexus(ivl_lval_pin(lval, idx),
bitchar_to_idx(bits[idx]), 0);
bitchar_to_idx(bits[idx]), delay);
return 0;
}
@ -195,10 +203,10 @@ static int show_stmt_assign_nb(ivl_statement_t net)
wid = ivl_lval_pins(lval);
for (idx = 0 ; idx < wid ; idx += 1)
assign_to_nexus(ivl_lval_pin(lval, idx), res.base+idx, 0);
assign_to_nexus(ivl_lval_pin(lval, idx), res.base+idx, delay);
for (idx = wid ; idx < ivl_lval_pins(lval) ; idx += 1)
assign_to_nexus(ivl_lval_pin(lval, idx), 0, 0);
assign_to_nexus(ivl_lval_pin(lval, idx), 0, delay);
clr_vector(res);
}
@ -717,6 +725,9 @@ int draw_func_definition(ivl_scope_t scope)
/*
* $Log: vvp_process.c,v $
* Revision 1.27 2001/04/15 02:58:11 steve
* vvp support for <= with internal delay.
*
* Revision 1.26 2001/04/06 02:28:03 steve
* Generate vvp code for functions with ports.
*