Update LMP_CLSHIFT to use nexus interface.

This commit is contained in:
steve 2000-03-16 21:47:27 +00:00
parent 7ab6ff77ad
commit 9deb7f6ba5
2 changed files with 61 additions and 28 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-vvm.cc,v 1.108 2000/03/16 19:03:03 steve Exp $" #ident "$Id: t-vvm.cc,v 1.109 2000/03/16 21:47:27 steve Exp $"
#endif #endif
# include <iostream> # include <iostream>
@ -1076,12 +1076,28 @@ void target_vvm::lpm_clshift(ostream&os, const NetCLShift*gate)
gate->width_dist() << "> " << mangle(gate->name()) << ";" gate->width_dist() << "> " << mangle(gate->name()) << ";"
<< endl; << endl;
for (unsigned idx = 0 ; idx < gate->width() ; idx += 1) { /* Connect the Data input pins... */
unsigned pin = gate->pin_Result(idx).get_pin(); for (unsigned idx = 0 ; idx < gate->width() ; idx += 1) {
string outfun = defn_gate_outputfun_(os, gate, pin); string nexus = mangle(nexus_from_link(&gate->pin_Data(idx)));
init_code << " " << mangle(gate->name()) << init_code << " " << nexus << "_nex.connect(&" <<
".config_rout(" << idx << ", &" << outfun << ");" << endl; mangle(gate->name()) << ", " << mangle(gate->name())
emit_gate_outputfun_(gate, pin); << ".key_Data(" << idx << "));" << endl;
}
/* Connect the Distance input pins... */
for (unsigned idx = 0 ; idx < gate->width_dist() ; idx += 1) {
string nexus = mangle(nexus_from_link(&gate->pin_Distance(idx)));
init_code << " " << nexus << "_nex.connect(&" <<
mangle(gate->name()) << ", " << mangle(gate->name())
<< ".key_Distance(" << idx << "));" << endl;
}
/* Connect the output drivers to the nexus nodes. */
for (unsigned idx = 0 ; idx < gate->width() ; idx += 1) {
string nexus = mangle(nexus_from_link(&gate->pin_Result(idx)));
init_code << " " << nexus << "_nex.connect(" <<
mangle(gate->name()) << ".config_rout(" << idx <<
"));" << endl;
} }
} }
@ -2262,6 +2278,9 @@ extern const struct target tgt_vvm = {
}; };
/* /*
* $Log: t-vvm.cc,v $ * $Log: t-vvm.cc,v $
* Revision 1.109 2000/03/16 21:47:27 steve
* Update LMP_CLSHIFT to use nexus interface.
*
* Revision 1.108 2000/03/16 19:03:03 steve * Revision 1.108 2000/03/16 19:03:03 steve
* Revise the VVM backend to use nexus objects so that * Revise the VVM backend to use nexus objects so that
* drivers and resolution functions can be used, and * drivers and resolution functions can be used, and

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vvm_gates.h,v 1.38 2000/03/16 19:03:04 steve Exp $" #ident "$Id: vvm_gates.h,v 1.39 2000/03/16 21:47:27 steve Exp $"
#endif #endif
# include "vvm.h" # include "vvm.h"
@ -182,7 +182,8 @@ class vvm_and : public vvm_1bit_out, public vvm_nexus::recvr_t {
vpip_bit_t input_[WIDTH]; vpip_bit_t input_[WIDTH];
}; };
template <unsigned WIDTH, unsigned WDIST> class vvm_clshift { template <unsigned WIDTH, unsigned WDIST>
class vvm_clshift : public vvm_nexus::recvr_t {
public: public:
explicit vvm_clshift() explicit vvm_clshift()
@ -190,8 +191,6 @@ template <unsigned WIDTH, unsigned WDIST> class vvm_clshift {
dist_val_ = WIDTH; dist_val_ = WIDTH;
for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) for (unsigned idx = 0 ; idx < WIDTH ; idx += 1)
data_[idx] = Vx; data_[idx] = Vx;
for (unsigned idx = 0 ; idx < WIDTH ; idx += 1)
out_[idx] = 0;
for (unsigned idx = 0 ; idx < WDIST ; idx += 1) for (unsigned idx = 0 ; idx < WDIST ; idx += 1)
dist_[idx] = Vx; dist_[idx] = Vx;
} }
@ -208,15 +207,36 @@ template <unsigned WIDTH, unsigned WDIST> class vvm_clshift {
void init_Direction(unsigned, vpip_bit_t val) void init_Direction(unsigned, vpip_bit_t val)
{ dir_ = val; } { dir_ = val; }
vvm_nexus::drive_t* config_rout(unsigned idx)
{ return out_+idx; }
unsigned key_Data(unsigned idx) const { return idx; }
unsigned key_Distance(unsigned idx) const { return 0x10000+idx; }
unsigned key_Direction(unsigned) const { return 0x20000; }
private:
void take_value(unsigned key, vpip_bit_t val)
{ unsigned code = key>>16;
unsigned idx = key & 0xffff;
switch (code) {
case 0:
set_Data(idx, val);
break;
case 1:
set_Distance(idx, val);
break;
default:
set_Direction(idx, val);
break;
}
}
void set_Data(unsigned idx, vpip_bit_t val) void set_Data(unsigned idx, vpip_bit_t val)
{ if (data_[idx] == val) return; { if (data_[idx] == val) return;
data_[idx] = val; data_[idx] = val;
if ((dist_val_ + idx) >= WIDTH) return; if ((dist_val_ + idx) >= WIDTH) return;
if ((dist_val_ + idx) < 0) return; if ((dist_val_ + idx) < 0) return;
vvm_out_event::action_t out = out_[dist_val_+idx]; out_[dist_val_+idx].set_value(val);
if (out == 0) return;
vvm_event*ev = new vvm_out_event(val, out);
ev->schedule();
} }
void set_Distance(unsigned idx, vpip_bit_t val) void set_Distance(unsigned idx, vpip_bit_t val)
@ -233,15 +253,11 @@ template <unsigned WIDTH, unsigned WDIST> class vvm_clshift {
compute_(); compute_();
} }
void config_rout(unsigned idx, vvm_out_event::action_t o)
{ out_[idx] = o;
}
private: private:
vpip_bit_t dir_; vpip_bit_t dir_;
vpip_bit_t data_[WIDTH]; vpip_bit_t data_[WIDTH];
vpip_bit_t dist_[WDIST]; vpip_bit_t dist_[WDIST];
vvm_out_event::action_t out_[WIDTH]; vvm_nexus::drive_t out_[WIDTH];
int dist_val_; int dist_val_;
void calculate_dist_() void calculate_dist_()
@ -266,21 +282,16 @@ template <unsigned WIDTH, unsigned WDIST> class vvm_clshift {
void compute_() void compute_()
{ vvm_event*ev; { vvm_event*ev;
if (dist_val_ == WIDTH) { if (dist_val_ == WIDTH) {
for (unsigned idx = 0 ; idx < WIDTH ; idx += 1) { for (unsigned idx = 0 ; idx < WIDTH ; idx += 1)
if (out_[idx] == 0) continue; out_[idx].set_value(Vx);
ev = new vvm_out_event(Vx, out_[idx]);
ev->schedule();
}
return; return;
} }
for (int idx = 0 ; idx < WIDTH ; idx += 1) { for (int idx = 0 ; idx < WIDTH ; idx += 1) {
if (out_[idx] == 0) continue;
vpip_bit_t val; vpip_bit_t val;
if ((idx-dist_val_) >= WIDTH) val = V0; if ((idx-dist_val_) >= WIDTH) val = V0;
else if ((idx-dist_val_) < 0) val = V0; else if ((idx-dist_val_) < 0) val = V0;
else val = data_[idx-dist_val_]; else val = data_[idx-dist_val_];
ev = new vvm_out_event(val, out_[idx]); out_[idx].set_value(val);
ev->schedule();
} }
} }
}; };
@ -981,6 +992,9 @@ template <unsigned WIDTH> class vvm_pevent : public vvm_nexus::recvr_t {
/* /*
* $Log: vvm_gates.h,v $ * $Log: vvm_gates.h,v $
* Revision 1.39 2000/03/16 21:47:27 steve
* Update LMP_CLSHIFT to use nexus interface.
*
* Revision 1.38 2000/03/16 19:03:04 steve * Revision 1.38 2000/03/16 19:03:04 steve
* Revise the VVM backend to use nexus objects so that * Revise the VVM backend to use nexus objects so that
* drivers and resolution functions can be used, and * drivers and resolution functions can be used, and