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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [or1ksim.tests/] [inst-set-test.exp] - Blame information for rev 115

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

Line No. Rev Author Line
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 112 jeremybenn
# Run the l.add, l.addc, l.addi and l.addic tests
28 115 jeremybenn
run_or1ksim "add-test"                                     \
29 114 jeremybenn
    [list "!l.add"                                         \
30
          "  0x00000001 + 0x00000002 = 0x00000003: OK"     \
31
          "  - carry flag set:    FALSE"                   \
32
          "  - overflow flag set: FALSE"                   \
33
          "  0x00000001 + 0x00000002 = 0x00000003: OK"     \
34
          "  - carry flag set:    FALSE"                   \
35
          "  - overflow flag set: FALSE"                   \
36
          "  0xffffffff + 0xfffffffe = 0xfffffffd: OK"     \
37
          "  - carry flag set:    TRUE"                    \
38
          "  - overflow flag set: FALSE"                   \
39
          "  0x40000000 + 0x3fffffff = 0x7fffffff: OK"     \
40
          "  - carry flag set:    FALSE"                   \
41
          "  - overflow flag set: FALSE"                   \
42
          "  0x40000000 + 0x40000000 = 0x80000000: OK"     \
43
          "  - carry flag set:    FALSE"                   \
44
          "  - overflow flag set: TRUE"                    \
45
          "  0xc0000000 + 0xc0000000 = 0x80000000: OK"     \
46
          "  - carry flag set:    TRUE"                    \
47
          "  - overflow flag set: FALSE"                   \
48
          "  0xbfffffff + 0xbfffffff = 0x7ffffffe: OK"     \
49
          "  - carry flag set:    TRUE"                    \
50
          "  - overflow flag set: TRUE"                    \
51
          "!  ** OVE flag set **"                          \
52
          "  RANGE exception"                              \
53
          "  - caused by: report(0xe0853000);"             \
54
          "  - SR value:  report(0x00009a01);"             \
55
          "  0x40000000 + 0x40000000 = 0x80000000: OK"     \
56
          "  - carry flag set:    FALSE"                   \
57
          "  - overflow flag set: TRUE"                    \
58
          "  0xffffffff + 0xfffffffe = 0xfffffffd: OK"     \
59
          "  - carry flag set:    TRUE"                    \
60
          "  - overflow flag set: FALSE"                   \
61
          "  RANGE exception"                              \
62
          "  - caused by: report(0xe0853000);"             \
63
          "  - SR value:  report(0x00009e01);"             \
64
          "  0xbfffffff + 0xbfffffff = 0x7ffffffe: OK"     \
65
          "  - carry flag set:    TRUE"                    \
66
          "  - overflow flag set: TRUE"                    \
67
          "!  ** OVE flag cleared **"                      \
68
          "!l.addc"                                        \
69
          "  0x00000001 + 0x00000002     = 0x00000003: OK" \
70
          "  - carry flag set:    FALSE"                   \
71
          "  - overflow flag set: FALSE"                   \
72
          "  0xffffffff + 0xfffffffe     = 0xfffffffd: OK" \
73
          "  - carry flag set:    TRUE"                    \
74
          "  - overflow flag set: FALSE"                   \
75
          "  0x40000000 + 0x3fffffff     = 0x7fffffff: OK" \
76
          "  - carry flag set:    FALSE"                   \
77
          "  - overflow flag set: FALSE"                   \
78
          "  0x40000000 + 0x3fffffff + c = 0x80000000: OK" \
79
          "  - carry flag set:    FALSE"                   \
80
          "  - overflow flag set: TRUE"                    \
81
          "  0x40000000 + 0x40000000     = 0x80000000: OK" \
82
          "  - carry flag set:    FALSE"                   \
83
          "  - overflow flag set: TRUE"                    \
84
          "  0xffffffff + 0x00000000 + c = 0x00000000: OK" \
85
          "  - carry flag set:    TRUE"                    \
86
          "  - overflow flag set: FALSE"                   \
87
          "  0x00000000 + 0xffffffff + c = 0x00000000: OK" \
88
          "  - carry flag set:    TRUE"                    \
89
          "  - overflow flag set: FALSE"                   \
90
          "  0xc0000000 + 0xc0000000     = 0x80000000: OK" \
91
          "  - carry flag set:    TRUE"                    \
92
          "  - overflow flag set: FALSE"                   \
93
          "  0xc0000000 + 0xbfffffff + c = 0x80000000: OK" \
94
          "  - carry flag set:    TRUE"                    \
95
          "  - overflow flag set: FALSE"                   \
96
          "  0xbfffffff + 0xbfffffff     = 0x7ffffffe: OK" \
97
          "  - carry flag set:    TRUE"                    \
98
          "  - overflow flag set: TRUE"                    \
99
          "!  ** OVE flag set **"                          \
100
          "  RANGE exception"                              \
101
          "  - caused by: report(0xe0853001);"             \
102
          "  - SR value:  report(0x00009a01);"             \
103
          "  0x40000000 + 0x40000000     = 0x80000000: OK" \
104
          "  - carry flag set:    FALSE"                   \
105
          "  - overflow flag set: TRUE"                    \
106
          "  RANGE exception"                              \
107
          "  - caused by: report(0xe0853001);"             \
108
          "  - SR value:  report(0x00009a01);"             \
109
          "  0x40000000 + 0x3fffffff + c = 0x80000000: OK" \
110
          "  - carry flag set:    FALSE"                   \
111
          "  - overflow flag set: TRUE"                    \
112
          "  0xffffffff + 0xfffffffe     = 0xfffffffd: OK" \
113
          "  - carry flag set:    TRUE"                    \
114
          "  - overflow flag set: FALSE"                   \
115
          "  0x00000000 + 0xffffffff + c = 0x00000000: OK" \
116
          "  - carry flag set:    TRUE"                    \
117
          "  - overflow flag set: FALSE"                   \
118
          "  RANGE exception"                              \
119
          "  - caused by: report(0xe0853001);"             \
120
          "  - SR value:  report(0x00009e01);"             \
121
          "  0xbfffffff + 0xbfffffff     = 0x7ffffffe: OK" \
122
          "  - carry flag set:    TRUE"                    \
123
          "  - overflow flag set: TRUE"                    \
124
          "!  ** OVE flag cleared **"                      \
125
          "!l.addi"                                        \
126
          "  0x00000001 + 0x00000002 = 0x00000003: OK"     \
127
          "  - carry flag set:    FALSE"                   \
128
          "  - overflow flag set: FALSE"                   \
129
          "  0x00000001 + 0x00000002 = 0x00000003: OK"     \
130
          "  - carry flag set:    FALSE"                   \
131
          "  - overflow flag set: FALSE"                   \
132
          "  0xffffffff + 0xfffffffe = 0xfffffffd: OK"     \
133
          "  - carry flag set:    TRUE"                    \
134
          "  - overflow flag set: FALSE"                   \
135
          "  0x7fff8000 + 0x00007fff = 0x7fffffff: OK"     \
136
          "  - carry flag set:    FALSE"                   \
137
          "  - overflow flag set: FALSE"                   \
138
          "  0x7fffc000 + 0x00004000 = 0x80000000: OK"     \
139
          "  - carry flag set:    FALSE"                   \
140
          "  - overflow flag set: TRUE"                    \
141
          "  0x80008000 + 0xffff8000 = 0x80000000: OK"     \
142
          "  - carry flag set:    TRUE"                    \
143
          "  - overflow flag set: FALSE"                   \
144
          "  0x80007fff + 0xffff8000 = 0x7fffffff: OK"     \
145
          "  - carry flag set:    TRUE"                    \
146
          "  - overflow flag set: TRUE"                    \
147
          "!  ** OVE flag set **"                          \
148
          "  RANGE exception"                              \
149
          "  - caused by: report(0x9c854000);"             \
150
          "  - SR value:  report(0x00009a01);"             \
151
          "  0x7fffc000 + 0x00004000 = 0x80000000: OK"     \
152
          "  - carry flag set:    FALSE"                   \
153
          "  - overflow flag set: TRUE"                    \
154
          "  0xffffffff + 0xfffffffe = 0xfffffffd: OK"     \
155
          "  - carry flag set:    TRUE"                    \
156
          "  - overflow flag set: FALSE"                   \
157
          "  RANGE exception"                              \
158
          "  - caused by: report(0x9c858000);"             \
159
          "  - SR value:  report(0x00009e01);"             \
160
          "  0x80007fff + 0xffff8000 = 0x7ffffffe: OK"     \
161
          "  - carry flag set:    TRUE"                    \
162
          "  - overflow flag set: TRUE"                    \
163
          "!  ** OVE flag cleared **"                      \
164
          "!l.addic"                                       \
165
          "  0x00000001 + 0x00000002     = 0x00000003: OK" \
166
          "  - carry flag set:    FALSE"                   \
167
          "  - overflow flag set: FALSE"                   \
168
          "  0xffffffff + 0xfffffffe     = 0xfffffffd: OK" \
169
          "  - carry flag set:    TRUE"                    \
170
          "  - overflow flag set: FALSE"                   \
171
          "  0x7fff8000 + 0x00007fff     = 0x7fffffff: OK" \
172
          "  - carry flag set:    FALSE"                   \
173
          "  - overflow flag set: FALSE"                   \
174
          "  0x7fff8000 + 0x00007fff + c = 0x80000000: OK" \
175
          "  - carry flag set:    FALSE"                   \
176
          "  - overflow flag set: TRUE"                    \
177
          "  0x7fffc000 + 0x00004000     = 0x80000000: OK" \
178
          "  - carry flag set:    FALSE"                   \
179
          "  - overflow flag set: TRUE"                    \
180
          "  0xffffffff + 0x00000000 + c = 0x00000000: OK" \
181
          "  - carry flag set:    TRUE"                    \
182
          "  - overflow flag set: FALSE"                   \
183
          "  0x00000000 + 0xffffffff + c = 0x00000000: OK" \
184
          "  - carry flag set:    TRUE"                    \
185
          "  - overflow flag set: FALSE"                   \
186
          "  0x80008000 + 0xffff8000     = 0x80000000: OK" \
187
          "  - carry flag set:    TRUE"                    \
188
          "  - overflow flag set: FALSE"                   \
189
          "  0x80007fff + 0xffff8000 + c = 0x80000000: OK" \
190
          "  - carry flag set:    TRUE"                    \
191
          "  - overflow flag set: FALSE"                   \
192
          "  0x80007fff + 0xffff8000     = 0x7fffffff: OK" \
193
          "  - carry flag set:    TRUE"                    \
194
          "  - overflow flag set: TRUE"                    \
195
          "!  ** OVE flag set **"                          \
196
          "  RANGE exception"                              \
197
          "  - caused by: report(0xa0854000);"             \
198
          "  - SR value:  report(0x00009a01);"             \
199
          "  0x7fffc000 + 0x00004000     = 0x80000000: OK" \
200
          "  - carry flag set:    FALSE"                   \
201
          "  - overflow flag set: TRUE"                    \
202
          "  RANGE exception"                              \
203
          "  - caused by: report(0xa0853fff);"             \
204
          "  - SR value:  report(0x00009a01);"             \
205
          "  0x7fffc000 + 0x00003fff + c = 0x80000000: OK" \
206
          "  - carry flag set:    FALSE"                   \
207
          "  - overflow flag set: TRUE"                    \
208
          "  0xffffffff + 0xfffffffe     = 0xfffffffd: OK" \
209
          "  - carry flag set:    TRUE"                    \
210
          "  - overflow flag set: FALSE"                   \
211
          "  0x00000000 + 0xffffffff + c = 0x00000000: OK" \
212
          "  - carry flag set:    TRUE"                    \
213
          "  - overflow flag set: FALSE"                   \
214
          "  RANGE exception"                              \
215
          "  - caused by: report(0xa0858000);"             \
216
          "  - SR value:  report(0x00009e01);"             \
217
          "  0x80007fff + 0xffff8000     = 0x7ffffffe: OK" \
218
          "  - carry flag set:    TRUE"                    \
219
          "  - overflow flag set: TRUE"                    \
220
          "!  ** OVE flag cleared **"                      \
221
          "!Test completed"                                \
222
          "!report(0xdeaddead);"                           \
223
          "!exit(0)"]                                      \
