From c150223a3a3219c0927a71ced22398ef1c6b0879 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 1 Sep 2008 13:55:42 -0700 Subject: [PATCH] Fix problem with vvp_vector2_t right shift that trips only when starting with perfectly aligned inputs. --- vvp/vvp_net.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index a3bd2ee19..179305dd3 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -1557,8 +1557,15 @@ vvp_vector2_t& vvp_vector2_t::operator >>= (unsigned shift) } // Cleanup the tail bits. + unsigned use_words = words; + // Mask_shift is the number of high bits of the top word + // that are to be masked off. We start with the number + // of bits that are not included even in the original, + // then we include the bits of the shift, that are to be + // masked to zero. unsigned long mask_shift = BITS_PER_WORD - wid_%BITS_PER_WORD; + mask_shift %= BITS_PER_WORD; mask_shift += oshift; while (mask_shift >= BITS_PER_WORD) { vec_[use_words-1] = 0;