Skip to content

Commit 4ab514f

Browse files
committed
fix(Xqci/Xqciint): xqciv0p13 changes
- Fix IDL code of qc.c.mileaveret instruction to avoid restoring from stack NMIP and EXCP bits Signed-off-by: Albert Yosher <[email protected]>
1 parent d10f222 commit 4ab514f

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

arch_overlay/qc_iu/ext/Xqci.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ versions:
441441
changes:
442442
- Fix version history of releases v0.11.0 and v0.12.0
443443
- Fix description and IDL code of qc.csrrwr instruction to allow just read CSR
444+
- Fix IDL code of qc.c.mileaveret instruction to avoid restoring from stack NMIP and EXCP bits
444445
implies:
445446
- { name: Xqcia, version: "0.7.0" }
446447
- { name: Xqciac, version: "0.3.0" }
@@ -450,7 +451,7 @@ versions:
450451
- { name: Xqcicm, version: "0.2.0" }
451452
- { name: Xqcics, version: "0.2.0" }
452453
- { name: Xqcicsr, version: "0.4.0" }
453-
- { name: Xqciint, version: "0.9.0" }
454+
- { name: Xqciint, version: "0.10.0" }
454455
- { name: Xqciio, version: "0.1.0" }
455456
- { name: Xqcilb, version: "0.2.0" }
456457
- { name: Xqcili, version: "0.2.0" }

arch_overlay/qc_iu/ext/Xqciint.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ versions:
134134
changes:
135135
- Fix desciption of qc.c.eir instruction to match IDL code and functionality
136136
requires: { name: Zca, version: ">= 1.0.0" }
137+
- version: "0.10.0"
138+
state: frozen
139+
ratification_date: null
140+
contributors:
141+
- name: Albert Yosher
142+
company: Qualcomm Technologies, Inc.
143+
144+
- name: Derek Hower
145+
company: Qualcomm Technologies, Inc.
146+
147+
changes:
148+
- Fix IDL code of qc.c.mileaveret instruction to avoid restoring from stack NMIP and EXCP bits
149+
requires: { name: Zca, version: ">= 1.0.0" }
137150
description: |
138151
The Xqciint extension includes eleven instructions to accelerate interrupt
139152
servicing by performing common actions during ISR prologue/epilogue.

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ operation(): |
2727
XReg prev_retpc = read_memory<32>(virtual_address - 4, $encoding);
2828
XReg qc_mcause_val = read_memory<32>(virtual_address - 12, $encoding);
2929
Bits<1> nmie_val = CSR[mnstatus].NMIE;
30+
XReg qc_mcause_prev_val = CSR[qc.mcause].sw_read();
31+
XReg qc_mcause_nmip_excp_mask = (32'b1 << 24) | (32'b1 << 25);
32+
XReg qc_mcause_new_val = (qc_mcause_val & ~qc_mcause_nmip_excp_mask) | (qc_mcause_prev_val & qc_mcause_nmip_excp_mask);
33+
CSR[qc.mcause].sw_write(qc_mcause_new_val);
3034
X[ 8] = read_memory<32>(virtual_address - 8, $encoding);
31-
CSR[qc.mcause].sw_write(qc_mcause_val);
3235
X[ 1] = read_memory<32>(virtual_address - 16, $encoding);
3336
X[ 5] = read_memory<32>(virtual_address - 24, $encoding);
3437
X[ 6] = read_memory<32>(virtual_address - 28, $encoding);
@@ -47,7 +50,7 @@ operation(): |
4750
X[31] = read_memory<32>(virtual_address - 80, $encoding);
4851
X[2] = X[2] + 96;
4952
if (nmie_val == 1'b1) {
50-
XReg qc_mcause_val_masked = qc_mcause_val & ~(32'b1<<26) & ~(32'b1<<27) & ~(32'b1<<29) & ~(32'hFF<<12);
53+
XReg qc_mcause_val_masked = qc_mcause_new_val & ~(32'b1<<26) & ~(32'b1<<27) & ~(32'b1<<29) & ~(32'hFF<<12);
5154
Bits<1> mpie_val = (qc_mcause_val >> 27) & 1;
5255
Bits<1> mpdt_val = (qc_mcause_val >> 29) & 1;
5356
Bits<4> mpil_val = (qc_mcause_val >> 16) & 0xF;
@@ -74,7 +77,7 @@ operation(): |
7477
}
7578
$pc = CSR[mepc].sw_read();
7679
} else {
77-
XReg qc_mcause_val_masked = qc_mcause_val & ~(32'b1<<26) & ~(32'b1<<28) & ~(32'b1<<30) & ~(32'b1111<<12) & ~(32'b1111<<20);
80+
XReg qc_mcause_val_masked = qc_mcause_new_val & ~(32'b1<<26) & ~(32'b1<<28) & ~(32'b1<<30) & ~(32'b1111<<12) & ~(32'b1111<<20);
7881
Bits<1> mnpie_val = (qc_mcause_val >> 28) & 1;
7982
Bits<4> mnpil_val = (qc_mcause_val >> 20) & 0xF;
8083
CSR[mstatus].MIE = mnpie_val;

0 commit comments

Comments
 (0)