diff options
author | Andrew Waterman <andrew@sifive.com> | 2022-09-06 17:53:46 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2022-09-06 17:53:46 -0700 |
commit | e2037cf837dff86d8e0bb158885b5408c3f2338c (patch) | |
tree | b9c7984b3c39240c26ad99fd85d18cf608648a6d | |
parent | bda19b952253e4b47828b6129cf1a6746781d0f5 (diff) | |
download | riscv-isa-manual-e2037cf837dff86d8e0bb158885b5408c3f2338c.zip riscv-isa-manual-e2037cf837dff86d8e0bb158885b5408c3f2338c.tar.gz riscv-isa-manual-e2037cf837dff86d8e0bb158885b5408c3f2338c.tar.bz2 |
Zfb also contains FLI.{H, S, D, Q}
-rw-r--r-- | src/zfb.tex | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/zfb.tex b/src/zfb.tex index 9c801a0..a79c52f 100644 --- a/src/zfb.tex +++ b/src/zfb.tex @@ -154,3 +154,94 @@ registers into a floating-point register. Integer registers {\em rs1} and floating-point register {\em rd}. FMVP.Q.X is encoded in the OP-FP major opcode with {\em funct3}=0 and {\em funct7}=1011011. + + +\section{Load-Immediate Instructions} + +The FLI.S instruction loads a 5-bit immediate value that represents +a single-precision floating-point number, encoded in the {\em rs1} field, into +floating-point register {\em rd}. +The correspondence of {\em rs1} field values and single-precision +floating-point values is shown in Table~\ref{tab:flis}. +FLI.S is encoded like FMV.W.X, but with {\em rs2}=1. + +\begin{table}[h] +\center +\begin{tabular}{|r|r|c|c|c|} +\hline +{\em rs1} & Value & Sign & Exponent & Significand \\ +\hline + 0 & $-1.0$ & {\tt 1} & {\tt 01111111} & {\tt 000...000} \\ + 1 & {\em Minimum positive normal} & {\tt 0} & {\tt 00000001} & {\tt 000...000} \\ + 2 & $1.0 \times 2^{-16}$ & {\tt 0} & {\tt 01101111} & {\tt 000...000} \\ + 3 & $1.0 \times 2^{-15}$ & {\tt 0} & {\tt 01110000} & {\tt 000...000} \\ + 4 & $1.0 \times 2^{-8}$ & {\tt 0} & {\tt 01110111} & {\tt 000...000} \\ + 5 & $1.0 \times 2^{-7}$ & {\tt 0} & {\tt 01111000} & {\tt 000...000} \\ + 6 & $1.0 \times 2^{-4}$ & {\tt 0} & {\tt 01111011} & {\tt 000...000} \\ + 7 & $1.0 \times 2^{-3}$ & {\tt 0} & {\tt 01111100} & {\tt 000...000} \\ + 8 & $1.0 \times 2^{-2}$ & {\tt 0} & {\tt 01111101} & {\tt 000...000} \\ + 9 & $1.25 \times 2^{-2}$ & {\tt 0} & {\tt 01111101} & {\tt 010...000} \\ +10 & $1.5 \times 2^{-2}$ & {\tt 0} & {\tt 01111101} & {\tt 100...000} \\ +11 & $1.75 \times 2^{-2}$ & {\tt 0} & {\tt 01111101} & {\tt 110...000} \\ +12 & $1.0 \times 2^{-1}$ & {\tt 0} & {\tt 01111110} & {\tt 000...000} \\ +13 & $1.25 \times 2^{-1}$ & {\tt 0} & {\tt 01111110} & {\tt 010...000} \\ +14 & $1.5 \times 2^{-1}$ & {\tt 0} & {\tt 01111110} & {\tt 100...000} \\ +15 & $1.75 \times 2^{-1}$ & {\tt 0} & {\tt 01111110} & {\tt 110...000} \\ +16 & 1.0 & {\tt 0} & {\tt 01111111} & {\tt 000...000} \\ +17 & 1.25 & {\tt 0} & {\tt 01111111} & {\tt 010...000} \\ +18 & 1.5 & {\tt 0} & {\tt 01111111} & {\tt 100...000} \\ +19 & 1.75 & {\tt 0} & {\tt 01111111} & {\tt 110...000} \\ +20 & 2.0 & {\tt 0} & {\tt 10000000} & {\tt 000...000} \\ +21 & 2.5 & {\tt 0} & {\tt 10000000} & {\tt 010...000} \\ +22 & 3 & {\tt 0} & {\tt 10000000} & {\tt 100...000} \\ +23 & 4 & {\tt 0} & {\tt 10000001} & {\tt 000...000} \\ +24 & 8 & {\tt 0} & {\tt 10000010} & {\tt 000...000} \\ +25 & $2^7$ & {\tt 0} & {\tt 10000110} & {\tt 000...000} \\ +26 & $2^8$ & {\tt 0} & {\tt 10000111} & {\tt 000...000} \\ +27 & $2^{15}$ & {\tt 0} & {\tt 10001110} & {\tt 000...000} \\ +28 & $2^{16}$ & {\tt 0} & {\tt 10001111} & {\tt 000...000} \\ +29 & {\em Maximum positive normal} & {\tt 0} & {\tt 11111110} & {\tt 111...111} \\ +30 & $+\infty$ & {\tt 0} & {\tt 11111111} & {\tt 000...000} \\ +31 & {\em Canonical NaN} & {\tt 0} & {\tt 11111111} & {\tt 100...000} \\ +\hline +\end{tabular} +\caption{Immediate values loaded by the FLI.S instruction.} +\label{tab:flis} +\end{table} + +\begin{commentary} +The set of 32 constants was chosen by examining floating-point libraries, +including the C standard math library, and to optimize fixed-point to +floating-point conversion. + +Entries 8--22 follow a regular encoding pattern. +\end{commentary} + +If the D extension is implemented, FLI.D performs the analogous operation, +but loads a double-precision value into floating-point register {\em rd}. +Note that entries 1 and 29 (corresponding to the minimum and maximum +normal values) have numerically different values for double-precision than +for single-precision. +FLI.D is encoded like FLI.S, but with {\em fmt}=D. + +If the Q extension is implemented, FLI.Q performs the analogous operation, +but loads a quad-precision value into floating-point register {\em rd}. +Note that entries 1 and 29 (corresponding to the minimum and maximum +normal values) have numerically different values for quad-precision. +FLI.Q is encoded like FLI.S, but with {\em fmt}=Q. + +If the Zfh or Zvfh extension is implemented, FLI.H performs the analogous +operation, but loads a half-precision floating-point value into register +{\em rd}. +Note that entries 1 and 29 (corresponding to the minimum and maximum normal +values) have numerically different values for half-precision. Furthermore, +since $2^{16}$ is not representable in half-precision floating-point, entry 28 +in the table instead loads the maximum positive normal value---i.e., it is +redundant with entry 29. FLI.H is encoded like FLI.S, but with {\em fmt}=H. + +\begin{commentary} +Additionally, since $2^{-16}$ is a subnormal in half-precision, entry 1 is numerically +greater than entry 2 for FLI.H. +\end{commentary} + +The FLI.{\em fmt} instructions never set any floating-point exception flags. |