forked from mit-plv/riscv-semantics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSRField.hs
57 lines (54 loc) · 1.92 KB
/
CSRField.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
module Spec.CSRField where
import Prelude
data CSRField = MXL | Extensions | -- misa
SXL | UXL | TSR | TW | TVM | MXR | SUM | MPRV | XS | FS | MPP |
SPP | MPIE | SPIE | UPIE | MIE | SIE | UIE | SD | -- mstatus (and sstatus)
MTVecBase | MTVecMode | -- mtvec
MEDeleg | -- medeleg
MIDeleg | -- mideleg
MEIP | SEIP | UEIP | MTIP | STIP | UTIP | MSIP | SSIP | USIP | -- mip
MEIE | SEIE | UEIE | MTIE | STIE | UTIE | MSIE | SSIE | USIE | -- mie
MCycle | -- mcycle
MInstRet | -- minstret
MHPM | MIR | MTM | MCY | -- mcounteren
-- TODO: mcountinhibit
MScratch | -- mscratch
MEPC | -- mepc
MCauseInterrupt | MCauseCode | -- mcause
MTVal | -- mtval
-- Supervisor-level CSRs:
STVecBase | STVecMode | -- stvec
SHPM | SIR | STM | SCY |
SScratch | -- sscratch
SEPC | -- sepc
SCauseInterrupt | SCauseCode | -- scause
STVal | -- stval
MODE | ASID | PPN | -- satp
FFlags | FRM -- fflags, frm, fcsr
deriving (Ord, Eq, Show)
-- WPRI is implicit in a field's lack of existence here.
data FieldType = RO | RW | WLRL | WARL deriving (Show, Eq)
fieldType MXL = WARL
fieldType Extensions = WARL
fieldType XS = RO
fieldType SD = RO
fieldType MTVecBase = WARL
fieldType MTVecMode = WARL
fieldType MEDeleg = WARL
fieldType MIDeleg = WARL
fieldType MHPM = WARL
fieldType MIR = WARL
fieldType MTM = WARL
fieldType MCY = WARL
fieldType MEPC = WARL
fieldType MCauseCode = WLRL
fieldType MTVal = WARL
fieldType STVecBase = WARL
fieldType STVecMode = WARL
fieldType SEPC = WARL
fieldType SCauseCode = WLRL
fieldType STVal = WARL
fieldType MODE = WARL
fieldType ASID = WARL
fieldType PPN = WARL
fieldType _ = RW