-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added testfiles for pipeline hazards
- Loading branch information
1 parent
f6b7f0b
commit 7e5f31b
Showing
3 changed files
with
270 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# | ||
# TEST CODE FOR ADD | ||
# | ||
# ----------------------------------------- | ||
# Program section (known as text) | ||
# ----------------------------------------- | ||
.text | ||
|
||
# Start symbol (must be present), exported as a global symbol. | ||
_start: .global _start | ||
|
||
# Export main as a global symbol | ||
.global main | ||
|
||
# Label for entry point of test code | ||
main: | ||
### TEST CODE STARTS HERE ### | ||
|
||
# 100 + 150 = 250 (positive answer) | ||
li x1, 100 # set x1 to 100 (0x00000064) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li x2, 150 # set x2 to 150 (0x00000096) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
add x3, x1, x2 # add x1(100) to x2(150), x3=250 (0x000000FA) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
j pass | ||
### END OF TEST CODE ### | ||
|
||
# Exit test using RISC-V International's riscv-tests pass/fail criteria | ||
|
||
fail: | ||
li a0, 2 # set a0 (x10) to 0 to indicate a pass code | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li a7, 93 # set a7 (x17) to 93 (5dh) to indicate reached the end of the test | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
ebreak | ||
pass: | ||
li a0, 0 # set a0 (x10) to 0 to indicate a pass code | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li a7, 93 # set a7 (x17) to 93 (5dh) to indicate reached the end of the test | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
ebreak | ||
|
||
|
||
|
||
|
||
# ----------------------------------------- | ||
# Data section. Note starts at 0x1000, as | ||
# set by DATAADDR variable in rv_asm.bat. | ||
# ----------------------------------------- | ||
.data | ||
|
||
# Data section | ||
data: | ||
|
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,112 @@ | ||
# | ||
# TEST CODE FOR ADD | ||
# | ||
# ----------------------------------------- | ||
# Program section (known as text) | ||
# ----------------------------------------- | ||
.text | ||
|
||
# Start symbol (must be present), exported as a global symbol. | ||
_start: .global _start | ||
|
||
# Export main as a global symbol | ||
.global main | ||
|
||
# Label for entry point of test code | ||
main: | ||
### TEST CODE STARTS HERE ### | ||
|
||
# 1 NOP margin between dependent instructions | ||
|
||
li x1, 100 # set x1 to 100 (0x00000064) | ||
li x2, 150 # set x2 to 150 (0x00000096) | ||
add x3, x1, x2 # add x1(100) to x2(150), x3=250 (0x000000FA) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li x4, 0xFA # set x4 to 0xFA (expected value for x3) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
beqz x4, fail0 # make sure x4 has value | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
bne x3, x4, fail1 # branch to fail if not equal to expected value | ||
|
||
# 2 NOP margin between dependent instructions | ||
li x1, 100 # set x1 to 100 (0x00000064) | ||
li x2, 150 # set x2 to 150 (0x00000096) | ||
nop | ||
nop | ||
add x3, x1, x2 # add x1(100) to x2(150), x3=250 (0x000000FA) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
bne x3, x4, fail2 # branch to fail if not equal to expected value | ||
|
||
# 3 NOP margin between dependent instructions | ||
li x1, 100 # set x1 to 100 (0x00000064) | ||
li x2, 150 # set x2 to 150 (0x00000096) | ||
nop | ||
nop | ||
nop | ||
add x3, x1, x2 # add x1(100) to x2(150), x3=250 (0x000000FA) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
bne x3, x4, fail3 # branch to fail if not equal to expected value | ||
|
||
### END OF TEST CODE ### | ||
pass: | ||
li a0, 0 # set a0 (x10) to 0 to indicate a pass code | ||
li a7, 93 # set a7 (x17) to 93 (5dh) to indicate reached the end of the test | ||
ebreak | ||
|
||
fail0: | ||
li a0, 1 # fail code | ||
li a7, 93 # reached end of code | ||
ebreak | ||
|
||
fail1: | ||
li a0, 2 # fail code | ||
li a7, 93 # reached end of code | ||
ebreak | ||
|
||
fail2: | ||
li a0, 4 # fail code | ||
li a7, 93 # reached end of code | ||
ebreak | ||
|
||
fail3: | ||
li a0, 6 # fail code | ||
li a7, 93 # reached end of code | ||
ebreak | ||
|
||
|
||
|
||
|
||
# ----------------------------------------- | ||
# Data section. Note starts at 0x1000, as | ||
# set by DATAADDR variable in rv_asm.bat. | ||
# ----------------------------------------- | ||
.data | ||
|
||
# Data section | ||
data: | ||
|
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,68 @@ | ||
# | ||
# TEST CODE FOR ADD | ||
# | ||
# ----------------------------------------- | ||
# Program section (known as text) | ||
# ----------------------------------------- | ||
.text | ||
|
||
# Start symbol (must be present), exported as a global symbol. | ||
_start: .global _start | ||
|
||
# Export main as a global symbol | ||
.global main | ||
|
||
# Label for entry point of test code | ||
main: | ||
### TEST CODE STARTS HERE ### | ||
|
||
# 100 + 150 = 250 (positive answer) | ||
li x1, 100 # set x1 to 100 (0x00000064) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li x2, 150 # set x2 to 150 (0x00000096) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
add x3, x1, x2 # add x1(100) to x2(150), x3=250 (0x000000FA) | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
### END OF TEST CODE ### | ||
|
||
# Exit test using RISC-V International's riscv-tests pass/fail criteria | ||
li a0, 0 # set a0 (x10) to 0 to indicate a pass code | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
li a7, 93 # set a7 (x17) to 93 (5dh) to indicate reached the end of the test | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
nop | ||
ebreak | ||
|
||
# ----------------------------------------- | ||
# Data section. Note starts at 0x1000, as | ||
# set by DATAADDR variable in rv_asm.bat. | ||
# ----------------------------------------- | ||
.data | ||
|
||
# Data section | ||
data: | ||
|