Do not use "synthesize" to elaborate nets if not necessary.

The synthesize was causing memories to be exploded, whis was then causing
memory word addresses to turn into bit index statements, causing bugs.
So don't synthesize if we are not actually synthesizing.
This commit is contained in:
Stephen Williams 2008-05-22 09:37:19 -07:00
parent b7e7d3cb04
commit 568e601212
5 changed files with 21 additions and 6 deletions

View File

@ -77,6 +77,8 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
o << " (local)";
if (signed_)
o << " signed";
if (mref_)
o << " mref_=" << mref_->name();
switch (port_type_) {
case NetNet::NOT_A_PORT:
break;
@ -464,7 +466,7 @@ void NetProcTop::dump(ostream&o, unsigned ind) const
void NetAssign_::dump_lval(ostream&o) const
{
if (sig_) {
o << sig_->name();
o << "sig=" << sig_->name();
if (bmux_) {
o << "[" << *bmux_ << "]";
@ -475,7 +477,7 @@ void NetAssign_::dump_lval(ostream&o) const
// Is there an obvious way to flag memories in the dump
// as different from the _real_ bit mux case?
// o << "**memory**";
o << mem_->name() << "[";
o << "mem=" << mem_->name() << "[";
if (bmux_) o << *bmux_;
else o << "**oops**";
o << "]";

View File

@ -500,6 +500,17 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
NetScope*found_in = symbol_search(des, scope, path_,
net, mem, var, par, eve);
if (net && mem) {
assert(net == mem->reg_from_explode());
net = 0;
}
if (net && net->mref()) {
mem = net->mref();
assert(net == mem->reg_from_explode());
net = 0;
}
// If the identifier name is a parameter name, then return
// a reference to the parameter expression.
if (par != 0) {

View File

@ -499,7 +499,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
use of the situation, or 0 if it cannot. */
if (NetEConst*tmp = dynamic_cast<NetEConst*>(rexp)) {
lsig = lexp->synthesize(des);
lsig = left_->elaborate_net(des, scope, 0, 0, 0, 0);
if (lsig == 0) {
cerr << get_line() << ": internal error: "
"Cannot elaborate net for " << *lexp << endl;
@ -519,7 +519,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
if (NetEConst*tmp = dynamic_cast<NetEConst*>(lexp)) {
rsig = rexp->synthesize(des);
rsig = right_->elaborate_net(des, scope, 0, 0, 0, 0);
assert(rsig);
delete rexp;
@ -533,13 +533,13 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, NetScope*scope,
}
if (lsig == 0) {
lsig = lexp->synthesize(des);
lsig = left_->elaborate_net(des, scope, 0, 0, 0, 0);
assert(lsig);
delete lexp;
}
if (rsig == 0) {
rsig = rexp->synthesize(des);
rsig = right_->elaborate_net(des, scope, 0, 0, 0, 0);
assert(rsig);
delete rexp;
}

View File

@ -62,6 +62,7 @@ NetNet* NetEBitSel::synthesize(Design*des)
NetMux*mux = new NetMux(scope, scope->local_symbol(),
1, net->pin_count(), adr->pin_count());
mux->set_line(*this);
des->add_node(mux);
for (unsigned idx = 0 ; idx < net->pin_count() ; idx += 1)

View File

@ -2226,6 +2226,7 @@ NetNet* NetMemory::explode_to_reg()
return explode_;
explode_ = new NetNet(scope_, name_, NetNet::REG, count()*width_);
explode_->mref(this);
//explode_->incr_lref();
return explode_;
}