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-CSRRSI-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-CSRRSI-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 CSRRSI.
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 CSRRSI\n");
48
 
49
    # Address for test results
50
    la      x15, test_A1_res
51
 
52
    # Register initialization
53
    csrrw   x0, mscratch, x0
54
 
55
    # Test
56
    csrrsi  x1, mscratch, 1
57
    csrrw   x1, mscratch, x0
58
 
59
    csrrsi  x2, mscratch, 0
60
    csrrw   x2, mscratch, x0
61
 
62
    csrrsi  x3, mscratch, 0x1F
63
    csrrw   x3, mscratch, x0
64
 
65
    csrrsi  x4, mscratch, 0x10
66
    csrrw   x4, mscratch, x0
67
 
68
    csrrsi  x5, mscratch, 0xF
69
    csrrw   x5, mscratch, x0
70
 
71
    # Store results
72
    sw      x0, 0(x15)
73
    sw      x1, 4(x15)
74
    sw      x2, 8(x15)
75
    sw      x3, 12(x15)
76
    sw      x4, 16(x15)
77
    sw      x5, 20(x15)
78
 
79
    //
80
    // Assert
81
    //
82
    RVTEST_IO_CHECK()
83
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
84
    #RVTEST_IO_ASSERT_GPR_EQ(x1, 0x8000030C)
85
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x00000000)
86
    RVTEST_IO_ASSERT_GPR_EQ(x3, 0x0000001F)
87
    RVTEST_IO_ASSERT_GPR_EQ(x4, 0x00000010)
88
    RVTEST_IO_ASSERT_GPR_EQ(x5, 0x00000000)
89
 
90
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
91
 
92
    # ---------------------------------------------------------------------------------------------
93
    RVTEST_IO_WRITE_STR("# Test part A2 - general test of CSRRSI\n");
94
 
95
    # Address for test results
96
    la      x5, test_A2_res
97
 
98
    # Register initialization
99
    csrrw   x0, mscratch, x0
100
 
101
    # Test
102
    csrrsi  x11, mscratch, 1
103
    csrrsi  x12, mscratch, 0
104
    csrrsi  x13, mscratch, 0x1F
105
    csrrsi  x14, mscratch, 0x10
106
    csrrsi  x15, mscratch, 0xF
107
    csrrsi  x16, mscratch, 0
108
 
109
    # Store results
110
    sw      x0, 0(x5)
111
    sw      x11, 4(x5)
112
    sw      x12, 8(x5)
113
    sw      x13, 12(x5)
114
    sw      x14, 16(x5)
115
    sw      x15, 20(x5)
116
    sw      x16, 24(x5)
117
 
118
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
119
    RVTEST_IO_ASSERT_GPR_EQ(x11, 0x00000000)
120
    RVTEST_IO_ASSERT_GPR_EQ(x12, 0x00000001)
121
    RVTEST_IO_ASSERT_GPR_EQ(x13, 0x00000001)
122
    RVTEST_IO_ASSERT_GPR_EQ(x14, 0x0000001F)
123
    RVTEST_IO_ASSERT_GPR_EQ(x15, 0x0000001F)
124
    RVTEST_IO_ASSERT_GPR_EQ(x16, 0x0000001F)
125
 
126
    RVTEST_IO_WRITE_STR("# Test part A2  - Complete\n");
127
 
128
    # ---------------------------------------------------------------------------------------------
129
    RVTEST_IO_WRITE_STR("# Test part B - testing writing to x0\n");
130
 
131
    # Address for test results
132
    la      x1, test_B_res
133
 
134
    # Register initialization
135
    li      x20, 0x32165498
136
    csrrw   x0, mscratch, x20
137
 
138
    # Test
139
    csrrsi   x0, mscratch, 0xF
140
    csrrw    x21, mscratch, x20
141
 
142
    # store results
143
    sw      x0, 0(x1)
144
    sw      x21, 4(x1)
145
    sw      x20, 8(x1)
146
 
147
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
148
    RVTEST_IO_ASSERT_GPR_EQ(x21, 0x3216549F)
149
    RVTEST_IO_ASSERT_GPR_EQ(x20, 0x32165498)
150
 
151
    RVTEST_IO_WRITE_STR("# Test part A3  - Complete\n");
152
 
153
    RVTEST_IO_WRITE_STR("# Test End\n")
154
 
155
 # ---------------------------------------------------------------------------------------------
156
    # HALT
157
    RV_COMPLIANCE_HALT
158
 
159
RV_COMPLIANCE_CODE_END
160
 
161
# Input data section.
162
    .data
163
    .align 4
164
 
165
 
166
# Output data section.
167
RV_COMPLIANCE_DATA_BEGIN
168
    .align 4
169
 
170
test_A1_res:
171
    .fill 6, 4, -1
172
test_A2_res:
173
    .fill 7, 4, -1
174
test_B_res:
175
    .fill 3, 4, -1
176
 
177
RV_COMPLIANCE_DATA_END     # End of test output data region.

powered by: WebSVN 2.1.0

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