diff --git a/t-vvm.cc b/t-vvm.cc index 605dd6f6b..3f3dea0dc 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.109 2000/03/16 21:47:27 steve Exp $" +#ident "$Id: t-vvm.cc,v 1.110 2000/03/16 23:13:49 steve Exp $" #endif # include @@ -1177,12 +1177,31 @@ void target_vvm::lpm_mux(ostream&os, const NetMux*mux) os << "static vvm_mux<" << mux->width() << "," << mux->size() << "," << mux->sel_width() << "> " << mname << ";" << endl; + /* Connect the select inputs... */ + for (unsigned idx = 0 ; idx < mux->sel_width() ; idx += 1) { + string nexus = mangle(nexus_from_link(&mux->pin_Sel(idx))); + init_code << " " << nexus << "_nex.connect(&" + << mangle(mux->name()) << ", " << mangle(mux->name()) + << ".key_Sel(" << idx << "));" << endl; + } + + /* Connect the data inputs... */ + for (unsigned idx = 0 ; idx < mux->size() ; idx += 1) { + for (unsigned wid = 0 ; wid < mux->width() ; wid += 1) { + string nexus = mangle(nexus_from_link(&mux->pin_Data(wid, idx))); + init_code << " " << nexus << "_nex.connect(&" + << mangle(mux->name()) << ", " + << mangle(mux->name()) << ".key_Data(" + << wid << "," << idx << "));" << endl; + } + } + + /* Connect the outputs... */ for (unsigned idx = 0 ; idx < mux->width() ; idx += 1) { - unsigned pin = mux->pin_Result(idx).get_pin(); - string outfun = defn_gate_outputfun_(os, mux, pin); - init_code << " " << mangle(mux->name()) << - ".config_rout(" << idx << ", &" << outfun << ");" << endl; - emit_gate_outputfun_(mux, pin); + string nexus = mangle(nexus_from_link(&mux->pin_Result(idx))); + init_code << " " << nexus << "_nex.connect(" << + mangle(mux->name()) << ".config_rout(" << idx << + "));" << endl; } } @@ -2278,6 +2297,9 @@ extern const struct target tgt_vvm = { }; /* * $Log: t-vvm.cc,v $ + * Revision 1.110 2000/03/16 23:13:49 steve + * Update LPM_MUX to nexus style. + * * Revision 1.109 2000/03/16 21:47:27 steve * Update LMP_CLSHIFT to use nexus interface. * diff --git a/vvm/vvm_gates.h b/vvm/vvm_gates.h index a8f045325..b0b4648aa 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.39 2000/03/16 21:47:27 steve Exp $" +#ident "$Id: vvm_gates.h,v 1.40 2000/03/16 23:13:49 steve Exp $" #endif # include "vvm.h" @@ -468,12 +468,12 @@ class vvm_mult { * (or bus) path, SIZE is the number of alternative inputs and SELWID * is the size (in bits) of the selector input. */ -template class vvm_mux { +template +class vvm_mux : public vvm_nexus::recvr_t { public: explicit vvm_mux() { unsigned idx; - for (idx = 0 ; idx < WIDTH ; idx += 1) out_[idx] = 0; for (idx = 0 ; idx < WIDTH ; idx += 1) output_[idx] = Vx; for (idx = 0 ; idx < SELWID; idx += 1) sel_[idx] = Vx; for (idx = 0 ; idx < WIDTH*SIZE; idx += 1) input_[idx] = Vx; @@ -485,6 +485,23 @@ template class vvm_mux { void init_Data(unsigned idx, vpip_bit_t val) { input_[idx] = val; } + vvm_nexus::drive_t* config_rout(unsigned idx) + { return out_+idx; } + + unsigned key_Sel(unsigned idx) const { return idx; } + unsigned key_Data(unsigned wi, unsigned si) const + { return 0x10000 + si*WIDTH + wi; } + + private: + void take_value(unsigned key, vpip_bit_t val) + { unsigned code = key >> 16; + unsigned idx = key & 0xffff; + if (code == 1) + set_Data(idx, val); + else + set_Sel(idx, val); + } + void set_Sel(unsigned idx, vpip_bit_t val) { if (sel_[idx] == val) return; sel_[idx] = val; @@ -497,15 +514,12 @@ template class vvm_mux { evaluate_(); } - void config_rout(unsigned idx, vvm_out_event::action_t o) - { out_[idx] = o; } - private: vpip_bit_t sel_[SELWID]; vpip_bit_t input_[WIDTH * SIZE]; vpip_bit_t output_[WIDTH]; - vvm_out_event::action_t out_[WIDTH]; + vvm_nexus::drive_t out_[WIDTH]; void evaluate_() { vpip_bit_t tmp[WIDTH]; @@ -513,9 +527,7 @@ template class vvm_mux { for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) if (tmp[idx] != output_[idx]) { output_[idx] = tmp[idx]; - vvm_event*ev = new vvm_out_event(output_[idx], - out_[idx]); - ev->schedule(); + out_[idx].set_value(output_[idx]); } } }; @@ -992,6 +1004,9 @@ template class vvm_pevent : public vvm_nexus::recvr_t { /* * $Log: vvm_gates.h,v $ + * Revision 1.40 2000/03/16 23:13:49 steve + * Update LPM_MUX to nexus style. + * * Revision 1.39 2000/03/16 21:47:27 steve * Update LMP_CLSHIFT to use nexus interface. *