From a8114ae1225a27c0caa13ea9a08cd30822f2431a Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 23 Apr 2000 03:45:24 +0000 Subject: [PATCH] Add support for the procedural release statement. --- design_dump.cc | 281 ++--------------------------------------------- elaborate.cc | 18 ++- emit.cc | 10 +- netlist.cc | 19 +++- netlist.h | 27 ++++- t-vvm.cc | 20 +++- target.cc | 13 ++- target.h | 6 +- vvm/vvm_force.cc | 15 ++- vvm/vvm_gates.h | 7 +- vvm/vvm_nexus.cc | 36 +++++- vvm/vvm_nexus.h | 11 +- 12 files changed, 175 insertions(+), 288 deletions(-) diff --git a/design_dump.cc b/design_dump.cc index b80925b15..375a50f20 100644 --- a/design_dump.cc +++ b/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.77 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: design_dump.cc,v 1.78 2000/04/23 03:45:24 steve Exp $" #endif /* @@ -584,6 +584,12 @@ void NetPDelay::dump(ostream&o, unsigned ind) const } } +void NetRelease::dump(ostream&o, unsigned ind) const +{ + o << setw(ind) << "" << "release " << lval_->name() << "; " + << "/* " << get_line() << " */" << endl; +} + void NetRepeat::dump(ostream&o, unsigned ind) const { o << setw(ind) << "" << "repeat (" << *expr_ << ")" << endl; @@ -902,6 +908,9 @@ void Design::dump(ostream&o) const /* * $Log: design_dump.cc,v $ + * Revision 1.78 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.77 2000/04/22 04:20:19 steve * Add support for force assignment. * @@ -948,275 +957,5 @@ void Design::dump(ostream&o) const * in a separate pass over the pform. Once the scopes * are generated, I can process overrides and evalutate * paremeters before elaboration begins. - * - * Revision 1.67 2000/02/23 02:56:54 steve - * Macintosh compilers do not support ident. - * - * Revision 1.66 2000/01/13 03:35:35 steve - * Multiplication all the way to simulation. - * - * Revision 1.65 2000/01/10 01:35:23 steve - * Elaborate parameters afer binding of overrides. - * - * Revision 1.64 1999/12/17 03:38:46 steve - * NetConst can now hold wide constants. - * - * Revision 1.63 1999/12/12 06:03:14 steve - * Allow memories without indices in expressions. - * - * Revision 1.62 1999/12/05 02:24:08 steve - * Synthesize LPM_RAM_DQ for writes into memories. - * - * Revision 1.61 1999/11/28 23:42:02 steve - * NetESignal object no longer need to be NetNode - * objects. Let them keep a pointer to NetNet objects. - * - * 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. - * - * Revision 1.58 1999/11/21 00:13:08 steve - * Support memories in continuous assignments. - * - * Revision 1.57 1999/11/14 23:43:45 steve - * Support combinatorial comparators. - * - * Revision 1.56 1999/11/14 20:24:28 steve - * Add support for the LPM_CLSHIFT device. - * - * Revision 1.55 1999/11/04 03:53:26 steve - * Patch to synthesize unary ~ and the ternary operator. - * Thanks to Larry Doolittle . - * - * Add the LPM_MUX device, and integrate it with the - * ternary synthesis from Larry. Replace the lpm_mux - * generator in t-xnf.cc to use XNF EQU devices to - * put muxs into function units. - * - * Rewrite elaborate_net for the PETernary class to - * also use the LPM_MUX device. - * - * Revision 1.54 1999/11/04 01:12:41 steve - * Elaborate combinational UDP devices. - * - * Revision 1.53 1999/11/01 02:07:40 steve - * Add the synth functor to do generic synthesis - * and add the LPM_FF device to handle rows of - * flip-flops. - * - * Revision 1.52 1999/10/31 20:08:24 steve - * Include subtraction in LPM_ADD_SUB device. - * - * Revision 1.51 1999/10/31 04:11:27 steve - * Add to netlist links pin name and instance number, - * and arrange in vvm for pin connections by name - * and instance number. - * - * Revision 1.50 1999/10/10 01:59:54 steve - * Structural case equals device. - * - * Revision 1.49 1999/10/08 02:00:35 steve - * Fix dump of sase statements. - * - * Revision 1.48 1999/10/07 05:25:33 steve - * Add non-const bit select in l-value of assignment. - * - * Revision 1.47 1999/10/06 05:06:16 steve - * Move the rvalue into NetAssign_ common code. - * - * Revision 1.46 1999/10/05 06:19:46 steve - * Add support for reduction NOR. - * - * Revision 1.45 1999/09/30 02:43:01 steve - * Elaborate ~^ and ~| operators. - * - * Revision 1.44 1999/09/29 18:36:03 steve - * Full case support - * - * Revision 1.43 1999/09/21 00:13:40 steve - * Support parameters that reference other paramters. - * - * Revision 1.42 1999/09/20 02:21:10 steve - * Elaborate parameters in phases. - * - * Revision 1.41 1999/09/19 01:06:36 steve - * dump the repeat count, if applicable. - * - * Revision 1.40 1999/09/15 01:55:06 steve - * Elaborate non-blocking assignment to memories. - * - * Revision 1.39 1999/09/04 19:11:46 steve - * Add support for delayed non-blocking assignments. - * - * Revision 1.38 1999/09/03 04:28:38 steve - * elaborate the binary plus operator. - * - * Revision 1.37 1999/09/01 20:46:19 steve - * Handle recursive functions and arbitrary function - * references to other functions, properly pass - * function parameters and save function results. - * - * Revision 1.36 1999/08/31 22:38:29 steve - * Elaborate and emit to vvm procedural functions. - * - * Revision 1.35 1999/08/25 22:22:41 steve - * elaborate some aspects of functions. - * - * Revision 1.34 1999/08/01 16:34:50 steve - * Parse and elaborate rise/fall/decay times - * for gates, and handle the rules for partial - * lists of times. - * - * Revision 1.33 1999/07/24 02:11:20 steve - * Elaborate task input ports. - * - * Revision 1.32 1999/07/17 19:50:59 steve - * netlist support for ternary operator. - * - * Revision 1.31 1999/07/03 02:12:51 steve - * Elaborate user defined tasks. - * - * Revision 1.30 1999/06/19 21:06:16 steve - * Elaborate and supprort to vvm the forever - * and repeat statements. - * - * Revision 1.29 1999/06/15 05:38:15 steve - * Handle total lack of signals or nodes. - * - * Revision 1.28 1999/06/09 03:00:05 steve - * Add support for procedural concatenation expression. - * - * Revision 1.27 1999/06/06 20:45:38 steve - * Add parse and elaboration of non-blocking assignments, - * Replace list with an svector version, - * Add integer support. - * - * Revision 1.26 1999/05/31 15:46:20 steve - * Compilation warning. - * - * Revision 1.25 1999/05/30 01:11:46 steve - * Exressions are trees that can duplicate, and not DAGS. - * - * Revision 1.24 1999/05/17 04:53:47 steve - * translate the letter synonyms for operators. - * - * Revision 1.23 1999/05/10 00:16:58 steve - * Parse and elaborate the concatenate operator - * in structural contexts, Replace vector - * and list with svector, evaluate - * constant expressions with parameters, handle - * memories as lvalues. - * - * Parse task declarations, integer types. - * - * Revision 1.22 1999/05/06 02:29:32 steve - * Excesss endl. - * - * Revision 1.21 1999/05/05 03:04:46 steve - * Fix handling of null delay statements. - * - * Revision 1.20 1999/05/01 20:43:55 steve - * Handle wide events, such as @(a) where a has - * many bits in it. - * - * Add to vvm the binary ^ and unary & operators. - * - * Dump events a bit more completely. - * - * Revision 1.19 1999/05/01 02:57:52 steve - * Handle much more complex event expressions. - * - * Revision 1.18 1999/04/25 00:44:10 steve - * Core handles subsignal expressions. - * - * Revision 1.17 1999/04/19 01:59:36 steve - * Add memories to the parse and elaboration phases. - * - * Revision 1.16 1999/03/15 02:43:32 steve - * Support more operators, especially logical. - * - * Revision 1.15 1999/03/01 03:27:53 steve - * Prevent the duplicate allocation of ESignal objects. - * - * Revision 1.14 1999/02/21 17:01:57 steve - * Add support for module parameters. - * - * Revision 1.13 1999/02/15 02:06:15 steve - * Elaborate gate ranges. - * - * Revision 1.12 1999/02/08 02:49:56 steve - * Turn the NetESignal into a NetNode so - * that it can connect to the netlist. - * Implement the case statement. - * Convince t-vvm to output code for - * the case statement. - * - * Revision 1.11 1999/02/03 04:20:11 steve - * Parse and elaborate the Verilog CASE statement. - * - * Revision 1.10 1999/02/01 00:26:48 steve - * Carry some line info to the netlist, - * Dump line numbers for processes. - * Elaborate prints errors about port vector - * width mismatch - * Emit better handles null statements. - * - * Revision 1.9 1998/12/20 02:05:41 steve - * Function to calculate wire initial value. - * - * Revision 1.8 1998/12/14 02:01:34 steve - * Fully elaborate Sequential UDP behavior. - * - * Revision 1.7 1998/12/07 04:53:17 steve - * Generate OBUF or IBUF attributes (and the gates - * to garry them) where a wire is a pad. This involved - * figuring out enough of the netlist to know when such - * was needed, and to generate new gates and signales - * to handle what's missing. - * - * Revision 1.6 1998/12/02 04:37:13 steve - * Add the nobufz function to eliminate bufz objects, - * Object links are marked with direction, - * constant propagation is more careful will wide links, - * Signal folding is aware of attributes, and - * the XNF target can dump UDP objects based on LCA - * attributes. - * - * Revision 1.5 1998/12/01 00:42:13 steve - * Elaborate UDP devices, - * Support UDP type attributes, and - * pass those attributes to nodes that - * are instantiated by elaboration, - * Put modules into a map instead of - * a simple list. - * - * Revision 1.4 1998/11/23 00:20:22 steve - * NetAssign handles lvalues as pin links - * instead of a signal pointer, - * Wire attributes added, - * Ability to parse UDP descriptions added, - * XNF generates EXT records for signals with - * the PAD attribute. - * - * Revision 1.3 1998/11/09 18:55:34 steve - * Add procedural while loops, - * Parse procedural for loops, - * Add procedural wait statements, - * Add constant nodes, - * Add XNOR logic gate, - * Make vvm output look a bit prettier. - * - * Revision 1.2 1998/11/07 17:05:05 steve - * Handle procedural conditional, and some - * of the conditional expressions. - * - * Elaborate signals and identifiers differently, - * allowing the netlist to hold signal information. - * - * Revision 1.1 1998/11/03 23:28:56 steve - * Introduce verilog to CVS. - * */ diff --git a/elaborate.cc b/elaborate.cc index c7274d424..9c18b9966 100644 --- a/elaborate.cc +++ b/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.161 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: elaborate.cc,v 1.162 2000/04/23 03:45:24 steve Exp $" #endif /* @@ -1969,9 +1969,16 @@ void PFunction::elaborate_2(Design*des, NetScope*scope) const NetProc* PRelease::elaborate(Design*des, const string&path) const { - cerr << get_line() << ": sorry: I do not elaborate release yet." - << endl; - return 0; + NetScope*scope = des->find_scope(path); + assert(scope); + + NetNet*lval = lval_->elaborate_net(des, path, 0, 0, 0, 0); + if (lval == 0) + return 0; + + NetRelease*dev = new NetRelease(lval); + dev->set_line( *this ); + return dev; } NetProc* PRepeat::elaborate(Design*des, const string&path) const @@ -2261,6 +2268,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.162 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.161 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/emit.cc b/emit.cc index bc20b0d85..b419dd5f3 100644 --- a/emit.cc +++ b/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.40 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: emit.cc,v 1.41 2000/04/23 03:45:24 steve Exp $" #endif /* @@ -194,6 +194,11 @@ void NetPDelay::emit_proc_recurse(ostream&o, struct target_t*tgt) const if (statement_) statement_->emit_proc(o, tgt); } +bool NetRelease::emit_proc(ostream&o, struct target_t*tgt) const +{ + return tgt->proc_release(o, this); +} + bool NetRepeat::emit_proc(ostream&o, struct target_t*tgt) const { tgt->proc_repeat(o, this); @@ -426,6 +431,9 @@ bool emit(ostream&o, const Design*des, const char*type) /* * $Log: emit.cc,v $ + * Revision 1.41 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.40 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/netlist.cc b/netlist.cc index e96f39822..a02bfd979 100644 --- a/netlist.cc +++ b/netlist.cc @@ -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.117 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: netlist.cc,v 1.118 2000/04/23 03:45:24 steve Exp $" #endif # include @@ -2300,6 +2300,20 @@ NetLogic::NetLogic(const string&n, unsigned pins, TYPE t) } } +NetRelease::NetRelease(NetNet*l) +: lval_(l) +{ +} + +NetRelease::~NetRelease() +{ +} + +const NetNet*NetRelease::lval() const +{ + return lval_; +} + NetRepeat::NetRepeat(NetExpr*e, NetProc*p) : expr_(e), statement_(p) { @@ -2502,6 +2516,9 @@ bool NetUDP::sequ_glob_(string input, char output) /* * $Log: netlist.cc,v $ + * Revision 1.118 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.117 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/netlist.h b/netlist.h index 1ad7735c6..7bc8255e4 100644 --- a/netlist.h +++ b/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.127 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: netlist.h,v 1.128 2000/04/23 03:45:24 steve Exp $" #endif /* @@ -1514,6 +1514,28 @@ class NetRepeat : public NetProc { NetProc*statement_; }; +/* + * The procedural release statement (the opposite of force) releases + * any force expressions attached to the bits of the wire or reg. The + * lval is the expression of the "release ;" statement with the + * expr elaborated to a net. + */ +class NetRelease : public NetProc { + + public: + explicit NetRelease(NetNet*l); + ~NetRelease(); + + const NetNet*lval() const; + + virtual bool emit_proc(ostream&, struct target_t*) const; + virtual void dump(ostream&, unsigned ind) const; + + private: + NetNet*lval_; +}; + + /* * The NetSTask class is a call to a system task. These kinds of tasks * are generally handled very simply in the target. They certainly are @@ -2418,6 +2440,9 @@ extern ostream& operator << (ostream&, NetNet::Type); /* * $Log: netlist.h,v $ + * Revision 1.128 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.127 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/t-vvm.cc b/t-vvm.cc index 24fe460d1..9b5eb16c9 100644 --- a/t-vvm.cc +++ b/t-vvm.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-vvm.cc,v 1.138 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.139 2000/04/23 03:45:24 steve Exp $" #endif # include @@ -94,6 +94,7 @@ class target_vvm : public target_t { void proc_condit_fun(ostream&os, const NetCondit*); virtual bool proc_force(ostream&os, const NetForce*); virtual void proc_forever(ostream&os, const NetForever*); + virtual bool target_vvm::proc_release(ostream&os, const NetRelease*); virtual void proc_repeat(ostream&os, const NetRepeat*); virtual void proc_stask(ostream&os, const NetSTask*); virtual bool proc_trigger(ostream&os, const NetEvTrig*); @@ -2384,6 +2385,20 @@ void target_vvm::proc_forever(ostream&os, const NetForever*net) << out_step << "_(vvm_thread*thr) {" << endl; } +bool target_vvm::proc_release(ostream&os, const NetRelease*dev) +{ + const NetNet*lval = dev->lval(); + for (unsigned idx = 0 ; idx < lval->pin_count() ; idx += 1) { + string nexus = nexus_from_link(&lval->pin(idx)); + unsigned ncode = nexus_wire_map[nexus]; + + defn << " nexus_wire_table["<expr()); @@ -2661,6 +2676,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.139 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.138 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/target.cc b/target.cc index 7929566b9..d122d8b4a 100644 --- a/target.cc +++ b/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.36 2000/04/22 04:20:19 steve Exp $" +#ident "$Id: target.cc,v 1.37 2000/04/23 03:45:24 steve Exp $" #endif # include "target.h" @@ -238,6 +238,14 @@ void target_t::proc_forever(ostream&os, const NetForever*) "Unhandled proc_forever." << endl; } +bool target_t::proc_release(ostream&os, const NetRelease*dev) +{ + cerr << dev->get_line() << ": internal error: " + << "target (" << typeid(*this).name() << "): " + << "Unhandled proc_repeat." << endl; + return false; +} + void target_t::proc_repeat(ostream&os, const NetRepeat*) { cerr << "target (" << typeid(*this).name() << "): " @@ -353,6 +361,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex) /* * $Log: target.cc,v $ + * Revision 1.37 2000/04/23 03:45:24 steve + * Add support for the procedural release statement. + * * Revision 1.36 2000/04/22 04:20:19 steve * Add support for force assignment. * diff --git a/target.h b/target.h index ff593bf1e..9641a2abc 100644 --- a/target.h +++ b/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.35 2000/04/22 04:20:20 steve Exp $" +#ident "$Id: target.h,v 1.36 2000/04/23 03:45:25 steve Exp $" #endif # include "netlist.h" @@ -108,6 +108,7 @@ struct target_t { virtual void proc_condit(ostream&os, const NetCondit*); virtual bool proc_force(ostream&os, const NetForce*); virtual void proc_forever(ostream&os, const NetForever*); + virtual bool proc_release(ostream&os, const NetRelease*); virtual void proc_repeat(ostream&os, const NetRepeat*); virtual bool proc_trigger(ostream&os, const NetEvTrig*); virtual void proc_stask(ostream&os, const NetSTask*); @@ -154,6 +155,9 @@ extern const struct target *target_table[]; /* * $Log: target.h,v $ + * Revision 1.36 2000/04/23 03:45:25 steve + * Add support for the procedural release statement. + * * Revision 1.35 2000/04/22 04:20:20 steve * Add support for force assignment. * diff --git a/vvm/vvm_force.cc b/vvm/vvm_force.cc index 66cb8a47a..4abd9834d 100644 --- a/vvm/vvm_force.cc +++ b/vvm/vvm_force.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_force.cc,v 1.1 2000/04/22 04:20:20 steve Exp $" +#ident "$Id: vvm_force.cc,v 1.2 2000/04/23 03:45:25 steve Exp $" #endif # include "vvm_gates.h" @@ -59,12 +59,25 @@ void vvm_force::force(unsigned key, vvm_nexus*tgt) assert(key < width_); assert(target_[key] == 0); target_[key] = tgt; + target_[key]->force_set(this, key); target_[key]->force_assign(bits_[key]); } +/* + * This method is to be called from the vvm_nexus only when it has + * been told to release me. + */ +void vvm_force::release(unsigned key) +{ + assert(target_[key]); + target_[key] = 0; +} /* * $Log: vvm_force.cc,v $ + * Revision 1.2 2000/04/23 03:45:25 steve + * Add support for the procedural release statement. + * * Revision 1.1 2000/04/22 04:20:20 steve * Add support for force assignment. * diff --git a/vvm/vvm_gates.h b/vvm/vvm_gates.h index 78129f3a8..47a87b377 100644 --- a/vvm/vvm_gates.h +++ b/vvm/vvm_gates.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_gates.h,v 1.58 2000/04/22 04:20:20 steve Exp $" +#ident "$Id: vvm_gates.h,v 1.59 2000/04/23 03:45:25 steve Exp $" #endif # include "vvm.h" @@ -294,7 +294,7 @@ class vvm_force : public vvm_nexus::recvr_t { void init_I(unsigned key, vpip_bit_t val); void force(unsigned key, vvm_nexus*tgt); - void release(); + void release(unsigned key); private: void take_value(unsigned key, vpip_bit_t val); @@ -916,6 +916,9 @@ class vvm_posedge : public vvm_nexus::recvr_t { /* * $Log: vvm_gates.h,v $ + * Revision 1.59 2000/04/23 03:45:25 steve + * Add support for the procedural release statement. + * * Revision 1.58 2000/04/22 04:20:20 steve * Add support for force assignment. * diff --git a/vvm/vvm_nexus.cc b/vvm/vvm_nexus.cc index 04546d178..2d3b17266 100644 --- a/vvm/vvm_nexus.cc +++ b/vvm/vvm_nexus.cc @@ -17,10 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_nexus.cc,v 1.6 2000/04/22 04:20:20 steve Exp $" +#ident "$Id: vvm_nexus.cc,v 1.7 2000/04/23 03:45:25 steve Exp $" #endif # include "vvm_nexus.h" +# include "vvm_gates.h" # include vvm_nexus::vvm_nexus() @@ -30,6 +31,9 @@ vvm_nexus::vvm_nexus() ival_ = 0; nival_ = 0; value_ = HiZ; + force_ = 0; + forcer_ = 0; + forcer_key_ = 0; } vvm_nexus::~vvm_nexus() @@ -128,20 +132,43 @@ void vvm_nexus::reg_assign(vpip_bit_t val) { assert(drivers_ == 0); value_ = val; - if (force_ != 0) + if (forcer_) return; for (recvr_cell*cur = recvrs_; cur ; cur = cur->next) cur->dev->take_value(cur->key, value_); } +void vvm_nexus::force_set(vvm_force*f, unsigned k) +{ + if (forcer_) + forcer_->release(forcer_key_); + + forcer_ = f; + forcer_key_ = k; +} + void vvm_nexus::force_assign(vpip_bit_t val) { + assert(forcer_); force_ = val; for (recvr_cell*cur = recvrs_; cur ; cur = cur->next) cur->dev->take_value(cur->key, force_); } +void vvm_nexus::release() +{ + if (forcer_) { + forcer_->release(forcer_key_); + forcer_ = 0; + } + + /* Now deliver that output value to all the receivers + connected to this nexus. */ + for (recvr_cell*cur = recvrs_; cur ; cur = cur->next) + cur->dev->take_value(cur->key, value_); +} + /* * This method is invoked when something interesting happens at one of * the drivers. It collects all the driver values, resolves them into @@ -169,7 +196,7 @@ void vvm_nexus::run_values() if (value_ == val) return; value_ = val; - if (force_ != 0) + if (forcer_) return; /* Now deliver that output value to all the receivers @@ -238,6 +265,9 @@ void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val, /* * $Log: vvm_nexus.cc,v $ + * Revision 1.7 2000/04/23 03:45:25 steve + * Add support for the procedural release statement. + * * Revision 1.6 2000/04/22 04:20:20 steve * Add support for force assignment. * diff --git a/vvm/vvm_nexus.h b/vvm/vvm_nexus.h index bc59f8d9a..ad53d644e 100644 --- a/vvm/vvm_nexus.h +++ b/vvm/vvm_nexus.h @@ -19,11 +19,14 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvm_nexus.h,v 1.2 2000/04/22 04:20:20 steve Exp $" +#ident "$Id: vvm_nexus.h,v 1.3 2000/04/23 03:45:25 steve Exp $" #endif # include "vvm.h" + +class vvm_force; + /* * The nexus class represents a connection point for drivers and * receivers of signals. The signal carries a single bit, has drivers, @@ -102,6 +105,7 @@ class vvm_nexus { // This method causes the specified value to be forced onto // the nexus. This overrides all drivers that are attached. + void force_set(class vvm_force*frc, unsigned key); void force_assign(vpip_bit_t val); void release(); @@ -125,6 +129,8 @@ class vvm_nexus { unsigned nival_; vpip_bit_t force_; + vvm_force *forcer_; + unsigned forcer_key_; private: // not implemented vvm_nexus(const vvm_nexus&); @@ -142,6 +148,9 @@ extern void vvm_delayed_assign(vvm_nexus&l_val, vpip_bit_t r_val, /* * $Log: vvm_nexus.h,v $ + * Revision 1.3 2000/04/23 03:45:25 steve + * Add support for the procedural release statement. + * * Revision 1.2 2000/04/22 04:20:20 steve * Add support for force assignment. *