From aaab515b5a9d8dc6eb19e6bb4330012bdffff4fb Mon Sep 17 00:00:00 2001 From: John Winans Date: Thu, 12 Mar 2020 14:16:29 -0500 Subject: [PATCH] Express shamt_i in terms of XLEN. --- book/refcard/chapter.tex | 6 +++--- book/rv32/chapter.tex | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/book/refcard/chapter.tex b/book/refcard/chapter.tex index f0ea8d5..01e3e1b 100644 --- a/book/refcard/chapter.tex +++ b/book/refcard/chapter.tex @@ -54,7 +54,7 @@ sb & rs2, imm(rs1) & \hyperref[insnformat:stype]{S} & \hyperref[insn:sb]{Stor \hline sh & rs2, imm(rs1) & \hyperref[insnformat:stype]{S} & \hyperref[insn:sh]{Store Halfword} & {\tt m16(rs1+\hyperref[imm.s:decode]{imm\_s}) $\leftarrow$ rs2[15:0], pc $\leftarrow$ pc+4}\\ \hline -sll & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:sll]{Shift Left Logical} & {\tt rd $\leftarrow$ rs1 << (rs2\&0x1f), pc $\leftarrow$ pc+4}\\ +sll & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:sll]{Shift Left Logical} & {\tt rd $\leftarrow$ rs1 << (rs2\%XLEN), pc $\leftarrow$ pc+4}\\ \hline slli & rd, rs1, shamt & \hyperref[insnformat:itype]{I} & \hyperref[insn:slli]{Shift Left Logical Immediate} & {\tt rd $\leftarrow$ rs1 << \hyperref[shamt.i:decode]{shamt\_i}, pc $\leftarrow$ pc+4}\\ \hline @@ -66,11 +66,11 @@ sltiu & rd, rs1, imm & \hyperref[insnformat:itype]{I} & \hyperref[insn:sltiu]{S \hline sltu & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:sltu]{Set Less Than Unsigned} & {\tt rd $\leftarrow$ (rs1 < rs2) ? 1 : 0, pc $\leftarrow$ pc+4}\\ \hline -sra & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:sra]{Shift Right Arithmetic} & {\tt rd $\leftarrow$ rs1 >> (rs2\&0x1f), pc $\leftarrow$ pc+4}\\ +sra & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:sra]{Shift Right Arithmetic} & {\tt rd $\leftarrow$ rs1 >> (rs2\%XLEN), pc $\leftarrow$ pc+4}\\ \hline srai & rd, rs1, shamt & \hyperref[insnformat:itype]{I} & \hyperref[insn:srai]{Shift Right Arithmetic Immediate} & {\tt rd $\leftarrow$ rs1 >> \hyperref[shamt.i:decode]{shamt\_i}, pc $\leftarrow$ pc+4}\\ \hline -srl & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:srl]{Shift Right Logical} & {\tt rd $\leftarrow$ rs1 >> (rs2\&0x1f), pc $\leftarrow$ pc+4}\\ +srl & rd, rs1, rs2 & \hyperref[insnformat:rtype]{R} & \hyperref[insn:srl]{Shift Right Logical} & {\tt rd $\leftarrow$ rs1 >> (rs2\%XLEN), pc $\leftarrow$ pc+4}\\ \hline srli & rd, rs1, shamt & \hyperref[insnformat:itype]{I} & \hyperref[insn:srli]{Shift Right Logical Immediate} & {\tt rd $\leftarrow$ rs1 >> \hyperref[shamt.i:decode]{shamt\_i}, pc $\leftarrow$ pc+4}\\ \hline diff --git a/book/rv32/chapter.tex b/book/rv32/chapter.tex index a9c43ea..d928c53 100644 --- a/book/rv32/chapter.tex +++ b/book/rv32/chapter.tex @@ -622,10 +622,12 @@ to form the \verb@imm_i@ value. \end{figure} A special case of the I-type is used for shift-immediate instructions -where only five bits of the imm field are used to represent the number -of bit positions to shift as shown in \autoref{Figure:shamt_i_type_decode}. +where the imm field is used to represent the number of bit positions +to shift as shown in \autoref{Figure:shamt_i_type_decode}. In this variation, the least significant five bits of the imm field are -zero-extended to form the \verb@shamt_i@ value. +zero-extended to form the \verb@shamt_i@ +value.\footnote{When XLEN is 64 or 128, the {\tt shamt\_i} field will +consist of 6 or 7 bits respectively.} \begin{figure}[ht] \centering