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-CSRRWI-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-CSRRWI-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 CSRRWI.
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 A - general test of CSRRWI\n");
48
 
49
    # Address for test results
50
    la      x15, test_A_res
51
 
52
    # Register initialization
53
    csrrw   x0, mscratch, x0
54
 
55
    # Test
56
    csrrwi  x2, mscratch, 1
57
    csrrwi  x4, mscratch, 0
58
    csrrwi  x6, mscratch, 0x1F
59
    csrrwi  x28, mscratch, 0x0F
60
    csrrwi  x30, mscratch, 0x10
61
    csrrwi  x31, mscratch, 0
62
 
63
    # Store results
64
    sw      x0, 0(x15)
65
    sw      x2, 4(x15)
66
    sw      x4, 8(x15)
67
    sw      x6, 12(x15)
68
    sw      x28, 16(x15)
69
    sw      x30, 20(x15)
70
    sw      x31, 24(x15)
71
 
72
    //
73
    // Assert
74
    //
75
    RVTEST_IO_CHECK()
76
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
77
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x00000000)
78
    RVTEST_IO_ASSERT_GPR_EQ(x4, 0x00000001)
79
    RVTEST_IO_ASSERT_GPR_EQ(x6, 0x00000000)
80
    RVTEST_IO_ASSERT_GPR_EQ(x28, 0x0000001F)
81
    RVTEST_IO_ASSERT_GPR_EQ(x30, 0x0000000F)
82
    RVTEST_IO_ASSERT_GPR_EQ(x31, 0x00000010)
83
 
84
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
85
 
86
    # ---------------------------------------------------------------------------------------------
87
    RVTEST_IO_WRITE_STR("# Test part B - testing writing to x0\n");
88
 
89
    # Address for test results
90
    la      x1, test_B_res
91
 
92
    # Test
93
    csrrwi  x0, mscratch, 0xF
94
    csrrwi  x0, mscratch, 0
95
 
96
    # store results
97
    sw      x0, 0(x1)
98
 
99
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x00000000)
100
 
101
    RVTEST_IO_WRITE_STR("# Test part A2  - Complete\n");
102
 
103
    RVTEST_IO_WRITE_STR("# Test End\n")
104
 
105
 # ---------------------------------------------------------------------------------------------
106
    # HALT
107
    RV_COMPLIANCE_HALT
108
 
109
RV_COMPLIANCE_CODE_END
110
 
111
# Input data section.
112
    .data
113
    .align 4
114
 
115
# Output data section.
116
RV_COMPLIANCE_DATA_BEGIN
117
    .align 4
118
 
119
test_A_res:
120
    .fill 7, 4, -1
121
test_B_res:
122
    .fill 1, 4, -1
123
 
124
RV_COMPLIANCE_DATA_END     # End of test output data region.

powered by: WebSVN 2.1.0

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