224 112 jeremybenn
    "inst-set-test.cfg" "inst-set-test/is-add-test"
225 115 jeremybenn
 
226
# Run the l.div and l.divu test
227
run_or1ksim "div-test"                                \
228
    [list "!l.div"                                    \
229
          "!  RANGE exception"                        \
230
          "  - caused by: report(0xe0853309);"        \
231
          "!  - SR value:  report(0x00008601);"       \
232
          "  1 / 0 (with error) carry flag set: TRUE" \
233
          "!l.divu"                                   \
234
          "!  RANGE exception"                        \
235
          "  - caused by: report(0xe085330a);"        \
236
          "!  - SR value:  report(0x00008601);"       \
237
          "  1 / 0 (with error) carry flag set: TRUE" \
238
          "!Test completed"                           \
239
          "!report(0xdeaddead);"                      \
240
          "!exit(0)"]                                 \
241
    "inst-set-test.cfg" "inst-set-test/is-div-test"
242
 
243
# Run the l.ff1 and l.fl1 test
244
run_or1ksim "find-test"                 \
245
    [list "!l.ff1"                      \
246
          "  ff1 (0x00000001) =  1: OK" \
247
          "  ff1 (0x80000000) = 32: OK" \
248
          "  ff1 (0x55555555) =  1: OK" \
249
          "  ff1 (0xaaaaaaaa) =  2: OK" \
250
          "  ff1 (0x00018000) = 16: OK" \
251
          "  ff1 (0xc0000000) = 31: OK" \
252
          "  ff1 (0x00000000) =  0: OK" \
253
          "!l.fl1"                      \
254
          "  fl1 (0x00000001) =  1: OK" \
255
          "  fl1 (0x80000000) = 32: OK" \
256
          "  fl1 (0x55555555) = 31: OK" \
257
          "  fl1 (0xaaaaaaaa) = 32: OK" \
258
          "  fl1 (0x00018000) = 17: OK" \
259
          "  fl1 (0xc0000000) = 32: OK" \
260
          "  fl1 (0x00000000) =  0: OK" \
261
          "!Test completed"             \
262
          "!report(0xdeaddead);"        \
263
          "!exit(0)"]                   \
