From f75b84b53d2a5d186145e0949e0aa1ec92d0af54 Mon Sep 17 00:00:00 2001 From: peter2500zz <2797880090@qq.com> Date: Mon, 11 May 2026 21:12:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=ADCSRRSI=E7=9A=84=E7=AC=94=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/csr.tex | 2 +- src/rvwmo.tex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csr.tex b/src/csr.tex index b32bc54..bc34a4c 100644 --- a/src/csr.tex +++ b/src/csr.tex @@ -109,7 +109,7 @@ \section{CSR指令} CSRRWI、CSRRSI和CSRRCI变体分别与CSRRW、CSRRS和CSRRC相似, 除了它们使用一个XLEN位的值来更新CSR,这个值通过零扩展编码在{\em rs1}中的一个5位的无符号立即数(uimm[4:0])域得到, -而不是来自一个整数寄存器。对于CSRRI和CSRRCI,如果uimm[4:0]域是零,那么这些指令将不会写CSR, +而不是来自一个整数寄存器。对于CSRRSI和CSRRCI,如果uimm[4:0]域是零,那么这些指令将不会写CSR, 并且应当既不引起任何只可能在写CSR时发生的副作用,也不在访问只读CSR时产生非法的指令异常。 对于CSRRWI,如果{\em rd}={\tt x0},那么指令不应当读CSR,也不应当跟引起任何可能在读CSR时发生的副作用。 不论{\em rd}和{\em rs1}域如何,CSRRSI和CSRRCI都将总是读CSR,和引起任何读的副作用。 diff --git a/src/rvwmo.tex b/src/rvwmo.tex index 98e1e6b..9af8b83 100644 --- a/src/rvwmo.tex +++ b/src/rvwmo.tex @@ -141,7 +141,7 @@ \subsection*{句法依赖} % In general, a register $r$ other than {\tt x0} is a {\em destination register} for an instruction $i$ if any of the following hold: \begin{itemize} \item 在i的操作码中,rd被设置为r % In the opcode of $i$, {\em rd} is set to $r$ - \item $i$是一个CSR指令,且在$i$的操作码中,{\em csr}被设置为$r$(除非$i$是CSRRS或CSRRC,并且{\em rs1}被设置为{\em x0};或者$i$是CSRRI或CSRRCI,并且uimm[4:0]被设置为0) % $i$ is a CSR instruction, and in the opcode of $i$, {\em csr} is set to $r$, unless $i$ is CSRRS or CSRRC and {\em rs1} is set to {\tt x0} or $i$ is CSRRSI or CSRRCI and uimm[4:0] is set to zero. + \item $i$是一个CSR指令,且在$i$的操作码中,{\em csr}被设置为$r$(除非$i$是CSRRS或CSRRC,并且{\em rs1}被设置为{\em x0};或者$i$是CSRRSI或CSRRCI,并且uimm[4:0]被设置为0) % $i$ is a CSR instruction, and in the opcode of $i$, {\em csr} is set to $r$, unless $i$ is CSRRS or CSRRC and {\em rs1} is set to {\tt x0} or $i$ is CSRRSI or CSRRCI and uimm[4:0] is set to zero. \item $r$是一个CSR,并且对于$i$,$r$是一个隐式的目的寄存器,正如~\ref{sec:source-dest-regs}节中定义的那样 % $r$ is a CSR and an implicit destination register for $i$, as defined in Section~\ref{sec:source-dest-regs} \item 对于$i$,$r$是一个作为另一个目的寄存器的别名的CSR % $r$ is a CSR that aliases with another destination register for $i$ \end{itemize} From 4914803050d9b1f1741649169b442412bbc1a0e9 Mon Sep 17 00:00:00 2001 From: peter2500zz <2797880090@qq.com> Date: Wed, 13 May 2026 10:23:16 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c.tex b/src/c.tex index a64bdf1..a6cd854 100644 --- a/src/c.tex +++ b/src/c.tex @@ -545,7 +545,7 @@ \subsection*{基于栈指针的加载和存储} 这些指令使用CSS格式。 % These instructions use the CSS format. -C.SWSP把一个32位的值存储到寄存器{\em rs2}中。它通过将{\em 零}扩展的偏移量扩大4倍,加到栈指针{\tt x2}上, +C.SWSP把寄存器{\em rs2}中的一个32位的值存储到内存。它通过将{\em 零}扩展的偏移量扩大4倍,加到栈指针{\tt x2}上, 来计算出有效地址。它扩展到{\tt sw rs2, offset(x2)}。 % C.SWSP stores a 32-bit value in register {\em rs2} to memory. It computes % an effective address by adding the {\em zero}-extended offset, scaled by 4, to From f05984ba049ff4dcb9b20ea66fde2ed99a773d74 Mon Sep 17 00:00:00 2001 From: peter2500zz <2797880090@qq.com> Date: Wed, 13 May 2026 12:43:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20C.ADDI=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=9A=84=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c.tex b/src/c.tex index a6cd854..f4199ae 100644 --- a/src/c.tex +++ b/src/c.tex @@ -983,7 +983,7 @@ \subsection*{整数寄存器-立即数操作} \end{center} C.ADDI把非零的符号扩展的6位立即数加到寄存器{\em rd}中的值,然后把结果写到{\em rd}。 -C.ADDI扩展到{\tt addi rd, rd, nzimm}。C.ADDI只有当{\tt addi rd, rd, nzimm}$\neq${\tt x0}且{\em nzimm}$\neq$0时有效。 +C.ADDI扩展到{\tt addi rd, rd, nzimm}。C.ADDI只有当{\em rd}$\neq${\tt x0}且{\em nzimm}$\neq$0时有效。 {\em rd}={\tt x0}的代码点编码了C.NOP指令;余下的{\em nzimm}=0的代码点编码了HINT。 % C.ADDI adds the non-zero sign-extended 6-bit immediate to the value in % register {\em rd} then writes the result to {\em rd}. C.ADDI expands From ff41442e679393c5f029fc78f645cf30543e6bd4 Mon Sep 17 00:00:00 2001 From: peter2500zz <2797880090@qq.com> Date: Wed, 13 May 2026 13:41:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20C.MV=20C.ADD=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E7=BF=BB=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c.tex b/src/c.tex index f4199ae..607fb7e 100644 --- a/src/c.tex +++ b/src/c.tex @@ -1210,7 +1210,7 @@ \subsection*{Integer Register-Register Operations} % These instructions use the CR format. C.MV把寄存器{\em rs2}中的值复制到寄存器{\em rd}中。C.MV扩展到{\tt add rd, x0, rs2}。 -C.MV只在rs2=x0时有效;$\textit{rs2}{=}\texttt{x0}$的代码点对应于C.JR指令。 +C.MV只在$\textit{rs2}{\neq}\texttt{x0}$时有效;$\textit{rs2}{=}\texttt{x0}$的代码点对应于C.JR指令。 $\textit{rs2}{\neq}\texttt{x0}$和$\textit{rd}{=}\texttt{x0}$的代码点是HINT。 % C.MV copies the value in register {\em rs2} into register {\em rd}. C.MV % expands into {\tt add rd, x0, rs2}. @@ -1229,8 +1229,8 @@ \subsection*{Integer Register-Register Operations} \end{commentary} C.ADD把寄存器{\em rd}和{\em rs2}中的值相加,并把结果写到寄存器{\em rd}。 -C.ADD扩展到{\tt add rd, rd, rs2}。C.ADD只在$\textit{rs2}{\neq}\texttt{x0}$时有效;r$\textit{rs2}{=}\texttt{x0}$的代码点对应于C.JALR和C.EBREAK指令。 -$\textit{rs2}{\neq}\texttt{x0}$0和$\textit{rd}{=}\texttt{x0}$的代码点是HINT。 +C.ADD扩展到{\tt add rd, rd, rs2}。C.ADD只在$\textit{rs2}{\neq}\texttt{x0}$时有效;$\textit{rs2}{=}\texttt{x0}$的代码点对应于C.JALR和C.EBREAK指令。 +$\textit{rs2}{\neq}\texttt{x0}$和$\textit{rd}{=}\texttt{x0}$的代码点是HINT。 % C.ADD adds the values in registers {\em rd} and {\em rs2} and writes the % result to register {\em rd}. C.ADD expands into {\tt add rd, rd, rs2}. % C.ADD is only valid when $\textit{rs2}{\neq}\texttt{x0}$; the code points