|
|
1.1 ! root 1: #include "fpp_defs.h" ! 2: ! 3: ! 4: /*************************************************************************** ! 5: * ! 6: * MULL2 -MULTIPLY INTEGER 2 INSTRUCTION TEST ! 7: * ! 8: *****************************************************************************/ ! 9: mull2() ! 10: { ! 11: asm(".globl _mull2_t"); ! 12: asm("_mull2_t:"); /* entry address */ ! 13: if( (cycle == 1) && (prt_hdrs) ) /* print headers on 1st cycle */ ! 14: { ! 15: writes(" MULL2"); ! 16: } ! 17: mull2_1(); /* register data / SGL acc. */ ! 18: mull2_2(); /* memory data / DBL acc. */ ! 19: mull2_3(); /* register corruption test */ ! 20: mull2_4(); /* PSL corruption test */ ! 21: mull2_5(); /* pipelined entry test */ ! 22: mull2_6(); /* pipelined exit test */ ! 23: asm("jmp *return"); /* return to the test monitor */ ! 24: } ! 25: ! 26: ! 27: ! 28: /************************************************************************ ! 29: * ! 30: * SUBTEST 1 - register addressing / single precsion accumulator ! 31: * ! 32: ************************************************************************/ ! 33: mull2_1() ! 34: { ! 35: force_loop = FALSE; ! 36: subtest = 1; ! 37: for( index = 0; index < max_mull_1_index; index++ ) { ! 38: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 39: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 40: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 41: sgl_ld_acc = 0x12345678; /* set acc data pattern */ ! 42: sgl_expected = sgl_ld_acc; /* final Acc expected */ ! 43: /* ! 44: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 45: */ ! 46: asm("_mull2_1_lp1:"); ! 47: asm("movl _sgl_value_1,r3"); /* move the 1st data to r3 */ ! 48: asm("movl _sgl_value_2,r4"); /* move the 2nd data to r4 */ ! 49: asm("movl _sgl_ld_acc,r5"); /* move the acc data to r5 */ ! 50: asm("ldf r5"); /* load the acc */ ! 51: asm("mull2 r3,r4"); /* do the multiply */ ! 52: asm("nop"); ! 53: asm("stf _sgl_st_acc"); /* save the acc */ ! 54: if( force_loop ) ! 55: asm("brb _mull2_1_lp1");; ! 56: asm("movl r4,_sgl_value_3"); ! 57: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */ ! 58: errcnt++; /* bump the error count */ ! 59: if ( prt_error ) { ! 60: print_mull2_error("(Reg. Data) -THE ACC WAS MODIFIED"); ! 61: writes("initial Acc = "); ! 62: write32h( sgl_ld_acc ); ! 63: writes(", final Acc = "); ! 64: write32h( sgl_st_acc ); ! 65: writes("\n expected Acc = "); ! 66: write32h( sgl_expected ); ! 67: writec('\n'); ! 68: } ! 69: if ( halt_flg ) /* halt on error? */ ! 70: mull2_halt( 4 ); ! 71: if ( loop_on_err ) { ! 72: force_loop = TRUE; /* set the force loop flag */ ! 73: asm("jmp _mull2_1_lp1"); /* and loop */ ! 74: } /* end of loop-on-error */ ! 75: } /* end of acc corr error */ ! 76: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */ ! 77: { ! 78: errcnt++; /* bump the error count */ ! 79: if ( prt_error ) { ! 80: print_mull2_error("(Reg. Data) -BAD MULTIPLY RESULT"); ! 81: } ! 82: if ( halt_flg ) /* halt on error? */ ! 83: mull2_halt( 1 ); ! 84: if ( loop_on_err ) { ! 85: force_loop = TRUE; /* set the force loop flag */ ! 86: asm("jmp _mull2_1_lp1"); /* and loop */ ! 87: } /* end of loop-on-error */ ! 88: } /* end of multiply error */ ! 89: } ! 90: } /* end of subtest 1 */ ! 91: ! 92: ! 93: ! 94: /************************************************************************ ! 95: * ! 96: * SUBTEST 2 - cache addressing / double precsion accumulator ! 97: * ! 98: ************************************************************************/ ! 99: mull2_2() ! 100: { ! 101: force_loop = FALSE; ! 102: subtest = 2; ! 103: for( index = 0; index < max_mull_1_index; index++ ) { ! 104: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 105: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 106: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 107: dbl_ld_acc.m = 0x12345678; /* set acc data pattern */ ! 108: dbl_ld_acc.l = 0x9abcdef0; ! 109: dbl_expected.m = dbl_ld_acc.m; /* final Acc expected */ ! 110: dbl_expected.l = dbl_ld_acc.l; ! 111: /* ! 112: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 113: */ ! 114: asm("_mull2_2_lp1:"); ! 115: sgl_value_3 = sgl_value_2; /* set initial op 2 data */ ! 116: asm("ldd _dbl_ld_acc"); /* load the acc */ ! 117: asm("mull2 _sgl_value_1,_sgl_value_3"); /* multiply the integers */ ! 118: asm("nop"); ! 119: asm("std _dbl_st_acc"); /* save the acc */ ! 120: if( force_loop ) ! 121: asm("brb _mull2_2_lp1");; ! 122: if( (dbl_expected.m != dbl_st_acc.m) || /* COMPARE the Acc */ ! 123: (dbl_expected.l != dbl_st_acc.l) ) { ! 124: errcnt++; /* bump the error count */ ! 125: if ( prt_error ) { ! 126: print_mull2_error("(Memory data) -THE ACC WAS MODIFIED"); ! 127: writes("initial Acc = "); ! 128: write32h( dbl_ld_acc.m ); ! 129: writec(' '); ! 130: write32h( dbl_ld_acc.l ); ! 131: writes(", final Acc = "); ! 132: write32h( dbl_st_acc.m ); ! 133: writec(' '); ! 134: write32h( dbl_st_acc.l ); ! 135: writes("\n expected Acc = "); ! 136: write32h( dbl_expected.m ); ! 137: writec(' '); ! 138: write32h( dbl_expected.l ); ! 139: writec('\n'); ! 140: } ! 141: if ( halt_flg ) /* halt on error? */ ! 142: mull2_halt( 4 ); ! 143: if ( loop_on_err ) { ! 144: force_loop = TRUE; /* set the force loop flag */ ! 145: asm("jmp _mull2_2_lp1"); /* and loop */ ! 146: } /* end of loop-on-error */ ! 147: } /* end of acc corr error */ ! 148: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */ ! 149: { ! 150: errcnt++; /* bump the error count */ ! 151: if ( prt_error ) { ! 152: print_mull2_error("(Memory data) -BAD MULTIPLY RESULT"); ! 153: } ! 154: if ( halt_flg ) /* halt on error? */ ! 155: mull2_halt( 1 ); ! 156: if ( loop_on_err ) { ! 157: force_loop = TRUE; /* set the force loop flag */ ! 158: asm("jmp _mull2_2_lp1"); /* and loop */ ! 159: } /* end of loop-on-error */ ! 160: } /* end of multiply error */ ! 161: } ! 162: } /* end of subtest 2 */ ! 163: ! 164: ! 165: ! 166: /************************************************************************ ! 167: * ! 168: * SUBTEST 3 - register corruption test ! 169: * ! 170: ************************************************************************/ ! 171: mull2_3() ! 172: { ! 173: force_loop = FALSE; ! 174: subtest = 3; ! 175: fill_reg_buf( load_regs ); /* get pattern for registers */ ! 176: for( index = 0; index < max_mull_1_index; index++ ) { ! 177: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 178: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 179: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 180: /* ! 181: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 182: */ ! 183: asm("_mull2_3_lp1:"); ! 184: sgl_value_3 = sgl_value_2; /* set operand 2 */ ! 185: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */ ! 186: asm("mull2 _sgl_value_1,_sgl_value_3");/* do the multiply */ ! 187: asm("nop"); ! 188: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */ ! 189: if( force_loop ) ! 190: asm("brb _mull2_3_lp1"); ! 191: /* ! 192: * Now check the result ! 193: */ ! 194: index2 = 0; ! 195: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) ) ! 196: index2++; /* check reg values */ ! 197: if( index2 < 13 ) { /* error if index2 < 13 */ ! 198: errcnt++; /* bump the error count */ ! 199: if ( prt_error ) { ! 200: print_mull2_error(" -A REGISTER WAS MODIFIED"); ! 201: writes("register "); ! 202: writeh( index2 ); ! 203: writes(" = "); ! 204: write32h( store_regs[index2] ); ! 205: writes(", should be = "); ! 206: write32h( load_regs[index2] ); ! 207: writec('\n'); ! 208: } ! 209: if ( halt_flg ) /* halt on error? */ ! 210: mull2_halt( 2 ); ! 211: if ( loop_on_err ) { ! 212: force_loop = TRUE; /* set the force loop flag */ ! 213: asm("jmp _mull2_3_lp1"); /* and loop */ ! 214: }; /* end of loop-on-error */ ! 215: } /* end of multiply error */ ! 216: } ! 217: } /* end of subtest 3 */ ! 218: ! 219: ! 220: ! 221: /************************************************************************ ! 222: * ! 223: * SUBTEST 4 - PSL corruption test ! 224: * ! 225: ************************************************************************/ ! 226: mull2_4() ! 227: { ! 228: force_loop = FALSE; ! 229: subtest = 4; ! 230: status_index = 0; ! 231: for( index = 0; index < max_mull_1_index; index++ ) { ! 232: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 233: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 234: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 235: sgl_dummy1 = status_array[status_index]; /* status = +, -, 0 */ ! 236: /* ! 237: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 238: */ ! 239: asm("_mull2_4_lp1:"); ! 240: sgl_value_3 = sgl_value_2; /* set operand 2 */ ! 241: asm("tstl _sgl_dummy1"); ! 242: asm("movpsl _init_psl"); /* save the initial PSL */ ! 243: asm("mull2 _sgl_value_1,_sgl_value_3");/* do the multiply */ ! 244: asm("movpsl _psl_val"); /* save the final PSL */ ! 245: if( force_loop ) ! 246: asm("brb _mull2_4_lp1"); ! 247: /* ! 248: * Now check the result ! 249: */ ! 250: exp_psl = init_psl & 0xffffff3; /* strip off the PSL status */ ! 251: if( sgl_value_4 < 0 ) /* check the MULL result */ ! 252: exp_psl |= PSL_N; /* set the NEGATIVE bit */ ! 253: if( !sgl_value_4 ) ! 254: exp_psl |= PSL_Z; /* set the ZERO bit */ ! 255: if( psl_val != exp_psl ) { /* was the final PSL correct */ ! 256: errcnt++; /* bump the error count */ ! 257: if ( prt_error ) { ! 258: print_mull2_error(" -INCORRECT FINAL PSL"); ! 259: writes("initial PSL = "); ! 260: write32h( init_psl ); ! 261: writes(", final PSL = "); ! 262: write32h( psl_val ); ! 263: writes(", expected PSL = "); ! 264: write32h( exp_psl ); ! 265: writec('\n'); ! 266: } ! 267: if ( halt_flg ) /* halt on error? */ ! 268: mull2_halt( 3 ); ! 269: if ( loop_on_err ) { ! 270: force_loop = TRUE; /* set the force loop flag */ ! 271: asm("jmp _mull2_4_lp1"); /* and loop */ ! 272: }; /* end of loop-on-error */ ! 273: }; /* end of error */ ! 274: if( ++status_index >= 3 ) ! 275: status_index = 0; ! 276: } ! 277: } /* end of subtest 4 */ ! 278: ! 279: ! 280: ! 281: /************************************************************************ ! 282: * ! 283: * SUBTEST 5 - Pipelined Entry test ! 284: * ! 285: ************************************************************************/ ! 286: mull2_5() ! 287: { ! 288: force_loop = FALSE; ! 289: subtest = 5; ! 290: for( index = 0; index < max_mull_1_index; index++ ) { ! 291: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 292: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 293: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 294: sgl_ld_acc = 0x12345678; /* set acc data pattern */ ! 295: sgl_expected = sgl_ld_acc; /* final Acc expected */ ! 296: sgl_value_10 = 0x40800000; /* floating "1.0" */ ! 297: /* ! 298: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 299: */ ! 300: asm("_mull2_5_lp1:"); ! 301: sgl_value_3 = sgl_value_2; /* set integer operand 2 */ ! 302: asm("ldf _sgl_ld_acc"); /* load the acc */ ! 303: asm("mulf _sgl_value_10"); /* do a floating multiply */ ! 304: asm("mull2 _sgl_value_1,_sgl_value_3"); /* do the int. multiply */ ! 305: asm("nop"); ! 306: asm("stf _sgl_st_acc"); /* save the acc */ ! 307: if( force_loop ) ! 308: asm("brb _mull2_5_lp1");; ! 309: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */ ! 310: errcnt++; /* bump the error count */ ! 311: if ( prt_error ) { ! 312: print_mull2_error("(Piped Entry) -BAD FINAL ACC"); ! 313: writes("initial Acc = "); ! 314: write32h( sgl_ld_acc ); ! 315: writes(", final Acc = "); ! 316: write32h( sgl_st_acc ); ! 317: writes("\nFPP operand = "); ! 318: write32h( sgl_value_10 ); ! 319: writes(", expected Acc = "); ! 320: write32h( sgl_expected ); ! 321: writec('\n'); ! 322: } ! 323: if ( halt_flg ) /* halt on error? */ ! 324: mull2_halt( 5 ); ! 325: if ( loop_on_err ) { ! 326: force_loop = TRUE; /* set the force loop flag */ ! 327: asm("jmp _mull2_5_lp1"); /* and loop */ ! 328: } /* end of loop-on-error */ ! 329: } /* end of acc corr error */ ! 330: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */ ! 331: { ! 332: errcnt++; /* bump the error count */ ! 333: if ( prt_error ) { ! 334: print_mull2_error("(Piped Entry) -BAD MULTIPLY RESULT"); ! 335: } ! 336: if ( halt_flg ) /* halt on error? */ ! 337: mull2_halt( 1 ); ! 338: if ( loop_on_err ) { ! 339: force_loop = TRUE; /* set the force loop flag */ ! 340: asm("jmp _mull2_5_lp1"); /* and loop */ ! 341: } /* end of loop-on-error */ ! 342: } /* end of multiply error */ ! 343: } ! 344: } /* end of subtest 5 */ ! 345: ! 346: ! 347: ! 348: /************************************************************************ ! 349: * ! 350: * SUBTEST 6 - Pipelined Exit test ! 351: * ! 352: ************************************************************************/ ! 353: mull2_6() ! 354: { ! 355: force_loop = FALSE; ! 356: subtest = 6; ! 357: for( index = 0; index < max_mull_1_index; index++ ) { ! 358: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */ ! 359: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */ ! 360: sgl_value_4 = mull_1_data[index].exp; /* get expected results */ ! 361: sgl_ld_acc = 0x40800000; /* floating "1.0" */ ! 362: sgl_value_10 = 0x12345678; /* set acc data pattern */ ! 363: sgl_expected = sgl_value_10; /* final Acc expected */ ! 364: /* ! 365: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 366: */ ! 367: asm("_mull2_6_lp1:"); ! 368: sgl_value_3 = sgl_value_2; /* set integer operand 2 */ ! 369: asm("ldf _sgl_ld_acc"); /* load the acc */ ! 370: asm("mull2 _sgl_value_1,_sgl_value_3"); /* do the int. multiply */ ! 371: asm("mulf _sgl_value_10"); /* do a floating multiply */ ! 372: asm("stf _sgl_st_acc"); /* save the acc */ ! 373: if( force_loop ) ! 374: asm("brb _mull2_6_lp1");; ! 375: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */ ! 376: errcnt++; /* bump the error count */ ! 377: if ( prt_error ) { ! 378: print_mull2_error("(Piped Exit) -BAD FINAL ACC"); ! 379: writes("initial Acc = "); ! 380: write32h( sgl_ld_acc ); ! 381: writes(", final Acc = "); ! 382: write32h( sgl_st_acc ); ! 383: writes("\nFPP operand = "); ! 384: write32h( sgl_value_10 ); ! 385: writes(", expected Acc = "); ! 386: write32h( sgl_expected ); ! 387: writec('\n'); ! 388: } ! 389: if ( halt_flg ) /* halt on error? */ ! 390: mull2_halt( 5 ); ! 391: if ( loop_on_err ) { ! 392: force_loop = TRUE; /* set the force loop flag */ ! 393: asm("jmp _mull2_6_lp1"); /* and loop */ ! 394: } /* end of loop-on-error */ ! 395: } /* end of acc corr error */ ! 396: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */ ! 397: { ! 398: errcnt++; /* bump the error count */ ! 399: if ( prt_error ) { ! 400: print_mull2_error("(Piped Exit) -BAD MULTIPLY RESULT"); ! 401: } ! 402: if ( halt_flg ) /* halt on error? */ ! 403: mull2_halt( 1 ); ! 404: if ( loop_on_err ) { ! 405: force_loop = TRUE; /* set the force loop flag */ ! 406: asm("jmp _mull2_6_lp1"); /* and loop */ ! 407: } /* end of loop-on-error */ ! 408: } /* end of multiply error */ ! 409: } ! 410: } /* end of subtest 6 */ ! 411: ! 412: ! 413: ! 414: /***************************************************************************** ! 415: * ! 416: * Print an error message of the form: ! 417: * ! 418: * cycle: xx MULL2 test xx, subtest xx <"your message here"> ! 419: * operand 1 = xxxxxxxx, result = xxxxxxxx, data index = xx ! 420: * operand 2 = xxxxxxxx, expected = xxxxxxxx ! 421: * ! 422: *****************************************************************************/ ! 423: print_mull2_error(msg) ! 424: char *msg; /* addressing mode msg */ ! 425: { ! 426: writes(" \n"); /* start a new print line */ ! 427: writes("cycle: "); ! 428: writed( cycle ); ! 429: writes(" MULL2 test "); ! 430: writed( test_no ); ! 431: writes(", subtest "); ! 432: writed( subtest ); ! 433: writes(" "); ! 434: writes( msg ); ! 435: writes("\n operand 1 = "); ! 436: write32h( sgl_value_1 ); ! 437: writes(", result = "); ! 438: write32h( sgl_value_3 ); ! 439: writes(", data index = "); ! 440: writed( index ); ! 441: writes("\n operand 2 = "); ! 442: write32h( sgl_value_2 ); ! 443: writes(", expected = "); ! 444: write32h( sgl_value_4 ); ! 445: writec('\n'); ! 446: } ! 447: ! 448: ! 449: ! 450: /*************************************************************************** ! 451: * ! 452: * HALT ON AN ERROR ! 453: * ! 454: ***************************************************************************/ ! 455: mull2_halt( code ) ! 456: int code; /* error code to use */ ! 457: { ! 458: sgl_dummy1 = code; /* save the error code */ ! 459: asm("movl _test_no,r0"); /* r0 = test number */ ! 460: asm("movl _subtest,r1"); /* r1 = subtest number */ ! 461: asm("movl _sgl_dummy1,r2"); /* r2 = error code */ ! 462: asm("movl _cycle,r3"); /* r3 = cycle count */ ! 463: asm("movl _sgl_value_1,r4"); /* r4 = operand 1 */ ! 464: asm("movl _sgl_value_2,r5"); /* r5 = operand 2 */ ! 465: asm("movl _sgl_value_3,r6"); /* r6 = MULL2's result */ ! 466: if( code == 1 ) { ! 467: asm("movl _sgl_value_4,r7"); /* r7 = expected result */ ! 468: asm("movl _index,r8");; /* r8 = data index */ ! 469: } ! 470: else if( code == 2 ) { /* corrupted register */ ! 471: sgl_dummy1 = store_regs[index2]; /* get the actual reg data */ ! 472: sgl_dummy2 = load_regs[index2]; /* get the data expected */ ! 473: asm("movl _index2,r7"); /* r7 = register number */ ! 474: asm("movl _sgl_dummy1,r8"); /* r8 = final reg value */ ! 475: asm("movl _sgl_dummy2,r9"); /* r9 = expected value */ ! 476: } ! 477: else if( code == 3 ) { /* corrupted PSL */ ! 478: asm("movl _init_psl,r7"); /* r7 = initial PSL */ ! 479: asm("movl _psl_val,r8"); /* r8 = final PSL */ ! 480: asm("movl _exp_psl,r9"); /* r9 = expected PSL */ ! 481: } ! 482: else if( code == 4 ) { /* corrupted Acc */ ! 483: if( subtest == 1 ) { /* single precision */ ! 484: dbl_ld_acc.m = sgl_ld_acc; ! 485: dbl_ld_acc.l = 0; ! 486: dbl_st_acc.m = sgl_st_acc; ! 487: dbl_st_acc.l = 0; ! 488: dbl_expected.m = sgl_expected; ! 489: dbl_expected.l = 0; ! 490: }; ! 491: asm("movl _index,r7"); /* r7 = data index */ ! 492: asm("movl _dbl_ld_acc,r8"); /* r8 = MS initial Acc. */ ! 493: asm("movl _dbl_ld_acc+4,r9"); /* r9 = LS initial Acc. */ ! 494: asm("movl _dbl_st_acc,r10"); /* r10 = MS final Acc. */ ! 495: asm("movl _dbl_st_acc+4,r11"); /* r11 = LS final Acc. */ ! 496: asm("movl _dbl_expected,r12"); /* r12 = MS expected Acc. */ ! 497: asm("movl _dbl_expected+4,r13"); /* r13 = LS expected Acc. */ ! 498: } ! 499: else if( code == 5 ) { /* bad final Acc */ ! 500: asm("movl _index,r7"); /* r7 = data index */ ! 501: asm("movl _sgl_ld_acc,r8"); /* r8 = initial Acc. */ ! 502: asm("movl _sgl_value_10,r9"); /* r9 = fpp operand */ ! 503: asm("movl _sgl_st_acc,r10"); /* r10 = final Acc. */ ! 504: asm("movl _sgl_expected,r11"); /* r11 = expected Acc. */ ! 505: }; ! 506: asm("halt"); /* HALT ... */ ! 507: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.