-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
197 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# 0 "sources/amoadd_w.S" | ||
# 0 "<built-in>" | ||
# 0 "<command-line>" | ||
# 1 "/usr/include/stdc-predef.h" 1 3 4 | ||
# 0 "<command-line>" 2 | ||
# 1 "sources/amoadd_w.S" | ||
# See LICENSE for license details. | ||
|
||
#***************************************************************************** | ||
# amoadd_w.S | ||
#----------------------------------------------------------------------------- | ||
|
||
# Test amoadd.w instruction. | ||
|
||
|
||
# 1 "sources/riscv_test.h" 1 | ||
# 11 "sources/amoadd_w.S" 2 | ||
# 1 "sources/test_macros.h" 1 | ||
|
||
|
||
|
||
|
||
|
||
|
||
#----------------------------------------------------------------------- | ||
# Helper macros | ||
#----------------------------------------------------------------------- | ||
# 20 "sources/test_macros.h" | ||
# We use a macro hack to simpify code generation for various numbers | ||
# of bubble cycles. | ||
# 36 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# RV64UI MACROS | ||
#----------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------- | ||
# Tests for instructions with immediate operand | ||
#----------------------------------------------------------------------- | ||
# 92 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Tests for vector config instructions | ||
#----------------------------------------------------------------------- | ||
# 120 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Tests for an instruction with register operands | ||
#----------------------------------------------------------------------- | ||
# 148 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Tests for an instruction with register-register operands | ||
#----------------------------------------------------------------------- | ||
# 242 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Test memory instructions | ||
#----------------------------------------------------------------------- | ||
# 319 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Test branch instructions | ||
#----------------------------------------------------------------------- | ||
# 404 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Test jump instructions | ||
#----------------------------------------------------------------------- | ||
# 433 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# RV64UF MACROS | ||
#----------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------- | ||
# Tests floating-point instructions | ||
#----------------------------------------------------------------------- | ||
# 569 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Pass and fail code (assumes test num is in x28) | ||
#----------------------------------------------------------------------- | ||
# 581 "sources/test_macros.h" | ||
#----------------------------------------------------------------------- | ||
# Test data section | ||
#----------------------------------------------------------------------- | ||
# 12 "sources/amoadd_w.S" 2 | ||
|
||
|
||
.globl __runtime_start; __runtime_start: | ||
|
||
test_2: li x10, 2; ebreak; li a0, 0xffffffff80000000; li a1, 0xfffffffffffff800; la a3, amo_operand; sw a0, 0(a3); amoadd.w a4, a1, 0(a3);; li x29, 0xffffffff80000000; li x28, 2; bne a4, x29, fail; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
test_3: li x10, 3; ebreak; lw a5, 0(a3); li x29, 0x000000007ffff800; li x28, 3; bne a5, x29, fail; | ||
|
||
# try again after a cache miss | ||
test_4: li x10, 4; ebreak; li a1, 0xffffffff80000000; amoadd.w a4, a1, 0(a3);; li x29, 0x000000007ffff800; li x28, 4; bne a4, x29, fail; | ||
|
||
|
||
|
||
|
||
test_5: li x10, 5; ebreak; lw a5, 0(a3); li x29, 0xfffffffffffff800; li x28, 5; bne a5, x29, fail; | ||
|
||
bne x0, x28, pass; fail: unimp;; pass: ___pass: j ___pass; | ||
|
||
|
||
|
||
.data | ||
.balign 4; | ||
|
||
|
||
|
||
|
||
|
||
.bss | ||
.align 3 | ||
amo_operand: | ||
.word 0 | ||
.word 0 |
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,49 @@ | ||
# See LICENSE for license details. | ||
|
||
#***************************************************************************** | ||
# amoadd_w.S | ||
#----------------------------------------------------------------------------- | ||
# | ||
# Test amoadd.w instruction. | ||
# | ||
|
||
#include "riscv_test.h" | ||
#include "test_macros.h" | ||
|
||
RVTEST_RV32U | ||
RVTEST_CODE_BEGIN | ||
|
||
TEST_CASE(2, a4, 0xffffffff80000000, \ | ||
li a0, 0xffffffff80000000; \ | ||
li a1, 0xfffffffffffff800; \ | ||
la a3, amo_operand; \ | ||
sw a0, 0(a3); \ | ||
amoadd.w a4, a1, 0(a3); \ | ||
) | ||
|
||
TEST_CASE(3, a5, 0x000000007ffff800, lw a5, 0(a3)) | ||
|
||
# try again after a cache miss | ||
TEST_CASE(4, a4, 0x000000007ffff800, \ | ||
li a1, 0xffffffff80000000; \ | ||
amoadd.w a4, a1, 0(a3); \ | ||
) | ||
|
||
TEST_CASE(5, a5, 0xfffffffffffff800, lw a5, 0(a3)) | ||
|
||
TEST_PASSFAIL | ||
|
||
RVTEST_CODE_END | ||
|
||
.data | ||
RVTEST_DATA_BEGIN | ||
|
||
TEST_DATA | ||
|
||
RVTEST_DATA_END | ||
|
||
.bss | ||
.align 3 | ||
amo_operand: | ||
.word 0 | ||
.word 0 |