diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index c7b2baf50..b0ed5702f 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -1106,8 +1106,6 @@ The instruction also checks flag bit 4. If it is true, the result is replaced with X instead of a shifted result. This is intended to detect that the index contents were not valid. -For a negative shift, %shiftr will pad the value with 'bx. - * %split/vec4 Pull the top vec4 vector from the stack and split it into two diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 2051b1176..5e7507752 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -5402,10 +5402,10 @@ bool of_SET_DAR_OBJ_STR(vthread_t thr, vvp_code_t cp) bool of_SHIFTL(vthread_t thr, vvp_code_t cp) { int use_index = cp->number; - int shift = thr->words[use_index].w_int; + uint64_t shift = thr->words[use_index].w_uint; vvp_vector4_t&val = thr->peek_vec4(); - int wid = val.size(); + unsigned wid = val.size(); if (thr->flags[4] == BIT4_1) { // The result is 'bx if the shift amount is undefined @@ -5421,18 +5421,6 @@ bool of_SHIFTL(vthread_t thr, vvp_code_t cp) vvp_vector4_t tmp (shift, BIT4_0); val.set_vec(0, tmp); val.set_vec(shift, blk); - - } else if (shift < -wid) { - val = vvp_vector4_t(wid, BIT4_X); - - } else if (shift < 0) { - // Negative left shift is a right shift. - // For a negative shift, we pad with 'bx. - int use_shift = -shift; - vvp_vector4_t blk = val.subvalue(use_shift, wid-use_shift); - vvp_vector4_t tmp (use_shift, BIT4_X); - val.set_vec(0, blk); - val.set_vec(wid-use_shift, tmp); } return true; @@ -5447,10 +5435,10 @@ bool of_SHIFTL(vthread_t thr, vvp_code_t cp) bool of_SHIFTR(vthread_t thr, vvp_code_t cp) { int use_index = cp->number; - int shift = thr->words[use_index].w_int; + uint64_t shift = thr->words[use_index].w_uint; vvp_vector4_t val = thr->pop_vec4(); - int wid = val.size(); + unsigned wid = val.size(); if (thr->flags[4] == BIT4_1) { val = vvp_vector4_t(wid, BIT4_X); @@ -5463,18 +5451,6 @@ bool of_SHIFTR(vthread_t thr, vvp_code_t cp) vvp_vector4_t tmp (shift, BIT4_0); val.set_vec(0, blk); val.set_vec(wid-shift, tmp); - - } else if (shift < -wid) { - val = vvp_vector4_t(wid, BIT4_X); - - } else if (shift < 0) { - // Negative right shift is a left shift. - // For a negative shift, we pad with 'bx. - int use_shift = -shift; - vvp_vector4_t blk = val.subvalue(0, wid-use_shift); - vvp_vector4_t tmp (use_shift, BIT4_X); - val.set_vec(0, tmp); - val.set_vec(use_shift, blk); } thr->push_vec4(val); @@ -5487,10 +5463,10 @@ bool of_SHIFTR(vthread_t thr, vvp_code_t cp) bool of_SHIFTR_S(vthread_t thr, vvp_code_t cp) { int use_index = cp->number; - int shift = thr->words[use_index].w_int; + uint64_t shift = thr->words[use_index].w_uint; vvp_vector4_t val = thr->pop_vec4(); - int wid = val.size(); + unsigned wid = val.size(); vvp_bit4_t sign_bit = val.value(val.size()-1); @@ -5505,16 +5481,6 @@ bool of_SHIFTR_S(vthread_t thr, vvp_code_t cp) vvp_vector4_t tmp (shift, sign_bit); val.set_vec(0, blk); val.set_vec(wid-shift, tmp); - - } else if (shift < -wid) { - val = vvp_vector4_t(wid, BIT4_X); - - } else if (shift < 0) { - int use_shift = -shift; - vvp_vector4_t blk = val.subvalue(0, wid-use_shift); - vvp_vector4_t tmp(use_shift, BIT4_X); - val.set_vec(0, tmp); - val.set_vec(use_shift, blk); } thr->push_vec4(val);