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-SLTIU-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-SLTIU-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 instruction SLTIU.
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 - general test of value 0 with 0, 1, -1, MIN, MAX immediate values\n");
48
 
49
    # Addresses for test data and results
50
    la      x1, test_A1_data
51
    la      x2, test_A1_res
52
 
53
    # Load testdata
54
    lw      x3, 0(x1)
55
 
56
    # Test
57
    sltiu   x4, x3, 1
58
    sltiu   x5, x3, 0x7FF
59
    sltiu   x6, x3, 0xFFFFFFFF
60
    sltiu   x7, x3, 0
61
    sltiu   x8, x3, 0xFFFFF800
62
 
63
    # Store results
64
    sw      x3, 0(x2)
65
    sw      x4, 4(x2)
66
    sw      x5, 8(x2)
67
    sw      x6, 12(x2)
68
    sw      x7, 16(x2)
69
    sw      x8, 20(x2)
70
 
71
    //
72
    // Assert
73
    //
74
    RVTEST_IO_CHECK()
75
    RVTEST_IO_ASSERT_GPR_EQ(x3, 0x00000000)
76
    RVTEST_IO_ASSERT_GPR_EQ(x4, 0x00000001)
77
    RVTEST_IO_ASSERT_GPR_EQ(x5, 0x00000000)
78
    RVTEST_IO_ASSERT_GPR_EQ(x6, 0x00000001)
79
    RVTEST_IO_ASSERT_GPR_EQ(x7, 0x00000000)
80
    RVTEST_IO_ASSERT_GPR_EQ(x8, 0x00000001)
81
 
82
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
83
 
84
    # ---------------------------------------------------------------------------------------------
85
    RVTEST_IO_WRITE_STR("# Test part A2 - general test of value 1 with 0, 1, -1, MIN, MAX immediate values\n");
86
 
87
    # Addresses for test data and results
88
    la      x1, test_A2_data
89
    la      x2, test_A2_res
90
 
91
    # Load testdata
92
    lw      x8, 0(x1)
93
 
94
    # Test
95
    sltiu   x9, x8, 1
96
    sltiu   x10, x8, 0x7FF
97
    sltiu   x11, x8, 0xFFFFFFFF
98
    sltiu   x12, x8, 0
99
    sltiu   x13, x8, 0xFFFFF800
100
 
101
    # Store results
102
    sw      x8, 0(x2)
103
    sw      x9, 4(x2)
104
    sw      x10, 8(x2)
105
    sw      x11, 12(x2)
106
    sw      x12, 16(x2)
107
    sw      x13, 20(x2)
108
 
109
    RVTEST_IO_ASSERT_GPR_EQ(x8, 0x00000001)
110
    RVTEST_IO_ASSERT_GPR_EQ(x9, 0x00000000)
111
    #RVTEST_IO_ASSERT_GPR_EQ(x10, 0x00000000)
112
    RVTEST_IO_ASSERT_GPR_EQ(x11, 0x00000001)
113
    RVTEST_IO_ASSERT_GPR_EQ(x12, 0x00000000)
114
    RVTEST_IO_ASSERT_GPR_EQ(x13, 0x00000001)
115
 
116
    RVTEST_IO_WRITE_STR("# Test part A2  - Complete\n");
117
 
118
    # ---------------------------------------------------------------------------------------------
119
    RVTEST_IO_WRITE_STR("# Test part A3 - general test of value -1 with 0, 1, -1, MIN, MAX immediate values\n");
120
 
121
    # Addresses for test data and results
122
    la      x1, test_A3_data
123
    la      x2, test_A3_res
124
 
125
    # Load testdata
126
    lw      x13, 0(x1)
127
 
128
    # Test
129
    sltiu   x14, x13, 1
130
    sltiu   x15, x13, 0x7FF
131
    sltiu   x16, x13, 0xFFFFFFFF
132
    sltiu   x17, x13, 0
133
    sltiu   x18, x13, 0xFFFFF800
134
 
135
    # Store results
136
    sw      x13, 0(x2)
137
    sw      x14, 4(x2)
138
    sw      x15, 8(x2)
139
    sw      x16, 12(x2)
140
    sw      x17, 16(x2)
141
    sw      x18, 20(x2)
142
 
143
    RVTEST_IO_ASSERT_GPR_EQ(x13, 0xFFFFFFFF)
