-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Improve RISC-V interrupt and CSR handling consistency
- Loading branch information
1 parent
08d836e
commit 9181a36
Showing
32 changed files
with
448 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,9 @@ common: | |
MSTATUS_UXL: 0x0000000300000000 | ||
MSTATUS_SXL: 0x0000000C00000000 | ||
MSTATUS64_SD: 0x8000000000000000 | ||
MSTATUS_MPP_M: 0x1800 | ||
MSTATUS_MPP_S: 0x800 | ||
MSTATUS_MPP_U: 0x000 | ||
SSTATUS_UIE: 0x00000001 | ||
SSTATUS_SIE: 0x00000002 | ||
SSTATUS_UPIE: 0x00000010 | ||
|
@@ -81,15 +84,6 @@ common: | |
PMP_TOR: 0x08 | ||
PMP_NA4: 0x10 | ||
PMP_NAPOT: 0x18 | ||
IRQ_S_SOFT: 1 | ||
IRQ_H_SOFT: 2 | ||
IRQ_M_SOFT: 3 | ||
IRQ_S_TIMER: 5 | ||
IRQ_H_TIMER: 6 | ||
IRQ_M_TIMER: 7 | ||
IRQ_S_EXT: 9 | ||
IRQ_H_EXT: 10 | ||
IRQ_M_EXT: 11 | ||
IRQ_COP: 12 | ||
IRQ_HOST: 13 | ||
DEFAULT_RSTVEC: 0x00001000 | ||
|
@@ -863,6 +857,16 @@ common: | |
CAUSE_FETCH_PAGE_FAULT: 0xc | ||
CAUSE_LOAD_PAGE_FAULT: 0xd | ||
CAUSE_STORE_PAGE_FAULT: 0xf | ||
CAUSE_S_SOFT_INTR: (0x1) | ||
CAUSE_H_SOFT_INTR: (0x2) | ||
CAUSE_M_SOFT_INTR: (0x3) | ||
CAUSE_S_TIMER_INTR: (0x5) | ||
CAUSE_H_TIMER_INTR: (0x6) | ||
CAUSE_M_TIMER_INTR: (0x7) | ||
CAUSE_S_EXT_INTR: (0x9) | ||
CAUSE_H_EXT_INTR: (0x10) | ||
CAUSE_M_EXT_INTR: (0x11) | ||
INTERRUPT_MASK: (0XF) | ||
CSR_MENTROPY: 0xF15 | ||
CSR_MNOISE: 0x7A9 | ||
DCSR_XDEBUGVER: (3U<<30) | ||
|
@@ -891,17 +895,26 @@ common: | |
MCONTROL_EXECUTE: (1<<2) | ||
MCONTROL_STORE: (1<<1) | ||
MCONTROL_LOAD: (1<<0) | ||
MIP_SSIP: (1 << IRQ_S_SOFT) | ||
MIP_HSIP: (1 << IRQ_H_SOFT) | ||
MIP_MSIP: (1 << IRQ_M_SOFT) | ||
MIP_STIP: (1 << IRQ_S_TIMER) | ||
MIP_HTIP: (1 << IRQ_H_TIMER) | ||
MIP_MTIP: (1 << IRQ_M_TIMER) | ||
MIP_SEIP: (1 << IRQ_S_EXT) | ||
MIP_HEIP: (1 << IRQ_H_EXT) | ||
MIP_MEIP: (1 << IRQ_M_EXT) | ||
MIP_SSIP: (1<<1) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
allenjbaum
Collaborator
|
||
MIP_HSIP: (1<<2) | ||
MIP_MSIP: (1<<3) | ||
MIP_STIP: (1<<5) | ||
MIP_HTIP: (1<<6) | ||
MIP_MTIP: (1<<7) | ||
MIP_SEIP: (1<<9) | ||
MIP_HEIP: (1<<10) | ||
MIP_MEIP: (1<<11) | ||
MIE_SSIE: (1<<1) | ||
MIE_HSIE: (1<<2) | ||
MIE_MSIE: (1<<3) | ||
MIE_STIE: (1<<5) | ||
MIE_HTIE: (1<<6) | ||
MIE_MTIE: (1<<7) | ||
MIE_SEIE: (1<<9) | ||
MIE_HEIE: (1<<10) | ||
MIE_MEIE: (1<<11) | ||
RISCV_PGSIZE: (1 << RISCV_PGSHIFT) | ||
|
||
PMP_MACROS: | ||
PMPCFG_BIT_SET: 1 | ||
PMPCFG_BIT_NOT_SET: 0 | ||
|
@@ -933,8 +946,9 @@ PMP_helper_Coverpoints: | |
NA4_REGION_ADDRESS_MATCH: (rs1_val + imm_val == (pmpaddr1 << 2)) | ||
NA4_PRIORITY_REGION_MATCH: (rs1_val + imm_val == (pmpaddr3 << 2)) | ||
NA4_PRIORITY_2_REGION_MATCH: (rs1_val + imm_val == (pmpaddr1 << 2)) | ||
|
||
Interrupt_Macros: | ||
MSIP_BASE: 0x02000000 | ||
MTIMECMP_BASE: 0x02004000 | ||
MTIME_BASE: 0x0200bff8 | ||
RVMODEL_MSIP_BASE: 0x02000000 | ||
RVMODEL_MTIMECMP_BASE: 0x02004000 | ||
RVMODEL_MTIME_BASE: 0x0200bff8 | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
To avoid problems in the future, I would remove the constants and replace them with the variables defined above, e.g. 1<<6 should be replace with 1<< CAUSE_H_EXT_INTR