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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [or1ksim/] [testbench/] [ext.S] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1725 nogj
/* ext.S -- Tests the l.ext{b,h}{s,z} instructions
2
   Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
3
 
4
This file is part of OpenRISC 1000 Architectural Simulator.
5
 
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
 
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
GNU General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
 
20
 
21
#include "spr_defs.h"
22
 
23
        .org 0x100
24
        l.j     start_test
25
        l.nop
26
        .org 0x200
27
        l.jal   unhandled_except
28
        l.nop
29
        .org 0x300
30
        l.jal   unhandled_except
31
        l.nop
32
        .org 0x400
33
        l.jal   unhandled_except
34
        l.nop
35
        .org 0x500
36
        l.jal   unhandled_except
37
        l.nop
38
        .org 0x600
39
        l.jal   unhandled_except
40
        l.nop
41
        .org 0x700
42
        l.jal   unhandled_except
43
        l.nop
44
        .org 0x800
45
        l.jal   unhandled_except
46
        l.nop
47
        .org 0x900
48
        l.jal   unhandled_except
49
        l.nop
50
        .org 0xa00
51
        l.jal   unhandled_except
52
        l.nop
53
        .org 0xb00
54
        l.jal   unhandled_except
55
        l.nop
56
        .org 0xc00
57
        l.jal   unhandled_except
58
        l.nop
59
        .org 0xd00
60
        l.jal   unhandled_except
61
        l.nop
62
        .org 0xe00
63
        l.jal   unhandled_except
64
        l.nop
65
        .org 0xf00
66
        l.jal   unhandled_except
67
        l.nop
68
 
69
#define CHECK_EXT(insn, val, mask, high_mask) \
70
        l.movhi r4,hi(val); \
71
        l.ori   r4,r4,lo(val); \
72
        l.ori   r3,r4,0; \
73
        l.nop   NOP_REPORT; \
74
        insn    r5,r4; \
75
        l.ori   r3,r5,0; \
76
        l.nop   NOP_REPORT; \
77
        \
78
        l.movhi r6,hi(mask); \
79
        l.ori   r6,r6,lo(mask); \
80
        l.xori  r7,r6,-1; \
81
        \
82
        l.and   r8,r4,r6; \
83
        l.and   r9,r5,r6; \
84
        l.sfne  r8,r9; \
85
        l.bf    ext_fail; \
86
        l.nop; \
87
        l.and   r8,r5,r7; \
88
        \
89
        l.movhi r7,hi(high_mask); \
90
        l.ori   r7,r7,lo(high_mask); \
91
        \
92
        l.sfne  r8,r7; \
93
        l.bf    ext_fail; \
94
        l.nop;
95
 
96
#define CHECK_HIGH3_CLEAR(insn, val) CHECK_EXT(insn, val, 0x000000ff, 0)
97
#define CHECK_HIGH3_SET(val) CHECK_EXT(l.extbs, val, 0x000000ff, 0xffffff00)
98
#define CHECK_HIGH2_CLEAR(insn, val) CHECK_EXT(insn, val, 0x0000ffff, 0)
99
#define CHECK_HIGH2_SET(val) CHECK_EXT(l.exths, val, 0x0000ffff, 0xffff0000)
100
 
101
#define CHECK_MOVE(insn, val) \
102
        l.movhi r4,hi(val); \
103
        l.ori   r4,r4,lo(val); \
104
        l.ori   r3,r4,0; \
105
        l.nop   NOP_REPORT; \
106
        insn    r5,r4; \
107
        l.ori   r3,r5,0; \
108
        l.nop   NOP_REPORT; \
109
        l.sfne  r5,r4; \
110
        l.bf    ext_fail; \
111
        l.nop;
112
 
113
start_test:
114
        /* Test l.extbs */
115
        CHECK_HIGH3_CLEAR(l.extbs, 0x7f)
116
        CHECK_HIGH3_CLEAR(l.extbs, 0x53)
117
        CHECK_HIGH3_CLEAR(l.extbs, 0xff53)
118
        CHECK_HIGH3_CLEAR(l.extbs, 0x1234)
119
 
120
        CHECK_HIGH3_SET(0xff)
121
        CHECK_HIGH3_SET(0x80)
122
        CHECK_HIGH3_SET(0xff80)
