update riscv-isa-manual to riscv-isa-release-1bec7d3-2024-05-28 (#2169)

This commit is contained in:
André Sintzoff 2024-05-30 17:54:30 +02:00 committed by GitHub
parent d714d833cb
commit 718c4e23b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 477 additions and 390 deletions

View file

@ -6,23 +6,28 @@
#
# Original Author: Jean-Roch COULON - Thales
all: priv unpriv priv-html
all: priv-pdf priv-html unpriv-pdf unpriv-html
setup:
mkdir -p build/riscv-isa-manual
cp -r riscv-isa-manual/* build/riscv-isa-manual
cp -r src build/riscv-isa-manual
priv: setup
cd build/riscv-isa-manual/build; make priv
priv-pdf: setup
cd build/riscv-isa-manual/build; make priv-pdf
cp ./build/riscv-isa-manual/build/priv-isa-asciidoc.pdf priv-isa-cv32a65x.pdf
priv-html: setup
cd build/riscv-isa-manual/build; make priv-html
cp ./build/riscv-isa-manual/build/priv-isa-asciidoc.html priv-isa-cv32a65x.html
unpriv: setup
cd build/riscv-isa-manual/build; make unpriv
unpriv-pdf: setup
cd build/riscv-isa-manual/build; make unpriv-pdf
cp ./build/riscv-isa-manual/build/unpriv-isa-asciidoc.html unpriv-isa-cv32a65x.html
unpriv-html: setup
cd build/riscv-isa-manual/build; make unpriv-html
cp ./build/riscv-isa-manual/build/unpriv-isa-asciidoc.html unpriv-isa-cv32a65x.html
clean:
rm -rf build

File diff suppressed because one or more lines are too long

@ -1 +1 @@
Subproject commit 217b3f8cdbd94583f4933bb7c7b35bae3e70f74d
Subproject commit 1bec7d34914aa1a2a890b4fca30af519ba539e7b

View file

@ -6,6 +6,8 @@
:RVU: false
:RVH: false
:SV: SV0
:RVZicfilp: false
:RVZicfiss: false
:RVZsmstateen: false
:RVZsmcsrind-RVZsscsrind: false
:RVZsmepmp: false

View file

@ -1,5 +1,5 @@
[[indirect-csr]]
== "Smcsrind/Sscsrind" Indirect CSR Access, Version 1.0.0
== "Smcsrind/Sscsrind" Indirect CSR Access, Version 1.0
ifeval::[{RVZsmcsrind-RVZsscsrind} == false]
{ohg-config}: This extension is not supported.

View file

@ -18,9 +18,9 @@ code can access all CSRs at lower privilege levels.
endif::[]
[[misa]]
==== Machine ISA Register `misa`
==== Machine ISA (`misa`) Register
The `misa` CSR is a *WARL* read-write register reporting the ISA supported by the hart.
The `misa` CSR is a *WARL* read-write register reporting the ISA supported by the hart.
ifeval::[{ohg-config} != CV32A65X]
This register must be readable in any implementation, but a value of zero can be returned to indicate the `misa` register has not been implemented, requiring that CPU capabilities be determined through a separate non-standard mechanism.
endif::[]
@ -68,7 +68,7 @@ knowing the register width (MXLEN) of the hart. The base width is
given by __MXLEN=2^MXL+4^__.
The base width can also be found if `misa` is zero, by placing the
immediate 4 in a register then shifting the register left by 31 bits at
immediate 4 in a register, then shifting the register left by 31 bits at
a time. If zero after one shift, then the hart is RV32. If zero after
two shifts, then the hart is RV64, else RV128.
====
@ -97,7 +97,9 @@ with a single bit per letter of the alphabet (bit 0 encodes presence of
extension "A" , bit 1 encodes presence of extension "B", through to
bit 25 which encodes "Z"). The "I" bit will be set for RV32I, RV64I,
and RV128I base ISAs, and the "E" bit will be set for RV32E and RV64E.
In CVA6, the Extensions field is not writeable, the presence of standard extensions corresponds to the hardware reset value and cannot be modified by writing in the register.
In CVA6, the Extensions field is not writeable, the presence of standard
extensions corresponds to the hardware reset value and cannot be modified
by writing in the register.
endif::[]
@ -173,7 +175,7 @@ K +
L +
M +
N +
O +
O +
P +
Q +
R +
@ -277,7 +279,7 @@ when a feature is not implemented, the corresponding opcodes and CSRs become
reserved, not necessarily illegal.
endif::[]
==== Machine Vendor ID Register `mvendorid`
==== Machine Vendor ID (`mvendorid`) Register
ifeval::[{ohg-config} != CV32A65X]
The `mvendorid` CSR is a 32-bit read-only register providing the JEDEC
@ -289,7 +291,9 @@ endif::[]
ifeval::[{ohg-config} == CV32A65X]
[CVA6] The `mvendorid` CSR is a 32-bit read-only register providing the JEDEC
manufacturer ID of the provider of the core. In CVA6, `mvendorid` is implemented and returns the commercial implementation id supplied to OpenHW Group organization, 0x602.
manufacturer ID of the provider of the core.
In CVA6, `mvendorid` is implemented and returns the commercial implementation
id supplied to OpenHW Group organization, 0x602.
endif::[]
//.Vendor ID register (`mvendorid`)
@ -325,7 +329,7 @@ ID with JEDEC has a one-time cost of $500.
====
endif::[]
==== Machine Architecture ID Register `marchid`
==== Machine Architecture ID (`marchid`) Register
ifeval::[{ohg-config} != CV32A65X]
The `marchid` CSR is an MXLEN-bit read-only register encoding the base
@ -338,10 +342,12 @@ endif::[]
ifeval::[{ohg-config} == CV32A65X]
[CVA6] The `marchid` CSR is an MXLEN-bit read-only register encoding the base
microarchitecture of the hart. In CVA6, `marchid` is implemented and returns the base microarchitecture of the hart supplied to CVA6, 0x3.
microarchitecture of the hart.
In CVA6, `marchid` is implemented and returns the base microarchitecture
of the hart supplied to CVA6, 0x3.
endif::[]
.Machine Architecture ID register (`marchid`)
.Machine Architecture ID (`marchid`) register
include::images/bytefield/marchid.adoc[]
ifeval::[{ohg-config} != CV32A65X]
@ -375,7 +381,7 @@ variants of a design.
====
endif::[]
==== Machine Implementation ID Register `mimpid`
==== Machine Implementation ID (`mimpid`) Register
ifeval::[{ohg-config} != CV32A65X]
The `mimpid` CSR provides a unique encoding of the version of the
@ -394,7 +400,7 @@ The Implementation value should reflect the design of the RISC-V
processor itself and not any surrounding system.
endif::[]
.Machine Implementation ID register (`mimpid`)
.Machine Implementation ID (`mimpid`) register
include::images/bytefield/mimpid.adoc[]
ifeval::[{note} == true]
@ -409,7 +415,7 @@ boundaries to ease human readability.
====
endif::[]
==== Hart ID Register `mhartid`
==== Hart ID (`mhartid`) Register
ifeval::[{ohg-config} != CV32A65X]
The `mhartid` CSR is an MXLEN-bit read-only register containing the
@ -427,7 +433,7 @@ readable. In {ohg-config}-based system, only one hart is implemented.
Hart ID is zero.
endif::[]
.Hart ID register (`mhartid`)
.Hart ID (`mhartid`) register
include::images/bytefield/mhartid.adoc[]
ifeval::[{note} == true]
@ -441,7 +447,7 @@ of the largest hart ID used in a system.
====
endif::[]
==== Machine Status Registers (`mstatus` and `mstatush`)
==== Machine Status (`mstatus` and `mstatush`) Registers
ifeval::[{ohg-config} != CV32A65X]
The `mstatus` register is an MXLEN-bit read/write register formatted as
@ -459,14 +465,74 @@ keeps track of and controls the harts current operating state.
endif::[]
[[mstatusreg-rv32]]
.Machine-mode status register (`mstatus`) for RV32
include::images/bytefield/mstatusreg-rv32.adoc[]
.Machine-mode status (`mstatus`) register for RV32
[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'SIE'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'MIE'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'SPIE'},
{bits: 1, name: 'UBE'},
{bits: 1, name: 'MPIE'},
{bits: 1, name: 'SPP'},
{bits: 2, name: 'VS[1:0]'},
{bits: 2, name: 'MPP[1:0]'},
{bits: 2, name: 'FS[1:0]'},
{bits: 2, name: 'XS[1:0]'},
{bits: 1, name: 'MPRV'},
{bits: 1, name: 'SUM'},
{bits: 1, name: 'MXR'},
{bits: 1, name: 'TVM'},
{bits: 1, name: 'TW'},
{bits: 1, name: 'TSR'},
{bits: 1, name: 'SPELP'},
{bits: 7, name: 'WPRI'},
{bits: 1, name: 'SD'},
], config:{lanes: 2, hspace:1024}}
....
ifeval::[{ohg-config} != CV32A65X]
include::images/bytefield/mstatusreg.adoc[]
[[mstatusreg]]
.Machine-mode status register (`mstatus`) for RV64
include::images/bytefield/mstatusreg2.adoc[]
.Machine-mode status (`mstatus`) register for RV64
[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'SIE'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'MIE'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'SPIE'},
{bits: 1, name: 'UBE'},
{bits: 1, name: 'MPIE'},
{bits: 1, name: 'SPP'},
{bits: 2, name: 'VS[1:0]'},
{bits: 2, name: 'MPP[1:0]'},
{bits: 2, name: 'FS[1:0]'},
{bits: 2, name: 'XS[1:0]'},
{bits: 1, name: 'MPRV'},
{bits: 1, name: 'SUM'},
{bits: 1, name: 'MXR'},
{bits: 1, name: 'TVM'},
{bits: 1, name: 'TW'},
{bits: 1, name: 'TSR'},
{bits: 1, name: 'SPELP'},
{bits: 8, name: 'WPRI'},
{bits: 2, name: 'UXL[1:0]'},
{bits: 2, name: 'SXL[1:0]'},
{bits: 1, name: 'SBE'},
{bits: 1, name: 'MBE'},
{bits: 1, name: 'GVA'},
{bits: 1, name: 'MPV'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'MPELP'},
{bits: 21, name: 'WPRI'},
{bits: 1, name: 'SD'},
], config:{lanes: 4, hspace:1024}}
....
endif::[]
ifeval::[{ohg-config} != CV32A65X]
@ -480,8 +546,16 @@ shown in <<mstatushreg>>.
endif::[]
[[mstatushreg]]
.Additional machine-mode status register (`mstatush`) for RV32.
include::images/bytefield/mstatushreg.adoc[]
.Additional machine-mode status (`mstatush`) register for RV32.
[wavedrom, ,svg]
....
{reg: [
{bits: 4, name: 'WPRI'},
{bits: 1, name: 'SBE'},
{bits: 1, name: 'MBE'},
{bits: 26, name: 'WPRI'},
], config:{lanes: 1, hspace:1024}}
....
[[privstack]]
===== Privilege and Global Interrupt-Enable Stack in `mstatus` register
@ -618,14 +692,6 @@ ifeval::[{RVS} == false]
and UPP are read-only 0.
endif::[]
ifeval::[{note} == true]
[NOTE]
====
M-mode software can determine whether a privilege mode is implemented by
writing that mode to MPP then reading it back.
====
endif::[]
[[xlen-control]]
===== Base ISA Control in `mstatus` Register
@ -727,7 +793,7 @@ whether access-fault exceptions are raised due to PMAs or PMP.
endif::[]
ifeval::[{RVS} == false]
[{ohg-config}] As U-Mode is not implemented, MPRV is read-only 0.
[{ohg-config}] As U-Mode is not implemented, the MPRV (Modify PRiVilege) bit is read-only 0.
Loads and stores behave as normal, using the translation and protection
mechanisms of the current privilege mode.
@ -741,11 +807,11 @@ The MBE, SBE, and UBE bits in `mstatus` and `mstatush` are *WARL* fields that
control the endianness of memory accesses other than instruction
fetches. Instruction fetches are always little-endian.
ifeval::[{RVS} == true]
MBE controls whether non-instruction-fetch memory accesses made from
M-mode (assuming `mstatus`.MPRV=0) are little-endian (MBE=0) or
big-endian (MBE=1).
ifeval::[{RVS} == true]
If S-mode is not supported, SBE is read-only 0. Otherwise, SBE controls
whether explicit load and store memory accesses made from S-mode are
little-endian (SBE=0) or big-endian (SBE=1).
@ -778,10 +844,6 @@ read-only copy of either MBE or SBE.
endif::[]
ifeval::[{RVS} == false]
MBE controls whether non-instruction-fetch memory accesses made from
M-mode (assuming `mstatus`.MPRV=0) are little-endian (MBE=0) or
big-endian (MBE=1).
[{ohg-config}]
It is always little-endian in M-Mode, the MBE is read-only zero.
@ -904,14 +966,6 @@ TW is read-only 0 because there are no modes less privileged
than M.
endif::[]
ifeval::[{note} == true]
[NOTE]
====
Trapping the WFI instruction can trigger a world switch to another guest
OS, rather than wastefully idling in the current guest.
====
endif::[]
ifeval::[{RVS} == true]
The TSR (Trap SRET) bit is a *WARL* field that supports intercepting the
supervisor exception return instruction, SRET. When TSR=1, attempts to
@ -1169,7 +1223,7 @@ alter its contents causes VS to transition to Dirty.
endif::[]
ifeval::[{ohg-config} != CV32A65X]
[{ohg-config}] <<fsxsstates>> shows all the possible state
<<fsxsstates>> shows all the possible state
transitions for the FS, VS, or XS status bits. Note that the standard
floating-point and vector extensions do not support user-mode
unconfigure or disable/enable instructions.
@ -1344,7 +1398,18 @@ interrupts, unless the interrupt results in a user-level context swap.
====
endif::[]
==== Machine Trap-Vector Base-Address Register (`mtvec`)
ifeval::[{ohg-config} != CV32A65X]
===== Previous Expected Landing Pad (ELP) State in `mstatus` Register
The Zicfilp extension adds the `SPELP` and `MPELP` fields that hold the previous
`ELP`, and are updated as specified in <<ZICFILP_FORWARD_TRAPS>>. The
*__x__*`PELP` fields are encoded as follows:
* 0 - `NO_LP_EXPECTED` - no landing pad instruction expected.
* 1 - `LP_EXPECTED` - a landing pad instruction is expected.
endif::[]
==== Machine Trap-Vector Base-Address (`mtvec`) Register
The `mtvec` register is an MXLEN-bit *WARL* read/write register that holds
trap vector configuration, consisting of a vector base address (BASE)
@ -1404,6 +1469,7 @@ times the interrupt cause number. For example, a machine-mode timer
interrupt (see <<mcauses>>) causes the `pc`
to be set to BASE+`0x1c`.
An implementation may have different alignment constraints for different
modes. In particular, MODE=Vectored may have stricter alignment
constraints than MODE=Direct.
@ -1415,11 +1481,13 @@ ifeval::[{note} == true]
Allowing coarser alignments in Vectored mode enables vectoring to be
implemented without a hardware adder circuit.
***
Reset and NMI vector locations are given in a platform specification.
====
endif::[]
==== Machine Trap Delegation Registers (`medeleg` and `mideleg`)
==== Machine Trap Delegation (`medeleg` and `mideleg`) Registers
ifeval::[{RVU} == true]
By default, all traps at any privilege level are handled in machine
@ -1430,7 +1498,7 @@ implementations can provide individual read/write bits within `medeleg`
and `mideleg` to indicate that certain exceptions and interrupts should
be processed directly by a lower privilege level. The machine exception
delegation register (`medeleg`) is a 64-bit read/write register.
The machine interrupt delegation register (`mideleg`) is an MXLEN-bit
The machine interrupt delegation (`mideleg`) register is an MXLEN-bit
read/write register.
In harts with S-mode, the `medeleg` and `mideleg` registers must
@ -1490,7 +1558,7 @@ will not be taken when executing in M-mode. By contrast, if `mideleg`[5]
is clear, STIs can be taken in any mode and regardless of current mode
will transfer control to M-mode.
.Machine Exception Delegation Register `medeleg`.
.Machine Exception Delegation (`medeleg`) register.
include::images/bytefield/medeleg.adoc[]
`medeleg` has a bit position allocated for every synchronous exception
@ -1501,9 +1569,9 @@ lower-privilege trap handler).
When XLEN=32, `medelegh` is a 32-bit read/write register
that aliases bits 63:32 of `medeleg`.
Register `medelegh` does not exist when XLEN=64.
The `medelegh` register does not exist when XLEN=64.
.Machine Interrupt Delegation Register `mideleg`.
.Machine Interrupt Delegation (`mideleg`) Register.
include::images/bytefield/mideleg.adoc[]
`mideleg` holds trap delegation bits for individual interrupts, with the
@ -1523,7 +1591,7 @@ mode.
The SPP, SPIE, SIE fields of `mstatus` are read-only zero.
endif::[]
==== Machine Interrupt Registers (`mip` and `mie`)
==== Machine Interrupt (`mip` and `mie`) Registers
The `mip` register is an MXLEN-bit read/write register containing
information on pending interrupts, while `mie` is the corresponding
@ -1538,10 +1606,10 @@ NOTE: Interrupts designated for platform use may be designated for custom use
at the platform's discretion.
endif::[]
.Machine Interrupt-Pending Register (mip).
.Machine Interrupt-Pending (`mip`) register.
include::images/bytefield/mideleg.adoc[]
.Machine Interrupt-Enable Register (mie)
.Machine Interrupt-Enable (`mie`) register
include::images/bytefield/mideleg.adoc[]
ifeval::[{RVU} == true]
@ -1572,7 +1640,7 @@ A bit in `mie` must be writable if the corresponding interrupt can ever
become pending. Bits of `mie` that are not writable must be read-only
zero.
The standard portions (bits 15:0) of registers `mip` and `mie` are
The standard portions (bits 15:0) of the `mip` and `mie` registers are
formatted as shown in <<mipreg-standard>> and <<miereg-standard>> respectively.
[[mipreg-standard]]
@ -1604,7 +1672,7 @@ interrupt controller.
Bits `mip`.MTIP and `mie`.MTIE are the interrupt-pending and
interrupt-enable bits for machine timer interrupts. MTIP is read-only in
`mip`, and is cleared by writing to the memory-mapped machine-mode timer
the `mip` register, and is cleared by writing to the memory-mapped machine-mode timer
compare register.
Bits `mip`.MSIP and `mie`.MSIE are the interrupt-pending and
@ -1843,14 +1911,14 @@ are not provided.
endif::[]
[[mcounteren]]
==== Machine Counter-Enable Register (`mcounteren`)
==== Machine Counter-Enable (`mcounteren`) Register
The counter-enable register `mcounteren` is a 32-bit register that
The counter-enable `mcounteren` register is a 32-bit register that
controls the availability of the hardware performance-monitoring
counters to the next-lower privileged mode.
ifeval::[{RVU} == true]
.Counter-enable register (`mcounteren`).
.Counter-enable (`mcounteren`) register.
include::images/bytefield/counteren.adoc[]
The settings in this register only control accessibility. The act of
@ -1901,20 +1969,21 @@ ifeval::[{RVU} == false]
[{ohg-config}] As U-mode is not implemented, the `mcounteren` register does not exist.
endif::[]
==== Machine Counter-Inhibit CSR (`mcountinhibit`)
==== Machine Counter-Inhibit (`mcountinhibit`) Register
.Counter-inhibit register `mcountinhibit`
.Counter-inhibit `mcountinhibit` register
include::images/bytefield/counterinh.adoc[]
ifeval::[{RVZsmcntrpmf} == true]
[{ohg-config}] The counter-inhibit register `mcountinhibit` is a 32-bit *WARL* register that
[{ohg-config}]
The counter-inhibit register `mcountinhibit` is a 32-bit *WARL* register that
controls which of the hardware performance-monitoring counters
increment. The settings in this register only control whether the
counters increment; their accessibility is not affected by the setting
of this register.
When the CY, IR, or HPM__n__ bit in the `mcountinhibit` register is clear,
the `cycle`, `instret`, or `hpmcountern` register increments as usual.
the `mcycle`, `minstret`, or `mhpmcountern` register increments as usual.
When the CY, IR, or HPM_n_ bit is set, the corresponding counter does
not increment.
@ -1927,12 +1996,12 @@ behaves as though the register were set to zero.
[NOTE]
====
When the `cycle` and `instret` counters are not needed, it is desirable
When the `mcycle` and `minstret` counters are not needed, it is desirable
to conditionally inhibit them to reduce energy consumption. Providing a
single CSR to inhibit all counters also allows the counters to be
atomically sampled.
Because the `time` counter can be shared between multiple cores, it
Because the `mtime` counter can be shared between multiple cores, it
cannot be inhibited with the `mcountinhibit` mechanism.
====
endif::[]
@ -1942,7 +2011,7 @@ ifeval::[{RVZsmcntrpmf} == false]
behaves as though the register were set to zero.
endif::[]
==== Machine Scratch Register (`mscratch`)
==== Machine Scratch (`mscratch`) Register
The `mscratch` register is an MXLEN-bit read/write register dedicated
for use by machine mode. Typically, it is used to hold a pointer to a
@ -1971,7 +2040,7 @@ while the user context is running.
====
endif::[]
==== Machine Exception Program Counter (`mepc`)
==== Machine Exception Program Counter (`mepc`) Register
`mepc` is an MXLEN-bit read/write register formatted as shown in
<<mepcreg>>. The low bit of `mepc` (`mepc[0]`) is
@ -2014,7 +2083,7 @@ though it may be explicitly written by software.
include::images/bytefield/mepcreg.adoc[]
[[mcause]]
==== Machine Cause Register (`mcause`)
==== Machine Cause (`mcause`) Register
The `mcause` register is an MXLEN-bit read-write register formatted as
shown in <<mcausereg>>. When a trap is taken into
@ -2029,7 +2098,7 @@ the possible machine-level exception codes. The Exception Code is a
*WLRL* field, so is only guaranteed to hold supported exception codes.
[[mcausereg]]
.Machine Cause register `mcause`.
.Machine Cause (`mcause`) register.
include::images/bytefield/mcausereg.adoc[]
ifeval::[{RVU} == true]
@ -2076,10 +2145,10 @@ endif::[]
<<<
[[mcauses]]
.Machine cause register (mcause) values after trap.
.Machine cause (`mcause`) register values after trap.
[%autowidth,float="center",align="center",cols=">,>,<",options="header",]
|===
|Interrupt |Exception Code |Description
|Interrupt |Exception Code |Description
|1 +
1 +
1 +
@ -2091,7 +2160,7 @@ endif::[]
|_Reserved_ +
Supervisor software interrupt +
_Reserved_ +
Machine software interrupt
Machine software interrupt
|1 +
1 +
@ -2104,7 +2173,7 @@ Machine software interrupt
|_Reserved_ +
Supervisor timer interrupt +
_Reserved_ +
Machine timer interrupt
Machine timer interrupt
|1 +
1 +
1 +
@ -2116,7 +2185,7 @@ Machine timer interrupt
|_Reserved_ +
Supervisor external interrupt +
_Reserved_ +
Machine external interrupt
Machine external interrupt
|1 +
1 +
1 +
@ -2128,7 +2197,7 @@ Machine external interrupt
|_Reserved_ +
Counter-overflow interrupt +
_Reserved_ +
_Designated for platform use_
_Designated for platform use_
|0 +
0 +
0 +
@ -2197,7 +2266,7 @@ _Reserved_ +
_Designated for custom use_ +
_Reserved_ +
_Designated for custom use_ +
_Reserved_
_Reserved_
|===
<<<
@ -2300,28 +2369,10 @@ instruction fetch, load, or store that attempted to access corrupted data. The
priority of Hardware Error exception is implementation-defined, but any given
occurrence is generally expected to be recognized at the point in the overall
priority order at which the hardware error is discovered.
A Software Check exception is a synchronous exception that is triggered when
there are violations of checks and assertions defined by ISA extensions that
aim to safeguard the integrity of software assets, including e.g. control-flow
and memory-access constraints. When this exception is raised, the `mtval`
register is set to 0. The priority of this exception,
relative to other synchronous exceptions, depends on the cause of this exception
and is defined by the extension that stipulated the exception be raised.
A Hardware Error exception is a synchronous exception triggered when corrupted or
uncorrectable data is accessed explicitly or implicitly by an instruction. In
this context, "data" encompasses all types of information used within a RISC-V
hart. Upon a hardware error exception, the `mepc` register is set to the
address of the instruction that attempted to access corrupted data, while the
`mtval` register is set to 0. The
priority of Hardware Error exception is implementation-defined (TODO), but any given
occurrence is generally expected to be recognized at the point in the overall
priority order at which the hardware error is discovered.
====
endif::[]
==== Machine Trap Value Register (`mtval`)
==== Machine Trap Value (`mtval`) Register
ifeval::[{MTvalEn} == true]
The `mtval` register is an MXLEN-bit read-write register formatted as
@ -2347,7 +2398,7 @@ exceptions. This design reduces datapath cost for most implementations,
particularly those with hardware page-table walkers.
[[mtvalreg]]
.Machine Trap Value register.
.Machine Trap Value (`mtval`) register.
include::images/bytefield/mtvalreg.adoc[]
@ -2400,6 +2451,13 @@ two cases (or alternatively, the system configuration information can be
interrogated to install the appropriate trap handling before runtime).
====
On a trap caused by a software check exception, the `mtval` register holds
the cause for the exception. The following encodings are defined:
* 0 - No information provided.
* 2 - Landing Pad Fault. Defined by the Zicfilp extension (<<priv-forward>>).
* 3 - Shadow Stack Fault. Defined by the Zicfiss extension (<<priv-backward>>).
For other traps, `mtval` is set to zero, but a future standard may
redefine `mtval`s setting for other traps.
@ -2417,17 +2475,18 @@ ifeval::[{MTvalEn} == false]
[{ohg-config}] The `mtval` register is an MXLEN-bit read-only 0 register.
endif::[]
==== Machine Configuration Pointer Register (`mconfigptr`)
==== Machine Configuration Pointer (`mconfigptr`) Register
ifeval::[{ohg-config} != CV32A65X]
`mconfigptr` is an MXLEN-bit read-only CSR, formatted as shown in
The `mconfigptr` register is an MXLEN-bit read-only CSR, formatted as shown in
<<mconfigptrreg>>, that holds the physical
address of a configuration data structure. Software can traverse this
data structure to discover information about the harts, the platform,
and their configuration.
[[mconfigptrreg]]
.Machine Configuration Pointer register.
.Machine Configuration Pointer (`mconfigptr`) register.
include::images/bytefield/mconfigptrreg.adoc[]
@ -2436,7 +2495,7 @@ i.e., if MXLEN is
latexmath:[$8\times n$], then `mconfigptr`[latexmath:[$\log_2n$]-1:0]
must be zero.
`mconfigptr` must be implemented, but it may be zero to indicate the
The `mconfigptr` register must be implemented, but it may be zero to indicate the
configuration data structure does not exist or that an alternative
mechanism must be used to locate it.
@ -2447,7 +2506,7 @@ standardized.
***
While `mconfigptr` will simply be hardwired in some implementations,
While the `mconfigptr` register will simply be hardwired in some implementations,
other implementations may provide a means to configure the value
returned on CSR reads. For example, `mconfigptr` might present the value
of a memory-mapped register that is programmed by the platform or by
@ -2456,15 +2515,15 @@ M-mode software towards the beginning of the boot process.
endif::[]
ifeval::[{ohg-config} == CV32A65X]
`mconfigptr` is an MXLEN-bit read-only CSR that holds the physical
The `mconfigptr` register is an MXLEN-bit read-only CSR that holds the physical
address of a configuration data structure.
[{ohg-config}] `mconfigptr` is implemented, but it is read-only 0 to indicate the
[{ohg-config}] The `mconfigptr` register is implemented, but it is read-only 0 to indicate the
configuration data structure does not exist.
endif::[]
[[sec:menvcfg]]
==== Machine Environment Configuration Register (`menvcfg`)
==== Machine Environment Configuration (`menvcfg`) Register
ifeval::[{RVU} == true]
The `menvcfg` CSR is a 64-bit read/write register, formatted
@ -2473,8 +2532,26 @@ certain characteristics of the execution environment for modes less
privileged than M.
[#menvcfgreg]
.Machine environment configuration register (`menvcfg`).
include::images/bytefield/menvcfgreg.adoc[]
.Machine environment configuration (`menvcfg`) register.
[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: 'FIOM'},
{bits: 1, name: 'WPRI'},
{bits: 1, name: 'LPE'},
{bits: 1, name: 'SSE'},
{bits: 2, name: 'CBIE'},
{bits: 1, name: 'CBCFE'},
{bits: 1, name: 'CBZE'},
{bits: 24, name: 'WPRI'},
{bits: 2, name: 'PMM'},
{bits: 26, name: 'WPRI'},
{bits: 1, name: 'CDE'},
{bits: 1, name: 'ADUE'},
{bits: 1, name: 'PBMTE'},
{bits: 1, name: 'STCE'},
], config:{lanes: 4, hspace:1024}}
....
If bit FIOM (Fence of I/O implies Memory) is set to one in `menvcfg`,
FENCE instructions executed in modes less privileged than M are modified
@ -2549,25 +2626,39 @@ A/D bits need be set, hence Svade is implemented when ADUE=0.
If the Smcdeleg extension is implemented, the CDE (Counter Delegation Enable) bit controls whether Zicntr and Zihpm counters can be delegated to S-mode. When CDE=1, the Smcdeleg extension is enabled, see <<smcdeleg>>. When CDE=0, the Smcdeleg and Ssccfg extensions appear to be not implemented. If Smcdeleg is not implemented, CDE is read-only zero.
The definition of the STCE field will be furnished by the forthcoming
Sstc extension. Its allocation within `menvcfg` may change prior to the
ratification of that extension.
The definition of the STCE field is furnished by the Sstc extension.
The definition of the CBZE field will be furnished by the forthcoming
Zicboz extension. Its allocation within `menvcfg` may change prior to
the ratification of that extension.
The definition of the CBZE field is furnished by the Zicboz extension.
The definitions of the CBCFE and CBIE fields will be furnished by the
forthcoming Zicbom extension. Their allocations within `menvcfg` may
change prior to the ratification of that extension.
The definitions of the CBCFE and CBIE fields are furnished by the Zicbom extension.
The definition of the PMM field will be furnished by the forthcoming
Smnpm extension. Its allocation within `menvcfg` may change prior to the
ratification of that extension.
The Zicfilp extension adds the `LPE` field in `menvcfg`. When the `LPE` field is
set to 1 and S-mode is implemented, the Zicfilp extension is enabled in S-mode.
If `LPE` field is set to 1 and S-mode is not implemented, the Zicfilp extension
is enabled in U-mode. When the `LPE` field is 0, the Zicfilp extension is not
enabled in S-mode, and the following rules apply to S-mode. If the `LPE` field
is 0 and S-mode is not implemented, then the same rules apply to U-mode.
* The hart does not update the `ELP` state; it remains as `NO_LP_EXPECTED`.
* The `LPAD` instruction operates as a no-op.
The Zicfiss extension adds the `SSE` field to `menvcfg`. When the `SSE` field is
set to 1 the Zicfiss extension is activated in S-mode. When `SSE` field is 0,
the following rules apply to privilege modes that are less than M:
* 32-bit Zicfiss instructions will revert to their behavior as defined by Zimop.
* 16-bit Zicfiss instructions will revert to their behavior as defined by Zcmop.
* The `pte.xwr=010b` encoding in VS/S-stage page tables becomes reserved.
* The `henvcfg.SSE` and `senvcfg.SSE` fields will read as zero and are read-only.
* `SSAMOSWAP.W/D` raises an illegal-instruction exception.
When XLEN=32, `menvcfgh` is a 32-bit read/write register
that aliases bits 63:32 of `menvcfg`.
Register `menvcfgh` does not exist when XLEN=64.
The `menvcfgh` register does not exist when XLEN=64.
If U-mode is not supported, then registers `menvcfg` and `menvcfgh` do
not exist.
@ -2589,15 +2680,27 @@ ifeval::[{RVU} == false]
not exist.
endif::[]
==== Machine Security Configuration Register (`mseccfg`)
==== Machine Security Configuration (`mseccfg`) Register
ifeval::[{RVZsmepmp} == true]
`mseccfg` is an optional 64-bit read/write register, formatted as
shown in <<mseccfg>>, that controls security features.
[[mseccfg]]
.Machine security configuration register (`mseccfg`).
include::images/bytefield/mseccfg.adoc[]
.Machine security configuration (`mseccfg`) register.
[wavedrom, ,svg]
....
{reg: [
{bits: 1, name: 'MML'},
{bits: 1, name: 'MMWP'},
{bits: 1, name: 'RLB'},
{bits: 5, name: 'WPRI'},
{bits: 1, name: 'USEED'},
{bits: 1, name: 'SSEED'},
{bits: 1, name: 'MLPE'},
{bits: 53, name: 'WPRI'},
], config:{lanes: 4, hspace:1024}}
....
The definitions of the SSEED and USEED fields will be furnished by the
forthcoming entropy-source extension, Zkr. Their allocations within
@ -2611,6 +2714,14 @@ The definition of the PMM field will be furnished by the forthcoming
Smmpm extension. Its allocation within `mseccfg` may change prior to the
ratification of that extension.
The Zicfilp extension adds the `MLPE` field in `mseccfg`. When `MLPE` field is
1, Zicfilp extension is enabled in M-mode. When the `MLPE` field is 0, the
Zicfilp extension is not enabled in M-mode and the following rules apply to
M-mode.
* The hart does not update the `ELP` state; it remains as `NO_LP_EXPECTED`.
* The `LPAD` instruction operates as a no-op.
When XLEN=32 only, `mseccfgh` is a 32-bit read/write register that
aliases bits 63:32 of `mseccfg`.
Register `mseccfgh` does not exist when XLEN=64.
@ -2631,7 +2742,7 @@ endif::[]
=== Machine-Level Memory-Mapped Registers
==== Machine Timer Registers (`mtime` and `mtimecmp`)
==== Machine Timer (`mtime` and `mtimecmp`) Registers
Platforms provide a real-time counter, exposed as a memory-mapped
machine-mode read-write register, `mtime`. `mtime` must increment at
@ -2747,8 +2858,9 @@ exception, and performs no other operation.
endif::[]
The EBREAK instruction is used by debuggers to cause control to be
transferred back to a debugging environment. It generates a breakpoint
exception and performs no other operation.
transferred back to a debugging environment.
Unless overridden by an external debug environment, EBREAK raises
a breakpoint exception and performs no other operation.
ifeval::[{note} == true]
[NOTE]
@ -3029,8 +3141,8 @@ endif::[]
=== Physical Memory Attributes
The physical memory map for a complete system includes various address
ranges, some corresponding to memory regions, some to memory-mapped
control registers, and some to vacant holes in the address space. Some
ranges, some corresponding to memory regions and some to memory-mapped
control registers, portions of which might not be accessible. Some
memory regions might not support reads, writes, or execution; some might
not support subword or subblock accesses; some might not support atomic
operations; and some might not support cache coherence or might have
@ -3139,17 +3251,19 @@ peripheral devices will be reported as imprecise bus-error interrupts.
[{ohg-config}] PMAs are not readable by software.
endif::[]
==== Main Memory versus I/O versus Vacant Regions
==== Main Memory versus I/O Regions
The most important characterization of a given memory address range is
whether it holds regular main memory, or I/O devices, or is vacant.
whether it holds regular main memory or I/O devices.
Regular main memory is required to have a number of properties,
specified below, whereas I/O devices can have a much broader range of
attributes. Memory regions that do not fit into regular main memory, for
example, device scratchpad RAMs, are categorized as I/O regions. Vacant
regions are also classified as I/O regions but with attributes
specifying that no accesses are supported.
example, device scratchpad RAMs, are categorized as I/O regions.
NOTE: What previous versions of this specification termed _vacant_ regions are
no longer a distinct category; they are now described as I/O regions that are
not accessible (i.e. lacking read, write, and execute permissions).
Main memory regions that are not accessible are also allowed.
==== Supported Access Type PMAs
@ -3618,6 +3732,7 @@ include::images/bytefield/pmp-rv32.adoc[]
.RV64 PMP configuration CSR layout.
include::images/bytefield/pmp-rv64.adoc[]
The PMP address registers are CSRs named `pmpaddr0`-`pmpaddr63`. Each
PMP address register encodes bits 33-2 of a 34-bit physical address for
RV32, as shown in <<pmpaddr-rv32>>. For RV64,

View file

@ -0,0 +1,10 @@
[[priv-cfi]]
== Control-flow Integrity (CFI)
ifeval::[{RVZicfiss} == false]
{ohg-config}: The Zicfiss extension is not supported.
endif::[]
ifeval::[{RVZicfilp} == false]
{ohg-config}: The Zicfilp extension is not supported.
endif::[]

View file

@ -6,10 +6,10 @@
This document describes the RISC-V privileged architecture tailored for
OpenHW Group {ohg-config}.
[.big]*_Preface to Version 20240326_*
[.big]*_Preface to Version 20240528_*
This document describes the RISC-V privileged architecture. This
release, version 20240213, contains the following versions of the RISC-V ISA
release, version 20240528, contains the following versions of the RISC-V ISA
modules:
[%autowidth,float="center",align="center",cols="^,<,^",options="header",]
@ -33,14 +33,14 @@ _Supervisor ISA_ +
*Hypervisor ISA*
|_1.13_ +
*1.0.0* +
*1.0.0* +
*1.0.0* +
*1.0.0* +
*1.0.0* +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
_1.13_ +
*1.0.0* +
_0.1_ +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
@ -55,7 +55,6 @@ _0.1_ +
*Ratified* +
*Ratified* +
*Ratified* +
_Draft_ +
*Ratified* +
_Draft_ +
*Ratified* +
@ -64,64 +63,20 @@ _Draft_ +
*Ratified* +
*Ratified* +
*Ratified* +
*Ratified* +
*Ratified*
|===
The following changes have been made since version 1.13, which, while
not strictly backwards compatible, are not anticipated to cause software
portability problems in practice:
* The inclusion of all ratified extensions through March 2024.
[.big]*_Preface to Version 20240213_*
This document describes the RISC-V privileged architecture. This
release, version 20240213, contains the following versions of the RISC-V ISA
modules:
[%autowidth,float="center",align="center",cols="^,<,^",options="header",]
|===
|Module |Version |Status
|_Machine ISA_ +
_Supervisor ISA_ +
_Smrnmi Extension_ +
*Svade Extension* +
*Svnapot Extension* +
*Svpbmt Extension* +
*Svinval Extension* +
*Svadu Extension* +
*Hypervisor ISA*
|_1.13_ +
_1.13_ +
_0.1_ +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
*1.0* +
*1.0*
|_Draft_ +
_Draft_ +
_Draft_ +
*Ratified* +
*Ratified* +
*Ratified* +
*Ratified* +
*Ratified* +
*Ratified*
|===
The following changes have been made since version 1.12, which, while
not strictly backwards compatible, are not anticipated to cause software
portability problems in practice:
The following changes have been made since version 1.12 of the Machine and
Supervisor ISAs, which, while not strictly backwards compatible, are not
anticipated to cause software portability problems in practice:
* Redefined `misa`.MXL to be read-only, making MXLEN a constant.
* Added the constraint that SXLEN&#8805;UXLEN.
Additionally, the following compatible changes have been made to the Machine ISA since
version 1.12:
Additionally, the following compatible changes have been
made to the Machine and Supervisor ISAs since version 1.12:
* Transliterated the document from LaTeX into AsciiDoc.
* Defined the `misa`.V field to reflect that the V extension has been
implemented.
* Defined the RV32-only `medelegh` and `hedelegh` CSRs.
@ -131,7 +86,13 @@ implemented.
* Defined hardware error and software check exception codes.
* Specified synchronization requirements when changing the PBMTE fields
in `menvcfg` and `henvcfg`.
* Incorporated Svade and Svadu extension specifications.
* Exposed count-overflow interrups to VS-mode.
Finally, the following clarifications and document improvments have been made
since the last document release:
* Transliterated the document from LaTeX into AsciiDoc.
* Included all ratified extensions through March 2024.
* Clarified that "platform- or custom-use" interrupts are actually
"platform-use interrupts", where the platform can choose to make some custom.
* Clarified semantics of explicit accesses to CSRs wider than XLEN bits.
@ -144,7 +105,7 @@ in `menvcfg` and `henvcfg`.
be set to a nonzero value but sometimes not.
* Clarified exception behavior of unimplemented or inaccessible CSRs.
* Clarified that Svpbmt allows implementations to override additional PMAs.
* Exposed count-overflow interrups to VS-mode.
* Replaced the concept of vacant memory regions with inaccessible memory or I/O regions.
[.big]*_Preface to Version 20211203_*

View file

@ -2,7 +2,7 @@
= The RISC-V Instruction Set Manual for CV32A65X: Volume II: Privileged Architecture
:description: Volume II - Privileged Architecture
:company: RISC-V.org
:revnumber: 20240411
:revnumber: 20240528
//:revremark: Pre-release version
//development: assume everything can change
//stable: assume everything could change
@ -32,7 +32,8 @@
:bibtex-throw: false
:icons: font
:lang: en
:listing-caption: Example
:example-caption: Example
:listing-caption: Listing
:sectnums:
:sectnumlevels: 5
:toc: left
@ -47,6 +48,8 @@ endif::[]
:chapter-refsig: Chapter
:section-refsig: Section
:appendix-refsig: Appendix
// Uncomment :data-uri: if your eBook reader is not capable of rendering
// embedded images. One known affected device is PocketBook InkPad 3.
:data-uri:
:hide-uri-scheme:
:stem: latexmath
@ -101,6 +104,7 @@ include::supervisor.adoc[]
include::sstc.adoc[]
include::sscofpmf.adoc[]
include::hypervisor.adoc[]
include::priv-cfi.adoc[]
include::priv-insns.adoc[]
include::priv-history.adoc[]
include::bibliography.adoc[]

View file

@ -1,5 +1,5 @@
[[smcdeleg]]
== "Smcdeleg" Counter Delegation Extension, Version 1.0.0
== "Smcdeleg" Counter Delegation Extension, Version 1.0
ifeval::[{RVZsmcdeleg} == false]
{ohg-config}: This extension is not supported.

View file

@ -1,5 +1,5 @@
[[smcntrpmf]]
== "Smcntrpmf" Cycle and Instret Privilege Mode Filtering, Version 1.0.0
== "Smcntrpmf" Cycle and Instret Privilege Mode Filtering, Version 1.0
ifeval::[{RVZsmcntrpmf} == false]
{ohg-config}: This extension is not supported.

View file

@ -1,5 +1,5 @@
[[smepmp]]
== "Smepmp" Extension for PMP Enhancements for memory access and execution prevention in Machine mode, Version 1.0.0
== "Smepmp" Extension for PMP Enhancements for memory access and execution prevention in Machine mode, Version 1.0
ifeval::[{RVZsmepmp} == false]
{ohg-config}: This extension is not supported.

View file

@ -1,5 +1,5 @@
[[smstateen]]
== "Smstateen/Ssstateen" Extensions, Version 1.0.0
== "Smstateen/Ssstateen" Extensions, Version 1.0
ifeval::[{RVZsmstateen} == false]
{ohg-config}: This extension is not supported.

View file

@ -1,5 +1,5 @@
[[Sscofpmf]]
== "Sscofpmf" Extension for Count Overflow and Mode-Based Filtering, Version 1.0.0
== "Sscofpmf" Extension for Count Overflow and Mode-Based Filtering, Version 1.0
ifeval::[{RVZsscofpmf} == false]
{ohg-config}: This extension is not supported.

View file

@ -1,5 +1,5 @@
[[Sstc]]
== "Sstc" Extension for Supervisor-mode Timer Interrupts, Version 1.0.0
== "Sstc" Extension for Supervisor-mode Timer Interrupts, Version 1.0
ifeval::[{RVZsstc} == false]
{ohg-config}: This extension is not supported.