144
    RVTEST_IO_ASSERT_GPR_EQ(x14, 0x00000000)
145
    RVTEST_IO_ASSERT_GPR_EQ(x15, 0x00000000)
146
    RVTEST_IO_ASSERT_GPR_EQ(x16, 0x00000000)
147
    RVTEST_IO_ASSERT_GPR_EQ(x17, 0x00000000)
148
    RVTEST_IO_ASSERT_GPR_EQ(x18, 0x00000000)
149
 
150
    RVTEST_IO_WRITE_STR("# Test part A3  - Complete\n");
151
 
152
    # ---------------------------------------------------------------------------------------------
153
    RVTEST_IO_WRITE_STR("# Test part A4 - general test of value 0x7FFFFFFF with 0, 1, -1, MIN, MAX immediate values\n");
154
 
155
    # Addresses for test data and results
156
    la      x1, test_A4_data
157
    la      x2, test_A4_res
158
 
159
    # Load testdata
160
    lw      x18, 0(x1)
161
 
162
    # Test
163
    sltiu   x19, x18, 1
164
    sltiu   x20, x18, 0x7FF
165
    sltiu   x21, x18, 0xFFFFFFFF
166
    sltiu   x22, x18, 0
167
    sltiu   x23, x18, 0xFFFFF800
168
 
169
    # Store results
170
    sw      x18, 0(x2)
171
    sw      x19, 4(x2)
172
    sw      x20, 8(x2)
173
    sw      x21, 12(x2)
174
    sw      x22, 16(x2)
175
    sw      x23, 20(x2)
176
 
177
    RVTEST_IO_ASSERT_GPR_EQ(x18, 0x7FFFFFFF)
178
    RVTEST_IO_ASSERT_GPR_EQ(x19, 0x00000000)
179
    RVTEST_IO_ASSERT_GPR_EQ(x20, 0x00000000)
180
    RVTEST_IO_ASSERT_GPR_EQ(x21, 0x00000001)
181
    RVTEST_IO_ASSERT_GPR_EQ(x22, 0x00000000)
182
    RVTEST_IO_ASSERT_GPR_EQ(x23, 0x00000001)
183
 
184
    RVTEST_IO_WRITE_STR("# Test part A4  - Complete\n");
185
 
186
    # ---------------------------------------------------------------------------------------------
187
    RVTEST_IO_WRITE_STR("# Test part A5 - general test of value 0x80000000 with 0, 1, -1, MIN, MAX immediate values\n");
188
 
189
    # Addresses for test data and results
190
    la      x1, test_A5_data
191
    la      x2, test_A5_res
192
 
193
    # Load testdata
194
    lw      x23, 0(x1)
195
 
196
    # Test
197
    sltiu   x24, x23, 1
198
    sltiu   x25, x23, 0x7FF
199
    sltiu   x26, x23, 0xFFFFFFFF
200
    sltiu   x27, x23, 0
201
    sltiu   x28, x23, 0xFFFFF800
202
 
203
    # Store results
204
    sw      x23, 0(x2)
205
    sw      x24, 4(x2)
206
    sw      x25, 8(x2)
207
    sw      x26, 12(x2)
208
    sw      x27, 16(x2)
209
    sw      x28, 20(x2)
210
 
211
    RVTEST_IO_ASSERT_GPR_EQ(x23, 0x80000000)
212
    RVTEST_IO_ASSERT_GPR_EQ(x24, 0x00000000)
213
    RVTEST_IO_ASSERT_GPR_EQ(x25, 0x00000000)
214
    RVTEST_IO_ASSERT_GPR_EQ(x26, 0x00000001)
215
    RVTEST_IO_ASSERT_GPR_EQ(x27, 0x00000000)
216
    RVTEST_IO_ASSERT_GPR_EQ(x28, 0x00000001)
217
 
218
    RVTEST_IO_WRITE_STR("# Test part A5  - Complete\n");
219
 
220
    # ---------------------------------------------------------------------------------------------
221
    RVTEST_IO_WRITE_STR("# Test part B - testing writing to x0\n");
222
 
223
    # Addresses for test data and results
224
    la      x26, test_B_data
225
    la      x27, test_B_res
226
 
227
    # Load testdata
228
    lw      x1, 0(x26)
229
 
230
    # Test
231
    sltiu   x0, x1, 0xFFFFFFFF
