1 |
2 |
mballance |
# RISC-V Compliance Test RV64I-ADDW-01
|
2 |
|
|
#
|
3 |
|
|
# Copyright (c) 2018, Imperas Software Ltd.
|
4 |
|
|
# All rights reserved.
|
5 |
|
|
#
|
6 |
|
|
# Redistribution and use in source and binary forms, with or without
|
7 |
|
|
# modification, are permitted provided that the following conditions are met:
|
8 |
|
|
# * Redistributions of source code must retain the above copyright
|
9 |
|
|
# notice, this list of conditions and the following disclaimer.
|
10 |
|
|
# * Redistributions in binary form must reproduce the above copyright
|
11 |
|
|
# notice, this list of conditions and the following disclaimer in the
|
12 |
|
|
# documentation and/or other materials provided with the distribution.
|
13 |
|
|
# * Neither the name of the Imperas Software Ltd. nor the
|
14 |
|
|
# names of its contributors may be used to endorse or promote products
|
15 |
|
|
# derived from this software without specific prior written permission.
|
16 |
|
|
#
|
17 |
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
18 |
|
|
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
19 |
|
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 |
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Imperas Software Ltd. BE LIABLE FOR ANY
|
21 |
|
|
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
22 |
|
|
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
23 |
|
|
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
24 |
|
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25 |
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
26 |
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 |
|
|
#
|
28 |
|
|
# Specification: RV64I Base Integer Instruction Set, Version 2.0
|
29 |
|
|
# Description: Testing instruction ADDW.
|
30 |
|
|
|
31 |
|
|
#include "test_macros.h"
|
32 |
|
|
#include "compliance_test.h"
|
33 |
|
|
#include "compliance_io.h"
|
34 |
|
|
|
35 |
|
|
RV_COMPLIANCE_RV32M
|
36 |
|
|
|
37 |
|
|
RV_COMPLIANCE_CODE_BEGIN
|
38 |
|
|
|
39 |
|
|
RVTEST_IO_INIT
|
40 |
|
|
RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
|
41 |
|
|
RVTEST_IO_WRITE_STR("Test Begin Reserved regs ra(x1) a0(x10) t0(x5)\n")
|
42 |
|
|
|
43 |
|
|
# ---------------------------------------------------------------------------------------------
|
44 |
|
|
|
45 |
|
|
RVTEST_IO_WRITE_STR("# Test number 1 - corner cases\n")
|
46 |
|
|
|
47 |
|
|
# address for test results
|
48 |
|
|
la x2, test_1_res
|
49 |
|
|
|
50 |
|
|
TEST_RR_SRC2(addw, x3, x4, 0, 0x0, 0x0, x2, 0)
|
51 |
|
|
TEST_RR_SRC2(addw, x8, x9, 0x1, 0x0, 0x1, x2, 8)
|
52 |
|
|
TEST_RR_SRC2(addw, x11, x12, 0xffffffffffffffff, 0x0, -0x1, x2, 16)
|
53 |
|
|
TEST_RR_SRC2(addw, x13, x14, 0xffffffffffffffff, 0x0, 0x7fffffffffffffff, x2, 24)
|
54 |
|
|
TEST_RR_SRC2(addw, x15, x16, 0, 0x0, 0x8000000000000000, x2, 32)
|
55 |
|
|
|
56 |
|
|
# ---------------------------------------------------------------------------------------------
|
57 |
|
|
|
58 |
|
|
RVTEST_IO_WRITE_STR("# Test number 2 - corner cases\n")
|
59 |
|
|
|
60 |
|
|
# address for test results
|
61 |
|
|
la x2, test_2_res
|
62 |
|
|
|
63 |
|
|
TEST_RR_SRC2(addw, x17, x18, 0x1, 0x1, 0x0, x2, 0)
|
64 |
|
|
TEST_RR_SRC2(addw, x19, x20, 0x2, 0x1, 0x1, x2, 8)
|
65 |
|
|
TEST_RR_SRC2(addw, x21, x22, 0, 0x1, -0x1, x2, 16)
|
66 |
|
|
TEST_RR_SRC2(addw, x23, x24, 0, 0x1, 0x7fffffffffffffff, x2, 24)
|
67 |
|
|
TEST_RR_SRC2(addw, x25, x26, 0x1, 0x1, 0x8000000000000000, x2, 32)
|
68 |
|
|
|
69 |
|
|
# ---------------------------------------------------------------------------------------------
|
70 |
|
|
|
71 |
|
|
RVTEST_IO_WRITE_STR("# Test number 3 - corner cases\n")
|
72 |
|
|
|
73 |
|
|
# address for test results
|
74 |
|
|
la x2, test_3_res
|
75 |
|
|
|
76 |
|
|
TEST_RR_SRC2(addw, x27, x28, 0xffffffffffffffff, -0x1, 0x0, x2, 0)
|
77 |
|
|
TEST_RR_SRC2(addw, x29, x30, 0, -0x1, 0x1, x2, 8)
|
78 |
|
|
TEST_RR_SRC2(addw, x31, x3, 0xfffffffffffffffe, -0x1, -0x1, x2, 16)
|
79 |
|
|
TEST_RR_SRC2(addw, x4, x8, 0xfffffffffffffffe, -0x1, 0x7fffffffffffffff, x2, 24)
|
80 |
|
|
TEST_RR_SRC2(addw, x9, x11, 0xffffffffffffffff, -0x1, 0x8000000000000000, x2, 32)
|
81 |
|
|
|
82 |
|
|
# ---------------------------------------------------------------------------------------------
|
83 |
|
|
|
84 |
|
|
RVTEST_IO_WRITE_STR("# Test number 4 - corner cases\n")
|
85 |
|
|
|
86 |
|
|
# address for test results
|
87 |
|
|
la x2, test_4_res
|
88 |
|
|
|
89 |
|
|
TEST_RR_SRC2(addw, x12, x13, 0xffffffffffffffff, 0x7fffffffffffffff, 0x0, x2, 0)
|
90 |
|
|
TEST_RR_SRC2(addw, x14, x15, 0, 0x7fffffffffffffff, 0x1, x2, 8)
|
91 |
|
|
TEST_RR_SRC2(addw, x16, x17, 0xfffffffffffffffe, 0x7fffffffffffffff, -0x1, x2, 16)
|
92 |
|
|
TEST_RR_SRC2(addw, x18, x19, 0xfffffffffffffffe, 0x7fffffffffffffff, 0x7fffffffffffffff, x2, 24)
|
93 |
|
|
TEST_RR_SRC2(addw, x20, x21, 0xffffffffffffffff, 0x7fffffffffffffff, 0x8000000000000000, x2, 32)
|
94 |
|
|
|
95 |
|
|
# ---------------------------------------------------------------------------------------------
|
96 |
|
|
|
97 |
|
|
RVTEST_IO_WRITE_STR("# Test number 5 - corner cases\n")
|
98 |
|
|
|
99 |
|
|
# address for test results
|
100 |
|
|
la x2, test_5_res
|
101 |
|
|
|
102 |
|
|
TEST_RR_SRC2(addw, x22, x23, 0, 0x8000000000000000, 0x0, x2, 0)
|
103 |
|
|
TEST_RR_SRC2(addw, x24, x25, 0x1, 0x8000000000000000, 0x1, x2, 8)
|
104 |
|
|
TEST_RR_SRC2(addw, x26, x27, 0xffffffffffffffff, 0x8000000000000000, -0x1, x2, 16)
|
105 |
|
|
TEST_RR_SRC2(addw, x28, x29, 0xffffffffffffffff, 0x8000000000000000, 0x7fffffffffffffff, x2, 24)
|
106 |
|
|
TEST_RR_SRC2(addw, x30, x31, 0, 0x8000000000000000, 0x8000000000000000, x2, 32)
|
107 |
|
|
|
108 |
|
|
RVTEST_IO_WRITE_STR("Test End\n")
|
109 |
|
|
|
110 |
|
|
# ---------------------------------------------------------------------------------------------
|
111 |
|
|
|
112 |
|
|
RV_COMPLIANCE_HALT
|
113 |
|
|
|
114 |
|
|
RV_COMPLIANCE_CODE_END
|
115 |
|
|
|
116 |
|
|
# Input data section.
|
117 |
|
|
.data
|
118 |
|
|
|
119 |
|
|
# Output data section.
|
120 |
|
|
RV_COMPLIANCE_DATA_BEGIN
|
121 |
|
|
test_1_res:
|
122 |
|
|
.fill 5, 8, -1
|
123 |
|
|
test_2_res:
|
124 |
|
|
.fill 5, 8, -1
|
125 |
|
|
test_3_res:
|
126 |
|
|
.fill 5, 8, -1
|
127 |
|
|
test_4_res:
|
128 |
|
|
.fill 5, 8, -1
|
129 |
|
|
test_5_res:
|
130 |
|
|
.fill 5, 8, -1
|
131 |
|
|
test_6_res:
|
132 |
|
|
.fill 5, 8, -1
|
133 |
|
|
test_7_res:
|
134 |
|
|
.fill 5, 8, -1
|
135 |
|
|
test_8_res:
|
136 |
|
|
.fill 5, 8, -1
|
137 |
|
|
test_9_res:
|
138 |
|
|
.fill 5, 8, -1
|
139 |
|
|
test_10_res:
|
140 |
|
|
.fill 5, 8, -1
|
141 |
|
|
|
142 |
|
|
RV_COMPLIANCE_DATA_END
|