Move memories to the NetScope object.
This commit is contained in:
parent
8d8f1e2401
commit
69612ceb73
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: design_dump.cc,v 1.80 2000/05/02 00:58:11 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.81 2000/05/02 03:13:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -677,6 +677,15 @@ void NetScope::dump(ostream&o) const
|
|||
} while (cur != signals_->sig_next_);
|
||||
}
|
||||
|
||||
// Dump the memories,
|
||||
if (memories_) {
|
||||
NetMemory*cur = memories_->snext_;
|
||||
do {
|
||||
cur->dump(o, 4);
|
||||
cur = cur->snext_;
|
||||
} while (cur != memories_->snext_);
|
||||
}
|
||||
|
||||
/* Dump any sub-scopes. */
|
||||
for (NetScope*cur = sub_ ; cur ; cur = cur->sib_)
|
||||
cur->dump(o);
|
||||
|
|
@ -876,15 +885,6 @@ void Design::dump(ostream&o) const
|
|||
o << "SCOPES:" << endl;
|
||||
root_scope_->dump(o);
|
||||
|
||||
o << "ELABORATED MEMORIES:" << endl;
|
||||
{
|
||||
map<string,NetMemory*>::const_iterator pp;
|
||||
for (pp = memories_.begin()
|
||||
; pp != memories_.end() ; pp ++) {
|
||||
(*pp).second->dump(o, 0);
|
||||
}
|
||||
}
|
||||
|
||||
o << "ELABORATED FUNCTION DEFINITIONS:" << endl;
|
||||
{
|
||||
map<string,NetFuncDef*>::const_iterator pp;
|
||||
|
|
@ -924,6 +924,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.81 2000/05/02 03:13:30 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.80 2000/05/02 00:58:11 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
13
elab_expr.cc
13
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.22 2000/05/02 00:58:11 steve Exp $"
|
||||
#ident "$Id: elab_expr.cc,v 1.23 2000/05/02 03:13:30 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -164,6 +164,8 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope) const
|
|||
}
|
||||
assert(def);
|
||||
|
||||
NetScope*dscope = des->find_scope(def->name());
|
||||
assert(dscope);
|
||||
|
||||
svector<NetExpr*> parms (parms_.count());
|
||||
|
||||
|
|
@ -183,7 +185,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope) const
|
|||
of the function, that has the name of the function. The
|
||||
function code assigns to this signal to return a value. */
|
||||
|
||||
NetNet*res = des->find_signal(def->name(), name_);
|
||||
NetNet*res = des->find_signal(dscope, name_);
|
||||
if (res == 0) {
|
||||
cerr << get_line() << ": internal error: Unable to locate "
|
||||
"function return value for " << name_ << " in " <<
|
||||
|
|
@ -260,7 +262,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope) const
|
|||
|
||||
// If the identifier names a signal (a register or wire)
|
||||
// then create a NetESignal node to handle it.
|
||||
if (NetNet*net = des->find_signal(scope->name(), text_)) {
|
||||
if (NetNet*net = des->find_signal(scope, text_)) {
|
||||
|
||||
// If this is a part select of a signal, then make a new
|
||||
// temporary signal that is connected to just the
|
||||
|
|
@ -346,7 +348,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope) const
|
|||
// If the identifier names a memory, then this is a
|
||||
// memory reference and I must generate a NetEMemory
|
||||
// object to handle it.
|
||||
if (NetMemory*mem = des->find_memory(scope->name(), text_)) {
|
||||
if (NetMemory*mem = des->find_memory(scope, text_)) {
|
||||
if (msb_ == 0) {
|
||||
NetEMemory*node = new NetEMemory(mem);
|
||||
node->set_line(*this);
|
||||
|
|
@ -454,6 +456,9 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
* Revision 1.23 2000/05/02 03:13:30 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.22 2000/05/02 00:58:11 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
13
elab_net.cc
13
elab_net.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_net.cc,v 1.31 2000/05/02 00:58:11 steve Exp $"
|
||||
#ident "$Id: elab_net.cc,v 1.32 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "PExpr.h"
|
||||
|
|
@ -886,12 +886,12 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path,
|
|||
unsigned long decay) const
|
||||
{
|
||||
NetScope*scope = des->find_scope(path);
|
||||
NetNet*sig = des->find_signal(path, text_);
|
||||
NetNet*sig = des->find_signal(scope, text_);
|
||||
|
||||
if (sig == 0) {
|
||||
/* If the identifier is a memory instead of a signal,
|
||||
then handle it elsewhere. Create a RAM. */
|
||||
if (NetMemory*mem = des->find_memory(path, text_))
|
||||
if (NetMemory*mem = des->find_memory(scope, text_))
|
||||
return elaborate_net_ram_(des, path, mem, lwidth,
|
||||
rise, fall, decay);
|
||||
|
||||
|
|
@ -1045,10 +1045,10 @@ NetNet* PEIdent::elaborate_lnet(Design*des, const string&path) const
|
|||
NetScope*scope = des->find_scope(path);
|
||||
assert(scope);
|
||||
|
||||
NetNet*sig = des->find_signal(path, text_);
|
||||
NetNet*sig = des->find_signal(scope, text_);
|
||||
if (sig == 0) {
|
||||
/* Don't allow memories here. Is it a memory? */
|
||||
if (des->find_memory(path, text_)) {
|
||||
if (des->find_memory(scope, text_)) {
|
||||
cerr << get_line() << ": error: memories (" << text_
|
||||
<< ") cannot be l-values in continuous "
|
||||
<< "assignments." << endl;
|
||||
|
|
@ -1410,6 +1410,9 @@ NetNet* PEUnary::elaborate_net(Design*des, const string&path,
|
|||
|
||||
/*
|
||||
* $Log: elab_net.cc,v $
|
||||
* Revision 1.32 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.31 2000/05/02 00:58:11 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
24
elaborate.cc
24
elaborate.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: elaborate.cc,v 1.166 2000/05/02 00:58:11 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.167 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -146,9 +146,9 @@ void PWire::elaborate(Design*des, NetScope*scope) const
|
|||
long rnum = rval->as_long();
|
||||
delete lval;
|
||||
delete rval;
|
||||
NetMemory*sig = new NetMemory(path+"."+basename, wid, lnum, rnum);
|
||||
NetMemory*sig = new NetMemory(scope, path+"."+basename,
|
||||
wid, lnum, rnum);
|
||||
sig->set_attributes(attributes);
|
||||
des->add_memory(sig);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
@ -409,7 +409,6 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
|
|||
// already, so just look it up as a child of the current scope.
|
||||
NetScope*my_scope = scope->child(get_name());
|
||||
assert(my_scope);
|
||||
const string my_name = my_scope -> name();
|
||||
|
||||
const svector<PExpr*>*pins;
|
||||
|
||||
|
|
@ -499,7 +498,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, const string&path) const
|
|||
unsigned prts_pin_count = 0;
|
||||
for (unsigned ldx = 0 ; ldx < mport.count() ; ldx += 1) {
|
||||
PWire*pport = mport[ldx];
|
||||
prts[ldx] = des->find_signal(my_name, pport->name());
|
||||
prts[ldx] = des->find_signal(my_scope, pport->name());
|
||||
assert(prts[ldx]);
|
||||
prts_pin_count += prts[ldx]->pin_count();
|
||||
}
|
||||
|
|
@ -815,7 +814,7 @@ NetNet* PAssign_::elaborate_lval(Design*des, const string&path,
|
|||
|
||||
/* Get the signal referenced by the identifier, and make sure
|
||||
it is a register. (Wires are not allows in this context. */
|
||||
NetNet*reg = des->find_signal(path, id->name());
|
||||
NetNet*reg = des->find_signal(scope, id->name());
|
||||
|
||||
if (reg == 0) {
|
||||
cerr << get_line() << ": error: Could not match signal ``" <<
|
||||
|
|
@ -907,11 +906,11 @@ NetProc* PAssign::elaborate(Design*des, const string&path) const
|
|||
const PEIdent*id = dynamic_cast<const PEIdent*>(lval());
|
||||
if (id == 0) break;
|
||||
|
||||
NetNet*net = des->find_signal(path, id->name());
|
||||
NetNet*net = des->find_signal(scope, id->name());
|
||||
if (net && (net->scope() == scope))
|
||||
break;
|
||||
|
||||
if (NetMemory*mem = des->find_memory(path, id->name()))
|
||||
if (NetMemory*mem = des->find_memory(scope, id->name()))
|
||||
return assign_to_memory_(mem, id->msb_, des, path);
|
||||
|
||||
} while(0);
|
||||
|
|
@ -1123,7 +1122,7 @@ NetProc* PAssignNB::elaborate(Design*des, const string&path) const
|
|||
const PEIdent*id = dynamic_cast<const PEIdent*>(lval());
|
||||
if (id == 0) break;
|
||||
|
||||
if (NetMemory*mem = des->find_memory(path, id->name()))
|
||||
if (NetMemory*mem = des->find_memory(scope, id->name()))
|
||||
return assign_to_memory_(mem, id->msb_, des, path);
|
||||
|
||||
} while(0);
|
||||
|
|
@ -1933,7 +1932,7 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const
|
|||
/* make the expression, and later the initial assignment to
|
||||
the condition variable. The statement in the for loop is
|
||||
very specifically an assignment. */
|
||||
NetNet*sig = des->find_signal(path, id1->name());
|
||||
NetNet*sig = des->find_signal(scope, id1->name());
|
||||
if (sig == 0) {
|
||||
cerr << id1->get_line() << ": register ``" << id1->name()
|
||||
<< "'' unknown in this context." << endl;
|
||||
|
|
@ -1962,7 +1961,7 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const
|
|||
/* Elaborate the increment assignment statement at the end of
|
||||
the for loop. This is also a very specific assignment
|
||||
statement. Put this into the "body" block. */
|
||||
sig = des->find_signal(path, id2->name());
|
||||
sig = des->find_signal(scope, id2->name());
|
||||
assert(sig);
|
||||
NetAssign*step = new NetAssign("@for-assign", des, sig->pin_count(),
|
||||
expr2_->elaborate_expr(des, scope));
|
||||
|
|
@ -2431,6 +2430,9 @@ Design* elaborate(const map<string,Module*>&modules,
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.167 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.166 2000/05/02 00:58:11 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
32
emit.cc
32
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.42 2000/05/02 00:58:12 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.43 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -297,6 +297,14 @@ void NetScope::emit_scope(ostream&o, struct target_t*tgt) const
|
|||
cur = cur->sig_next_;
|
||||
} while (cur != signals_->sig_next_);
|
||||
}
|
||||
|
||||
if (memories_) {
|
||||
NetMemory*cur = memories_->snext_;
|
||||
do {
|
||||
tgt->memory(o, cur);
|
||||
cur = cur->snext_;
|
||||
} while (cur != memories_->snext_);
|
||||
}
|
||||
}
|
||||
|
||||
void NetWhile::emit_proc_recurse(ostream&o, struct target_t*tgt) const
|
||||
|
|
@ -312,25 +320,6 @@ bool Design::emit(ostream&o, struct target_t*tgt) const
|
|||
// enumerate the scopes
|
||||
root_scope_->emit_scope(o, tgt);
|
||||
|
||||
#if 0
|
||||
// emit signals
|
||||
if (signals_) {
|
||||
NetNet*cur = signals_->sig_next_;
|
||||
do {
|
||||
tgt->signal(o, cur);
|
||||
cur = cur->sig_next_;
|
||||
} while (cur != signals_->sig_next_);
|
||||
}
|
||||
#endif
|
||||
|
||||
// emit memories
|
||||
{
|
||||
map<string,NetMemory*>::const_iterator mi;
|
||||
for (mi = memories_.begin() ; mi != memories_.end() ; mi++) {
|
||||
tgt->memory(o, (*mi).second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// emit nodes
|
||||
if (nodes_) {
|
||||
|
|
@ -440,6 +429,9 @@ bool emit(ostream&o, const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.43 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.42 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_design.cc,v 1.6 2000/05/02 00:58:12 steve Exp $"
|
||||
#ident "$Id: net_design.cc,v 1.7 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -269,49 +269,27 @@ string Design::get_flag(const string&key) const
|
|||
* This method looks for a string given a current context as a
|
||||
* starting point.
|
||||
*/
|
||||
NetNet* Design::find_signal(const string&path, const string&name)
|
||||
NetNet* Design::find_signal(NetScope*scope, const string&name)
|
||||
{
|
||||
NetScope*scope = find_scope(path);
|
||||
if (scope == 0) {
|
||||
cerr << "internal error: invalid scope: " << path << endl;
|
||||
return 0;
|
||||
}
|
||||
assert(scope);
|
||||
|
||||
while (scope) {
|
||||
if (NetNet*net = scope->find_signal(name))
|
||||
return net;
|
||||
|
||||
scope = scope->parent();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Design::add_memory(NetMemory*mem)
|
||||
NetMemory* Design::find_memory(NetScope*scope, const string&name)
|
||||
{
|
||||
memories_[mem->name()] = mem;
|
||||
}
|
||||
|
||||
NetMemory* Design::find_memory(const string&path, const string&name)
|
||||
{
|
||||
string root = path;
|
||||
|
||||
for (;;) {
|
||||
string fulname = root + "." + name;
|
||||
map<string,NetMemory*>::const_iterator cur
|
||||
= memories_.find(fulname);
|
||||
|
||||
if (cur != memories_.end())
|
||||
return (*cur).second;
|
||||
|
||||
unsigned pos = root.rfind('.');
|
||||
if (pos > root.length())
|
||||
break;
|
||||
|
||||
root = root.substr(0, pos);
|
||||
assert(scope);
|
||||
while (scope) {
|
||||
if (NetMemory*mem = scope->find_memory(name))
|
||||
return mem;
|
||||
scope = scope->parent();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -321,29 +299,20 @@ void Design::find_symbol(NetScope*scope, const string&key,
|
|||
sig = 0;
|
||||
mem = 0;
|
||||
|
||||
for (;;) {
|
||||
while (scope) {
|
||||
|
||||
/* Form the full heirarchical name for lookups. */
|
||||
string fulname = scope? (scope->name() + "." + key) : key;
|
||||
string fulname = scope->name() + "." + key;
|
||||
|
||||
if (scope)
|
||||
if (NetNet*cur = scope->find_signal(fulname)) {
|
||||
sig = cur;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Is this a memory? If so, we are again done. */
|
||||
map<string,NetMemory*>::const_iterator cur
|
||||
= memories_.find(fulname);
|
||||
|
||||
if (cur != memories_.end()) {
|
||||
mem = (*cur).second;
|
||||
if (NetNet*cur = scope->find_signal(fulname)) {
|
||||
sig = cur;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Neither a signal nor memory are found, so go up a
|
||||
scope level and try again. */
|
||||
if (scope == 0)
|
||||
if (NetMemory*cur = scope->find_memory(fulname)) {
|
||||
mem = cur;
|
||||
return;
|
||||
}
|
||||
|
||||
scope = scope->parent();
|
||||
}
|
||||
|
|
@ -504,6 +473,9 @@ NetNode* Design::find_node(bool (*func)(const NetNode*))
|
|||
|
||||
/*
|
||||
* $Log: net_design.cc,v $
|
||||
* Revision 1.7 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.6 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
52
net_scope.cc
52
net_scope.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: net_scope.cc,v 1.5 2000/05/02 00:58:12 steve Exp $"
|
||||
#ident "$Id: net_scope.cc,v 1.6 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
NetScope::NetScope(const string&n)
|
||||
: type_(NetScope::MODULE), name_(n), up_(0), sib_(0), sub_(0)
|
||||
{
|
||||
memories_ = 0;
|
||||
signals_ = 0;
|
||||
events_ = 0;
|
||||
lcounter_ = 0;
|
||||
|
|
@ -42,6 +43,7 @@ NetScope::NetScope(const string&n)
|
|||
NetScope::NetScope(NetScope*up, const string&n, NetScope::TYPE t)
|
||||
: type_(t), name_(n), up_(up), sib_(0), sub_(0)
|
||||
{
|
||||
memories_ = 0;
|
||||
signals_ = 0;
|
||||
events_ = 0;
|
||||
sib_ = up_->sub_;
|
||||
|
|
@ -184,6 +186,51 @@ NetNet* NetScope::find_signal(const string&key)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void NetScope::add_memory(NetMemory*mem)
|
||||
{
|
||||
if (memories_ == 0) {
|
||||
mem->snext_ = mem;
|
||||
mem->sprev_ = mem;
|
||||
} else {
|
||||
mem->snext_ = memories_->snext_;
|
||||
mem->sprev_ = memories_;
|
||||
mem->snext_->sprev_ = mem;
|
||||
mem->sprev_->snext_ = mem;
|
||||
}
|
||||
memories_ = mem;
|
||||
mem->scope_ = this;
|
||||
}
|
||||
|
||||
void NetScope::rem_memory(NetMemory*mem)
|
||||
{
|
||||
assert(mem->scope_ == this);
|
||||
if (memories_ == mem)
|
||||
memories_ = mem->sprev_;
|
||||
|
||||
if (memories_ == mem) {
|
||||
memories_ = 0;
|
||||
} else {
|
||||
mem->sprev_->snext_ = mem->snext_;
|
||||
mem->snext_->sprev_ = mem->sprev_;
|
||||
}
|
||||
mem->scope_ = 0;
|
||||
}
|
||||
|
||||
NetMemory* NetScope::find_memory(const string&key)
|
||||
{
|
||||
if (memories_ == 0)
|
||||
return 0;
|
||||
|
||||
string fulname = name()+"."+key;
|
||||
NetMemory*cur = memories_;
|
||||
do {
|
||||
if (cur->name() == fulname)
|
||||
return cur;
|
||||
cur = cur->sprev_;
|
||||
} while (cur != memories_);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method locates a child scope by name. The name is the simple
|
||||
* name of the child, no heirarchy is searched.
|
||||
|
|
@ -234,6 +281,9 @@ string NetScope::local_symbol()
|
|||
|
||||
/*
|
||||
* $Log: net_scope.cc,v $
|
||||
* Revision 1.6 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.5 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
16
netlist.cc
16
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: netlist.cc,v 1.120 2000/05/02 00:58:12 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.121 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <cassert>
|
||||
|
|
@ -2124,9 +2124,16 @@ NetEMemory::~NetEMemory()
|
|||
{
|
||||
}
|
||||
|
||||
NetMemory::NetMemory(const string&n, long w, long s, long e)
|
||||
: name_(n), width_(w), idxh_(s), idxl_(e), ram_list_(0)
|
||||
NetMemory::NetMemory(NetScope*sc, const string&n, long w, long s, long e)
|
||||
: name_(n), width_(w), idxh_(s), idxl_(e), ram_list_(0), scope_(sc)
|
||||
{
|
||||
scope_->add_memory(this);
|
||||
}
|
||||
|
||||
NetMemory::~NetMemory()
|
||||
{
|
||||
assert(scope_);
|
||||
scope_->rem_memory(this);
|
||||
}
|
||||
|
||||
unsigned NetMemory::count() const
|
||||
|
|
@ -2545,6 +2552,9 @@ bool NetUDP::sequ_glob_(string input, char output)
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.121 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.120 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
41
netlist.h
41
netlist.h
|
|
@ -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.133 2000/05/02 00:58:12 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.134 2000/05/02 03:13:31 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -495,13 +495,17 @@ class NetFF : public NetNode {
|
|||
class NetMemory {
|
||||
|
||||
public:
|
||||
NetMemory(const string&n, long w, long s, long e);
|
||||
NetMemory(NetScope*sc, const string&n, long w, long s, long e);
|
||||
~NetMemory();
|
||||
|
||||
const string&name() const { return name_; }
|
||||
|
||||
// This is the width (in bits) of a single memory position.
|
||||
unsigned width() const { return width_; }
|
||||
|
||||
NetScope*scope();
|
||||
const NetScope*scope() const;
|
||||
|
||||
// This is the number of memory positions.
|
||||
unsigned count() const;
|
||||
|
||||
|
|
@ -524,6 +528,14 @@ class NetMemory {
|
|||
|
||||
friend class NetRamDq;
|
||||
NetRamDq* ram_list_;
|
||||
|
||||
friend class NetScope;
|
||||
NetMemory*snext_, *sprev_;
|
||||
NetScope*scope_;
|
||||
|
||||
private: // not implemented
|
||||
NetMemory(const NetMemory&);
|
||||
NetMemory& operator= (const NetMemory&);
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -2267,6 +2279,16 @@ class NetScope {
|
|||
|
||||
NetNet* find_signal(const string&name);
|
||||
|
||||
|
||||
/* ... and these methods manage memory the same way as signals
|
||||
are managed above. */
|
||||
|
||||
void add_memory(NetMemory*);
|
||||
void rem_memory(NetMemory*);
|
||||
|
||||
NetMemory* find_memory(const string&name);
|
||||
|
||||
|
||||
/* The parent and child() methods allow users of NetScope
|
||||
objects to locate nearby scopes. */
|
||||
NetScope* parent();
|
||||
|
|
@ -2310,8 +2332,9 @@ class NetScope {
|
|||
map<string,NetExpr*>parameters_;
|
||||
map<string,NetExpr*>localparams_;
|
||||
|
||||
NetEvent*events_;
|
||||
NetNet *signals_;
|
||||
NetEvent *events_;
|
||||
NetNet *signals_;
|
||||
NetMemory*memories_;
|
||||
|
||||
NetScope*up_;
|
||||
NetScope*sib_;
|
||||
|
|
@ -2367,11 +2390,10 @@ class Design {
|
|||
this method, unlike the NetScope::find_signal method,
|
||||
handles global name binding. */
|
||||
|
||||
NetNet*find_signal(const string&path, const string&name);
|
||||
NetNet*find_signal(NetScope*scope, const string&name);
|
||||
|
||||
// Memories
|
||||
void add_memory(NetMemory*);
|
||||
NetMemory* find_memory(const string&path, const string&name);
|
||||
NetMemory* find_memory(NetScope*scope, const string&name);
|
||||
|
||||
/* This is a more general lookup that finds the named signal
|
||||
or memory, whichever is first in the search path. */
|
||||
|
|
@ -2416,8 +2438,6 @@ class Design {
|
|||
// tree and per-hop searches for me.
|
||||
NetScope*root_scope_;
|
||||
|
||||
map<string,NetMemory*> memories_;
|
||||
|
||||
// List the function definitions in the design.
|
||||
map<string,NetFuncDef*> funcs_;
|
||||
|
||||
|
|
@ -2485,6 +2505,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.134 2000/05/02 03:13:31 steve
|
||||
* Move memories to the NetScope object.
|
||||
*
|
||||
* Revision 1.133 2000/05/02 00:58:12 steve
|
||||
* Move signal tables to the NetScope class.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue