X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=rv_major_opcode_1010011.mdwn;h=6383cf0c48f21b9b91aecbffef51b4da553e6847;hb=415b6046ad257d1d11d8bedc950799e8c3b14409;hp=43423c93ed457c3785f50a91036afe78145b9b95;hpb=6d96885ce93c6e51a40000a168c3a626f535a053;p=libreriscv.git diff --git a/rv_major_opcode_1010011.mdwn b/rv_major_opcode_1010011.mdwn index 43423c93e..6383cf0c4 100644 --- a/rv_major_opcode_1010011.mdwn +++ b/rv_major_opcode_1010011.mdwn @@ -1,58 +1,122 @@ +**OBSOLETE**, superceded by [[openpower/transcendentals]] + # Summary FP Opcodes -* Zfrsqrt - Recip SQRT -* Zftrans - Transcendentals (FSIN, FCOS, FATAN, FPOW, FEXP, FLOG, FRCP) +This page aids and assists in the development of FP proposals, +by identifying and listing in full both publicly-known proposals +and the full brownfield encoding space available in the 0b010011 +major opcode. + +A primary critical use-case for extending FP is for 3D and supercomputing. + +Publicly-known FP proposals: + +* Zfrsqrt - Reciprocal SQRT +* Zftrans - see [[ztrans_proposal]]: Transcendentals + (FPOW, FEXP, FLOG, FCBRT) + +* Ztrig\* - see [[ztrans_proposal]]: Trigonometriics + (FSIN, FCOS, FTAN, arc-variants, hypotenuse-variants) +* Extension of formats to cover FP16 (RISC-V ISA Manual Table 11.3 "fmt field") + * HI-half FP MV - + +* (Add new entries here: Zextname - Description and URL) + +[[!toc levels=2]] # Main FP opcode 1010011 table -Proposed new encodings in **bold** +Notes: + +* Proposed new encodings in **bold**. +* *Use funct5 sparingly!* - 2-operand functions only. +* Single-argument FP operations should go under one of the funct5 tables +* Both dual and single argument FP operations that do not require + "rounding mode" should go in one of the funct5 tables that already use + "funct3". +* The rs2 field can be best used to sub-select a considerable number + of 1-op operations, with "rounding" in funct3 +* The funct3 field can be best used to sub-select a considerable number + of 2-op operations +* 1-op operations that do not need "rounding" have the best brownfield + availability: 8 bit sub-selection (rs2=5 + funct3=3). This however is + rare as most FP operations need "rounding" selection. +* Be careful not to use encoding space for which FP16 has already been + reserved (mostly FP conversion opcodes) [[!table data=""" -31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | -funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | - 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | -00000 | xx | rs2 | rs1 | rm | rd | 1010011 | FADD.xx | -00001 | xx | rs2 | rs1 | rm | rd | 1010011 | FSUB.xx | -00010 | xx | rs2 | rs1 | rm | rd | 1010011 | FMUL.xx | -00011 | xx | rs2 | rs1 | rm | rd | 1010011 | FDIV.xx | -00100 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=00100 | -00101 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=00101 | -00110 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -00111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01000 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=01000 | -01001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01010 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=01011 | -01100 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01110 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -01111 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FPOW.XX** | -10000 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10010 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10011 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10100 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=10100 | -10101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10110 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -10111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -11000 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11000 | -11001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -11010 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11010 | -11100 | xx | xxxxx | rs1 | 000 | rd | 1010011 | tb=11100 | -11101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | -11110 | xx | xxxxx | rs1 | 000 | rd | 1010011 | tb=11110 | -11111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | +funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | + 5 | 2 | 5 | 5 | 3 | 5 | 7 | | +00000 | xx | rs2 | rs1 | rm | rd | 1010011 | FADD.xx | +00001 | xx | rs2 | rs1 | rm | rd | 1010011 | FSUB.xx | +00010 | xx | rs2 | rs1 | rm | rd | 1010011 | FMUL.xx | +00011 | xx | rs2 | rs1 | rm | rd | 1010011 | FDIV.xx | +00100 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +00101 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=00101 | +00110 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +00111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +01000 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=01000 | +01001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +01010 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +01011 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=01011 | +01100 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FHYPOT.xx** | +01101 | xx | rs2 | rs1 | rm | rd | 1010011 | **FATAN2.xx** | +01110 | xx | rs2 | rs1 | rm | rd | 1010011 | **FATAN2PI.xx**| +01111 | xx | rs2 | rs1 | rm | rd | 1010011 | **FPOW.xx** | +10000 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FROOTN.xx** | +10001 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FPOWN.xx** | +10010 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FPOWR.xx** | +10011 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +10100 | xx | rs2 | rs1 | yyy | rd | 1010011 | tb=10100 | +10101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +10110 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +10111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +11000 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11000 | +11001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +11010 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11010 | +11100 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11100 | +11101 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | +11110 | xx | xxxxx | rs1 | yyy | rd | 1010011 | tb=11110 | +11111 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | """]] -## funct5 = 00100 +Code: + +* xx: Opcode format field "fmt" - Table 11.3 +* xxxxx: 5-bit selection field (usually 1-op selection) +* yyy: funct3 selection field (usually 2-op selection) +* rm: "rounding mode" + +## funct5 = 00000 - FADD + +No brownfield encodings available. + +## funct5 = 00001 - FSUB + +No brownfield encodings available. + +## funct5 = 00010 - FMUL + +No brownfield encodings available. + +## funct5 = 00011 - FDIV + +No brownfield encodings available. + +## funct5 = 00100 - unused + +Brownfield encodings available. + +## funct5 = 00100 - FSGN + +This table uses funct3 for encoding 2-operand FP operations [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 00100 | xx | rs2 | rs1 | 000 | rd | 1010011 | FSGNJ.xx | 00100 | xx | rs2 | rs1 | 001 | rd | 1010011 | FSGNJN.xx | 00100 | xx | rs2 | rs1 | 010 | rd | 1010011 | FSGNJX.xx | @@ -63,13 +127,15 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 00100 | xx | rs2 | rs1 | 111 | rd | 1010011 | ?f3=111 | """]] -# funct5 = 00101 +## funct5 = 00101 - FMIN/MAX + +This table uses funct3 for encoding 2-operand FP operations where the result +register is a **floating-point** value. [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 00101 | xx | rs2 | rs1 | 000 | rd | 1010011 | FMIN.S | 00101 | xx | rs2 | rs1 | 001 | rd | 1010011 | FMAX.S | 00101 | xx | rs2 | rs1 | 010 | rd | 1010011 | ?f3=010 | @@ -80,73 +146,147 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 00101 | xx | rs2 | rs1 | 111 | rd | 1010011 | ?f3=111 | """]] -# funct5 = 01000 +## funct5 = 00110 - unused + +Brownfield encodings available. + +## funct5 = 00111 - unused + +Brownfield encodings available. + +## funct5 = 01000 - FCVT + +This table uses rs2 for encoding 1-operand FP operations, using +funct3 to specify the "rounding" mode Notes: -* TODO FP16 (trivial) +* FP16 logically deduced from fmt field encoding (bits 25-26) [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | +01000 | 00 | 00000 | rs1 | rm | rd | 1010011 | ???????? | 01000 | 00 | 00001 | rs1 | rm | rd | 1010011 | FCVT.S.D | +01000 | 00 | 00010 | rs1 | rm | rd | 1010011 | **FCVT.S.H**| 01000 | 00 | 00011 | rs1 | rm | rd | 1010011 | FCVT.S.Q | 01000 | 00 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 01000 | 01 | 00000 | rs1 | rm | rd | 1010011 | FCVT.D.S | +01000 | 01 | 00001 | rs1 | rm | rd | 1010011 | ???????? | +01000 | 01 | 00010 | rs1 | rm | rd | 1010011 | **FCVT.D.H**| 01000 | 01 | 00011 | rs1 | rm | rd | 1010011 | FCVT.D.Q | 01000 | 01 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | +01000 | 10 | 00000 | rs1 | rm | rd | 1010011 | FCVT.H.S | +01000 | 10 | 00001 | rs1 | rm | rd | 1010011 | **FCVT.H.D**| +01000 | 10 | 00010 | rs1 | rm | rd | 1010011 | ???????? | +01000 | 10 | 00011 | rs1 | rm | rd | 1010011 | FCVT.H.Q | +01000 | 10 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | +------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 01000 | 11 | 00000 | rs1 | rm | rd | 1010011 | FCVT.Q.S | 01000 | 11 | 00001 | rs1 | rm | rd | 1010011 | FCVT.Q.D | +01000 | 11 | 00010 | rs1 | rm | rd | 1010011 | **FCVT.Q.H**| +01000 | 11 | 00011 | rs1 | rm | rd | 1010011 | ???????? | 01000 | 11 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | """]] -# funct5 = 01011 +## funct5 = 01001 - unused + +Brownfield encodings available. + +## funct5 = 01010 - unused + +Brownfield encodings available. + +## funct5 = 01011 - 1-op Transcendentals + +This table uses rs2 for encoding 1-operand FP operations, using +funct3 to specify the "rounding" mode [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | -01011 | xx | 00000 | rs1 | yyy | rd | 1010011 | FSQRT.xx | -01011 | xx | 00001 | rs1 | yyy | rd | 1010011 | **FRSQRT.xx** | -01011 | xx | 00010 | rs1 | yyy | rd | 1010011 | **FSIN.xx** | -01011 | xx | 00011 | rs1 | yyy | rd | 1010011 | **FCOS.xx** | -01011 | xx | 00100 | rs1 | yyy | rd | 1010011 | **FATAN.xx** | -01011 | xx | 00101 | rs1 | yyy | rd | 1010011 | **FEXP.xx** | -01011 | xx | 00110 | rs1 | yyy | rd | 1010011 | **FLOG.xx** | -01011 | xx | 00111 | rs1 | yyy | rd | 1010011 | **FRCP.xx** | -01011 | xx | 01000 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01001 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01010 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01011 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01100 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01101 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01110 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 01111 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10000 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10001 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10010 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10011 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10100 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10101 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10110 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 10111 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11000 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11001 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11010 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11011 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11100 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11101 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11110 | rs1 | yyy | rd | 1010011 | ? | -01011 | xx | 11111 | rs1 | yyy | rd | 1010011 | ? | +01011 | xx | 00000 | rs1 | rm | rd | 1010011 | FSQRT.xx | +01011 | xx | 00001 | rs1 | rm | rd | 1010011 | **FRSQRT.xx** | +01011 | xx | 00010 | rs1 | rm | rd | 1010011 | **FRECIP.xx** | +01011 | xx | 00011 | rs1 | rm | rd | 1010011 | **FCBRT.xx** | +01011 | xx | 00100 | rs1 | rm | rd | 1010011 | **FEXP2.xx** | +01011 | xx | 00101 | rs1 | rm | rd | 1010011 | **FLOG2.xx** | +01011 | xx | 00110 | rs1 | rm | rd | 1010011 | **FEXPM1.xx** | +01011 | xx | 00111 | rs1 | rm | rd | 1010011 | **FLOGP1.xx** | +01011 | xx | 01000 | rs1 | rm | rd | 1010011 | **FEXP.xx** | +01011 | xx | 01001 | rs1 | rm | rd | 1010011 | **FLOG.xx** | +01011 | xx | 01010 | rs1 | rm | rd | 1010011 | **FEXP10.xx** | +01011 | xx | 01011 | rs1 | rm | rd | 1010011 | **FLOG10.xx** | +01011 | xx | 01100 | rs1 | rm | rd | 1010011 | **FASINH.xx** | +01011 | xx | 01101 | rs1 | rm | rd | 1010011 | **FACOSH.xx** | +01011 | xx | 01110 | rs1 | rm | rd | 1010011 | **FATANH.xx** | +01011 | xx | 01111 | rs1 | rm | rd | 1010011 | ? | +01011 | xx | 10000 | rs1 | rm | rd | 1010011 | **FSIN.xx** | +01011 | xx | 10001 | rs1 | rm | rd | 1010011 | **FSINPI.xx** | +01011 | xx | 10010 | rs1 | rm | rd | 1010011 | **FASIN.xx** | +01011 | xx | 10011 | rs1 | rm | rd | 1010011 | **FASINPI.xx**| +01011 | xx | 10100 | rs1 | rm | rd | 1010011 | **FCOS.xx** | +01011 | xx | 10101 | rs1 | rm | rd | 1010011 | **FCOSPI.xx** | +01011 | xx | 10110 | rs1 | rm | rd | 1010011 | **FACOS.xx** | +01011 | xx | 10111 | rs1 | rm | rd | 1010011 | **FACOSPI.xx**| +01011 | xx | 11000 | rs1 | rm | rd | 1010011 | **FTAN.xx** | +01011 | xx | 11001 | rs1 | rm | rd | 1010011 | **FTANPI.xx** | +01011 | xx | 11010 | rs1 | rm | rd | 1010011 | **FATAN.xx** | +01011 | xx | 11011 | rs1 | rm | rd | 1010011 | **FATANPI.xx**| +01011 | xx | 11100 | rs1 | rm | rd | 1010011 | **FSINH.xx** | +01011 | xx | 11101 | rs1 | rm | rd | 1010011 | **FCOSH.xx** | +01011 | xx | 11110 | rs1 | rm | rd | 1010011 | **FTANH.xx** | +01011 | xx | 11111 | rs1 | rm | rd | 1010011 | ? | """]] -# funct5 = 10100 +## funct5 = 01100 - **FHYPOT** + +Proposed for Zftrans - FHYPOT: "sqrt(rs1 * rs1 + rs2 * rs2)" + +## funct5 = 01101 - **FATAN2** + +Proposed for Zftrans - FATAN: "atan(rs1, rs2)" + +## funct5 = 01110 - **FATAN2PI** + +Proposed for ZftransExt - FATAN2PI: "atan2(rs1, rs2) * PI". +Rationale: Gives better accuracy than if using FMUL with the constant, PI. + +## funct5 = 01111 - **FPOW** + +Proposed for ZftransAdv - FPOW: "FP rs1 to the power of rs2" + +## funct5 = 10000 - **FROOTN** + +Proposed for ZftransAdv - FPROOTN: "FP rs1 to the power of (1/rs2)". +rs1 is FP, rs2 is **integer**. + +## funct5 = 10000 - **FPOWN** + +Proposed for ZftransAdv - FPOW: "FP rs1 to the power of rs2" +rs1 is FP, rs2 is **integer**. + +## funct5 = 10001 - **FPOW** + +Proposed for ZftransAdv - FPOWN: "FP rs1 to the power of rs2, rs1 +ve" +rs1 and rs2 are FP, rs1 must be +ve. Equivalent to "exp(rs2 * log(rs1))" + +## funct5 = 10010 - unused + +Brownfield encodings available. + +## funct5 = 10011 - unused + +Brownfield encodings available. + +## funct5 = 10100 - FP comparisons + +This table uses funct3 for encoding 2-operand FP "comparison" operations +where the result register is an **integer** Notes: @@ -156,7 +296,6 @@ Notes: 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 10100 | xx | rs2 | rs1 | 000 | rd | 1010011 | FLE.xx | 10100 | xx | rs2 | rs1 | 001 | rd | 1010011 | FLT.xx | 10100 | xx | rs2 | rs1 | 010 | rd | 1010011 | FEQ.xx | @@ -167,17 +306,31 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 10100 | xx | rs2 | rs1 | 111 | rd | 1010011 | ?f3=111 | """]] -# funct5 = 11000 +## funct5 = 10101 - unused + +Brownfield encodings available. + +## funct5 = 10110 - unused + +Brownfield encodings available. + +## funct5 = 10111 - unused + +Brownfield encodings available. + +## funct5 = 11000 - FCVT + +This table uses rs2 for encoding 1-operand FP operations, using +funct3 to specify the "rounding" mode Notes: -* TODO FP16 (trivial) +* FP16 logically deduced from fmt field (bits 25-26) [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11000 | 00 | 00000 | rs1 | rm | rd | 1010011 | FCVT.W.S | 11000 | 00 | 00001 | rs1 | rm | rd | 1010011 | FCVT.WU.S | 11000 | 00 | 00010 | rs1 | rm | rd | 1010011 | FCVT.L.S | @@ -190,21 +343,34 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 11000 | 01 | 00011 | rs1 | rm | rd | 1010011 | FCVT.LU.D | 11000 | 01 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | +11000 | 10 | 00000 | rs1 | rm | rd | 1010011 |**FCVT.W.H** | +11000 | 10 | 00001 | rs1 | rm | rd | 1010011 |**FCVT.WU.H**| +11000 | 10 | 00010 | rs1 | rm | rd | 1010011 |**FCVT.L.H** | +11000 | 10 | 00011 | rs1 | rm | rd | 1010011 |**FCVT.LU.H**| +11000 | 10 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | +------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11000 | 11 | 00000 | rs1 | rm | rd | 1010011 | FCVT.W.Q | 11000 | 11 | 00001 | rs1 | rm | rd | 1010011 | FCVT.WU.Q | 11000 | 11 | 00010 | rs1 | rm | rd | 1010011 | FCVT.L.Q | 11000 | 11 | 00011 | rs1 | rm | rd | 1010011 | FCVT.LU.Q | 11000 | 11 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | """]] -# funct5 = 11010 +## funct5 = 11001 - unused + +Brownfield encodings available. + +## funct5 = 11010 - FCVT + +This table uses rs2 for encoding 1-operand FP operations, using +funct3 to specify the "rounding" mode + +* FP16 logically deduced from fmt field (bits 25-26) [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11010 | 00 | 00000 | rs1 | rm | rd | 1010011 | FCVT.S.W | 11010 | 00 | 00001 | rs1 | rm | rd | 1010011 | FCVT.S.WU | 11010 | 00 | 00010 | rs1 | rm | rd | 1010011 | FCVT.S.L | @@ -217,67 +383,89 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 11010 | 01 | 00011 | rs1 | rm | rd | 1010011 | FCVT.D.LU | 11010 | 01 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | +11010 | 10 | 00000 | rs1 | rm | rd | 1010011 |**FCVT.H.W** | +11010 | 10 | 00001 | rs1 | rm | rd | 1010011 |**FCVT.H.WU**| +11010 | 10 | 00010 | rs1 | rm | rd | 1010011 |**FCVT.H.L** | +11010 | 10 | 00011 | rs1 | rm | rd | 1010011 |**FCVT.H.LU**| +11010 | 10 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | +------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11010 | 11 | 00000 | rs1 | rm | rd | 1010011 | FCVT.Q.W | 11010 | 11 | 00001 | rs1 | rm | rd | 1010011 | FCVT.Q.WU | 11010 | 11 | 00010 | rs1 | rm | rd | 1010011 | FCVT.Q.L | 11010 | 11 | 00011 | rs1 | rm | rd | 1010011 | FCVT.Q.LU | 11010 | 11 | xxxxx | rs1 | rm | rd | 1010011 | rs2? | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | """]] -# funct5 = 11100 +## funct5 = 11100 - FMV, FCLASS + +This table uses *both* rs2 *and* funct3 for encoding 1-operand FP operations. Notes: * FMV.X.Q is missing (alias of FMVH.X.D if it existed) -* TODO FP16 (trivial) +* FP16 logically deduced from fmt field (bits 25-26) * FMVH.X.HW (half-word) missing? [[!table data=""" 31..27| 26..25| 24..20 |19..15|14...12| 11..7 | 6....0 | function | funct5| SDHQ | rs2 | rs1 |funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11100 | 00 | 00000 | rs1 | 000 | rd | 1010011 | FMV.X.W | 11100 | 00 | 00000 | rs1 | 001 | rd | 1010011 | FCLASS.S | 11100 | 00 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------| ----- | ----- | -----| ----- | ----- | ------- | -------- | 11100 | 01 | 00000 | rs1 | 000 | rd | 1010011 | FMV.X.D **FMVH.X.W** | 11100 | 01 | 00000 | rs1 | 001 | rd | 1010011 | FCLASS.D | -11100 | xx | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | +11100 | 01 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | +------| ----- | ----- | -----| ----- | ----- | ------- | -------- | +11100 | 10 | 00000 | rs1 | 000 | rd | 1010011 |**FMV.X.H** | +11100 | 10 | 00000 | rs1 | 001 | rd | 1010011 |**FCLASS.H** | +11100 | 10 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------| ----- | ----- | -----| ----- | ----- | ------- | -------- | 11100 | 11 | 00000 | rs1 | 000 | rd | 1010011 | **FMVH.X.D** | 11100 | 11 | 00000 | rs1 | 001 | rd | 1010011 | FCLASS.Q | 11100 | xx | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | """]] -# funct5 = 11110 +## funct5 = 11101 - unused + +Brownfield encodings available. + +## funct5 = 11110 - FMV + +This table uses *both* rs2 *and* funct3 for encoding 1-operand FP operations. Notes: * FMV.Q.X is missing (as is FMVH.D.X) * FMVH.W.X is missing (alias of FMV.D.X) -* TODO FP16 (trivial) +* FP16 logically deduced from fmt field (bits 25-26) * FMVH.HW.X (half-word) missing? [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function | funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 5 | 2 | 5 | 5 | 3 | 5 | 7 | | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11110 | 00 | 00000 | rs1 | 000 | rd | 1010011 | FMV.W.X | 11110 | 00 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11110 | 01 | 00000 | rs1 | 000 | rd | 1010011 | FMV.D.X | 11110 | 01 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | +11110 | 10 | 00000 | rs1 | 000 | rd | 1010011 |**FMV.H.X** | +11110 | 10 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | +------ | ----- | ----- | -----| ----- | ----- | ------- | -------- | 11110 | 11 | 00000 | rs1 | 000 | rd | 1010011 | ? | 11110 | 11 | xxxxx | rs1 | yyy | rd | 1010011 | rs2? f3? | ------- | ----- | ----- | -----| ----- | ----- | ------- | -------- | """]] -# funct5 = ????? +## funct5 = 11111 - unused + +Brownfield encodings available. + +## funct5 = ????? (table template) + +This table acts as a cut/paste template for creating brownfield encodings [[!table data=""" 31..27 | 26..25 | 24..20 |19..15| 14...12| 11..7 | 6....0 | function |