Add support for bit select of parameters.
This leads to a NetESelect node and the vvp code generator to support that.
This commit is contained in:
parent
712080f7e0
commit
364ffc9024
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.112 2002/01/25 03:25:16 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.113 2002/01/28 00:52:41 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -117,8 +117,8 @@ elab_lval.o elab_net.o elab_anet.o elab_pexpr.o elab_scope.o \
|
|||
elab_sig.o emit.o eval.o eval_rconst.o \
|
||||
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
|
||||
load_module.o mangle.o netlist.o netmisc.o net_assign.o \
|
||||
net_design.o net_event.o net_force.o net_link.o net_modulo.o net_proc.o \
|
||||
net_scope.o net_udp.o pad_to_width.o \
|
||||
net_design.o net_event.o net_expr.o net_force.o net_link.o net_modulo.o \
|
||||
net_proc.o net_scope.o net_udp.o pad_to_width.o \
|
||||
parse.o parse_misc.o pform.o pform_dump.o \
|
||||
set_width.o \
|
||||
verinum.o verireal.o target.o targets.o \
|
||||
|
|
|
|||
|
|
@ -405,6 +405,8 @@ constructs.
|
|||
|
||||
- trireg is not supported. tri0 and tri1 are supported.
|
||||
|
||||
- force to nets are not supported. Force to variables, and
|
||||
assign/deassign, are supported.
|
||||
|
||||
6.0 CREDITS
|
||||
|
||||
|
|
@ -430,6 +432,7 @@ Verilog guidance, and especially testing from many people, including
|
|||
Stuart Sutherland <stuart@sutherland.com>
|
||||
Stephen Tell <tell@cs.unc.edu>
|
||||
Stefan Theide <Stefan.Thiede@sv.sc.philips.com>
|
||||
Tom Verbeure
|
||||
Steve Wilson <stevew@home.com>
|
||||
|
||||
and others. Testers in particular include a larger community of people
|
||||
|
|
|
|||
13
dup_expr.cc
13
dup_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: dup_expr.cc,v 1.6 2001/11/19 01:54:14 steve Exp $"
|
||||
#ident "$Id: dup_expr.cc,v 1.7 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -31,6 +31,12 @@ NetEScope* NetEScope::dup_expr() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
NetESelect* NetESelect::dup_expr() const
|
||||
{
|
||||
return new NetESelect(expr_->dup_expr(), base_->dup_expr(),
|
||||
expr_width());
|
||||
}
|
||||
|
||||
NetESFunc* NetESFunc::dup_expr() const
|
||||
{
|
||||
NetESFunc*tmp = new NetESFunc(name_, expr_width(), nparms());
|
||||
|
|
@ -68,6 +74,11 @@ NetEUnary* NetEUnary::dup_expr() const
|
|||
|
||||
/*
|
||||
* $Log: dup_expr.cc,v $
|
||||
* Revision 1.7 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.6 2001/11/19 01:54:14 steve
|
||||
* Port close cropping behavior from mcrgb
|
||||
* Move window array reset to libmc.
|
||||
|
|
|
|||
24
elab_expr.cc
24
elab_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_expr.cc,v 1.49 2002/01/11 05:25:45 steve Exp $"
|
||||
#ident "$Id: elab_expr.cc,v 1.50 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -415,6 +415,23 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope) const
|
|||
else
|
||||
tmp = new NetEParam(des, scope, path_);
|
||||
|
||||
if (msb_ && lsb_) {
|
||||
cerr << get_line() << ": error: part select of "
|
||||
<< "parameter " << path_ << " in " << scope->name()
|
||||
<< " is illegal." << endl;
|
||||
des->errors += 1;
|
||||
|
||||
} else if (msb_) {
|
||||
/* Handle the case where a parameter has a bit
|
||||
select attached to it. Generate a NetESelect
|
||||
object to select the bit as desired. */
|
||||
NetExpr*mtmp = msb_->elaborate_expr(des, scope);
|
||||
NetESelect*stmp = new NetESelect(tmp, mtmp, 1);
|
||||
tmp->set_line(*this);
|
||||
tmp = stmp;
|
||||
}
|
||||
|
||||
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
|
@ -673,6 +690,11 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
* Revision 1.50 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.49 2002/01/11 05:25:45 steve
|
||||
* The stime system function is 32bits.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elab_pexpr.cc,v 1.12 2001/12/03 04:47:14 steve Exp $"
|
||||
#ident "$Id: elab_pexpr.cc,v 1.13 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -152,6 +152,12 @@ NetExpr*PEIdent::elaborate_pexpr(Design*des, NetScope*scope) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (msb_ || lsb_ || idx_) {
|
||||
cerr << get_line() << ": error: Cannot bit/part select "
|
||||
"bits of parameters." << endl;
|
||||
des->errors += 1;
|
||||
}
|
||||
|
||||
NetExpr*res = new NetEParam(des, pscope, hname_t(name));
|
||||
assert(res);
|
||||
delete name;
|
||||
|
|
@ -218,6 +224,11 @@ NetExpr*PEUnary::elaborate_pexpr (Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_pexpr.cc,v $
|
||||
* Revision 1.13 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.12 2001/12/03 04:47:14 steve
|
||||
* Parser and pform use hierarchical names as hname_t
|
||||
* objects instead of encoded strings.
|
||||
|
|
|
|||
12
emit.cc
12
emit.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: emit.cc,v 1.64 2002/01/19 19:02:08 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.65 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -434,6 +434,11 @@ void NetEScope::expr_scan(struct expr_scan_t*tgt) const
|
|||
tgt->expr_scope(this);
|
||||
}
|
||||
|
||||
void NetESelect::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_select(this);
|
||||
}
|
||||
|
||||
void NetESFunc::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_sfunc(this);
|
||||
|
|
@ -477,6 +482,11 @@ bool emit(const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.65 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.64 2002/01/19 19:02:08 steve
|
||||
* Pass back target errors processing conditionals.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.91 2002/01/03 04:19:01 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.92 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -164,6 +164,7 @@ typedef enum ivl_expr_type_e {
|
|||
IVL_EX_MEMORY,
|
||||
IVL_EX_NUMBER,
|
||||
IVL_EX_SCOPE,
|
||||
IVL_EX_SELECT,
|
||||
IVL_EX_SFUNC,
|
||||
IVL_EX_SIGNAL,
|
||||
IVL_EX_STRING,
|
||||
|
|
@ -977,6 +978,11 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.92 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.91 2002/01/03 04:19:01 steve
|
||||
* Add structural modulus support down to vvp.
|
||||
*
|
||||
|
|
|
|||
35
netlist.h
35
netlist.h
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __netlist_H
|
||||
#define __netlist_H
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2002 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.h,v 1.230 2002/01/22 01:40:04 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.231 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -2308,6 +2308,32 @@ class NetEParam : public NetExpr {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* This expression node supports bit/part selects from general
|
||||
* expressions. The sub-expression is self-sized, and has bits
|
||||
* selected from it. The base is the expression that identifies the
|
||||
* lsb of the expression, and the wid is the width of the part select,
|
||||
* or 1 for a bit select.
|
||||
*/
|
||||
class NetESelect : public NetExpr {
|
||||
|
||||
public:
|
||||
NetESelect(NetExpr*exp, NetExpr*base, unsigned wid);
|
||||
~NetESelect();
|
||||
|
||||
const NetExpr*sub_expr() const;
|
||||
const NetExpr*select() const;
|
||||
|
||||
virtual bool set_width(unsigned w);
|
||||
virtual bool has_width() const;
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual NetESelect* dup_expr() const;
|
||||
|
||||
private:
|
||||
NetExpr*expr_;
|
||||
NetExpr*base_;
|
||||
};
|
||||
|
||||
/*
|
||||
* This class is a special (and magical) expression node type that
|
||||
* represents scope names. These can only be found as parameters to
|
||||
|
|
@ -2865,6 +2891,11 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.231 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.230 2002/01/22 01:40:04 steve
|
||||
* Precalculate constant results of memory index expressions.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.74 2002/01/03 04:19:01 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.75 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -272,6 +272,7 @@ extern "C" ivl_expr_t ivl_expr_oper1(ivl_expr_t net)
|
|||
assert(net);
|
||||
switch (net->type_) {
|
||||
case IVL_EX_BINARY:
|
||||
case IVL_EX_SELECT:
|
||||
return net->u_.binary_.lef_;
|
||||
|
||||
case IVL_EX_BITSEL:
|
||||
|
|
@ -298,6 +299,7 @@ extern "C" ivl_expr_t ivl_expr_oper2(ivl_expr_t net)
|
|||
assert(net);
|
||||
switch (net->type_) {
|
||||
case IVL_EX_BINARY:
|
||||
case IVL_EX_SELECT:
|
||||
return net->u_.binary_.rig_;
|
||||
|
||||
case IVL_EX_TERNARY:
|
||||
|
|
@ -1450,6 +1452,11 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.75 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.74 2002/01/03 04:19:01 steve
|
||||
* Add structural modulus support down to vvp.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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-expr.cc,v 1.21 2001/12/31 00:08:14 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.22 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -161,6 +161,28 @@ void dll_target::expr_scope(const NetEScope*net)
|
|||
expr_->u_.scope_.scope = lookup_scope_(net->scope());
|
||||
}
|
||||
|
||||
void dll_target::expr_select(const NetESelect*net)
|
||||
{
|
||||
assert(expr_ == 0);
|
||||
|
||||
net->sub_expr()->expr_scan(this);
|
||||
ivl_expr_t left = expr_;
|
||||
|
||||
expr_ = 0;
|
||||
net->select()->expr_scan(this);
|
||||
ivl_expr_t rght = expr_;
|
||||
|
||||
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
|
||||
assert(expr_);
|
||||
|
||||
expr_->type_ = IVL_EX_SELECT;
|
||||
expr_->width_= net->expr_width();
|
||||
expr_->signed_ = net->has_sign()? 1 : 0;
|
||||
|
||||
expr_->u_.binary_.lef_ = left;
|
||||
expr_->u_.binary_.rig_ = rght;
|
||||
}
|
||||
|
||||
void dll_target::expr_sfunc(const NetESFunc*net)
|
||||
{
|
||||
assert(expr_ == 0);
|
||||
|
|
@ -347,6 +369,11 @@ void dll_target::expr_unary(const NetEUnary*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.22 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.21 2001/12/31 00:08:14 steve
|
||||
* Support $signed cast of expressions.
|
||||
*
|
||||
|
|
|
|||
8
t-dll.h
8
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.74 2002/01/19 19:02:08 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.75 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -131,6 +131,7 @@ struct dll_target : public target_t, public expr_scan_t {
|
|||
void expr_memory(const NetEMemory*);
|
||||
void expr_const(const NetEConst*);
|
||||
void expr_scope(const NetEScope*);
|
||||
void expr_select(const NetESelect*);
|
||||
void expr_sfunc(const NetESFunc*);
|
||||
void expr_subsignal(const NetEBitSel*);
|
||||
void expr_ternary(const NetETernary*);
|
||||
|
|
@ -590,6 +591,11 @@ struct ivl_statement_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.75 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.74 2002/01/19 19:02:08 steve
|
||||
* Pass back target errors processing conditionals.
|
||||
*
|
||||
|
|
|
|||
13
target.cc
13
target.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: target.cc,v 1.58 2002/01/19 19:02:08 steve Exp $"
|
||||
#ident "$Id: target.cc,v 1.59 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -340,6 +340,12 @@ void expr_scan_t::expr_scope(const NetEScope*)
|
|||
"unhandled expr_scope." << endl;
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_select(const NetESelect*)
|
||||
{
|
||||
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
|
||||
"unhandled expr_select." << endl;
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_sfunc(const NetESFunc*)
|
||||
{
|
||||
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
|
||||
|
|
@ -384,6 +390,11 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
|
|||
|
||||
/*
|
||||
* $Log: target.cc,v $
|
||||
* Revision 1.59 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.58 2002/01/19 19:02:08 steve
|
||||
* Pass back target errors processing conditionals.
|
||||
*
|
||||
|
|
|
|||
8
target.h
8
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: target.h,v 1.55 2002/01/19 19:02:08 steve Exp $"
|
||||
#ident "$Id: target.h,v 1.56 2002/01/28 00:52:41 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -132,6 +132,7 @@ struct expr_scan_t {
|
|||
virtual void expr_concat(const NetEConcat*);
|
||||
virtual void expr_memory(const NetEMemory*);
|
||||
virtual void expr_scope(const NetEScope*);
|
||||
virtual void expr_select(const NetESelect*);
|
||||
virtual void expr_sfunc(const NetESFunc*);
|
||||
virtual void expr_signal(const NetESignal*);
|
||||
virtual void expr_subsignal(const NetEBitSel*);
|
||||
|
|
@ -162,6 +163,11 @@ extern const struct target *target_table[];
|
|||
|
||||
/*
|
||||
* $Log: target.h,v $
|
||||
* Revision 1.56 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.55 2002/01/19 19:02:08 steve
|
||||
* Pass back target errors processing conditionals.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: eval_expr.c,v 1.54 2002/01/11 05:23:05 steve Exp $"
|
||||
#ident "$Id: eval_expr.c,v 1.55 2002/01/28 00:52:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -977,6 +977,55 @@ static struct vector_info draw_memory_expr(ivl_expr_t exp, unsigned wid)
|
|||
return res;
|
||||
}
|
||||
|
||||
static struct vector_info draw_select_expr(ivl_expr_t exp, unsigned wid)
|
||||
{
|
||||
struct vector_info subv, shiv, res;
|
||||
ivl_expr_t sube = ivl_expr_oper1(exp);
|
||||
ivl_expr_t shift = ivl_expr_oper2(exp);
|
||||
|
||||
/* Evaluate the sub-expression. */
|
||||
subv = draw_eval_expr(sube);
|
||||
|
||||
/* Any bit select of a constant zero is another constant zero,
|
||||
so short circuit and return the value we know. */
|
||||
if (subv.base == 0) {
|
||||
subv.wid = wid;
|
||||
return subv;
|
||||
}
|
||||
|
||||
/* Evaluate the bit select base expression and store the
|
||||
result into index register 0. */
|
||||
shiv = draw_eval_expr(shift);
|
||||
fprintf(vvp_out, " %%ix/get 0, %u, %u;\n", shiv.base, shiv.wid);
|
||||
clr_vector(shiv);
|
||||
|
||||
/* If the subv result is a magic constant, then make a copy in
|
||||
writeable vector space and work from there instead. */
|
||||
if (subv.base < 0) {
|
||||
res.base = allocate_vector(subv.wid);
|
||||
res.wid = wid;
|
||||
fprintf(vvp_out, " %%mov %u, %u, %u;\n", res.base,
|
||||
subv.base, res.wid);
|
||||
subv = res;
|
||||
}
|
||||
|
||||
fprintf(vvp_out, " %%shiftr/i0 %u, %u;\n", subv.base, subv.wid);
|
||||
|
||||
assert(subv.wid >= wid);
|
||||
if (subv.wid > wid) {
|
||||
res.base = subv.base;
|
||||
res.wid = wid;
|
||||
|
||||
subv.base += wid;
|
||||
clr_vector(subv);
|
||||
|
||||
} else if (subv.wid == wid) {
|
||||
res = subv;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct vector_info draw_ternary_expr(ivl_expr_t exp, unsigned wid)
|
||||
{
|
||||
struct vector_info res, tmp;
|
||||
|
|
@ -1415,6 +1464,10 @@ struct vector_info draw_eval_expr_wid(ivl_expr_t exp, unsigned wid)
|
|||
res = draw_number_expr(exp, wid);
|
||||
break;
|
||||
|
||||
case IVL_EX_SELECT:
|
||||
res = draw_select_expr(exp, wid);
|
||||
break;
|
||||
|
||||
case IVL_EX_SIGNAL:
|
||||
res = draw_signal_expr(exp, wid);
|
||||
break;
|
||||
|
|
@ -1450,6 +1503,11 @@ struct vector_info draw_eval_expr(ivl_expr_t exp)
|
|||
|
||||
/*
|
||||
* $Log: eval_expr.c,v $
|
||||
* Revision 1.55 2002/01/28 00:52:42 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.54 2002/01/11 05:23:05 steve
|
||||
* Handle certain special cases of stime.
|
||||
*
|
||||
|
|
@ -1499,70 +1557,5 @@ struct vector_info draw_eval_expr(ivl_expr_t exp)
|
|||
*
|
||||
* Revision 1.39 2001/07/27 02:41:56 steve
|
||||
* Fix binding of dangling function ports. do not elide them.
|
||||
*
|
||||
* Revision 1.38 2001/07/22 19:33:51 steve
|
||||
* Handle repeat for concatenation expressions.
|
||||
*
|
||||
* 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
|
||||
* Properly step through wide inputs. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.35 2001/07/07 20:20:10 steve
|
||||
* Pass parameters to system functions.
|
||||
*
|
||||
* Revision 1.34 2001/06/30 21:07:26 steve
|
||||
* Support non-const right shift (unsigned).
|
||||
*
|
||||
* Revision 1.33 2001/06/23 18:40:34 steve
|
||||
* Generate %shiftl instructions for shift.
|
||||
*
|
||||
* Revision 1.32 2001/06/21 04:53:59 steve
|
||||
* Escaped identifiers in behavioral expressions. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.31 2001/06/18 01:09:32 steve
|
||||
* More behavioral unary reduction operators.
|
||||
* (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.30 2001/06/16 23:45:05 steve
|
||||
* Add support for structural multiply in t-dll.
|
||||
* Add code generators and vvp support for both
|
||||
* structural and behavioral multiply.
|
||||
*
|
||||
* Revision 1.29 2001/05/24 04:20:10 steve
|
||||
* Add behavioral modulus.
|
||||
*
|
||||
* Revision 1.28 2001/05/20 01:18:38 steve
|
||||
* Implement reduction nor.
|
||||
*
|
||||
* Revision 1.27 2001/05/20 01:02:55 steve
|
||||
* Initial support for system functions.
|
||||
*
|
||||
* Revision 1.26 2001/05/17 04:37:02 steve
|
||||
* Behavioral ternary operators for vvp.
|
||||
*
|
||||
* Revision 1.25 2001/05/10 00:26:53 steve
|
||||
* VVP support for memories in expressions,
|
||||
* including general support for thread bit
|
||||
* vectors as system task parameters.
|
||||
* (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.24 2001/05/06 17:54:33 steve
|
||||
* Behavioral code to read memories. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.23 2001/05/02 01:57:25 steve
|
||||
* Support behavioral subtraction.
|
||||
*
|
||||
* Revision 1.22 2001/05/01 02:07:34 steve
|
||||
* Comparisons cant leave their results in the opcode
|
||||
* result area or their values will be clobbered by other
|
||||
* parts of a complex expression.
|
||||
*
|
||||
* Revision 1.21 2001/04/30 05:11:18 steve
|
||||
* OR is %or. Get this right.
|
||||
*
|
||||
* Revision 1.20 2001/04/29 20:47:39 steve
|
||||
* Evalulate logical or (||)
|
||||
*/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue