1 |
2 |
mballance |
# RISC-V Compliance Test RV32IMC-C.LW-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: RV32IMC Base Integer Instruction Set, Version 2.0
|
29 |
|
|
# Description: Testing instruction C.LW.
|
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_CL(c.lw, x14, 0, x2, 0)
|
51 |
|
|
|
52 |
|
|
# ---------------------------------------------------------------------------------------------
|
53 |
|
|
|
54 |
|
|
RVTEST_IO_WRITE_STR("# Test number 2 - corner cases\n")
|
55 |
|
|
|
56 |
|
|
# address for test results
|
57 |
|
|
la x2, test_2_res
|
58 |
|
|
|
59 |
|
|
TEST_CL(c.lw, x15, 4, x2, 0)
|
60 |
|
|
|
61 |
|
|
# ---------------------------------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
RVTEST_IO_WRITE_STR("# Test number 3 - corner cases\n")
|
64 |
|
|
|
65 |
|
|
# address for test results
|
66 |
|
|
la x2, test_3_res
|
67 |
|
|
|
68 |
|
|
TEST_CL(c.lw, x8, 8, x2, 0)
|
69 |
|
|
|
70 |
|
|
# ---------------------------------------------------------------------------------------------
|
71 |
|
|
|
72 |
|
|
RVTEST_IO_WRITE_STR("# Test number 4 - corner cases\n")
|
73 |
|
|
|
74 |
|
|
# address for test results
|
75 |
|
|
la x2, test_4_res
|
76 |
|
|
|
77 |
|
|
TEST_CL(c.lw, x9, 100, x2, 0)
|
78 |
|
|
|
79 |
|
|
# ---------------------------------------------------------------------------------------------
|
80 |
|
|
|
81 |
|
|
RVTEST_IO_WRITE_STR("# Test number 5 - corner cases\n")
|
82 |
|
|
|
83 |
|
|
# address for test results
|
84 |
|
|
la x2, test_5_res
|
85 |
|
|
|
86 |
|
|
TEST_CL(c.lw, x13, 124, x2, 0)
|
87 |
|
|
|
88 |
|
|
RVTEST_IO_WRITE_STR("Test End\n")
|
89 |
|
|
|
90 |
|
|
# ---------------------------------------------------------------------------------------------
|
91 |
|
|
|
92 |
|
|
RV_COMPLIANCE_HALT
|
93 |
|
|
|
94 |
|
|
RV_COMPLIANCE_CODE_END
|
95 |
|
|
|
96 |
|
|
# Input data section.
|
97 |
|
|
.data
|
98 |
|
|
.align 4
|
99 |
|
|
test_data:
|
100 |
|
|
.word 0x11111111
|
101 |
|
|
.word 0x22222222
|
102 |
|
|
.word 0x33333333
|
103 |
|
|
.fill 22, 4, -1
|
104 |
|
|
.word 0x44444444
|
105 |
|
|
.fill 5, 4, -1
|
106 |
|
|
.word 0x55555555
|
107 |
|
|
|
108 |
|
|
# Output data section.
|
109 |
|
|
RV_COMPLIANCE_DATA_BEGIN
|
110 |
|
|
test_1_res:
|
111 |
|
|
.fill 1, 4, -1
|
112 |
|
|
test_2_res:
|
113 |
|
|
.fill 1, 4, -1
|
114 |
|
|
test_3_res:
|
115 |
|
|
.fill 1, 4, -1
|
116 |
|
|
test_4_res:
|
117 |
|
|
.fill 1, 4, -1
|
118 |
|
|
test_5_res:
|
119 |
|
|
.fill 1, 4, -1
|
120 |
|
|
|
121 |
|
|
RV_COMPLIANCE_DATA_END
|