264
    "inst-set-test.cfg" "inst-set-test/is-find-test"
265
 
266
# Run the l.lws test
267
run_or1ksim "lws-test"                            \
268
    [list "!l.lws"                                \
269
          "   l.lws r4,0(r5): r4=0xdeadbeef:  OK" \
270
          "   l.lws r4,0(r5): r4=0x00000000:  OK" \
271
          "   l.lws r4,0(r5): r4=0x7fffffff:  OK" \
272
          "   l.lws r4,0(r5): r4=0x80000000:  OK" \
273
          "   l.lws r4,0(r5): r4=0xffffffff:  OK" \
274
          "   l.lws r4,0(r5): r4=0x00000000:  OK" \
275
          "   l.lws r4,0(r5): r4=0x7fffffff:  OK" \
276
          "   l.lws r4,0(r5): r4=0x80000000:  OK" \
277
          "   l.lws r4,0(r5): r4=0xffffffff:  OK" \
278
          "   l.lws r4,0(r5): r4=0xdeadbeef:  OK" \
279
          "   l.lws r4,0(r5): r4=0x00000000:  OK" \
280
          "   l.lws r4,0(r5): r4=0x7fffffff:  OK" \
281
          "   l.lws r4,0(r5): r4=0x80000000:  OK" \
282
          "!Test completed"                       \
283
          "!report(0xdeaddead);"                  \
284
          "!exit(0)"]                             \
285
    "inst-set-test.cfg" "inst-set-test/is-lws-test"

powered by: WebSVN 2.1.0

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