232
 
233
    # Store results
234
    sw      x1, 0(x27)
235
    sw      x0, 4(x27)
236
 
237
 
238
    #RVTEST_IO_ASSERT_GPR_EQ(x1, 0x8000161C)
239
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
240
 
241
    RVTEST_IO_WRITE_STR("# Test part B  - Complete\n");
242
 
243
    # ---------------------------------------------------------------------------------------------
244
    RVTEST_IO_WRITE_STR("# Test part C - testing compare x0\n");
245
 
246
    # Addresses for test data and results
247
    la      x31, test_C_res
248
 
249
    # Test
250
    sltiu   x1, x0, 1
251
    sltiu   x2, x0, 0x7FF
252
    sltiu   x3, x0, 0xFFFFFFFF
253
    sltiu   x4, x0, 0
254
    sltiu   x5, x0, 0xFFFFF800
255
 
256
    # Store results
257
    sw      x0, 0(x31)
258
    sw      x1, 4(x31)
259
    sw      x2, 8(x31)
260
    sw      x3, 12(x31)
261
    sw      x4, 16(x31)
262
    sw      x5, 20(x31)
263
 
264
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
265
    #RVTEST_IO_ASSERT_GPR_EQ(x1, 0x800017A8)
266
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x00000001)
267
    RVTEST_IO_ASSERT_GPR_EQ(x3, 0x00000001)
268
    RVTEST_IO_ASSERT_GPR_EQ(x4, 0x00000000)
269
    RVTEST_IO_ASSERT_GPR_EQ(x5, 0x00000000)
270
 
271
    RVTEST_IO_WRITE_STR("# Test part C  - Complete\n");
272
 
273
    # ---------------------------------------------------------------------------------------------
274
    RVTEST_IO_WRITE_STR("# Test part D - testing forwarding between instructions\n");
275
 
276
    # Addresses for test data and results
277
    la      x31, test_D_res
278
 
279
    # Test
280
    sltiu   x1, x0, 1
281
    sltiu   x2, x1, 1
282
    sltiu   x28, x2, 1
283
    sltiu   x29, x28, 1
284
    sltiu   x30, x29, 1
285
 
286
    # Store results
287
    sw      x0, 0(x31)
288
    sw      x1, 4(x31)
289
    sw      x2, 8(x31)
290
    sw      x28, 12(x31)
291
    sw      x29, 16(x31)
292
    sw      x30, 20(x31)
293
 
294
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
295
    #RVTEST_IO_ASSERT_GPR_EQ(x1, 0x00000000)
296
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x00000000)
297
    RVTEST_IO_ASSERT_GPR_EQ(x28, 0x00000001)
298
    RVTEST_IO_ASSERT_GPR_EQ(x29, 0x00000000)
299
    RVTEST_IO_ASSERT_GPR_EQ(x30, 0x00000001)
300
 
301
    RVTEST_IO_WRITE_STR("# Test part D  - Complete\n");
302
 
303
    RVTEST_IO_WRITE_STR("# Test End\n")
304
 
305
 # ---------------------------------------------------------------------------------------------
306
    # HALT
307
    RV_COMPLIANCE_HALT
308
 
309
RV_COMPLIANCE_CODE_END
310
 
311
# Input data section.
312
    .data
313
    .align 4
314
 
315
test_A1_data:
316
    .word 0
317
test_A2_data:
318
    .word 1
319
test_A3_data:
320
    .word -1
321
test_A4_data:
322
    .word 0x7FFFFFFF
323
test_A5_data:
324
    .word 0x80000000
325
test_B_data:
326
    .word 1
327
 
328
# Output data section.
329
RV_COMPLIANCE_DATA_BEGIN
330
    .align 4
331
 
332
test_A1_res:
333
    .fill 6, 4, -1
334
test_A2_res:
335
    .fill 6, 4, -1
336
test_A3_res:
337
    .fill 6, 4, -1
338
test_A4_res:
339
    .fill 6, 4, -1
340
test_A5_res:
341
    .fill 6, 4, -1
342
test_B_res:
343
    .fill 2, 4, -1
344
test_C_res:
345
    .fill 6, 4, -1
346
test_D_res:
347
    .fill 6, 4, -1
348
 
349
 
350
RV_COMPLIANCE_DATA_END

powered by: WebSVN 2.1.0

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