Properly cast signedness of parameters with ranges.
This commit is contained in:
parent
0a2a9dcd94
commit
7e1e44e87a
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_scope.cc,v 1.15 2002/08/19 02:39:16 steve Exp $"
|
||||
#ident "$Id: elab_scope.cc,v 1.16 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -64,13 +64,21 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
|
|||
for (mparm_it_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; cur ++) {
|
||||
|
||||
scope->set_parameter((*cur).first, new NetEParam);
|
||||
NetEParam*tmp = new NetEParam;
|
||||
if ((*cur).second.msb)
|
||||
tmp->cast_signed( (*cur).second.signed_flag );
|
||||
|
||||
scope->set_parameter((*cur).first, tmp);
|
||||
}
|
||||
|
||||
for (mparm_it_t cur = localparams.begin()
|
||||
; cur != localparams.end() ; cur ++) {
|
||||
|
||||
scope->set_parameter((*cur).first, new NetEParam);
|
||||
NetEParam*tmp = new NetEParam;
|
||||
if ((*cur).second.msb)
|
||||
tmp->cast_signed( (*cur).second.signed_flag );
|
||||
|
||||
scope->set_parameter((*cur).first, tmp);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -111,9 +119,16 @@ bool Module::elaborate_scope(Design*des, NetScope*scope) const
|
|||
|
||||
if (NetEConst*tmp = dynamic_cast<NetEConst*>(val)) {
|
||||
verinum tval (tmp->value(), width);
|
||||
tval.has_sign((*cur).second.signed_flag);
|
||||
val = new NetEConst(tval);
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
/* If the parameter has a range, then the
|
||||
signedness is taken from the parameter
|
||||
declaration, and the signedness of the
|
||||
expression is ignored. */
|
||||
val->cast_signed( (*cur).second.signed_flag );
|
||||
}
|
||||
|
||||
val = scope->set_parameter((*cur).first, val);
|
||||
|
|
@ -497,6 +512,9 @@ void PWhile::elaborate_scope(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_scope.cc,v $
|
||||
* Revision 1.16 2002/09/01 03:01:48 steve
|
||||
* Properly cast signedness of parameters with ranges.
|
||||
*
|
||||
* Revision 1.15 2002/08/19 02:39:16 steve
|
||||
* Support parameters with defined ranges.
|
||||
*
|
||||
|
|
|
|||
29
net_expr.cc
29
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.6 2002/08/12 01:34:59 steve Exp $"
|
||||
#ident "$Id: net_expr.cc,v 1.7 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -110,6 +110,30 @@ unsigned NetEConcat::repeat() const
|
|||
return repeat_value_;
|
||||
}
|
||||
|
||||
NetEParam::NetEParam()
|
||||
: des_(0)
|
||||
{
|
||||
}
|
||||
|
||||
NetEParam::NetEParam(Design*d, NetScope*s, const hname_t&n)
|
||||
: des_(d), scope_(s), name_(n)
|
||||
{
|
||||
}
|
||||
|
||||
NetEParam::~NetEParam()
|
||||
{
|
||||
}
|
||||
|
||||
bool NetEParam::has_width() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NetEParam* NetEParam::dup_expr() const
|
||||
{
|
||||
return new NetEParam(des_, scope_, name_);
|
||||
}
|
||||
|
||||
NetESelect::NetESelect(NetExpr*exp, NetExpr*base, unsigned wid)
|
||||
: expr_(exp), base_(base)
|
||||
{
|
||||
|
|
@ -147,6 +171,9 @@ bool NetESelect::set_width(unsigned w)
|
|||
|
||||
/*
|
||||
* $Log: net_expr.cc,v $
|
||||
* Revision 1.7 2002/09/01 03:01:48 steve
|
||||
* Properly cast signedness of parameters with ranges.
|
||||
*
|
||||
* Revision 1.6 2002/08/12 01:34:59 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
|
|
|
|||
29
netlist.cc
29
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.198 2002/08/19 00:06:12 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.199 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -2029,30 +2029,6 @@ NetEMemory* NetEMemory::dup_expr() const
|
|||
assert(0);
|
||||
}
|
||||
|
||||
NetEParam::NetEParam()
|
||||
: des_(0)
|
||||
{
|
||||
}
|
||||
|
||||
NetEParam::NetEParam(Design*d, NetScope*s, const hname_t&n)
|
||||
: des_(d), scope_(s), name_(n)
|
||||
{
|
||||
}
|
||||
|
||||
NetEParam::~NetEParam()
|
||||
{
|
||||
}
|
||||
|
||||
bool NetEParam::has_width() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NetEParam* NetEParam::dup_expr() const
|
||||
{
|
||||
return new NetEParam(des_, scope_, name_);
|
||||
}
|
||||
|
||||
NetEScope::NetEScope(NetScope*s)
|
||||
: scope_(s)
|
||||
{
|
||||
|
|
@ -2324,6 +2300,9 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.199 2002/09/01 03:01:48 steve
|
||||
* Properly cast signedness of parameters with ranges.
|
||||
*
|
||||
* Revision 1.198 2002/08/19 00:06:12 steve
|
||||
* Allow release to handle removal of target net.
|
||||
*
|
||||
|
|
|
|||
15
parse.y
15
parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: parse.y,v 1.158 2002/08/19 02:39:16 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.159 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -31,6 +31,7 @@ extern void lex_start_table();
|
|||
extern void lex_end_table();
|
||||
|
||||
static svector<PExpr*>* active_range = 0;
|
||||
static bool active_signed = false;
|
||||
|
||||
/*
|
||||
* These are some common strength pairs that are used as defaults when
|
||||
|
|
@ -1619,7 +1620,8 @@ parameter_assign
|
|||
delete tmp;
|
||||
tmp = 0;
|
||||
} else {
|
||||
pform_set_parameter($1, active_range, tmp);
|
||||
pform_set_parameter($1, active_signed,
|
||||
active_range, tmp);
|
||||
}
|
||||
delete $1;
|
||||
}
|
||||
|
|
@ -1627,8 +1629,15 @@ parameter_assign
|
|||
|
||||
parameter_assign_decl
|
||||
: parameter_assign_list
|
||||
| range { active_range = $1; } parameter_assign_list
|
||||
| range { active_range = $1; active_signed = false; }
|
||||
parameter_assign_list
|
||||
{ active_range = 0;
|
||||
active_signed = false;
|
||||
}
|
||||
| K_signed range { active_range = $2; active_signed = true; }
|
||||
parameter_assign_list
|
||||
{ active_range = 0;
|
||||
active_signed = false;
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
|||
10
pform.cc
10
pform.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform.cc,v 1.101 2002/08/19 02:39:17 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.102 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1166,7 +1166,8 @@ void pform_set_reg_idx(const char*name, PExpr*l, PExpr*r)
|
|||
cur->set_memory_idx(l, r);
|
||||
}
|
||||
|
||||
void pform_set_parameter(const string&name, svector<PExpr*>*range, PExpr*expr)
|
||||
void pform_set_parameter(const string&name, bool signed_flag,
|
||||
svector<PExpr*>*range, PExpr*expr)
|
||||
{
|
||||
assert(expr);
|
||||
pform_cur_module->parameters[name].expr = expr;
|
||||
|
|
@ -1181,7 +1182,7 @@ void pform_set_parameter(const string&name, svector<PExpr*>*range, PExpr*expr)
|
|||
pform_cur_module->parameters[name].msb = 0;
|
||||
pform_cur_module->parameters[name].lsb = 0;
|
||||
}
|
||||
pform_cur_module->parameters[name].signed_flag = false;
|
||||
pform_cur_module->parameters[name].signed_flag = signed_flag;
|
||||
|
||||
pform_cur_module->param_names.push_back(name);
|
||||
}
|
||||
|
|
@ -1359,6 +1360,9 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.102 2002/09/01 03:01:48 steve
|
||||
* Properly cast signedness of parameters with ranges.
|
||||
*
|
||||
* Revision 1.101 2002/08/19 02:39:17 steve
|
||||
* Support parameters with defined ranges.
|
||||
*
|
||||
|
|
|
|||
6
pform.h
6
pform.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform.h,v 1.63 2002/08/19 02:39:17 steve Exp $"
|
||||
#ident "$Id: pform.h,v 1.64 2002/09/01 03:01:48 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -197,6 +197,7 @@ extern void pform_set_type_attrib(const string&name, const string&key,
|
|||
char*value);
|
||||
|
||||
extern void pform_set_parameter(const string&name,
|
||||
bool signed_flag,
|
||||
svector<PExpr*>*range,
|
||||
PExpr*expr);
|
||||
extern void pform_set_localparam(const string&name, PExpr*expr);
|
||||
|
|
@ -258,6 +259,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
|||
|
||||
/*
|
||||
* $Log: pform.h,v $
|
||||
* Revision 1.64 2002/09/01 03:01:48 steve
|
||||
* Properly cast signedness of parameters with ranges.
|
||||
*
|
||||
* Revision 1.63 2002/08/19 02:39:17 steve
|
||||
* Support parameters with defined ranges.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue