diff options
author | Krste Asanovic <krste@eecs.berkeley.edu> | 2017-05-03 07:12:57 -0700 |
---|---|---|
committer | Krste Asanovic <krste@eecs.berkeley.edu> | 2017-05-03 07:12:57 -0700 |
commit | 8ca7cc545451f97b8941f19c5ca7fcc05494df40 (patch) | |
tree | 6e76584061eb7c12a8597f4327a0a20323b9d382 /src | |
parent | 20496c298de36f5eb9e282c4a461968f6bb097ea (diff) | |
download | riscv-isa-manual-8ca7cc545451f97b8941f19c5ca7fcc05494df40.zip riscv-isa-manual-8ca7cc545451f97b8941f19c5ca7fcc05494df40.tar.gz riscv-isa-manual-8ca7cc545451f97b8941f19c5ca7fcc05494df40.tar.bz2 |
Clarified result of REM*W on divide by zero.
Diffstat (limited to 'src')
-rw-r--r-- | src/m.tex | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -93,21 +93,14 @@ cannot be the same as {\em rs1} or {\em rs2}). Microarchitectures can then fuse these into a single divide operation instead of performing two separate divides. -DIVW and DIVUW instructions are only valid for RV64, and divide the -lower 32 bits of {\em rs1} by the lower 32 bits of {\em rs2}, treating -them as signed and unsigned integers respectively, placing the 32-bit -quotient in {\em rd}, sign-extended to 64 bits. REMW and REMUW -instructions are only valid for RV64, and provide the corresponding -signed and unsigned remainder operations respectively. Both REMW and -REMUW sign-extend the 32-bit result to 64 bits. - -The semantics for division by zero and division overflow are summarized in -Table~\ref{tab:divby0}. The quotient of division by zero has all bits set, -i.e. $2^{XLEN}-1$ for unsigned division or $-1$ for signed division. The -remainder of division by zero equals the dividend. Signed division overflow -occurs only when the most-negative integer, $-2^{XLEN-1}$, is divided by $-1$. -The quotient of signed division overflow is equal to the dividend, and the -remainder is zero. Unsigned division overflow cannot occur. +The semantics for division by zero and division overflow are +summarized in Table~\ref{tab:divby0}. The quotient of division by +zero has all bits set, i.e. $2^{XLEN}-1$ for unsigned division or $-1$ +for signed division. The remainder of division by zero equals the +dividend. Signed division overflow occurs only when the most-negative +integer, $-2^{XLEN-1}$, is divided by $-1$. The quotient of signed +division overflow is equal to the dividend, and the remainder is zero. +Unsigned division overflow cannot occur. \vspace{0.1in} \begin{table}[h] @@ -145,3 +138,13 @@ unsigned divider implementations. Signed division is often implemented using an unsigned division circuit and specifying the same overflow result simplifies the hardware. \end{commentary} + +DIVW and DIVUW instructions are only valid for RV64, and divide the +lower 32 bits of {\em rs1} by the lower 32 bits of {\em rs2}, treating +them as signed and unsigned integers respectively, placing the 32-bit +quotient in {\em rd}, sign-extended to 64 bits. REMW and REMUW +instructions are only valid for RV64, and provide the corresponding +signed and unsigned remainder operations respectively. Both REMW and +REMUW always sign-extend the 32-bit result to 64 bits, including on a +divide by zero. + |