Skip to content
Browse files

Support elaboration of disable statements.

  • Loading branch information...
1 parent 739365a commit 4494a7a4f3adc79d2c47609684ad196db6059551 steve committed Jul 27, 2000
Showing with 119 additions and 11 deletions.
  1. +10 −1 design_dump.cc
  2. +33 −5 elaborate.cc
  3. +9 −1 emit.cc
  4. +18 −1 net_proc.cc
  5. +32 −1 netlist.h
  6. +12 −1 target.cc
  7. +5 −1 target.h
View
11 design_dump.cc
@@ -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.91 2000/07/22 22:09:03 steve Exp $"
+#ident "$Id: design_dump.cc,v 1.92 2000/07/27 05:13:44 steve Exp $"
#endif
/*
@@ -565,6 +565,12 @@ void NetDeassign::dump(ostream&o, unsigned ind) const
<< "/* " << get_line() << " */" << endl;
}
+void NetDisable::dump(ostream&o, unsigned ind) const
+{
+ o << setw(ind) << "" << "disable " << target_->name() << "; "
+ << "/* " << get_line() << " */" << endl;
+}
+
void NetEvProbe::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "";
@@ -981,6 +987,9 @@ void Design::dump(ostream&o) const
/*
* $Log: design_dump.cc,v $
+ * Revision 1.92 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.91 2000/07/22 22:09:03 steve
* Parse and elaborate timescale to scopes.
*
View
38 elaborate.cc
@@ -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.180 2000/07/26 05:08:07 steve Exp $"
+#ident "$Id: elaborate.cc,v 1.181 2000/07/27 05:13:44 steve Exp $"
#endif
/*
@@ -1635,10 +1635,35 @@ NetProc* PDelayStatement::elaborate(Design*des, const string&path) const
*/
NetProc* PDisable::elaborate(Design*des, const string&path) const
{
- cerr << get_line() << ": sorry: disable not supported " << endl;
- NetProc*cur = new NetProc;
- des->errors += 1;
- return cur;
+ NetScope*scope = des->find_scope(path);
+ assert(scope);
+
+ NetScope*target = des->find_scope(scope, scope_);
+ if (target == 0) {
+ cerr << get_line() << ": error: Cannot find scope "
+ << scope_ << " in " << scope->name() << endl;
+ des->errors += 1;
+ return 0;
+ }
+
+ switch (target->type()) {
+ case NetScope::FUNC:
+ cerr << get_line() << ": error: Cannot disable functions." << endl;
+ des->errors += 1;
+ return 0;
+
+ case NetScope::MODULE:
+ cerr << get_line() << ": error: Cannot disable modules." << endl;
+ des->errors += 1;
+ return 0;
+
+ default:
+ break;
+ }
+
+ NetDisable*obj = new NetDisable(target);
+ obj->set_line(*this);
+ return obj;
}
/*
@@ -2489,6 +2514,9 @@ Design* elaborate(const map<string,Module*>&modules,
/*
* $Log: elaborate.cc,v $
+ * Revision 1.181 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.180 2000/07/26 05:08:07 steve
* Parse disable statements to pform.
*
View
10 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.45 2000/05/11 23:37:27 steve Exp $"
+#ident "$Id: emit.cc,v 1.46 2000/07/27 05:13:44 steve Exp $"
#endif
/*
@@ -187,6 +187,11 @@ bool NetDeassign::emit_proc(ostream&o, struct target_t*tgt) const
return tgt->proc_deassign(o, this);
}
+bool NetDisable::emit_proc(ostream&o, struct target_t*tgt) const
+{
+ return tgt->proc_disable(o, this);
+}
+
bool NetForce::emit_proc(ostream&o, struct target_t*tgt) const
{
return tgt->proc_force(o, this);
@@ -449,6 +454,9 @@ bool emit(ostream&o, const Design*des, const char*type)
/*
* $Log: emit.cc,v $
+ * Revision 1.46 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.45 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*
View
19 net_proc.cc
@@ -17,12 +17,26 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: net_proc.cc,v 1.1 2000/07/07 04:53:54 steve Exp $"
+#ident "$Id: net_proc.cc,v 1.2 2000/07/27 05:13:44 steve Exp $"
#endif
# include "netlist.h"
# include <assert.h>
+NetDisable::NetDisable(NetScope*tgt)
+: target_(tgt)
+{
+}
+
+NetDisable::~NetDisable()
+{
+}
+
+const NetScope* NetDisable::target() const
+{
+ return target_;
+}
+
NetForever::NetForever(NetProc*p)
: statement_(p)
{
@@ -79,6 +93,9 @@ const NetExpr* NetRepeat::expr() const
/*
* $Log: net_proc.cc,v $
+ * Revision 1.2 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.1 2000/07/07 04:53:54 steve
* Add support for non-constant delays in delay statements,
* Support evaluating ! in constant expressions, and
View
33 netlist.h
@@ -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.148 2000/07/22 22:09:04 steve Exp $"
+#ident "$Id: netlist.h,v 1.149 2000/07/27 05:13:44 steve Exp $"
#endif
/*
@@ -1407,6 +1407,34 @@ class NetDeassign : public NetProc {
};
/*
+ * This node represents the behavioral disable statement. The Verilog
+ * source that produces it looks like:
+ *
+ * disable <scope>;
+ *
+ * Where the scope is a named block or a task. It cannot be a module
+ * instance scope because module instances cannot be disabled.
+ */
+class NetDisable : public NetProc {
+
+ public:
+ explicit NetDisable(NetScope*tgt);
+ ~NetDisable();
+
+ const NetScope*target() const;
+
+ virtual bool emit_proc(ostream&, struct target_t*) const;
+ virtual void dump(ostream&, unsigned ind) const;
+
+ private:
+ NetScope*target_;
+
+ private: // not implemented
+ NetDisable(const NetDisable&);
+ NetDisable& operator= (const NetDisable&);
+};
+
+/*
* A NetEvent is an object that represents an event object, that is
* objects declared like so in Verilog:
*
@@ -2691,6 +2719,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/*
* $Log: netlist.h,v $
+ * Revision 1.149 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.148 2000/07/22 22:09:04 steve
* Parse and elaborate timescale to scopes.
*
View
13 target.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: target.cc,v 1.39 2000/05/11 23:37:27 steve Exp $"
+#ident "$Id: target.cc,v 1.40 2000/07/27 05:13:44 steve Exp $"
#endif
# include "target.h"
@@ -247,6 +247,14 @@ void target_t::proc_delay(ostream&os, const NetPDelay*)
"Unhandled proc_delay." << endl;
}
+bool target_t::proc_disable(ostream&os, const NetDisable*obj)
+{
+ cerr << obj->get_line() << ": internal error: "
+ << "target (" << typeid(*this).name() << "): "
+ << "does not support disable statements." << endl;
+ return false;
+}
+
bool target_t::proc_force(ostream&os, const NetForce*dev)
{
cerr << "target (" << typeid(*this).name() << "): "
@@ -389,6 +397,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
/*
* $Log: target.cc,v $
+ * Revision 1.40 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.39 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*
View
6 target.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: target.h,v 1.38 2000/05/11 23:37:27 steve Exp $"
+#ident "$Id: target.h,v 1.39 2000/07/27 05:13:44 steve Exp $"
#endif
# include "netlist.h"
@@ -109,6 +109,7 @@ struct target_t {
virtual bool proc_cassign(ostream&os, const NetCAssign*);
virtual void proc_condit(ostream&os, const NetCondit*);
virtual bool proc_deassign(ostream&os, const NetDeassign*);
+ virtual bool proc_disable(ostream&os, const NetDisable*);
virtual bool proc_force(ostream&os, const NetForce*);
virtual void proc_forever(ostream&os, const NetForever*);
virtual bool proc_release(ostream&os, const NetRelease*);
@@ -159,6 +160,9 @@ extern const struct target *target_table[];
/*
* $Log: target.h,v $
+ * Revision 1.39 2000/07/27 05:13:44 steve
+ * Support elaboration of disable statements.
+ *
* Revision 1.38 2000/05/11 23:37:27 steve
* Add support for procedural continuous assignment.
*

0 comments on commit 4494a7a

Please sign in to comment.
Something went wrong with that request. Please try again.