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-FENCE.I-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-FENCE.I-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 FENCE.I.
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 - test fence\n");
48
 
49
    # Addresses for test data and results
50
    la      x16, test_A_data
51
    la      x17, test_A_res
52
 
53
    # Register initialization
54
    li      x3, 0
55
 
56
    # Load testdata
57
    lw      x1, 0(x16)
58
    lw      x2, 4(x16)
59
 
60
    # Test
61
    la      x20, instr_A_src
62
    la      x21, instr_A_dst
63
    lw      x15, 0(x20)
64
    sw      x15, 0(x21)
65
    fence.i
66
instr_A_dst:
67
    lui     x2, 0
68
 
69
    # Store results
70
    sw      x1, 0(x17)
71
    sw      x2, 4(x17)
72
    sw      x3, 8(x17)
73
    sw      x15, 12(x17)
74
 
75
    //
76
    // Assert
77
    //
78
    RVTEST_IO_CHECK()
79
    #RVTEST_IO_ASSERT_GPR_EQ(x1, 0x8000026C)
80
    RVTEST_IO_ASSERT_GPR_EQ(x2, 0x00000012)
81
    RVTEST_IO_ASSERT_GPR_EQ(x3, 0x00000042)
82
    RVTEST_IO_ASSERT_GPR_EQ(x15, 0x001101B3)
83
 
84
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
85
 
86
    RVTEST_IO_WRITE_STR("# Test End\n")
87
 
88
 # ---------------------------------------------------------------------------------------------
89
    # HALT
90
    RV_COMPLIANCE_HALT
91
 
92
RV_COMPLIANCE_CODE_END
93
 
94
# Input data section.
95
    .data
96
    .align 4
97
 
98
instr_A_src:
99
    add     x3, x2, x1
100
 
101
test_A_data:
102
    .word 0x30
103
    .word 0x12
104
 
105
 
106
# Output data section.
107
RV_COMPLIANCE_DATA_BEGIN
108
    .align 4
109
 
110
test_A_res:
111
    .fill 4, 4, -1
112
 
113
RV_COMPLIANCE_DATA_END

powered by: WebSVN 2.1.0

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