Permalink
Browse files

Add support for force assignment.

  • Loading branch information...
1 parent ad88112 commit 44838f89739bd6246720fde9caa5919d780d55a0 steve committed Apr 22, 2000
Showing with 413 additions and 46 deletions.
  1. +25 −1 Statement.cc
  2. +31 −1 Statement.h
  3. +16 −1 design_dump.cc
  4. +37 −1 elaborate.cc
  5. +14 −1 emit.cc
  6. +23 −1 netlist.cc
  7. +31 −1 netlist.h
  8. +9 −5 parse.y
  9. +16 −1 pform_dump.cc
  10. +40 −2 t-vvm.cc
  11. +18 −1 target.cc
  12. +6 −1 target.h
  13. +2 −2 vvm/Makefile.in
  14. +6 −1 vvm/vpi_priv.h
  15. +72 −0 vvm/vvm_force.cc
  16. +33 −1 vvm/vvm_gates.h
  17. +19 −11 vvm/vvm_nexus.cc
  18. +15 −14 vvm/vvm_nexus.h
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.19 2000/04/12 04:23:57 steve Exp $"
+#ident "$Id: Statement.cc,v 1.20 2000/04/22 04:20:19 steve Exp $"
#endif
# include "Statement.h"
@@ -167,6 +167,17 @@ void PEventStatement::set_statement(Statement*st)
statement_ = st;
}
+PForce::PForce(PExpr*l, PExpr*r)
+: lval_(l), expr_(r)
+{
+}
+
+PForce::~PForce()
+{
+ delete lval_;
+ delete expr_;
+}
+
PForever::PForever(Statement*s)
: statement_(s)
{
@@ -182,6 +193,16 @@ PProcess::~PProcess()
delete statement_;
}
+PRelease::PRelease(PExpr*l)
+: lval_(l)
+{
+}
+
+PRelease::~PRelease()
+{
+ delete lval_;
+}
+
PRepeat::PRepeat(PExpr*e, Statement*s)
: expr_(e), statement_(s)
{
@@ -210,6 +231,9 @@ PWhile::~PWhile()
/*
* $Log: Statement.cc,v $
+ * Revision 1.20 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.19 2000/04/12 04:23:57 steve
* Named events really should be expressed with PEIdent
* objects in the pform,
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.24 2000/04/12 04:23:57 steve Exp $"
+#ident "$Id: Statement.h,v 1.25 2000/04/22 04:20:19 steve Exp $"
#endif
# include <string>
@@ -288,6 +288,20 @@ class PEventStatement : public Statement {
Statement*statement_;
};
+class PForce : public Statement {
+
+ public:
+ explicit PForce(PExpr*l, PExpr*r);
+ ~PForce();
+
+ virtual NetProc* elaborate(Design*des, const string&path) const;
+ virtual void dump(ostream&out, unsigned ind) const;
+
+ private:
+ PExpr*lval_;
+ PExpr*expr_;
+};
+
class PForever : public Statement {
public:
explicit PForever(Statement*s);
@@ -346,6 +360,19 @@ class PRepeat : public Statement {
Statement*statement_;
};
+class PRelease : public Statement {
+
+ public:
+ explicit PRelease(PExpr*l);
+ ~PRelease();
+
+ virtual NetProc* elaborate(Design*des, const string&path) const;
+ virtual void dump(ostream&out, unsigned ind) const;
+
+ private:
+ PExpr*lval_;
+};
+
/*
* The PTrigger statement sends a trigger to a named event. Take the
* name here.
@@ -381,6 +408,9 @@ class PWhile : public Statement {
/*
* $Log: Statement.h,v $
+ * Revision 1.25 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.24 2000/04/12 04:23:57 steve
* Named events really should be expressed with PEIdent
* objects in the pform,
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: design_dump.cc,v 1.76 2000/04/12 20:02:52 steve Exp $"
+#ident "$Id: design_dump.cc,v 1.77 2000/04/22 04:20:19 steve Exp $"
#endif
/*
@@ -154,6 +154,12 @@ void NetDivide::dump_node(ostream&o, unsigned ind) const
dump_obj_attr(o, ind+4);
}
+void NetForce::dump_node(ostream&o, unsigned ind) const
+{
+ o << setw(ind) << "" << "force " << lval_->name() << endl;
+ dump_node_pins(o, ind+4);
+}
+
void NetMult::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "LPM_MULT (NetMult): " << name() << endl;
@@ -546,6 +552,12 @@ void NetEvWait::dump(ostream&o, unsigned ind) const
o << setw(ind+2) << "" << "/* noop */ ;" << endl;
}
+void NetForce::dump(ostream&o, unsigned ind) const
+{
+ o << setw(ind) << "" << "force " << lval_->name() << " = "
+ << name() << ";" << endl;
+}
+
void NetForever::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "forever" << endl;
@@ -890,6 +902,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
+ * Revision 1.77 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.76 2000/04/12 20:02:52 steve
* Finally remove the NetNEvent and NetPEvent classes,
* Get synthesis working with the NetEvWait class,
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.160 2000/04/21 04:38:15 steve Exp $"
+#ident "$Id: elaborate.cc,v 1.161 2000/04/22 04:20:19 steve Exp $"
#endif
/*
@@ -1802,6 +1802,32 @@ NetProc* PForever::elaborate(Design*des, const string&path) const
return proc;
}
+NetProc* PForce::elaborate(Design*des, const string&path) const
+{
+ NetScope*scope = des->find_scope(path);
+ assert(scope);
+
+ NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0);
+ if (lval == 0)
+ return 0;
+
+ NetNet*rval = expr_->elaborate_net(des, path, lval->pin_count(),
+ 0, 0, 0);
+ if (rval == 0)
+ return 0;
+
+ if (rval->pin_count() < lval->pin_count())
+ rval = pad_to_width(des, path, rval, lval->pin_count());
+
+ NetForce* dev = new NetForce(des->local_symbol(path), lval);
+ des->add_node(dev);
+
+ for (unsigned idx = 0 ; idx < dev->pin_count() ; idx += 1)
+ connect(dev->pin(idx), rval->pin(idx));
+
+ return dev;
+}
+
/*
* elaborate the for loop as the equivalent while loop. This eases the
* task for the target code generator. The structure is:
@@ -1941,6 +1967,13 @@ void PFunction::elaborate_2(Design*des, NetScope*scope) const
def->set_proc(st);
}
+NetProc* PRelease::elaborate(Design*des, const string&path) const
+{
+ cerr << get_line() << ": sorry: I do not elaborate release yet."
+ << endl;
+ return 0;
+}
+
NetProc* PRepeat::elaborate(Design*des, const string&path) const
{
NetScope*scope = des->find_scope(path);
@@ -2228,6 +2261,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
+ * Revision 1.161 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.160 2000/04/21 04:38:15 steve
* Bit padding in assignment to memory.
*
View
15 emit.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: emit.cc,v 1.39 2000/04/12 04:23:58 steve Exp $"
+#ident "$Id: emit.cc,v 1.40 2000/04/22 04:20:19 steve Exp $"
#endif
/*
@@ -95,6 +95,11 @@ void NetFF::emit_node(ostream&o, struct target_t*tgt) const
tgt->lpm_ff(o, this);
}
+void NetForce::emit_node(ostream&o, struct target_t*tgt) const
+{
+ tgt->net_force(o, this);
+}
+
void NetMult::emit_node(ostream&o, struct target_t*tgt) const
{
tgt->lpm_mult(o, this);
@@ -167,6 +172,11 @@ bool NetCondit::emit_proc(ostream&o, struct target_t*tgt) const
return true;
}
+bool NetForce::emit_proc(ostream&o, struct target_t*tgt) const
+{
+ return tgt->proc_force(o, this);
+}
+
bool NetForever::emit_proc(ostream&o, struct target_t*tgt) const
{
tgt->proc_forever(o, this);
@@ -416,6 +426,9 @@ bool emit(ostream&o, const Design*des, const char*type)
/*
* $Log: emit.cc,v $
+ * Revision 1.40 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.39 2000/04/12 04:23:58 steve
* Named events really should be expressed with PEIdent
* objects in the pform,
View
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: netlist.cc,v 1.116 2000/04/18 01:02:54 steve Exp $"
+#ident "$Id: netlist.cc,v 1.117 2000/04/22 04:20:19 steve Exp $"
#endif
# include <cassert>
@@ -1735,6 +1735,25 @@ verinum::V NetConst::value(unsigned idx) const
return value_[idx];
}
+NetForce::NetForce(const string&n, NetNet*l)
+: NetNode(n, l->pin_count()), lval_(l)
+{
+ for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
+ pin(idx).set_dir(Link::INPUT);
+ pin(idx).set_name("I", idx);
+ }
+}
+
+NetForce::~NetForce()
+{
+}
+
+const NetObj::Link& NetForce::lval_pin(unsigned idx) const
+{
+ assert(idx < lval_->pin_count());
+ return lval_->pin(idx);
+}
+
NetFuncDef::NetFuncDef(NetScope*s, const svector<NetNet*>&po)
: scope_(s), statement_(0), ports_(po)
{
@@ -2483,6 +2502,9 @@ bool NetUDP::sequ_glob_(string input, char output)
/*
* $Log: netlist.cc,v $
+ * Revision 1.117 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.116 2000/04/18 01:02:54 steve
* Minor cleanup of NetTaskDef.
*
View
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: netlist.h,v 1.126 2000/04/20 00:28:03 steve Exp $"
+#ident "$Id: netlist.h,v 1.127 2000/04/22 04:20:19 steve Exp $"
#endif
/*
@@ -1402,6 +1402,33 @@ class NetEvProbe : public NetNode {
};
/*
+ * The force statement causes the r-val net to be forced onto the
+ * l-val net when it is executed. The code generator is expected to
+ * know what that means. All the expressions are structural and behave
+ * like nets.
+ *
+ * This class is a NetProc because it it turned on by procedural
+ * behavior. However, it is also a NetNode because it connects to
+ * nets, and when activated follows the net values.
+ */
+class NetForce : public NetProc, public NetNode {
+
+ public:
+ explicit NetForce(const string&n, NetNet*l);
+ ~NetForce();
+
+ const NetObj::Link& lval_pin(unsigned) const;
+
+ virtual void dump(ostream&, unsigned ind) const;
+ virtual bool emit_proc(ostream&, struct target_t*) const;
+ virtual void dump_node(ostream&, unsigned ind) const;
+ virtual void emit_node(ostream&, struct target_t*) const;
+
+ private:
+ NetNet*lval_;
+};
+
+/*
* A forever statement is executed over and over again forever. Or
* until its block is disabled.
*/
@@ -2391,6 +2418,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
+ * Revision 1.127 2000/04/22 04:20:19 steve
+ * Add support for force assignment.
+ *
* Revision 1.126 2000/04/20 00:28:03 steve
* Catch some simple identity compareoptimizations.
*
Oops, something went wrong.

0 comments on commit 44838f8

Please sign in to comment.