|
|
1.1 ! root 1: ! 2: #include "fpp_defs.h" ! 3: ! 4: ! 5: /***************************************************************************** ! 6: * ! 7: * LDFD - SINGLE PRECISION FLOATING POINT CONVERT LONG TO FLOAT TEST ! 8: * ! 9: *****************************************************************************/ ! 10: ldfd() ! 11: { ! 12: asm(".globl _ldfd_t"); ! 13: asm("_ldfd_t:"); /* entry address */ ! 14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */ ! 15: writes(" LDFD"); ! 16: ldfd_1(); /* load through a register */ ! 17: ldfd_2(); /* load through the cache */ ! 18: ldfd_3(); /* register stability */ ! 19: ldfd_4(); /* PSL stability test */ ! 20: asm("jmp *return"); /* return to the test monitor */ ! 21: } ! 22: ! 23: ! 24: ! 25: /************************************************************************ ! 26: * ! 27: * SUBTEST 1 ! 28: * ! 29: ************************************************************************/ ! 30: ldfd_1() ! 31: { ! 32: force_loop = FALSE; ! 33: subtest = 1; ! 34: index = 0; ! 35: do ! 36: { ! 37: sgl_ld_acc = ldfd_1_data[index].ld; /* get the operand */ ! 38: dbl_expected.m = ldfd_1_data[index].exp.m;/* get expected result */ ! 39: dbl_expected.l = 0; /* get expected result */ ! 40: /* ! 41: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 42: * The force loop flag is set after the first error. ! 43: */ ! 44: asm("_ldfd_1_lp1:"); ! 45: asm("movl _sgl_ld_acc,r4"); /* get the value to convert */ ! 46: asm("ldfd r4"); /* load the data */ ! 47: asm("std r6"); /* store the result in R8 */ ! 48: if( force_loop ) ! 49: asm("brb _ldfd_1_lp1");; /* loop on the error */ ! 50: /* ! 51: * end error loop - test the results ! 52: */ ! 53: asm("movl r6,_dbl_st_acc"); /* move MSW to cache */ ! 54: asm("movl r7,_dbl_st_acc+4"); /* move LSW to cache */ ! 55: if( ( dbl_st_acc.m != dbl_expected.m ) || /* COMPARE the values */ ! 56: ( dbl_st_acc.l != dbl_expected.l ) ){ ! 57: errcnt++; /* bump the error count */ ! 58: if( prt_error ) { ! 59: writes(" \n"); /* start a new print line */ ! 60: writes("cycle: "); ! 61: writed( cycle ); ! 62: writes(" LDFD test "); ! 63: writed( test_no ); ! 64: writes(", subtest 1 (Reg. Data) - BAD FINAL ACC\n"); ! 65: print_ldfd_data(); ! 66: writes(", index = "); ! 67: writed( index ); ! 68: writec('\n'); ! 69: writes(" operand = "); ! 70: write32h( sgl_ld_acc ); ! 71: writes(", expected Acc = "); ! 72: write32h( dbl_expected.m ); ! 73: writec(' '); ! 74: write32h( dbl_expected.l ); ! 75: writec('\n'); ! 76: } ! 77: if( halt_flg ) ! 78: ldfd_er_halt( BAD_ACC_HLT ); /* halt on the error */ ! 79: if( loop_on_err ) { ! 80: force_loop = TRUE; /* set the force loop flag */ ! 81: asm("brw _ldfd_1_lp1");; /* and loop on the error */ ! 82: } /* end of loop on error */ ! 83: } /* end of compare error */ ! 84: } while( index++ < max_ldfd_1_index ); /* end of WHILE loop */ ! 85: } /* end of subtest 1 */ ! 86: ! 87: ! 88: ! 89: /************************************************************************ ! 90: * ! 91: * SUBTEST 2 - convert through memory ! 92: * ! 93: ************************************************************************/ ! 94: ldfd_2() ! 95: { ! 96: force_loop = FALSE; ! 97: subtest = 2; ! 98: index = 0; ! 99: do ! 100: { ! 101: sgl_ld_acc = ldfd_1_data[index].ld; /* get the operand */ ! 102: dbl_expected.m = ldfd_1_data[index].exp.m;/* get expected result */ ! 103: dbl_expected.l = 0; /* get expected result */ ! 104: /* ! 105: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 106: * The force loop flag is set after the first error. ! 107: */ ! 108: asm("_ldfd_2_lp1:"); ! 109: asm("ldfd _sgl_ld_acc"); /* convert the value */ ! 110: asm("std _dbl_st_acc"); /* store the result */ ! 111: if( force_loop ) ! 112: asm("brb _ldfd_2_lp1");; /* loop on the error */ ! 113: /* ! 114: * end error loop - test the results ! 115: */ ! 116: if( ( dbl_st_acc.m != dbl_expected.m ) || /* COMPARE the values */ ! 117: ( dbl_st_acc.l != dbl_expected.l ) ){ ! 118: errcnt++; /* bump the error count */ ! 119: if( prt_error ) { ! 120: writes(" \n"); /* start a new print line */ ! 121: writes("cycle: "); ! 122: writed( cycle ); ! 123: writes(" LDFD test "); ! 124: writed( test_no ); ! 125: writes(", subtest 2 (Cache Data) - BAD FINAL ACC\n"); ! 126: print_ldfd_data(); ! 127: writes(", index = "); ! 128: writed( index ); ! 129: writec('\n'); ! 130: writes(" operand = "); ! 131: write32h( sgl_ld_acc ); ! 132: writes(", expected Acc = "); ! 133: write32h( dbl_expected.m ); ! 134: writec(' '); ! 135: write32h( dbl_expected.l ); ! 136: writec('\n'); ! 137: } ! 138: if( halt_flg ) ! 139: ldfd_er_halt( BAD_ACC_HLT ); /* halt on the error */ ! 140: if( loop_on_err ) { ! 141: force_loop = TRUE; /* set the force loop flag */ ! 142: asm("brw _ldfd_2_lp1");; /* and loop on the error */ ! 143: } /* end of loop on error */ ! 144: } /* end of compare error */ ! 145: } while( index++ < max_ldfd_1_index ); /* end of WHILE loop */ ! 146: } /* end of subtest 2 */ ! 147: ! 148: ! 149: ! 150: /************************************************************************ ! 151: * ! 152: * SUBTEST 3 - Check for register corruption ! 153: * ! 154: ************************************************************************/ ! 155: ldfd_3() ! 156: { ! 157: force_loop = FALSE; /* clear force_loop flg */ ! 158: subtest = 3; ! 159: fill_reg_buf( load_regs ); /* get patterns for regs */ ! 160: index = 0; ! 161: sgl_ld_acc = ldfd_1_data[index].ld; /* get the operand */ ! 162: /* ! 163: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 164: * The force loop flag is set after the first error. ! 165: */ ! 166: asm("_ldfd_3_lp1:"); ! 167: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */ ! 168: asm("nop"); ! 169: asm("ldfd _sgl_ld_acc"); /* convert the value */ ! 170: asm("nop"); ! 171: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */ ! 172: asm("std _dbl_st_acc"); /* save the acc */ ! 173: if( force_loop ) ! 174: asm("brb _ldfd_3_lp1");; /* loop on the error */ ! 175: /* ! 176: * Now compare the stored register values to those that were loaded ! 177: */ ! 178: index2 = 0; ! 179: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) ) ! 180: index2++; /* check reg values */ ! 181: if( index2 < 13 ) { /* error if index2 < 13 */ ! 182: errcnt++; /* bump the error count */ ! 183: if( prt_error ) { ! 184: writes(" \n"); /* start a new print line */ ! 185: writes("cycle: "); ! 186: writed( cycle ); ! 187: writes(" LDFD test "); ! 188: writed( test_no ); ! 189: writes(", subtest 3 - A REGISTER WAS MODIFIED\n"); ! 190: print_ldfd_data(); /* print the operands */ ! 191: writes("\n"); ! 192: writes(" operand = "); ! 193: write32h( sgl_ld_acc ); ! 194: writes("\n"); ! 195: writes("register "); /* print the information */ ! 196: writed( index2 ); /* about the corrupted */ ! 197: writes(" = "); /* register */ ! 198: write32h( store_regs[index2] ); ! 199: writes(", should be = "); ! 200: write32h( load_regs[index2] ); ! 201: writes("\n"); ! 202: } ! 203: if( halt_flg ) ! 204: ldfd_er_halt( BAD_REG_HLT ); /* halt on the error */ ! 205: if( loop_on_err ) { ! 206: force_loop = TRUE; /* set the force loop flag */ ! 207: asm("brw _ldfd_3_lp1");; /* and loop on the error */ ! 208: } /* end of loop on error */ ! 209: } while( index++ < max_ldfd_1_index ); /* end of reg corruption error */ ! 210: } /* end of subtest 3 */ ! 211: ! 212: ! 213: ! 214: /************************************************************************ ! 215: * ! 216: * SUBTEST 4 - Check for PSL corruption ! 217: * ! 218: ************************************************************************/ ! 219: ldfd_4() ! 220: { ! 221: force_loop = FALSE; /* clear force_loop flg */ ! 222: subtest = 4; ! 223: for( index = 0; index < max_ldfd_1_index; index++ ) { ! 224: sgl_ld_acc = ldfd_1_data[index].ld; /* get the operand */ ! 225: for( status_index = 0; status_index < 3; status_index++ ) { ! 226: sgl_dummy1 = status_array[status_index];/* status = +, -, 0 */ ! 227: /* ! 228: * If LOOP ON ERROR is set, this is the loop for this subtest. ! 229: * The force loop flag is set after the first error. ! 230: */ ! 231: asm("_ldfd_4_lp1:"); ! 232: asm("movl _sgl_ld_acc,r4"); /* load the base value */ ! 233: asm("tstl _sgl_dummy1"); /* set the PSL status */ ! 234: asm("movpsl _init_psl"); /* save the initial PSL */ ! 235: asm("nop"); ! 236: asm("ldfd r4"); /* convert the value */ ! 237: asm("nop"); ! 238: asm("movpsl _psl_val"); /* save the final PSL */ ! 239: asm("std _dbl_st_acc"); /* save the acc */ ! 240: if( force_loop ) ! 241: asm("brb _ldfd_4_lp1");; /* loop on the error */ ! 242: /* ! 243: * Now compare the final PSL to the initial PSL -they should be the same ! 244: */ ! 245: exp_psl = init_psl; ! 246: exp_psl |= PSL_DBL; ! 247: if( psl_val != exp_psl ) { ! 248: errcnt++; /* bump the error count */ ! 249: if( prt_error ) { ! 250: writes(" \n"); /* start a new print line */ ! 251: writes("cycle: "); ! 252: writed( cycle ); ! 253: writes(" LDFD test "); ! 254: writed( test_no ); ! 255: writes(", subtest 4 - INCORRECT FINAL PSL\n"); ! 256: print_ldfd_data(); /* print operands */ ! 257: writes("\n"); ! 258: writes(" operand = "); ! 259: write32h( sgl_ld_acc ); ! 260: writes("\n"); ! 261: writes("initial PSL = "); ! 262: write32h( init_psl ); ! 263: writes(", final PSL = "); ! 264: write32h( psl_val ); ! 265: writes(", expectd PSL = "); ! 266: write32h( exp_psl ); ! 267: writes("\n"); ! 268: } ! 269: if( halt_flg ) ! 270: ldfd_er_halt( BAD_PSL_HLT ); /* halt on error */ ! 271: if( loop_on_err ) { ! 272: force_loop = TRUE; /* set force loop flag */ ! 273: asm("brw _ldfd_4_lp1");; /* and loop on error */ ! 274: } /* end of loop on error */ ! 275: } /* end of PSL corruption error */ ! 276: } /* end of PSL corruption error */ ! 277: } /* end of data WHILE loop */ ! 278: } /* end of subtest 4 */ ! 279: ! 280: ! 281: ! 282: /************************************************************************** ! 283: * ! 284: * PRINT THE DATA AND STORE RESULTS ! 285: * ! 286: * initial Acc = xxxxxxxx xxxxxxxx, stored = xxxxxxxx xxxxxxxx, index = xx ! 287: **************************************************************************/ ! 288: print_ldfd_data() ! 289: { ! 290: writes("initial Acc = "); ! 291: write32h( sgl_ld_acc ); ! 292: writes(", "); ! 293: writes(" final Acc = "); ! 294: write32h( dbl_st_acc.m ); ! 295: writec(' '); ! 296: write32h( dbl_st_acc.l ); ! 297: } ! 298: ! 299: ! 300: ! 301: /************************************************************************** ! 302: * ! 303: * HALT ON ERROR ROUTINE ! 304: * ! 305: **************************************************************************/ ! 306: ldfd_er_halt( halt_code ) ! 307: int halt_code; ! 308: { ! 309: sgl_value_1 = sgl_ld_acc; ! 310: sgl_value_2 = dbl_st_acc.m; ! 311: sgl_value_3 = dbl_st_acc.l; ! 312: sgl_value_5 = 0; ! 313: sgl_dummy1 = halt_code; /* get the error type */ ! 314: asm("movl _test_no,r0"); /* r0 = test number */ ! 315: asm("movl _subtest,r1"); /* r1 = subtest number */ ! 316: asm("movl _sgl_dummy1,r2"); /* r2 = error code */ ! 317: asm("movl _cycle,r3"); /* r3 = cycle count */ ! 318: asm("movl _sgl_value_1,r4"); /* r4 = MS operand 1 */ ! 319: asm("movl _sgl_value_5,r5"); /* r5 = LS operand 1 */ ! 320: asm("movl _sgl_value_1,r6"); /* r6 = operand */ ! 321: asm("movl _sgl_value_2,r7"); /* r7 = MS stored */ ! 322: asm("movl _sgl_value_3,r8"); /* r8 = LS stored */ ! 323: if( halt_code == BAD_ACC_HLT ) { ! 324: sgl_value_1 = dbl_expected.m; ! 325: sgl_value_2 = dbl_expected.l; ! 326: asm("movl _sgl_value_1,r9"); /* r9 = MS expected */ ! 327: asm("movl _sgl_value_2,r10"); /* r10 = LS expected */ ! 328: asm("movl _index,r11"); /* r11 = data index */ ! 329: } else ! 330: if( halt_code == BAD_REG_HLT ) { ! 331: sgl_dummy1 = load_regs[index2]; ! 332: sgl_dummy2 = store_regs[index2]; ! 333: asm("movl _index2,r9"); /* r9 = bad register # */ ! 334: asm("movl _sgl_dummy2,r10"); /* r10 = actual value */ ! 335: asm("movl _sgl_dummy1,r11"); /* r11 = expected value */ ! 336: } else ! 337: if( halt_code == BAD_PSL_HLT ) { ! 338: asm("movl _init_psl,r9"); /* r9 = initial PSL */ ! 339: asm("movl _psl_val,r10"); /* r10 = final PSL */ ! 340: asm("movl _exp_psl,r11"); /* r11 = expected PSL */ ! 341: }; ! 342: asm("halt"); /* HALT ... */ ! 343: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.