Permalink
Browse files

Support the creation of scopes.

  • Loading branch information...
1 parent ac25dc0 commit 4cfa3e4047d956ef24c93746e8fe425681760f9b steve committed Nov 27, 1999
Showing with 428 additions and 206 deletions.
  1. +3 −3 Makefile.in
  2. +6 −2 Module.h
  3. +5 −2 PWire.h
  4. +24 −2 design_dump.cc
  5. +38 −0 dup_expr.cc
  6. +10 −1 elab_expr.cc
  7. +18 −15 elab_net.cc
  8. +26 −63 elaborate.cc
  9. +16 −1 emit.cc
  10. +10 −8 expr_synth.cc
  11. +65 −90 netlist.cc
  12. +43 −7 netlist.h
  13. +51 −3 t-vvm.cc
  14. +14 −1 target.cc
  15. +9 −1 target.h
  16. +7 −1 vpi/vpi_user.h
  17. +2 −2 vvm/Makefile.in
  18. +21 −1 vvm/vpi_priv.h
  19. +54 −0 vvm/vpi_scope.c
  20. +6 −3 xnfio.cc
View
@@ -18,7 +18,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.28 1999/11/18 03:52:19 steve Exp $"
+#ident "$Id: Makefile.in,v 1.29 1999/11/27 19:07:57 steve Exp $"
#
#
SHELL = /bin/sh
@@ -68,8 +68,8 @@ distclean: clean
TT = t-null.o t-verilog.o t-vvm.o t-xnf.o
FF = nobufz.o nodangle.o propinit.o sigfold.o synth.o xnfio.o xnfsyn.o
-O = main.o cprop.o design_dump.o elaborate.o elab_expr.o elab_net.o \
-emit.o eval.o eval_tree.o expr_synth.o functor.o \
+O = main.o cprop.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
+elab_net.o emit.o eval.o eval_tree.o expr_synth.o functor.o \
lexor.o lexor_keyword.o mangle.o netlist.o pad_to_width.o \
parse.o parse_misc.o pform.o pform_dump.o \
set_width.o \
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: Module.h,v 1.9 1999/08/23 16:48:39 steve Exp $"
+#ident "$Id: Module.h,v 1.10 1999/11/27 19:07:57 steve Exp $"
#endif
# include <list>
@@ -33,6 +33,7 @@ class PFunction;
class PWire;
class PProcess;
class Design;
+class NetScope;
/*
* A module is a named container and scope. A module holds a bunch of
@@ -93,7 +94,7 @@ class Module {
const list<PProcess*>& get_behaviors() const { return behaviors_; }
void dump(ostream&out) const;
- bool elaborate(Design*, const string&path, svector<PExpr*>*overrides_) const;
+ bool elaborate(Design*, NetScope*scope, svector<PExpr*>*overrides_) const;
private:
const string name_;
@@ -113,6 +114,9 @@ class Module {
/*
* $Log: Module.h,v $
+ * Revision 1.10 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
* Revision 1.9 1999/08/23 16:48:39 steve
* Parameter overrides support from Peter Monta
* AND and XOR support wide expressions.
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: PWire.h,v 1.5 1999/06/17 05:34:42 steve Exp $"
+#ident "$Id: PWire.h,v 1.6 1999/11/27 19:07:57 steve Exp $"
#endif
# include "netlist.h"
@@ -58,7 +58,7 @@ class PWire : public LineInfo {
// Write myself to the specified stream.
void dump(ostream&out) const;
- void elaborate(Design*, const string&path) const;
+ void elaborate(Design*, NetScope*scope) const;
private:
string name_;
@@ -82,6 +82,9 @@ class PWire : public LineInfo {
/*
* $Log: PWire.h,v $
+ * Revision 1.6 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
* Revision 1.5 1999/06/17 05:34:42 steve
* Clean up interface of the PWire class,
* Properly match wire ranges.
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
-#ident "$Id: design_dump.cc,v 1.59 1999/11/24 04:01:58 steve Exp $"
+#ident "$Id: design_dump.cc,v 1.60 1999/11/27 19:07:57 steve Exp $"
#endif
/*
@@ -49,6 +49,8 @@ void NetNet::dump_net(ostream&o, unsigned ind) const
pin_count() << "]";
if (local_flag_)
o << " (local)";
+ if (scope_)
+ o << " scope=" << scope_->name();
o << " #(" << rise_time() << "," << fall_time() << "," <<
decay_time() << ") init=";
for (unsigned idx = pin_count() ; idx > 0 ; idx -= 1)
@@ -581,7 +583,19 @@ void NetRepeat::dump(ostream&o, unsigned ind) const
void NetScope::dump(ostream&o) const
{
- o << name_ << endl;
+ o << name_;
+ switch (type_) {
+ case BEGIN_END:
+ o << " sequential block";
+ break;
+ case FORK_JOIN:
+ o << " parallel block";
+ break;
+ case MODULE:
+ o << " module";
+ break;
+ }
+ o << endl;
}
void NetSTask::dump(ostream&o, unsigned ind) const
@@ -710,6 +724,11 @@ void NetEIdent::dump(ostream&o) const
o << name_;
}
+void NetEScope::dump(ostream&o) const
+{
+ o << "<scope=" << scope_->name() << ">";
+}
+
void NetESignal::dump(ostream&o) const
{
o << name();
@@ -855,6 +874,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
+ * Revision 1.60 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
* Revision 1.59 1999/11/24 04:01:58 steve
* Detect and list scope names.
*
View
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1999 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
+ * General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+#if !defined(WINNT)
+#ident "$Id: dup_expr.cc,v 1.1 1999/11/27 19:07:57 steve Exp $"
+#endif
+
+# include "netlist.h"
+# include <cassert>
+
+NetEScope* NetEScope::dup_expr() const
+{
+ assert(0);
+ return 0;
+}
+
+/*
+ * $Log: dup_expr.cc,v $
+ * Revision 1.1 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
+ */
+
View
@@ -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.9 1999/11/21 17:35:37 steve Exp $"
+#ident "$Id: elab_expr.cc,v 1.10 1999/11/27 19:07:57 steve Exp $"
#endif
@@ -181,6 +181,12 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const
return tmp;
}
+ if (NetScope*nsc = des->find_scope(text_)) {
+ NetEScope*tmp = new NetEScope(nsc);
+ tmp->set_line(*this);
+ return tmp;
+ }
+
// If the identifier names a signal (a register or wire)
// then create a NetESignal node to handle it.
if (NetNet*net = des->find_signal(path, text_)) {
@@ -324,6 +330,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const
/*
* $Log: elab_expr.cc,v $
+ * Revision 1.10 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
* Revision 1.9 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
View
@@ -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.8 1999/11/21 17:35:37 steve Exp $"
+#ident "$Id: elab_net.cc,v 1.9 1999/11/27 19:07:57 steve Exp $"
#endif
# include "PExpr.h"
@@ -73,7 +73,7 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path,
switch (op_) {
case '^': // XOR
assert(lsig->pin_count() == rsig->pin_count());
- osig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
lsig->pin_count());
osig->local_flag(true);
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
@@ -92,7 +92,7 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path,
case '&': // AND
assert(lsig->pin_count() == rsig->pin_count());
- osig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
lsig->pin_count());
osig->local_flag(true);
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
@@ -111,7 +111,7 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path,
case '|': // Bitwise OR
assert(lsig->pin_count() == rsig->pin_count());
- osig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
lsig->pin_count());
osig->local_flag(true);
for (unsigned idx = 0 ; idx < lsig->pin_count() ; idx += 1) {
@@ -156,7 +156,7 @@ NetNet* PEBinary::elaborate_net(Design*des, const string&path,
}
// The output is the AND of the two logic values.
- osig = new NetNet(des->local_symbol(path), NetNet::WIRE);
+ osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE);
osig->local_flag(true);
connect(gate->pin(0), osig->pin(0));
des->add_signal(osig);
@@ -237,7 +237,7 @@ NetNet* PEBinary::elaborate_net_add_(Design*des, const string&path,
width = rsig->pin_count();
// Make the adder as wide as the widest operand
- osig = new NetNet(des->local_symbol(path), NetNet::WIRE, width);
+ osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE, width);
NetAddSub*adder = new NetAddSub(name, width);
// Connect the adder to the various parts.
@@ -306,7 +306,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, const string&path,
return 0;
}
- NetNet*osig = new NetNet(des->local_symbol(path), NetNet::WIRE);
+ NetNet*osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE);
osig->local_flag(true);
NetNode*gate;
@@ -356,7 +356,7 @@ NetNet* PEBinary::elaborate_net_cmp_(Design*des, const string&path,
des->add_node(gate_t);
// Attach a label to this intermediate wire
- NetNet*tmp = new NetNet(des->local_symbol(path),
+ NetNet*tmp = new NetNet(0, des->local_symbol(path),
NetNet::WIRE);
tmp->local_flag(true);
connect(gate_t->pin(0), tmp->pin(0));
@@ -430,7 +430,7 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, const string&path,
/* Very special case, constant 0 shift. */
if (dist == 0) return lsig;
- NetNet*osig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ NetNet*osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
lsig->pin_count());
osig->local_flag(true);
@@ -469,7 +469,7 @@ NetNet* PEBinary::elaborate_net_shift_(Design*des, const string&path,
lsig->pin_count(),
rsig->pin_count());
- NetNet*osig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ NetNet*osig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
lsig->pin_count());
osig->local_flag(true);
@@ -514,7 +514,7 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path,
const NetEConst*pc = dynamic_cast<const NetEConst*>(pe);
assert(pc);
verinum pvalue = pc->value();
- sig = new NetNet(path+"."+text_, NetNet::IMPLICIT,
+ sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT,
pc->expr_width());
for (unsigned idx = 0; idx < sig->pin_count(); idx += 1) {
NetConst*cp = new NetConst(des->local_symbol(path),
@@ -525,7 +525,7 @@ NetNet* PEIdent::elaborate_net(Design*des, const string&path,
} else {
- sig = new NetNet(path+"."+text_, NetNet::IMPLICIT, 1);
+ sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT, 1);
des->add_signal(sig);
cerr << get_line() << ": warning: Implicitly defining "
"wire " << path << "." << text_ << "." << endl;
@@ -666,7 +666,7 @@ NetNet* PEIdent::elaborate_lnet(Design*des, const string&path) const
}
/* Fine, create an implicit wire as an l-value. */
- sig = new NetNet(path+"."+text_, NetNet::IMPLICIT, 1);
+ sig = new NetNet(0, path+"."+text_, NetNet::IMPLICIT, 1);
des->add_signal(sig);
cerr << get_line() << ": warning: Implicitly defining "
"wire " << path << "." << text_ << "." << endl;
@@ -758,7 +758,7 @@ NetNet* PENumber::elaborate_net(Design*des, const string&path,
if ((lwidth > 0) && (lwidth < width))
width = lwidth;
- NetNet*net = new NetNet(des->local_symbol(path),
+ NetNet*net = new NetNet(0, des->local_symbol(path),
NetNet::IMPLICIT, width);
net->local_flag(true);
for (unsigned idx = 0 ; idx < width ; idx += 1) {
@@ -795,7 +795,7 @@ NetNet* PETernary::elaborate_net(Design*des, const string&path,
assert(width == tru_sig->pin_count());
assert(expr_sig->pin_count() == 1);
- NetNet*sig = new NetNet(des->local_symbol(path), NetNet::WIRE,
+ NetNet*sig = new NetNet(0, des->local_symbol(path), NetNet::WIRE,
tru_sig->pin_count());
sig->local_flag(true);
@@ -816,6 +816,9 @@ NetNet* PETernary::elaborate_net(Design*des, const string&path,
/*
* $Log: elab_net.cc,v $
+ * Revision 1.9 1999/11/27 19:07:57 steve
+ * Support the creation of scopes.
+ *
* Revision 1.8 1999/11/21 17:35:37 steve
* Memory name lookup handles scopes.
*
Oops, something went wrong.

0 comments on commit 4cfa3e4

Please sign in to comment.