Floating-Point Less Than Single-Precision
The `flt.s` instruction writes 1 to `xd` if `fs1` is less than `fs2`, and 0 otherwise. If either operand is NaN, the result is 0 (not equal). If either operand is a NaN (signaling or quiet), the invalid flag is set.
flt.s xd, fs1, fs2
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 0000 | fs2 | fs1 | 00 | 1 | xd | 1 | 0 | 1 | 00 | 11 | ||||||||||||||||||
| Variable | Bits | Width |
|---|---|---|
fs2 | [24:20] | 5 |
fs1 | [19:15] | 5 |
xd | [11:7] | 5 |
check_f_ok($encoding);
Bits<32> sp_value_a = F[fs1][31:0];
Bits<32> sp_value_b = F[fs2][31:0];
Bits<1> sign_a = sp_value_a[31];
Bits<1> sign_b = sp_value_b[31];
if (is_sp_nan?(sp_value_a) || is_sp_nan?(sp_value_b)) {
set_fp_flag(FpFlag::NV);
X[xd] = 0;
} else {
if (sign_a != sign_b) {
X[xd] = (
(sign_a == 1) # a is neg and b is pos
&& ((sp_value_a[30:0] | sp_value_b[30:0]) != 0) # a and b are not both zero
) ? 1 : 0;
} else {
X[xd] = (
(sp_value_a != sp_value_b) # a and b are not equal
&& ((sign_a ^ ((sp_value_a < sp_value_b) ? 1 : 0)) != 0)# a < b
) ? 1 : 0;
}
}
F
| S | U | VS | VU |
|---|---|---|---|
| Always | Always | Always | Always |
Version af3eaf9+cheriot.f635218
Data from the RISC-V Unified Database, copyright RISC-V International and contributors.
CHERIoT extensions from the CHERIoT specification and Sail model, copyright Microsoft and the CHERIoT Platform contributors.
This site is provided as a community resource and is NOT affiliated with nor endorsed by RISC-V International.