123
        CHECK_HIGH3_SET(0x7f80)
124
        CHECK_HIGH3_SET(0x7fff)
125
 
126
        /* Test l.extbz */
127
        CHECK_HIGH3_CLEAR(l.extbz, 0x7f)
128
        CHECK_HIGH3_CLEAR(l.extbz, 0x53)
129
        CHECK_HIGH3_CLEAR(l.extbz, 0xff53)
130
        CHECK_HIGH3_CLEAR(l.extbz, 0x1234)
131
 
132
        CHECK_HIGH3_CLEAR(l.extbz, 0xff)
133
        CHECK_HIGH3_CLEAR(l.extbz, 0x80)
134
        CHECK_HIGH3_CLEAR(l.extbz, 0xff80)
135
        CHECK_HIGH3_CLEAR(l.extbz, 0x7f80)
136
        CHECK_HIGH3_CLEAR(l.extbz, 0x7fff)
137
 
138
        /* Test l.exths */
139
        CHECK_HIGH2_CLEAR(l.exths, 0x7fff)
140
        CHECK_HIGH2_CLEAR(l.exths, 0x5233)
141
        CHECK_HIGH2_CLEAR(l.exths, 0xffff2f53)
142
        CHECK_HIGH2_CLEAR(l.exths, 0x12345678)
143
 
144
        CHECK_HIGH2_SET(0xffff)
145
        CHECK_HIGH2_SET(0x8000)
146
        CHECK_HIGH2_SET(0xff80)
147
        CHECK_HIGH2_SET(0x80008000)
148
        CHECK_HIGH2_SET(0x7fffffff)
149
 
150
        /* Test l.exthz */
151
        CHECK_HIGH2_CLEAR(l.exthz, 0x7fff)
152
        CHECK_HIGH2_CLEAR(l.exthz, 0x5233)
153
        CHECK_HIGH2_CLEAR(l.exthz, 0xffff2f53)
154
        CHECK_HIGH2_CLEAR(l.exthz, 0x12345678)
155
 
156
        CHECK_HIGH2_CLEAR(l.exthz, 0xffff)
157
        CHECK_HIGH2_CLEAR(l.exthz, 0x8000)
158
        CHECK_HIGH2_CLEAR(l.exthz, 0xff80)
159
        CHECK_HIGH2_CLEAR(l.exthz, 0x80008000)
160
        CHECK_HIGH2_CLEAR(l.exthz, 0x7fffffff)
161
 
162
        /* Test l.extws */
163
        CHECK_MOVE(l.extws, 0xffffffff)
164
        CHECK_MOVE(l.extws, 0x7fffffff)
165
        CHECK_MOVE(l.extws, 0x7fff7fff)
166
        CHECK_MOVE(l.extws, 0xffff7f7f)
167
        CHECK_MOVE(l.extws, 0xffffff7f)
168
        CHECK_MOVE(l.extws, 0xffff7fff)
169
        CHECK_MOVE(l.extws, 0x7fff7f7f)
170
        CHECK_MOVE(l.extws, 0x12345678)
171
 
172
        /* Test l.extwz */
173
        CHECK_MOVE(l.extwz, 0xffffffff)
174
        CHECK_MOVE(l.extwz, 0x7fffffff)
175
        CHECK_MOVE(l.extwz, 0x7fff7fff)
176
        CHECK_MOVE(l.extwz, 0xffff7f7f)
177
        CHECK_MOVE(l.extwz, 0xffffff7f)
178
        CHECK_MOVE(l.extwz, 0xffff7fff)
179
        CHECK_MOVE(l.extwz, 0x7fff7f7f)
180
        CHECK_MOVE(l.extwz, 0x12345678)
181
 
182
        l.movhi r3,0xdead
183
        l.ori   r3,r3,0xdead
184
        l.nop   NOP_REPORT
185
        l.ori   r3,r0,0
186
        l.nop   NOP_EXIT
187
 
188
ext_fail:
189
        l.ori   r3,r0,0x1234
190
        l.nop   NOP_EXIT
191
 
192
unhandled_except:
193
        l.addi  r3,r9,-8
194
        l.nop   NOP_REPORT
195
        l.nop   NOP_EXIT
196
 

powered by: WebSVN 2.1.0

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