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-EBREAK-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-EBREAK-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 EBREAK.
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
    # Save and set trap handler address
47
    la x1, _trap_handler
48
    csrrw x31, mtvec, x1
49
 
50
    //
51
    // Assert
52
    //
53
    RVTEST_IO_CHECK()
54
    # ---------------------------------------------------------------------------------------------
55
    RVTEST_IO_WRITE_STR("# Test part A - test EBREAK\n");
56
 
57
    # Address for test results
58
    la      x1, test_A_res_exc
59
 
60
    # Test
61
    li      x2, 0x11111111
62
    ebreak
63
    sw      x0, 0(x1)
64
 
65
    RVTEST_IO_ASSERT_GPR_EQ(x0, 0x0000000)
66
 
67
    RVTEST_IO_WRITE_STR("# Test part A1  - Complete\n");
68
 
69
    # ---------------------------------------------------------------------------------------------
70
    # restore mtvec and jump to the end
71
    csrw mtvec, x31
72
    jal x0, test_end
73
 
74
    # ---------------------------------------------------------------------------------------------
75
    # Exception handler
76
_trap_handler:
77
    # increment return address
78
    csrr    x30, mepc
79
    addi    x30, x30, 4
80
    csrw    mepc, x30
81
 
82
    # Store MCAUSE
83
    csrr    x30, mcause
84
    sw      x30, 0(x1)
85
 
86
    # Store data from test
87
    sw      x2, 4(x1)
88
    sw      x0, 8(x1)
89
 
90
    # increment data_exc address
91
    addi    x1, x1, 12
92
 
93
    # return
94
    mret
95
 
96
    RVTEST_IO_WRITE_STR("# Test part A2  - Complete\n");
97
 
98
    # ---------------------------------------------------------------------------------------------
99
 
100
test_end:
101
 
102
    RVTEST_IO_WRITE_STR("# Test End\n")
103
 
104
 # ---------------------------------------------------------------------------------------------
105
    # HALT
106
    RV_COMPLIANCE_HALT
107
 
108
RV_COMPLIANCE_CODE_END
109
 
110
# Input data section.
111
    .data
112
    .align 4
113
 
114
 
115
# Output data section.
116
RV_COMPLIANCE_DATA_BEGIN
117
    .align 4
118
 
119
test_A_res_exc:
120
    .fill 4, 4, -1
121
 
122
RV_COMPLIANCE_DATA_END

powered by: WebSVN 2.1.0

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