Make bit masks of vector4_t 64bit aware.

This commit is contained in:
steve 2005-06-26 01:57:22 +00:00
parent 6c8e1f7834
commit de1dd2f2b3
3 changed files with 27 additions and 17 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.140 2005/06/19 18:42:00 steve Exp $"
#ident "$Id: vthread.cc,v 1.141 2005/06/26 01:57:22 steve Exp $"
#endif
# include "config.h"
@ -149,9 +149,9 @@ static void thr_check_addr(struct vthread_s*thr, unsigned addr)
static inline vvp_bit4_t thr_get_bit(struct vthread_s*thr, unsigned addr)
{
assert(addr < thr->nbits);
unsigned idx = addr % (CPU_WORD_BITS/2);
unsigned long idx = addr % (CPU_WORD_BITS/2);
addr /= (CPU_WORD_BITS/2);
return (vvp_bit4_t) ((thr->bits[addr] >> (idx*2)) & 3UL);
return (vvp_bit4_t) ((thr->bits[addr] >> (idx*2UL)) & 3UL);
}
static inline void thr_put_bit(struct vthread_s*thr,
@ -160,13 +160,13 @@ static inline void thr_put_bit(struct vthread_s*thr,
if (addr >= thr->nbits)
thr_check_addr(thr, addr);
unsigned idx = addr % (CPU_WORD_BITS/2);
unsigned long idx = addr % (CPU_WORD_BITS/2);
addr /= (CPU_WORD_BITS/2);
unsigned long mask = 3UL << (idx*2);
unsigned long mask = 3UL << (idx*2UL);
unsigned long tmp = val;
thr->bits[addr] = (thr->bits[addr] & ~mask) | (tmp << (idx*2));
thr->bits[addr] = (thr->bits[addr] & ~mask) | (tmp << (idx*2UL));
}
static inline void thr_clr_bit_(struct vthread_s*thr, unsigned addr)
@ -243,11 +243,12 @@ static vvp_vector4_t vthread_bits_to_vector(struct vthread_s*thr,
}
} else {
vvp_bit4_t bit_val = (vvp_bit4_t)bit;
for (unsigned idx = 0; idx < wid; idx +=1, bit += 1) {
for (unsigned idx = 0; idx < wid; idx +=1) {
value.set_bit(idx, bit_val);
}
}
return value;
}
@ -3239,6 +3240,9 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.141 2005/06/26 01:57:22 steve
* Make bit masks of vector4_t 64bit aware.
*
* Revision 1.140 2005/06/19 18:42:00 steve
* Optimize the LOAD_VEC implementation.
*

View File

@ -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.38 2005/06/24 02:16:42 steve Exp $"
#ident "$Id: vvp_net.cc,v 1.39 2005/06/26 01:57:22 steve Exp $"
# include "config.h"
# include "vvp_net.h"
@ -224,7 +224,7 @@ bool vvp_vector4_t::eeq(const vvp_vector4_t&that) const
void vvp_vector4_t::change_z2x()
{
assert(BIT4_Z == 3 && BIT4_X == 2);
# define Z2X(val) do { (val) = (val) & ~(((val)&WORD_X_BITS) >> 1); } while(0)
# define Z2X(val) do{ (val) = (val) & ~(((val)&WORD_X_BITS) >> 1UL); }while(0)
if (size_ <= BITS_PER_WORD) {
Z2X(bits_val_);
@ -1270,6 +1270,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
/*
* $Log: vvp_net.cc,v $
* Revision 1.39 2005/06/26 01:57:22 steve
* Make bit masks of vector4_t 64bit aware.
*
* Revision 1.38 2005/06/24 02:16:42 steve
* inline the vvp_send_vec4_pv function.
*

View File

@ -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.40 2005/06/24 02:16:42 steve Exp $"
#ident "$Id: vvp_net.h,v 1.41 2005/06/26 01:57:22 steve Exp $"
# include "config.h"
# include <stddef.h>
@ -158,7 +158,7 @@ inline vvp_bit4_t vvp_vector4_t::value(unsigned idx) const
return BIT4_X;
unsigned wdx = idx / BITS_PER_WORD;
unsigned off = idx % BITS_PER_WORD;
unsigned long off = idx % BITS_PER_WORD;
unsigned long bits;
if (size_ > BITS_PER_WORD) {
@ -167,7 +167,7 @@ inline vvp_bit4_t vvp_vector4_t::value(unsigned idx) const
bits = bits_val_;
}
bits >>= (off * 2);
bits >>= (off * 2UL);
/* Casting is evil, but this cast matches the un-cast done
when the vvp_bit4_t value is put into the vector. */
@ -178,16 +178,16 @@ inline void vvp_vector4_t::set_bit(unsigned idx, vvp_bit4_t val)
{
assert(idx < size_);
unsigned wdx = idx / BITS_PER_WORD;
unsigned off = idx % BITS_PER_WORD;
unsigned long mask = 3UL << (2*off);
unsigned long off = idx % BITS_PER_WORD;
unsigned long mask = 3UL << (2UL*off);
if (size_ > BITS_PER_WORD) {
unsigned wdx = idx / BITS_PER_WORD;
bits_ptr_[wdx] &= ~mask;
bits_ptr_[wdx] |= val << (2*off);
bits_ptr_[wdx] |= (unsigned long)val << (2UL*off);
} else {
bits_val_ &= ~mask;
bits_val_ |= val << (2*off);
bits_val_ |= (unsigned long)val << (2UL*off);
}
}
@ -910,6 +910,9 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
/*
* $Log: vvp_net.h,v $
* Revision 1.41 2005/06/26 01:57:22 steve
* Make bit masks of vector4_t 64bit aware.
*
* Revision 1.40 2005/06/24 02:16:42 steve
* inline the vvp_send_vec4_pv function.
*