1 |
107 |
jeremybenn |
# inst-set-test.exp. Tests of ORBIS32 instruction set
|
2 |
|
|
|
3 |
|
|
# Copyright (C) 2010 Embecosm Limited
|
4 |
|
|
|
5 |
|
|
# Contributor Jeremy Bennett
|
6 |
|
|
|
7 |
|
|
# This file is part of OpenRISC 1000 Architectural Simulator.
|
8 |
|
|
|
9 |
|
|
# This program is free software; you can redistribute it and/or modify it
|
10 |
|
|
# under the terms of the GNU General Public License as published by the Free
|
11 |
|
|
# Software Foundation; either version 3 of the License, or (at your option)
|
12 |
|
|
# any later version.
|
13 |
|
|
|
14 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
17 |
|
|
# more details.
|
18 |
|
|
|
19 |
|
|
# You should have received a copy of the GNU General Public License along
|
20 |
|
|
# with this program. If not, see . */
|
21 |
|
|
|
22 |
|
|
# -----------------------------------------------------------------------------
|
23 |
|
|
# This code is commented throughout for use with Doxygen.
|
24 |
|
|
# -----------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
# Run the l.lws test
|
28 |
|
|
run_or1ksim "lws-test" \
|
29 |
|
|
[list "!l.lws" \
|
30 |
|
|
" l.lws r4,0(r5): r4=0xdeadbeef: OK" \
|
31 |
|
|
" l.lws r4,0(r5): r4=0x00000000: OK" \
|
32 |
|
|
" l.lws r4,0(r5): r4=0x7fffffff: OK" \
|
33 |
|
|
" l.lws r4,0(r5): r4=0x80000000: OK" \
|
34 |
|
|
" l.lws r4,0(r5): r4=0xffffffff: OK" \
|
35 |
|
|
" l.lws r4,0(r5): r4=0x00000000: OK" \
|
36 |
|
|
" l.lws r4,0(r5): r4=0x7fffffff: OK" \
|
37 |
|
|
" l.lws r4,0(r5): r4=0x80000000: OK" \
|
38 |
|
|
" l.lws r4,0(r5): r4=0xffffffff: OK" \
|
39 |
|
|
" l.lws r4,0(r5): r4=0xdeadbeef: OK" \
|
40 |
|
|
" l.lws r4,0(r5): r4=0x00000000: OK" \
|
41 |
|
|
" l.lws r4,0(r5): r4=0x7fffffff: OK" \
|
42 |
|
|
" l.lws r4,0(r5): r4=0x80000000: OK" \
|
43 |
|
|
"!Test completed" \
|
44 |
|
|
"!report(0xdeaddead);" \
|
45 |
|
|
"!exit(0)"] \
|
46 |
|
|
"inst-set-test.cfg" "inst-set-test/is-lws-test"
|
47 |
112 |
jeremybenn |
|
48 |
|
|
# Run the l.div and l.divu test
|
49 |
|
|
run_or1ksim "lws-test" \
|
50 |
|
|
[list "!l.div" \
|
51 |
|
|
"! RANGE exception" \
|
52 |
|
|
" - caused by: report(0xe0853309);" \
|
53 |
|
|
"! - SR value: report(0x00008601);" \
|
54 |
|
|
" 1 / 0 (with error) carry flag set: TRUE" \
|
55 |
|
|
"!l.divu" \
|
56 |
|
|
"! RANGE exception" \
|
57 |
|
|
" - caused by: report(0xe085330a);" \
|
58 |
|
|
"! - SR value: report(0x00008601);" \
|
59 |
|
|
" 1 / 0 (with error) carry flag set: TRUE" \
|
60 |
|
|
"!Test completed" \
|
61 |
|
|
"!report(0xdeaddead);" \
|
62 |
|
|
"!exit(0)"] \
|
63 |
|
|
"inst-set-test.cfg" "inst-set-test/is-div-test"
|
64 |
|
|
|
65 |
|
|
# Run the l.add, l.addc, l.addi and l.addic tests
|
66 |
114 |
jeremybenn |
run_or1ksim "lws-test" \
|
67 |
|
|
[list "!l.add" \
|
68 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
69 |
|
|
" - carry flag set: FALSE" \
|
70 |
|
|
" - overflow flag set: FALSE" \
|
71 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
72 |
|
|
" - carry flag set: FALSE" \
|
73 |
|
|
" - overflow flag set: FALSE" \
|
74 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
75 |
|
|
" - carry flag set: TRUE" \
|
76 |
|
|
" - overflow flag set: FALSE" \
|
77 |
|
|
" 0x40000000 + 0x3fffffff = 0x7fffffff: OK" \
|
78 |
|
|
" - carry flag set: FALSE" \
|
79 |
|
|
" - overflow flag set: FALSE" \
|
80 |
|
|
" 0x40000000 + 0x40000000 = 0x80000000: OK" \
|
81 |
|
|
" - carry flag set: FALSE" \
|
82 |
|
|
" - overflow flag set: TRUE" \
|
83 |
|
|
" 0xc0000000 + 0xc0000000 = 0x80000000: OK" \
|
84 |
|
|
" - carry flag set: TRUE" \
|
85 |
|
|
" - overflow flag set: FALSE" \
|
86 |
|
|
" 0xbfffffff + 0xbfffffff = 0x7ffffffe: OK" \
|
87 |
|
|
" - carry flag set: TRUE" \
|
88 |
|
|
" - overflow flag set: TRUE" \
|
89 |
|
|
"! ** OVE flag set **" \
|
90 |
|
|
" RANGE exception" \
|
91 |
|
|
" - caused by: report(0xe0853000);" \
|
92 |
|
|
" - SR value: report(0x00009a01);" \
|
93 |
|
|
" 0x40000000 + 0x40000000 = 0x80000000: OK" \
|
94 |
|
|
" - carry flag set: FALSE" \
|
95 |
|
|
" - overflow flag set: TRUE" \
|
96 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
97 |
|
|
" - carry flag set: TRUE" \
|
98 |
|
|
" - overflow flag set: FALSE" \
|
99 |
|
|
" RANGE exception" \
|
100 |
|
|
" - caused by: report(0xe0853000);" \
|
101 |
|
|
" - SR value: report(0x00009e01);" \
|
102 |
|
|
" 0xbfffffff + 0xbfffffff = 0x7ffffffe: OK" \
|
103 |
|
|
" - carry flag set: TRUE" \
|
104 |
|
|
" - overflow flag set: TRUE" \
|
105 |
|
|
"! ** OVE flag cleared **" \
|
106 |
|
|
"!l.addc" \
|
107 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
108 |
|
|
" - carry flag set: FALSE" \
|
109 |
|
|
" - overflow flag set: FALSE" \
|
110 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
111 |
|
|
" - carry flag set: TRUE" \
|
112 |
|
|
" - overflow flag set: FALSE" \
|
113 |
|
|
" 0x40000000 + 0x3fffffff = 0x7fffffff: OK" \
|
114 |
|
|
" - carry flag set: FALSE" \
|
115 |
|
|
" - overflow flag set: FALSE" \
|
116 |
|
|
" 0x40000000 + 0x3fffffff + c = 0x80000000: OK" \
|
117 |
|
|
" - carry flag set: FALSE" \
|
118 |
|
|
" - overflow flag set: TRUE" \
|
119 |
|
|
" 0x40000000 + 0x40000000 = 0x80000000: OK" \
|
120 |
|
|
" - carry flag set: FALSE" \
|
121 |
|
|
" - overflow flag set: TRUE" \
|
122 |
|
|
" 0xffffffff + 0x00000000 + c = 0x00000000: OK" \
|
123 |
|
|
" - carry flag set: TRUE" \
|
124 |
|
|
" - overflow flag set: FALSE" \
|
125 |
|
|
" 0x00000000 + 0xffffffff + c = 0x00000000: OK" \
|
126 |
|
|
" - carry flag set: TRUE" \
|
127 |
|
|
" - overflow flag set: FALSE" \
|
128 |
|
|
" 0xc0000000 + 0xc0000000 = 0x80000000: OK" \
|
129 |
|
|
" - carry flag set: TRUE" \
|
130 |
|
|
" - overflow flag set: FALSE" \
|
131 |
|
|
" 0xc0000000 + 0xbfffffff + c = 0x80000000: OK" \
|
132 |
|
|
" - carry flag set: TRUE" \
|
133 |
|
|
" - overflow flag set: FALSE" \
|
134 |
|
|
" 0xbfffffff + 0xbfffffff = 0x7ffffffe: OK" \
|
135 |
|
|
" - carry flag set: TRUE" \
|
136 |
|
|
" - overflow flag set: TRUE" \
|
137 |
|
|
"! ** OVE flag set **" \
|
138 |
|
|
" RANGE exception" \
|
139 |
|
|
" - caused by: report(0xe0853001);" \
|
140 |
|
|
" - SR value: report(0x00009a01);" \
|
141 |
|
|
" 0x40000000 + 0x40000000 = 0x80000000: OK" \
|
142 |
|
|
" - carry flag set: FALSE" \
|
143 |
|
|
" - overflow flag set: TRUE" \
|
144 |
|
|
" RANGE exception" \
|
145 |
|
|
" - caused by: report(0xe0853001);" \
|
146 |
|
|
" - SR value: report(0x00009a01);" \
|
147 |
|
|
" 0x40000000 + 0x3fffffff + c = 0x80000000: OK" \
|
148 |
|
|
" - carry flag set: FALSE" \
|
149 |
|
|
" - overflow flag set: TRUE" \
|
150 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
151 |
|
|
" - carry flag set: TRUE" \
|
152 |
|
|
" - overflow flag set: FALSE" \
|
153 |
|
|
" 0x00000000 + 0xffffffff + c = 0x00000000: OK" \
|
154 |
|
|
" - carry flag set: TRUE" \
|
155 |
|
|
" - overflow flag set: FALSE" \
|
156 |
|
|
" RANGE exception" \
|
157 |
|
|
" - caused by: report(0xe0853001);" \
|
158 |
|
|
" - SR value: report(0x00009e01);" \
|
159 |
|
|
" 0xbfffffff + 0xbfffffff = 0x7ffffffe: OK" \
|
160 |
|
|
" - carry flag set: TRUE" \
|
161 |
|
|
" - overflow flag set: TRUE" \
|
162 |
|
|
"! ** OVE flag cleared **" \
|
163 |
|
|
"!l.addi" \
|
164 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
165 |
|
|
" - carry flag set: FALSE" \
|
166 |
|
|
" - overflow flag set: FALSE" \
|
167 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
168 |
|
|
" - carry flag set: FALSE" \
|
169 |
|
|
" - overflow flag set: FALSE" \
|
170 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
171 |
|
|
" - carry flag set: TRUE" \
|
172 |
|
|
" - overflow flag set: FALSE" \
|
173 |
|
|
" 0x7fff8000 + 0x00007fff = 0x7fffffff: OK" \
|
174 |
|
|
" - carry flag set: FALSE" \
|
175 |
|
|
" - overflow flag set: FALSE" \
|
176 |
|
|
" 0x7fffc000 + 0x00004000 = 0x80000000: OK" \
|
177 |
|
|
" - carry flag set: FALSE" \
|
178 |
|
|
" - overflow flag set: TRUE" \
|
179 |
|
|
" 0x80008000 + 0xffff8000 = 0x80000000: OK" \
|
180 |
|
|
" - carry flag set: TRUE" \
|
181 |
|
|
" - overflow flag set: FALSE" \
|
182 |
|
|
" 0x80007fff + 0xffff8000 = 0x7fffffff: OK" \
|
183 |
|
|
" - carry flag set: TRUE" \
|
184 |
|
|
" - overflow flag set: TRUE" \
|
185 |
|
|
"! ** OVE flag set **" \
|
186 |
|
|
" RANGE exception" \
|
187 |
|
|
" - caused by: report(0x9c854000);" \
|
188 |
|
|
" - SR value: report(0x00009a01);" \
|
189 |
|
|
" 0x7fffc000 + 0x00004000 = 0x80000000: OK" \
|
190 |
|
|
" - carry flag set: FALSE" \
|
191 |
|
|
" - overflow flag set: TRUE" \
|
192 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
193 |
|
|
" - carry flag set: TRUE" \
|
194 |
|
|
" - overflow flag set: FALSE" \
|
195 |
|
|
" RANGE exception" \
|
196 |
|
|
" - caused by: report(0x9c858000);" \
|
197 |
|
|
" - SR value: report(0x00009e01);" \
|
198 |
|
|
" 0x80007fff + 0xffff8000 = 0x7ffffffe: OK" \
|
199 |
|
|
" - carry flag set: TRUE" \
|
200 |
|
|
" - overflow flag set: TRUE" \
|
201 |
|
|
"! ** OVE flag cleared **" \
|
202 |
|
|
"!l.addic" \
|
203 |
|
|
" 0x00000001 + 0x00000002 = 0x00000003: OK" \
|
204 |
|
|
" - carry flag set: FALSE" \
|
205 |
|
|
" - overflow flag set: FALSE" \
|
206 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
207 |
|
|
" - carry flag set: TRUE" \
|
208 |
|
|
" - overflow flag set: FALSE" \
|
209 |
|
|
" 0x7fff8000 + 0x00007fff = 0x7fffffff: OK" \
|
210 |
|
|
" - carry flag set: FALSE" \
|
211 |
|
|
" - overflow flag set: FALSE" \
|
212 |
|
|
" 0x7fff8000 + 0x00007fff + c = 0x80000000: OK" \
|
213 |
|
|
" - carry flag set: FALSE" \
|
214 |
|
|
" - overflow flag set: TRUE" \
|
215 |
|
|
" 0x7fffc000 + 0x00004000 = 0x80000000: OK" \
|
216 |
|
|
" - carry flag set: FALSE" \
|
217 |
|
|
" - overflow flag set: TRUE" \
|
218 |
|
|
" 0xffffffff + 0x00000000 + c = 0x00000000: OK" \
|
219 |
|
|
" - carry flag set: TRUE" \
|
220 |
|
|
" - overflow flag set: FALSE" \
|
221 |
|
|
" 0x00000000 + 0xffffffff + c = 0x00000000: OK" \
|
222 |
|
|
" - carry flag set: TRUE" \
|
223 |
|
|
" - overflow flag set: FALSE" \
|
224 |
|
|
" 0x80008000 + 0xffff8000 = 0x80000000: OK" \
|
225 |
|
|
" - carry flag set: TRUE" \
|
226 |
|
|
" - overflow flag set: FALSE" \
|
227 |
|
|
" 0x80007fff + 0xffff8000 + c = 0x80000000: OK" \
|
228 |
|
|
" - carry flag set: TRUE" \
|
229 |
|
|
" - overflow flag set: FALSE" \
|
230 |
|
|
" 0x80007fff + 0xffff8000 = 0x7fffffff: OK" \
|
231 |
|
|
" - carry flag set: TRUE" \
|
232 |
|
|
" - overflow flag set: TRUE" \
|
233 |
|
|
"! ** OVE flag set **" \
|
234 |
|
|
" RANGE exception" \
|
235 |
|
|
" - caused by: report(0xa0854000);" \
|
236 |
|
|
" - SR value: report(0x00009a01);" \
|
237 |
|
|
" 0x7fffc000 + 0x00004000 = 0x80000000: OK" \
|
238 |
|
|
" - carry flag set: FALSE" \
|
239 |
|
|
" - overflow flag set: TRUE" \
|
240 |
|
|
" RANGE exception" \
|
241 |
|
|
" - caused by: report(0xa0853fff);" \
|
242 |
|
|
" - SR value: report(0x00009a01);" \
|
243 |
|
|
" 0x7fffc000 + 0x00003fff + c = 0x80000000: OK" \
|
244 |
|
|
" - carry flag set: FALSE" \
|
245 |
|
|
" - overflow flag set: TRUE" \
|
246 |
|
|
" 0xffffffff + 0xfffffffe = 0xfffffffd: OK" \
|
247 |
|
|
" - carry flag set: TRUE" \
|
248 |
|
|
" - overflow flag set: FALSE" \
|
249 |
|
|
" 0x00000000 + 0xffffffff + c = 0x00000000: OK" \
|
250 |
|
|
" - carry flag set: TRUE" \
|
251 |
|
|
" - overflow flag set: FALSE" \
|
252 |
|
|
" RANGE exception" \
|
253 |
|
|
" - caused by: report(0xa0858000);" \
|
254 |
|
|
" - SR value: report(0x00009e01);" \
|
255 |
|
|
" 0x80007fff + 0xffff8000 = 0x7ffffffe: OK" \
|
256 |
|
|
" - carry flag set: TRUE" \
|
257 |
|
|
" - overflow flag set: TRUE" \
|
258 |
|
|
"! ** OVE flag cleared **" \
|
259 |
|
|
"!Test completed" \
|
260 |
|
|
"!report(0xdeaddead);" \
|
261 |
|
|
"!exit(0)"] \
|
262 |
112 |
jeremybenn |
"inst-set-test.cfg" "inst-set-test/is-add-test"
|