From 894a7d11587c87e9cb3a2d96122cfe0a147ea4fc Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 5 Aug 2019 06:36:16 +0100 Subject: [PATCH] add missing transcendentals from bug #127 --- rv_major_opcode_1010011.mdwn | 66 +++++++++++++++++++++--------------- ztrans_proposal.mdwn | 50 ++++++++++++++++----------- 2 files changed, 68 insertions(+), 48 deletions(-) diff --git a/rv_major_opcode_1010011.mdwn b/rv_major_opcode_1010011.mdwn index 993b4493c..790ee5bd4 100644 --- a/rv_major_opcode_1010011.mdwn +++ b/rv_major_opcode_1010011.mdwn @@ -59,7 +59,7 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 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 | ? | +10000 | xx | rs2 | rs1 | yyy | rd | 1010011 | **FROOT.xx** | 10001 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | 10010 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | 10011 | xx | rs2 | rs1 | yyy | rd | 1010011 | ? | @@ -207,36 +207,42 @@ funct5 | SDHQ | rs2 | rs1 | funct3 | rd | opcode | name | 01011 | xx | 00001 | rs1 | rm | rd | 1010011 | **FRSQRT.xx** | 01011 | xx | 00010 | rs1 | rm | rd | 1010011 | **FRCP.xx** | 01011 | xx | 00011 | rs1 | rm | rd | 1010011 | **FCBRT.xx** | -01011 | xx | 00100 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 00101 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 00110 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 00111 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 01000 | rs1 | rm | rd | 1010011 | **FEXP2.xx** | -01011 | xx | 01001 | rs1 | rm | rd | 1010011 | **FLOG2.xx** | -01011 | xx | 01010 | rs1 | rm | rd | 1010011 | **FEXPM1.xx** | -01011 | xx | 01011 | rs1 | rm | rd | 1010011 | **FLOGP1.xx** | -01011 | xx | 01100 | rs1 | rm | rd | 1010011 | **FEXP.xx** | -01011 | xx | 01101 | rs1 | rm | rd | 1010011 | **FLOG.xx** | -01011 | xx | 01110 | rs1 | rm | rd | 1010011 | **FEXP10.xx** | -01011 | xx | 01111 | rs1 | rm | rd | 1010011 | **FLOG10.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 | **FCOS.xx** | -01011 | xx | 10010 | rs1 | rm | rd | 1010011 | **FTAN.xx** | -01011 | xx | 10011 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 10100 | rs1 | rm | rd | 1010011 | **FSINPI.xx** | -01011 | xx | 10101 | rs1 | rm | rd | 1010011 | **FCOSPI.xx** | -01011 | xx | 10110 | rs1 | rm | rd | 1010011 | **FTANPI.xx** | -01011 | xx | 10111 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 11000 | rs1 | rm | rd | 1010011 | **FSINH.xx** | -01011 | xx | 11001 | rs1 | rm | rd | 1010011 | **FCOSH.xx** | -01011 | xx | 11010 | rs1 | rm | rd | 1010011 | **FTANH.xx** | -01011 | xx | 11011 | rs1 | rm | rd | 1010011 | ? | -01011 | xx | 11100 | rs1 | rm | rd | 1010011 | **FASINH.xx** | -01011 | xx | 11101 | rs1 | rm | rd | 1010011 | **FACOSH.xx** | -01011 | xx | 11110 | rs1 | rm | rd | 1010011 | **FATANH.xx** | +01011 | xx | 10001 | rs1 | rm | rd | 1010011 | **FASIN.xx** | +01011 | xx | 10010 | rs1 | rm | rd | 1010011 | **FSINPI.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 | **FACOS.xx** | +01011 | xx | 10110 | rs1 | rm | rd | 1010011 | **FCOSPI.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 | **FATAN.xx** | +01011 | xx | 11010 | rs1 | rm | rd | 1010011 | **FTANPI.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 = 01100 - unused Brownfield encodings available. @@ -252,7 +258,11 @@ Rationale: Gives better accuracy than if using FMUL with the constant, PI. ## funct5 = 01111 - **FPOW** -Proposed for Zftrans - FPOW: "FP rs2 to the power of rs1" +Proposed for ZftransAdv - FPOW: "FP rs1 to the power of rs2" + +## funct5 = 10000 - **FROOT** + +Proposed for ZftransAdv - FPROOT: "FP rs1 to the power of (1/rs2)" ## funct5 = 10000 - unused diff --git a/ztrans_proposal.mdwn b/ztrans_proposal.mdwn index 15c6ea766..9cc4112eb 100644 --- a/ztrans_proposal.mdwn +++ b/ztrans_proposal.mdwn @@ -5,6 +5,12 @@ See: * * +Extension subsets: + +* **Ztrans**: standard transcendentals (best suited to 3D) +* **ZtransExt**: extra functions (useful, not generally needed for 3D) +* **ZtransAdv**: much more complex to implement in hardware + [[!toc levels=2]] # List of 2-arg opcodes @@ -12,35 +18,39 @@ See: [[!table data=""" opcode | Description | pseudo-code | Extension | FATAN2 | atan2 arc tangent | rd = atan2(rs2, rs1) | Ztrans | -FATAN2PI | atan arc tangent / pi | rd = atan2(rs2, rs1) / pi | | -FPOW | power of | rd = pow(rs1, rs2) | Ztrans | +FATAN2PI | atan arc tangent / pi | rd = atan2(rs2, rs1) / pi | ZtransExt | +FPOW | x power of y | rd = pow(rs1, rs2) | ZtransAdv | +FROOT | x power 1/y | rd = pow(rs1, 1/rs2) | ZtransAdv | """]] # List of 1-arg opcodes [[!table data=""" opcode | Description | pseudo-code | Extension | -FCBRT | Cube Root | rd = pow(rs1, 3) | | -FEXP2 | power-of-2 | rd = pow(2, rs1) | | -FLOG2 | log2 | rd = log2(rs1) | | -FEXPM1 | exponent minus 1 | rd = pow(e, rs1) - 1.0 | | -FLOG1P | log plus 1 | rd = log(e, 1 + rs1) | | -FEXP | exponent | rd = pow(e, rs1) | | -FLOG | natural log (base e) | rd = log(e, rs1) | | -FEXP10 | power-of-10 | rd = pow(10, rs1) | | -FLOG10 | log base 10 | rd = log10(rs1) | | +FCBRT | Cube Root | rd = pow(rs1, 3) | Ztrans | +FEXP2 | power-of-2 | rd = pow(2, rs1) | Ztrans | +FLOG2 | log2 | rd = log2(rs1) | Ztrans | +FEXPM1 | exponent minus 1 | rd = pow(e, rs1) - 1.0 | Ztrans | +FLOG1P | log plus 1 | rd = log(e, 1 + rs1) | Ztrans | +FEXP | exponent | rd = pow(e, rs1) | ZtransExt | +FLOG | natural log (base e) | rd = log(e, rs1) | ZtransExt | +FEXP10 | power-of-10 | rd = pow(10, rs1) | ZtransExt | +FLOG10 | log base 10 | rd = log10(rs1) | ZtransExt | FSIN | sin (radians) | | Ztrans | FCOS | cos (radians) | | Ztrans | FTAN | tan (radians) | | Ztrans | -FSINPI | sin times pi | rd = sin(pi * rs1) | | -FCOSPI | cos times pi | rd = cos(pi * rs1) | | -FTANPI | tan times pi | rd = tan(pi * rs1) | | -FSINH | hyperbolic sin (radians) | | | -FCOSH | hyperbolic cos (radians) | | | -FTANH | hyperbolic tan (radians) | | | -FASINH | inverse hyperbolic sin | | | -FACOSH | inverse hyperbolic cos | | | -FATANH | inverse hyperbolic tan | | | +FASIN | arcsin (radians) | rd = asin(rs1) | Ztrans | +FACOS | arccos (radians) | rd = acos(rs1) | Ztrans | +FATAN | arctan (radians) | rd = atan(rs1) | Ztrans | +FSINPI | sin times pi | rd = sin(pi * rs1) | ZtransExt | +FCOSPI | cos times pi | rd = cos(pi * rs1) | ZtransExt | +FTANPI | tan times pi | rd = tan(pi * rs1) | ZtransExt | +FSINH | hyperbolic sin (radians) | | ZtransExt | +FCOSH | hyperbolic cos (radians) | | ZtransExt | +FTANH | hyperbolic tan (radians) | | ZtransExt | +FASINH | inverse hyperbolic sin | | ZtransExt | +FACOSH | inverse hyperbolic cos | | ZtransExt | +FATANH | inverse hyperbolic tan | | ZtransExt | """]] # Pseudo-code ops -- 2.30.2