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