Skip to content

Commit 2b22350

Browse files
authored
Xqci (Xqciint) extensiion: Fix IDL code of qc.c.mileaveret instruction to match Smdbltrp behaviour (#618)
Signed-off-by: Albert Yosher <[email protected]>
1 parent 213456e commit 2b22350

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

arch_overlay/qc_iu/ext/Xqci.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,40 @@ versions:
312312
requires:
313313
name: Zca
314314
version: ">= 1.0.0"
315+
- version: "0.10.0"
316+
state: frozen
317+
ratification_date: null
318+
contributors:
319+
- name: Albert Yosher
320+
company: Qualcomm Technologies, Inc.
321+
322+
- name: Derek Hower
323+
company: Qualcomm Technologies, Inc.
324+
325+
changes:
326+
- Fix IDL code for Smdbltrp and Smrnmi spec compatibility for qc.c.mileaveret instruction
327+
implies:
328+
- { name: Xqcia, version: "0.6.0" }
329+
- { name: Xqciac, version: "0.3.0" }
330+
- { name: Xqcibi, version: "0.2.0" }
331+
- { name: Xqcibm, version: "0.7.0" }
332+
- { name: Xqcicli, version: "0.3.0" }
333+
- { name: Xqcicm, version: "0.2.0" }
334+
- { name: Xqcics, version: "0.2.0" }
335+
- { name: Xqcicsr, version: "0.3.0" }
336+
- { name: Xqciint, version: "0.7.0" }
337+
- { name: Xqciio, version: "0.1.0" }
338+
- { name: Xqcilb, version: "0.2.0" }
339+
- { name: Xqcili, version: "0.2.0" }
340+
- { name: Xqcilia, version: "0.2.0" }
341+
- { name: Xqcilo, version: "0.3.0" }
342+
- { name: Xqcilsm, version: "0.5.0" }
343+
- { name: Xqcisim, version: "0.2.0" }
344+
- { name: Xqcisls, version: "0.2.0" }
345+
- { name: Xqcisync, version: "0.2.0" }
346+
requires:
347+
name: Zca
348+
version: ">= 1.0.0"
315349
description: |
316350
The Xqci extension includes a set of instructions that improve RISC-V code density and
317351
performance in microontrollers. It fills several gaps:

arch_overlay/qc_iu/ext/Xqciint.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ versions:
9393
changes:
9494
- Fix IDL code for Smdbltrp and Smrnmi spec compatibility for qc.c.mret and qc.c.mnret instructions
9595
requires: { name: Zca, version: ">= 1.0.0" }
96+
- version: "0.7.0"
97+
state: frozen
98+
ratification_date: null
99+
contributors:
100+
- name: Albert Yosher
101+
company: Qualcomm Technologies, Inc.
102+
103+
- name: Derek Hower
104+
company: Qualcomm Technologies, Inc.
105+
106+
changes:
107+
- Fix IDL code for Smdbltrp and Smrnmi spec compatibility for qc.c.mileaveret instruction
108+
requires: { name: Zca, version: ">= 1.0.0" }
96109
description: |
97110
The Xqciint extension includes eleven instructions to accelerate interrupt
98111
servicing by performing common actions during ISR prologue/epilogue.

arch_overlay/qc_iu/inst/Xqci/qc.c.mileaveret.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ operation(): |
5353
Bits<4> mpil_val = (qc_mcause_val >> 16) & 0xF;
5454
CSR[mstatus].MIE = mpie_val;
5555
CSR[mstatus].MPIE = 1'b1;
56-
CSR[mstatush].MDT = mpdt_val;
56+
if (implemented?(ExtensionName::Smdbltrp)) {
57+
CSR[mstatush].MDT = mpdt_val;
58+
}
5759
CSR[qc.mcause].sw_write(qc_mcause_val_masked |
5860
(1<<27) | (mpie_val<<26) | (0<<29) |
5961
(mpil_val << 12) | (0xF << 16));
6062
if (mpdt_val == 1'b0) {
63+
if (CSR[mstatus].MPP != 2'b11) {
64+
CSR[mstatus].MPRV = 0;
65+
}
6166
if (CSR[mstatus].MPP == 2'b00) {
6267
set_mode(PrivilegeMode::U);
6368
} else if (CSR[mstatus].MPP == 2'b01) {
@@ -77,6 +82,12 @@ operation(): |
7782
CSR[qc.mcause].sw_write(qc_mcause_val_masked |
7883
(1<<28) | (mnpie_val<<26) | (1<<30) |
7984
(mnpil_val << 12) | (0xF << 20));
85+
if (CSR[mnstatus].MNPP != 2'b11) {
86+
CSR[mstatus].MPRV = 0;
87+
if (implemented?(ExtensionName::Smdbltrp)) {
88+
CSR[mstatush].MDT = 1'b0;
89+
}
90+
}
8091
if (CSR[mnstatus].MNPP == 2'b00) {
8192
set_mode(PrivilegeMode::U);
8293
} else if (CSR[mnstatus].MNPP == 2'b01) {

0 commit comments

Comments
 (0)