Update vvm_mult to nexus style.
This commit is contained in:
parent
8cbf4f815e
commit
20712d3fcc
32
t-vvm.cc
32
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.111 2000/03/17 02:22:03 steve Exp $"
|
||||
#ident "$Id: t-vvm.cc,v 1.112 2000/03/17 03:05:13 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -1161,13 +1161,28 @@ void target_vvm::lpm_mult(ostream&os, const NetMult*mul)
|
|||
"," << mul->width_a() << "," << mul->width_b() << "," <<
|
||||
mul->width_s() << ");" << endl;
|
||||
|
||||
// Write the output functions for the multiplier device.
|
||||
|
||||
/* Connect the DataA inputs... */
|
||||
for (unsigned idx = 0 ; idx < mul->width_a() ; idx += 1) {
|
||||
string nexus = nexus_from_link(&mul->pin_DataA(idx));
|
||||
init_code << " " << mangle(nexus) << "_nex.connect(&"
|
||||
<< mname << ", " << mname << ".key_DataA("
|
||||
<< idx << "));" << endl;
|
||||
}
|
||||
|
||||
/* Connect the Datab inputs... */
|
||||
for (unsigned idx = 0 ; idx < mul->width_b() ; idx += 1) {
|
||||
string nexus = nexus_from_link(&mul->pin_DataB(idx));
|
||||
init_code << " " << mangle(nexus) << "_nex.connect(&"
|
||||
<< mname << ", " << mname << ".key_DataB("
|
||||
<< idx << "));" << endl;
|
||||
}
|
||||
|
||||
/* Connect the output pins... */
|
||||
for (unsigned idx = 0 ; idx < mul->width_r() ; idx += 1) {
|
||||
unsigned pin = mul->pin_Result(idx).get_pin();
|
||||
string outfun = defn_gate_outputfun_(os, mul, pin);
|
||||
init_code << " " << mangle(mul->name()) <<
|
||||
".config_rout(" << idx << ", &" << outfun << ");" << endl;
|
||||
emit_gate_outputfun_(mul, pin);
|
||||
string nexus = nexus_from_link(&mul->pin_Result(idx));
|
||||
init_code << " " << mangle(nexus) << "_nex.connect("
|
||||
<< mname << ".config_rout(" << idx << "));" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2181,6 +2196,9 @@ extern const struct target tgt_vvm = {
|
|||
};
|
||||
/*
|
||||
* $Log: t-vvm.cc,v $
|
||||
* Revision 1.112 2000/03/17 03:05:13 steve
|
||||
* Update vvm_mult to nexus style.
|
||||
*
|
||||
* Revision 1.111 2000/03/17 02:22:03 steve
|
||||
* vvm_clshift implementation without templates.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.41 2000/03/17 02:22:03 steve Exp $"
|
||||
#ident "$Id: vvm_gates.h,v 1.42 2000/03/17 03:05:13 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm.h"
|
||||
|
|
@ -359,7 +359,7 @@ template <unsigned WIDTH> class vvm_ff {
|
|||
* This class behaves like a combinational multiplier. The device
|
||||
* behaves like the LPM_MULT device.
|
||||
*/
|
||||
class vvm_mult {
|
||||
class vvm_mult : public vvm_nexus::recvr_t {
|
||||
|
||||
public:
|
||||
explicit vvm_mult(unsigned rwid, unsigned awid,
|
||||
|
|
@ -370,19 +370,20 @@ class vvm_mult {
|
|||
void init_DataB(unsigned idx, vpip_bit_t val);
|
||||
void init_Sum(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void set_DataA(unsigned idx, vpip_bit_t val);
|
||||
void set_DataB(unsigned idx, vpip_bit_t val);
|
||||
void set_Sum(unsigned idx, vpip_bit_t val);
|
||||
|
||||
void config_rout(unsigned idx, vvm_out_event::action_t o);
|
||||
vvm_nexus::drive_t* config_rout(unsigned idx);
|
||||
unsigned key_DataA(unsigned idx) const;
|
||||
unsigned key_DataB(unsigned idx) const;
|
||||
unsigned key_Sum(unsigned idx) const;
|
||||
|
||||
private:
|
||||
void take_value(unsigned key, vpip_bit_t val);
|
||||
|
||||
unsigned rwid_;
|
||||
unsigned awid_;
|
||||
unsigned bwid_;
|
||||
unsigned swid_;
|
||||
vpip_bit_t*bits_;
|
||||
vvm_out_event::action_t*out_;
|
||||
vvm_nexus::drive_t*out_;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -926,6 +927,9 @@ template <unsigned WIDTH> class vvm_pevent : public vvm_nexus::recvr_t {
|
|||
|
||||
/*
|
||||
* $Log: vvm_gates.h,v $
|
||||
* Revision 1.42 2000/03/17 03:05:13 steve
|
||||
* Update vvm_mult to nexus style.
|
||||
*
|
||||
* Revision 1.41 2000/03/17 02:22:03 steve
|
||||
* vvm_clshift implementation without templates.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: vvm_mult.cc,v 1.3 2000/03/04 01:13:54 steve Exp $"
|
||||
#ident "$Id: vvm_mult.cc,v 1.4 2000/03/17 03:05:13 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvm_gates.h"
|
||||
|
|
@ -80,13 +80,10 @@ vvm_mult::vvm_mult(unsigned rwid, unsigned awid,
|
|||
: rwid_(rwid), awid_(awid), bwid_(bwid), swid_(swid)
|
||||
{
|
||||
bits_ = new vpip_bit_t[rwid_+awid_+bwid_+swid_];
|
||||
out_ = new vvm_out_event::action_t[rwid_];
|
||||
out_ = new vvm_nexus::drive_t[rwid_];
|
||||
|
||||
for (unsigned idx = 0 ; idx < rwid_+awid_+bwid_+swid_ ; idx += 1)
|
||||
bits_[idx] = Vx;
|
||||
|
||||
for (unsigned idx = 0 ; idx < rwid_ ; idx += 1)
|
||||
out_[idx] = 0;
|
||||
}
|
||||
|
||||
vvm_mult::~vvm_mult()
|
||||
|
|
@ -95,11 +92,16 @@ vvm_mult::~vvm_mult()
|
|||
delete[]out_;
|
||||
}
|
||||
|
||||
void vvm_mult::config_rout(unsigned idx, vvm_out_event::action_t o)
|
||||
vvm_nexus::drive_t* vvm_mult::config_rout(unsigned idx)
|
||||
{
|
||||
assert(o);
|
||||
assert(idx < rwid_);
|
||||
out_[idx] = o;
|
||||
return out_+idx;
|
||||
}
|
||||
|
||||
unsigned vvm_mult::key_DataA(unsigned idx) const
|
||||
{
|
||||
assert(idx < awid_);
|
||||
return rwid_ + idx;
|
||||
}
|
||||
|
||||
void vvm_mult::init_DataA(unsigned idx, vpip_bit_t val)
|
||||
|
|
@ -108,15 +110,10 @@ void vvm_mult::init_DataA(unsigned idx, vpip_bit_t val)
|
|||
bits_[rwid_+idx] = val;
|
||||
}
|
||||
|
||||
void vvm_mult::set_DataA(unsigned idx, vpip_bit_t val)
|
||||
unsigned vvm_mult::key_DataB(unsigned idx) const
|
||||
{
|
||||
assert(idx < awid_);
|
||||
bits_[rwid_+idx] = val;
|
||||
vvm_binop_mult(bits_, rwid_,
|
||||
bits_+rwid_, awid_,
|
||||
bits_+rwid_+awid_, bwid_);
|
||||
for (unsigned idx = 0 ; idx < rwid_ ; idx += 1)
|
||||
if (out_[idx]) (out_[idx])(bits_[idx]);
|
||||
assert(idx < bwid_);
|
||||
return rwid_+awid_+idx;
|
||||
}
|
||||
|
||||
void vvm_mult::init_DataB(unsigned idx, vpip_bit_t val)
|
||||
|
|
@ -125,20 +122,21 @@ void vvm_mult::init_DataB(unsigned idx, vpip_bit_t val)
|
|||
bits_[rwid_+awid_+idx] = val;
|
||||
}
|
||||
|
||||
void vvm_mult::set_DataB(unsigned idx, vpip_bit_t val)
|
||||
void vvm_mult::take_value(unsigned key, vpip_bit_t val)
|
||||
{
|
||||
assert(idx < bwid_);
|
||||
bits_[rwid_+awid_+idx] = val;
|
||||
bits_[key] = val;
|
||||
vvm_binop_mult(bits_, rwid_,
|
||||
bits_+rwid_, awid_,
|
||||
bits_+rwid_+awid_, bwid_);
|
||||
for (unsigned idx = 0 ; idx < rwid_ ; idx += 1)
|
||||
if (out_[idx]) (out_[idx])(bits_[idx]);
|
||||
out_[idx].set_value(bits_[idx]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: vvm_mult.cc,v $
|
||||
* Revision 1.4 2000/03/17 03:05:13 steve
|
||||
* Update vvm_mult to nexus style.
|
||||
*
|
||||
* Revision 1.3 2000/03/04 01:13:54 steve
|
||||
* Simpler implementation of multiplication.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue