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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [ext/] [ext.S] - Blame information for rev 613

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

Line No. Rev Author Line
1 90 jeremybenn
/* ext.S -- Tests the l.ext{b,h}{s,z} instructions
2
 
3
   Copyright (C) 2005 György `nog' Jeney 
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributor György `nog' Jeney 
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
   This code is commented throughout for use with Doxygen.
26
   --------------------------------------------------------------------------*/
27
 
28
#include "spr-defs.h"
29
 
30 458 julius
        .section .except,"ax"
31
 
32 90 jeremybenn
        .org 0x100
33
        l.j     start_test
34
        l.nop
35
        .org 0x200
36
        l.jal   unhandled_except
37
        l.nop
38
        .org 0x300
39
        l.jal   unhandled_except
40
        l.nop
41
        .org 0x400
42
        l.jal   unhandled_except
43
        l.nop
44
        .org 0x500
45
        l.jal   unhandled_except
46
        l.nop
47
        .org 0x600
48
        l.jal   unhandled_except
49
        l.nop
50
        .org 0x700
51
        l.jal   unhandled_except
52
        l.nop
53
        .org 0x800
54
        l.jal   unhandled_except
55
        l.nop
56
        .org 0x900
57
        l.jal   unhandled_except
58
        l.nop
59
        .org 0xa00
60
        l.jal   unhandled_except
61
        l.nop
62
        .org 0xb00
63
        l.jal   unhandled_except
64
        l.nop
65
        .org 0xc00
66
        l.jal   unhandled_except
67
        l.nop
68
        .org 0xd00
69
        l.jal   unhandled_except
70
        l.nop
71
        .org 0xe00
72
        l.jal   unhandled_except
73
        l.nop
74
        .org 0xf00
75
        l.jal   unhandled_except
76
        l.nop
77
 
78
#define CHECK_EXT(insn, val, mask, high_mask) \
79
        l.movhi r4,hi(val); \
80
        l.ori   r4,r4,lo(val); \
81
        l.ori   r3,r4,0; \
82
        l.nop   NOP_REPORT; \
83
        insn    r5,r4; \
84
        l.ori   r3,r5,0; \
85
        l.nop   NOP_REPORT; \
86
        \
87
        l.movhi r6,hi(mask); \
88
        l.ori   r6,r6,lo(mask); \
89
        l.xori  r7,r6,-1; \
90
        \
91
        l.and   r8,r4,r6; \
92
        l.and   r9,r5,r6; \
93
        l.sfne  r8,r9; \
94
        l.bf    ext_fail; \
95
        l.nop; \
96
        l.and   r8,r5,r7; \
97
        \
98
        l.movhi r7,hi(high_mask); \
99
        l.ori   r7,r7,lo(high_mask); \
100
        \
101
        l.sfne  r8,r7; \
102
        l.bf    ext_fail; \
103
        l.nop;
104
 
105
#define CHECK_HIGH3_CLEAR(insn, val) CHECK_EXT(insn, val, 0x000000ff, 0)
106
#define CHECK_HIGH3_SET(val) CHECK_EXT(l.extbs, val, 0x000000ff, 0xffffff00)
107
#define CHECK_HIGH2_CLEAR(insn, val) CHECK_EXT(insn, val, 0x0000ffff, 0)
108
#define CHECK_HIGH2_SET(val) CHECK_EXT(l.exths, val, 0x0000ffff, 0xffff0000)
109
 
110
#define CHECK_MOVE(insn, val) \
111
        l.movhi r4,hi(val); \
112
        l.ori   r4,r4,lo(val); \
113
        l.ori   r3,r4,0; \
114
        l.nop   NOP_REPORT; \
115
        insn    r5,r4; \
116
        l.ori   r3,r5,0; \
117
        l.nop   NOP_REPORT; \
118
        l.sfne  r5,r4; \
119
        l.bf    ext_fail; \
120
        l.nop;
121
 
122 458 julius
        .section .text
123 90 jeremybenn
start_test:
124
        /* Test l.extbs */
125
        CHECK_HIGH3_CLEAR(l.extbs, 0x7f)
126
        CHECK_HIGH3_CLEAR(l.extbs, 0x53)
127
        CHECK_HIGH3_CLEAR(l.extbs, 0xff53)
128
        CHECK_HIGH3_CLEAR(l.extbs, 0x1234)
129
 
130
        CHECK_HIGH3_SET(0xff)
131
        CHECK_HIGH3_SET(0x80)
132
        CHECK_HIGH3_SET(0xff80)
133
        CHECK_HIGH3_SET(0x7f80)
134
        CHECK_HIGH3_SET(0x7fff)
135
 
136
        /* Test l.extbz */
137
        CHECK_HIGH3_CLEAR(l.extbz, 0x7f)
138
        CHECK_HIGH3_CLEAR(l.extbz, 0x53)
139
        CHECK_HIGH3_CLEAR(l.extbz, 0xff53)
140
        CHECK_HIGH3_CLEAR(l.extbz, 0x1234)
141
 
142
        CHECK_HIGH3_CLEAR(l.extbz, 0xff)
143
        CHECK_HIGH3_CLEAR(l.extbz, 0x80)
144
        CHECK_HIGH3_CLEAR(l.extbz, 0xff80)
145
        CHECK_HIGH3_CLEAR(l.extbz, 0x7f80)
146
        CHECK_HIGH3_CLEAR(l.extbz, 0x7fff)
147
 
148
        /* Test l.exths */
149
        CHECK_HIGH2_CLEAR(l.exths, 0x7fff)
150
        CHECK_HIGH2_CLEAR(l.exths, 0x5233)
151
        CHECK_HIGH2_CLEAR(l.exths, 0xffff2f53)
152
        CHECK_HIGH2_CLEAR(l.exths, 0x12345678)
153
 
154
        CHECK_HIGH2_SET(0xffff)
155
        CHECK_HIGH2_SET(0x8000)
156
        CHECK_HIGH2_SET(0xff80)
157
        CHECK_HIGH2_SET(0x80008000)
158
        CHECK_HIGH2_SET(0x7fffffff)
159
 
160
        /* Test l.exthz */
161
        CHECK_HIGH2_CLEAR(l.exthz, 0x7fff)
162
        CHECK_HIGH2_CLEAR(l.exthz, 0x5233)
163
        CHECK_HIGH2_CLEAR(l.exthz, 0xffff2f53)
164
        CHECK_HIGH2_CLEAR(l.exthz, 0x12345678)
165
 
166
        CHECK_HIGH2_CLEAR(l.exthz, 0xffff)
167
        CHECK_HIGH2_CLEAR(l.exthz, 0x8000)
168
        CHECK_HIGH2_CLEAR(l.exthz, 0xff80)
169
        CHECK_HIGH2_CLEAR(l.exthz, 0x80008000)
170
        CHECK_HIGH2_CLEAR(l.exthz, 0x7fffffff)
171
 
172
        /* Test l.extws */
173
        CHECK_MOVE(l.extws, 0xffffffff)
174
        CHECK_MOVE(l.extws, 0x7fffffff)
175
        CHECK_MOVE(l.extws, 0x7fff7fff)
176
        CHECK_MOVE(l.extws, 0xffff7f7f)
177
        CHECK_MOVE(l.extws, 0xffffff7f)
178
        CHECK_MOVE(l.extws, 0xffff7fff)
179
        CHECK_MOVE(l.extws, 0x7fff7f7f)
180
        CHECK_MOVE(l.extws, 0x12345678)
181
 
182
        /* Test l.extwz */
183
        CHECK_MOVE(l.extwz, 0xffffffff)
184
        CHECK_MOVE(l.extwz, 0x7fffffff)
185
        CHECK_MOVE(l.extwz, 0x7fff7fff)
186
        CHECK_MOVE(l.extwz, 0xffff7f7f)
187
        CHECK_MOVE(l.extwz, 0xffffff7f)
188
        CHECK_MOVE(l.extwz, 0xffff7fff)
189
        CHECK_MOVE(l.extwz, 0x7fff7f7f)
190
        CHECK_MOVE(l.extwz, 0x12345678)
191
 
192
        l.movhi r3,0xdead
193
        l.ori   r3,r3,0xdead
194
        l.nop   NOP_REPORT
195
        l.ori   r3,r0,0
196
        l.nop   NOP_EXIT
197
 
198
ext_fail:
199
        l.ori   r3,r0,0x1234
200
        l.nop   NOP_EXIT
201
 
202
unhandled_except:
203
        l.addi  r3,r9,-8
204
        l.nop   NOP_REPORT
205
        l.nop   NOP_EXIT
206
 

powered by: WebSVN 2.1.0

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