parent
46253ed873
commit
04ada23119
65
net_expr.cc
65
net_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_expr.cc,v 1.11 2003/01/26 21:15:58 steve Exp $"
|
||||
#ident "$Id: net_expr.cc,v 1.12 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -344,8 +344,71 @@ bool NetESelect::set_width(unsigned w)
|
|||
return false;
|
||||
}
|
||||
|
||||
NetESFunc::NetESFunc(const string&n, unsigned width, unsigned np)
|
||||
: name_(0)
|
||||
{
|
||||
name_ = new char [n.length()+1];
|
||||
strcpy(name_, n.c_str());
|
||||
expr_width(width);
|
||||
nparms_ = np;
|
||||
parms_ = new NetExpr*[np];
|
||||
for (unsigned idx = 0 ; idx < nparms_ ; idx += 1)
|
||||
parms_[idx] = 0;
|
||||
}
|
||||
|
||||
NetESFunc::~NetESFunc()
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < nparms_ ; idx += 1)
|
||||
if (parms_[idx]) delete parms_[idx];
|
||||
|
||||
delete[]parms_;
|
||||
delete[]name_;
|
||||
}
|
||||
|
||||
const char* NetESFunc::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
unsigned NetESFunc::nparms() const
|
||||
{
|
||||
return nparms_;
|
||||
}
|
||||
|
||||
void NetESFunc::parm(unsigned idx, NetExpr*v)
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
if (parms_[idx])
|
||||
delete parms_[idx];
|
||||
parms_[idx] = v;
|
||||
}
|
||||
|
||||
const NetExpr* NetESFunc::parm(unsigned idx) const
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
return parms_[idx];
|
||||
}
|
||||
|
||||
NetExpr* NetESFunc::parm(unsigned idx)
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
return parms_[idx];
|
||||
}
|
||||
|
||||
NetExpr::TYPE NetESFunc::expr_type() const
|
||||
{
|
||||
if (strcmp(name_,"$realtime") == 0)
|
||||
return ET_REAL;
|
||||
|
||||
return ET_VECTOR;
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: net_expr.cc,v $
|
||||
* Revision 1.12 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.11 2003/01/26 21:15:58 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
57
netlist.cc
57
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.cc,v 1.204 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.205 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1989,57 +1989,6 @@ const NetScope* NetEScope::scope() const
|
|||
return scope_;
|
||||
}
|
||||
|
||||
NetESFunc::NetESFunc(const string&n, unsigned width, unsigned np)
|
||||
: name_(0)
|
||||
{
|
||||
name_ = new char [n.length()+1];
|
||||
strcpy(name_, n.c_str());
|
||||
expr_width(width);
|
||||
nparms_ = np;
|
||||
parms_ = new NetExpr*[np];
|
||||
for (unsigned idx = 0 ; idx < nparms_ ; idx += 1)
|
||||
parms_[idx] = 0;
|
||||
}
|
||||
|
||||
NetESFunc::~NetESFunc()
|
||||
{
|
||||
for (unsigned idx = 0 ; idx < nparms_ ; idx += 1)
|
||||
if (parms_[idx]) delete parms_[idx];
|
||||
|
||||
delete[]parms_;
|
||||
delete[]name_;
|
||||
}
|
||||
|
||||
const char* NetESFunc::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
unsigned NetESFunc::nparms() const
|
||||
{
|
||||
return nparms_;
|
||||
}
|
||||
|
||||
void NetESFunc::parm(unsigned idx, NetExpr*v)
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
if (parms_[idx])
|
||||
delete parms_[idx];
|
||||
parms_[idx] = v;
|
||||
}
|
||||
|
||||
const NetExpr* NetESFunc::parm(unsigned idx) const
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
return parms_[idx];
|
||||
}
|
||||
|
||||
NetExpr* NetESFunc::parm(unsigned idx)
|
||||
{
|
||||
assert(idx < nparms_);
|
||||
return parms_[idx];
|
||||
}
|
||||
|
||||
NetESignal::NetESignal(NetNet*n)
|
||||
: NetExpr(n->pin_count()), net_(n)
|
||||
{
|
||||
|
|
@ -2246,6 +2195,10 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.205 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.204 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.h,v 1.272 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.273 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -2640,6 +2640,7 @@ class NetESFunc : public NetExpr {
|
|||
NetExpr* parm(unsigned idx);
|
||||
const NetExpr* parm(unsigned idx) const;
|
||||
|
||||
virtual TYPE expr_type() const;
|
||||
virtual NexusSet* nex_input();
|
||||
virtual bool set_width(unsigned);
|
||||
virtual void dump(ostream&) const;
|
||||
|
|
@ -3190,6 +3191,10 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.273 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.272 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-expr.cc,v 1.30 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.31 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -328,7 +328,18 @@ void dll_target::expr_sfunc(const NetESFunc*net)
|
|||
assert(expr);
|
||||
|
||||
expr->type_ = IVL_EX_SFUNC;
|
||||
expr->value_= IVL_VT_VECTOR;
|
||||
switch (net->expr_type()) {
|
||||
case NetExpr::ET_VECTOR:
|
||||
expr->value_= IVL_VT_VECTOR;
|
||||
break;
|
||||
case NetExpr::ET_REAL:
|
||||
expr->value_= IVL_VT_REAL;
|
||||
break;
|
||||
case NetExpr::ET_VOID:
|
||||
assert(0);
|
||||
expr->value_= IVL_VT_VECTOR;
|
||||
break;
|
||||
}
|
||||
expr->width_= net->expr_width();
|
||||
expr->u_.sfunc_.name_ = strdup(net->name());
|
||||
|
||||
|
|
@ -550,6 +561,10 @@ void dll_target::expr_variable(const NetEVariable*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.31 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.30 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -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.89 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: eval_expr.c,v 1.90 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -1685,8 +1685,10 @@ static struct vector_info draw_sfunc_expr(ivl_expr_t exp, unsigned wid)
|
|||
fprintf(vvp_out, ", $time");
|
||||
else if (strcmp("$stime", ivl_expr_name(expr)) == 0)
|
||||
fprintf(vvp_out, ", $stime");
|
||||
else if (strcmp("$realtime", ivl_expr_name(expr)) == 0)
|
||||
fprintf(vvp_out, ", $realtime");
|
||||
else
|
||||
fprintf(vvp_out, ", ?");
|
||||
fprintf(vvp_out, ", ?%s?", ivl_expr_name(expr));
|
||||
continue;
|
||||
|
||||
case IVL_EX_MEMORY:
|
||||
|
|
@ -2099,6 +2101,10 @@ struct vector_info draw_eval_expr(ivl_expr_t exp, int stuff_ok_flag)
|
|||
|
||||
/*
|
||||
* $Log: eval_expr.c,v $
|
||||
* Revision 1.90 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.89 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -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.1 2003/01/26 21:16:00 steve Exp $"
|
||||
#ident "$Id: eval_real.c,v 1.2 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -139,6 +139,19 @@ static int draw_realnum_real(ivl_expr_t exp)
|
|||
return res;
|
||||
}
|
||||
|
||||
static int draw_sfunc_real(ivl_expr_t exp)
|
||||
{
|
||||
int res;
|
||||
assert(ivl_expr_parms(exp) == 0);
|
||||
assert(ivl_expr_value(exp) == IVL_VT_REAL);
|
||||
|
||||
res = allocate_word();
|
||||
fprintf(vvp_out, " %%vpi_func/r \"%s\", %d;\n",
|
||||
ivl_expr_name(exp), res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* The real value of a signal is the integer value of a signal
|
||||
* converted to real.
|
||||
|
|
@ -178,6 +191,10 @@ int draw_eval_real(ivl_expr_t exp)
|
|||
res = draw_variable_real(exp);
|
||||
break;
|
||||
|
||||
case IVL_EX_SFUNC:
|
||||
res = draw_sfunc_real(exp);
|
||||
break;
|
||||
|
||||
case IVL_EX_SIGNAL:
|
||||
res = draw_signal_real(exp);
|
||||
break;
|
||||
|
|
@ -194,6 +211,10 @@ int draw_eval_real(ivl_expr_t exp)
|
|||
|
||||
/*
|
||||
* $Log: eval_real.c,v $
|
||||
* Revision 1.2 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.1 2003/01/26 21:16:00 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -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.77 2003/01/26 21:16:00 steve Exp $"
|
||||
#ident "$Id: vvp_process.c,v 1.78 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -1313,9 +1313,11 @@ static int show_system_task_call(ivl_statement_t net)
|
|||
if (strcmp("$time", ivl_expr_name(expr)) == 0)
|
||||
fprintf(vvp_out, ", $time");
|
||||
else if (strcmp("$stime", ivl_expr_name(expr)) == 0)
|
||||
fprintf(vvp_out, ", $time");
|
||||
fprintf(vvp_out, ", $stime");
|
||||
else if (strcmp("$realtime", ivl_expr_name(expr)) == 0)
|
||||
fprintf(vvp_out, ", $realtime");
|
||||
else
|
||||
fprintf(vvp_out, ", ?");
|
||||
fprintf(vvp_out, ", ?%s?", ivl_expr_name(expr));
|
||||
continue;
|
||||
|
||||
case IVL_EX_MEMORY:
|
||||
|
|
@ -1563,6 +1565,10 @@ int draw_func_definition(ivl_scope_t scope)
|
|||
|
||||
/*
|
||||
* $Log: vvp_process.c,v $
|
||||
* Revision 1.78 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.77 2003/01/26 21:16:00 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: sys_time.c,v 1.5 2002/12/21 00:55:58 steve Exp $"
|
||||
#ident "$Id: sys_time.c,v 1.6 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -89,6 +89,49 @@ static int sys_time_calltf(char*name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sys_realtime_calltf(char*name)
|
||||
{
|
||||
s_vpi_value val;
|
||||
s_vpi_time now;
|
||||
vpiHandle call_handle;
|
||||
vpiHandle mod;
|
||||
int units, prec;
|
||||
double scale;
|
||||
|
||||
call_handle = vpi_handle(vpiSysTfCall, 0);
|
||||
assert(call_handle);
|
||||
|
||||
mod = module_of_function(call_handle);
|
||||
|
||||
now.type = vpiSimTime;
|
||||
vpi_get_time(0, &now);
|
||||
|
||||
/* All the variants but $simtime return the time in units of
|
||||
the local scope. The $simtime function returns the
|
||||
simulation time. */
|
||||
if (strcmp(name, "$simtime") == 0)
|
||||
units = vpi_get(vpiTimePrecision, 0);
|
||||
else
|
||||
units = vpi_get(vpiTimeUnit, mod);
|
||||
|
||||
prec = vpi_get(vpiTimePrecision, 0);
|
||||
scale = 1;
|
||||
while (units > prec) {
|
||||
scale *= 10;
|
||||
units -= 1;
|
||||
}
|
||||
|
||||
val.format = vpiRealVal;
|
||||
val.value.real = now.low;
|
||||
assert(now.high == 0);
|
||||
|
||||
val.value.real /= scale;
|
||||
|
||||
vpi_put_value(call_handle, &val, 0, vpiNoDelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sys_time_register()
|
||||
{
|
||||
s_vpi_systf_data tf_data;
|
||||
|
|
@ -101,6 +144,14 @@ void sys_time_register()
|
|||
tf_data.user_data = "$time";
|
||||
vpi_register_systf(&tf_data);
|
||||
|
||||
tf_data.type = vpiSysFunc;
|
||||
tf_data.tfname = "$realtime";
|
||||
tf_data.calltf = sys_realtime_calltf;
|
||||
tf_data.compiletf = 0;
|
||||
tf_data.sizetf = 0;
|
||||
tf_data.user_data = "$realtime";
|
||||
vpi_register_systf(&tf_data);
|
||||
|
||||
tf_data.type = vpiSysFunc;
|
||||
tf_data.tfname = "$stime";
|
||||
tf_data.calltf = sys_time_calltf;
|
||||
|
|
@ -120,6 +171,10 @@ void sys_time_register()
|
|||
|
||||
/*
|
||||
* $Log: sys_time.c,v $
|
||||
* Revision 1.6 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.5 2002/12/21 00:55:58 steve
|
||||
* The $time system task returns the integer time
|
||||
* scaled to the local units. Change the internal
|
||||
|
|
|
|||
|
|
@ -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.149 2003/01/26 18:16:22 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.150 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
|
|
@ -444,6 +444,12 @@ void compile_vpi_lookup(vpiHandle *handle, char*label)
|
|||
return;
|
||||
}
|
||||
|
||||
if (strcmp(label, "$realtime") == 0) {
|
||||
*handle = vpip_sim_time(vpip_peek_current_scope());
|
||||
free(label);
|
||||
return;
|
||||
}
|
||||
|
||||
struct vpi_handle_resolv_list_s*res
|
||||
= new struct vpi_handle_resolv_list_s;
|
||||
|
||||
|
|
@ -1409,7 +1415,7 @@ void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
|
|||
}
|
||||
|
||||
void compile_vpi_func_call(char*label, char*name,
|
||||
unsigned vbit, unsigned vwid,
|
||||
unsigned vbit, int vwid,
|
||||
unsigned argc, vpiHandle*argv)
|
||||
{
|
||||
if (label)
|
||||
|
|
@ -1507,6 +1513,10 @@ void compile_net(char*label, char*name, int msb, int lsb, bool signed_flag,
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.150 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.149 2003/01/26 18:16:22 steve
|
||||
* Add %cvt/ir and %cvt/ri instructions, and support
|
||||
* real values passed as arguments to VPI tasks.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compile.h,v 1.47 2003/01/25 23:48:06 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.48 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -224,8 +224,12 @@ extern void compile_disable(char*label, struct symb_s symb);
|
|||
extern void compile_vpi_call(char*label, char*name,
|
||||
unsigned argc, vpiHandle*argv);
|
||||
|
||||
/* Compile a function call. The vbit and vwid encode the return
|
||||
type. If the vwid >0, the return type is a vector. If the vwid is
|
||||
<0, the return type is -vpiRealConst or some other constant subtype
|
||||
code that represents the function type. */
|
||||
extern void compile_vpi_func_call(char*label, char*name,
|
||||
unsigned vbit, unsigned vwid,
|
||||
unsigned vbit, int vwid,
|
||||
unsigned argc, vpiHandle*argv);
|
||||
|
||||
extern void compile_fork(char*label, struct symb_s targ_s,
|
||||
|
|
@ -257,6 +261,10 @@ extern void compile_net(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.48 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.47 2003/01/25 23:48:06 steve
|
||||
* Add thread word array, and add the instructions,
|
||||
* %add/wr, %cmp/wr, %load/wr, %mul/wr and %set/wr.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: lexor.lex,v 1.36 2003/01/25 23:48:06 steve Exp $"
|
||||
#ident "$Id: lexor.lex,v 1.37 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -120,6 +120,7 @@
|
|||
|
||||
"%vpi_call" { return K_vpi_call; }
|
||||
"%vpi_func" { return K_vpi_func; }
|
||||
"%vpi_func/r" { return K_vpi_func_r; }
|
||||
"%disable" { return K_disable; }
|
||||
"%fork" { return K_fork; }
|
||||
|
||||
|
|
@ -175,6 +176,10 @@ int yywrap()
|
|||
|
||||
/*
|
||||
* $Log: lexor.lex,v $
|
||||
* Revision 1.37 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.36 2003/01/25 23:48:06 steve
|
||||
* Add thread word array, and add the instructions,
|
||||
* %add/wr, %cmp/wr, %load/wr, %mul/wr and %set/wr.
|
||||
|
|
|
|||
13
vvp/parse.y
13
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: parse.y,v 1.49 2003/01/25 23:48:06 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.50 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -64,7 +64,8 @@ extern FILE*yyin;
|
|||
%token K_UDP K_UDP_C K_UDP_S
|
||||
%token K_MEM K_MEM_P K_MEM_I
|
||||
%token K_FORCE K_WORD
|
||||
%token K_VAR K_VAR_S K_VAR_I K_vpi_call K_vpi_func K_disable K_fork
|
||||
%token K_VAR K_VAR_S K_VAR_I K_vpi_call K_vpi_func K_vpi_func_r
|
||||
%token K_disable K_fork
|
||||
%token K_vpi_module K_vpi_time_precision
|
||||
|
||||
%token <text> T_INSTR
|
||||
|
|
@ -277,6 +278,10 @@ statement
|
|||
T_NUMBER ',' T_NUMBER argument_opt ';'
|
||||
{ compile_vpi_func_call($1, $3, $5, $7, $8.argc, $8.argv); }
|
||||
|
||||
| label_opt K_vpi_func_r T_STRING ',' T_NUMBER argument_opt ';'
|
||||
{ compile_vpi_func_call($1, $3, $5, -vpiRealConst,
|
||||
$6.argc, $6.argv); }
|
||||
|
||||
/* %disable statements are instructions that takes a scope reference
|
||||
as an operand. It therefore is parsed uniquely. */
|
||||
|
||||
|
|
@ -564,6 +569,10 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.50 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.49 2003/01/25 23:48:06 steve
|
||||
* Add thread word array, and add the instructions,
|
||||
* %add/wr, %cmp/wr, %load/wr, %mul/wr and %set/wr.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_priv.h,v 1.44 2003/01/26 18:16:22 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.45 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -248,7 +248,8 @@ struct __vpiSysTaskCall {
|
|||
/* Support for vpi_get_userdata. */
|
||||
void*userdata;
|
||||
/* These represent where in the vthread to put the return value. */
|
||||
unsigned short vbit, vwid;
|
||||
unsigned short vbit;
|
||||
signed short vwid;
|
||||
};
|
||||
|
||||
extern struct __vpiSysTaskCall*vpip_cur_task;
|
||||
|
|
@ -321,7 +322,7 @@ extern unsigned vpip_module_path_cnt;
|
|||
* not be released by the caller.
|
||||
*/
|
||||
extern vpiHandle vpip_build_vpi_call(const char*name,
|
||||
unsigned vbit, unsigned vwid,
|
||||
unsigned vbit, int vwid,
|
||||
unsigned argc,
|
||||
vpiHandle*argv);
|
||||
|
||||
|
|
@ -392,6 +393,10 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.45 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.44 2003/01/26 18:16:22 steve
|
||||
* Add %cvt/ir and %cvt/ri instructions, and support
|
||||
* real values passed as arguments to VPI tasks.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_real.cc,v 1.1 2003/01/25 23:48:06 steve Exp $"
|
||||
#ident "$Id: vpi_real.cc,v 1.2 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_priv.h"
|
||||
|
|
@ -39,6 +39,7 @@ static void real_var_get_value(vpiHandle ref, s_vpi_value*vp)
|
|||
{
|
||||
assert(ref->vpi_type->type_code == vpiRealVar);
|
||||
|
||||
static char buf[64];
|
||||
struct __vpiRealVar*rfp = (struct __vpiRealVar*)ref;
|
||||
|
||||
switch (vp->format) {
|
||||
|
|
@ -47,6 +48,11 @@ static void real_var_get_value(vpiHandle ref, s_vpi_value*vp)
|
|||
case vpiRealVal:
|
||||
vp->value.real = rfp->value;
|
||||
break;
|
||||
case vpiDecStrVal:
|
||||
sprintf(buf, "%0.0f", rfp->value);
|
||||
vp->value.str = buf;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "ERROR: Unsupported format code: %d\n",
|
||||
vp->format);
|
||||
|
|
@ -100,6 +106,10 @@ vpiHandle vpip_make_real_var(const char*name)
|
|||
|
||||
/*
|
||||
* $Log: vpi_real.cc,v $
|
||||
* Revision 1.2 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.1 2003/01/25 23:48:06 steve
|
||||
* Add thread word array, and add the instructions,
|
||||
* %add/wr, %cmp/wr, %load/wr, %mul/wr and %set/wr.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_tasks.cc,v 1.18 2003/01/09 04:09:44 steve Exp $"
|
||||
#ident "$Id: vpi_tasks.cc,v 1.19 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -118,7 +118,7 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp,
|
|||
|
||||
case vpiIntVal: {
|
||||
long val = vp->value.integer;
|
||||
for (unsigned idx = 0 ; idx < rfp->vwid ; idx += 1) {
|
||||
for (int idx = 0 ; idx < rfp->vwid ; idx += 1) {
|
||||
vthread_put_bit(vpip_current_vthread,
|
||||
rfp->vbit+idx, val&1);
|
||||
val >>= 1;
|
||||
|
|
@ -150,7 +150,7 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp,
|
|||
|
||||
unsigned long aval = vp->value.vector->aval;
|
||||
unsigned long bval = vp->value.vector->bval;
|
||||
for (unsigned idx = 0 ; idx < rfp->vwid ; idx += 1) {
|
||||
for (int idx = 0 ; idx < rfp->vwid ; idx += 1) {
|
||||
int bit = (aval&1) | (((bval^aval)<<1)&2);
|
||||
|
||||
vthread_put_bit(vpip_current_vthread,
|
||||
|
|
@ -169,6 +169,34 @@ static vpiHandle sysfunc_put_value(vpiHandle ref, p_vpi_value vp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static vpiHandle sysfunc_put_real_value(vpiHandle ref, p_vpi_value vp,
|
||||
p_vpi_time t, int flags)
|
||||
{
|
||||
assert(ref->vpi_type->type_code == vpiSysFuncCall);
|
||||
|
||||
struct __vpiSysTaskCall*rfp = (struct __vpiSysTaskCall*)ref;
|
||||
|
||||
/* delays are not allowed. */
|
||||
assert(flags == vpiNoDelay);
|
||||
/* Make sure this is a real valued function. */
|
||||
assert(rfp->vwid == -vpiRealConst);
|
||||
|
||||
double val = 0.0;
|
||||
|
||||
switch (vp->format) {
|
||||
|
||||
case vpiRealVal:
|
||||
val = vp->value.real;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
vthread_put_real(vpip_current_vthread, rfp->vbit, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_rt = {
|
||||
vpiSysFuncCall,
|
||||
|
|
@ -180,6 +208,16 @@ static const struct __vpirt vpip_sysfunc_rt = {
|
|||
systask_iter
|
||||
};
|
||||
|
||||
static const struct __vpirt vpip_sysfunc_real_rt = {
|
||||
vpiSysFuncCall,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
sysfunc_put_real_value,
|
||||
systask_handle,
|
||||
systask_iter
|
||||
};
|
||||
|
||||
/* **** Manipulate the internal datastructures. **** */
|
||||
|
||||
static struct __vpiUserSystf**def_table = 0;
|
||||
|
|
@ -225,7 +263,7 @@ static struct __vpiUserSystf* vpip_find_systf(const char*name)
|
|||
* describes the call, and return it. The %vpi_call instruction will
|
||||
* store this handle for when it is executed.
|
||||
*/
|
||||
vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, unsigned vwid,
|
||||
vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, int vwid,
|
||||
unsigned argc, vpiHandle*argv)
|
||||
{
|
||||
struct __vpiUserSystf*defn = vpip_find_systf(name);
|
||||
|
|
@ -237,7 +275,7 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, unsigned vwid,
|
|||
|
||||
switch (defn->info.type) {
|
||||
case vpiSysTask:
|
||||
if (vwid > 0) {
|
||||
if (vwid != 0) {
|
||||
fprintf(stderr, "%s: This is a system Task, "
|
||||
"you cannot call it as a Function\n", name);
|
||||
return 0;
|
||||
|
|
@ -251,7 +289,6 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, unsigned vwid,
|
|||
"you cannot call it as a Task\n", name);
|
||||
return 0;
|
||||
}
|
||||
assert(vwid > 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -266,7 +303,19 @@ vpiHandle vpip_build_vpi_call(const char*name, unsigned vbit, unsigned vwid,
|
|||
break;
|
||||
|
||||
case vpiSysFunc:
|
||||
obj->base.vpi_type = &vpip_sysfunc_rt;
|
||||
if (vwid > 0) {
|
||||
obj->base.vpi_type = &vpip_sysfunc_rt;
|
||||
|
||||
} else switch (vwid) {
|
||||
|
||||
case -vpiRealConst:
|
||||
obj->base.vpi_type = &vpip_sysfunc_real_rt;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
obj->base.vpi_type = &vpip_sysfunc_rt;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -365,6 +414,10 @@ void* vpi_get_userdata(vpiHandle ref)
|
|||
|
||||
/*
|
||||
* $Log: vpi_tasks.cc,v $
|
||||
* Revision 1.19 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.18 2003/01/09 04:09:44 steve
|
||||
* Add vpi_put_userdata
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.98 2003/01/26 18:16:22 steve Exp $"
|
||||
#ident "$Id: vthread.cc,v 1.99 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vthread.h"
|
||||
|
|
@ -187,6 +187,11 @@ double vthread_get_real(struct vthread_s*thr, unsigned addr)
|
|||
return thr->words[addr].w_real;
|
||||
}
|
||||
|
||||
void vthread_put_real(struct vthread_s*thr, unsigned addr, double val)
|
||||
{
|
||||
thr->words[addr].w_real = val;
|
||||
}
|
||||
|
||||
static unsigned long* vector_to_array(struct vthread_s*thr,
|
||||
unsigned addr, unsigned wid)
|
||||
{
|
||||
|
|
@ -2603,6 +2608,10 @@ bool of_CALL_UFUNC(vthread_t thr, vvp_code_t cp)
|
|||
|
||||
/*
|
||||
* $Log: vthread.cc,v $
|
||||
* Revision 1.99 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.98 2003/01/26 18:16:22 steve
|
||||
* Add %cvt/ir and %cvt/ri instructions, and support
|
||||
* real values passed as arguments to VPI tasks.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vthread.h,v 1.9 2003/01/26 18:16:22 steve Exp $"
|
||||
#ident "$Id: vthread.h,v 1.10 2003/01/27 00:14:37 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -72,9 +72,14 @@ extern unsigned vthread_get_bit(struct vthread_s*thr, unsigned addr);
|
|||
extern void vthread_put_bit(struct vthread_s*thr, unsigned addr, unsigned bit);
|
||||
|
||||
extern double vthread_get_real(struct vthread_s*thr, unsigned addr);
|
||||
extern void vthread_put_real(struct vthread_s*thr, unsigned addr, double val);
|
||||
|
||||
/*
|
||||
* $Log: vthread.h,v $
|
||||
* Revision 1.10 2003/01/27 00:14:37 steve
|
||||
* Support in various contexts the $realtime
|
||||
* system task.
|
||||
*
|
||||
* Revision 1.9 2003/01/26 18:16:22 steve
|
||||
* Add %cvt/ir and %cvt/ri instructions, and support
|
||||
* real values passed as arguments to VPI tasks.
|
||||
|
|
|
|||
Loading…
Reference in New Issue