|
|
1.1 ! root 1: #include "fpp_defs.h" ! 2: ! 3: ! 4: ! 5: /*************************************************************************** ! 6: * ! 7: * CMPF -COMPARE SGL ACCUMULATOR TO SGL OPERAND ! 8: * ! 9: *****************************************************************************/ ! 10: cmpf() ! 11: { ! 12: asm(".globl _cmpf_t"); ! 13: asm("_cmpf_t:"); /* entry address */ ! 14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */ ! 15: { ! 16: writes(" CMPF"); ! 17: } ! 18: cmpf_1(); /* test via registers */ ! 19: cmpf_2(); /* test via cache */ ! 20: cmpf_3(); /* register corruption test */ ! 21: cmpf_4(); /* acc. corruption test */ ! 22: if( !no_fpp_wcs ) { ! 23: cmpf_5(); /* pipelined entry test */ ! 24: cmpf_6(); /* pipelined exit test */ ! 25: }; ! 26: asm("jmp *return"); /* return to the test monitor */ ! 27: } ! 28: ! 29: ! 30: ! 31: /**************************************************************************** ! 32: * ! 33: * SUBTEST 1 - CMPF status test -register data ! 34: * ! 35: ****************************************************************************/ ! 36: cmpf_1() ! 37: { ! 38: force_loop = FALSE; ! 39: subtest = 1; ! 40: index = 0; ! 41: do ! 42: { ! 43: sgl_value_1 = cmpf_1_data[index].one; /* get the data operands */ ! 44: sgl_value_2 = cmpf_1_data[index].two; ! 45: sgl_expected = cmpf_1_data[index].flag; /* get expected results */ ! 46: status_index = 0; /* clear the status index */ ! 47: do ! 48: { ! 49: sgl_dummy1 = status_array[status_index]; /* array = +, -, 0 */ ! 50: /* ! 51: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 52: * The force loop flag is set after the first error. ! 53: */ ! 54: asm("_cmpf_1_lp1:"); ! 55: asm("movl _sgl_value_1,r4"); /* move operand #1 to r4 */ ! 56: asm("movl _sgl_value_2,r5"); /* move operand #2 to r5 */ ! 57: asm("ldf r4"); /* load the 1st operand */ ! 58: asm("tstl _sgl_dummy1"); /* generate initial status */ ! 59: asm("movpsl _init_psl"); /* save the initial status */ ! 60: asm("cmpf r5"); /* compare the operands */ ! 61: asm("movpsl _psl_val"); /* save the final status */ ! 62: asm("stf _sgl_st_acc"); /* save the final acc */ ! 63: if( force_loop ) /* loop? */ ! 64: asm("brb _cmpf_1_lp1");; /* run the loop again */ ! 65: exp_psl = init_psl; /* get the initial PSL */ ! 66: exp_psl &= 0xfffffff3; /* clear ZERO, NEGATIVE */ ! 67: if( sgl_expected == ZERO ) ! 68: exp_psl |= PSL_Z; /* expect the ZERO bit set */ ! 69: if( sgl_expected == NEGATIVE ) ! 70: exp_psl |= PSL_N; /* expect the NEG bit set */ ! 71: if( psl_val != exp_psl ) { /* COMPARE the values */ ! 72: errcnt++; /* bump the error count */ ! 73: if ( prt_error ) { ! 74: writes(" \n"); /* start a new print line */ ! 75: writes("cycle: "); ! 76: writed( cycle ); ! 77: writes(" CMPF test "); ! 78: writed( test_no ); ! 79: writes(", subtest 1 (Reg. Data) - BAD FINAL PSL\n"); ! 80: print_cmpf_data(); ! 81: writes(", data index = "); ! 82: writed( index ); ! 83: writec('\n'); ! 84: writes("initial PSL = "); ! 85: write32h( init_psl ); ! 86: writes(", final PSL = "); ! 87: write32h( psl_val ); ! 88: writes(", expected PSL = "); ! 89: write32h( exp_psl ); ! 90: writes("\n"); ! 91: } ! 92: if ( halt_flg ) ! 93: cmpf_er_halt( BAD_PSL_HLT ); /* halt on the error */ ! 94: if ( loop_on_err ) { ! 95: force_loop = TRUE; /* set the force loop flag */ ! 96: asm("brw _cmpf_1_lp1"); /* and loop on the error */ ! 97: } /* end of loop on error */ ! 98: } /* end of compare error */ ! 99: } while ( ++status_index < 3 ); /* end of PSL WHILE loop */ ! 100: } while( index++ < max_cmpf_1_index);/* end of data loop */ ! 101: } /* end of subtest 1 */ ! 102: ! 103: ! 104: ! 105: /**************************************************************************** ! 106: * ! 107: * SUBTEST 2 - CMPF status test -cache data ! 108: * ! 109: ****************************************************************************/ ! 110: cmpf_2() ! 111: { ! 112: force_loop = FALSE; ! 113: subtest = 2; ! 114: index = 0; ! 115: do ! 116: { ! 117: sgl_value_1 = cmpf_1_data[index].one; /* get the data operands */ ! 118: sgl_value_2 = cmpf_1_data[index].two; ! 119: sgl_expected = cmpf_1_data[index].flag;/* get expected results */ ! 120: status_index = 0; /* clear the status index */ ! 121: do ! 122: { ! 123: sgl_dummy1 = status_array[status_index]; /* array = +, -, 0 */ ! 124: /* ! 125: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 126: * The force loop flag is set after the first error. ! 127: */ ! 128: asm("_cmpf_2_lp1:"); ! 129: asm("ldf _sgl_value_1"); /* load the 1st operand */ ! 130: asm("tstl _sgl_dummy1"); /* generate initial status */ ! 131: asm("movpsl _init_psl"); /* save the initial status */ ! 132: asm("cmpf _sgl_value_2"); /* compare the operands */ ! 133: asm("movpsl _psl_val"); /* save the final status */ ! 134: asm("stf _sgl_st_acc"); /* save the final acc */ ! 135: if( force_loop ) /* loop? */ ! 136: asm("brb _cmpf_2_lp1");; /* run the loop again */ ! 137: exp_psl = init_psl; /* get the initial PSL */ ! 138: exp_psl &= 0xfffffff3; /* clear ZERO, NEGATIVE */ ! 139: if( sgl_expected == ZERO ) ! 140: exp_psl |= PSL_Z; /* expect the ZERO bit set */ ! 141: if( sgl_expected == NEGATIVE ) ! 142: exp_psl |= PSL_N; /* expect the NEG bit set */ ! 143: if( psl_val != exp_psl ) { /* COMPARE the values */ ! 144: errcnt++; /* bump the error count */ ! 145: if ( prt_error ) { ! 146: writes(" \n"); /* start a new print line */ ! 147: writes("cycle: "); ! 148: writed( cycle ); ! 149: writes(" CMPF test "); ! 150: writed( test_no ); ! 151: writes(", subtest 2 (Cache Data) - BAD FINAL PSL\n"); ! 152: print_cmpf_data(); ! 153: writes(", data index = "); ! 154: writed( index ); ! 155: writec('\n'); ! 156: writes("initial PSL = "); ! 157: write32h( init_psl ); ! 158: writes(", final PSL = "); ! 159: write32h( psl_val ); ! 160: writes(", expected PSL = "); ! 161: write32h( exp_psl ); ! 162: writes("\n"); ! 163: } ! 164: if ( halt_flg ) ! 165: cmpf_er_halt( BAD_PSL_HLT ); /* halt on the error */ ! 166: if ( loop_on_err ) { ! 167: force_loop = TRUE; /* set the force loop flag */ ! 168: asm("brw _cmpf_2_lp1"); /* and loop on the error */ ! 169: } /* end of loop on error */ ! 170: } /* end of compare error */ ! 171: } while ( ++status_index < 3 ); /* end of PSL WHILE loop */ ! 172: } while( index++ < max_cmpf_1_index);/* end of data loop */ ! 173: } /* end of subtest 2 */ ! 174: ! 175: ! 176: ! 177: /************************************************************************ ! 178: * ! 179: * SUBTEST 3 - Check for register corruption ! 180: * ! 181: ************************************************************************/ ! 182: cmpf_3() ! 183: { ! 184: force_loop = FALSE; /* clear force_loop flg */ ! 185: subtest = 3; ! 186: fill_reg_buf( load_regs ); /* get pattern for regs */ ! 187: index = 0; ! 188: do ! 189: { ! 190: sgl_value_1 = cmpf_1_data[index].one; /* data to load */ ! 191: sgl_value_2 = cmpf_1_data[index].two; /* data to compare */ ! 192: /* ! 193: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 194: * The force loop flag is set after the first error. ! 195: */ ! 196: asm("_cmpf_3_lp1:"); ! 197: asm("ldf _sgl_value_1"); /* LOAD the accumulator */ ! 198: asm("nop"); ! 199: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */ ! 200: asm("nop"); ! 201: asm("cmpf _sgl_value_2"); /* test the values */ ! 202: asm("nop"); ! 203: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */ ! 204: asm("stf _sgl_st_acc"); /* save the final acc */ ! 205: if( force_loop ) /* loop? */ ! 206: asm("brb _cmpf_3_lp1");; /* run the loop again */ ! 207: /* ! 208: * Now compare the stored register values to those that were loaded ! 209: */ ! 210: index2 = 0; ! 211: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) ) ! 212: index2++; /* check reg values */ ! 213: if( index2 < 13 ) { /* error if index2 < 13 */ ! 214: errcnt++; /* bump the error count */ ! 215: if ( prt_error ) { ! 216: writes(" \n"); /* start a new print line */ ! 217: writes("cycle: "); ! 218: writed( cycle ); ! 219: writes(", CMPF test "); ! 220: writed( test_no ); ! 221: writes(", subtest 3 - A REGISTER WAS MODIFIED\n"); ! 222: print_cmpf_data(); /* print the operands */ ! 223: writes("\n"); ! 224: writes("register "); /* print the information */ ! 225: writed( index2 ); /* about the corrupted */ ! 226: writes(" = "); /* register */ ! 227: write32h( store_regs[index2] ); ! 228: writes(", should be = "); ! 229: write32h( load_regs[index2] ); ! 230: writes("\n"); ! 231: } ! 232: if ( halt_flg ) /* halt on error? */ ! 233: cmpf_er_halt( BAD_REG_HLT ); /* PC after the halt */ ! 234: if ( loop_on_err ) { ! 235: force_loop = TRUE; /* set the force loop flag */ ! 236: asm("brw _cmpf_3_lp1"); /* and loop on the error */ ! 237: } /* end of loop on error */ ! 238: } /* end of register corruption error */ ! 239: } while( index++ < max_cmpf_1_index);/* end of data loop */ ! 240: } /* end of subtest 3 */ ! 241: ! 242: ! 243: ! 244: /************************************************************************ ! 245: * ! 246: * SUBTEST 4 - Check for accumulator corruption ! 247: * ! 248: ************************************************************************/ ! 249: cmpf_4() ! 250: { ! 251: force_loop = FALSE; /* clear force_loop flg */ ! 252: index = 0; ! 253: do ! 254: { ! 255: sgl_value_1 = cmpf_1_data[index].one; /* data to load */ ! 256: sgl_value_2 = cmpf_1_data[index].two; ! 257: if( sgl_value_1 & 0x7f800000 ) ! 258: sgl_expected = sgl_value_1; /* expected = loaded */ ! 259: else ! 260: sgl_expected = 0; /* expect a '0' stored */ ! 261: /* ! 262: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 263: * The force loop flag is set after the first error. ! 264: */ ! 265: asm("_cmpf_4_lp1:"); ! 266: asm("ldf _sgl_value_1"); /* LOAD the accumulator */ ! 267: asm("cmpf _sgl_value_2"); /* test the values */ ! 268: asm("stf _sgl_st_acc"); /* store the accumulator */ ! 269: if( force_loop ) /* loop? */ ! 270: asm("brb _cmpf_4_lp1");; /* run the loop again */ ! 271: if( sgl_st_acc != sgl_expected ) /* COMPARE the values */ ! 272: { ! 273: errcnt++; /* bump the error count */ ! 274: if ( prt_error ) { ! 275: writes(" \n"); /* start a new print line */ ! 276: writes("cycle: "); ! 277: writed( cycle ); ! 278: writes(" CMPF test "); ! 279: writed( test_no ); ! 280: writes(", subtest 4 (Cache Data) - THE ACC WAS MODIFIED\n"); ! 281: print_cmpf_data(); ! 282: writes(", data index = "); ! 283: writed( index ); ! 284: writec('\n'); ! 285: writes(" final Acc = "); ! 286: write32h( sgl_st_acc ); ! 287: writes(", Acc expected = "); ! 288: write32h( sgl_expected ); ! 289: writec('\n'); ! 290: } ! 291: if ( halt_flg ) /* halt on error? */ ! 292: cmpf_er_halt( BAD_ACC_HLT ); /* halt on the error */ ! 293: if ( loop_on_err ) { ! 294: force_loop = TRUE; /* set the force loop flag */ ! 295: asm("brw _cmpf_4_lp1"); /* and loop on the error */ ! 296: } /* end of loop on error */ ! 297: } /* end of compare error */ ! 298: } while( index++ < max_cmpf_1_index);/* end of data loop */ ! 299: } /* end of subtest 4 */ ! 300: ! 301: ! 302: ! 303: /**************************************************************************** ! 304: * ! 305: * SUBTEST 5 - CMPF status test - piped entry ! 306: * ! 307: ****************************************************************************/ ! 308: cmpf_5() ! 309: { ! 310: force_loop = FALSE; ! 311: subtest = 5; ! 312: index = 0; ! 313: do ! 314: { ! 315: sgl_value_1 = cmpf_1_data[index].one; /* get the data operands */ ! 316: sgl_value_2 = cmpf_1_data[index].two; ! 317: sgl_expected = cmpf_1_data[index].flag;/* get expected results */ ! 318: status_index = 0; /* clear the status index */ ! 319: do ! 320: { ! 321: sgl_dummy1 = status_array[status_index]; /* array = +, -, 0 */ ! 322: /* ! 323: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 324: * The force loop flag is set after the first error. ! 325: */ ! 326: asm("_cmpf_5_lp1:"); ! 327: asm("movl $0,r0"); /* clear r0 */ ! 328: asm("ldf r0"); /* load the accumulator */ ! 329: asm("addf _sgl_value_1"); /* add the 1st operand */ ! 330: asm("tstl _sgl_dummy1"); /* generate initial status */ ! 331: asm("movpsl _init_psl"); /* save the initial status */ ! 332: asm("cmpf _sgl_value_2"); /* compare the operands */ ! 333: asm("movpsl _psl_val"); /* save the final status */ ! 334: asm("stf _sgl_st_acc"); /* save the final acc */ ! 335: if( force_loop ) /* loop? */ ! 336: asm("brb _cmpf_5_lp1");; /* run the loop again */ ! 337: exp_psl = init_psl; /* get the initial PSL */ ! 338: exp_psl &= 0xfffffff3; /* clear ZERO, NEGATIVE */ ! 339: if( sgl_expected == ZERO ) ! 340: exp_psl |= PSL_Z; /* expect the ZERO bit set */ ! 341: if( sgl_expected == NEGATIVE ) ! 342: exp_psl |= PSL_N; /* expect the NEG bit set */ ! 343: if( psl_val != exp_psl ) { /* COMPARE the values */ ! 344: errcnt++; /* bump the error count */ ! 345: if ( prt_error ) { ! 346: writes(" \n"); /* start a new print line */ ! 347: writes("cycle: "); ! 348: writed( cycle ); ! 349: writes(" CMPF test "); ! 350: writed( test_no ); ! 351: writes(", subtest 5 (Piped Entry) - BAD FINAL PSL\n"); ! 352: print_cmpf_data(); ! 353: writes(", data index = "); ! 354: writed( index ); ! 355: writec('\n'); ! 356: writes("initial PSL = "); ! 357: write32h( init_psl ); ! 358: writes(", final PSL = "); ! 359: write32h( psl_val ); ! 360: writes(", expected PSL = "); ! 361: write32h( exp_psl ); ! 362: writes("\n"); ! 363: } ! 364: if ( halt_flg ) ! 365: cmpf_er_halt( BAD_PSL_HLT ); /* halt on the error */ ! 366: if ( loop_on_err ) { ! 367: force_loop = TRUE; /* set the force loop flag */ ! 368: asm("brw _cmpf_5_lp1"); /* and loop on the error */ ! 369: } /* end of loop on error */ ! 370: } /* end of compare error */ ! 371: } while ( ++status_index < 3 ); /* end of PSL WHILE loop */ ! 372: } while( index++ < max_cmpf_1_index);/* end of data loop */ ! 373: } /* end of subtest 5 */ ! 374: ! 375: ! 376: ! 377: /**************************************************************************** ! 378: * ! 379: * SUBTEST 6 - CMPF status test -piped exit ! 380: * ! 381: ****************************************************************************/ ! 382: cmpf_6() ! 383: { ! 384: force_loop = FALSE; ! 385: subtest = 2; ! 386: index = 0; ! 387: do ! 388: { ! 389: sgl_value_1 = cmpf_1_data[index].one; /* data to load */ ! 390: sgl_value_2 = cmpf_1_data[index].two; ! 391: if( sgl_value_1 & 0x7f800000 ) ! 392: sgl_expected = sgl_value_1; /* expected = loaded */ ! 393: else ! 394: sgl_expected = 0; /* expect a '0' stored */ ! 395: /* ! 396: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 397: * The force loop flag is set after the first error. ! 398: */ ! 399: asm("_cmpf_6_lp1:"); ! 400: asm("movl $0,r0"); /* clear r0 */ ! 401: asm("ldf _sgl_value_1"); /* load the 1st operand */ ! 402: asm("cmpf _sgl_value_2"); /* compare the value */ ! 403: asm("addf r0"); /* add a zero to the acc */ ! 404: asm("stf _sgl_st_acc"); /* save the accumulator */ ! 405: if( force_loop ) /* loop? */ ! 406: asm("brb _cmpf_6_lp1");; /* run the loop again */ ! 407: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */ ! 408: errcnt++; /* bump the error count */ ! 409: if ( prt_error ) { ! 410: writes(" \n"); /* start a new print line */ ! 411: writes("cycle: "); ! 412: writed( cycle ); ! 413: writes(" CMPF test "); ! 414: writed( test_no ); ! 415: writes(", subtest 6 (Piped Exit) - THE ACC WAS MODIFIED\n"); ! 416: print_cmpf_data(); ! 417: writes(", data index = "); ! 418: writed( index ); ! 419: writec('\n'); ! 420: writes(" final Acc = "); ! 421: write32h( sgl_st_acc ); ! 422: writes(", Acc expected = "); ! 423: write32h( sgl_expected ); ! 424: writec('\n'); ! 425: } ! 426: if ( halt_flg ) ! 427: cmpf_er_halt( BAD_ACC_HLT ); /* halt on the error */ ! 428: if ( loop_on_err ) { ! 429: force_loop = TRUE; /* set the force loop flag */ ! 430: asm("brw _cmpf_6_lp1"); /* and loop on the error */ ! 431: } /* end of loop on error */ ! 432: } /* end of compare error */ ! 433: } while( index++ < max_cmpf_1_index); /* end of data loop */ ! 434: } /* end of subtest 6 */ ! 435: ! 436: ! 437: ! 438: /************************************************************************** ! 439: * ! 440: * PRINT THE DATA AND STORE RESULTS ! 441: * ! 442: * initial Acc = xxxxxxxx, stored = xxxxxxxx, data index = xx ! 443: * operand = xxxxxxxx, expected = xxxxxxxx ! 444: **************************************************************************/ ! 445: print_cmpf_data() ! 446: { ! 447: writes("initial Acc = "); ! 448: write32h( sgl_value_1 ); ! 449: writes(", operand = "); ! 450: write32h( sgl_value_2 ); ! 451: } ! 452: ! 453: ! 454: ! 455: /************************************************************************** ! 456: * ! 457: * HALT ON ERROR ROUTINE ! 458: * ! 459: **************************************************************************/ ! 460: cmpf_er_halt( halt_code ) ! 461: int halt_code; ! 462: { ! 463: sgl_dummy1 = halt_code; /* get the error type */ ! 464: asm("movl _test_no,r0"); /* r0 = test number */ ! 465: asm("movl _subtest,r1"); /* r1 = subtest number */ ! 466: asm("movl _sgl_dummy1,r2"); /* r2 = error code */ ! 467: asm("movl _cycle,r3"); /* r3 = cycle count */ ! 468: asm("movl _sgl_value_1,r4"); /* r4 = initial acc */ ! 469: asm("movl _sgl_value_2,r5"); /* r5 = data compared */ ! 470: asm("movl _psl_val,r6"); /* r6 = final PSL */ ! 471: if( halt_code == BAD_ACC_HLT ) { ! 472: asm("movl _sgl_st_acc,r7"); /* r7 = actual value */ ! 473: asm("movl _sgl_expected,r8"); /* r8 = expected value */ ! 474: } else ! 475: if( halt_code == BAD_REG_HLT ) { ! 476: sgl_dummy1 = load_regs[index2]; ! 477: sgl_dummy2 = store_regs[index2]; ! 478: asm("movl _index2,r7"); /* r7 = bad register # */ ! 479: asm("movl _sgl_dummy2,r8"); /* r8 = actual value */ ! 480: asm("movl _sgl_dummy1,r9"); /* r9 = expected value */ ! 481: } else ! 482: if( halt_code == BAD_PSL_HLT ) { ! 483: asm("movl _exp_psl,r7"); /* r7 = expected PSL */ ! 484: asm("movl _index,r7"); /* r8 = data index */ ! 485: }; ! 486: asm("halt"); /* HALT ... */ ! 487: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.