vfirst.m
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> rd = $encoding[11:7];
Execution
-
IDL
-
Sail
{
let SEW = get_sew();
let LMUL_pow = get_lmul_pow();
let num_elem = unsigned(vlenb) * 8;
if illegal_vd_unmasked() | not(assert_vstart(0)) 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 vs2_val : vector('n, dec, bool) = read_vmask(num_elem, 0b0, vs2);
result : vector('n, dec, bool) = undefined;
mask : vector('n, dec, bool) = undefined;
(result, mask) = init_masked_result_cmp(num_elem, SEW, 0, vs2_val, vm_val);
index : int = -1;
foreach (i from 0 to (num_elem - 1)) {
if index == -1 then {
if mask[i] & vs2_val[i] then index = i;
};
};
X(rd) = to_bits(sizeof(xlen), index);
vstart = zeros();
RETIRE_SUCCESS
}