Permalink
Browse files

Remove find_memory method from Design class.

  • Loading branch information...
1 parent da7956a commit 693794552c3125265ab23bd862bd6f6b4c8b2d02 steve committed Sep 19, 2003
Showing with 111 additions and 81 deletions.
  1. +32 −11 elab_anet.cc
  2. +70 −42 elab_net.cc
  3. +5 −24 net_design.cc
  4. +4 −4 netlist.h
View
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000 Stephen Williams (steve@icarus.com.com)
+ * Copyright (c) 2000-2003 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: elab_anet.cc,v 1.8 2003/06/21 01:21:43 steve Exp $"
+#ident "$Id: elab_anet.cc,v 1.9 2003/09/19 03:50:12 steve Exp $"
#endif
# include "config.h"
@@ -29,6 +29,7 @@
# include "PExpr.h"
# include "netlist.h"
+# include "netmisc.h"
# include <iostream>
NetNet* PExpr::elaborate_anet(Design*des, NetScope*scope) const
@@ -104,17 +105,34 @@ NetNet* PEConcat::elaborate_anet(Design*des, NetScope*scope) const
NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
{
- NetNet*sig = des->find_signal(scope, path_);
+ assert(scope);
- if (sig == 0) {
- if (des->find_memory(scope, path_)) {
- cerr << get_line() << ": error: memories not allowed "
- << "on left side of procedural continuous "
- << "assignment." << endl;
- des->errors += 1;
- return 0;
- }
+ NetNet* sig = 0;
+ NetMemory* mem = 0;
+ NetVariable* var = 0;
+ const NetExpr*par = 0;
+ NetEvent* eve = 0;
+
+ symbol_search(des, scope, path_, sig, mem, var, par, eve);
+
+
+ if (mem != 0) {
+ cerr << get_line() << ": error: memories not allowed "
+ << "on left side of procedural continuous "
+ << "assignment." << endl;
+ des->errors += 1;
+ return 0;
+ }
+ if (eve != 0) {
+ cerr << get_line() << ": error: named events not allowed "
+ << "on left side of procedural continuous "
+ << "assignment." << endl;
+ des->errors += 1;
+ return 0;
+ }
+
+ if (sig == 0) {
cerr << get_line() << ": error: reg ``" << path_ << "'' "
<< "is undefined in this scope." << endl;
des->errors += 1;
@@ -149,6 +167,9 @@ NetNet* PEIdent::elaborate_anet(Design*des, NetScope*scope) const
/*
* $Log: elab_anet.cc,v $
+ * Revision 1.9 2003/09/19 03:50:12 steve
+ * Remove find_memory method from Design class.
+ *
* Revision 1.8 2003/06/21 01:21:43 steve
* Harmless fixup of warnings.
*
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: elab_net.cc,v 1.118 2003/09/13 01:30:07 steve Exp $"
+#ident "$Id: elab_net.cc,v 1.119 2003/09/19 03:50:12 steve Exp $"
#endif
# include "config.h"
@@ -1307,48 +1307,56 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
Link::strength_t drive0,
Link::strength_t drive1) const
{
- NetNet*sig = des->find_signal(scope, path_);
+ assert(scope);
- if (sig == 0) {
- NetScope*found_in;
+ NetNet* sig = 0;
+ NetMemory* mem = 0;
+ NetVariable* var = 0;
+ const NetExpr*par = 0;
+ NetEvent* eve = 0;
- /* If the identifier is a memory instead of a signal,
- then handle it elsewhere. Create a RAM. */
- if (NetMemory*mem = des->find_memory(scope, path_))
- return elaborate_net_ram_(des, scope, mem, lwidth,
- rise, fall, decay);
+ symbol_search(des, scope, path_, sig, mem, var, par, eve);
+ /* If the identifier is a memory instead of a signal,
+ then handle it elsewhere. Create a RAM. */
+ if (mem != 0) {
+ return elaborate_net_ram_(des, scope, mem, lwidth,
+ rise, fall, decay);
+ }
- if (const NetExpr*pe = des->find_parameter(scope, path_, found_in)) {
+ /* If this is a parameter name, then create a constant node
+ that connects to a signal with the correct name. */
+ if (par != 0) {
- const NetEConst*pc = dynamic_cast<const NetEConst*>(pe);
- assert(pc);
- verinum pvalue = pc->value();
+ const NetEConst*pc = dynamic_cast<const NetEConst*>(par);
+ assert(pc);
+ verinum pvalue = pc->value();
- sig = new NetNet(scope, path_.peek_name(0),
- NetNet::IMPLICIT, pc->expr_width());
- NetConst*cp = new NetConst(scope, scope->local_symbol(),
- pvalue);
- des->add_node(cp);
- for (unsigned idx = 0; idx < sig->pin_count(); idx += 1)
- connect(sig->pin(idx), cp->pin(idx));
+ sig = new NetNet(scope, path_.peek_name(0),
+ NetNet::IMPLICIT, pc->expr_width());
+ NetConst*cp = new NetConst(scope, scope->local_symbol(),
+ pvalue);
+ des->add_node(cp);
+ for (unsigned idx = 0; idx < sig->pin_count(); idx += 1)
+ connect(sig->pin(idx), cp->pin(idx));
+ }
- } else {
+ /* Fallback, this may be an implicitly declared net. */
+ if (sig == 0) {
- sig = new NetNet(scope, path_.peek_name(0),
- NetNet::IMPLICIT, 1);
+ sig = new NetNet(scope, path_.peek_name(0),
+ NetNet::IMPLICIT, 1);
- if (error_implicit) {
- cerr << get_line() << ": error: "
- << scope->name() << "." << path_.peek_name(0)
- << " not defined in this scope." << endl;
- des->errors += 1;
+ if (error_implicit) {
+ cerr << get_line() << ": error: "
+ << scope->name() << "." << path_.peek_name(0)
+ << " not defined in this scope." << endl;
+ des->errors += 1;
- } else if (warn_implicit) {
- cerr << get_line() << ": warning: implicit "
- "definition of wire " << scope->name()
- << "." << path_.peek_name(0) << "." << endl;
- }
+ } else if (warn_implicit) {
+ cerr << get_line() << ": warning: implicit "
+ "definition of wire " << scope->name()
+ << "." << path_.peek_name(0) << "." << endl;
}
}
@@ -1559,16 +1567,33 @@ NetNet* PEConcat::elaborate_lnet(Design*des, NetScope*scope,
NetNet* PEIdent::elaborate_lnet(Design*des, NetScope*scope,
bool implicit_net_ok) const
{
- NetNet*sig = des->find_signal(scope, path_);
+ assert(scope);
+
+ NetNet* sig = 0;
+ NetMemory* mem = 0;
+ NetVariable* var = 0;
+ const NetExpr*par = 0;
+ NetEvent* eve = 0;
+
+ symbol_search(des, scope, path_, sig, mem, var, par, eve);
+
+ if (mem != 0) {
+ cerr << get_line() << ": error: memories (" << path_
+ << ") cannot be l-values in continuous "
+ << "assignments." << endl;
+ des->errors += 1;
+ return 0;
+ }
+
+ if (eve != 0) {
+ cerr << get_line() << ": error: named events (" << path_
+ << ") cannot be l-values in continuous "
+ << "assignments." << endl;
+ des->errors += 1;
+ return 0;
+ }
+
if (sig == 0) {
- /* Don't allow memories here. Is it a memory? */
- if (des->find_memory(scope, path_)) {
- cerr << get_line() << ": error: memories (" << path_
- << ") cannot be l-values in continuous "
- << "assignments." << endl;
- des->errors += 1;
- return 0;
- }
if (implicit_net_ok && !error_implicit) {
@@ -2338,6 +2363,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
+ * Revision 1.119 2003/09/19 03:50:12 steve
+ * Remove find_memory method from Design class.
+ *
* Revision 1.118 2003/09/13 01:30:07 steve
* Missing case warnings.
*
View
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Stephen Williams (steve@icarus.com)
+ * Copyright (c) 2000-2003 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: net_design.cc,v 1.39 2003/09/19 03:30:05 steve Exp $"
+#ident "$Id: net_design.cc,v 1.40 2003/09/19 03:50:12 steve Exp $"
#endif
# include "config.h"
@@ -503,28 +503,6 @@ NetNet* Design::find_signal(NetScope*scope, hname_t path)
return 0;
}
-NetMemory* Design::find_memory(NetScope*scope, hname_t path)
-{
- assert(scope);
-
- char*key = path.remove_tail_name();
- if (path.peek_name(0))
- scope = find_scope(scope, path);
-
- while (scope) {
- if (NetMemory*mem = scope->find_memory(key)) {
- delete key;
- return mem;
- }
-
- scope = scope->parent();
- }
-
- delete key;
- return 0;
-}
-
-
NetFuncDef* Design::find_function(NetScope*scope, const hname_t&name)
{
assert(scope);
@@ -662,6 +640,9 @@ void Design::delete_process(NetProcTop*top)
/*
* $Log: net_design.cc,v $
+ * Revision 1.40 2003/09/19 03:50:12 steve
+ * Remove find_memory method from Design class.
+ *
* Revision 1.39 2003/09/19 03:30:05 steve
* Fix name search in elab_lval.
*
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
-#ident "$Id: netlist.h,v 1.300 2003/09/19 03:30:05 steve Exp $"
+#ident "$Id: netlist.h,v 1.301 2003/09/19 03:50:12 steve Exp $"
#endif
/*
@@ -3214,9 +3214,6 @@ class Design {
NetNet*find_signal(NetScope*scope, hname_t path);
- // Memories
- NetMemory* find_memory(NetScope*scope, hname_t path);
-
/* This is a more general lookup that finds the named signal
or memory, whichever is first in the search path. */
void find_symbol(NetScope*,const string&key,
@@ -3319,6 +3316,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
+ * Revision 1.301 2003/09/19 03:50:12 steve
+ * Remove find_memory method from Design class.
+ *
* Revision 1.300 2003/09/19 03:30:05 steve
* Fix name search in elab_lval.
*

0 comments on commit 6937945

Please sign in to comment.