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

Update Templates/setup/model/env/model_test.h to match spike #97

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
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
51 changes: 42 additions & 9 deletions riscof/Templates/setup/model/env/model_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,51 @@
//RVTEST_IO_ASSERT_DFPR_EQ
#define RVMODEL_IO_ASSERT_DFPR_EQ(_D, _R, _I)

#define RVMODEL_SET_MSW_INT \
li t1, 1; \
li t2, 0x2000000; \
sw t1, 0(t2);
#ifndef RVMODEL_MCLINTBASE
#define RVMODEL_MCLINTBASE 0x02000000
#endif

#define RVMODEL_CLEAR_MSW_INT \
li t2, 0x2000000; \
sw x0, 0(t2);
#ifndef RVMODEL_MSIP_OFFSET
#define RVMODEL_MSIP_OFFSET 0x0
#endif

#define RVMODEL_CLEAR_MTIMER_INT
#ifndef RVMODEL_MTIMECMP_OFFSET
#define RVMODEL_MTIMECMP_OFFSET 0x4000
#endif

#define RVMODEL_CLEAR_MEXT_INT
#ifndef RVMODEL_MTIMECMPH_OFFSET
#define RVMODEL_MTIMECMPH_OFFSET 0x4004
#endif

#define RVMODEL_SET_MSW_INT \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MSIP_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MSIP_OFFSET) & 0xFFF); \
li t1, 1; \
sw t1, (t0); \

#define RVMODEL_CLEAR_MSW_INT \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MSIP_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MSIP_OFFSET) & 0xFFF); \
sw x0, (t0); \

#define RVMODEL_SET_MTIMER_INT \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMP_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMP_OFFSET) & 0xFFF); \
sw x0, (t0); \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMPH_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMPH_OFFSET) & 0xFFF); \
sw x0, (t0); \

#define RVMODEL_CLEAR_MTIMER_INT \
addi t1,x0,1; \
neg t1,t1; \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMPH_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMPH_OFFSET) & 0xFFF); \
sw t1, (t0); \
lui t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMP_OFFSET)>> 12); \
addi t0, t0, ((RVMODEL_MCLINTBASE + RVMODEL_MTIMECMP_OFFSET) & 0xFFF); \
sw t1, (t0); \

#define RVMODEL_CLEAR_MEXT_INT

#endif // _COMPLIANCE_MODEL_H