Permalink
Browse files

Add structure for asynchronous logic synthesis.

  • Loading branch information...
steve
steve committed Jun 30, 2002
1 parent b54ee3b commit 9b6b081e38af1dbc2cda51966e32774de44a6172
Showing with 358 additions and 12 deletions.
  1. +4 −4 Makefile.in
  2. +82 −0 async.cc
  3. +6 −1 main.cc
  4. +27 −1 net_event.cc
  5. +18 −3 net_link.cc
  6. +64 −0 net_nex_output.cc
  7. +50 −3 netlist.h
  8. +107 −0 synth2.cc
View
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.128 2002/06/14 04:17:12 steve Exp $"
+#ident "$Id: Makefile.in,v 1.129 2002/06/30 02:21:31 steve Exp $"
#
#
SHELL = /bin/sh
@@ -124,15 +124,15 @@ TT_VVM = mangle.o t-vvm.o
endif
TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o $(TT_VVM) t-xnf.o
-FF = nodangle.o synth.o syn-rules.o xnfio.o
+FF = cprop.o nodangle.o synth.o synth2.o syn-rules.o xnfio.o
-O = main.o cprop.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
+O = main.o async.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
elab_lval.o elab_net.o elab_anet.o elab_pexpr.o elab_scope.o \
elab_sig.o emit.o eval.o eval_attrib.o eval_rconst.o \
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
load_module.o netlist.o netmisc.o net_assign.o \
net_design.o net_event.o net_expr.o net_force.o net_func.o \
-net_link.o net_modulo.o net_nex_input.o \
+net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
net_proc.o net_scope.o net_udp.o pad_to_width.o \
parse.o parse_misc.o pform.o pform_dump.o \
set_width.o \
View
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2002 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: async.cc,v 1.1 2002/06/30 02:21:31 steve Exp $"
+#endif
+
+# include "config.h"
+
+# include "functor.h"
+# include "netlist.h"
+# include <assert.h>
+
+bool NetAssign::is_asynchronous()
+{
+ return true;
+}
+
+bool NetCondit::is_asynchronous()
+{
+ return false;
+}
+
+bool NetEvWait::is_asynchronous()
+{
+ NexusSet*sense = new NexusSet;
+ for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) {
+ NexusSet*tmp = event(idx)->nex_async_();
+ if (tmp == 0) {
+ delete sense;
+ return false;
+ }
+
+ sense->add(*tmp);
+ delete tmp;
+ }
+
+ NexusSet*inputs = statement_->nex_input();
+
+ if (! sense->contains(*inputs)) {
+ delete sense;
+ delete inputs;
+ return false;
+ }
+
+ delete sense;
+ delete inputs;
+ return true;
+}
+
+bool NetProc::is_asynchronous()
+{
+ return false;
+}
+
+bool NetProcTop::is_asynchronous()
+{
+ return statement_->is_asynchronous();
+}
+
+/*
+ * $Log: async.cc,v $
+ * Revision 1.1 2002/06/30 02:21:31 steve
+ * Add structure for asynchronous logic synthesis.
+ *
+ */
+
View
@@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: main.cc,v 1.60 2002/06/24 01:49:39 steve Exp $"
+#ident "$Id: main.cc,v 1.61 2002/06/30 02:21:31 steve Exp $"
#endif
# include "config.h"
@@ -193,6 +193,7 @@ extern Design* elaborate(list <const char*>root);
extern void cprop(Design*des);
extern void synth(Design*des);
+extern void synth2(Design*des);
extern void syn_rules(Design*des);
extern void nodangle(Design*des);
extern void xnfio(Design*des);
@@ -205,6 +206,7 @@ static struct net_func_map {
{ "cprop", &cprop },
{ "nodangle",&nodangle },
{ "synth", &synth },
+ { "synth2", &synth2 },
{ "syn-rules", &syn_rules },
{ "xnfio", &xnfio },
{ 0, 0 }
@@ -594,6 +596,9 @@ int main(int argc, char*argv[])
/*
* $Log: main.cc,v $
+ * Revision 1.61 2002/06/30 02:21:31 steve
+ * Add structure for asynchronous logic synthesis.
+ *
* Revision 1.60 2002/06/24 01:49:39 steve
* Make link_drive_constant cache its results in
* the Nexus, to improve cprop performance.
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: net_event.cc,v 1.17 2002/02/02 06:13:38 steve Exp $"
+#ident "$Id: net_event.cc,v 1.18 2002/06/30 02:21:31 steve Exp $"
#endif
# include "config.h"
@@ -260,6 +260,29 @@ void NetEvent::replace_event(NetEvent*that)
}
}
+NexusSet* NetEvent::nex_async_()
+{
+ /* If there are behavioral trigger statements attached to me,
+ then this is not an asynchronous event. */
+ if (trig_ != 0)
+ return 0;
+
+
+ NexusSet*tmp = new NexusSet;
+ for (NetEvProbe*cur = probes_ ; cur != 0 ; cur = cur->enext_) {
+ if (cur->edge() != NetEvProbe::ANYEDGE) {
+ delete tmp;
+ return 0;
+ }
+
+ for (unsigned idx = 0 ; idx < cur->pin_count() ; idx += 1)
+ tmp->add(cur->pin(idx).nexus());
+
+ }
+
+ return tmp;
+}
+
NetEvTrig::NetEvTrig(NetEvent*ev)
: event_(ev)
{
@@ -456,6 +479,9 @@ NetProc* NetEvWait::statement()
/*
* $Log: net_event.cc,v $
+ * Revision 1.18 2002/06/30 02:21:31 steve
+ * Add structure for asynchronous logic synthesis.
+ *
* Revision 1.17 2002/02/02 06:13:38 steve
* event find_similar should not find self.
*
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: net_link.cc,v 1.7 2002/06/24 01:49:39 steve Exp $"
+#ident "$Id: net_link.cc,v 1.8 2002/06/30 02:21:31 steve Exp $"
#endif
# include "config.h"
@@ -414,13 +414,13 @@ void NexusSet::add(const NexusSet&that)
add(that.items_[idx]);
}
-Nexus* NexusSet::operator[] (unsigned idx)
+Nexus* NexusSet::operator[] (unsigned idx) const
{
assert(idx < nitems_);
return items_[idx];
}
-unsigned NexusSet::bsearch_(Nexus*that)
+unsigned NexusSet::bsearch_(Nexus*that) const
{
for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
if (items_[idx] < that)
@@ -432,9 +432,24 @@ unsigned NexusSet::bsearch_(Nexus*that)
return nitems_;
}
+bool NexusSet::contains(const NexusSet&that) const
+{
+ for (unsigned idx = 0 ; idx < that.nitems_ ; idx += 1) {
+ unsigned where = bsearch_(that[idx]);
+ if (where == nitems_)
+ return false;
+ if (items_[where] != that[idx])
+ return false;
+ }
+
+ return true;
+}
/*
* $Log: net_link.cc,v $
+ * Revision 1.8 2002/06/30 02:21:31 steve
+ * Add structure for asynchronous logic synthesis.
+ *
* Revision 1.7 2002/06/24 01:49:39 steve
* Make link_drive_constant cache its results in
* the Nexus, to improve cprop performance.
View
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2002 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: net_nex_output.cc,v 1.1 2002/06/30 02:21:32 steve Exp $"
+#endif
+
+#if !defined(WINNT)
+#ident "$Id: net_nex_output.cc,v 1.1 2002/06/30 02:21:32 steve Exp $"
+#endif
+
+# include "config.h"
+
+# include <iostream>
+
+# include <cassert>
+# include <typeinfo>
+# include "netlist.h"
+# include "netmisc.h"
+
+void NetProc::nex_output(NexusSet&out)
+{
+ cerr << get_line()
+ << ": internal error: NetProc::nex_output not implemented"
+ << endl;
+}
+
+void NetAssign::nex_output(NexusSet&out)
+{
+ cerr << get_line()
+ << ": internal error: NetProc::nex_output not implemented"
+ << endl;
+}
+
+void NetCondit::nex_output(NexusSet&out)
+{
+ cerr << get_line()
+ << ": internal error: NetProc::nex_output not implemented"
+ << endl;
+}
+
+
+/*
+ * $Log: net_nex_output.cc,v $
+ * Revision 1.1 2002/06/30 02:21:32 steve
+ * Add structure for asynchronous logic synthesis.
+ *
+ */
+
Oops, something went wrong.

0 comments on commit 9b6b081

Please sign in to comment.