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