Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mhpmevent): add struct, rtl guidance and legal check for mhpmevent csr #574

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(mhpmevent): add CSRS_M_HPMEVENTS_STRUCT for mhpmevent csr.
wissygh authored and lewislzh committed Oct 25, 2024
commit bf3955646a1453bff66954c92f6ae313a3013194
24 changes: 23 additions & 1 deletion src/isa/riscv64/local-include/csr.h
Original file line number Diff line number Diff line change
@@ -623,7 +623,29 @@ CSR_STRUCT_START(minstret)
CSR_STRUCT_END(minstret)

CSR_STRUCT_DUMMY_LIST(CSRS_M_HPMCOUNTER)
CSR_STRUCT_DUMMY_LIST(CSRS_M_HPMEVENT)

#define CSRS_M_HPMEVENTS_STRUCT(name, addr) \
typedef union { \
struct { \
uint64_t event0 : 10; \
uint64_t event1 : 10; \
uint64_t event2 : 10; \
uint64_t event3 : 10; \
uint64_t optype0 : 5; \
uint64_t optype1 : 5; \
uint64_t optype2 : 5; \
uint64_t pad0 : 3; \
uint64_t vuinh : 1; \
uint64_t vsinh : 1; \
uint64_t uinh : 1; \
uint64_t sinh : 1; \
uint64_t minh : 1; \
uint64_t of : 1; \
}; \
word_t val; \
} concat(name, _t);

MAP(CSRS_M_HPMEVENT, CSRS_M_HPMEVENTS_STRUCT)

CSR_STRUCT_START(mcounteren)
CSR_STRUCT_END(mcounteren)