coreblocks 0.2026.7.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coreblocks/__init__.py +0 -0
- coreblocks/arch/__init__.py +4 -0
- coreblocks/arch/csr_address.py +588 -0
- coreblocks/arch/isa.py +286 -0
- coreblocks/arch/isa_consts.py +319 -0
- coreblocks/arch/optypes.py +204 -0
- coreblocks/backend/__init__.py +0 -0
- coreblocks/backend/announcement.py +61 -0
- coreblocks/backend/retirement.py +358 -0
- coreblocks/cache/__init__.py +0 -0
- coreblocks/cache/icache.py +364 -0
- coreblocks/cache/iface.py +42 -0
- coreblocks/cache/refiller.py +107 -0
- coreblocks/core.py +245 -0
- coreblocks/core_structs/__init__.py +0 -0
- coreblocks/core_structs/crat.py +493 -0
- coreblocks/core_structs/rat.py +57 -0
- coreblocks/core_structs/rf.py +132 -0
- coreblocks/core_structs/rob.py +187 -0
- coreblocks/frontend/__init__.py +1 -0
- coreblocks/frontend/bpu/__init__.py +0 -0
- coreblocks/frontend/bpu/bpu.py +48 -0
- coreblocks/frontend/decoder/__init__.py +0 -0
- coreblocks/frontend/decoder/decode_stage.py +154 -0
- coreblocks/frontend/decoder/instr_decoder.py +357 -0
- coreblocks/frontend/decoder/instr_description.py +230 -0
- coreblocks/frontend/decoder/rvc.py +375 -0
- coreblocks/frontend/fetch/__init__.py +0 -0
- coreblocks/frontend/fetch/fetch.py +685 -0
- coreblocks/frontend/fetch_addr_unit.py +73 -0
- coreblocks/frontend/frontend.py +172 -0
- coreblocks/frontend/frontend_params.py +26 -0
- coreblocks/frontend/ftq.py +242 -0
- coreblocks/frontend/stall_controller.py +113 -0
- coreblocks/func_blocks/__init__.py +0 -0
- coreblocks/func_blocks/csr/csr_protocol.py +18 -0
- coreblocks/func_blocks/csr/csr_unit.py +281 -0
- coreblocks/func_blocks/fu/__init__.py +0 -0
- coreblocks/func_blocks/fu/alu.py +269 -0
- coreblocks/func_blocks/fu/common/__init__.py +5 -0
- coreblocks/func_blocks/fu/common/fifo_rs.py +42 -0
- coreblocks/func_blocks/fu/common/fu_decoder.py +107 -0
- coreblocks/func_blocks/fu/common/func_base.py +52 -0
- coreblocks/func_blocks/fu/common/rs.py +189 -0
- coreblocks/func_blocks/fu/common/rs_func_block.py +135 -0
- coreblocks/func_blocks/fu/div_unit.py +132 -0
- coreblocks/func_blocks/fu/division/common.py +15 -0
- coreblocks/func_blocks/fu/division/long_division.py +206 -0
- coreblocks/func_blocks/fu/exception.py +108 -0
- coreblocks/func_blocks/fu/fpu/__init__.py +0 -0
- coreblocks/func_blocks/fu/fpu/close_path.py +180 -0
- coreblocks/func_blocks/fu/fpu/far_path.py +323 -0
- coreblocks/func_blocks/fu/fpu/float_to_int.py +214 -0
- coreblocks/func_blocks/fu/fpu/fpu_add_sub.py +287 -0
- coreblocks/func_blocks/fu/fpu/fpu_class.py +114 -0
- coreblocks/func_blocks/fu/fpu/fpu_common.py +169 -0
- coreblocks/func_blocks/fu/fpu/fpu_comp.py +134 -0
- coreblocks/func_blocks/fu/fpu/fpu_error_module.py +178 -0
- coreblocks/func_blocks/fu/fpu/fpu_mul.py +263 -0
- coreblocks/func_blocks/fu/fpu/fpu_qsf.py +122 -0
- coreblocks/func_blocks/fu/fpu/fpu_rounding_module.py +117 -0
- coreblocks/func_blocks/fu/fpu/fpu_sign_injection.py +88 -0
- coreblocks/func_blocks/fu/fpu/int_to_float.py +132 -0
- coreblocks/func_blocks/fu/fpu/lza.py +105 -0
- coreblocks/func_blocks/fu/fpu/otfc.py +126 -0
- coreblocks/func_blocks/fu/fpu/qsf_tables.py +21 -0
- coreblocks/func_blocks/fu/jumpbranch.py +259 -0
- coreblocks/func_blocks/fu/lsu/__init__.py +0 -0
- coreblocks/func_blocks/fu/lsu/dummyLsu.py +214 -0
- coreblocks/func_blocks/fu/lsu/lsu_atomic_wrapper.py +225 -0
- coreblocks/func_blocks/fu/lsu/lsu_requester.py +184 -0
- coreblocks/func_blocks/fu/lsu/pma.py +74 -0
- coreblocks/func_blocks/fu/mul_unit.py +210 -0
- coreblocks/func_blocks/fu/priv.py +288 -0
- coreblocks/func_blocks/fu/shift_unit.py +108 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/__init__.py +0 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/common.py +73 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/fast_recursive.py +134 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/pipelined.py +145 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/sequence.py +154 -0
- coreblocks/func_blocks/fu/unsigned_multiplication/shift.py +45 -0
- coreblocks/func_blocks/fu/zbc.py +233 -0
- coreblocks/func_blocks/fu/zbkx.py +85 -0
- coreblocks/func_blocks/fu/zbs.py +116 -0
- coreblocks/func_blocks/instruction_metrics.py +37 -0
- coreblocks/func_blocks/interface/__init__.py +0 -0
- coreblocks/func_blocks/interface/func_blocks_unifier.py +34 -0
- coreblocks/func_blocks/interface/func_protocols.py +21 -0
- coreblocks/gen_verilog.py +165 -0
- coreblocks/interface/keys.py +168 -0
- coreblocks/interface/layouts.py +954 -0
- coreblocks/interface/views.py +65 -0
- coreblocks/params/__init__.py +5 -0
- coreblocks/params/configurations.py +133 -0
- coreblocks/params/core_configuration.py +223 -0
- coreblocks/params/fu_params.py +128 -0
- coreblocks/params/genparams.py +175 -0
- coreblocks/params/icache_params.py +59 -0
- coreblocks/params/instr.py +250 -0
- coreblocks/params/vmem_params.py +100 -0
- coreblocks/peripherals/__init__.py +0 -0
- coreblocks/peripherals/axi_lite.py +339 -0
- coreblocks/peripherals/bus_adapter.py +279 -0
- coreblocks/peripherals/wishbone.py +533 -0
- coreblocks/priv/__init__.py +0 -0
- coreblocks/priv/csr/__init__.py +0 -0
- coreblocks/priv/csr/aliased.py +101 -0
- coreblocks/priv/csr/csr_instances.py +596 -0
- coreblocks/priv/csr/csr_register.py +286 -0
- coreblocks/priv/csr/double_counter.py +78 -0
- coreblocks/priv/csr/double_shadow.py +100 -0
- coreblocks/priv/csr/shadow.py +141 -0
- coreblocks/priv/pmp.py +124 -0
- coreblocks/priv/traps/__init__.py +0 -0
- coreblocks/priv/traps/exception.py +135 -0
- coreblocks/priv/traps/instr_counter.py +51 -0
- coreblocks/priv/traps/interrupt_controller.py +402 -0
- coreblocks/priv/vmem/__init__.py +2 -0
- coreblocks/priv/vmem/iface.py +15 -0
- coreblocks/priv/vmem/tlb.py +658 -0
- coreblocks/priv/vmem/translation.py +224 -0
- coreblocks/priv/vmem/walker.py +273 -0
- coreblocks/scheduler/__init__.py +0 -0
- coreblocks/scheduler/scheduler.py +593 -0
- coreblocks/scheduler/wakeup_select.py +62 -0
- coreblocks/socks/clint.py +76 -0
- coreblocks/socks/peripheral.py +68 -0
- coreblocks/socks/plic.py +188 -0
- coreblocks/socks/socks.py +100 -0
- coreblocks-0.2026.7.3.dist-info/METADATA +45 -0
- coreblocks-0.2026.7.3.dist-info/RECORD +137 -0
- coreblocks-0.2026.7.3.dist-info/WHEEL +5 -0
- coreblocks-0.2026.7.3.dist-info/entry_points.txt +2 -0
- coreblocks-0.2026.7.3.dist-info/licenses/LICENSE +23 -0
- coreblocks-0.2026.7.3.dist-info/scm_file_list.json +315 -0
- coreblocks-0.2026.7.3.dist-info/scm_version.json +8 -0
- coreblocks-0.2026.7.3.dist-info/top_level.txt +1 -0
coreblocks/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
from collections.abc import Set
|
|
2
|
+
from amaranth.lib.enum import IntEnum, unique
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"CSRAddress",
|
|
6
|
+
"MstatusFieldOffsets",
|
|
7
|
+
"MenvcfgFieldOffsets",
|
|
8
|
+
"CounterEnableFieldOffsets",
|
|
9
|
+
"sstatus_field_subset",
|
|
10
|
+
"senvcfg_field_subset",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@unique
|
|
15
|
+
class CSRAddress(IntEnum, shape=12):
|
|
16
|
+
# Unprivileged Floating-Point CSRs
|
|
17
|
+
FFLAGS = 0x001 # Floating-Point Accrued Exceptions
|
|
18
|
+
FRM = 0x002 # Floating-Point Dynamic Rounding Mode
|
|
19
|
+
FCSR = 0x003 # Floating-Point Control and Status Register (`frm` +`fflags`)
|
|
20
|
+
|
|
21
|
+
# Unprivileged Zicfiss extension CSR
|
|
22
|
+
SSP = 0x011 # Shadow Stack Pointer
|
|
23
|
+
|
|
24
|
+
# Unprivileged Counter/Timers
|
|
25
|
+
CYCLE = 0xC00 # Cycle counter for RDCYCLE instruction
|
|
26
|
+
TIME = 0xC01 # Timer for RDTIME instruction
|
|
27
|
+
INSTRET = 0xC02 # Instructions-retired counter for RDINSTRET instruction
|
|
28
|
+
HPMCOUNTER3 = 0xC03 # Performance-monitoring counter
|
|
29
|
+
HPMCOUNTER4 = 0xC04 # Performance-monitoring counter
|
|
30
|
+
HPMCOUNTER5 = 0xC05 # Performance-monitoring counter
|
|
31
|
+
HPMCOUNTER6 = 0xC06 # Performance-monitoring counter
|
|
32
|
+
HPMCOUNTER7 = 0xC07 # Performance-monitoring counter
|
|
33
|
+
HPMCOUNTER8 = 0xC08 # Performance-monitoring counter
|
|
34
|
+
HPMCOUNTER9 = 0xC09 # Performance-monitoring counter
|
|
35
|
+
HPMCOUNTER10 = 0xC0A # Performance-monitoring counter
|
|
36
|
+
HPMCOUNTER11 = 0xC0B # Performance-monitoring counter
|
|
37
|
+
HPMCOUNTER12 = 0xC0C # Performance-monitoring counter
|
|
38
|
+
HPMCOUNTER13 = 0xC0D # Performance-monitoring counter
|
|
39
|
+
HPMCOUNTER14 = 0xC0E # Performance-monitoring counter
|
|
40
|
+
HPMCOUNTER15 = 0xC0F # Performance-monitoring counter
|
|
41
|
+
HPMCOUNTER16 = 0xC10 # Performance-monitoring counter
|
|
42
|
+
HPMCOUNTER17 = 0xC11 # Performance-monitoring counter
|
|
43
|
+
HPMCOUNTER18 = 0xC12 # Performance-monitoring counter
|
|
44
|
+
HPMCOUNTER19 = 0xC13 # Performance-monitoring counter
|
|
45
|
+
HPMCOUNTER20 = 0xC14 # Performance-monitoring counter
|
|
46
|
+
HPMCOUNTER21 = 0xC15 # Performance-monitoring counter
|
|
47
|
+
HPMCOUNTER22 = 0xC16 # Performance-monitoring counter
|
|
48
|
+
HPMCOUNTER23 = 0xC17 # Performance-monitoring counter
|
|
49
|
+
HPMCOUNTER24 = 0xC18 # Performance-monitoring counter
|
|
50
|
+
HPMCOUNTER25 = 0xC19 # Performance-monitoring counter
|
|
51
|
+
HPMCOUNTER26 = 0xC1A # Performance-monitoring counter
|
|
52
|
+
HPMCOUNTER27 = 0xC1B # Performance-monitoring counter
|
|
53
|
+
HPMCOUNTER28 = 0xC1C # Performance-monitoring counter
|
|
54
|
+
HPMCOUNTER29 = 0xC1D # Performance-monitoring counter
|
|
55
|
+
HPMCOUNTER30 = 0xC1E # Performance-monitoring counter
|
|
56
|
+
HPMCOUNTER31 = 0xC1F # Performance-monitoring counter
|
|
57
|
+
CYCLEH = 0xC80 # Upper 32 bits of `cycle`, RV32 only
|
|
58
|
+
TIMEH = 0xC81 # Upper 32 bits of `time`, RV32 only
|
|
59
|
+
INSTRETH = 0xC82 # Upper 32 bits of `instret`, RV32 only
|
|
60
|
+
HPMCOUNTER3H = 0xC83 # Upper 32 bits of `hpmcounter3`, RV32 only
|
|
61
|
+
HPMCOUNTER4H = 0xC84 # Upper 32 bits of `hpmcounter4`, RV32 only
|
|
62
|
+
HPMCOUNTER5H = 0xC85 # Upper 32 bits of `hpmcounter5`, RV32 only
|
|
63
|
+
HPMCOUNTER6H = 0xC86 # Upper 32 bits of `hpmcounter6`, RV32 only
|
|
64
|
+
HPMCOUNTER7H = 0xC87 # Upper 32 bits of `hpmcounter7`, RV32 only
|
|
65
|
+
HPMCOUNTER8H = 0xC88 # Upper 32 bits of `hpmcounter8`, RV32 only
|
|
66
|
+
HPMCOUNTER9H = 0xC89 # Upper 32 bits of `hpmcounter9`, RV32 only
|
|
67
|
+
HPMCOUNTER10H = 0xC8A # Upper 32 bits of `hpmcounter10`, RV32 only
|
|
68
|
+
HPMCOUNTER11H = 0xC8B # Upper 32 bits of `hpmcounter11`, RV32 only
|
|
69
|
+
HPMCOUNTER12H = 0xC8C # Upper 32 bits of `hpmcounter12`, RV32 only
|
|
70
|
+
HPMCOUNTER13H = 0xC8D # Upper 32 bits of `hpmcounter13`, RV32 only
|
|
71
|
+
HPMCOUNTER14H = 0xC8E # Upper 32 bits of `hpmcounter14`, RV32 only
|
|
72
|
+
HPMCOUNTER15H = 0xC8F # Upper 32 bits of `hpmcounter15`, RV32 only
|
|
73
|
+
HPMCOUNTER16H = 0xC90 # Upper 32 bits of `hpmcounter16`, RV32 only
|
|
74
|
+
HPMCOUNTER17H = 0xC91 # Upper 32 bits of `hpmcounter17`, RV32 only
|
|
75
|
+
HPMCOUNTER18H = 0xC92 # Upper 32 bits of `hpmcounter18`, RV32 only
|
|
76
|
+
HPMCOUNTER19H = 0xC93 # Upper 32 bits of `hpmcounter19`, RV32 only
|
|
77
|
+
HPMCOUNTER20H = 0xC94 # Upper 32 bits of `hpmcounter20`, RV32 only
|
|
78
|
+
HPMCOUNTER21H = 0xC95 # Upper 32 bits of `hpmcounter21`, RV32 only
|
|
79
|
+
HPMCOUNTER22H = 0xC96 # Upper 32 bits of `hpmcounter22`, RV32 only
|
|
80
|
+
HPMCOUNTER23H = 0xC97 # Upper 32 bits of `hpmcounter23`, RV32 only
|
|
81
|
+
HPMCOUNTER24H = 0xC98 # Upper 32 bits of `hpmcounter24`, RV32 only
|
|
82
|
+
HPMCOUNTER25H = 0xC99 # Upper 32 bits of `hpmcounter25`, RV32 only
|
|
83
|
+
HPMCOUNTER26H = 0xC9A # Upper 32 bits of `hpmcounter26`, RV32 only
|
|
84
|
+
HPMCOUNTER27H = 0xC9B # Upper 32 bits of `hpmcounter27`, RV32 only
|
|
85
|
+
HPMCOUNTER28H = 0xC9C # Upper 32 bits of `hpmcounter28`, RV32 only
|
|
86
|
+
HPMCOUNTER29H = 0xC9D # Upper 32 bits of `hpmcounter29`, RV32 only
|
|
87
|
+
HPMCOUNTER30H = 0xC9E # Upper 32 bits of `hpmcounter30`, RV32 only
|
|
88
|
+
HPMCOUNTER31H = 0xC9F # Upper 32 bits of `hpmcounter31`, RV32 only
|
|
89
|
+
|
|
90
|
+
# Supervisor Trap Setup
|
|
91
|
+
SSTATUS = 0x100 # Supervisor status register
|
|
92
|
+
SIE = 0x104 # Supervisor interrupt-enable register
|
|
93
|
+
STVEC = 0x105 # Supervisor trap handler base address
|
|
94
|
+
SCOUNTEREN = 0x106 # Supervisor counter enable
|
|
95
|
+
|
|
96
|
+
# Supervisor Configuration
|
|
97
|
+
SENVCFG = 0x10A # Supervisor environment configuration register
|
|
98
|
+
|
|
99
|
+
# Supervisor Counter Setup
|
|
100
|
+
SCOUNTINHIBIT = 0x120 # Supervisor counter-inhibit register
|
|
101
|
+
|
|
102
|
+
# Supervisor Trap Handling
|
|
103
|
+
SSCRATCH = 0x140 # Scratch register for supervisor trap handlers
|
|
104
|
+
SEPC = 0x141 # Supervisor exception program counter
|
|
105
|
+
SCAUSE = 0x142 # Supervisor trap cause
|
|
106
|
+
STVAL = 0x143 # Supervisor bad address or instruction
|
|
107
|
+
SIP = 0x144 # Supervisor interrupt pending
|
|
108
|
+
SCOUNTOVF = 0xDA0 # Supervisor count overflow
|
|
109
|
+
|
|
110
|
+
# Supervisor Protection and Translation
|
|
111
|
+
SATP = 0x180 # Supervisor address translation and protection
|
|
112
|
+
|
|
113
|
+
# Debug/Trace Registers
|
|
114
|
+
SCONTEXT = 0x5A8 # Supervisor-mode context register
|
|
115
|
+
|
|
116
|
+
# Supervisor State Enable Registers
|
|
117
|
+
SSTATEEN0 = 0x10C # Supervisor State Enable 0 Register
|
|
118
|
+
SSTATEEN1 = 0x10D # Supervisor State Enable 1 Register
|
|
119
|
+
SSTATEEN2 = 0x10E # Supervisor State Enable 2 Register
|
|
120
|
+
SSTATEEN3 = 0x10F # Supervisor State Enable 3 Register
|
|
121
|
+
|
|
122
|
+
# Hypervisor Trap Setup
|
|
123
|
+
HSTATUS = 0x600 # Hypervisor status register
|
|
124
|
+
HEDELEG = 0x602 # Hypervisor exception delegation register
|
|
125
|
+
HIDELEG = 0x603 # Hypervisor interrupt delegation register
|
|
126
|
+
HIE = 0x604 # Hypervisor interrupt-enable register
|
|
127
|
+
HCOUNTEREN = 0x606 # Hypervisor counter enable
|
|
128
|
+
HGEIE = 0x607 # Hypervisor guest external interrupt-enable register
|
|
129
|
+
HEDELEGH = 0x612 # Upper 32 bits of `hedeleg`, RV32 only
|
|
130
|
+
|
|
131
|
+
# Hypervisor Trap Handling
|
|
132
|
+
HTVAL = 0x643 # Hypervisor bad guest physical address
|
|
133
|
+
HIP = 0x644 # Hypervisor interrupt pending
|
|
134
|
+
HVIP = 0x645 # Hypervisor virtual interrupt pending
|
|
135
|
+
HTINST = 0x64A # Hypervisor trap instruction (transformed)
|
|
136
|
+
HGEIP = 0xE12 # Hypervisor guest external interrupt pending
|
|
137
|
+
|
|
138
|
+
# Hypervisor Configuration
|
|
139
|
+
HENVCFG = 0x60A # Hypervisor environment configuration register
|
|
140
|
+
HENVCFGH = 0x61A # Upper 32 bits of `henvcfg`, RV32 only
|
|
141
|
+
|
|
142
|
+
# Hypervisor Protection and Translation
|
|
143
|
+
HGATP = 0x680 # Hypervisor guest address translation and protection
|
|
144
|
+
|
|
145
|
+
# Debug/Trace Registers
|
|
146
|
+
HCONTEXT = 0x6A8 # Hypervisor-mode context register
|
|
147
|
+
|
|
148
|
+
# Hypervisor Counter/Timer Virtualization Registers
|
|
149
|
+
HTIMEDELTA = 0x605 # Delta for VS/VU-mode timer
|
|
150
|
+
HTIMEDELTAH = 0x615 # Upper 32 bits of `htimedelta`, RV32 only
|
|
151
|
+
|
|
152
|
+
# Hypervisor State Enable Registers
|
|
153
|
+
HSTATEEN0 = 0x60C # Hypervisor State Enable 0 Register
|
|
154
|
+
HSTATEEN1 = 0x60D # Hypervisor State Enable 1 Register
|
|
155
|
+
HSTATEEN2 = 0x60E # Hypervisor State Enable 2 Register
|
|
156
|
+
HSTATEEN3 = 0x60F # Hypervisor State Enable 3 Register
|
|
157
|
+
HSTATEEN0H = 0x61C # Upper 32 bits of Hypervisor State Enable 0 Register, RV32 only
|
|
158
|
+
HSTATEEN1H = 0x61D # Upper 32 bits of Hypervisor State Enable 1 Register, RV32 only
|
|
159
|
+
HSTATEEN2H = 0x61E # Upper 32 bits of Hypervisor State Enable 2 Register, RV32 only
|
|
160
|
+
HSTATEEN3H = 0x61F # Upper 32 bits of Hypervisor State Enable 3 Register, RV32 only
|
|
161
|
+
|
|
162
|
+
# Virtual Supervisor Registers
|
|
163
|
+
VSSTATUS = 0x200 # Virtual supervisor status register
|
|
164
|
+
VSIE = 0x204 # Virtual supervisor interrupt-enable register
|
|
165
|
+
VSTVEC = 0x205 # Virtual supervisor trap handler base address
|
|
166
|
+
VSSCRATCH = 0x240 # Virtual supervisor scratch register
|
|
167
|
+
VSEPC = 0x241 # Virtual supervisor exception program counter
|
|
168
|
+
VSCAUSE = 0x242 # Virtual supervisor trap cause
|
|
169
|
+
VSTVAL = 0x243 # Virtual supervisor bad address or instruction
|
|
170
|
+
VSIP = 0x244 # Virtual supervisor interrupt pending
|
|
171
|
+
VSATP = 0x280 # Virtual supervisor address translation and protection
|
|
172
|
+
|
|
173
|
+
# Machine Information Registers
|
|
174
|
+
MVENDORID = 0xF11 # Vendor ID
|
|
175
|
+
MARCHID = 0xF12 # Architecture ID
|
|
176
|
+
MIMPID = 0xF13 # Implementation ID
|
|
177
|
+
MHARTID = 0xF14 # Hardware thread ID
|
|
178
|
+
MCONFIGPTR = 0xF15 # Pointer to configuration data structure
|
|
179
|
+
|
|
180
|
+
# Machine Trap Setup
|
|
181
|
+
MSTATUS = 0x300 # Machine status register
|
|
182
|
+
MISA = 0x301 # ISA and extension
|
|
183
|
+
MEDELEG = 0x302 # Machine exception delegation register
|
|
184
|
+
MIDELEG = 0x303 # Machine interrupt delegation register
|
|
185
|
+
MIE = 0x304 # Machine interrupt-enable register
|
|
186
|
+
MTVEC = 0x305 # Machine trap-handler base address
|
|
187
|
+
MCOUNTEREN = 0x306 # Machine counter enable
|
|
188
|
+
MSTATUSH = 0x310 # Additional machine status register, RV32 only
|
|
189
|
+
MEDELEGH = 0x312 # Upper 32 bits of `medeleg`, RV32 only
|
|
190
|
+
|
|
191
|
+
# Machine Trap Handling
|
|
192
|
+
MSCRATCH = 0x340 # Scratch register for machine trap handlers
|
|
193
|
+
MEPC = 0x341 # Machine exception program counter
|
|
194
|
+
MCAUSE = 0x342 # Machine trap cause
|
|
195
|
+
MTVAL = 0x343 # Machine bad address or instruction
|
|
196
|
+
MIP = 0x344 # Machine interrupt pending
|
|
197
|
+
MTINST = 0x34A # Machine trap instruction (transformed)
|
|
198
|
+
MTVAL2 = 0x34B # Machine bad guest physical address
|
|
199
|
+
|
|
200
|
+
# Machine Configuration
|
|
201
|
+
MENVCFG = 0x30A # Machine environment configuration register
|
|
202
|
+
MENVCFGH = 0x31A # Upper 32 bits of `menvcfg`, RV32 only
|
|
203
|
+
MSECCFG = 0x747 # Machine security configuration register
|
|
204
|
+
MSECCFGH = 0x757 # Upper 32 bits of `mseccfg`, RV32 only
|
|
205
|
+
|
|
206
|
+
# Machine Memory Protection
|
|
207
|
+
PMPCFG0 = 0x3A0 # Physical memory protection configuration
|
|
208
|
+
PMPCFG1 = 0x3A1 # Physical memory protection configuration, RV32 only
|
|
209
|
+
PMPCFG2 = 0x3A2 # Physical memory protection configuration
|
|
210
|
+
PMPCFG3 = 0x3A3 # Physical memory protection configuration, RV32 only
|
|
211
|
+
PMPCFG4 = 0x3A4 # Physical memory protection configuration
|
|
212
|
+
PMPCFG5 = 0x3A5 # Physical memory protection configuration, RV32 only
|
|
213
|
+
PMPCFG6 = 0x3A6 # Physical memory protection configuration
|
|
214
|
+
PMPCFG7 = 0x3A7 # Physical memory protection configuration, RV32 only
|
|
215
|
+
PMPCFG8 = 0x3A8 # Physical memory protection configuration
|
|
216
|
+
PMPCFG9 = 0x3A9 # Physical memory protection configuration, RV32 only
|
|
217
|
+
PMPCFG10 = 0x3AA # Physical memory protection configuration
|
|
218
|
+
PMPCFG11 = 0x3AB # Physical memory protection configuration, RV32 only
|
|
219
|
+
PMPCFG12 = 0x3AC # Physical memory protection configuration
|
|
220
|
+
PMPCFG13 = 0x3AD # Physical memory protection configuration, RV32 only
|
|
221
|
+
PMPCFG14 = 0x3AE # Physical memory protection configuration
|
|
222
|
+
PMPCFG15 = 0x3AF # Physical memory protection configuration, RV32 only
|
|
223
|
+
PMPADDR0 = 0x3B0 # Physical memory protection address register
|
|
224
|
+
PMPADDR1 = 0x3B1 # Physical memory protection address register
|
|
225
|
+
PMPADDR2 = 0x3B2 # Physical memory protection address register
|
|
226
|
+
PMPADDR3 = 0x3B3 # Physical memory protection address register
|
|
227
|
+
PMPADDR4 = 0x3B4 # Physical memory protection address register
|
|
228
|
+
PMPADDR5 = 0x3B5 # Physical memory protection address register
|
|
229
|
+
PMPADDR6 = 0x3B6 # Physical memory protection address register
|
|
230
|
+
PMPADDR7 = 0x3B7 # Physical memory protection address register
|
|
231
|
+
PMPADDR8 = 0x3B8 # Physical memory protection address register
|
|
232
|
+
PMPADDR9 = 0x3B9 # Physical memory protection address register
|
|
233
|
+
PMPADDR10 = 0x3BA # Physical memory protection address register
|
|
234
|
+
PMPADDR11 = 0x3BB # Physical memory protection address register
|
|
235
|
+
PMPADDR12 = 0x3BC # Physical memory protection address register
|
|
236
|
+
PMPADDR13 = 0x3BD # Physical memory protection address register
|
|
237
|
+
PMPADDR14 = 0x3BE # Physical memory protection address register
|
|
238
|
+
PMPADDR15 = 0x3BF # Physical memory protection address register
|
|
239
|
+
PMPADDR16 = 0x3C0 # Physical memory protection address register
|
|
240
|
+
PMPADDR17 = 0x3C1 # Physical memory protection address register
|
|
241
|
+
PMPADDR18 = 0x3C2 # Physical memory protection address register
|
|
242
|
+
PMPADDR19 = 0x3C3 # Physical memory protection address register
|
|
243
|
+
PMPADDR20 = 0x3C4 # Physical memory protection address register
|
|
244
|
+
PMPADDR21 = 0x3C5 # Physical memory protection address register
|
|
245
|
+
PMPADDR22 = 0x3C6 # Physical memory protection address register
|
|
246
|
+
PMPADDR23 = 0x3C7 # Physical memory protection address register
|
|
247
|
+
PMPADDR24 = 0x3C8 # Physical memory protection address register
|
|
248
|
+
PMPADDR25 = 0x3C9 # Physical memory protection address register
|
|
249
|
+
PMPADDR26 = 0x3CA # Physical memory protection address register
|
|
250
|
+
PMPADDR27 = 0x3CB # Physical memory protection address register
|
|
251
|
+
PMPADDR28 = 0x3CC # Physical memory protection address register
|
|
252
|
+
PMPADDR29 = 0x3CD # Physical memory protection address register
|
|
253
|
+
PMPADDR30 = 0x3CE # Physical memory protection address register
|
|
254
|
+
PMPADDR31 = 0x3CF # Physical memory protection address register
|
|
255
|
+
PMPADDR32 = 0x3D0 # Physical memory protection address register
|
|
256
|
+
PMPADDR33 = 0x3D1 # Physical memory protection address register
|
|
257
|
+
PMPADDR34 = 0x3D2 # Physical memory protection address register
|
|
258
|
+
PMPADDR35 = 0x3D3 # Physical memory protection address register
|
|
259
|
+
PMPADDR36 = 0x3D4 # Physical memory protection address register
|
|
260
|
+
PMPADDR37 = 0x3D5 # Physical memory protection address register
|
|
261
|
+
PMPADDR38 = 0x3D6 # Physical memory protection address register
|
|
262
|
+
PMPADDR39 = 0x3D7 # Physical memory protection address register
|
|
263
|
+
PMPADDR40 = 0x3D8 # Physical memory protection address register
|
|
264
|
+
PMPADDR41 = 0x3D9 # Physical memory protection address register
|
|
265
|
+
PMPADDR42 = 0x3DA # Physical memory protection address register
|
|
266
|
+
PMPADDR43 = 0x3DB # Physical memory protection address register
|
|
267
|
+
PMPADDR44 = 0x3DC # Physical memory protection address register
|
|
268
|
+
PMPADDR45 = 0x3DD # Physical memory protection address register
|
|
269
|
+
PMPADDR46 = 0x3DE # Physical memory protection address register
|
|
270
|
+
PMPADDR47 = 0x3DF # Physical memory protection address register
|
|
271
|
+
PMPADDR48 = 0x3E0 # Physical memory protection address register
|
|
272
|
+
PMPADDR49 = 0x3E1 # Physical memory protection address register
|
|
273
|
+
PMPADDR50 = 0x3E2 # Physical memory protection address register
|
|
274
|
+
PMPADDR51 = 0x3E3 # Physical memory protection address register
|
|
275
|
+
PMPADDR52 = 0x3E4 # Physical memory protection address register
|
|
276
|
+
PMPADDR53 = 0x3E5 # Physical memory protection address register
|
|
277
|
+
PMPADDR54 = 0x3E6 # Physical memory protection address register
|
|
278
|
+
PMPADDR55 = 0x3E7 # Physical memory protection address register
|
|
279
|
+
PMPADDR56 = 0x3E8 # Physical memory protection address register
|
|
280
|
+
PMPADDR57 = 0x3E9 # Physical memory protection address register
|
|
281
|
+
PMPADDR58 = 0x3EA # Physical memory protection address register
|
|
282
|
+
PMPADDR59 = 0x3EB # Physical memory protection address register
|
|
283
|
+
PMPADDR60 = 0x3EC # Physical memory protection address register
|
|
284
|
+
PMPADDR61 = 0x3ED # Physical memory protection address register
|
|
285
|
+
PMPADDR62 = 0x3EE # Physical memory protection address register
|
|
286
|
+
PMPADDR63 = 0x3EF # Physical memory protection address register
|
|
287
|
+
|
|
288
|
+
# Machine State Enable Registers
|
|
289
|
+
MSTATEEN0 = 0x30C # Machine State Enable 0 Register
|
|
290
|
+
MSTATEEN1 = 0x30D # Machine State Enable 1 Register
|
|
291
|
+
MSTATEEN2 = 0x30E # Machine State Enable 2 Register
|
|
292
|
+
MSTATEEN3 = 0x30F # Machine State Enable 3 Register
|
|
293
|
+
MSTATEEN0H = 0x31C # Upper 32 bits of Machine State Enable 0 Register, RV32 only
|
|
294
|
+
MSTATEEN1H = 0x31D # Upper 32 bits of Machine State Enable 1 Register, RV32 only
|
|
295
|
+
MSTATEEN2H = 0x31E # Upper 32 bits of Machine State Enable 2 Register, RV32 only
|
|
296
|
+
MSTATEEN3H = 0x31F # Upper 32 bits of Machine State Enable 3 Register, RV32 only
|
|
297
|
+
|
|
298
|
+
# Machine Non-Maskable Interrupt Handling
|
|
299
|
+
MNSCRATCH = 0x740 # Resumable NMI scratch register
|
|
300
|
+
MNEPC = 0x741 # Resumable NMI program counter
|
|
301
|
+
MNCAUSE = 0x742 # Resumable NMI cause
|
|
302
|
+
MNSTATUS = 0x744 # Resumable NMI status
|
|
303
|
+
|
|
304
|
+
# Machine Counter/Timers
|
|
305
|
+
MCYCLE = 0xB00 # Machine cycle counter
|
|
306
|
+
MINSTRET = 0xB02 # Machine instructions-retired counter
|
|
307
|
+
MHPMCOUNTER3 = 0xB03 # Machine performance-monitoring counter
|
|
308
|
+
MHPMCOUNTER4 = 0xB04 # Machine performance-monitoring counter
|
|
309
|
+
MHPMCOUNTER5 = 0xB05 # Machine performance-monitoring counter
|
|
310
|
+
MHPMCOUNTER6 = 0xB06 # Machine performance-monitoring counter
|
|
311
|
+
MHPMCOUNTER7 = 0xB07 # Machine performance-monitoring counter
|
|
312
|
+
MHPMCOUNTER8 = 0xB08 # Machine performance-monitoring counter
|
|
313
|
+
MHPMCOUNTER9 = 0xB09 # Machine performance-monitoring counter
|
|
314
|
+
MHPMCOUNTER10 = 0xB0A # Machine performance-monitoring counter
|
|
315
|
+
MHPMCOUNTER11 = 0xB0B # Machine performance-monitoring counter
|
|
316
|
+
MHPMCOUNTER12 = 0xB0C # Machine performance-monitoring counter
|
|
317
|
+
MHPMCOUNTER13 = 0xB0D # Machine performance-monitoring counter
|
|
318
|
+
MHPMCOUNTER14 = 0xB0E # Machine performance-monitoring counter
|
|
319
|
+
MHPMCOUNTER15 = 0xB0F # Machine performance-monitoring counter
|
|
320
|
+
MHPMCOUNTER16 = 0xB10 # Machine performance-monitoring counter
|
|
321
|
+
MHPMCOUNTER17 = 0xB11 # Machine performance-monitoring counter
|
|
322
|
+
MHPMCOUNTER18 = 0xB12 # Machine performance-monitoring counter
|
|
323
|
+
MHPMCOUNTER19 = 0xB13 # Machine performance-monitoring counter
|
|
324
|
+
MHPMCOUNTER20 = 0xB14 # Machine performance-monitoring counter
|
|
325
|
+
MHPMCOUNTER21 = 0xB15 # Machine performance-monitoring counter
|
|
326
|
+
MHPMCOUNTER22 = 0xB16 # Machine performance-monitoring counter
|
|
327
|
+
MHPMCOUNTER23 = 0xB17 # Machine performance-monitoring counter
|
|
328
|
+
MHPMCOUNTER24 = 0xB18 # Machine performance-monitoring counter
|
|
329
|
+
MHPMCOUNTER25 = 0xB19 # Machine performance-monitoring counter
|
|
330
|
+
MHPMCOUNTER26 = 0xB1A # Machine performance-monitoring counter
|
|
331
|
+
MHPMCOUNTER27 = 0xB1B # Machine performance-monitoring counter
|
|
332
|
+
MHPMCOUNTER28 = 0xB1C # Machine performance-monitoring counter
|
|
333
|
+
MHPMCOUNTER29 = 0xB1D # Machine performance-monitoring counter
|
|
334
|
+
MHPMCOUNTER30 = 0xB1E # Machine performance-monitoring counter
|
|
335
|
+
MHPMCOUNTER31 = 0xB1F # Machine performance-monitoring counter
|
|
336
|
+
MCYCLEH = 0xB80 # Upper 32 bits of `mcycle`, RV32 only
|
|
337
|
+
MINSTRETH = 0xB82 # Upper 32 bits of `minstret`, RV32 only
|
|
338
|
+
MHPMCOUNTER3H = 0xB83 # Upper 32 bits of `mhpmcounter3`, RV32 only
|
|
339
|
+
MHPMCOUNTER4H = 0xB84 # Upper 32 bits of `mhpmcounter4`, RV32 only
|
|
340
|
+
MHPMCOUNTER5H = 0xB85 # Upper 32 bits of `mhpmcounter5`, RV32 only
|
|
341
|
+
MHPMCOUNTER6H = 0xB86 # Upper 32 bits of `mhpmcounter6`, RV32 only
|
|
342
|
+
MHPMCOUNTER7H = 0xB87 # Upper 32 bits of `mhpmcounter7`, RV32 only
|
|
343
|
+
MHPMCOUNTER8H = 0xB88 # Upper 32 bits of `mhpmcounter8`, RV32 only
|
|
344
|
+
MHPMCOUNTER9H = 0xB89 # Upper 32 bits of `mhpmcounter9`, RV32 only
|
|
345
|
+
MHPMCOUNTER10H = 0xB8A # Upper 32 bits of `mhpmcounter10`, RV32 only
|
|
346
|
+
MHPMCOUNTER11H = 0xB8B # Upper 32 bits of `mhpmcounter11`, RV32 only
|
|
347
|
+
MHPMCOUNTER12H = 0xB8C # Upper 32 bits of `mhpmcounter12`, RV32 only
|
|
348
|
+
MHPMCOUNTER13H = 0xB8D # Upper 32 bits of `mhpmcounter13`, RV32 only
|
|
349
|
+
MHPMCOUNTER14H = 0xB8E # Upper 32 bits of `mhpmcounter14`, RV32 only
|
|
350
|
+
MHPMCOUNTER15H = 0xB8F # Upper 32 bits of `mhpmcounter15`, RV32 only
|
|
351
|
+
MHPMCOUNTER16H = 0xB90 # Upper 32 bits of `mhpmcounter16`, RV32 only
|
|
352
|
+
MHPMCOUNTER17H = 0xB91 # Upper 32 bits of `mhpmcounter17`, RV32 only
|
|
353
|
+
MHPMCOUNTER18H = 0xB92 # Upper 32 bits of `mhpmcounter18`, RV32 only
|
|
354
|
+
MHPMCOUNTER19H = 0xB93 # Upper 32 bits of `mhpmcounter19`, RV32 only
|
|
355
|
+
MHPMCOUNTER20H = 0xB94 # Upper 32 bits of `mhpmcounter20`, RV32 only
|
|
356
|
+
MHPMCOUNTER21H = 0xB95 # Upper 32 bits of `mhpmcounter21`, RV32 only
|
|
357
|
+
MHPMCOUNTER22H = 0xB96 # Upper 32 bits of `mhpmcounter22`, RV32 only
|
|
358
|
+
MHPMCOUNTER23H = 0xB97 # Upper 32 bits of `mhpmcounter23`, RV32 only
|
|
359
|
+
MHPMCOUNTER24H = 0xB98 # Upper 32 bits of `mhpmcounter24`, RV32 only
|
|
360
|
+
MHPMCOUNTER25H = 0xB99 # Upper 32 bits of `mhpmcounter25`, RV32 only
|
|
361
|
+
MHPMCOUNTER26H = 0xB9A # Upper 32 bits of `mhpmcounter26`, RV32 only
|
|
362
|
+
MHPMCOUNTER27H = 0xB9B # Upper 32 bits of `mhpmcounter27`, RV32 only
|
|
363
|
+
MHPMCOUNTER28H = 0xB9C # Upper 32 bits of `mhpmcounter28`, RV32 only
|
|
364
|
+
MHPMCOUNTER29H = 0xB9D # Upper 32 bits of `mhpmcounter29`, RV32 only
|
|
365
|
+
MHPMCOUNTER30H = 0xB9E # Upper 32 bits of `mhpmcounter30`, RV32 only
|
|
366
|
+
MHPMCOUNTER31H = 0xB9F # Upper 32 bits of `mhpmcounter31`, RV32 only
|
|
367
|
+
|
|
368
|
+
# Machine Counter Setup
|
|
369
|
+
MCOUNTINHIBIT = 0x320 # Machine counter-inhibit register
|
|
370
|
+
MHPMEVENT3 = 0x323 # Machine performance-monitoring event selector
|
|
371
|
+
MHPMEVENT4 = 0x324 # Machine performance-monitoring event selector
|
|
372
|
+
MHPMEVENT5 = 0x325 # Machine performance-monitoring event selector
|
|
373
|
+
MHPMEVENT6 = 0x326 # Machine performance-monitoring event selector
|
|
374
|
+
MHPMEVENT7 = 0x327 # Machine performance-monitoring event selector
|
|
375
|
+
MHPMEVENT8 = 0x328 # Machine performance-monitoring event selector
|
|
376
|
+
MHPMEVENT9 = 0x329 # Machine performance-monitoring event selector
|
|
377
|
+
MHPMEVENT10 = 0x32A # Machine performance-monitoring event selector
|
|
378
|
+
MHPMEVENT11 = 0x32B # Machine performance-monitoring event selector
|
|
379
|
+
MHPMEVENT12 = 0x32C # Machine performance-monitoring event selector
|
|
380
|
+
MHPMEVENT13 = 0x32D # Machine performance-monitoring event selector
|
|
381
|
+
MHPMEVENT14 = 0x32E # Machine performance-monitoring event selector
|
|
382
|
+
MHPMEVENT15 = 0x32F # Machine performance-monitoring event selector
|
|
383
|
+
MHPMEVENT16 = 0x330 # Machine performance-monitoring event selector
|
|
384
|
+
MHPMEVENT17 = 0x331 # Machine performance-monitoring event selector
|
|
385
|
+
MHPMEVENT18 = 0x332 # Machine performance-monitoring event selector
|
|
386
|
+
MHPMEVENT19 = 0x333 # Machine performance-monitoring event selector
|
|
387
|
+
MHPMEVENT20 = 0x334 # Machine performance-monitoring event selector
|
|
388
|
+
MHPMEVENT21 = 0x335 # Machine performance-monitoring event selector
|
|
389
|
+
MHPMEVENT22 = 0x336 # Machine performance-monitoring event selector
|
|
390
|
+
MHPMEVENT23 = 0x337 # Machine performance-monitoring event selector
|
|
391
|
+
MHPMEVENT24 = 0x338 # Machine performance-monitoring event selector
|
|
392
|
+
MHPMEVENT25 = 0x339 # Machine performance-monitoring event selector
|
|
393
|
+
MHPMEVENT26 = 0x33A # Machine performance-monitoring event selector
|
|
394
|
+
MHPMEVENT27 = 0x33B # Machine performance-monitoring event selector
|
|
395
|
+
MHPMEVENT28 = 0x33C # Machine performance-monitoring event selector
|
|
396
|
+
MHPMEVENT29 = 0x33D # Machine performance-monitoring event selector
|
|
397
|
+
MHPMEVENT30 = 0x33E # Machine performance-monitoring event selector
|
|
398
|
+
MHPMEVENT31 = 0x33F # Machine performance-monitoring event selector
|
|
399
|
+
MHPMEVENT3H = 0x723 # Upper 32 bits of `mhpmevent3`, RV32 only
|
|
400
|
+
MHPMEVENT4H = 0x724 # Upper 32 bits of `mhpmevent4`, RV32 only
|
|
401
|
+
MHPMEVENT5H = 0x725 # Upper 32 bits of `mhpmevent5`, RV32 only
|
|
402
|
+
MHPMEVENT6H = 0x726 # Upper 32 bits of `mhpmevent6`, RV32 only
|
|
403
|
+
MHPMEVENT7H = 0x727 # Upper 32 bits of `mhpmevent7`, RV32 only
|
|
404
|
+
MHPMEVENT8H = 0x728 # Upper 32 bits of `mhpmevent8`, RV32 only
|
|
405
|
+
MHPMEVENT9H = 0x729 # Upper 32 bits of `mhpmevent9`, RV32 only
|
|
406
|
+
MHPMEVENT10H = 0x72A # Upper 32 bits of `mhpmevent10`, RV32 only
|
|
407
|
+
MHPMEVENT11H = 0x72B # Upper 32 bits of `mhpmevent11`, RV32 only
|
|
408
|
+
MHPMEVENT12H = 0x72C # Upper 32 bits of `mhpmevent12`, RV32 only
|
|
409
|
+
MHPMEVENT13H = 0x72D # Upper 32 bits of `mhpmevent13`, RV32 only
|
|
410
|
+
MHPMEVENT14H = 0x72E # Upper 32 bits of `mhpmevent14`, RV32 only
|
|
411
|
+
MHPMEVENT15H = 0x72F # Upper 32 bits of `mhpmevent15`, RV32 only
|
|
412
|
+
MHPMEVENT16H = 0x730 # Upper 32 bits of `mhpmevent16`, RV32 only
|
|
413
|
+
MHPMEVENT17H = 0x731 # Upper 32 bits of `mhpmevent17`, RV32 only
|
|
414
|
+
MHPMEVENT18H = 0x732 # Upper 32 bits of `mhpmevent18`, RV32 only
|
|
415
|
+
MHPMEVENT19H = 0x733 # Upper 32 bits of `mhpmevent19`, RV32 only
|
|
416
|
+
MHPMEVENT20H = 0x734 # Upper 32 bits of `mhpmevent20`, RV32 only
|
|
417
|
+
MHPMEVENT21H = 0x735 # Upper 32 bits of `mhpmevent21`, RV32 only
|
|
418
|
+
MHPMEVENT22H = 0x736 # Upper 32 bits of `mhpmevent22`, RV32 only
|
|
419
|
+
MHPMEVENT23H = 0x737 # Upper 32 bits of `mhpmevent23`, RV32 only
|
|
420
|
+
MHPMEVENT24H = 0x738 # Upper 32 bits of `mhpmevent24`, RV32 only
|
|
421
|
+
MHPMEVENT25H = 0x739 # Upper 32 bits of `mhpmevent25`, RV32 only
|
|
422
|
+
MHPMEVENT26H = 0x73A # Upper 32 bits of `mhpmevent26`, RV32 only
|
|
423
|
+
MHPMEVENT27H = 0x73B # Upper 32 bits of `mhpmevent27`, RV32 only
|
|
424
|
+
MHPMEVENT28H = 0x73C # Upper 32 bits of `mhpmevent28`, RV32 only
|
|
425
|
+
MHPMEVENT29H = 0x73D # Upper 32 bits of `mhpmevent29`, RV32 only
|
|
426
|
+
MHPMEVENT30H = 0x73E # Upper 32 bits of `mhpmevent30`, RV32 only
|
|
427
|
+
MHPMEVENT31H = 0x73F # Upper 32 bits of `mhpmevent31`, RV32 only
|
|
428
|
+
|
|
429
|
+
# Debug/Trace Registers (shared with Debug Mode)
|
|
430
|
+
TSELECT = 0x7A0 # Debug/Trace trigger register select
|
|
431
|
+
TDATA1 = 0x7A1 # First Debug/Trace trigger data register
|
|
432
|
+
TDATA2 = 0x7A2 # Second Debug/Trace trigger data register
|
|
433
|
+
TDATA3 = 0x7A3 # Third Debug/Trace trigger data register
|
|
434
|
+
MCONTEXT = 0x7A8 # Machine-mode context register
|
|
435
|
+
|
|
436
|
+
# Debug Mode Registers
|
|
437
|
+
DCSR = 0x7B0 # Debug control and status register
|
|
438
|
+
DPC = 0x7B1 # Debug program counter
|
|
439
|
+
DSCRATCH0 = 0x7B2 # Debug scratch register 0
|
|
440
|
+
DSCRATCH1 = 0x7B3 # Debug scratch register 1.
|
|
441
|
+
|
|
442
|
+
# Internal Coreblocks CSRs
|
|
443
|
+
# used only for testbench verification
|
|
444
|
+
|
|
445
|
+
# CSR for custom communication with testbenches
|
|
446
|
+
COREBLOCKS_TEST_CSR = 0x7FF
|
|
447
|
+
# CSR for signalling end of test in testbenches
|
|
448
|
+
COREBLOCKS_TEST_EXIT_CSR = 0x8FE
|
|
449
|
+
# CSR providing writable current privilege mode (U-mode accesible)
|
|
450
|
+
COREBLOCKS_TEST_PRIV_MODE = 0x8FF
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
# Width of pmpXcfg subfields in pmpcfgX registers
|
|
454
|
+
PMPXCFG_WIDTH = 8
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
@unique
|
|
458
|
+
class MstatusFieldOffsets(IntEnum):
|
|
459
|
+
SIE = 1 # Supervisor Interrupt Enable
|
|
460
|
+
MIE = 3 # Machine Interrupt Enable
|
|
461
|
+
SPIE = 5 # Supervisor Previous Interrupt Enable
|
|
462
|
+
UBE = 6 # User Endianness Control
|
|
463
|
+
MPIE = 7 # Machine Previous Interrupt Enable
|
|
464
|
+
SPP = 8 # Supervisor Previous Privilege
|
|
465
|
+
VS = 9 # Vector Context Status
|
|
466
|
+
MPP = 11 # Machine Previous Privilege
|
|
467
|
+
FS = 13 # Float Context Status
|
|
468
|
+
XS = 15 # Additional Extension State Context Status
|
|
469
|
+
MPRV = 17 # Modify Privilege
|
|
470
|
+
SUM = 18 # Supervisor User Memory Access
|
|
471
|
+
MXR = 19 # Make Executable Readable
|
|
472
|
+
TVM = 20 # Trap Virtual Memory
|
|
473
|
+
TW = 21 # Timeout Wait
|
|
474
|
+
TSR = 22 # Trap SRET
|
|
475
|
+
SPELP = 23 # Supervisor Previous Expected Landing Pad
|
|
476
|
+
SDT = 24 # Supervisor Double Trap
|
|
477
|
+
UXL = 32 # User XLEN
|
|
478
|
+
SXL = 34 # Supervisor XLEN
|
|
479
|
+
SBE = 36 # Supervisor Endianness Control
|
|
480
|
+
MBE = 37 # Machine Endianness Control
|
|
481
|
+
GVA = 38 # Guest Virtual Address
|
|
482
|
+
MPV = 39 # Mass Page Valid
|
|
483
|
+
MPELP = 40 # Machine Previous Expected Landing Pad
|
|
484
|
+
MDT = 41 # Machine Disable Trap
|
|
485
|
+
SD = -1 # Context Status Dirty bit. Placed on last bit of mstatus
|
|
486
|
+
|
|
487
|
+
def field_length(self) -> int:
|
|
488
|
+
if self in [
|
|
489
|
+
MstatusFieldOffsets.VS,
|
|
490
|
+
MstatusFieldOffsets.MPP,
|
|
491
|
+
MstatusFieldOffsets.FS,
|
|
492
|
+
MstatusFieldOffsets.XS,
|
|
493
|
+
MstatusFieldOffsets.UXL,
|
|
494
|
+
MstatusFieldOffsets.SXL,
|
|
495
|
+
]:
|
|
496
|
+
return 2
|
|
497
|
+
|
|
498
|
+
return 1
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
@unique
|
|
502
|
+
class MenvcfgFieldOffsets(IntEnum):
|
|
503
|
+
FIOM = 0 # Fence of I/O implies Memory
|
|
504
|
+
LPE = 2 # Landing Pad Enable
|
|
505
|
+
SSE = 3 # Supervisor Shadow Stack Enable
|
|
506
|
+
CBIE = 4 # Cache Block Invalidate instruction Enable
|
|
507
|
+
CBCFE = 6 # Cache Block Clean and Flush instruction Enable
|
|
508
|
+
CBZE = 7 # Cache Block Zero instruction Enable
|
|
509
|
+
PMM = 32 # Pointer Masking for Machine mode
|
|
510
|
+
DTE = 59 # Double Trap Enable
|
|
511
|
+
CDE = 60 # Counter Delegation Enable
|
|
512
|
+
ADUE = 61 # Accessed Dirty Update Enable
|
|
513
|
+
PBMTE = 62 # Page-Based Memory Types Enable
|
|
514
|
+
STCE = 63 # STimeCmp Enable
|
|
515
|
+
|
|
516
|
+
def field_length(self) -> int:
|
|
517
|
+
if self in [
|
|
518
|
+
MenvcfgFieldOffsets.PMM,
|
|
519
|
+
MenvcfgFieldOffsets.CBIE,
|
|
520
|
+
]:
|
|
521
|
+
return 2
|
|
522
|
+
|
|
523
|
+
return 1
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
@unique
|
|
527
|
+
class CounterEnableFieldOffsets(IntEnum):
|
|
528
|
+
CY = 0 # Cycle counter enable
|
|
529
|
+
TM = 1 # Timer counter enable
|
|
530
|
+
IR = 2 # Instret counter enable
|
|
531
|
+
HPM3 = 3 # HPMCOUNTER3 enable
|
|
532
|
+
HPM4 = 4 # HPMCOUNTER4 enable
|
|
533
|
+
HPM5 = 5 # HPMCOUNTER5 enable
|
|
534
|
+
HPM6 = 6 # HPMCOUNTER6 enable
|
|
535
|
+
HPM7 = 7 # HPMCOUNTER7 enable
|
|
536
|
+
HPM8 = 8 # HPMCOUNTER8 enable
|
|
537
|
+
HPM9 = 9 # HPMCOUNTER9 enable
|
|
538
|
+
HPM10 = 10 # HPMCOUNTER10 enable
|
|
539
|
+
HPM11 = 11 # HPMCOUNTER11 enable
|
|
540
|
+
HPM12 = 12 # HPMCOUNTER12 enable
|
|
541
|
+
HPM13 = 13 # HPMCOUNTER13 enable
|
|
542
|
+
HPM14 = 14 # HPMCOUNTER14 enable
|
|
543
|
+
HPM15 = 15 # HPMCOUNTER15 enable
|
|
544
|
+
HPM16 = 16 # HPMCOUNTER16 enable
|
|
545
|
+
HPM17 = 17 # HPMCOUNTER17 enable
|
|
546
|
+
HPM18 = 18 # HPMCOUNTER18 enable
|
|
547
|
+
HPM19 = 19 # HPMCOUNTER19 enable
|
|
548
|
+
HPM20 = 20 # HPMCOUNTER20 enable
|
|
549
|
+
HPM21 = 21 # HPMCOUNTER21 enable
|
|
550
|
+
HPM22 = 22 # HPMCOUNTER22 enable
|
|
551
|
+
HPM23 = 23 # HPMCOUNTER23 enable
|
|
552
|
+
HPM24 = 24 # HPMCOUNTER24 enable
|
|
553
|
+
HPM25 = 25 # HPMCOUNTER25 enable
|
|
554
|
+
HPM26 = 26 # HPMCOUNTER26 enable
|
|
555
|
+
HPM27 = 27 # HPMCOUNTER27 enable
|
|
556
|
+
HPM28 = 28 # HPMCOUNTER28 enable
|
|
557
|
+
HPM29 = 29 # HPMCOUNTER29 enable
|
|
558
|
+
HPM30 = 30 # HPMCOUNTER30 enable
|
|
559
|
+
HPM31 = 31 # HPMCOUNTER31 enable
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
sstatus_field_subset: Set[MstatusFieldOffsets] = frozenset(
|
|
563
|
+
{
|
|
564
|
+
MstatusFieldOffsets.SIE,
|
|
565
|
+
MstatusFieldOffsets.SPIE,
|
|
566
|
+
MstatusFieldOffsets.UBE,
|
|
567
|
+
MstatusFieldOffsets.SPP,
|
|
568
|
+
MstatusFieldOffsets.VS,
|
|
569
|
+
MstatusFieldOffsets.FS,
|
|
570
|
+
MstatusFieldOffsets.XS,
|
|
571
|
+
MstatusFieldOffsets.SUM,
|
|
572
|
+
MstatusFieldOffsets.MXR,
|
|
573
|
+
MstatusFieldOffsets.SPELP,
|
|
574
|
+
MstatusFieldOffsets.SDT,
|
|
575
|
+
MstatusFieldOffsets.SD,
|
|
576
|
+
}
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
senvcfg_field_subset: Set[MenvcfgFieldOffsets] = frozenset(
|
|
580
|
+
{
|
|
581
|
+
MenvcfgFieldOffsets.FIOM,
|
|
582
|
+
MenvcfgFieldOffsets.LPE,
|
|
583
|
+
MenvcfgFieldOffsets.SSE,
|
|
584
|
+
MenvcfgFieldOffsets.CBIE,
|
|
585
|
+
MenvcfgFieldOffsets.CBCFE,
|
|
586
|
+
MenvcfgFieldOffsets.CBZE,
|
|
587
|
+
}
|
|
588
|
+
)
|