Memory name lookup handles scopes.

This commit is contained in:
steve 1999-11-21 17:35:37 +00:00
parent b4aade1e4c
commit 4cfa715092
5 changed files with 44 additions and 16 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elab_expr.cc,v 1.8 1999/11/10 02:52:24 steve Exp $"
#ident "$Id: elab_expr.cc,v 1.9 1999/11/21 17:35:37 steve Exp $"
#endif
@ -260,7 +260,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) 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(name)) {
if (NetMemory*mem = des->find_memory(path, text_)) {
if (msb_ == 0) {
cerr << get_line() << ": error: Memory ``" << name <<
"'' referenced without an index expression." << endl;
@ -324,6 +324,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const
/*
* $Log: elab_expr.cc,v $
* Revision 1.9 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
* Revision 1.8 1999/11/10 02:52:24 steve
* Create the vpiMemory handle type.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elab_net.cc,v 1.7 1999/11/21 00:13:08 steve Exp $"
#ident "$Id: elab_net.cc,v 1.8 1999/11/21 17:35:37 steve Exp $"
#endif
# include "PExpr.h"
@ -504,7 +504,7 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path,
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(path, text_))
return elaborate_net_ram_(des, path, mem, lwidth,
rise, fall, decay);
@ -658,7 +658,7 @@ NetNet* PEIdent::elaborate_lnet(Design*des, const string&path) const
NetNet*sig = des->find_signal(path, text_);
if (sig == 0) {
/* Don't allow memories here. Is it a memory? */
if (des->find_memory(path+"."+text_)) {
if (des->find_memory(path, text_)) {
cerr << get_line() << ": error: memories (" << text_
<< ") cannot be l-values in continuous "
<< "assignments." << endl;
@ -816,6 +816,9 @@ NetNet* PETernary::elaborate_net(Design*des, const string&path,
/*
* $Log: elab_net.cc,v $
* Revision 1.8 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
* Revision 1.7 1999/11/21 00:13:08 steve
* Support memories in continuous assignments.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: elaborate.cc,v 1.126 1999/11/21 01:16:51 steve Exp $"
#ident "$Id: elaborate.cc,v 1.127 1999/11/21 17:35:37 steve Exp $"
#endif
/*
@ -1047,7 +1047,7 @@ NetProc* PAssign::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(path, id->name()))
return assign_to_memory_(mem, id->msb_, des, path);
} while(0);
@ -1243,7 +1243,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(path, id->name()))
return assign_to_memory_(mem, id->msb_, des, path);
} while(0);
@ -2133,6 +2133,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
* Revision 1.127 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
* Revision 1.126 1999/11/21 01:16:51 steve
* Fix coding errors handling names of logic devices,
* and add support for buf device in vvm.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: netlist.cc,v 1.90 1999/11/21 00:13:08 steve Exp $"
#ident "$Id: netlist.cc,v 1.91 1999/11/21 17:35:37 steve Exp $"
#endif
# include <cassert>
@ -2326,13 +2326,26 @@ void Design::add_memory(NetMemory*mem)
memories_[mem->name()] = mem;
}
NetMemory* Design::find_memory(const string&key)
NetMemory* Design::find_memory(const string&path, const string&name)
{
map<string,NetMemory*>::const_iterator cur = memories_.find(key);
if (cur == memories_.end())
return 0;
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);
}
return 0;
}
void Design::add_function(const string&key, NetFuncDef*def)
@ -2518,6 +2531,9 @@ NetNet* Design::find_signal(bool (*func)(const NetNet*))
/*
* $Log: netlist.cc,v $
* Revision 1.91 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
* Revision 1.90 1999/11/21 00:13:08 steve
* Support memories in continuous assignments.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: netlist.h,v 1.92 1999/11/21 00:13:09 steve Exp $"
#ident "$Id: netlist.h,v 1.93 1999/11/21 17:35:37 steve Exp $"
#endif
/*
@ -1862,7 +1862,7 @@ class Design {
// Memories
void add_memory(NetMemory*);
NetMemory* find_memory(const string&name);
NetMemory* find_memory(const string&path, const string&name);
// Functions
void add_function(const string&n, NetFuncDef*);
@ -1977,6 +1977,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
* Revision 1.93 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
* Revision 1.92 1999/11/21 00:13:09 steve
* Support memories in continuous assignments.
*