OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [riscv-compliance/] [riscv-test-suite/] [rv32i/] [src/] [I-DELAY_SLOTS-01.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
# RISC-V Compliance Test I-DELAY_SLOTS-01
2
#
3
# Copyright (c) 2017, Codasip Ltd.
4
# Copyright (c) 2018, Imperas Software Ltd. Additions
5
# All rights reserved.
6
#
7
# Redistribution and use in source and binary forms, with or without
8
# modification, are permitted provided that the following conditions are met:
9
#      * Redistributions of source code must retain the above copyright
10
#        notice, this list of conditions and the following disclaimer.
11
#      * Redistributions in binary form must reproduce the above copyright
12
#        notice, this list of conditions and the following disclaimer in the
13
#        documentation and/or other materials provided with the distribution.
14
#      * Neither the name of the Codasip Ltd., Imperas Software Ltd. nor the
15
#        names of its contributors may be used to endorse or promote products
16
#        derived from this software without specific prior written permission.
17
#
18
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Codasip Ltd., Imperas Software Ltd.
22
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
#
29
# Specification: RV32I Base Integer Instruction Set, Version 2.0
30
# Description: Testing delay slots of jump and branch instructions.
31
 
32
#include "compliance_test.h"
33
#include "compliance_io.h"
34
#include "test_macros.h"
35
 
36
# Test Virtual Machine (TVM) used by program.
37
RV_COMPLIANCE_RV32M
38
 
39
# Test code region
40
RV_COMPLIANCE_CODE_BEGIN
41
 
42
    RVTEST_IO_INIT
43
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
44
    RVTEST_IO_WRITE_STR("# Test Begin Reserved regs ra(x1) a0(x10) t0(x5)\n")
45
 
46
    # ---------------------------------------------------------------------------------------------
47
    RVTEST_IO_WRITE_STR("# Test part A1 - test JAL\n");
48
 
49
    # Address for test results
50
    la      x1, test_A1_res
51
 
52
    # Test
53
    li      x2, 0x11111111
54
    jal     x0, 1f
55
    li      x2, 0
56
1:
57
 
58
    # Store results
59
    sw      x2, 0(x1)
60
 
61
    //
62
    // Assert
63
    //
64
    RVTEST_IO_CHECK()
65
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x11111111)
66
 
67
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
68
 
69
    # ---------------------------------------------------------------------------------------------
70
    RVTEST_IO_WRITE_STR("# Test part A2 - test JALR\n");
71
 
72
    # Address for test results
73
    la      x1, test_A2_res
74
 
75
    # Test
76
    li      x2, 0x22222222
77
    la      x4, 1f
78
    jalr    x0, x4, 0
79
    li      x2, 0
80
1:
81
 
82
    # Store results
83
    sw      x2, 0(x1)
84
 
85
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x22222222)
86
 
87
    RVTEST_IO_WRITE_STR("# Test part A2  - Complete\n");
88
 
89
    # ---------------------------------------------------------------------------------------------
90
    RVTEST_IO_WRITE_STR("# Test part B1 - test BEQ\n");
91
 
92
    # Address for test results
93
    la      x1, test_B1_res
94
 
95
    # Register initialization
96
    li      x5, 5
97
    li      x6, 6
98
 
99
    # Test
100
    li      x2, 0x33333333
101
    beq     x5, x5, 1f
102
    li      x2, 0
103
1:
104
 
105
    # Store results
106
    sw      x2, 0(x1)
107
 
108
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x33333333)
109
 
110
    RVTEST_IO_WRITE_STR("# Test part A3  - Complete\n");
111
 
112
    # ---------------------------------------------------------------------------------------------
113
    RVTEST_IO_WRITE_STR("# Test part B2 - test BNE\n");
114
 
115
    # Address for test results
116
    la      x1, test_B2_res
117
 
118
    # Register initialization
119
    li      x5, 5
120
    li      x6, 6
121
 
122
    # Test
123
    li      x2, 0x44444444
124
    bne     x5, x6, 1f
