File tree Expand file tree Collapse file tree 3 files changed +82
-8
lines changed Expand file tree Collapse file tree 3 files changed +82
-8
lines changed Original file line number Diff line number Diff line change 1+ $schema : csr_schema.json#
2+ kind : csr
3+ name : qc_mncause
4+ long_name : Machine NMI Cause
5+ address : 0x7c2
6+ base : 32
7+ priv_mode : M
8+ length : MXLEN
9+ description : |
10+ Reports the cause of the latest non-maskable interrupt.
11+ definedBy :
12+ anyOf :
13+ - Xqci
14+ - Xqciint
15+ fields :
16+ INT :
17+ type : RW-H
18+ reset_value : 0
19+ location : 31
20+ description : Interrupt bit copied from mcause.INT at the moment of NMI
21+ NMI :
22+ type : RW-H
23+ reset_value : 0
24+ location : 30
25+ description : If 1'b1, currently processing NMI.
26+ MPP :
27+ type : RW-H
28+ reset_value : 3
29+ location : 29-28
30+ description : M-mode Previous Privilege.
31+ MPIE :
32+ type : RW-H
33+ reset_value : 0
34+ location : 27
35+ description : M-mode Previous Interrupt Enable.
36+ MIE :
37+ type : RW-H
38+ reset_value : 0
39+ location : 26
40+ description : M-mode Interrupt Enable.
41+ EXCP :
42+ type : RW-H
43+ reset_value : 0
44+ location : 25
45+ description : Exception Pending Bit.
46+ RESP :
47+ type : RW-H
48+ reset_value : 0
49+ location : 24
50+ description : Resume Pending Bit.
51+ MPIL :
52+ type : RW-H
53+ reset_value : 0
54+ location : 19-16
55+ description : M-mode Previous Interrupt Level.
56+ MIL :
57+ type : RW-H
58+ reset_value : 15
59+ location : 15-12
60+ description : M-mode Interrupt Level.
61+ NMICODE :
62+ type : RW-H
63+ reset_value : 0
64+ location : 11-0
65+ description : NMI code ID.
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ description: |
88 Returns from an NMI in M-mode.
99 Instruction encoded in CI instruction format.
1010assembly : " "
11- definedBy : Xqciint
11+ definedBy :
12+ anyOf :
13+ - Xqci
14+ - Xqciint
1215access :
1316 s : never
1417 u : never
@@ -18,15 +21,18 @@ base: 32
1821encoding :
1922 match : " 0001100110010010"
2023operation() : |
21- CSR[mncause].MIE = CSR[mncause].MPIE;
22- CSR[mncause].MPIE = 1;
23- if (CSR[mncause].MPP == 2'b00) {
24+ if (implemented?(ExtensionName::S) && CSR[mstatus].MPP != 2'b11) {
25+ CSR[mstatus].MPRV = 0;
26+ }
27+ CSR[mstatus].MIE = CSR[mstatus].MPIE;
28+ CSR[mstatus].MPIE = 1;
29+ if (CSR[mstatus].MPP == 2'b00) {
2430 set_mode(PrivilegeMode::U);
25- } else if (CSR[mncause ].MPP == 2'b01) {
31+ } else if (CSR[mstatus ].MPP == 2'b01) {
2632 set_mode(PrivilegeMode::S);
27- } else if (CSR[mncause ].MPP == 2'b11) {
33+ } else if (CSR[mstatus ].MPP == 2'b11) {
2834 set_mode(PrivilegeMode::M);
2935 }
30- CSR[mncause ].MPP = implemented?(ExtensionName::U) ? 2'b00 : 2'b11;
36+ CSR[mstatus ].MPP = implemented?(ExtensionName::U) ? 2'b00 : 2'b11;
3137 CSR[mcause].NMI = 0;
3238 $pc = CSR[qc_mnepc].sw_read();
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ description: |
88 Returns from an exception in M-mode.
99 Instruction encoded in CI instruction format.
1010assembly : " "
11- definedBy : Xqciint
11+ definedBy :
12+ anyOf :
13+ - Xqci
14+ - Xqciint
1215access :
1316 s : never
1417 u : never
You can’t perform that action at this time.
0 commit comments