Skip to content

Commit

Permalink
CSR clarify rs1==c0 & rd==c0
Browse files Browse the repository at this point in the history
  • Loading branch information
andresag01 committed Feb 12, 2024
1 parent 28d3162 commit ffceb5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/insns/csrr_32bit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@ xref:extended_CSR_writing[xrefstyle=short].
See xref:aliased_CSRs[xrefstyle=short] for a list of CLEN-wide CSRs and
xref:extended_CSR_writing[xrefstyle=short] for the action taken on writing an XLEN-wide value to each one.
+
If `cd` is `c0` (or `rd` is `x0`), then <<CSRRWI>> shall not read the CSR and
and shall not cause any of the side effects that might occur on a CSR read. If
`rs1` is `x0`, then <<CSRRS>>, <<CSRRC>>, <<CSRRSI>> and <<CSRRCI>> will not
write to the CSR at all, and so shall not cause any of the side effects that
might otherwise occur on a CSR write.
+
Access to XLEN-wide CSRs from other extensions is as specified by RISC-V.

NOTE: If `rs1` is `x0` and the CSR accessed is a capability, then <<CSRRS>>,
<<CSRRC>>, <<CSRRSI>> and <<CSRRCI>> do not write so no representability check
is needed in this case.

Permissions::
All non-user mode accessible CSRs require <<asr_perm>>, including existing RISC-V CSRs.

Expand Down
3 changes: 3 additions & 0 deletions src/insns/csrrw_32bit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ CSRRW writes `cs1` to the CLEN-wide alias of extended CSRs, and reads a full cap
+
CSRRW writes `rs1` to the XLEN-wide alias of extended CSRs, and reads the address field into `rd`.
+
If `cd` is `c0` (or `rd` is `x0`), then the instruction shall not read the CSR
and shall not cause any of the side effects that might occur on a CSR read.
+
Access to XLEN-wide CSRs from other extensions is as specified by RISC-V.


Expand Down

0 comments on commit ffceb5e

Please sign in to comment.