vslidedown.vi
No synopsis available.
This instruction is defined by:
-
V, version >= 0
This instruction is included in the following profiles:
-
RVA22S64 (Optional)
-
RVA22U64 (Optional)
Decode Variables
Bits<1> vm = $encoding[25];
Bits<5> vs2 = $encoding[24:20];
Bits<5> simm5 = $encoding[19:15];
Bits<5> vd = $encoding[11:7];
Execution
-
IDL
-
Sail
{
let SEW_pow = get_sew_pow();
let SEW = get_sew();
let LMUL_pow = get_lmul_pow();
let VLEN_pow = get_vlen_pow();
let num_elem = get_num_elem(LMUL_pow, SEW);
if illegal_normal(vd, vm) then { handle_illegal(); return RETIRE_FAIL };
let 'n = num_elem;
let 'm = SEW;
let vm_val : vector('n, dec, bool) = read_vmask(num_elem, vm, 0b00000);
let imm_val : nat = unsigned(zero_extend(sizeof(xlen), simm));
let vs2_val : vector('n, dec, bits('m)) = read_vreg(num_elem, SEW, LMUL_pow, vs2);
let vd_val : vector('n, dec, bits('m)) = read_vreg(num_elem, SEW, LMUL_pow, vd);
result : vector('n, dec, bits('m)) = undefined;
mask : vector('n, dec, bool) = undefined;
(result, mask) = init_masked_result(num_elem, SEW, LMUL_pow, vd_val, vm_val);
foreach (i from 0 to (num_elem - 1)) {
if mask[i] then {
result[i] = match funct6 {
VI_VSLIDEUP => {
if (vs2 == vd) then { handle_illegal(); return RETIRE_FAIL };
if i >= imm_val then vs2_val[i - imm_val] else vd_val[i]
},
VI_VSLIDEDOWN => {
let VLMAX = int_power(2, LMUL_pow + VLEN_pow - SEW_pow);
assert(VLMAX > 0 & VLMAX <= 'n);
if i + imm_val < VLMAX then vs2_val[i + imm_val] else zeros()
},
VI_VRGATHER => {
if (vs2 == vd) then { handle_illegal(); return RETIRE_FAIL };
let VLMAX = int_power(2, LMUL_pow + VLEN_pow - SEW_pow);
assert(VLMAX > 0 & VLMAX <= 'n);
if imm_val < VLMAX then vs2_val[imm_val] else zeros()
}
}
}
};
write_vreg(num_elem, SEW, LMUL_pow, vd, result);
vstart = zeros();
RETIRE_SUCCESS
}