Permalink
Browse files

Add support for conbinational events by finding

 the inputs to expressions and some statements.
 Get case and assignment statements working.
  • Loading branch information...
steve
steve committed Apr 21, 2002
1 parent eb708c1 commit b094bbdcf403d5369d8c94132ebe5e1bdc856f94
Showing with 496 additions and 56 deletions.
  1. +2 −2 Makefile.in
  2. +12 −1 Statement.cc
  3. +9 −1 Statement.h
  4. +38 −2 elaborate.cc
  5. +97 −1 net_link.cc
  6. +213 −0 net_nex_input.cc
  7. +41 −2 net_proc.cc
  8. +6 −35 netlist.cc
  9. +56 −1 netlist.h
  10. +7 −5 parse.y
  11. +15 −6 pform_dump.cc
View
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.118 2002/04/07 00:50:13 steve Exp $"
+#ident "$Id: Makefile.in,v 1.119 2002/04/21 04:59:07 steve Exp $"
#
#
SHELL = /bin/sh
@@ -130,7 +130,7 @@ elab_sig.o emit.o eval.o eval_rconst.o \
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
load_module.o mangle.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_link.o net_modulo.o net_nex_input.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
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: Statement.cc,v 1.25 2001/12/03 04:47:14 steve Exp $"
+#ident "$Id: Statement.cc,v 1.26 2002/04/21 04:59:07 steve Exp $"
#endif
# include "config.h"
@@ -188,6 +188,7 @@ PDisable::~PDisable()
PEventStatement::PEventStatement(const svector<PEEvent*>&ee)
: expr_(ee), statement_(0)
{
+ assert(expr_.count() > 0);
}
@@ -197,6 +198,11 @@ PEventStatement::PEventStatement(PEEvent*ee)
expr_[0] = ee;
}
+PEventStatement::PEventStatement(void)
+: statement_(0)
+{
+}
+
PEventStatement::~PEventStatement()
{
// delete the events and the statement?
@@ -287,6 +293,11 @@ PWhile::~PWhile()
/*
* $Log: Statement.cc,v $
+ * Revision 1.26 2002/04/21 04:59:07 steve
+ * Add support for conbinational events by finding
+ * the inputs to expressions and some statements.
+ * Get case and assignment statements working.
+ *
* Revision 1.25 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: Statement.h,v 1.31 2001/12/03 04:47:14 steve Exp $"
+#ident "$Id: Statement.h,v 1.32 2002/04/21 04:59:07 steve Exp $"
#endif
# include <string>
@@ -308,13 +308,16 @@ class PDisable : public Statement {
*
* @name <statement>;
* @(expr) <statement>;
+ * @* <statement>;
*/
class PEventStatement : public Statement {
public:
explicit PEventStatement(const svector<PEEvent*>&ee);
explicit PEventStatement(PEEvent*ee);
+ // Make an @* statement.
+ explicit PEventStatement(void);
~PEventStatement();
@@ -450,6 +453,11 @@ class PWhile : public Statement {
/*
* $Log: Statement.h,v $
+ * Revision 1.32 2002/04/21 04:59:07 steve
+ * Add support for conbinational events by finding
+ * the inputs to expressions and some statements.
+ * Get case and assignment statements working.
+ *
* Revision 1.31 2001/12/03 04:47:14 steve
* Parser and pform use hierarchical names as hname_t
* objects instead of encoded strings.
View
@@ -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.242 2002/04/13 02:33:17 steve Exp $"
+#ident "$Id: elaborate.cc,v 1.243 2002/04/21 04:59:07 steve Exp $"
#endif
# include "config.h"
@@ -1843,7 +1843,38 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
NetEvWait*wa = new NetEvWait(enet);
wa->set_line(*this);
- for (unsigned idx = 0 ; idx < expr_.count() ; idx += 1) {
+ /* If there are no expressions, this is a signal that it is an
+ @* statement. Generate an expression to use. */
+
+ if (expr_.count() == 0) {
+ assert(enet);
+ NexusSet*nset = enet->nex_input();
+ if (nset == 0) {
+ cerr << get_line() << ": internal error: No NexusSet"
+ << " from statement." << endl;
+ enet->dump(cerr, 6);
+ des->errors += 1;
+ return enet;
+ }
+
+ if (nset->count() == 0) {
+ cerr << get_line() << ": warning: No inputs to statement."
+ << " Ignoring @*." << endl;
+ return enet;
+ }
+
+ NetEvProbe*pr = new NetEvProbe(scope, scope->local_hsymbol(),
+ ev, NetEvProbe::ANYEDGE,
+ nset->count());
+ for (unsigned idx = 0 ; idx < nset->count() ; idx += 1)
+ connect(nset[0][idx], pr->pin(idx));
+
+ delete nset;
+ des->add_node(pr);
+
+ expr_count = 1;
+
+ } else for (unsigned idx = 0 ; idx < expr_.count() ; idx += 1) {
assert(expr_[idx]->expr());
@@ -2423,6 +2454,11 @@ Design* elaborate(list<const char*>roots)
/*
* $Log: elaborate.cc,v $
+ * Revision 1.243 2002/04/21 04:59:07 steve
+ * Add support for conbinational events by finding
+ * the inputs to expressions and some statements.
+ * Get case and assignment statements working.
+ *
* Revision 1.242 2002/04/13 02:33:17 steve
* Detect missing indices to memories (PR#421)
*
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.5 2001/07/25 03:10:49 steve Exp $"
+#ident "$Id: net_link.cc,v 1.6 2002/04/21 04:59:08 steve Exp $"
#endif
# include "config.h"
@@ -28,6 +28,28 @@
# include <strstream>
# include <string>
# include <typeinfo>
+#ifdef HAVE_MALLOC_H
+# include <malloc.h>
+#endif
+
+void connect(Nexus*l, Link&r)
+{
+ assert(l);
+ assert(r.nexus_);
+
+ if (l == r.nexus_)
+ return;
+
+
+ Nexus*tmp = r.nexus_;
+ while (Link*cur = tmp->first_nlink()) {
+ tmp->unlink(cur);
+ l->relink(cur);
+ }
+
+ assert(tmp->list_ == 0);
+ delete tmp;
+}
void connect(Link&l, Link&r)
{
@@ -352,8 +374,82 @@ const char* Nexus::name() const
return name_;
}
+
+NexusSet::NexusSet()
+{
+ items_ = 0;
+ nitems_ = 0;
+}
+
+NexusSet::~NexusSet()
+{
+ if (nitems_ > 0) {
+ assert(items_ != 0);
+ delete[] items_;
+ } else {
+ assert(items_ == 0);
+ }
+}
+
+unsigned NexusSet::count() const
+{
+ return nitems_;
+}
+
+void NexusSet::add(Nexus*that)
+{
+ if (nitems_ == 0) {
+ assert(items_ == 0);
+ items_ = (Nexus**)malloc(sizeof(Nexus*));
+ items_[0] = that;
+ nitems_ = 1;
+ return;
+ }
+
+ unsigned ptr = bsearch_(that);
+ if ((ptr < nitems_) && (items_[ptr] == that))
+ return;
+
+ items_ = (Nexus**)realloc(items_, (nitems_+1) * sizeof(Nexus*));
+ for (unsigned idx = nitems_ ; idx > ptr ; idx -= 1)
+ items_[idx] = items_[idx-1];
+
+ items_[ptr] = that;
+ nitems_ += 1;
+}
+
+void NexusSet::add(const NexusSet&that)
+{
+ for (unsigned idx = 0 ; idx < that.nitems_ ; idx += 1)
+ add(that.items_[idx]);
+}
+
+Nexus* NexusSet::operator[] (unsigned idx)
+{
+ assert(idx < nitems_);
+ return items_[idx];
+}
+
+unsigned NexusSet::bsearch_(Nexus*that)
+{
+ for (unsigned idx = 0 ; idx < nitems_ ; idx += 1) {
+ if (items_[idx] < that)
+ continue;
+
+ return idx;
+ }
+
+ return nitems_;
+}
+
+
/*
* $Log: net_link.cc,v $
+ * Revision 1.6 2002/04/21 04:59:08 steve
+ * Add support for conbinational events by finding
+ * the inputs to expressions and some statements.
+ * Get case and assignment statements working.
+ *
* Revision 1.5 2001/07/25 03:10:49 steve
* Create a config.h.in file to hold all the config
* junk, and support gcc 3.0. (Stephan Boettcher)
Oops, something went wrong.

0 comments on commit b094bbd

Please sign in to comment.