Support the NetESubSignal expressions in vvp.tgt.

This commit is contained in:
steve 2001-07-22 00:17:49 +00:00
parent 0bb9359c05
commit ce589da58a
9 changed files with 145 additions and 64 deletions

View File

@ -32,6 +32,7 @@ ivl_expr_parm
ivl_expr_parms ivl_expr_parms
ivl_expr_repeat ivl_expr_repeat
ivl_expr_scope ivl_expr_scope
ivl_expr_signal
ivl_expr_signed ivl_expr_signed
ivl_expr_string ivl_expr_string
ivl_expr_uvalue ivl_expr_uvalue

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: ivl_target.h,v 1.72 2001/07/19 04:55:06 steve Exp $" #ident "$Id: ivl_target.h,v 1.73 2001/07/22 00:17:49 steve Exp $"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -158,6 +158,7 @@ typedef enum ivl_drive_e {
/* This is the type of an ivl_expr_t object. */ /* This is the type of an ivl_expr_t object. */
typedef enum ivl_expr_type_e { typedef enum ivl_expr_type_e {
IVL_EX_NONE = 0, IVL_EX_NONE = 0,
IVL_EX_BITSEL,
IVL_EX_BINARY, IVL_EX_BINARY,
IVL_EX_CONCAT, IVL_EX_CONCAT,
IVL_EX_MEMORY, IVL_EX_MEMORY,
@ -166,7 +167,6 @@ typedef enum ivl_expr_type_e {
IVL_EX_SFUNC, IVL_EX_SFUNC,
IVL_EX_SIGNAL, IVL_EX_SIGNAL,
IVL_EX_STRING, IVL_EX_STRING,
IVL_EX_SUBSIG,
IVL_EX_TERNARY, IVL_EX_TERNARY,
IVL_EX_UFUNC, IVL_EX_UFUNC,
IVL_EX_ULONG, IVL_EX_ULONG,
@ -398,7 +398,7 @@ extern ivl_scope_t ivl_expr_def(ivl_expr_t net);
extern const char* ivl_expr_name(ivl_expr_t net); extern const char* ivl_expr_name(ivl_expr_t net);
/* IVL_EX_BINARY IVL_EX_UNARY */ /* IVL_EX_BINARY IVL_EX_UNARY */
extern char ivl_expr_opcode(ivl_expr_t net); extern char ivl_expr_opcode(ivl_expr_t net);
/* IVL_EX_BINARY IVL_EX_UNARY, IVL_EX_MEMORY IVL_EX_TERNARY */ /* IVL_EX_BINARY IVL_EX_BITSEL IVL_EX_UNARY, IVL_EX_MEMORY IVL_EX_TERNARY */
extern ivl_expr_t ivl_expr_oper1(ivl_expr_t net); extern ivl_expr_t ivl_expr_oper1(ivl_expr_t net);
/* IVL_EX_BINARY IVL_EX_TERNARY */ /* IVL_EX_BINARY IVL_EX_TERNARY */
extern ivl_expr_t ivl_expr_oper2(ivl_expr_t net); extern ivl_expr_t ivl_expr_oper2(ivl_expr_t net);
@ -412,6 +412,8 @@ extern unsigned ivl_expr_parms(ivl_expr_t net);
extern unsigned ivl_expr_repeat(ivl_expr_t net); extern unsigned ivl_expr_repeat(ivl_expr_t net);
/* IVL_EX_SCOPE */ /* IVL_EX_SCOPE */
extern ivl_scope_t ivl_expr_scope(ivl_expr_t net); extern ivl_scope_t ivl_expr_scope(ivl_expr_t net);
/* IVL_EX_BITSEL */
extern ivl_signal_t ivl_expr_signal(ivl_expr_t net);
/* any expression */ /* any expression */
extern int ivl_expr_signed(ivl_expr_t net); extern int ivl_expr_signed(ivl_expr_t net);
/* IVL_EX_STRING */ /* IVL_EX_STRING */
@ -892,6 +894,9 @@ _END_DECL
/* /*
* $Log: ivl_target.h,v $ * $Log: ivl_target.h,v $
* Revision 1.73 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.72 2001/07/19 04:55:06 steve * Revision 1.72 2001/07/19 04:55:06 steve
* Support calculated delays in vvp.tgt. * Support calculated delays in vvp.tgt.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.cc,v 1.166 2001/07/07 03:01:37 steve Exp $" #ident "$Id: netlist.cc,v 1.167 2001/07/22 00:17:49 steve Exp $"
#endif #endif
# include <cassert> # include <cassert>
@ -2208,6 +2208,11 @@ NetESignal* NetESignal::dup_expr() const
assert(0); assert(0);
} }
const NetNet* NetESignal::sig() const
{
return net_;
}
NetESubSignal::NetESubSignal(NetESignal*sig, NetExpr*ex) NetESubSignal::NetESubSignal(NetESignal*sig, NetExpr*ex)
: sig_(sig), idx_(ex) : sig_(sig), idx_(ex)
{ {
@ -2226,6 +2231,11 @@ string NetESubSignal::name() const
return sig_->name(); return sig_->name();
} }
const NetNet* NetESubSignal::sig() const
{
return sig_->sig();
}
NetESubSignal* NetESubSignal::dup_expr() const NetESubSignal* NetESubSignal::dup_expr() const
{ {
assert(0); assert(0);
@ -2348,6 +2358,9 @@ const NetProc*NetTaskDef::proc() const
/* /*
* $Log: netlist.cc,v $ * $Log: netlist.cc,v $
* Revision 1.167 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.166 2001/07/07 03:01:37 steve * Revision 1.166 2001/07/07 03:01:37 steve
* Detect and make available to t-dll the right shift. * Detect and make available to t-dll the right shift.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.211 2001/07/04 22:59:25 steve Exp $" #ident "$Id: netlist.h,v 1.212 2001/07/22 00:17:49 steve Exp $"
#endif #endif
/* /*
@ -2473,6 +2473,8 @@ class NetESignal : public NetExpr {
unsigned pin_count() const; unsigned pin_count() const;
Link& pin(unsigned idx); Link& pin(unsigned idx);
const NetNet* sig() const;
virtual void expr_scan(struct expr_scan_t*) const; virtual void expr_scan(struct expr_scan_t*) const;
virtual void dump(ostream&) const; virtual void dump(ostream&) const;
@ -2499,6 +2501,8 @@ class NetESubSignal : public NetExpr {
virtual bool set_width(unsigned); virtual bool set_width(unsigned);
const NetNet* sig() const;
NetESubSignal* dup_expr() const; NetESubSignal* dup_expr() const;
virtual void expr_scan(struct expr_scan_t*) const; virtual void expr_scan(struct expr_scan_t*) const;
@ -2812,6 +2816,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.212 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.211 2001/07/04 22:59:25 steve * Revision 1.211 2001/07/04 22:59:25 steve
* handle left shifter in dll output. * handle left shifter in dll output.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-dll-api.cc,v 1.56 2001/07/19 04:55:06 steve Exp $" #ident "$Id: t-dll-api.cc,v 1.57 2001/07/22 00:17:49 steve Exp $"
#endif #endif
# include "t-dll.h" # include "t-dll.h"
@ -204,7 +204,7 @@ extern "C" const char* ivl_expr_name(ivl_expr_t net)
return net->u_.sfunc_.name_; return net->u_.sfunc_.name_;
case IVL_EX_SIGNAL: case IVL_EX_SIGNAL:
return net->u_.subsig_.name_; return net->u_.subsig_.sig->name_;
case IVL_EX_MEMORY: case IVL_EX_MEMORY:
return net->u_.memory_.mem_->name_; return net->u_.memory_.mem_->name_;
@ -238,6 +238,9 @@ extern "C" ivl_expr_t ivl_expr_oper1(ivl_expr_t net)
case IVL_EX_BINARY: case IVL_EX_BINARY:
return net->u_.binary_.lef_; return net->u_.binary_.lef_;
case IVL_EX_BITSEL:
return net->u_.subsig_.msb_;
case IVL_EX_UNARY: case IVL_EX_UNARY:
return net->u_.unary_.sub_; return net->u_.unary_.sub_;
@ -342,6 +345,19 @@ extern "C" ivl_scope_t ivl_expr_scope(ivl_expr_t net)
return net->u_.scope_.scope; return net->u_.scope_.scope;
} }
extern "C" ivl_signal_t ivl_expr_signal(ivl_expr_t net)
{
assert(net);
switch (net->type_) {
case IVL_EX_BITSEL:
return net->u_.subsig_.sig;
default:
assert(0);
return 0;
}
}
extern "C" int ivl_expr_signed(ivl_expr_t net) extern "C" int ivl_expr_signed(ivl_expr_t net)
{ {
assert(net); assert(net);
@ -1262,6 +1278,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
/* /*
* $Log: t-dll-api.cc,v $ * $Log: t-dll-api.cc,v $
* Revision 1.57 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.56 2001/07/19 04:55:06 steve * Revision 1.56 2001/07/19 04:55:06 steve
* Support calculated delays in vvp.tgt. * Support calculated delays in vvp.tgt.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) & !defined(macintosh) #if !defined(WINNT) & !defined(macintosh)
#ident "$Id: t-dll-expr.cc,v 1.14 2001/07/07 20:20:10 steve Exp $" #ident "$Id: t-dll-expr.cc,v 1.15 2001/07/22 00:17:49 steve Exp $"
#endif #endif
# include "t-dll.h" # include "t-dll.h"
@ -218,7 +218,31 @@ void dll_target::expr_signal(const NetESignal*net)
expr_->type_ = IVL_EX_SIGNAL; expr_->type_ = IVL_EX_SIGNAL;
expr_->width_= net->expr_width(); expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0; expr_->signed_ = net->has_sign()? 1 : 0;
expr_->u_.subsig_.name_ = strdup(net->name().c_str()); expr_->u_.subsig_.sig = find_signal(des_.root_, net->sig());
}
void dll_target::expr_subsignal(const NetESubSignal*net)
{
assert(expr_ == 0);
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
assert(expr);
if (net->sig()->lsb() != 0) {
cerr << net->get_line() << ": sorry: LSB for signal "
<< "is not zero." << endl;
}
expr->type_ = IVL_EX_BITSEL;
expr->width_= net->expr_width();
expr->signed_ = net->has_sign()? 1 : 0;
expr->u_.subsig_.sig = find_signal(des_.root_, net->sig());
net->index()->expr_scan(this);
assert(expr_);
expr->u_.subsig_.msb_ = expr_;
expr_ = expr;
} }
void dll_target::expr_ufunc(const NetEUFunc*net) void dll_target::expr_ufunc(const NetEUFunc*net)
@ -268,6 +292,9 @@ void dll_target::expr_unary(const NetEUnary*net)
/* /*
* $Log: t-dll-expr.cc,v $ * $Log: t-dll-expr.cc,v $
* Revision 1.15 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.14 2001/07/07 20:20:10 steve * Revision 1.14 2001/07/07 20:20:10 steve
* Pass parameters to system functions. * Pass parameters to system functions.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-dll.cc,v 1.54 2001/07/07 03:01:37 steve Exp $" #ident "$Id: t-dll.cc,v 1.55 2001/07/22 00:17:49 steve Exp $"
#endif #endif
# include "compiler.h" # include "compiler.h"
@ -94,7 +94,7 @@ static struct dll_target dll_target_obj;
* NetScope object. The search works by looking for the parent scope, * NetScope object. The search works by looking for the parent scope,
* then scanning the parent scope for the NetScope object. * then scanning the parent scope for the NetScope object.
*/ */
static ivl_scope_t find_scope(ivl_scope_t root, const NetScope*cur) ivl_scope_t dll_target::find_scope(ivl_scope_t root, const NetScope*cur)
{ {
ivl_scope_t parent, tmp; ivl_scope_t parent, tmp;
@ -118,6 +118,26 @@ ivl_scope_t dll_target::lookup_scope_(const NetScope*cur)
return find_scope(des_.root_, cur); return find_scope(des_.root_, cur);
} }
/*
* This is a convenience function to locate an ivl_signal_t object
* given the NetESignal that has the signal name.
*/
ivl_signal_t dll_target::find_signal(ivl_scope_t root, const NetNet*net)
{
ivl_scope_t scope = find_scope(root, net->scope());
assert(scope);
const char*nname = net->name();
for (unsigned idx = 0 ; idx < scope->nsigs_ ; idx += 1) {
if (strcmp(scope->sigs_[idx]->name_, nname) == 0)
return scope->sigs_[idx];
}
assert(0);
return 0;
}
/* /*
* This function locates an ivl_memory_t object that matches the * This function locates an ivl_memory_t object that matches the
* NetMemory object. The search works by looking for the parent scope, * NetMemory object. The search works by looking for the parent scope,
@ -1460,6 +1480,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
/* /*
* $Log: t-dll.cc,v $ * $Log: t-dll.cc,v $
* Revision 1.55 2001/07/22 00:17:49 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.54 2001/07/07 03:01:37 steve * Revision 1.54 2001/07/07 03:01:37 steve
* Detect and make available to t-dll the right shift. * Detect and make available to t-dll the right shift.
* *

62
t-dll.h
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-dll.h,v 1.55 2001/07/19 04:55:06 steve Exp $" #ident "$Id: t-dll.h,v 1.56 2001/07/22 00:17:50 steve Exp $"
#endif #endif
# include "target.h" # include "target.h"
@ -118,6 +118,7 @@ struct dll_target : public target_t, public expr_scan_t {
void expr_const(const NetEConst*); void expr_const(const NetEConst*);
void expr_scope(const NetEScope*); void expr_scope(const NetEScope*);
void expr_sfunc(const NetESFunc*); void expr_sfunc(const NetESFunc*);
void expr_subsignal(const NetESubSignal*);
void expr_ternary(const NetETernary*); void expr_ternary(const NetETernary*);
void expr_ufunc(const NetEUFunc*); void expr_ufunc(const NetEUFunc*);
void expr_unary(const NetEUnary*); void expr_unary(const NetEUnary*);
@ -125,6 +126,10 @@ struct dll_target : public target_t, public expr_scan_t {
ivl_scope_t lookup_scope_(const NetScope*scope); ivl_scope_t lookup_scope_(const NetScope*scope);
ivl_memory_t lookup_memory_(const NetMemory*mem); ivl_memory_t lookup_memory_(const NetMemory*mem);
private:
static ivl_scope_t find_scope(ivl_scope_t root, const NetScope*cur);
static ivl_signal_t find_signal(ivl_scope_t root, const NetNet*net);
}; };
/* /*
@ -182,7 +187,7 @@ struct ivl_expr_s {
} string_; } string_;
struct { struct {
char*name_; ivl_signal_t sig;
ivl_expr_t msb_; ivl_expr_t msb_;
ivl_expr_t lsb_; ivl_expr_t lsb_;
} subsig_; } subsig_;
@ -552,6 +557,9 @@ struct ivl_statement_s {
/* /*
* $Log: t-dll.h,v $ * $Log: t-dll.h,v $
* Revision 1.56 2001/07/22 00:17:50 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.55 2001/07/19 04:55:06 steve * Revision 1.55 2001/07/19 04:55:06 steve
* Support calculated delays in vvp.tgt. * Support calculated delays in vvp.tgt.
* *
@ -588,55 +596,5 @@ struct ivl_statement_s {
* *
* Revision 1.45 2001/05/20 15:09:39 steve * Revision 1.45 2001/05/20 15:09:39 steve
* Mingw32 support (Venkat Iyer) * Mingw32 support (Venkat Iyer)
*
* Revision 1.44 2001/05/17 04:37:02 steve
* Behavioral ternary operators for vvp.
*
* Revision 1.43 2001/05/08 23:59:33 steve
* Add ivl and vvp.tgt support for memories in
* expressions and l-values. (Stephan Boettcher)
*
* Revision 1.42 2001/05/06 17:48:20 steve
* Support memory objects. (Stephan Boettcher)
*
* Revision 1.41 2001/04/29 23:17:38 steve
* Carry drive strengths in the ivl_nexus_ptr_t, and
* handle constant devices in targets.'
*
* Revision 1.40 2001/04/26 05:12:02 steve
* Implement simple MUXZ for ?: operators.
*
* Revision 1.39 2001/04/22 23:09:46 steve
* More UDP consolidation from Stephan Boettcher.
*
* 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.
*
* Revision 1.36 2001/04/06 02:28:02 steve
* Generate vvp code for functions with ports.
*
* Revision 1.35 2001/04/05 03:20:58 steve
* Generate vvp code for the repeat statement.
*
* Revision 1.34 2001/04/04 04:50:35 steve
* Support forever loops in the tgt-vvp target.
*
* Revision 1.33 2001/04/03 04:50:37 steve
* Support non-blocking assignments.
*
* Revision 1.32 2001/04/02 02:28:12 steve
* Generate code for task calls.
*
* Revision 1.31 2001/04/02 00:28:35 steve
* Support the scope expression node.
*
* Revision 1.30 2001/04/01 06:52:28 steve
* support the NetWhile statement.
*
* Revision 1.29 2001/04/01 01:48:21 steve
* Redesign event information to support arbitrary edge combining.
*/ */
#endif #endif

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: eval_expr.c,v 1.36 2001/07/09 15:38:35 steve Exp $" #ident "$Id: eval_expr.c,v 1.37 2001/07/22 00:17:50 steve Exp $"
#endif #endif
# include "vvp_priv.h" # include "vvp_priv.h"
@ -553,6 +553,27 @@ static struct vector_info draw_binary_expr(ivl_expr_t exp, unsigned wid)
return rv; return rv;
} }
static struct vector_info draw_bitsel_expr(ivl_expr_t exp, unsigned wid)
{
struct vector_info res;
ivl_signal_t sig = ivl_expr_signal(exp);
ivl_expr_t sel = ivl_expr_oper1(exp);
/* Evaluate the bit select expression and save the result into
index register 0. */
res = draw_eval_expr(sel);
fprintf(vvp_out, " %%ix/get 0, %u,%u;\n", res.base, res.wid);
clr_vector(res);
res.base = allocate_vector(wid);
res.wid = wid;
fprintf(vvp_out, " %%load/x %u, V_%s, 0;\n", res.base,
vvp_mangle_id(ivl_signal_name(sig)));
return res;
}
static struct vector_info draw_concat_expr(ivl_expr_t exp, unsigned wid) static struct vector_info draw_concat_expr(ivl_expr_t exp, unsigned wid)
{ {
unsigned idx, off; unsigned idx, off;
@ -1082,6 +1103,10 @@ struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned wid)
res = draw_binary_expr(exp, wid); res = draw_binary_expr(exp, wid);
break; break;
case IVL_EX_BITSEL:
res = draw_bitsel_expr(exp, wid);
break;
case IVL_EX_CONCAT: case IVL_EX_CONCAT:
res = draw_concat_expr(exp, wid); res = draw_concat_expr(exp, wid);
break; break;
@ -1125,6 +1150,9 @@ struct vector_info draw_eval_expr(ivl_expr_t exp)
/* /*
* $Log: eval_expr.c,v $ * $Log: eval_expr.c,v $
* Revision 1.37 2001/07/22 00:17:50 steve
* Support the NetESubSignal expressions in vvp.tgt.
*
* Revision 1.36 2001/07/09 15:38:35 steve * Revision 1.36 2001/07/09 15:38:35 steve
* Properly step through wide inputs. (Stephan Boettcher) * Properly step through wide inputs. (Stephan Boettcher)
* *