Support event names as expressions elements.

This commit is contained in:
steve 2003-04-22 04:48:29 +00:00
parent 299f6f8551
commit f1cc9d865b
17 changed files with 212 additions and 35 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: design_dump.cc,v 1.138 2003/03/10 23:40:53 steve Exp $"
#ident "$Id: design_dump.cc,v 1.139 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -915,6 +915,11 @@ void NetECReal::dump(ostream&o) const
o << value_;
}
void NetEEvent::dump(ostream&o) const
{
o << "<event=" << event_->name() << ">";
}
void NetEScope::dump(ostream&o) const
{
o << "<scope=" << scope_->name() << ">";
@ -1028,6 +1033,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
* Revision 1.139 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.138 2003/03/10 23:40:53 steve
* Keep parameter constants for the ivl_target API.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: dup_expr.cc,v 1.13 2003/03/15 18:08:43 steve Exp $"
#ident "$Id: dup_expr.cc,v 1.14 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -46,6 +46,12 @@ NetEConstParam* NetEConstParam::dup_expr() const
return tmp;
}
NetEEvent* NetEEvent::dup_expr() const
{
assert(0);
return 0;
}
NetEScope* NetEScope::dup_expr() const
{
assert(0);
@ -116,6 +122,9 @@ NetEVariable* NetEVariable::dup_expr() const
/*
* $Log: dup_expr.cc,v $
* Revision 1.14 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.13 2003/03/15 18:08:43 steve
* Comparison operators do have defined width.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.75 2003/04/19 04:19:38 steve Exp $"
#ident "$Id: elab_expr.cc,v 1.76 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -778,6 +778,14 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
return node;
}
// If the identifier is a named event.
// is a variable reference.
if (NetEvent*nev = des->find_event(scope, path_)) {
NetEEvent*tmp = new NetEEvent(nev);
tmp->set_line(*this);
return tmp;
}
// Finally, if this is a scope name, then return that. Look
// first to see if this is a name of a local scope. Failing
// that, search globally for a hierarchical name.
@ -953,6 +961,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
/*
* $Log: elab_expr.cc,v $
* Revision 1.76 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.75 2003/04/19 04:19:38 steve
* Set line number for ternary expressions.
*

10
emit.cc
View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: emit.cc,v 1.72 2003/03/10 23:40:53 steve Exp $"
#ident "$Id: emit.cc,v 1.73 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -435,6 +435,11 @@ void NetEParam::expr_scan(struct expr_scan_t*tgt) const
<< endl;
}
void NetEEvent::expr_scan(struct expr_scan_t*tgt) const
{
tgt->expr_event(this);
}
void NetEScope::expr_scan(struct expr_scan_t*tgt) const
{
tgt->expr_scope(this);
@ -497,6 +502,9 @@ bool emit(const Design*des, const char*type)
/*
* $Log: emit.cc,v $
* Revision 1.73 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.72 2003/03/10 23:40:53 steve
* Keep parameter constants for the ivl_target API.
*

View File

@ -26,6 +26,7 @@ ivl_expr_type
ivl_expr_bits
ivl_expr_def
ivl_expr_dvalue
ivl_expr_event
ivl_expr_lsi
ivl_expr_memory
ivl_expr_name

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: ivl_target.h,v 1.116 2003/04/11 05:18:08 steve Exp $"
#ident "$Id: ivl_target.h,v 1.117 2003/04/22 04:48:29 steve Exp $"
#endif
#ifdef __cplusplus
@ -167,25 +167,28 @@ typedef enum ivl_drive_e {
IVL_DR_SUPPLY = 7
} ivl_drive_t;
/* This is the type of an ivl_expr_t object. */
/* This is the type of an ivl_expr_t object. The explicit numbers
allow additions to the enumeration without causing values to shift
and incompatibilities to be introduced. */
typedef enum ivl_expr_type_e {
IVL_EX_NONE = 0,
IVL_EX_BITSEL,
IVL_EX_BINARY,
IVL_EX_CONCAT,
IVL_EX_MEMORY,
IVL_EX_NUMBER,
IVL_EX_SCOPE,
IVL_EX_SELECT,
IVL_EX_SFUNC,
IVL_EX_SIGNAL,
IVL_EX_STRING,
IVL_EX_TERNARY,
IVL_EX_UFUNC,
IVL_EX_ULONG,
IVL_EX_UNARY,
IVL_EX_VARIABLE,
IVL_EX_REALNUM
IVL_EX_BITSEL = 1,
IVL_EX_BINARY = 2,
IVL_EX_CONCAT = 3,
IVL_EX_EVENT = 17,
IVL_EX_MEMORY = 4,
IVL_EX_NUMBER = 5,
IVL_EX_SCOPE = 6,
IVL_EX_SELECT = 7,
IVL_EX_SFUNC = 8,
IVL_EX_SIGNAL = 9,
IVL_EX_STRING = 10,
IVL_EX_TERNARY = 11,
IVL_EX_UFUNC = 12,
IVL_EX_ULONG = 13,
IVL_EX_UNARY = 14,
IVL_EX_VARIABLE = 15,
IVL_EX_REALNUM = 16
} ivl_expr_type_t;
/* This is the type code for an ivl_net_logic_t object. */
@ -493,6 +496,8 @@ extern ivl_expr_t ivl_expr_parm(ivl_expr_t net, unsigned idx);
extern unsigned ivl_expr_parms(ivl_expr_t net);
/* IVL_EX_CONCAT */
extern unsigned ivl_expr_repeat(ivl_expr_t net);
/* IVL_EX_EVENT */
extern ivl_event_t ivl_expr_event(ivl_expr_t net);
/* IVL_EX_SCOPE */
extern ivl_scope_t ivl_expr_scope(ivl_expr_t net);
/* IVL_EX_BITSEL */
@ -1209,6 +1214,9 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
* Revision 1.117 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.116 2003/04/11 05:18:08 steve
* Handle signed magnitude compare all the
* way through to the vvp code generator.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: net_event.cc,v 1.22 2003/03/06 00:28:41 steve Exp $"
#ident "$Id: net_event.cc,v 1.23 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -35,6 +35,7 @@ NetEvent::NetEvent(const char*n)
probes_ = 0;
trig_ = 0;
waitref_ = 0;
exprref_ = 0;
wlist_ = 0;
}
@ -116,6 +117,11 @@ unsigned NetEvent::nwait() const
return waitref_;
}
unsigned NetEvent::nexpr() const
{
return exprref_;
}
/*
* A "similar" event is one that has an identical non-nil set of
* probes.
@ -443,6 +449,9 @@ NetProc* NetEvWait::statement()
/*
* $Log: net_event.cc,v $
* Revision 1.23 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.22 2003/03/06 00:28:41 steve
* All NetObj objects have lex_string base names.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: net_nex_input.cc,v 1.8 2003/01/26 21:15:58 steve Exp $"
#ident "$Id: net_nex_input.cc,v 1.9 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -102,6 +102,11 @@ NexusSet* NetEParam::nex_input()
return new NexusSet;
}
NexusSet* NetEEvent::nex_input()
{
return new NexusSet;
}
NexusSet* NetEScope::nex_input()
{
return new NexusSet;
@ -372,6 +377,9 @@ NexusSet* NetWhile::nex_input()
/*
* $Log: net_nex_input.cc,v $
* Revision 1.9 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.8 2003/01/26 21:15:58 steve
* Rework expression parsing and elaboration to
* accommodate real/realtime values and expressions.

View File

@ -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.211 2003/04/11 05:18:08 steve Exp $"
#ident "$Id: netlist.cc,v 1.212 2003/04/22 04:48:29 steve Exp $"
#endif
# include "config.h"
@ -1942,6 +1942,21 @@ NetEMemory* NetEMemory::dup_expr() const
assert(0);
}
NetEEvent::NetEEvent(NetEvent*e)
: event_(e)
{
e->exprref_ += 1;
}
NetEEvent::~NetEEvent()
{
}
const NetEvent* NetEEvent::event() const
{
return event_;
}
NetEScope::NetEScope(NetScope*s)
: scope_(s)
{
@ -2162,6 +2177,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
* Revision 1.212 2003/04/22 04:48:29 steve
* Support event names as expressions elements.
*
* Revision 1.211 2003/04/11 05:18:08 steve
* Handle signed magnitude compare all the
* way through to the vvp code generator.

View File

@ -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.285 2003/04/11 05:18:08 steve Exp $"
#ident "$Id: netlist.h,v 1.286 2003/04/22 04:48:30 steve Exp $"
#endif
/*
@ -1734,6 +1734,7 @@ class NetEvent : public LineInfo {
friend class NetEvProbe;
friend class NetEvTrig;
friend class NetEvWait;
friend class NetEEvent;
public:
// The name of the event is the basename, and should not
@ -1752,8 +1753,8 @@ class NetEvent : public LineInfo {
// Return the number of NetEvWait nodes that reference me.
unsigned nwait() const;
unsigned ntrig() const;
unsigned nexpr() const;
NetScope* scope();
const NetScope* scope() const;
@ -1795,6 +1796,9 @@ class NetEvent : public LineInfo {
};
struct wcell_ *wlist_;
// expression references, ala. task/funcs
unsigned exprref_;
private: // not implemented
NetEvent(const NetEvent&);
NetEvent& operator= (const NetEvent&);
@ -2645,6 +2649,27 @@ class NetESelect : public NetExpr {
NetExpr*base_;
};
/*
* This node is for representation of named events.
*/
class NetEEvent : public NetExpr {
public:
NetEEvent(NetEvent*);
~NetEEvent();
const NetEvent* event() const;
virtual void expr_scan(struct expr_scan_t*) const;
virtual NetEEvent* dup_expr() const;
virtual NexusSet* nex_input();
virtual void dump(ostream&os) const;
private:
NetEvent*event_;
};
/*
* This class is a special (and magical) expression node type that
* represents scope names. These can only be found as parameters to
@ -3250,6 +3275,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.286 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.285 2003/04/11 05:18:08 steve
* Handle signed magnitude compare all the
* way through to the vvp code generator.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: nodangle.cc,v 1.17 2002/08/12 01:35:00 steve Exp $"
#ident "$Id: nodangle.cc,v 1.18 2003/04/22 04:48:30 steve Exp $"
#endif
# include "config.h"
@ -46,7 +46,7 @@ void nodangle_f::event(Design*des, NetEvent*ev)
/* If there are no references to this event, then go right
ahead and delete in. There is no use looking further at
it. */
if ((ev->nwait() + ev->ntrig()) == 0) {
if ((ev->nwait() + ev->ntrig() + ev->nexpr()) == 0) {
delete ev;
etotal += 1;
return;
@ -164,6 +164,9 @@ void nodangle(Design*des)
/*
* $Log: nodangle.cc,v $
* Revision 1.18 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.17 2002/08/12 01:35:00 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll-api.cc,v 1.97 2003/04/11 05:18:08 steve Exp $"
#ident "$Id: t-dll-api.cc,v 1.98 2003/04/22 04:48:30 steve Exp $"
#endif
# include "config.h"
@ -420,6 +420,13 @@ extern "C" unsigned ivl_expr_repeat(ivl_expr_t net)
return net->u_.concat_.rept;
}
extern "C" ivl_event_t ivl_expr_event(ivl_expr_t net)
{
assert(net);
assert(net->type_ == IVL_EX_EVENT);
return net->u_.event_.event;
}
extern "C" ivl_scope_t ivl_expr_scope(ivl_expr_t net)
{
assert(net);
@ -1826,6 +1833,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
/*
* $Log: t-dll-api.cc,v $
* Revision 1.98 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.97 2003/04/11 05:18:08 steve
* Handle signed magnitude compare all the
* way through to the vvp code generator.

View File

@ -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.35 2003/03/10 23:40:53 steve Exp $"
#ident "$Id: t-dll-expr.cc,v 1.36 2003/04/22 04:48:30 steve Exp $"
#endif
# include "config.h"
@ -302,6 +302,30 @@ void dll_target::expr_creal(const NetECReal*net)
expr_->u_.real_.value = net->value().as_double();
}
void dll_target::expr_event(const NetEEvent*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
assert(expr_);
expr_->type_ = IVL_EX_EVENT;
expr_->value_= IVL_VT_VOID;
/* Locate the event by name. Save the ivl_event_t in the
expression so that the generator can find it easily. */
const NetEvent*ev = net->event();
ivl_scope_t ev_scope = lookup_scope_(ev->scope());
for (unsigned idx = 0 ; idx < ev_scope->nevent_ ; idx += 1) {
const char*ename = ivl_event_basename(ev_scope->event_[idx]);
if (strcmp(ev->name(), ename) == 0) {
expr_->u_.event_.event = ev_scope->event_[idx];
break;
}
}
}
void dll_target::expr_scope(const NetEScope*net)
{
assert(expr_ == 0);
@ -579,6 +603,9 @@ void dll_target::expr_variable(const NetEVariable*net)
/*
* $Log: t-dll-expr.cc,v $
* Revision 1.36 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.35 2003/03/10 23:40:53 steve
* Keep parameter constants for the ivl_target API.
*

10
t-dll.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: t-dll.h,v 1.101 2003/04/11 05:18:08 steve Exp $"
#ident "$Id: t-dll.h,v 1.102 2003/04/22 04:48:30 steve Exp $"
#endif
# include "target.h"
@ -134,6 +134,7 @@ struct dll_target : public target_t, public expr_scan_t {
void expr_const(const NetEConst*);
void expr_creal(const NetECReal*);
void expr_param(const NetEConstParam*);
void expr_event(const NetEEvent*);
void expr_scope(const NetEScope*);
void expr_select(const NetESelect*);
void expr_sfunc(const NetESFunc*);
@ -217,6 +218,10 @@ struct ivl_expr_s {
ivl_parameter_t parameter;
} number_;
struct {
ivl_event_t event;
} event_;
struct {
ivl_scope_t scope;
} scope_;
@ -673,6 +678,9 @@ struct ivl_variable_s {
/*
* $Log: t-dll.h,v $
* Revision 1.102 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.101 2003/04/11 05:18:08 steve
* Handle signed magnitude compare all the
* way through to the vvp code generator.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: target.cc,v 1.66 2003/03/10 23:40:54 steve Exp $"
#ident "$Id: target.cc,v 1.67 2003/04/22 04:48:30 steve Exp $"
#endif
# include "config.h"
@ -346,6 +346,12 @@ void expr_scan_t::expr_memory(const NetEMemory*)
"unhandled expr_memory." << endl;
}
void expr_scan_t::expr_event(const NetEEvent*)
{
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
"unhandled expr_event." << endl;
}
void expr_scan_t::expr_scope(const NetEScope*)
{
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
@ -408,6 +414,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
/*
* $Log: target.cc,v $
* Revision 1.67 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.66 2003/03/10 23:40:54 steve
* Keep parameter constants for the ivl_target API.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: target.h,v 1.62 2003/03/10 23:40:54 steve Exp $"
#ident "$Id: target.h,v 1.63 2003/04/22 04:48:30 steve Exp $"
#endif
# include "netlist.h"
@ -135,6 +135,7 @@ struct expr_scan_t {
virtual void expr_creal(const NetECReal*);
virtual void expr_concat(const NetEConcat*);
virtual void expr_memory(const NetEMemory*);
virtual void expr_event(const NetEEvent*);
virtual void expr_scope(const NetEScope*);
virtual void expr_select(const NetESelect*);
virtual void expr_sfunc(const NetESFunc*);
@ -168,6 +169,9 @@ extern const struct target *target_table[];
/*
* $Log: target.h,v $
* Revision 1.63 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.62 2003/03/10 23:40:54 steve
* Keep parameter constants for the ivl_target API.
*

View File

@ -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.6 2003/04/12 23:25:20 steve Exp $"
#ident "$Id: draw_vpi.c,v 1.7 2003/04/22 04:48:30 steve Exp $"
#endif
# include "vvp_priv.h"
@ -77,6 +77,7 @@ static void draw_vpi_taskfunc_args(const char*call_string,
case IVL_EX_NONE:
case IVL_EX_NUMBER:
case IVL_EX_STRING:
case IVL_EX_EVENT:
case IVL_EX_SCOPE:
case IVL_EX_VARIABLE:
continue;
@ -198,6 +199,10 @@ static void draw_vpi_taskfunc_args(const char*call_string,
}
continue;
case IVL_EX_EVENT:
fprintf(vvp_out, ", E_%p", ivl_expr_event(expr));
continue;
case IVL_EX_SCOPE:
fprintf(vvp_out, ", S_%p", ivl_expr_scope(expr));
continue;
@ -289,6 +294,9 @@ int draw_vpi_rfunc_call(ivl_expr_t fnet)
/*
* $Log: draw_vpi.c,v $
* Revision 1.7 2003/04/22 04:48:30 steve
* Support event names as expressions elements.
*
* Revision 1.6 2003/04/12 23:25:20 steve
* Properly pass $signed(signal) to tasks.
*