125
    li      x2, 0
126
1:
127
 
128
    # Store results
129
    sw      x2, 0(x1)
130
 
131
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x44444444)
132
 
133
    RVTEST_IO_WRITE_STR("# Test part A4  - Complete\n");
134
 
135
    # ---------------------------------------------------------------------------------------------
136
    RVTEST_IO_WRITE_STR("# Test part B3 - test BLT\n");
137
 
138
    # Address for test results
139
    la      x1, test_B3_res
140
 
141
    # Register initialization
142
    li      x5, 5
143
    li      x6, 6
144
 
145
    # Test
146
    li      x2, 0x55555555
147
    blt     x5, x6, 1f
148
    li      x2, 0
149
1:
150
 
151
    # Store results
152
    sw      x2, 0(x1)
153
 
154
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x55555555)
155
 
156
    RVTEST_IO_WRITE_STR("# Test part A5  - Complete\n");
157
 
158
    # ---------------------------------------------------------------------------------------------
159
    RVTEST_IO_WRITE_STR("# Test part B4 - test BLTU\n");
160
 
161
    # Address for test results
162
    la      x1, test_B4_res
163
 
164
    # Register initialization
165
    li      x5, 5
166
    li      x6, 6
167
 
168
    # Test
169
    li      x2, 0x66666666
170
    bltu    x5, x6, 1f
171
    li      x2, 0
172
1:
173
 
174
    # Store results
175
    sw      x2, 0(x1)
176
 
177
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x66666666)
178
 
179
    RVTEST_IO_WRITE_STR("# Test part B  - Complete\n");
180
 
181
    # ---------------------------------------------------------------------------------------------
182
    RVTEST_IO_WRITE_STR("# Test part B5 - test BGE\n");
183
 
184
    # Address for test results
185
    la      x1, test_B5_res
186
 
187
    # Register initialization
188
    li      x5, 5
189
    li      x6, 6
190
 
191
    # Test
192
    li      x2, 0x77777777
193
    bge     x6, x5, 1f
194
    li      x2, 0
195
1:
196
 
197
    # Store results
198
    sw      x2, 0(x1)
199
 
200
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x77777777)
201
 
202
    RVTEST_IO_WRITE_STR("# Test part C  - Complete\n");
203
 
204
    # ---------------------------------------------------------------------------------------------
205
    RVTEST_IO_WRITE_STR("# Test part B6 - test BGEU\n");
206
 
207
    # Address for test results
208
    la      x1, test_B6_res
209
 
210
    # Register initialization
211
    li      x5, 5
212
    li      x6, 6
213
 
214
    # Test
215
    li      x2, 0x88888888
216
    bgeu    x6, x5, 1f
217
    li      x2, 0
218
1:
219
 
220
    # Store results
221
    sw      x2, 0(x1)
222
 
223
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x88888888)
224
 
225
    RVTEST_IO_WRITE_STR("# Test part D  - Complete\n");
226
 
227
    RVTEST_IO_WRITE_STR("# Test End\n")
228
 
229
 # ---------------------------------------------------------------------------------------------
230
    # HALT
231
    RV_COMPLIANCE_HALT
232
 
233
RV_COMPLIANCE_CODE_END
234
 
235
# Input data section.
236
    .data
237
    .align 4
238
 
239
 
240
# Output data section.
241
RV_COMPLIANCE_DATA_BEGIN
242
    .align 4
243
 
244
test_A1_res:
245
    .fill 1, 4, -1
246
test_A2_res:
247
    .fill 1, 4, -1
248
test_B1_res:
249
    .fill 1, 4, -1
250
test_B2_res:
251
    .fill 1, 4, -1
252
test_B3_res:
253
    .fill 1, 4, -1
254
test_B4_res:
255
    .fill 1, 4, -1
256
test_B5_res:
257
    .fill 1, 4, -1
258
test_B6_res:
259
    .fill 1, 4, -1
260
 
261
RV_COMPLIANCE_DATA_END

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.