Update LPM_MUX to nexus style.

This commit is contained in:
steve 2000-03-16 23:13:49 +00:00
parent 9deb7f6ba5
commit 5ea3610d4a
2 changed files with 53 additions and 16 deletions

View File

@ -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 <iostream>
@ -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.
*

View File

@ -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 <unsigned WIDTH, unsigned SIZE, unsigned SELWID> class vvm_mux {
template <unsigned WIDTH, unsigned SIZE, unsigned SELWID>
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 <unsigned WIDTH, unsigned SIZE, unsigned SELWID> 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 <unsigned WIDTH, unsigned SIZE, unsigned SELWID> 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 <unsigned WIDTH, unsigned SIZE, unsigned SELWID> 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 <unsigned WIDTH> 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.
*