Skip to content

Commit

Permalink
Define the RV32-only medelegh CSR
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman committed Sep 1, 2023
1 parent ee240a4 commit 4c9a535
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/images/bytefield/medeleg.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
(def right-margin 100)
(def boxes-per-row 32)
(draw-box "MXLEN-1" {:span 16 :text-anchor "start" :borders {}})
(draw-box "63" {:span 16 :text-anchor "start" :borders {}})
(draw-box "0" {:span 16 :text-anchor "end" :borders {}})
(draw-box "Synchronous Exceptions" {:font-size 18 :span 18 :text-anchor "end" :borders {:top :border-unrelated :bottom :border-unrelated :left :border-unrelated}})
(draw-box (text "(WARL)" {:font-weight "bold"}) {:font-size 18 :span 14 :text-anchor "start" :borders {:top :border-unrelated :bottom :border-unrelated :right :border-unrelated}})
(draw-box "MXLEN" {:font-size 24 :span 32 :borders {}})
----
(draw-box "64" {:font-size 24 :span 32 :borders {}})
----
9 changes: 7 additions & 2 deletions src/machine.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,9 @@ appropriate level with the MRET instruction
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`) and machine interrupt delegation
register (`mideleg`) are MXLEN-bit read/write registers.
delegation register (`medeleg`) is a 64-bit read/write register.
The machine interrupt delegation register (`mideleg`) is an MXLEN-bit
read/write register.

In systems with S-mode, the `medeleg` and `mideleg` registers must
exist, and setting a bit in `medeleg` or `mideleg` will delegate the
Expand Down Expand Up @@ -1203,6 +1204,10 @@ bit position equal to the value returned in the `mcause` register (i.e.,
setting bit 8 allows user-mode environment calls to be delegated to a
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.

.Machine Interrupt Delegation Register `mideleg`.
include::images/bytefield/mideleg.adoc[]

Expand Down
1 change: 1 addition & 0 deletions src/priv-preface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ version 1.12:

* Defined the `misa`.V field to reflect that the V extension has been
implemented.
* Defined the RV32-only `medelegh` CSR.
* Clarified semantics of explicit accesses to CSRs wider than XLEN bits.
* Clarified that MXLEN≥SXLEN, and added the constraint that
SXLEN≥UXLEN.
Expand Down

0 comments on commit 4c9a535

Please sign in to comment.