-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: add missing mandatory machine information CSRs and add basic as…
…m tests for them
- Loading branch information
1 parent
1a8e96f
commit 5f91ebf
Showing
5 changed files
with
151 additions
and
44 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
#ifndef CSR_H | ||
#define CSR_H | ||
|
||
#define CSR_TOHOST 0x51e | ||
#define CSR_MSCRATCH 0x340 | ||
#define CSR_MCYCLE 0xb00 | ||
#define CSR_MINSTRET 0xb02 | ||
#define CSR_MCYCLEH 0xb80 | ||
#define CSR_MINSTRETH 0xb82 | ||
// read-only CSRs | ||
#define CSR_MISA 0x301 | ||
#define CSR_MHARTID 0xf14 | ||
// read only user CSRs | ||
#define CSR_CYCLE 0xC00 | ||
#define CSR_TIME 0xC01 | ||
#define CSR_INSTRET 0xC02 | ||
#define CSR_CYCLEH 0xC80 | ||
#define CSR_TIMEH 0xC81 | ||
#define CSR_INSTRETH 0xC82 | ||
#define CSR_TOHOST 0x51E | ||
|
||
// Machine-level CSR addresses | ||
// Machine Information Registers | ||
#define CSR_MVENDORID 0xF11 // MRO | ||
#define CSR_MARCHID 0xF12 // MRO | ||
#define CSR_MIMPID 0xF13 // MRO | ||
#define CSR_MHARTID 0xF14 // MRO | ||
// Machine Trap Setup | ||
//#define CSR_MSTATUS 0x300 // MRW | ||
#define CSR_MISA 0x301 // MRW | ||
//#define CSR_MIE 0x304 // MRW | ||
//#define CSR_MTVEC 0x305 // MRW | ||
// Machine Trap Handling | ||
#define CSR_MSCRATCH 0x340 // MRW | ||
//#define CSR_MEPC 0x341 // MRW | ||
//#define CSR_MCAUSE 0x342 // MRW | ||
//#define CSR_MTVAL 0x343 // MRW | ||
//#define CSR_MIP 0x344 // MRW | ||
// Machine Counter/Timers | ||
#define CSR_MCYCLE 0XB00 // MRW | ||
#define CSR_MINSTRET 0XB02 // MRW | ||
#define CSR_MCYCLEH 0XB80 // MRW | ||
#define CSR_MINSTRETH 0XB82 // MRW | ||
|
||
// Unprivileged CSR addresses | ||
// Unprivileged Counter/Timers | ||
#define CSR_CYCLE 0xC00 // URO | ||
#define CSR_TIME 0xC01 // URO | ||
#define CSR_INSTRET 0xC02 // URO | ||
#define CSR_CYCLEH 0xC80 // URO | ||
#define CSR_TIMEH 0xC81 // URO | ||
#define CSR_INSTRETH 0xC82 // URO | ||
|
||
#endif |