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