-
Notifications
You must be signed in to change notification settings - Fork 199
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
Draft : Added test cases for load address match trigger in sdtrig extension #487
Open
anuani21
wants to merge
31
commits into
riscv-non-isa:dev
Choose a base branch
from
anuani21:Sdtrig
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,866
−0
Open
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ac1e9a3
Added test cases for load address match trigger in sdtrig extension
anuani21 16c1028
Merge branch 'dev' into Sdtrig
anuani21 222b4d6
Updated load test cases and added store, execute test cases with diff…
anuani21 04b414d
Merge branch 'dev' into Sdtrig
anuani21 d2e7cd8
updated tests
anuani21 dbb9090
Merge branch 'Sdtrig' of https://github.com/anuani21/riscv-arch-test …
anuani21 fc0c35e
Modified test cases
anuani21 02b07a3
Removed
anuani21 486cab3
Delete riscv-test-suite/rv32i_m/sdtrig/store_match5.S
anuani21 66801c4
Delete riscv-test-suite/rv32i_m/sdtrig/execute_match0.S
anuani21 65c0e80
Delete riscv-test-suite/rv32i_m/sdtrig/execute_match2.S
anuani21 491877e
Delete riscv-test-suite/rv32i_m/sdtrig/execute_match3.S
anuani21 c22ab26
Delete riscv-test-suite/rv32i_m/sdtrig/execute_match4.S
anuani21 c33f0d4
Delete riscv-test-suite/rv32i_m/sdtrig/execute_match5.S
anuani21 eab99bd
Delete riscv-test-suite/rv32i_m/sdtrig/load_match0.S
anuani21 0eaefef
Delete riscv-test-suite/rv32i_m/sdtrig/load_match1.S
anuani21 b401d05
Delete riscv-test-suite/rv32i_m/sdtrig/load_match2.S
anuani21 16949c0
Delete riscv-test-suite/rv32i_m/sdtrig/load_match3.S
anuani21 821d960
Delete riscv-test-suite/rv32i_m/sdtrig/load_match4.S
anuani21 29cc8b1
Delete riscv-test-suite/rv32i_m/sdtrig/load_match5.S
anuani21 2020acc
Delete riscv-test-suite/rv32i_m/sdtrig/store_match0.S
anuani21 9d52f76
Delete riscv-test-suite/rv32i_m/sdtrig/store_match1.S
anuani21 47f0808
Delete riscv-test-suite/rv32i_m/sdtrig/store_match2.S
anuani21 2198dd5
Delete riscv-test-suite/rv32i_m/sdtrig/store_match3.S
anuani21 18abd78
Delete riscv-test-suite/rv32i_m/sdtrig/store_match4.S
anuani21 b3abd20
Delete riscv-test-suite/rv32i_m/sdtrig/src directory
anuani21 c858b14
Updated test cases for execute,load and store operations
anuani21 717eaf8
Merge branch 'riscv-non-isa:dev' into Sdtrig
anuani21 2d0b254
Updated test cases
anuani21 61b43c4
Icount test cases
anuani21 8ea168a
Merge branch 'riscv-non-isa:dev' into Sdtrig
anuani21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#include "model_test.h" | ||
#include "arch_test.h" | ||
#include "debug_defines.h" | ||
RVTEST_ISA("RV32IZicsr_Sdtrig") | ||
|
||
.section .text.init | ||
.globl rvtest_entry_point | ||
rvtest_entry_point: | ||
RVMODEL_BOOT | ||
RVTEST_CODE_BEGIN | ||
|
||
#ifdef TEST_CASE_1 | ||
RVTEST_CASE(1,"//check ISA:=regex(.*I.*Zicsr.*Sdtrig.*);def TEST_CASE_1=True;",execute_match0) | ||
RVTEST_SIGBASE(x1, signature_x1_0) | ||
# Set mtvec to the address of the trap handler | ||
la a0, trap_handler | ||
csrw mtvec, a0 | ||
|
||
# Read the misa | ||
csrr t2, misa | ||
RVTEST_SIGUPD(x1,t2) | ||
li t1, (1 << 18) | ||
and t2,t2,t1 | ||
|
||
bnez t2, implement_mie | ||
beqz t2 , implement_tcontrol | ||
|
||
implement_mie: | ||
li t1,(1<<3) | ||
csrw mstatus, t1 | ||
csrr t4, mstatus | ||
j resume_code | ||
|
||
implement_tcontrol: | ||
|
||
li t3, (1<<3) | ||
csrw tcontrol, t3 | ||
csrr t4, tcontrol | ||
j resume_code | ||
|
||
resume_code: | ||
# Write 0 to tselect, read back and append it to the signature | ||
csrw tselect, zero | ||
csrr t0, tselect | ||
RVTEST_SIGUPD(x1, t0) | ||
|
||
# Read tinfo | ||
csrr t6, tinfo | ||
|
||
# Set the value of tdata | ||
csrw tdata1, zero | ||
csrr a3, tdata1 | ||
|
||
# Set the address for tdata2 where the trigger should occur | ||
la t2, 0x80001234 # Set the data value to match | ||
csrw tdata2, t2 | ||
|
||
|
||
# Set up trigger to cause a trap on a breakpoint | ||
# Configure tdata1 for address match control | ||
li t2, (CSR_TDATA1_TYPE_MCONTROL6 << 28 | \ | ||
CSR_TDATA1_DMODE_BOTH << 27 | \ | ||
CSR_MCONTROL6_SELECT_ADDRESS << 21 | \ | ||
CSR_MCONTROL6_SIZE_ANY << 16 | \ | ||
CSR_MCONTROL6_CHAIN_DISABLED << 11 | \ | ||
CSR_MCONTROL6_ACTION_BREAKPOINT << 12 | \ | ||
CSR_MCONTROL6_MATCH_EQUAL << 7 | \ | ||
CSR_MCONTROL6_M | \ | ||
CSR_MCONTROL6_EXECUTE) | ||
csrw tdata1, t2 | ||
csrr t4,tdata1 | ||
RVTEST_SIGUPD(x1, t4) | ||
csrr t6,tdata2 | ||
RVTEST_SIGUPD(x1, t6) | ||
|
||
# Trigger setup complete; now perform an instruction that will hit the trigger | ||
la t4, 0x80001234 | ||
jalr x0,0(t4) | ||
nop | ||
nop | ||
|
||
#endif | ||
|
||
trap_handler: | ||
# Save trap information | ||
csrr t0, mcause # Cause of the trap | ||
csrr t1, mepc # Program counter at the time of trap | ||
csrr t2, mtval # Trap value | ||
RVTEST_SIGUPD(x1, t0) # Update signature with mcause | ||
RVTEST_SIGUPD(x1, t1) # Update signature with mepc | ||
RVTEST_SIGUPD(x1, t2) # Update signature with mtval | ||
|
||
# Check if the trigger hit bit is set (bit 22 in tdata1) | ||
csrr t3, tdata1 | ||
RVTEST_SIGUPD(x1, t3) | ||
|
||
end: | ||
RVTEST_CODE_END | ||
RVMODEL_HALT | ||
|
||
# Output data section. | ||
RVMODEL_DATA_BEGIN | ||
rvtest_sig_begin: | ||
sig_begin_canary: | ||
CANARY; | ||
|
||
signature_x1_0: | ||
.fill 128*(XLEN/32),4,0xdeadbeef | ||
|
||
sig_end_canary: | ||
CANARY; | ||
rvtest_sig_end: | ||
RVMODEL_DATA_END | ||
|
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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#include "model_test.h" | ||
#include "arch_test.h" | ||
#include "debug_defines.h" | ||
RVTEST_ISA("RV32IZicsr_Sdtrig") | ||
|
||
.section .text.init | ||
.globl rvtest_entry_point | ||
rvtest_entry_point: | ||
RVMODEL_BOOT | ||
RVTEST_CODE_BEGIN | ||
|
||
#ifdef TEST_CASE_1 | ||
RVTEST_CASE(1,"//check ISA:=regex(.*I.*Zicsr.*Sdtrig.*);def TEST_CASE_1=True;",execute_match1) | ||
RVTEST_SIGBASE(x1, signature_x1_0) | ||
|
||
# Set mtvec to the address of the trap handler | ||
la a0, trap_handler | ||
csrw mtvec, a0 | ||
|
||
# Read the misa | ||
csrr t2, misa | ||
RVTEST_SIGUPD(x1,t2) | ||
li t1, (1 << 18) | ||
and t2,t2,t1 | ||
|
||
bnez t2, implement_mie | ||
beqz t2 , implement_tcontrol | ||
|
||
implement_mie: | ||
li t1,(1<<3) | ||
csrw mstatus, t1 | ||
csrr t4, mstatus | ||
j resume_code | ||
|
||
implement_tcontrol: | ||
|
||
li t3, (1<<3) | ||
csrw tcontrol, t3 | ||
csrr t4, tcontrol | ||
j resume_code | ||
|
||
resume_code: | ||
|
||
# Write 0 to tselect, read back and append it to the signature | ||
csrw tselect, zero | ||
csrr t0, tselect | ||
RVTEST_SIGUPD(x1, t0) | ||
|
||
# Read tinfo | ||
csrr t6, tinfo | ||
|
||
# Set the value of tdata | ||
csrw tdata1, zero | ||
csrr a3, tdata1 | ||
|
||
# Set the address for tdata2 where the trigger should occur | ||
la t2, 0x80001001 # Set the data value to match | ||
csrw tdata2, t2 | ||
|
||
|
||
# Set up trigger to cause a trap on a breakpoint | ||
# Configure tdata1 for address match control | ||
li t2, (CSR_TDATA1_TYPE_MCONTROL6 << 28 | \ | ||
CSR_TDATA1_DMODE_BOTH << 27 | \ | ||
CSR_MCONTROL6_SELECT_ADDRESS << 21 | \ | ||
CSR_MCONTROL6_SIZE_ANY << 16 | \ | ||
CSR_MCONTROL6_CHAIN_DISABLED << 11 | \ | ||
CSR_MCONTROL6_ACTION_BREAKPOINT << 12 | \ | ||
CSR_MCONTROL6_MATCH_NAPOT << 7 | \ | ||
CSR_MCONTROL6_M | \ | ||
CSR_MCONTROL6_EXECUTE) | ||
csrw tdata1, t2 | ||
csrr t4,tdata1 | ||
RVTEST_SIGUPD(x1, t4) | ||
csrr t6,tdata2 | ||
RVTEST_SIGUPD(x1, t6) | ||
|
||
# Trigger setup complete; now perform an instruction that will hit the trigger | ||
la t4, 0x80001000 | ||
jalr x0,0(t4) | ||
nop | ||
nop | ||
|
||
#endif | ||
|
||
trap_handler: | ||
# Save trap information | ||
csrr t0, mcause # Cause of the trap | ||
csrr t1, mepc # Program counter at the time of trap | ||
csrr t2, mtval # Trap value | ||
RVTEST_SIGUPD(x1, t0) # Update signature with mcause | ||
RVTEST_SIGUPD(x1, t1) # Update signature with mepc | ||
RVTEST_SIGUPD(x1, t2) # Update signature with mtval | ||
|
||
# Check if the trigger hit bit is set (bit 22 in tdata1) | ||
csrr t3, tdata1 | ||
RVTEST_SIGUPD(x1, t3) | ||
|
||
end: | ||
RVTEST_CODE_END | ||
RVMODEL_HALT | ||
|
||
# Output data section. | ||
RVMODEL_DATA_BEGIN | ||
rvtest_sig_begin: | ||
sig_begin_canary: | ||
CANARY; | ||
|
||
signature_x1_0: | ||
.fill 128*(XLEN/32),4,0xdeadbeef | ||
|
||
sig_end_canary: | ||
CANARY; | ||
rvtest_sig_end: | ||
RVMODEL_DATA_END | ||
|
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 |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#include "model_test.h" | ||
#include "arch_test.h" | ||
#include "debug_defines.h" | ||
RVTEST_ISA("RV32IZicsr_Sdtrig") | ||
|
||
.section .text.init | ||
.globl rvtest_entry_point | ||
rvtest_entry_point: | ||
RVMODEL_BOOT | ||
RVTEST_CODE_BEGIN | ||
|
||
#ifdef TEST_CASE_1 | ||
RVTEST_CASE(1,"//check ISA:=regex(.*I.*Zicsr.*Sdtrig.*);def TEST_CASE_1=True;",execute_match2) | ||
RVTEST_SIGBASE(x1, signature_x1_0) | ||
|
||
# Set mtvec to the address of the trap handler | ||
la a0, trap_handler | ||
csrw mtvec, a0 | ||
|
||
# Read the misa | ||
csrr t2, misa | ||
RVTEST_SIGUPD(x1,t2) | ||
li t1, (1 << 18) | ||
and t2,t2,t1 | ||
|
||
bnez t2, implement_mie | ||
beqz t2 , implement_tcontrol | ||
|
||
implement_mie: | ||
li t1,(1<<3) | ||
csrw mstatus, t1 | ||
csrr t4, mstatus | ||
j resume_code | ||
|
||
implement_tcontrol: | ||
|
||
li t3, (1<<3) | ||
csrw tcontrol, t3 | ||
csrr t4, tcontrol | ||
j resume_code | ||
|
||
resume_code: | ||
|
||
# Write 0 to tselect, read back and append it to the signature | ||
csrw tselect, zero | ||
csrr t0, tselect | ||
RVTEST_SIGUPD(x1, t0) | ||
|
||
# Read tinfo | ||
csrr t6, tinfo | ||
|
||
# Set the value of tdata | ||
csrw tdata1, zero | ||
csrr a3, tdata1 | ||
|
||
# Set the address for tdata2 where the trigger should occur | ||
la t2, 0x80001233 # Set the data value to match | ||
csrw tdata2, t2 | ||
|
||
# Set up trigger to cause a trap on a breakpoint | ||
# Configure tdata1 for address match control | ||
li t2, (CSR_TDATA1_TYPE_MCONTROL6 << 28 | \ | ||
CSR_TDATA1_DMODE_BOTH << 27 | \ | ||
CSR_MCONTROL6_SELECT_ADDRESS << 21 | \ | ||
CSR_MCONTROL6_SIZE_ANY << 16 | \ | ||
CSR_MCONTROL6_CHAIN_DISABLED << 11 | \ | ||
CSR_MCONTROL6_ACTION_BREAKPOINT << 12 | \ | ||
CSR_MCONTROL6_MATCH_GE << 7 | \ | ||
CSR_MCONTROL6_M | \ | ||
CSR_MCONTROL6_EXECUTE) | ||
csrw tdata1, t2 | ||
csrr t4,tdata1 | ||
RVTEST_SIGUPD(x1, t4) | ||
csrr t6,tdata2 | ||
RVTEST_SIGUPD(x1, t6) | ||
|
||
# Trigger setup complete; now perform an instruction that will hit the trigger | ||
la t4, 0x80001234 | ||
jalr x0,0(t4) | ||
nop | ||
nop | ||
|
||
#endif | ||
|
||
trap_handler: | ||
# Save trap information | ||
csrr t0, mcause # Cause of the trap | ||
csrr t1, mepc # Program counter at the time of trap | ||
csrr t2, mtval # Trap value | ||
RVTEST_SIGUPD(x1, t0) # Update signature with mcause | ||
RVTEST_SIGUPD(x1, t1) # Update signature with mepc | ||
RVTEST_SIGUPD(x1, t2) # Update signature with mtval | ||
|
||
# Check if the trigger hit bit is set (bit 22 in tdata1) | ||
csrr t3, tdata1 | ||
RVTEST_SIGUPD(x1, t3) | ||
|
||
end: | ||
RVTEST_CODE_END | ||
RVMODEL_HALT | ||
|
||
# Output data section. | ||
RVMODEL_DATA_BEGIN | ||
rvtest_sig_begin: | ||
sig_begin_canary: | ||
CANARY; | ||
|
||
signature_x1_0: | ||
.fill 128*(XLEN/32),4,0xdeadbeef | ||
|
||
sig_end_canary: | ||
CANARY; | ||
rvtest_sig_end: | ||
RVMODEL_DATA_END | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this isn't used anywhere.