|
| 1 | +# yaml-language-server: $schema=../../../schemas/inst_schema.json |
| 2 | + |
| 3 | +fclass.s: |
| 4 | + long_name: Single-precision floating-point classify. |
| 5 | + description: | |
| 6 | + The `fclass.s` instruction examines the value in floating-point register |
| 7 | + _fs1_ and writes to integer register _rd_ a 10-bit mask that indicates |
| 8 | + the class of the floating-point number. |
| 9 | + The format of the mask is described in the table below. |
| 10 | + The corresponding bit in _rd_ will be set if the property is true and |
| 11 | + clear otherwise. |
| 12 | + All other bits in _rd_ are cleared. |
| 13 | + Note that exactly one bit in rd will be set. |
| 14 | + `fclass.s` does not set the floating-point exception flags. |
| 15 | +
|
| 16 | + .Format of result of `fclass` instruction. |
| 17 | + [%autowidth,float="center",align="center",cols="^,<",options="header",] |
| 18 | + |=== |
| 19 | + |_rd_ bit |Meaning |
| 20 | + |0 |_rs1_ is latexmath:[$-\infty$]. |
| 21 | + |1 |_rs1_ is a negative normal number. |
| 22 | + |2 |_rs1_ is a negative subnormal number. |
| 23 | + |3 |_rs1_ is latexmath:[$-0$]. |
| 24 | + |4 |_rs1_ is latexmath:[$+0$]. |
| 25 | + |5 |_rs1_ is a positive subnormal number. |
| 26 | + |6 |_rs1_ is a positive normal number. |
| 27 | + |7 |_rs1_ is latexmath:[$+\infty$]. |
| 28 | + |8 |_rs1_ is a signaling NaN. |
| 29 | + |9 |_rs1_ is a quiet NaN. |
| 30 | + |=== |
| 31 | +
|
| 32 | + definedBy: F |
| 33 | + assembly: xd, fs1 |
| 34 | + encoding: |
| 35 | + match: 111000000000-----001-----1010011 |
| 36 | + variables: |
| 37 | + - name: fs1 |
| 38 | + location: 19-15 |
| 39 | + - name: rd |
| 40 | + location: 11-7 |
| 41 | + access: |
| 42 | + s: always |
| 43 | + u: always |
| 44 | + vs: always |
| 45 | + vu: always |
| 46 | + data_independent_timing: false |
| 47 | + operation(): | |
| 48 | + check_f_ok($encoding); |
| 49 | +
|
| 50 | + Bits<32> sp_value = f[fs1][31:0]; |
| 51 | +
|
| 52 | + if (is_sp_neg_inf?(sp_value)) { |
| 53 | + X[rd] = 1 << 0; |
| 54 | + } else if (is_sp_neg_norm?(sp_value)) { |
| 55 | + X[rd] = 1 << 1; |
| 56 | + } else if (is_sp_neg_subnorm?(sp_value)) { |
| 57 | + X[rd] = 1 << 2; |
| 58 | + } else if (is_sp_neg_zero?(sp_value)) { |
| 59 | + X[rd] = 1 << 3; |
| 60 | + } else if (is_sp_pos_zero?(sp_value)) { |
| 61 | + X[rd] = 1 << 4; |
| 62 | + } else if (is_sp_pos_subnorm?(sp_value)) { |
| 63 | + X[rd] = 1 << 5; |
| 64 | + } else if (is_sp_pos_norm?(sp_value)) { |
| 65 | + X[rd] = 1 << 6; |
| 66 | + } else if (is_sp_pos_inf?(sp_value)) { |
| 67 | + X[rd] = 1 << 7; |
| 68 | + } else if (is_sp_signaling_nan?(sp_value)) { |
| 69 | + X[rd] = 1 << 8; |
| 70 | + } else { |
| 71 | + assert(is_sp_quiet_nan?(sp_value), "Unexpected SP value"); |
| 72 | + X[rd] = 1 << 9; |
| 73 | + } |
0 commit comments