diff --git a/vvp/resolv.cc b/vvp/resolv.cc index b3ac1bd1c..a65ccb96d 100644 --- a/vvp/resolv.cc +++ b/vvp/resolv.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: resolv.cc,v 1.25 2005/06/22 00:04:49 steve Exp $" +#ident "$Id: resolv.cc,v 1.26 2005/06/22 18:30:12 steve Exp $" #endif # include "resolv.h" @@ -41,7 +41,7 @@ void resolv_functor::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit) recv_vec8(port, vvp_vector8_t(bit, 6 /* STRONG */)); } -void resolv_functor::recv_vec4_pv(vvp_net_ptr_t port, vvp_vector4_t bit, +void resolv_functor::recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, unsigned base, unsigned wid, unsigned vwid) { assert(bit.size() == wid); @@ -93,6 +93,9 @@ void resolv_functor::recv_vec8(vvp_net_ptr_t port, vvp_vector8_t bit) /* * $Log: resolv.cc,v $ + * Revision 1.26 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.25 2005/06/22 00:04:49 steve * Reduce vvp_vector4 copies by using const references. * diff --git a/vvp/resolv.h b/vvp/resolv.h index c98aa3e26..7fea803d4 100644 --- a/vvp/resolv.h +++ b/vvp/resolv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: resolv.h,v 1.14 2005/06/22 00:04:49 steve Exp $" +#ident "$Id: resolv.h,v 1.15 2005/06/22 18:30:12 steve Exp $" #endif # include "config.h" @@ -46,7 +46,7 @@ class resolv_functor : public vvp_net_fun_t { void recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit); void recv_vec8(vvp_net_ptr_t port, vvp_vector8_t bit); - void recv_vec4_pv(vvp_net_ptr_t port, vvp_vector4_t bit, + void recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, unsigned base, unsigned wid, unsigned vwid); private: @@ -56,6 +56,9 @@ class resolv_functor : public vvp_net_fun_t { /* * $Log: resolv.h,v $ + * Revision 1.15 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.14 2005/06/22 00:04:49 steve * Reduce vvp_vector4 copies by using const references. * diff --git a/vvp/schedule.cc b/vvp/schedule.cc index 77c077b82..1ef4254fa 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: schedule.cc,v 1.37 2005/06/12 01:10:26 steve Exp $" +#ident "$Id: schedule.cc,v 1.38 2005/06/22 18:30:12 steve Exp $" #endif # include "schedule.h" @@ -422,7 +422,7 @@ void schedule_vthread(vthread_t thr, vvp_time64_t delay, bool push_flag) void schedule_assign_vector(vvp_net_ptr_t ptr, unsigned base, unsigned vwid, - vvp_vector4_t bit, + const vvp_vector4_t&bit, vvp_time64_t delay) { struct assign_vector4_event_s*cur = new struct assign_vector4_event_s; @@ -434,7 +434,7 @@ void schedule_assign_vector(vvp_net_ptr_t ptr, } void schedule_assign_vector(vvp_net_ptr_t ptr, - vvp_vector4_t bit, + const vvp_vector4_t&bit, vvp_time64_t delay) { struct assign_vector4_event_s*cur = new struct assign_vector4_event_s; @@ -581,6 +581,9 @@ void schedule_simulate(void) /* * $Log: schedule.cc,v $ + * Revision 1.38 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.37 2005/06/12 01:10:26 steve * Remove useless references to functor.h * diff --git a/vvp/schedule.h b/vvp/schedule.h index 35bd96126..b4bbb57cf 100644 --- a/vvp/schedule.h +++ b/vvp/schedule.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: schedule.h,v 1.23 2005/06/09 05:04:45 steve Exp $" +#ident "$Id: schedule.h,v 1.24 2005/06/22 18:30:12 steve Exp $" #endif # include "vthread.h" @@ -47,11 +47,11 @@ extern void schedule_vthread(vthread_t thr, vvp_time64_t delay, */ extern void schedule_assign_vector(vvp_net_ptr_t ptr, unsigned base, unsigned vwid, - vvp_vector4_t val, + const vvp_vector4_t&val, vvp_time64_t delay); extern void schedule_assign_vector(vvp_net_ptr_t ptr, - vvp_vector4_t val, + const vvp_vector4_t&val, vvp_time64_t delay); extern void schedule_assign_memory_word(vvp_memory_t mem, @@ -131,6 +131,9 @@ extern unsigned long count_event_pool; /* * $Log: schedule.h,v $ + * Revision 1.24 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.23 2005/06/09 05:04:45 steve * Support UDP initial values. * diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 742d935ab..42ef41581 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.cc,v 1.36 2005/06/22 00:04:49 steve Exp $" +#ident "$Id: vvp_net.cc,v 1.37 2005/06/22 18:30:12 steve Exp $" # include "config.h" # include "vvp_net.h" @@ -137,7 +137,7 @@ ostream& operator<<(ostream&out, vvp_bit4_t bit) return out; } -void vvp_send_vec4_pv(vvp_net_ptr_t ptr, vvp_vector4_t val, +void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val, unsigned base, unsigned wid, unsigned vwid) { while (struct vvp_net_t*cur = ptr.ptr()) { @@ -221,14 +221,10 @@ bool vvp_vector4_t::eeq(const vvp_vector4_t&that) const if (size_ != that.size_) return false; - unsigned words = (size_+BITS_PER_WORD-1) / BITS_PER_WORD; - if (words == 1) { - if (bits_val_ == that.bits_val_) - return true; - else - return false; - } + if (size_ <= BITS_PER_WORD) + return bits_val_ == that.bits_val_; + unsigned words = (size_+BITS_PER_WORD-1) / BITS_PER_WORD; for (unsigned idx = 0 ; idx < words ; idx += 1) { if (bits_ptr_[idx] != that.bits_ptr_[idx]) return false; @@ -519,12 +515,6 @@ vvp_vector8_t::vvp_vector8_t(const vvp_vector4_t&that, } -vvp_vector8_t::~vvp_vector8_t() -{ - if (size_ > 0) - delete[]bits_; -} - vvp_vector8_t& vvp_vector8_t::operator= (const vvp_vector8_t&that) { if (size_ != that.size_) { @@ -549,18 +539,6 @@ vvp_vector8_t& vvp_vector8_t::operator= (const vvp_vector8_t&that) return *this; } -vvp_scalar_t vvp_vector8_t::value(unsigned idx) const -{ - assert(idx < size_); - return bits_[idx]; -} - -void vvp_vector8_t::set_bit(unsigned idx, vvp_scalar_t val) -{ - assert(idx < size_); - bits_[idx] = val; -} - bool vvp_vector8_t::eeq(const vvp_vector8_t&that) const { if (size_ != that.size_) @@ -602,7 +580,7 @@ void vvp_net_fun_t::recv_vec4(vvp_net_ptr_t, const vvp_vector4_t&) assert(0); } -void vvp_net_fun_t::recv_vec4_pv(vvp_net_ptr_t, vvp_vector4_t, +void vvp_net_fun_t::recv_vec4_pv(vvp_net_ptr_t, const vvp_vector4_t&, unsigned, unsigned, unsigned) { fprintf(stderr, "internal error: %s: recv_vec4_pv not implemented\n", @@ -720,7 +698,7 @@ void vvp_fun_signal::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit) } } -void vvp_fun_signal::recv_vec4_pv(vvp_net_ptr_t ptr, vvp_vector4_t bit, +void vvp_fun_signal::recv_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&bit, unsigned base, unsigned wid, unsigned vwid) { assert(bit.size() == wid); @@ -1305,6 +1283,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a, /* * $Log: vvp_net.cc,v $ + * Revision 1.37 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.36 2005/06/22 00:04:49 steve * Reduce vvp_vector4 copies by using const references. * diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index f99f4d12c..175029f35 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#ident "$Id: vvp_net.h,v 1.38 2005/06/22 00:04:49 steve Exp $" +#ident "$Id: vvp_net.h,v 1.39 2005/06/22 18:30:12 steve Exp $" # include "config.h" # include @@ -366,6 +366,24 @@ extern vvp_vector4_t reduce4(const vvp_vector8_t&that); /* Print a vector8 value to a stream. */ extern ostream& operator<< (ostream&, const vvp_vector8_t&); +inline vvp_vector8_t::~vvp_vector8_t() +{ + if (size_ > 0) + delete[]bits_; +} + +inline vvp_scalar_t vvp_vector8_t::value(unsigned idx) const +{ + assert(idx < size_); + return bits_[idx]; +} + +inline void vvp_vector8_t::set_bit(unsigned idx, vvp_scalar_t val) +{ + assert(idx < size_); + bits_[idx] = val; +} + /* * This class implements a pointer that points to an item within a * target. The ptr() method returns a pointer to the vvp_net_t, and @@ -509,7 +527,7 @@ class vvp_net_fun_t { virtual void recv_long(vvp_net_ptr_t port, long bit); // Part select variants of above - virtual void recv_vec4_pv(vvp_net_ptr_t p, vvp_vector4_t bit, + virtual void recv_vec4_pv(vvp_net_ptr_t p, const vvp_vector4_t&bit, unsigned base, unsigned wid, unsigned vwid); private: // not implemented @@ -731,7 +749,7 @@ class vvp_fun_signal : public vvp_net_fun_t { void recv_long(vvp_net_ptr_t port, long bit); // Part select variants of above - void recv_vec4_pv(vvp_net_ptr_t port, vvp_vector4_t bit, + void recv_vec4_pv(vvp_net_ptr_t port, const vvp_vector4_t&bit, unsigned base, unsigned wid, unsigned vwid); // Get information about the vector value. @@ -875,11 +893,14 @@ extern void vvp_send_long(vvp_net_ptr_t ptr, long val); * know how wide to pad with Z, if it needs to transform the part to a * mirror of the destination vector. */ -extern void vvp_send_vec4_pv(vvp_net_ptr_t ptr, vvp_vector4_t val, +extern void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val, unsigned base, unsigned wid, unsigned vwid); /* * $Log: vvp_net.h,v $ + * Revision 1.39 2005/06/22 18:30:12 steve + * Inline more simple stuff, and more vector4_t by const reference for performance. + * * Revision 1.38 2005/06/22 00:04:49 steve * Reduce vvp_vector4 copies by using const references. *