aboutsummaryrefslogtreecommitdiff
path: root/src/rv32.tex
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2019-10-19 14:10:43 -0700
committerAndrew Waterman <andrew@sifive.com>2019-10-19 14:15:15 -0700
commit0ac0b9a801299896f20aaa69744e246e71204150 (patch)
treea05d6cdb08d81a71b4bc8408986cc12652ae6f06 /src/rv32.tex
parentacbb41226286e052e62891c6473abe7718a21b44 (diff)
downloadriscv-isa-manual-0ac0b9a801299896f20aaa69744e246e71204150.zip
riscv-isa-manual-0ac0b9a801299896f20aaa69744e246e71204150.tar.gz
riscv-isa-manual-0ac0b9a801299896f20aaa69744e246e71204150.tar.bz2
Consistently claim that U-immediate is 32 bits, not 20 bits
The text vacillates between describing the U-immediate as a 20-bit quantity, and as a 32-bit quantity whose lower 12 bits are zero. Standardize on the latter. Note the discrepancy in the ASM syntax. Resolves #452
Diffstat (limited to 'src/rv32.tex')
-rw-r--r--src/rv32.tex9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rv32.tex b/src/rv32.tex
index 78742cb..de11d93 100644
--- a/src/rv32.tex
+++ b/src/rv32.tex
@@ -562,16 +562,19 @@ U-immediate[31:12] & dest & AUIPC
\end{center}
LUI (load upper immediate) is used to build 32-bit constants and uses
-the U-type format. LUI places the U-immediate value in the top 20
-bits of the destination register {\em rd}, filling in the lowest 12
+the U-type format. LUI places the 32-bit U-immediate value into
+the destination register {\em rd}, filling in the lowest 12
bits with zeros.
AUIPC (add upper immediate to {\tt pc}) is used to build {\tt pc}-relative
addresses and uses the U-type format. AUIPC forms a 32-bit offset from the
-20-bit U-immediate, filling in the lowest 12 bits with zeros, adds this offset
+U-immediate, filling in the lowest 12 bits with zeros, adds this offset
to the address of the AUIPC instruction, then places the result in register {\em rd}.
\begin{commentary}
+The assembly syntax for {\tt lui} and {\tt auipc} does not represent the lower
+12 bits of the U-immediate, which are always zero.
+
The AUIPC instruction supports two-instruction sequences to access
arbitrary offsets from the PC for both control-flow transfers and data
accesses. The combination of an AUIPC and the 12-bit immediate in a