Shadow reduction part 3

Continue cleaning up shadowed variables, flagged by turning on -Wshadow.
No intended change in functionality.  Patch looks right, and is tested
to compile and run on my machine.  No regressions in test suite.
This commit is contained in:
Larry Doolittle 2008-10-20 10:06:04 -07:00 committed by Stephen Williams
parent de2b10b445
commit 904e76f176
4 changed files with 143 additions and 143 deletions

View File

@ -112,7 +112,7 @@ NetExpr* PExpr::elaborate_expr(Design*des, NetScope*, int, bool) const
unsigned PEBinary::test_width(Design*des, NetScope*scope, unsigned PEBinary::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
ivl_variable_type_t expr_type_left = IVL_VT_NO_TYPE; ivl_variable_type_t expr_type_left = IVL_VT_NO_TYPE;
@ -155,7 +155,7 @@ unsigned PEBinary::test_width(Design*des, NetScope*scope,
break; break;
case '*': case '*':
if (unsized_flag && type_is_vectorable(expr_type)) { if (unsized_flag && type_is_vectorable(expr_type_)) {
unsigned use_wid = wid_left + wid_right; unsigned use_wid = wid_left + wid_right;
if (use_wid > integer_width) if (use_wid > integer_width)
use_wid = integer_width; use_wid = integer_width;
@ -191,7 +191,7 @@ unsigned PEBinary::test_width(Design*des, NetScope*scope,
else else
expr_width_ = 1; expr_width_ = 1;
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -502,7 +502,7 @@ NetExpr* PEBinary::elaborate_expr_base_lshift_(Design*des,
} else if (NetEConst*rpc = dynamic_cast<NetEConst*> (rp)) { } else if (NetEConst*rpc = dynamic_cast<NetEConst*> (rp)) {
long shift = rpc->value().as_long(); long shift = rpc->value().as_long();
long use_wid = lp->expr_width(); use_wid = lp->expr_width();
if (expr_wid > 0) if (expr_wid > 0)
use_wid = expr_wid; use_wid = expr_wid;
@ -734,17 +734,17 @@ NetExpr* PEBinary::elaborate_expr_base_add_(Design*des,
} }
unsigned PEBComp::test_width(Design*, NetScope*,unsigned, unsigned, unsigned PEBComp::test_width(Design*, NetScope*,unsigned, unsigned,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&) bool&)
{ {
expr_type_ = IVL_VT_LOGIC; expr_type_ = IVL_VT_LOGIC;
expr_type = expr_type_; expr_type__ = expr_type_;
expr_width_ = 1; expr_width_ = 1;
return 1; return 1;
} }
NetExpr* PEBComp::elaborate_expr(Design*des, NetScope*scope, NetExpr* PEBComp::elaborate_expr(Design*des, NetScope*scope,
int expr_width, bool sys_task_arg) const int expr_width_dummy, bool sys_task_arg) const
{ {
assert(left_); assert(left_);
assert(right_); assert(right_);
@ -795,10 +795,10 @@ NetExpr* PEBComp::elaborate_expr(Design*des, NetScope*scope,
unsigned PEBShift::test_width(Design*des, NetScope*scope, unsigned PEBShift::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
unsigned wid_left = left_->test_width(des,scope,min, 0, expr_type, unsized_flag); unsigned wid_left = left_->test_width(des,scope,min, 0, expr_type__, unsized_flag);
// The right expression is self-determined and has no impact // The right expression is self-determined and has no impact
// on the expression size that is generated. // on the expression size that is generated.
@ -818,7 +818,7 @@ unsigned PEBShift::test_width(Design*des, NetScope*scope,
<< endl; << endl;
} }
expr_type_ = expr_type; expr_type_ = expr_type__;
expr_width_ = wid_left; expr_width_ = wid_left;
// Run a test-width on the shift amount so that its types are // Run a test-width on the shift amount so that its types are
@ -856,7 +856,7 @@ NetExpr*PEBShift::elaborate_expr(Design*des, NetScope*scope,
unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
perm_string name = peek_tail_name(path_); perm_string name = peek_tail_name(path_);
@ -866,8 +866,8 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
if (expr == 0) if (expr == 0)
return 0; return 0;
expr_width_ = expr->test_width(des, scope, min, lval, expr_type, unsized_flag); expr_width_ = expr->test_width(des, scope, min, lval, expr_type__, unsized_flag);
expr_type_ = expr_type; expr_type_ = expr_type__;
if (debug_elaborate) if (debug_elaborate)
cerr << get_fileline() << ": debug: test_width" cerr << get_fileline() << ": debug: test_width"
@ -900,7 +900,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
expr_type_ = IVL_VT_BOOL; expr_type_ = IVL_VT_BOOL;
expr_width_= integer_width; expr_width_= integer_width;
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -912,7 +912,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
expr_type_ = IVL_VT_BOOL; expr_type_ = IVL_VT_BOOL;
expr_width_ = 1; expr_width_ = 1;
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -924,7 +924,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
expr_type_ = sfunc_info->type; expr_type_ = sfunc_info->type;
expr_width_ = sfunc_info->wid; expr_width_ = sfunc_info->wid;
expr_type = expr_type_; expr_type__ = expr_type_;
if (debug_elaborate) if (debug_elaborate)
cerr << get_fileline() << ": debug: test_width " cerr << get_fileline() << ": debug: test_width "
@ -937,11 +937,11 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
unsigned PECallFunction::test_width(Design*des, NetScope*scope, unsigned PECallFunction::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
if (peek_tail_name(path_)[0] == '$') if (peek_tail_name(path_)[0] == '$')
return test_width_sfunc_(des, scope, min, lval, expr_type, unsized_flag); return test_width_sfunc_(des, scope, min, lval, expr_type__, unsized_flag);
// The width of user defined functions depends only on the // The width of user defined functions depends only on the
// width of the return value. The arguments are entirely // width of the return value. The arguments are entirely
@ -963,14 +963,14 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope,
if (debug_elaborate) if (debug_elaborate)
cerr << get_fileline() << ": debug: test_width " cerr << get_fileline() << ": debug: test_width "
<< "of function returns width " << res->vector_width() << "of function returns width " << res->vector_width()
<< ", type=" << expr_type << ", type=" << expr_type_
<< "." << endl; << "." << endl;
if (! type_is_vectorable(expr_type)) if (! type_is_vectorable(expr_type__))
unsized_flag = true; unsized_flag = true;
expr_width_ = res->vector_width(); expr_width_ = res->vector_width();
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -1289,7 +1289,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope,
unsigned PEConcat::test_width(Design*des, NetScope*scope, unsigned PEConcat::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
expr_type_ = IVL_VT_LOGIC; expr_type_ = IVL_VT_LOGIC;
@ -1297,7 +1297,7 @@ unsigned PEConcat::test_width(Design*des, NetScope*scope,
if (debug_elaborate) if (debug_elaborate)
cerr << get_fileline() << ": debug: CONCAT MISSING TEST_WIDTH!" << endl; cerr << get_fileline() << ": debug: CONCAT MISSING TEST_WIDTH!" << endl;
expr_type = expr_type_; expr_type__ = expr_type_;
unsized_flag = false; unsized_flag = false;
return 0; return 0;
} }
@ -1416,14 +1416,14 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope,
*/ */
unsigned PEFNumber::test_width(Design*des, NetScope*scope, unsigned PEFNumber::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
expr_type_ = IVL_VT_REAL; expr_type_ = IVL_VT_REAL;
expr_width_ = 1; expr_width_ = 1;
unsized_flag = true; unsized_flag = true;
expr_type = expr_type_; expr_type__ = expr_type_;
return 1; return 1;
} }
@ -1577,7 +1577,7 @@ bool PEIdent::calculate_param_range_(Design*des, NetScope*scope,
unsigned PEIdent::test_width(Design*des, NetScope*scope, unsigned PEIdent::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
NetNet* net = 0; NetNet* net = 0;
@ -1626,7 +1626,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope,
if (use_width != UINT_MAX) { if (use_width != UINT_MAX) {
expr_type_ = IVL_VT_LOGIC; // Assume bit/parts selects are logic expr_type_ = IVL_VT_LOGIC; // Assume bit/parts selects are logic
expr_width_ = max(use_width, min); expr_width_ = max(use_width, min);
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -1634,7 +1634,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope,
if (net != 0) { if (net != 0) {
expr_type_ = net->data_type(); expr_type_ = net->data_type();
expr_width_= max(net->vector_width(), (unsigned long)min); expr_width_= max(net->vector_width(), (unsigned long)min);
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -1643,7 +1643,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope,
// width is undefined. // width is undefined.
if (par != 0) { if (par != 0) {
expr_type_ = par->expr_type(); expr_type_ = par->expr_type();
expr_type = expr_type_; expr_type__ = expr_type_;
if (ex1) { if (ex1) {
ivl_assert(*this, ex2); ivl_assert(*this, ex2);
const NetEConst*ex1_const = dynamic_cast<const NetEConst*> (ex1); const NetEConst*ex1_const = dynamic_cast<const NetEConst*> (ex1);
@ -1673,7 +1673,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope,
expr_type_ = IVL_VT_NO_TYPE; expr_type_ = IVL_VT_NO_TYPE;
expr_width_ = min; expr_width_ = min;
expr_type = expr_type_; expr_type__ = expr_type_;
return min; return min;
} }
@ -2111,10 +2111,10 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des,
rb = verinum::V0; rb = verinum::V0;
} }
NetEConst*re = new NetEConst(verinum(rb, 1)); NetEConst*re2 = new NetEConst(verinum(rb, 1));
delete tmp; delete tmp;
delete mtmp; delete mtmp;
tmp = re; tmp = re2;
} else { } else {
@ -2528,7 +2528,7 @@ NetExpr* PEIdent::elaborate_expr_net(Design*des, NetScope*scope,
unsigned PENumber::test_width(Design*, NetScope*, unsigned PENumber::test_width(Design*, NetScope*,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
expr_type_ = IVL_VT_LOGIC; expr_type_ = IVL_VT_LOGIC;
@ -2542,13 +2542,13 @@ unsigned PENumber::test_width(Design*, NetScope*,
if (lval > 0 && lval < use_wid) if (lval > 0 && lval < use_wid)
use_wid = lval; use_wid = lval;
expr_type = expr_type_; expr_type__ = expr_type_;
expr_width_ = use_wid; expr_width_ = use_wid;
return use_wid; return use_wid;
} }
NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, NetEConst* PENumber::elaborate_expr(Design*des, NetScope*,
int expr_width, bool) const int expr_width__, bool) const
{ {
assert(value_); assert(value_);
verinum tvalue = *value_; verinum tvalue = *value_;
@ -2557,10 +2557,10 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*,
// specific size (for example this is part of the r-values of // specific size (for example this is part of the r-values of
// an assignment) so we pad to the desired width and ignore // an assignment) so we pad to the desired width and ignore
// the self-determined size. // the self-determined size.
if (expr_width > 0) { if (expr_width__ > 0) {
tvalue = pad_to_width(tvalue, expr_width); tvalue = pad_to_width(tvalue, expr_width__);
if (tvalue.len() > (unsigned)expr_width) { if (tvalue.len() > (unsigned)expr_width__) {
verinum tmp (tvalue, expr_width); verinum tmp (tvalue, expr_width__);
tmp.has_sign(tvalue.has_sign()); tmp.has_sign(tvalue.has_sign());
tvalue = tmp; tvalue = tmp;
} }
@ -2573,7 +2573,7 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*,
unsigned PEString::test_width(Design*des, NetScope*scope, unsigned PEString::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
expr_type_ = IVL_VT_BOOL; expr_type_ = IVL_VT_BOOL;
@ -2581,12 +2581,12 @@ unsigned PEString::test_width(Design*des, NetScope*scope,
if (min > expr_width_) if (min > expr_width_)
expr_width_ = min; expr_width_ = min;
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
NetEConst* PEString::elaborate_expr(Design*des, NetScope*, NetEConst* PEString::elaborate_expr(Design*des, NetScope*,
int expr_width, bool) const int expr_width_dummy, bool) const
{ {
NetEConst*tmp = new NetEConst(value()); NetEConst*tmp = new NetEConst(value());
tmp->set_line(*this); tmp->set_line(*this);
@ -2595,7 +2595,7 @@ NetEConst* PEString::elaborate_expr(Design*des, NetScope*,
unsigned PETernary::test_width(Design*des, NetScope*scope, unsigned PETernary::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&flag) bool&flag)
{ {
// The condition of the ternary is self-determined, but we // The condition of the ternary is self-determined, but we
@ -2631,7 +2631,7 @@ unsigned PETernary::test_width(Design*des, NetScope*scope,
expr_width_ = max(tru_wid,fal_wid); expr_width_ = max(tru_wid,fal_wid);
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
@ -2761,7 +2761,7 @@ NetExpr*PETernary::elaborate_expr(Design*des, NetScope*scope,
unsigned PEUnary::test_width(Design*des, NetScope*scope, unsigned PEUnary::test_width(Design*des, NetScope*scope,
unsigned min, unsigned lval, unsigned min, unsigned lval,
ivl_variable_type_t&expr_type, ivl_variable_type_t&expr_type__,
bool&unsized_flag) bool&unsized_flag)
{ {
switch (op_) { switch (op_) {
@ -2781,11 +2781,11 @@ unsigned PEUnary::test_width(Design*des, NetScope*scope,
} }
expr_width_ = 1; expr_width_ = 1;
expr_type = expr_type_; expr_type__ = expr_type_;
return expr_width_; return expr_width_;
} }
unsigned test_wid = expr_->test_width(des, scope, min, lval, expr_type, unsized_flag); unsigned test_wid = expr_->test_width(des, scope, min, lval, expr_type__, unsized_flag);
switch (op_) { switch (op_) {
// For these operators, the act of padding to the // For these operators, the act of padding to the
// minimum width can have an important impact on the // minimum width can have an important impact on the
@ -2799,7 +2799,7 @@ unsigned PEUnary::test_width(Design*des, NetScope*scope,
break; break;
} }
expr_type_ = expr_type; expr_type_ = expr_type__;
expr_width_ = test_wid; expr_width_ = test_wid;
return test_wid; return test_wid;
} }
@ -2864,11 +2864,11 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
tmp->set_line(*this); tmp->set_line(*this);
delete ip; delete ip;
} else if (NetECReal*ipc = dynamic_cast<NetECReal*>(ip)) { } else if (NetECReal*ipr = dynamic_cast<NetECReal*>(ip)) {
/* When taking the - of a real, fold this into the /* When taking the - of a real, fold this into the
constant value. */ constant value. */
verireal val = - ipc->value(); verireal val = - ipr->value();
tmp = new NetECReal(val); tmp = new NetECReal(val);
tmp->set_line( *ip ); tmp->set_line( *ip );
delete ip; delete ip;

View File

@ -257,13 +257,13 @@ void dll_target::expr_const(const NetEConst*net)
void dll_target::expr_param(const NetEConstParam*net) void dll_target::expr_param(const NetEConstParam*net)
{ {
ivl_scope_t scope = find_scope(des_, net->scope()); ivl_scope_t scop = find_scope(des_, net->scope());
ivl_parameter_t par = scope_find_param(scope, net->name()); ivl_parameter_t par = scope_find_param(scop, net->name());
if (par == 0) { if (par == 0) {
cerr << net->get_fileline() << ": internal error: " cerr << net->get_fileline() << ": internal error: "
<< "Parameter " << net->name() << " missing from " << "Parameter " << net->name() << " missing from "
<< ivl_scope_name(scope) << endl; << ivl_scope_name(scop) << endl;
} }
assert(par); assert(par);
assert(par->value); assert(par->value);

View File

@ -85,7 +85,7 @@ bool dll_target::process(const NetProcTop*net)
void dll_target::task_def(const NetScope*net) void dll_target::task_def(const NetScope*net)
{ {
ivl_scope_t scope = lookup_scope_(net); ivl_scope_t scop = lookup_scope_(net);
const NetTaskDef*def = net->task_def(); const NetTaskDef*def = net->task_def();
assert(stmt_cur_ == 0); assert(stmt_cur_ == 0);
@ -94,14 +94,14 @@ void dll_target::task_def(const NetScope*net)
def->proc()->emit_proc(this); def->proc()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
scope->def = stmt_cur_; scop->def = stmt_cur_;
stmt_cur_ = 0; stmt_cur_ = 0;
} }
bool dll_target::func_def(const NetScope*net) bool dll_target::func_def(const NetScope*net)
{ {
ivl_scope_t scope = lookup_scope_(net); ivl_scope_t scop = lookup_scope_(net);
const NetFuncDef*def = net->func_def(); const NetFuncDef*def = net->func_def();
assert(stmt_cur_ == 0); assert(stmt_cur_ == 0);
@ -110,14 +110,14 @@ bool dll_target::func_def(const NetScope*net)
def->proc()->emit_proc(this); def->proc()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
scope->def = stmt_cur_; scop->def = stmt_cur_;
stmt_cur_ = 0; stmt_cur_ = 0;
scope->ports = def->port_count() + 1; scop->ports = def->port_count() + 1;
if (scope->ports > 0) { if (scop->ports > 0) {
scope->port = new ivl_signal_t[scope->ports]; scop->port = new ivl_signal_t[scop->ports];
for (unsigned idx = 1 ; idx < scope->ports ; idx += 1) for (unsigned idx = 1 ; idx < scop->ports ; idx += 1)
scope->port[idx] = find_signal(des_, def->port(idx-1)); scop->port[idx] = find_signal(des_, def->port(idx-1));
} }
/* FIXME: the ivl_target API expects port-0 to be the output /* FIXME: the ivl_target API expects port-0 to be the output
@ -126,7 +126,7 @@ bool dll_target::func_def(const NetScope*net)
this, but that will break code generators that use this this, but that will break code generators that use this
result. */ result. */
if (const NetNet*ret_sig = def->return_sig()) { if (const NetNet*ret_sig = def->return_sig()) {
scope->port[0] = find_signal(des_, ret_sig); scop->port[0] = find_signal(des_, ret_sig);
return true; return true;
} }

160
t-dll.cc
View File

@ -469,15 +469,15 @@ ivl_parameter_t dll_target::scope_find_param(ivl_scope_t scope,
* ivl_parameter_t objects. This involves saving the name and scanning * ivl_parameter_t objects. This involves saving the name and scanning
* the expression value. * the expression value.
*/ */
void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net) void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net)
{ {
scope->nparam_ = net->parameters.size() + net->localparams.size(); scop->nparam_ = net->parameters.size() + net->localparams.size();
if (scope->nparam_ == 0) { if (scop->nparam_ == 0) {
scope->param_ = 0; scop->param_ = 0;
return; return;
} }
scope->param_ = new struct ivl_parameter_s [scope->nparam_]; scop->param_ = new struct ivl_parameter_s [scop->nparam_];
unsigned idx = 0; unsigned idx = 0;
typedef map<perm_string,NetScope::param_expr_t>::const_iterator pit_t; typedef map<perm_string,NetScope::param_expr_t>::const_iterator pit_t;
@ -485,10 +485,10 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net)
for (pit_t cur_pit = net->parameters.begin() for (pit_t cur_pit = net->parameters.begin()
; cur_pit != net->parameters.end() ; cur_pit ++) { ; cur_pit != net->parameters.end() ; cur_pit ++) {
assert(idx < scope->nparam_); assert(idx < scop->nparam_);
ivl_parameter_t cur_par = scope->param_ + idx; ivl_parameter_t cur_par = scop->param_ + idx;
cur_par->basename = (*cur_pit).first; cur_par->basename = (*cur_pit).first;
cur_par->scope = scope; cur_par->scope = scop;
cur_par->file = (*cur_pit).second.get_file(); cur_par->file = (*cur_pit).second.get_file();
cur_par->lineno = (*cur_pit).second.get_lineno(); cur_par->lineno = (*cur_pit).second.get_lineno();
@ -499,10 +499,10 @@ void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net)
for (pit_t cur_pit = net->localparams.begin() for (pit_t cur_pit = net->localparams.begin()
; cur_pit != net->localparams.end() ; cur_pit ++) { ; cur_pit != net->localparams.end() ; cur_pit ++) {
assert(idx < scope->nparam_); assert(idx < scop->nparam_);
ivl_parameter_t cur_par = scope->param_ + idx; ivl_parameter_t cur_par = scop->param_ + idx;
cur_par->basename = (*cur_pit).first; cur_par->basename = (*cur_pit).first;
cur_par->scope = scope; cur_par->scope = scop;
cur_par->file = (*cur_pit).second.get_file(); cur_par->file = (*cur_pit).second.get_file();
cur_par->lineno = (*cur_pit).second.get_lineno(); cur_par->lineno = (*cur_pit).second.get_lineno();
@ -530,9 +530,9 @@ void dll_target::make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp)
assert(0); assert(0);
} }
} else if (const NetECReal*e = dynamic_cast<const NetECReal*>(etmp)) { } else if (const NetECReal*er = dynamic_cast<const NetECReal*>(etmp)) {
expr_creal(e); expr_creal(er);
assert(expr_); assert(expr_);
assert(expr_->type_ == IVL_EX_REALNUM); assert(expr_->type_ == IVL_EX_REALNUM);
expr_->u_.real_.parameter = cur_par; expr_->u_.real_.parameter = cur_par;
@ -550,7 +550,7 @@ void dll_target::make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp)
expr_ = 0; expr_ = 0;
} }
void dll_target::add_root(ivl_design_s &des_, const NetScope *s) void dll_target::add_root(ivl_design_s &des__, const NetScope *s)
{ {
ivl_scope_t root_ = new struct ivl_scope_s; ivl_scope_t root_ = new struct ivl_scope_s;
perm_string name = s->basename(); perm_string name = s->basename();
@ -577,12 +577,12 @@ void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
root_->attr = fill_in_attributes(s); root_->attr = fill_in_attributes(s);
root_->is_auto = 0; root_->is_auto = 0;
des_.nroots_++; des__.nroots_++;
if (des_.roots_) if (des__.roots_)
des_.roots_ = (ivl_scope_t *)realloc(des_.roots_, des_.nroots_ * sizeof(ivl_scope_t)); des__.roots_ = (ivl_scope_t *)realloc(des__.roots_, des__.nroots_ * sizeof(ivl_scope_t));
else else
des_.roots_ = (ivl_scope_t *)malloc(des_.nroots_ * sizeof(ivl_scope_t)); des__.roots_ = (ivl_scope_t *)malloc(des__.nroots_ * sizeof(ivl_scope_t));
des_.roots_[des_.nroots_ - 1] = root_; des__.roots_[des__.nroots_ - 1] = root_;
} }
bool dll_target::start_design(const Design*des) bool dll_target::start_design(const Design*des)
@ -615,9 +615,9 @@ bool dll_target::start_design(const Design*des)
des_.roots_ = NULL; des_.roots_ = NULL;
root_scopes = des->find_root_scopes(); root_scopes = des->find_root_scopes();
for (list<NetScope*>::const_iterator scope = root_scopes.begin(); for (list<NetScope*>::const_iterator scop = root_scopes.begin();
scope != root_scopes.end(); scope++) scop != root_scopes.end(); scop++)
add_root(des_, *scope); add_root(des_, *scop);
des_.consts = (ivl_net_const_t*) des_.consts = (ivl_net_const_t*)
malloc(sizeof(ivl_net_const_t)); malloc(sizeof(ivl_net_const_t));
@ -848,17 +848,17 @@ bool dll_target::bufz(const NetBUFZ*net)
/* Attach the logic device to the scope that contains it. */ /* Attach the logic device to the scope that contains it. */
assert(net->scope()); assert(net->scope());
ivl_scope_t scope = find_scope(des_, net->scope()); ivl_scope_t scop = find_scope(des_, net->scope());
assert(scope); assert(scop);
obj->scope_ = scope; obj->scope_ = scop;
obj->name_ = net->name(); obj->name_ = net->name();
logic_attributes(obj, net); logic_attributes(obj, net);
make_logic_delays_(obj, net); make_logic_delays_(obj, net);
scope_add_logic(scope, obj); scope_add_logic(scop, obj);
return true; return true;
} }
@ -867,10 +867,10 @@ void dll_target::event(const NetEvent*net)
{ {
struct ivl_event_s *obj = new struct ivl_event_s; struct ivl_event_s *obj = new struct ivl_event_s;
ivl_scope_t scope = find_scope(des_, net->scope()); ivl_scope_t scop = find_scope(des_, net->scope());
obj->name = net->name(); obj->name = net->name();
obj->scope = scope; obj->scope = scop;
scope_add_event(scope, obj); scope_add_event(scop, obj);
obj->nany = 0; obj->nany = 0;
obj->nneg = 0; obj->nneg = 0;
@ -1029,17 +1029,17 @@ void dll_target::logic(const NetLogic*net)
} }
assert(net->scope()); assert(net->scope());
ivl_scope_t scope = find_scope(des_, net->scope()); ivl_scope_t scop = find_scope(des_, net->scope());
assert(scope); assert(scop);
obj->scope_= scope; obj->scope_= scop;
obj->name_ = net->name(); obj->name_ = net->name();
logic_attributes(obj, net); logic_attributes(obj, net);
make_logic_delays_(obj, net); make_logic_delays_(obj, net);
scope_add_logic(scope, obj); scope_add_logic(scop, obj);
} }
bool dll_target::tran(const NetTran*net) bool dll_target::tran(const NetTran*net)
@ -1377,10 +1377,10 @@ void dll_target::udp(const NetUDP*net)
} }
assert(net->scope()); assert(net->scope());
ivl_scope_t scope = find_scope(des_, net->scope()); ivl_scope_t scop = find_scope(des_, net->scope());
assert(scope); assert(scop);
obj->scope_= scope; obj->scope_= scop;
obj->name_ = net->name(); obj->name_ = net->name();
make_logic_delays_(obj, net); make_logic_delays_(obj, net);
@ -1388,7 +1388,7 @@ void dll_target::udp(const NetUDP*net)
obj->nattr = 0; obj->nattr = 0;
obj->attr = 0; obj->attr = 0;
scope_add_logic(scope, obj); scope_add_logic(scop, obj);
} }
void dll_target::lpm_abs(const NetAbs*net) void dll_target::lpm_abs(const NetAbs*net)
@ -2293,81 +2293,81 @@ void dll_target::net_probe(const NetEvProbe*net)
void dll_target::scope(const NetScope*net) void dll_target::scope(const NetScope*net)
{ {
ivl_scope_t scope; ivl_scope_t scop;
if (net->parent() == 0) { if (net->parent() == 0) {
unsigned i; unsigned i;
scope = NULL; scop = NULL;
for (i = 0; i < des_.nroots_ && scope == NULL; i++) { for (i = 0; i < des_.nroots_ && scop == NULL; i++) {
if (strcmp(des_.roots_[i]->name_, net->basename()) == 0) if (strcmp(des_.roots_[i]->name_, net->basename()) == 0)
scope = des_.roots_[i]; scop = des_.roots_[i];
} }
assert(scope); assert(scop);
} else { } else {
perm_string sname = make_scope_name(net->fullname()); perm_string sname = make_scope_name(net->fullname());
scope = new struct ivl_scope_s; scop = new struct ivl_scope_s;
scope->name_ = sname; scop->name_ = sname;
FILE_NAME(scope, net); FILE_NAME(scop, net);
scope->child_ = 0; scop->child_ = 0;
scope->sibling_ = 0; scop->sibling_ = 0;
scope->parent = find_scope(des_, net->parent()); scop->parent = find_scope(des_, net->parent());
assert(scope->parent); assert(scop->parent);
scope->nsigs_ = 0; scop->nsigs_ = 0;
scope->sigs_ = 0; scop->sigs_ = 0;
scope->nlog_ = 0; scop->nlog_ = 0;
scope->log_ = 0; scop->log_ = 0;
scope->nevent_ = 0; scop->nevent_ = 0;
scope->event_ = 0; scop->event_ = 0;
scope->nlpm_ = 0; scop->nlpm_ = 0;
scope->lpm_ = 0; scop->lpm_ = 0;
scope->def = 0; scop->def = 0;
make_scope_parameters(scope, net); make_scope_parameters(scop, net);
scope->time_precision = net->time_precision(); scop->time_precision = net->time_precision();
scope->time_units = net->time_unit(); scop->time_units = net->time_unit();
scope->nattr = net->attr_cnt(); scop->nattr = net->attr_cnt();
scope->attr = fill_in_attributes(net); scop->attr = fill_in_attributes(net);
scope->is_auto = net->is_auto(); scop->is_auto = net->is_auto();
switch (net->type()) { switch (net->type()) {
case NetScope::MODULE: case NetScope::MODULE:
scope->type_ = IVL_SCT_MODULE; scop->type_ = IVL_SCT_MODULE;
scope->tname_ = net->module_name(); scop->tname_ = net->module_name();
break; break;
case NetScope::TASK: { case NetScope::TASK: {
const NetTaskDef*def = net->task_def(); const NetTaskDef*def = net->task_def();
if (def == 0) { if (def == 0) {
cerr << "?:?" << ": internal error: " cerr << "?:?" << ": internal error: "
<< "task " << scope->name_ << "task " << scop->name_
<< " has no definition." << endl; << " has no definition." << endl;
} }
assert(def); assert(def);
scope->type_ = IVL_SCT_TASK; scop->type_ = IVL_SCT_TASK;
scope->tname_ = def->scope()->basename(); scop->tname_ = def->scope()->basename();
break; break;
} }
case NetScope::FUNC: case NetScope::FUNC:
scope->type_ = IVL_SCT_FUNCTION; scop->type_ = IVL_SCT_FUNCTION;
scope->tname_ = net->func_def()->scope()->basename(); scop->tname_ = net->func_def()->scope()->basename();
break; break;
case NetScope::BEGIN_END: case NetScope::BEGIN_END:
scope->type_ = IVL_SCT_BEGIN; scop->type_ = IVL_SCT_BEGIN;
scope->tname_ = scope->name_; scop->tname_ = scop->name_;
break; break;
case NetScope::FORK_JOIN: case NetScope::FORK_JOIN:
scope->type_ = IVL_SCT_FORK; scop->type_ = IVL_SCT_FORK;
scope->tname_ = scope->name_; scop->tname_ = scop->name_;
break; break;
case NetScope::GENBLOCK: case NetScope::GENBLOCK:
scope->type_ = IVL_SCT_GENERATE; scop->type_ = IVL_SCT_GENERATE;
scope->tname_ = scope->name_; scop->tname_ = scop->name_;
break; break;
} }
assert(scope->parent != 0); assert(scop->parent != 0);
scope->sibling_= scope->parent->child_; scop->sibling_= scop->parent->child_;
scope->parent->child_ = scope; scop->parent->child_ = scop;
} }
} }