1# Copyright (C) 2012-2016 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program; if not, write to the Free Software 15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. 16 17# 18# Some xc16x tests 19# 20proc do_xc16x_add {} { 21 set testname "add.s: xc16x add word tests" 22 set x 0 23 24 gas_start "add.s" "-al" 25 26 # Check each instruction bit pattern to verify it got 27 # assembled correctly. 28 while 1 { 29 expect { 30 -re " +\[0-9\]+ 0000 0001\[^\n\]*\n" { set x [expr $x+1] } 31 -re " +\[0-9\]+ 0002 0809\[^\n\]*\n" { set x [expr $x+1] } 32 -re " +\[0-9\]+ 0004 080D\[^\n\]*\n" { set x [expr $x+1] } 33 -re " +\[0-9\]+ 0006 0803\[^\n\]*\n" { set x [expr $x+1] } 34 -re " +\[0-9\]+ 0008 06F0D204\[^\n\]*\n" { set x [expr $x+1] } 35 -re " +\[0-9\]+ 000c 02F0EDFF\[^\n\]*\n" { set x [expr $x+1] } 36 -re " +\[0-9\]+ 0010 04F0EDFF\[^\n\]*\n" { set x [expr $x+1] } 37 timeout { perror "timeout\n"; break } 38 eof { break } 39 } 40 } 41 42 # This was intended to do any cleanup necessary. It kinda looks like it 43 # isn't needed, but just in case, please keep it in for now. 44 gas_finish 45 46 # Did we find what we were looking for? If not, flunk it. 47 if [expr $x == 7] then { pass $testname } else { fail $testname } 48} 49 50proc do_xc16x_addb {} { 51 set testname "addb.s: xc16x add byte tests" 52 set x 0 53 54 gas_start "addb.s" "-al" 55 56 # Check each instruction bit pattern to verify it got 57 # assembled correctly. 58 while 1 { 59 expect { 60 -re " +\[0-9\]+ 0000 0102\[^\n\]*\n" { set x [expr $x+1] } 61 -re " +\[0-9\]+ 0002 0909\[^\n\]*\n" { set x [expr $x+1] } 62 -re " +\[0-9\]+ 0004 090D\[^\n\]*\n" { set x [expr $x+1] } 63 -re " +\[0-9\]+ 0006 0902\[^\n\]*\n" { set x [expr $x+1] } 64 -re " +\[0-9\]+ 0008 07F03300\[^\n\]*\n" { set x [expr $x+1] } 65 -re " +\[0-9\]+ 000c 03F08723\[^\n\]*\n" { set x [expr $x+1] } 66 -re " +\[0-9\]+ 0010 05F08723\[^\n\]*\n" { set x [expr $x+1] } 67 timeout { perror "timeout\n"; break } 68 eof { break } 69 } 70 } 71 72 # This was intended to do any cleanup necessary. It kinda looks like it 73 # isn't needed, but just in case, please keep it in for now. 74 gas_finish 75 76 # Did we find what we were looking for? If not, flunk it. 77 if [expr $x == 7] then { pass $testname } else { fail $testname } 78} 79 80proc do_xc16x_addc {} { 81 set testname "addc.s: xc16x add with carry tests" 82 set x 0 83 84 gas_start "addc.s" "-al" 85 86 # Check each instruction bit pattern to verify it got 87 # assembled correctly. 88 while 1 { 89 expect { 90 -re " +\[0-9\]+ 0000 1001\[^\n\]*\n" { set x [expr $x+1] } 91 -re " +\[0-9\]+ 0002 1809\[^\n\]*\n" { set x [expr $x+1] } 92 -re " +\[0-9\]+ 0004 180D\[^\n\]*\n" { set x [expr $x+1] } 93 -re " +\[0-9\]+ 0006 16F03400\[^\n\]*\n" { set x [expr $x+1] } 94 -re " +\[0-9\]+ 000a 16F05634\[^\n\]*\n" { set x [expr $x+1] } 95 -re " +\[0-9\]+ 000e 12F08723\[^\n\]*\n" { set x [expr $x+1] } 96 -re " +\[0-9\]+ 0012 14F08723\[^\n\]*\n" { set x [expr $x+1] } 97 timeout { perror "timeout\n"; break } 98 eof { break } 99 } 100 } 101 102 # This was intended to do any cleanup necessary. It kinda looks like it 103 # isn't needed, but just in case, please keep it in for now. 104 gas_finish 105 106 # Did we find what we were looking for? If not, flunk it. 107 if [expr $x == 7] then { pass $testname } else { fail $testname } 108} 109 110proc do_xc16x_addcb {} { 111 set testname "addcb.s: xc16x add byte with carry tests" 112 set x 0 113 114 gas_start "addcb.s" "-al" 115 116 # Check each instruction bit pattern to verify it got 117 # assembled correctly. 118 while 1 { 119 expect { 120 -re " +\[0-9\]+ 0000 1102\[^\n\]*\n" { set x [expr $x+1] } 121 -re " +\[0-9\]+ 0002 1909\[^\n\]*\n" { set x [expr $x+1] } 122 -re " +\[0-9\]+ 0004 190D\[^\n\]*\n" { set x [expr $x+1] } 123 -re " +\[0-9\]+ 0006 17F00200\[^\n\]*\n" { set x [expr $x+1] } 124 -re " +\[0-9\]+ 000a 17F02300\[^\n\]*\n" { set x [expr $x+1] } 125 -re " +\[0-9\]+ 000e 15F08723\[^\n\]*\n" { set x [expr $x+1] } 126 timeout { perror "timeout\n"; break } 127 eof { break } 128 } 129 } 130 131 # This was intended to do any cleanup necessary. It kinda looks like it 132 # isn't needed, but just in case, please keep it in for now. 133 gas_finish 134 135 # Did we find what we were looking for? If not, flunk it. 136 if [expr $x == 6] then { pass $testname } else { fail $testname } 137} 138 139proc do_xc16x_sub {} { 140 set testname "sub.s: xc16x sub tests" 141 set x 0 142 143 gas_start "sub.s" "-al" 144 145 # Check each instruction bit pattern to verify it got 146 # assembled correctly. 147 while 1 { 148 expect { 149 -re " +\[0-9\]+ 0000 2001\[^\n\]*\n" { set x [expr $x+1] } 150 -re " +\[0-9\]+ 0002 2809\[^\n\]*\n" { set x [expr $x+1] } 151 -re " +\[0-9\]+ 0004 280D\[^\n\]*\n" { set x [expr $x+1] } 152 -re " +\[0-9\]+ 0006 2801\[^\n\]*\n" { set x [expr $x+1] } 153 -re " +\[0-9\]+ 0008 26F04376\[^\n\]*\n" { set x [expr $x+1] } 154 -re " +\[0-9\]+ 000c 22F04376\[^\n\]*\n" { set x [expr $x+1] } 155 -re " +\[0-9\]+ 0010 24F04376\[^\n\]*\n" { set x [expr $x+1] } 156 timeout { perror "timeout\n"; break } 157 eof { break } 158 } 159 } 160 161 # This was intended to do any cleanup necessary. It kinda looks like it 162 # isn't needed, but just in case, please keep it in for now. 163 gas_finish 164 165 # Did we find what we were looking for? If not, flunk it. 166 if [expr $x == 7] then { pass $testname } else { fail $testname } 167} 168 169proc do_xc16x_subb {} { 170 set testname "subb.s: xc16x sub byte tests" 171 set x 0 172 173 gas_start "subb.s" "-al" 174 175 # Check each instruction bit pattern to verify it got 176 # assembled correctly. 177 while 1 { 178 expect { 179 -re " +\[0-9\]+ 0000 2102\[^\n\]*\n" { set x [expr $x+1] } 180 -re " +\[0-9\]+ 0002 2909\[^\n\]*\n" { set x [expr $x+1] } 181 -re " +\[0-9\]+ 0004 290D\[^\n\]*\n" { set x [expr $x+1] } 182 -re " +\[0-9\]+ 0006 2901\[^\n\]*\n" { set x [expr $x+1] } 183 -re " +\[0-9\]+ 0008 27F04300\[^\n\]*\n" { set x [expr $x+1] } 184 -re " +\[0-9\]+ 000c 23F04376\[^\n\]*\n" { set x [expr $x+1] } 185 -re " +\[0-9\]+ 0010 25F04376\[^\n\]*\n" { set x [expr $x+1] } 186 timeout { perror "timeout\n"; break } 187 eof { break } 188 } 189 } 190 191 # This was intended to do any cleanup necessary. It kinda looks like it 192 # isn't needed, but just in case, please keep it in for now. 193 gas_finish 194 195 # Did we find what we were looking for? If not, flunk it. 196 if [expr $x == 7] then { pass $testname } else { fail $testname } 197} 198 199proc do_xc16x_subc {} { 200 set testname "subc.s: xc16x sub with carry tests" 201 set x 0 202 203 gas_start "subc.s" "-al" 204 205 # Check each instruction bit pattern to verify it got 206 # assembled correctly. 207 while 1 { 208 expect { 209 -re " +\[0-9\]+ 0000 3001\[^\n\]*\n" { set x [expr $x+1] } 210 -re " +\[0-9\]+ 0002 3809\[^\n\]*\n" { set x [expr $x+1] } 211 -re " +\[0-9\]+ 0004 380D\[^\n\]*\n" { set x [expr $x+1] } 212 -re " +\[0-9\]+ 0006 3802\[^\n\]*\n" { set x [expr $x+1] } 213 -re " +\[0-9\]+ 0008 36F04300\[^\n\]*\n" { set x [expr $x+1] } 214 -re " +\[0-9\]+ 000c 32F04376\[^\n\]*\n" { set x [expr $x+1] } 215 -re " +\[0-9\]+ 0010 34F04376\[^\n\]*\n" { set x [expr $x+1] } 216 timeout { perror "timeout\n"; break } 217 eof { break } 218 } 219 } 220 221 # This was intended to do any cleanup necessary. It kinda looks like it 222 # isn't needed, but just in case, please keep it in for now. 223 gas_finish 224 225 # Did we find what we were looking for? If not, flunk it. 226 if [expr $x == 7] then { pass $testname } else { fail $testname } 227} 228 229proc do_xc16x_subcb {} { 230 set testname "subcb.s: xc16x sub byte with carry tests" 231 set x 0 232 233 gas_start "subcb.s" "-al" 234 235 # Check each instruction bit pattern to verify it got 236 # assembled correctly. 237 while 1 { 238 expect { 239 -re " +\[0-9\]+ 0000 3102\[^\n\]*\n" { set x [expr $x+1] } 240 -re " +\[0-9\]+ 0002 3909\[^\n\]*\n" { set x [expr $x+1] } 241 -re " +\[0-9\]+ 0004 390D\[^\n\]*\n" { set x [expr $x+1] } 242 -re " +\[0-9\]+ 0006 3902\[^\n\]*\n" { set x [expr $x+1] } 243 -re " +\[0-9\]+ 0008 37F04300\[^\n\]*\n" { set x [expr $x+1] } 244 -re " +\[0-9\]+ 000c 33F04376\[^\n\]*\n" { set x [expr $x+1] } 245 -re " +\[0-9\]+ 0010 35F04376\[^\n\]*\n" { set x [expr $x+1] } 246 timeout { perror "timeout\n"; break } 247 eof { break } 248 } 249 } 250 251 # This was intended to do any cleanup necessary. It kinda looks like it 252 # isn't needed, but just in case, please keep it in for now. 253 gas_finish 254 255 # Did we find what we were looking for? If not, flunk it. 256 if [expr $x == 7] then { pass $testname } else { fail $testname } 257} 258 259proc do_xc16x_and {} { 260 set testname "and.s: xc16x and tests" 261 set x 0 262 263 gas_start "and.s" "-al" 264 265 # Check each instruction bit pattern to verify it got 266 # assembled correctly. 267 while 1 { 268 expect { 269 -re " +\[0-9\]+ 0000 6001\[^\n\]*\n" { set x [expr $x+1] } 270 -re " +\[0-9\]+ 0002 6809\[^\n\]*\n" { set x [expr $x+1] } 271 -re " +\[0-9\]+ 0004 680D\[^\n\]*\n" { set x [expr $x+1] } 272 -re " +\[0-9\]+ 0006 6803\[^\n\]*\n" { set x [expr $x+1] } 273 -re " +\[0-9\]+ 0008 66F0BEFC\[^\n\]*\n" { set x [expr $x+1] } 274 -re " +\[0-9\]+ 000c 62F03002\[^\n\]*\n" { set x [expr $x+1] } 275 -re " +\[0-9\]+ 0010 64F02003\[^\n\]*\n" { set x [expr $x+1] } 276 timeout { perror "timeout\n"; break } 277 eof { break } 278 } 279 } 280 281 # This was intended to do any cleanup necessary. It kinda looks like it 282 # isn't needed, but just in case, please keep it in for now. 283 gas_finish 284 285 # Did we find what we were looking for? If not, flunk it. 286 if [expr $x == 7] then { pass $testname } else { fail $testname } 287} 288 289proc do_xc16x_andb {} { 290 set testname "andb.s: xc16x and byte tests" 291 set x 0 292 293 gas_start "andb.s" "-al" 294 295 # Check each instruction bit pattern to verify it got 296 # assembled correctly. 297 while 1 { 298 expect { 299 -re " +\[0-9\]+ 0000 6102\[^\n\]*\n" { set x [expr $x+1] } 300 -re " +\[0-9\]+ 0002 6909\[^\n\]*\n" { set x [expr $x+1] } 301 -re " +\[0-9\]+ 0004 690D\[^\n\]*\n" { set x [expr $x+1] } 302 -re " +\[0-9\]+ 0006 6903\[^\n\]*\n" { set x [expr $x+1] } 303 -re " +\[0-9\]+ 0008 67F0BE00\[^\n\]*\n" { set x [expr $x+1] } 304 -re " +\[0-9\]+ 000c 63F03002\[^\n\]*\n" { set x [expr $x+1] } 305 -re " +\[0-9\]+ 0010 65F02003\[^\n\]*\n" { set x [expr $x+1] } 306 timeout { perror "timeout\n"; break } 307 eof { break } 308 } 309 } 310 311 # This was intended to do any cleanup necessary. It kinda looks like it 312 # isn't needed, but just in case, please keep it in for now. 313 gas_finish 314 315 # Did we find what we were looking for? If not, flunk it. 316 if [expr $x == 7] then { pass $testname } else { fail $testname } 317} 318 319proc do_xc16x_or {} { 320 set testname "or.s: xc16x or tests" 321 set x 0 322 323 gas_start "or.s" "-al" 324 325 # Check each instruction bit pattern to verify it got 326 # assembled correctly. 327 while 1 { 328 expect { 329 -re " +\[0-9\]+ 0000 7001\[^\n\]*\n" { set x [expr $x+1] } 330 -re " +\[0-9\]+ 0002 7809\[^\n\]*\n" { set x [expr $x+1] } 331 -re " +\[0-9\]+ 0004 780D\[^\n\]*\n" { set x [expr $x+1] } 332 -re " +\[0-9\]+ 0006 7803\[^\n\]*\n" { set x [expr $x+1] } 333 -re " +\[0-9\]+ 0008 76F03402\[^\n\]*\n" { set x [expr $x+1] } 334 -re " +\[0-9\]+ 000c 72F03645\[^\n\]*\n" { set x [expr $x+1] } 335 -re " +\[0-9\]+ 0010 74F03645\[^\n\]*\n" { set x [expr $x+1] } 336 timeout { perror "timeout\n"; break } 337 eof { break } 338 } 339 } 340 341 # This was intended to do any cleanup necessary. It kinda looks like it 342 # isn't needed, but just in case, please keep it in for now. 343 gas_finish 344 345 # Did we find what we were looking for? If not, flunk it. 346 if [expr $x == 7] then { pass $testname } else { fail $testname } 347} 348 349proc do_xc16x_xor {} { 350 set testname "xor.s: xc16x xor tests" 351 set x 0 352 353 gas_start "xor.s" "-al" 354 355 # Check each instruction bit pattern to verify it got 356 # assembled correctly. 357 while 1 { 358 expect { 359 -re " +\[0-9\]+ 0000 5001\[^\n\]*\n" { set x [expr $x+1] } 360 -re " +\[0-9\]+ 0002 5809\[^\n\]*\n" { set x [expr $x+1] } 361 -re " +\[0-9\]+ 0004 580D\[^\n\]*\n" { set x [expr $x+1] } 362 -re " +\[0-9\]+ 0006 5803\[^\n\]*\n" { set x [expr $x+1] } 363 -re " +\[0-9\]+ 0008 56F03402\[^\n\]*\n" { set x [expr $x+1] } 364 -re " +\[0-9\]+ 000c 52F03402\[^\n\]*\n" { set x [expr $x+1] } 365 -re " +\[0-9\]+ 0010 54F03402\[^\n\]*\n" { set x [expr $x+1] } 366 timeout { perror "timeout\n"; break } 367 eof { break } 368 } 369 } 370 371 # This was intended to do any cleanup necessary. It kinda looks like it 372 # isn't needed, but just in case, please keep it in for now. 373 gas_finish 374 375 # Did we find what we were looking for? If not, flunk it. 376 if [expr $x == 7] then { pass $testname } else { fail $testname } 377} 378 379proc do_xc16x_xorb {} { 380 set testname "xorb.s: xc16x xorb tests" 381 set x 0 382 383 gas_start "xorb.s" "-al" 384 385 # Check each instruction bit pattern to verify it got 386 # assembled correctly. 387 while 1 { 388 expect { 389 -re " +\[0-9\]+ 0000 5102\[^\n\]*\n" { set x [expr $x+1] } 390 -re " +\[0-9\]+ 0002 5909\[^\n\]*\n" { set x [expr $x+1] } 391 -re " +\[0-9\]+ 0004 590D\[^\n\]*\n" { set x [expr $x+1] } 392 -re " +\[0-9\]+ 0006 5903\[^\n\]*\n" { set x [expr $x+1] } 393 -re " +\[0-9\]+ 0008 57F03400\[^\n\]*\n" { set x [expr $x+1] } 394 -re " +\[0-9\]+ 000c 53F00324\[^\n\]*\n" { set x [expr $x+1] } 395 -re " +\[0-9\]+ 0010 55F00324\[^\n\]*\n" { set x [expr $x+1] } 396 timeout { perror "timeout\n"; break } 397 eof { break } 398 } 399 } 400 401 # This was intended to do any cleanup necessary. It kinda looks like it 402 # isn't needed, but just in case, please keep it in for now. 403 gas_finish 404 405 # Did we find what we were looking for? If not, flunk it. 406 if [expr $x == 7] then { pass $testname } else { fail $testname } 407 408} 409 410proc do_xc16x_mov {} { 411 set testname "mov.s: xc16x mov tests" 412 set x 0 413 414 gas_start "mov.s" "-al" 415 416 # Check each instruction bit pattern to verify it got 417 # assembled correctly. 418 while 1 { 419 expect { 420 -re " +\[0-9\]+ 0000 F001\[^\n\]*\n" { set x [expr $x+1] } 421 -re " +\[0-9\]+ 0002 E6F00200\[^\n\]*\n" { set x [expr $x+1] } 422 -re " +\[0-9\]+ 0006 E6F0BEFC\[^\n\]*\n" { set x [expr $x+1] } 423 -re " +\[0-9\]+ 000a A801\[^\n\]*\n" { set x [expr $x+1] } 424 -re " +\[0-9\]+ 000c 9801\[^\n\]*\n" { set x [expr $x+1] } 425 -re " +\[0-9\]+ 000e B810\[^\n\]*\n" { set x [expr $x+1] } 426 -re " +\[0-9\]+ 0010 8810\[^\n\]*\n" { set x [expr $x+1] } 427 -re " +\[0-9\]+ 0012 C801\[^\n\]*\n" { set x [expr $x+1] } 428 -re " +\[0-9\]+ 0014 D801\[^\n\]*\n" { set x [expr $x+1] } 429 -re " +\[0-9\]+ 0016 E801\[^\n\]*\n" { set x [expr $x+1] } 430 -re " +\[0-9\]+ 0018 D400CBFF\[^\n\]*\n" { set x [expr $x+1] } 431 -re " +\[0-9\]+ 001c C400CBFF\[^\n\]*\n" { set x [expr $x+1] } 432 -re " +\[0-9\]+ 0020 8400CBFF\[^\n\]*\n" { set x [expr $x+1] } 433 -re " +\[0-9\]+ 0024 9400CBFF\[^\n\]*\n" { set x [expr $x+1] } 434 -re " +\[0-9\]+ 0028 F2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 435 -re " +\[0-9\]+ 002c F6F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 436 timeout { perror "timeout\n"; break } 437 eof { break } 438 } 439 } 440 441 # This was intended to do any cleanup necessary. It kinda looks like it 442 # isn't needed, but just in case, please keep it in for now. 443 gas_finish 444 445 # Did we find what we were looking for? If not, flunk it. 446 if [expr $x == 16] then { pass $testname } else { fail $testname } 447} 448 449proc do_xc16x_movb {} { 450 set testname "movb.s: xc16x movb tests" 451 set x 0 452 453 gas_start "movb.s" "-al" 454 455 # Check each instruction bit pattern to verify it got 456 # assembled correctly. 457 while 1 { 458 expect { 459 -re " +\[0-9\]+ 0000 F3F00000\[^\n\]*\n" { set x [expr $x+1] } 460 -re " +\[0-9\]+ 0004 E7F01200\[^\n\]*\n" { set x [expr $x+1] } 461 -re " +\[0-9\]+ 0008 B4020000\[^\n\]*\n" { set x [expr $x+1] } 462 -re " +\[0-9\]+ 000c 9902\[^\n\]*\n" { set x [expr $x+1] } 463 -re " +\[0-9\]+ 000e 8902\[^\n\]*\n" { set x [expr $x+1] } 464 -re " +\[0-9\]+ 0010 E932\[^\n\]*\n" { set x [expr $x+1] } 465 -re " +\[0-9\]+ 0012 C932\[^\n\]*\n" { set x [expr $x+1] } 466 -re " +\[0-9\]+ 0014 D923\[^\n\]*\n" { set x [expr $x+1] } 467 -re " +\[0-9\]+ 0016 E923\[^\n\]*\n" { set x [expr $x+1] } 468 -re " +\[0-9\]+ 0018 F4033412\[^\n\]*\n" { set x [expr $x+1] } 469 -re " +\[0-9\]+ 001c E4033412\[^\n\]*\n" { set x [expr $x+1] } 470 -re " +\[0-9\]+ 0020 A4033412\[^\n\]*\n" { set x [expr $x+1] } 471 -re " +\[0-9\]+ 0024 A403FFEE\[^\n\]*\n" { set x [expr $x+1] } 472 -re " +\[0-9\]+ 0028 B4033412\[^\n\]*\n" { set x [expr $x+1] } 473 -re " +\[0-9\]+ 002c F3F01200\[^\n\]*\n" { set x [expr $x+1] } 474 -re " +\[0-9\]+ 0030 F7F01200\[^\n\]*\n" { set x [expr $x+1] } 475 timeout { perror "timeout\n"; break } 476 eof { break } 477 } 478 } 479 480 # This was intended to do any cleanup necessary. It kinda looks like it 481 # isn't needed, but just in case, please keep it in for now. 482 gas_finish 483 484 # Did we find what we were looking for? If not, flunk it. 485 if [expr $x == 16] then { pass $testname } else { fail $testname } 486} 487 488proc do_xc16x_movbs {} { 489 set testname "movbs.s: xc16x mov byte tests" 490 set x 0 491 492 gas_start "movbs.s" "-al" 493 494 # Check each instruction bit pattern to verify it got 495 # assembled correctly. 496 while 1 { 497 expect { 498 -re " +\[0-9\]+ 0000 D020\[^\n\]*\n" { set x [expr $x+1] } 499 -re " +\[0-9\]+ 0002 D2F0FF00\[^\n\]*\n" { set x [expr $x+1] } 500 -re " +\[0-9\]+ 0006 D5F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 501 timeout { perror "timeout\n"; break } 502 eof { break } 503 } 504 } 505 506 # This was intended to do any cleanup necessary. It kinda looks like it 507 # isn't needed, but just in case, please keep it in for now. 508 gas_finish 509 510 # Did we find what we were looking for? If not, flunk it. 511 if [expr $x == 3] then { pass $testname } else { fail $testname } 512} 513 514proc do_xc16x_movbz {} { 515 set testname "movbz.s: xc16x movbz tests" 516 set x 0 517 518 gas_start "movbz.s" "-al" 519 520 # Check each instruction bit pattern to verify it got 521 # assembled correctly. 522 while 1 { 523 expect { 524 -re " +\[0-9\]+ 0000 C002\[^\n\]*\n" { set x [expr $x+1] } 525 -re " +\[0-9\]+ 0002 C2F0DD23\[^\n\]*\n" { set x [expr $x+1] } 526 -re " +\[0-9\]+ 0006 C5F02300\[^\n\]*\n" { set x [expr $x+1] } 527 timeout { perror "timeout\n"; break } 528 eof { break } 529 } 530 } 531 532 # This was intended to do any cleanup necessary. It kinda looks like it 533 # isn't needed, but just in case, please keep it in for now. 534 gas_finish 535 536 # Did we find what we were looking for? If not, flunk it. 537 if [expr $x == 3] then { pass $testname } else { fail $testname } 538} 539 540proc do_xc16x_pushpop {} { 541 set testname "pushpop.s: xc16x push/pop tests" 542 set x 0 543 544 gas_start "pushpop.s" "-al" 545 546 # Check each instruction bit pattern to verify it got 547 # assembled correctly. 548 while 1 { 549 expect { 550 -re " +\[0-9\]+ 0000 FCF0\[^\n\]*\n" { set x [expr $x+1] } 551 -re " +\[0-9\]+ 0002 ECF0\[^\n\]*\n" { set x [expr $x+1] } 552 timeout { perror "timeout\n"; break } 553 eof { break } 554 } 555 } 556 557 # This was intended to do any cleanup necessary. It kinda looks like it 558 # isn't needed, but just in case, please keep it in for now. 559 gas_finish 560 561 # Did we find what we were looking for? If not, flunk it. 562 if [expr $x == 2] then { pass $testname } else { fail $testname } 563} 564 565proc do_xc16x_shlrol {} { 566 set testname "shlrol.s: xc16x shift and rotate tests" 567 set x 0 568 569 gas_start "shlrol.s" "-al" 570 571 # Check each instruction bit pattern to verify it got 572 # assembled correctly. 573 while 1 { 574 expect { 575 -re " +\[0-9\]+ 0000 4C01\[^\n\]*\n" { set x [expr $x+1] } 576 -re " +\[0-9\]+ 0002 5C40\[^\n\]*\n" { set x [expr $x+1] } 577 -re " +\[0-9\]+ 0004 6C01\[^\n\]*\n" { set x [expr $x+1] } 578 -re " +\[0-9\]+ 0006 7C40\[^\n\]*\n" { set x [expr $x+1] } 579 -re " +\[0-9\]+ 0008 0C01\[^\n\]*\n" { set x [expr $x+1] } 580 -re " +\[0-9\]+ 000a 1C40\[^\n\]*\n" { set x [expr $x+1] } 581 -re " +\[0-9\]+ 000c 2C01\[^\n\]*\n" { set x [expr $x+1] } 582 -re " +\[0-9\]+ 000e 3C40\[^\n\]*\n" { set x [expr $x+1] } 583 -re " +\[0-9\]+ 0010 AC01\[^\n\]*\n" { set x [expr $x+1] } 584 -re " +\[0-9\]+ 0012 BC40\[^\n\]*\n" { set x [expr $x+1] } 585 timeout { perror "timeout\n"; break } 586 eof { break } 587 } 588 } 589 590 # This was intended to do any cleanup necessary. It kinda looks like it 591 # isn't needed, but just in case, please keep it in for now. 592 gas_finish 593 594 # Did we find what we were looking for? If not, flunk it. 595 if [expr $x == 10] then { pass $testname } else { fail $testname } 596} 597 598proc do_xc16x_neg {} { 599 set testname "neg.s: xc16x neg tests" 600 set x 0 601 602 gas_start "neg.s" "-al" 603 604 # Check each instruction bit pattern to verify it got 605 # assembled correctly. 606 while 1 { 607 expect { 608 -re " +\[0-9\]+ 0000 8100\[^\n\]*\n" { set x [expr $x+1] } 609 -re " +\[0-9\]+ 0002 A100\[^\n\]*\n" { set x [expr $x+1] } 610 timeout { perror "timeout\n"; break } 611 eof { break } 612 } 613 } 614 615 # This was intended to do any cleanup necessary. It kinda looks like it 616 # isn't needed, but just in case, please keep it in for now. 617 gas_finish 618 619 # Did we find what we were looking for? If not, flunk it. 620 if [expr $x == 2] then { pass $testname } else { fail $testname } 621} 622proc do_xc16x_mul {} { 623 set testname "mul.s: xc16x multiply tests" 624 set x 0 625 626 gas_start "mul.s" "-al" 627 628 # Check each instruction bit pattern to verify it got 629 # assembled correctly. 630 while 1 { 631 expect { 632 -re " +\[0-9\]+ 0000 0B01\[^\n\]*\n" { set x [expr $x+1] } 633 -re " +\[0-9\]+ 0002 1B01\[^\n\]*\n" { set x [expr $x+1] } 634 timeout { perror "timeout\n"; break } 635 eof { break } 636 } 637 } 638 639 # This was intended to do any cleanup necessary. It kinda looks like it 640 # isn't needed, but just in case, please keep it in for now. 641 gas_finish 642 643 # Did we find what we were looking for? If not, flunk it. 644 if [expr $x == 2] then { pass $testname } else { fail $testname } 645} 646 647proc do_xc16x_div {} { 648 set testname "div.s: xc16x division tests" 649 set x 0 650 651 gas_start "div.s" "-al" 652 653 # Check each instruction bit pattern to verify it got 654 # assembled correctly. 655 while 1 { 656 expect { 657 -re " +\[0-9\]+ 0000 4B00\[^\n\]*\n" { set x [expr $x+1] } 658 -re " +\[0-9\]+ 0002 6B00\[^\n\]*\n" { set x [expr $x+1] } 659 -re " +\[0-9\]+ 0004 7B00\[^\n\]*\n" { set x [expr $x+1] } 660 -re " +\[0-9\]+ 0006 5B00\[^\n\]*\n" { set x [expr $x+1] } 661 timeout { perror "timeout\n"; break } 662 eof { break } 663 } 664 } 665 666 # This was intended to do any cleanup necessary. It kinda looks like it 667 # isn't needed, but just in case, please keep it in for now. 668 gas_finish 669 670 # Did we find what we were looking for? If not, flunk it. 671 if [expr $x == 4] then { pass $testname } else { fail $testname } 672} 673 674proc do_xc16x_jmpa {} { 675 set testname "jmpa.s: xc16x jump absolute test" 676 set x 0 677 678 gas_start "jmpa.s" "-al" 679 680 # Check each instruction bit pattern to verify it got 681 # assembled correctly. 682 while 1 { 683 expect { 684 -re " +\[0-9\]+ 0000 EA00AAAA\[^\n\]*\n" { set x [expr $x+1] } 685 -re " +\[0-9\]+ 0004 EA20AAAA\[^\n\]*\n" { set x [expr $x+1] } 686 -re " +\[0-9\]+ 0008 EA30AAAA\[^\n\]*\n" { set x [expr $x+1] } 687 -re " +\[0-9\]+ 000c EA40AAAA\[^\n\]*\n" { set x [expr $x+1] } 688 -re " +\[0-9\]+ 0010 EA50AAAA\[^\n\]*\n" { set x [expr $x+1] } 689 -re " +\[0-9\]+ 0014 EA60AAAA\[^\n\]*\n" { set x [expr $x+1] } 690 -re " +\[0-9\]+ 0018 EA70AAAA\[^\n\]*\n" { set x [expr $x+1] } 691 -re " +\[0-9\]+ 001c EA80AAAA\[^\n\]*\n" { set x [expr $x+1] } 692 -re " +\[0-9\]+ 0020 EA90AAAA\[^\n\]*\n" { set x [expr $x+1] } 693 -re " +\[0-9\]+ 0024 EA20AAAA\[^\n\]*\n" { set x [expr $x+1] } 694 -re " +\[0-9\]+ 0028 EA30AAAA\[^\n\]*\n" { set x [expr $x+1] } 695 -re " +\[0-9\]+ 002c EA80AAAA\[^\n\]*\n" { set x [expr $x+1] } 696 -re " +\[0-9\]+ 0030 EAF0AAAA\[^\n\]*\n" { set x [expr $x+1] } 697 -re " +\[0-9\]+ 0034 EA90AAAA\[^\n\]*\n" { set x [expr $x+1] } 698 -re " +\[0-9\]+ 0038 EAE0AAAA\[^\n\]*\n" { set x [expr $x+1] } 699 -re " +\[0-9\]+ 003c EAB0AAAA\[^\n\]*\n" { set x [expr $x+1] } 700 -re " +\[0-9\]+ 0040 EAD0AAAA\[^\n\]*\n" { set x [expr $x+1] } 701 -re " +\[0-9\]+ 0044 EAA0AAAA\[^\n\]*\n" { set x [expr $x+1] } 702 -re " +\[0-9\]+ 0048 EA10AAAA\[^\n\]*\n" { set x [expr $x+1] } 703 timeout { perror "timeout\n"; break } 704 eof { break } 705 } 706 } 707 708 # This was intended to do any cleanup necessary. It kinda looks like it 709 # isn't needed, but just in case, please keep it in for now. 710 gas_finish 711 712 # Did we find what we were looking for? If not, flunk it. 713 if [expr $x == 19] then { pass $testname } else { fail $testname } 714} 715 716proc do_xc16x_jmpi {} { 717 set testname "jmpi.s: xc16x jmp immidiate tests " 718 set x 0 719 720 gas_start "jmpi.s" "-al" 721 722 # Check each instruction bit pattern to verify it got 723 # assembled correctly. 724 while 1 { 725 expect { 726 -re " +\[0-9\]+ 0000 9C07\[^\n\]*\n" { set x [expr $x+1] } 727 -re " +\[0-9\]+ 0002 9C27\[^\n\]*\n" { set x [expr $x+1] } 728 -re " +\[0-9\]+ 0004 9C37\[^\n\]*\n" { set x [expr $x+1] } 729 -re " +\[0-9\]+ 0006 9C47\[^\n\]*\n" { set x [expr $x+1] } 730 -re " +\[0-9\]+ 0008 9C57\[^\n\]*\n" { set x [expr $x+1] } 731 -re " +\[0-9\]+ 000a 9C67\[^\n\]*\n" { set x [expr $x+1] } 732 -re " +\[0-9\]+ 000c 9C77\[^\n\]*\n" { set x [expr $x+1] } 733 -re " +\[0-9\]+ 000e 9C87\[^\n\]*\n" { set x [expr $x+1] } 734 -re " +\[0-9\]+ 0010 9C97\[^\n\]*\n" { set x [expr $x+1] } 735 -re " +\[0-9\]+ 0012 9C27\[^\n\]*\n" { set x [expr $x+1] } 736 -re " +\[0-9\]+ 0014 9C37\[^\n\]*\n" { set x [expr $x+1] } 737 -re " +\[0-9\]+ 0016 9C87\[^\n\]*\n" { set x [expr $x+1] } 738 -re " +\[0-9\]+ 0018 9CF7\[^\n\]*\n" { set x [expr $x+1] } 739 -re " +\[0-9\]+ 001a 9C97\[^\n\]*\n" { set x [expr $x+1] } 740 -re " +\[0-9\]+ 001c 9CE7\[^\n\]*\n" { set x [expr $x+1] } 741 -re " +\[0-9\]+ 001e 9CB7\[^\n\]*\n" { set x [expr $x+1] } 742 -re " +\[0-9\]+ 0020 9CD7\[^\n\]*\n" { set x [expr $x+1] } 743 -re " +\[0-9\]+ 0022 9CA7\[^\n\]*\n" { set x [expr $x+1] } 744 -re " +\[0-9\]+ 0024 9C17\[^\n\]*\n" { set x [expr $x+1] } 745 timeout { perror "timeout\n"; break } 746 eof { break } 747 } 748 } 749 750 # This was intended to do any cleanup necessary. It kinda looks like it 751 # isn't needed, but just in case, please keep it in for now. 752 gas_finish 753 754 # Did we find what we were looking for? If not, flunk it. 755 if [expr $x == 19] then { pass $testname } else { fail $testname } 756} 757 758 759proc do_xc16x_jmpr {} { 760 set testname "jmpr.s: xc16x jump relative tests" 761 set x 0 762 763 gas_start "jmpr.s" "-al" 764 765 # Check each instruction bit pattern to verify it got 766 # assembled correctly. 767 while 1 { 768 expect { 769 -re " +\[0-9\]+ 0000 0DFF\[^\n\]*\n" { set x [expr $x+1] } 770 -re " +\[0-9\]+ 0002 2DFE\[^\n\]*\n" { set x [expr $x+1] } 771 -re " +\[0-9\]+ 0004 3DFD\[^\n\]*\n" { set x [expr $x+1] } 772 -re " +\[0-9\]+ 0006 4DFC\[^\n\]*\n" { set x [expr $x+1] } 773 -re " +\[0-9\]+ 0008 5DFB\[^\n\]*\n" { set x [expr $x+1] } 774 -re " +\[0-9\]+ 000a 6DFA\[^\n\]*\n" { set x [expr $x+1] } 775 -re " +\[0-9\]+ 000c 7DF9\[^\n\]*\n" { set x [expr $x+1] } 776 -re " +\[0-9\]+ 000e 8DF8\[^\n\]*\n" { set x [expr $x+1] } 777 -re " +\[0-9\]+ 0010 9DF7\[^\n\]*\n" { set x [expr $x+1] } 778 -re " +\[0-9\]+ 0012 2DF6\[^\n\]*\n" { set x [expr $x+1] } 779 -re " +\[0-9\]+ 0014 3DF5\[^\n\]*\n" { set x [expr $x+1] } 780 -re " +\[0-9\]+ 0016 8DF4\[^\n\]*\n" { set x [expr $x+1] } 781 -re " +\[0-9\]+ 0018 FDF3\[^\n\]*\n" { set x [expr $x+1] } 782 -re " +\[0-9\]+ 001a 9DF2\[^\n\]*\n" { set x [expr $x+1] } 783 -re " +\[0-9\]+ 001c EDF1\[^\n\]*\n" { set x [expr $x+1] } 784 -re " +\[0-9\]+ 001e BDF0\[^\n\]*\n" { set x [expr $x+1] } 785 -re " +\[0-9\]+ 0020 DDEF\[^\n\]*\n" { set x [expr $x+1] } 786 -re " +\[0-9\]+ 0022 ADEE\[^\n\]*\n" { set x [expr $x+1] } 787 -re " +\[0-9\]+ 0024 1DED\[^\n\]*\n" { set x [expr $x+1] } 788 -re " +\[0-9\]+ 0026 CDEC\[^\n\]*\n" { set x [expr $x+1] } 789 timeout { perror "timeout\n"; break } 790 eof { break } 791 } 792 } 793 794 # This was intended to do any cleanup necessary. It kinda looks like it 795 # isn't needed, but just in case, please keep it in for now. 796 gas_finish 797 798 # Did we find what we were looking for? If not, flunk it. 799 if [expr $x == 20] then { pass $testname } else { fail $testname } 800} 801 802proc do_xc16x_syscontrol1 {} { 803 set testname "syscontrol1.s: xc16x system control insrutions tests" 804 set x 0 805 806 gas_start "syscontrol1.s" "-al" 807 808 # Check each instruction bit pattern to verify it got 809 # assembled correctly. 810 while 1 { 811 expect { 812 -re " +\[0-9\]+ 0000 B748B7B7\[^\n\]*\n" { set x [expr $x+1] } 813 -re " +\[0-9\]+ 0004 8C00\[^\n\]*\n" { set x [expr $x+1] } 814 -re " +\[0-9\]+ 0006 87788787\[^\n\]*\n" { set x [expr $x+1] } 815 -re " +\[0-9\]+ 000a 97689797\[^\n\]*\n" { set x [expr $x+1] } 816 -re " +\[0-9\]+ 000e A758A7A7\[^\n\]*\n" { set x [expr $x+1] } 817 -re " +\[0-9\]+ 0012 A55AA5A5\[^\n\]*\n" { set x [expr $x+1] } 818 -re " +\[0-9\]+ 0016 857A8585\[^\n\]*\n" { set x [expr $x+1] } 819 -re " +\[0-9\]+ 001a B54AB5B5\[^\n\]*\n" { set x [expr $x+1] } 820 timeout { perror "timeout\n"; break } 821 eof { break } 822 } 823 } 824 825 # This was intended to do any cleanup necessary. It kinda looks like it 826 # isn't needed, but just in case, please keep it in for now. 827 gas_finish 828 829 # Did we find what we were looking for? If not, flunk it. 830 if [expr $x == 8] then { pass $testname } else { fail $testname } 831} 832 833proc do_xc16x_syscontrol2 {} { 834 set testname "syscontrol2.s: xc16x syscontrol2 tests" 835 set x 0 836 837 gas_start "syscontrol2.s" "-al" 838 839 # Check each instruction bit pattern to verify it got 840 # assembled correctly. 841 while 1 { 842 expect { 843 -re " +\[0-9\]+ 0000 D1B0\[^\n\]*\n" { set x [expr $x+1] } 844 -re " +\[0-9\]+ 0002 D1A0\[^\n\]*\n" { set x [expr $x+1] } 845 -re " +\[0-9\]+ 0004 D190\[^\n\]*\n" { set x [expr $x+1] } 846 -re " +\[0-9\]+ 0006 D180\[^\n\]*\n" { set x [expr $x+1] } 847 -re " +\[0-9\]+ 0008 D130\[^\n\]*\n" { set x [expr $x+1] } 848 -re " +\[0-9\]+ 000a D120\[^\n\]*\n" { set x [expr $x+1] } 849 -re " +\[0-9\]+ 000c D110\[^\n\]*\n" { set x [expr $x+1] } 850 -re " +\[0-9\]+ 000e D100\[^\n\]*\n" { set x [expr $x+1] } 851 -re " +\[0-9\]+ 0010 DC75\[^\n\]*\n" { set x [expr $x+1] } 852 -re " +\[0-9\]+ 0012 D770FF03\[^\n\]*\n" { set x [expr $x+1] } 853 -re " +\[0-9\]+ 0016 DCF5\[^\n\]*\n" { set x [expr $x+1] } 854 -re " +\[0-9\]+ 0018 D7F0FF03\[^\n\]*\n" { set x [expr $x+1] } 855 -re " +\[0-9\]+ 001c DC35\[^\n\]*\n" { set x [expr $x+1] } 856 -re " +\[0-9\]+ 001e D7300100\[^\n\]*\n" { set x [expr $x+1] } 857 -re " +\[0-9\]+ 0022 DCB5\[^\n\]*\n" { set x [expr $x+1] } 858 -re " +\[0-9\]+ 0024 D7B00100\[^\n\]*\n" { set x [expr $x+1] } 859 timeout { perror "timeout\n"; break } 860 eof { break } 861 } 862 } 863 864 # This was intended to do any cleanup necessary. It kinda looks like it 865 # isn't needed, but just in case, please keep it in for now. 866 gas_finish 867 868 # Did we find what we were looking for? If not, flunk it. 869 if [expr $x == 16] then { pass $testname } else { fail $testname } 870} 871 872proc do_xc16x_cpl {} { 873 set testname "cpl.s: xc16x compliment tests" 874 set x 0 875 876 gas_start "cpl.s" "-al" 877 878 # Check each instruction bit pattern to verify it got 879 # assembled correctly. 880 while 1 { 881 expect { 882 -re " +\[0-9\]+ 0000 9100\[^\n\]*\n" { set x [expr $x+1] } 883 -re " +\[0-9\]+ 0002 B100\[^\n\]*\n" { set x [expr $x+1] } 884 timeout { perror "timeout\n"; break } 885 eof { break } 886 } 887 } 888 889 # This was intended to do any cleanup necessary. It kinda looks like it 890 # isn't needed, but just in case, please keep it in for now. 891 gas_finish 892 893 # Did we find what we were looking for? If not, flunk it. 894 if [expr $x == 2] then { pass $testname } else { fail $testname } 895} 896 897proc do_xc16x_cmp {} { 898 set testname "cmp.s: xc16x misc tests" 899 set x 0 900 901 gas_start "cmp.s" "-al" 902 903 # Check each instruction bit pattern to verify it got 904 # assembled correctly. 905 while 1 { 906 expect { 907 -re " +\[0-9\]+ 0000 4001\[^\n\]*\n" { set x [expr $x+1] } 908 -re " +\[0-9\]+ 0002 4809\[^\n\]*\n" { set x [expr $x+1] } 909 -re " +\[0-9\]+ 0004 480D\[^\n\]*\n" { set x [expr $x+1] } 910 -re " +\[0-9\]+ 0006 4803\[^\n\]*\n" { set x [expr $x+1] } 911 -re " +\[0-9\]+ 0008 46F03402\[^\n\]*\n" { set x [expr $x+1] } 912 -re " +\[0-9\]+ 000c 42F05234\[^\n\]*\n" { set x [expr $x+1] } 913 timeout { perror "timeout\n"; break } 914 eof { break } 915 } 916 } 917 918 # This was intended to do any cleanup necessary. It kinda looks like it 919 # isn't needed, but just in case, please keep it in for now. 920 gas_finish 921 922 # Did we find what we were looking for? If not, flunk it. 923 if [expr $x == 6] then { pass $testname } else { fail $testname } 924} 925 926proc do_xc16x_cmpb {} { 927 set testname "cmpb.s: xc16x cmp byte tests" 928 set x 0 929 930 gas_start "cmpb.s" "-al" 931 932 # Check each instruction bit pattern to verify it got 933 # assembled correctly. 934 while 1 { 935 expect { 936 -re " +\[0-9\]+ 0000 4102\[^\n\]*\n" { set x [expr $x+1] } 937 -re " +\[0-9\]+ 0002 4909\[^\n\]*\n" { set x [expr $x+1] } 938 -re " +\[0-9\]+ 0004 490D\[^\n\]*\n" { set x [expr $x+1] } 939 -re " +\[0-9\]+ 0006 4903\[^\n\]*\n" { set x [expr $x+1] } 940 -re " +\[0-9\]+ 0008 47F02200\[^\n\]*\n" { set x [expr $x+1] } 941 -re " +\[0-9\]+ 000c 43F03402\[^\n\]*\n" { set x [expr $x+1] } 942 timeout { perror "timeout\n"; break } 943 eof { break } 944 } 945 } 946 947 # This was intended to do any cleanup necessary. It kinda looks like it 948 # isn't needed, but just in case, please keep it in for now. 949 gas_finish 950 951 # Did we find what we were looking for? If not, flunk it. 952 if [expr $x == 6] then { pass $testname } else { fail $testname } 953} 954 955proc do_xc16x_cmpi {} { 956 set testname "cmpi.s: xc16x cmpi tests" 957 set x 0 958 959 gas_start "cmpi.s" "-al" 960 961 # Check each instruction bit pattern to verify it got 962 # assembled correctly. 963 while 1 { 964 expect { 965 -re " +\[0-9\]+ 0000 A0F0\[^\n\]*\n" { set x [expr $x+1] } 966 -re " +\[0-9\]+ 0002 A6F0CBFC\[^\n\]*\n" { set x [expr $x+1] } 967 -re " +\[0-9\]+ 0006 A2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 968 -re " +\[0-9\]+ 000a B0F0\[^\n\]*\n" { set x [expr $x+1] } 969 -re " +\[0-9\]+ 000c B6F0CBFC\[^\n\]*\n" { set x [expr $x+1] } 970 -re " +\[0-9\]+ 0010 B2F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 971 -re " +\[0-9\]+ 0014 80F0\[^\n\]*\n" { set x [expr $x+1] } 972 -re " +\[0-9\]+ 0016 86F0CBFC\[^\n\]*\n" { set x [expr $x+1] } 973 -re " +\[0-9\]+ 001a 82F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 974 -re " +\[0-9\]+ 001e 90F0\[^\n\]*\n" { set x [expr $x+1] } 975 -re " +\[0-9\]+ 0020 96F0CBFC\[^\n\]*\n" { set x [expr $x+1] } 976 -re " +\[0-9\]+ 0024 92F0CBFF\[^\n\]*\n" { set x [expr $x+1] } 977 timeout { perror "timeout\n"; break } 978 eof { break } 979 } 980 } 981 982 # This was intended to do any cleanup necessary. It kinda looks like it 983 # isn't needed, but just in case, please keep it in for now. 984 gas_finish 985 986 # Did we find what we were looking for? If not, flunk it. 987 if [expr $x == 12] then { pass $testname } else { fail $testname } 988} 989 990proc do_xc16x_calli {} { 991 set testname "calli.s: xc16x call tests" 992 set x 0 993 994 gas_start "calli.s" "-al" 995 996 # Check each instruction bit pattern to verify it got 997 # assembled correctly. 998 while 1 { 999 expect { 1000 -re " +\[0-9\]+ 0000 AB01\[^\n\]*\n" { set x [expr $x+1] } 1001 -re " +\[0-9\]+ 0002 AB21\[^\n\]*\n" { set x [expr $x+1] } 1002 -re " +\[0-9\]+ 0004 AB31\[^\n\]*\n" { set x [expr $x+1] } 1003 -re " +\[0-9\]+ 0006 AB41\[^\n\]*\n" { set x [expr $x+1] } 1004 -re " +\[0-9\]+ 0008 AB51\[^\n\]*\n" { set x [expr $x+1] } 1005 -re " +\[0-9\]+ 000a AB61\[^\n\]*\n" { set x [expr $x+1] } 1006 -re " +\[0-9\]+ 000c AB71\[^\n\]*\n" { set x [expr $x+1] } 1007 -re " +\[0-9\]+ 000e AB81\[^\n\]*\n" { set x [expr $x+1] } 1008 -re " +\[0-9\]+ 0010 AB91\[^\n\]*\n" { set x [expr $x+1] } 1009 -re " +\[0-9\]+ 0012 AB21\[^\n\]*\n" { set x [expr $x+1] } 1010 -re " +\[0-9\]+ 0014 AB31\[^\n\]*\n" { set x [expr $x+1] } 1011 -re " +\[0-9\]+ 0016 AB81\[^\n\]*\n" { set x [expr $x+1] } 1012 -re " +\[0-9\]+ 0018 ABF1\[^\n\]*\n" { set x [expr $x+1] } 1013 -re " +\[0-9\]+ 001a AB91\[^\n\]*\n" { set x [expr $x+1] } 1014 -re " +\[0-9\]+ 001c ABE1\[^\n\]*\n" { set x [expr $x+1] } 1015 -re " +\[0-9\]+ 001e ABB1\[^\n\]*\n" { set x [expr $x+1] } 1016 -re " +\[0-9\]+ 0020 ABD1\[^\n\]*\n" { set x [expr $x+1] } 1017 -re " +\[0-9\]+ 0022 AB11\[^\n\]*\n" { set x [expr $x+1] } 1018 -re " +\[0-9\]+ 0024 ABC1\[^\n\]*\n" { set x [expr $x+1] } 1019 timeout { perror "timeout\n"; break } 1020 eof { break } 1021 } 1022 } 1023 1024 # This was intended to do any cleanup necessary. It kinda looks like it 1025 # isn't needed, but just in case, please keep it in for now. 1026 gas_finish 1027 1028 # Did we find what we were looking for? If not, flunk it. 1029 if [expr $x == 19] then { pass $testname } else { fail $testname } 1030} 1031 1032proc do_xc16x_calla {} { 1033 set testname "calla.s: xc16x call tests" 1034 set x 0 1035 1036 gas_start "calla.s" "-al" 1037 1038 # Check each instruction bit pattern to verify it got 1039 # assembled correctly. 1040 while 1 { 1041 expect { 1042 -re " +\[0-9\]+ 0000 CA00AAAA\[^\n\]*\n" { set x [expr $x+1] } 1043 -re " +\[0-9\]+ 0004 CA20AAAA\[^\n\]*\n" { set x [expr $x+1] } 1044 -re " +\[0-9\]+ 0008 CA30AAAA\[^\n\]*\n" { set x [expr $x+1] } 1045 -re " +\[0-9\]+ 000c CA40AAAA\[^\n\]*\n" { set x [expr $x+1] } 1046 -re " +\[0-9\]+ 0010 CA50AAAA\[^\n\]*\n" { set x [expr $x+1] } 1047 -re " +\[0-9\]+ 0014 CA60AAAA\[^\n\]*\n" { set x [expr $x+1] } 1048 -re " +\[0-9\]+ 0018 CA70AAAA\[^\n\]*\n" { set x [expr $x+1] } 1049 -re " +\[0-9\]+ 001c CA80AAAA\[^\n\]*\n" { set x [expr $x+1] } 1050 -re " +\[0-9\]+ 0020 CA90AAAA\[^\n\]*\n" { set x [expr $x+1] } 1051 -re " +\[0-9\]+ 0024 CA20AAAA\[^\n\]*\n" { set x [expr $x+1] } 1052 -re " +\[0-9\]+ 0028 CA30AAAA\[^\n\]*\n" { set x [expr $x+1] } 1053 -re " +\[0-9\]+ 002c CA80AAAA\[^\n\]*\n" { set x [expr $x+1] } 1054 -re " +\[0-9\]+ 0030 CAF0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1055 -re " +\[0-9\]+ 0034 CA90AAAA\[^\n\]*\n" { set x [expr $x+1] } 1056 -re " +\[0-9\]+ 0038 CAE0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1057 -re " +\[0-9\]+ 003c CAB0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1058 -re " +\[0-9\]+ 0040 CAD0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1059 -re " +\[0-9\]+ 0044 CAA0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1060 -re " +\[0-9\]+ 0048 CA10AAAA\[^\n\]*\n" { set x [expr $x+1] } 1061 -re " +\[0-9\]+ 004c CAC0AAAA\[^\n\]*\n" { set x [expr $x+1] } 1062 timeout { perror "timeout\n"; break } 1063 eof { break } 1064 } 1065 } 1066 1067 # This was intended to do any cleanup necessary. It kinda looks like it 1068 # isn't needed, but just in case, please keep it in for now. 1069 gas_finish 1070 1071 # Did we find what we were looking for? If not, flunk it. 1072 if [expr $x == 20] then { pass $testname } else { fail $testname } 1073} 1074 1075 1076proc do_xc16x_bit {} { 1077 set testname "bit.s: xc16x bit manipulation tests" 1078 set x 0 1079 1080 gas_start "bit.s" "-al" 1081 1082 # Check each instruction bit pattern to verify it got 1083 # assembled correctly. 1084 while 1 { 1085 expect { 1086 -re " +\[0-9\]+ 0000 1EF0\[^\n\]*\n" { set x [expr $x+1] } 1087 -re " +\[0-9\]+ 0002 1FF0\[^\n\]*\n" { set x [expr $x+1] } 1088 -re " +\[0-9\]+ 0004 4AF0F012\[^\n\]*\n" { set x [expr $x+1] } 1089 -re " +\[0-9\]+ 0008 3AF0F023\[^\n\]*\n" { set x [expr $x+1] } 1090 -re " +\[0-9\]+ 000c 6AF0F041\[^\n\]*\n" { set x [expr $x+1] } 1091 -re " +\[0-9\]+ 0010 5AF0F021\[^\n\]*\n" { set x [expr $x+1] } 1092 -re " +\[0-9\]+ 0014 7AF0F021\[^\n\]*\n" { set x [expr $x+1] } 1093 -re " +\[0-9\]+ 0018 2AF0F021\[^\n\]*\n" { set x [expr $x+1] } 1094 timeout { perror "timeout\n"; break } 1095 eof { break } 1096 } 1097 } 1098 1099 # This was intended to do any cleanup necessary. It kinda looks like it 1100 # isn't needed, but just in case, please keep it in for now. 1101 gas_finish 1102 1103 # Did we find what we were looking for? If not, flunk it. 1104 if [expr $x == 8] then { pass $testname } else { fail $testname } 1105} 1106 1107proc do_xc16x_bfldl {} { 1108 set testname "bfldl.s: xc16x bitwise modify masked data tests" 1109 set x 0 1110 1111 gas_start "bfldl.s" "-al" 1112 1113 # Check each instruction bit pattern to verify it got 1114 # assembled correctly. 1115 while 1 { 1116 expect { 1117 -re " +\[0-9\]+ 0000 0AF0870E\[^\n\]*\n" { set x [expr $x+1] } 1118 -re " +\[0-9\]+ 0004 1AF00EFF\[^\n\]*\n" { set x [expr $x+1] } 1119 timeout { perror "timeout\n"; break } 1120 eof { break } 1121 } 1122 } 1123 1124 # This was intended to do any cleanup necessary. It kinda looks like it 1125 # isn't needed, but just in case, please keep it in for now. 1126 gas_finish 1127 1128 # Did we find what we were looking for? If not, flunk it. 1129 if [expr $x == 2] then { pass $testname } else { fail $testname } 1130} 1131 1132proc do_xc16x_ret {} { 1133 set testname "ret.s: xc16x ret tests" 1134 set x 0 1135 1136 gas_start "ret.s" "-al" 1137 1138 # Check each instruction bit pattern to verify it got 1139 # assembled correctly. 1140 while 1 { 1141 expect { 1142 -re " +\[0-9\]+ 0000 CB00\[^\n\]*\n" { set x [expr $x+1] } 1143 -re " +\[0-9\]+ 0002 FB88\[^\n\]*\n" { set x [expr $x+1] } 1144 -re " +\[0-9\]+ 0004 DB00\[^\n\]*\n" { set x [expr $x+1] } 1145 -re " +\[0-9\]+ 0006 EBF5\[^\n\]*\n" { set x [expr $x+1] } 1146 timeout { perror "timeout\n"; break } 1147 eof { break } 1148 } 1149 } 1150 1151 # This was intended to do any cleanup necessary. It kinda looks like it 1152 # isn't needed, but just in case, please keep it in for now. 1153 gas_finish 1154 1155 # Did we find what we were looking for? If not, flunk it. 1156 if [expr $x == 4] then { pass $testname } else { fail $testname } 1157} 1158 1159proc do_xc16x_trap {} { 1160 set testname "trap.s: xc16x add/sub tests" 1161 set x 0 1162 1163 gas_start "trap.s" "-al" 1164 1165 # Check each instruction bit pattern to verify it got 1166 # assembled correctly. 1167 while 1 { 1168 expect { 1169 -re " +\[0-9\]+ 0000 9B04\[^\n\]*\n" { set x [expr $x+1] } 1170 timeout { perror "timeout\n"; break } 1171 eof { break } 1172 } 1173 } 1174 1175 # This was intended to do any cleanup necessary. It kinda looks like it 1176 # isn't needed, but just in case, please keep it in for now. 1177 gas_finish 1178 1179 # Did we find what we were looking for? If not, flunk it. 1180 if [expr $x == 1] then { pass $testname } else { fail $testname } 1181} 1182 1183proc do_xc16x_orb {} { 1184 set testname "orb.s: xc16x or byte instructions tests" 1185 set x 0 1186 1187 gas_start "orb.s" "-al" 1188 1189 # Check each instruction bit pattern to verify it got 1190 # assembled correctly. 1191 while 1 { 1192 expect { 1193 -re " +\[0-9\]+ 0000 7102\[^\n\]*\n" { set x [expr $x+1] } 1194 -re " +\[0-9\]+ 0002 7909\[^\n\]*\n" { set x [expr $x+1] } 1195 -re " +\[0-9\]+ 0004 790D\[^\n\]*\n" { set x [expr $x+1] } 1196 -re " +\[0-9\]+ 0006 7903\[^\n\]*\n" { set x [expr $x+1] } 1197 -re " +\[0-9\]+ 0008 77F02300\[^\n\]*\n" { set x [expr $x+1] } 1198 -re " +\[0-9\]+ 000c 73F03402\[^\n\]*\n" { set x [expr $x+1] } 1199 -re " +\[0-9\]+ 0010 75F03402\[^\n\]*\n" { set x [expr $x+1] } 1200 timeout { perror "timeout\n"; break } 1201 eof { break } 1202 } 1203 } 1204 1205 # This was intended to do any cleanup necessary. It kinda looks like it 1206 # isn't needed, but just in case, please keep it in for now. 1207 gas_finish 1208 1209 # Did we find what we were looking for? If not, flunk it. 1210 if [expr $x == 7] then { pass $testname } else { fail $testname } 1211} 1212 1213 1214proc do_xc16x_prior {} { 1215 set testname "prior.s: Determine no shift cycles tests" 1216 set x 0 1217 1218 gas_start "prior.s" "-al" 1219 1220 # Check each instruction bit pattern to verify it got 1221 # assembled correctly. 1222 while 1 { 1223 expect { 1224 -re " +\[0-9\]+ 0000 2B01\[^\n\]*\n" { set x [expr $x+1] } 1225 timeout { perror "timeout\n"; break } 1226 eof { break } 1227 } 1228 } 1229 1230 # This was intended to do any cleanup necessary. It kinda looks like it 1231 # isn't needed, but just in case, please keep it in for now. 1232 gas_finish 1233 1234 # Did we find what we were looking for? If not, flunk it. 1235 if [expr $x == 1] then { pass $testname } else { fail $testname } 1236} 1237 1238proc do_xc16x_nop {} { 1239 set testname "nop.s: no operation nop tests" 1240 set x 0 1241 1242 gas_start "nop.s" "-al" 1243 1244 # Check each instruction bit pattern to verify it got 1245 # assembled correctly. 1246 while 1 { 1247 expect { 1248 -re " +\[0-9\]+ 0000 CC00\[^\n\]*\n" { set x [expr $x+1] } 1249 -re " +\[0-9\]+ 0002 CC00\[^\n\]*\n" { set x [expr $x+1] } 1250 timeout { perror "timeout\n"; break } 1251 eof { break } 1252 } 1253 } 1254 1255 # This was intended to do any cleanup necessary. It kinda looks like it 1256 # isn't needed, but just in case, please keep it in for now. 1257 gas_finish 1258 1259 # Did we find what we were looking for? If not, flunk it. 1260 if [expr $x == 2] then { pass $testname } else { fail $testname } 1261} 1262 1263 1264proc do_xc16x_scxt {} { 1265 set testname "scxt.s: push direct word to system stack tests" 1266 set x 0 1267 1268 gas_start "scxt.s" "-al" 1269 1270 # Check each instruction bit pattern to verify it got 1271 # assembled correctly. 1272 while 1 { 1273 expect { 1274 -re " +\[0-9\]+ 0000 C6F0FFFF\[^\n\]*\n" { set x [expr $x+1] } 1275 -re " +\[0-9\]+ 0004 D6F0FFFF\[^\n\]*\n" { set x [expr $x+1] } 1276 timeout { perror "timeout\n"; break } 1277 eof { break } 1278 } 1279 } 1280 1281 # This was intended to do any cleanup necessary. It kinda looks like it 1282 # isn't needed, but just in case, please keep it in for now. 1283 gas_finish 1284 1285 # Did we find what we were looking for? If not, flunk it. 1286 if [expr $x == 2] then { pass $testname } else { fail $testname } 1287} 1288 1289 1290if [istarget xc16x*-*-*] then { 1291 # Test the basic xc16x instruction parser 1292 do_xc16x_add 1293 do_xc16x_addb 1294 do_xc16x_addc 1295 do_xc16x_addcb 1296 do_xc16x_sub 1297 do_xc16x_subb 1298 do_xc16x_subc 1299 do_xc16x_subcb 1300 do_xc16x_and 1301 do_xc16x_andb 1302 do_xc16x_or 1303 do_xc16x_xor 1304 do_xc16x_xorb 1305 do_xc16x_mov 1306 do_xc16x_movb 1307 do_xc16x_movbs 1308 do_xc16x_movbz 1309 do_xc16x_shlrol 1310 do_xc16x_neg 1311 do_xc16x_mul 1312 do_xc16x_div 1313 do_xc16x_jmpa 1314 do_xc16x_jmpi 1315 do_xc16x_jmpr 1316 do_xc16x_syscontrol1 1317 do_xc16x_syscontrol2 1318 do_xc16x_cpl 1319 do_xc16x_cmp 1320 do_xc16x_cmpb 1321 do_xc16x_cmpi 1322 do_xc16x_calla 1323 do_xc16x_calli 1324 do_xc16x_bit 1325 do_xc16x_bfldl 1326 do_xc16x_ret 1327 do_xc16x_trap 1328 do_xc16x_orb 1329 do_xc16x_prior 1330 do_xc16x_nop 1331 do_xc16x_scxt 1332 1333} 1334