OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [inst-set-test/] [is-lws-test.S] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 107 jeremybenn
/* is-lws-test.S. l.lws instruction test of Or1ksim
2
 *
3
 * Copyright (C) 1999-2006 OpenCores
4
 * Copyright (C) 2010 Embecosm Limited
5
 *
6
 * Contributors various OpenCores participants
7
 * Contributor Jeremy Bennett 
8
 *
9
 * This file is part of OpenRISC 1000 Architectural Simulator.
10
 *
11
 * This program is free software; you can redistribute it and/or modify it
12
 * under the terms of the GNU General Public License as published by the Free
13
 * Software Foundation; either version 3 of the License, or (at your option)
14
 * any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful, but WITHOUT
17
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
 * more details.
20
 *
21
 * You should have received a copy of the GNU General Public License along
22
 * with this program.  If not, see .
23
 */
24
 
25
/* ----------------------------------------------------------------------------
26 116 jeremybenn
 * Coding conventions are described in inst-set-test.S
27 107 jeremybenn
 * ------------------------------------------------------------------------- */
28
 
29
/* ----------------------------------------------------------------------------
30
 * Test coverage
31
 *
32
 * The l.lws instruction was omitted from Or1ksim originally. It is specified
33
 * for ORBIS32, even though it is functionally equivalent to l.lwz.
34
 *
35
 * Having fixed the problem, this is (in good software engineering style), a
36
 * regresison test to go with the fix.
37
 *
38
 * Of course what is really needed is a comprehensive instruction test...
39
 * ------------------------------------------------------------------------- */
40
 
41
 
42
#include "inst-set-test.h"
43
 
44
/* ----------------------------------------------------------------------------
45
 * Test of load single word and extend with sign: l.lws
46
 * ------------------------------------------------------------------------- */
47
        .section .rodata
48
        .balign 4
49
50:     .word   0xdeadbeef
50
51:     .word   0x00000000
51
52:     .word   0x7fffffff
52
53:     .word   0x80000000
53
54:     .word   0xffffffff
54
 
55
        .section .text
56
        .global _start
57
_start:
58
        LOAD_STR (r3, "l.lws\n")
59
        l.jal   _puts
60
        l.nop
61
 
62
        /* Load with zero offset */
63
        LOAD_CONST (r5,50b)
64
        l.lws   r4,0(r5)
65
        CHECK_RES (" l.lws r4,0(r5): r4=0xdeadbeef:  ", r4, 0xdeadbeef)
66
 
67
        LOAD_CONST (r5,51b)
68
        l.lws   r4,0(r5)
69
        CHECK_RES (" l.lws r4,0(r5): r4=0x00000000:  ", r4, 0x00000000)
70
 
71
        LOAD_CONST (r5,52b)
72
        l.lws   r4,0(r5)
73
        CHECK_RES (" l.lws r4,0(r5): r4=0x7fffffff:  ", r4, 0x7fffffff)
74
 
75
        LOAD_CONST (r5,53b)
76
        l.lws   r4,0(r5)
77
        CHECK_RES (" l.lws r4,0(r5): r4=0x80000000:  ", r4, 0x80000000)
78
 
79
        LOAD_CONST (r5,54b)
80
        l.lws   r4,0(r5)
81
        CHECK_RES (" l.lws r4,0(r5): r4=0xffffffff:  ", r4, 0xffffffff)
82
 
83
        /* Load with positive offset */
84
        LOAD_CONST (r5,50b)
85
        l.lws   r4,4(r5)
86
        CHECK_RES (" l.lws r4,0(r5): r4=0x00000000:  ", r4, 0x00000000)
87
 
88
        LOAD_CONST (r5,50b)
89
        l.lws   r4,8(r5)
90
        CHECK_RES (" l.lws r4,0(r5): r4=0x7fffffff:  ", r4, 0x7fffffff)
91
 
92
        LOAD_CONST (r5,50b)
93
        l.lws   r4,12(r5)
94
        CHECK_RES (" l.lws r4,0(r5): r4=0x80000000:  ", r4, 0x80000000)
95
 
96
        LOAD_CONST (r5,50b)
97
        l.lws   r4,16(r5)
98
        CHECK_RES (" l.lws r4,0(r5): r4=0xffffffff:  ", r4, 0xffffffff)
99
 
100
        /* Load with negative offset */
101
        LOAD_CONST (r5,54b)
102
        l.lws   r4,-16(r5)
103
        CHECK_RES (" l.lws r4,0(r5): r4=0xdeadbeef:  ", r4, 0xdeadbeef)
104
 
105
        LOAD_CONST (r5,54b)
106
        l.lws   r4,-12(r5)
107
        CHECK_RES (" l.lws r4,0(r5): r4=0x00000000:  ", r4, 0x00000000)
108
 
109
        LOAD_CONST (r5,54b)
110
        l.lws   r4,-8(r5)
111
        CHECK_RES (" l.lws r4,0(r5): r4=0x7fffffff:  ", r4, 0x7fffffff)
112
 
113
        LOAD_CONST (r5,54b)
114
        l.lws   r4,-4(r5)
115
        CHECK_RES (" l.lws r4,0(r5): r4=0x80000000:  ", r4, 0x80000000)
116
 
117
/* ----------------------------------------------------------------------------
118
 * All done
119
 * ------------------------------------------------------------------------- */
120
_exit:
121
        LOAD_STR (r3, "Test completed\n")
122
        l.jal   _puts
123
        l.nop
124
 
125 118 jeremybenn
        TEST_EXIT

powered by: WebSVN 2.1.0

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