|
|
1.1 root 1:
2: #include "fpp_defs.h"
3:
4:
5: /*****************************************************************************
6: *
7: * SUBF - SINGLE PRECISION FLOATING POINT ADD TEST
8: *
9: *****************************************************************************/
10: subf()
11: {
12: asm(".globl _subf_t");
13: asm("_subf_t:"); /* entry address */
14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */
15: writes(" SUBF");
16: subf_1(); /* subract through a register */
17: subf_2(); /* subract through the cache */
18: subf_3(); /* wait 3 NOPs */
19: subf_4(); /* wait 2 NOPs */
20: subf_5(); /* wait 1 NOP before storing */
21: subf_6(); /* register stability test */
22: subf_7(); /* PSL stability test */
23: subf_8(); /* pipelined entry test */
24: subf_9(); /* pipelined exit test */
25: asm("jmp *return"); /* return to the test monitor */
26: }
27:
28:
29:
30: /************************************************************************
31: *
32: * SUBTEST 1 - subract through a register
33: *
34: ************************************************************************/
35: subf_1()
36: {
37: force_loop = FALSE;
38: subtest = 1;
39: for( index = 0; index < max_subf_1_index; index++ ) {
40: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
41: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
42: sgl_expected = subf_1_data[index].exp; /* get expected result */
43: /*
44: * If LOOP ON ERROR is set, this is the loop for this subtest.
45: * The force loop flag is set after the first error.
46: */
47: asm("_subf_1_lp1:");
48: asm("movl _sgl_ld_acc,r3"); /* move the 1st data to r3 */
49: asm("movl _sgl_value_1,r4"); /* move the 2nd data to r4 */
50: asm("ldf r3"); /* load the 1st operand */
51: asm("subf r4"); /* subract the 2nd operand */
52: asm("stf _sgl_st_acc"); /* store the result */
53: if( force_loop )
54: asm("brb _subf_1_lp1");; /* loop on the error */
55: /*
56: * end error loop - test the results
57: */
58: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
59: errcnt++; /* bump the error count */
60: if( prt_error ) {
61: writes(" \n"); /* start a new print line */
62: writes("cycle: ");
63: writed( cycle );
64: writes(" SUBF test ");
65: writed( test_no );
66: writes(", subtest 1 (Reg. Data) - BAD FINAL ACC\n");
67: print_subf_data();
68: }
69: if( halt_flg )
70: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
71: if( loop_on_err ) {
72: force_loop = TRUE; /* set the force loop flag */
73: asm("brw _subf_1_lp1");; /* and loop on the error */
74: } /* end of loop on error */
75: } /* end of compare error */
76: } /* end of WHILE loop */
77: } /* end of subtest 1 */
78:
79:
80:
81: /************************************************************************
82: *
83: * SUBTEST 2 - subract through memory
84: *
85: ************************************************************************/
86: subf_2()
87: {
88: force_loop = FALSE;
89: subtest = 2;
90: for( index = 0; index < max_subf_1_index; index++ ) {
91: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
92: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
93: sgl_expected = subf_1_data[index].exp; /* get expected result */
94: /*
95: * If LOOP ON ERROR is set, this is the loop for this subtest.
96: * The force loop flag is set after the first error.
97: */
98: asm("_subf_2_lp1:");
99: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
100: asm("subf _sgl_value_1"); /* sub the 2nd operand */
101: asm("stf _sgl_st_acc"); /* store the result */
102: if( force_loop )
103: asm("brb _subf_2_lp1");; /* loop on the error */
104: /*
105: * end error loop - test the results
106: */
107: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
108: errcnt++; /* bump the error count */
109: if( prt_error ) {
110: writes(" \n"); /* start a new print line */
111: writes("cycle: ");
112: writed( cycle );
113: writes(" SUBF test ");
114: writed( test_no );
115: writes(", subtest 2 (Cache Data) - BAD FINAL ACC\n");
116: print_subf_data();
117: }
118: if( halt_flg )
119: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
120: if( loop_on_err ) {
121: force_loop = TRUE; /* set the force loop flag */
122: asm("brw _subf_2_lp1");; /* and loop on the error */
123: } /* end of loop on error */
124: } /* end of compare error */
125: } /* end of WHILE loop */
126: } /* end of subtest 2 */
127:
128:
129:
130: /************************************************************************
131: *
132: * SUBTEST 3 - Wait 3 NOPs before storing the results
133: *
134: ************************************************************************/
135: subf_3()
136: {
137: force_loop = FALSE;
138: subtest = 3;
139: for( index = 0; index < max_subf_1_index; index++ ) {
140: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
141: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
142: sgl_expected = subf_1_data[index].exp; /* get expected result */
143: /*
144: * If LOOP ON ERROR is set, this is the loop for this subtest.
145: * The force loop flag is set after the first error.
146: */
147: asm("_subf_3_lp1:");
148: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
149: asm("nop"); /* delay */
150: asm("subf _sgl_value_1"); /* sub the 2nd operand */
151: asm("nop"); /* delay before ... */
152: asm("nop");
153: asm("nop"); /* ... storing the result */
154: asm("stf _sgl_st_acc"); /* store the result */
155: if( force_loop )
156: asm("brb _subf_3_lp1");; /* loop on the error */
157: /*
158: * end error loop - test the results
159: */
160: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
161: errcnt++; /* bump the error count */
162: if( prt_error ) {
163: writes(" \n"); /* start a new print line */
164: writes("cycle: ");
165: writed( cycle );
166: writes(" SUBF test ");
167: writed( test_no );
168: writes(", subtest 3 (Cache Data - 3 NOPS) - BAD FINAL ACC\n");
169: print_subf_data();
170: }
171: if( halt_flg )
172: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
173: if( loop_on_err ) {
174: force_loop = TRUE; /* set the force loop flag */
175: asm("brw _subf_3_lp1");; /* and loop on the error */
176: } /* end of loop on error */
177: } /* end of compare error */
178: } /* end of WHILE loop */
179: } /* end of subtest 3 */
180:
181:
182:
183: /************************************************************************
184: *
185: * SUBTEST 4 - Wait 2 NOPs before storing the results
186: *
187: ************************************************************************/
188: subf_4()
189: {
190: force_loop = FALSE;
191: subtest = 4;
192: for( index = 0; index < max_subf_1_index; index++ ) {
193: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
194: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
195: sgl_expected = subf_1_data[index].exp; /* get expected result */
196: /*
197: * If LOOP ON ERROR is set, this is the loop for this subtest.
198: * The force loop flag is set after the first error.
199: */
200: asm("_subf_4_lp1:");
201: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
202: asm("nop"); /* delay */
203: asm("subf _sgl_value_1"); /* subract the 2nd operand */
204: asm("nop"); /* delay before ... */
205: asm("nop"); /* ... storing the result */
206: asm("stf _sgl_st_acc"); /* store the result */
207: if( force_loop )
208: asm("brb _subf_4_lp1");; /* loop on the error */
209: /*
210: * end error loop - test the results
211: */
212: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
213: errcnt++; /* bump the error count */
214: if( prt_error ) {
215: writes(" \n"); /* start a new print line */
216: writes("cycle: ");
217: writed( cycle );
218: writes(" SUBF test ");
219: writed( test_no );
220: writes(", subtest 4 (Cache Data - 2 NOPS) - BAD FINAL ACC\n");
221: print_subf_data();
222: }
223: if( halt_flg )
224: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
225: if( loop_on_err ) {
226: force_loop = TRUE; /* set the force loop flag */
227: asm("brw _subf_4_lp1");; /* and loop on the error */
228: } /* end of loop on error */
229: } /* end of compare error */
230: } /* end of WHILE loop */
231: } /* end of subtest 4 */
232:
233:
234:
235: /************************************************************************
236: *
237: * SUBTEST 5 - Wait 1 NOP before storing the results
238: *
239: ************************************************************************/
240: subf_5()
241: {
242: force_loop = FALSE;
243: subtest = 5;
244: for( index = 0; index < max_subf_1_index; index++ ) {
245: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
246: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
247: sgl_expected = subf_1_data[index].exp; /* get expected result */
248: /*
249: * If LOOP ON ERROR is set, this is the loop for this subtest.
250: * The force loop flag is set after the first error.
251: */
252: asm("_subf_5_lp1:");
253: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
254: asm("nop"); /* delay */
255: asm("subf _sgl_value_1"); /* subract the 2nd operand */
256: asm("nop"); /* delay before storing */
257: asm("stf _sgl_st_acc"); /* store the result */
258: if( force_loop )
259: asm("brb _subf_5_lp1");; /* loop on the error */
260: /*
261: * end error loop - test the results
262: */
263: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
264: errcnt++; /* bump the error count */
265: if( prt_error ) {
266: writes(" \n"); /* start a new print line */
267: writes("cycle: ");
268: writed( cycle );
269: writes(" SUBF test ");
270: writed( test_no );
271: writes(", subtest 5 (Cache Data - 1 NOPS) - BAD FINAL ACC\n");
272: print_subf_data();
273: }
274: if( halt_flg )
275: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
276: if( loop_on_err ) {
277: force_loop = TRUE; /* set the force loop flag */
278: asm("brw _subf_5_lp1");; /* and loop on the error */
279: } /* end of loop on error */
280: } /* end of compare error */
281: } /* end of WHILE loop */
282: } /* end of subtest 5 */
283:
284:
285:
286: /************************************************************************
287: *
288: * SUBTEST 6 - Check for register corruption
289: *
290: ************************************************************************/
291: subf_6()
292: {
293: force_loop = FALSE; /* clear force_loop flg */
294: subtest = 6;
295: fill_reg_buf( load_regs ); /* get patterns for regs */
296: index = 0;
297: sgl_ld_acc = subf_1_data[0].op_1; /* get operand 1 */
298: sgl_value_1 = subf_1_data[0].op_2; /* get operand 2 */
299: sgl_expected = subf_1_data[0].exp; /* get expected result */
300: /*
301: * If LOOP ON ERROR is set, this is the loop for this subtest.
302: * The force loop flag is set after the first error.
303: */
304: asm("_subf_6_lp1:");
305: asm("ldf _sgl_ld_acc"); /* LOAD the accumulator */
306: asm("nop");
307: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */
308: asm("nop");
309: asm("subf _sgl_value_1"); /* do the subraction */
310: asm("nop");
311: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */
312: asm("stf _sgl_st_acc"); /* save the accumulator */
313: if( force_loop )
314: asm("brb _subf_6_lp1");; /* loop on the error */
315: /*
316: * Now compare the stored register values to those that were loaded
317: */
318: index2 = 0;
319: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) )
320: index2++; /* check reg values */
321: if( index2 < 13 ) { /* error if index2 < 13 */
322: errcnt++; /* bump the error count */
323: if( prt_error ) {
324: writes(" \n"); /* start a new print line */
325: writes("cycle: ");
326: writed( cycle );
327: writes(" SUBF test ");
328: writed( test_no );
329: writes(", subtest 6 - A REGISTER WAS MODIFIED\n");
330: print_subf_data(); /* print the operands */
331: writes("register "); /* print the information */
332: writed( index2 ); /* about the corrupted */
333: writes(" = "); /* register */
334: write32h( store_regs[index2] );
335: writes(", should be = ");
336: write32h( load_regs[index2] );
337: writes("\n");
338: }
339: if( halt_flg )
340: subf_er_halt( BAD_REG_HLT ); /* halt on the error */
341: if( loop_on_err ) {
342: force_loop = TRUE; /* set the force loop flag */
343: asm("brw _subf_6_lp1");; /* and loop on the error */
344: } /* end of loop on error */
345: } /* end of register corruption error */
346: } /* end of subtest 6 */
347:
348:
349:
350: /************************************************************************
351: *
352: * SUBTEST 7 - Check for PSL corruption
353: *
354: ************************************************************************/
355: subf_7()
356: {
357: force_loop = FALSE; /* clear force_loop flg */
358: subtest = 7;
359: fill_reg_buf( load_regs ); /* get patterns for regs */
360: for( index = 0; index < 3; index++ ) {
361: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
362: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
363: sgl_expected = subf_1_data[index].exp; /* get expected */
364: sgl_dummy1 = status_array[status_index]; /* status = +, -, 0 */
365: /*
366: * If LOOP ON ERROR is set, this is the loop for this subtest.
367: * The force loop flag is set after the first error.
368: */
369: asm("_subf_7_lp1:");
370: asm("ldf _sgl_ld_acc"); /* LOAD the accumulator */
371: asm("nop");
372: asm("tstl _sgl_dummy1"); /* set the PSL status */
373: asm("movpsl _init_psl"); /* save the initial PSL */
374: asm("subf _sgl_value_1"); /* do the subract */
375: asm("nop");
376: asm("movpsl _psl_val"); /* save the final PSL */
377: asm("stf _sgl_st_acc"); /* save the accumulator */
378: if( force_loop )
379: asm("brb _subf_7_lp1");; /* loop on the error */
380: /*
381: * Now compare the final PSL to the initial PSL -they should be the same
382: */
383: exp_psl = init_psl;
384: if( psl_val != init_psl ) {
385: errcnt++; /* bump the error count */
386: if( prt_error ) {
387: writes(" \n"); /* start a new print line */
388: writes("cycle: ");
389: writed( cycle );
390: writes(" SUBF test ");
391: writed( test_no );
392: writes(", subtest 7 - INCORRECT FINAL PSL\n");
393: print_subf_data(); /* print the operands */
394: writes("initial PSL = ");
395: write32h( init_psl );
396: writes(", final PSL = ");
397: write32h( psl_val );
398: writes(", expected PSL = ");
399: write32h( exp_psl );
400: writes("\n");
401: }
402: if( halt_flg )
403: subf_er_halt( BAD_PSL_HLT ); /* halt on the error */
404: if( loop_on_err ) {
405: force_loop = TRUE; /* set the force loop flag */
406: asm("brw _subf_7_lp1");; /* and loop on the error */
407: } /* end of loop on error */
408: } /* end of PSL corruption error */
409: } /* end of WHILE loop */
410: } /* end of subtest 7 */
411:
412:
413:
414: /************************************************************************
415: *
416: * SUBTEST 8 - pipelined entry test
417: *
418: ************************************************************************/
419: subf_8()
420: {
421: force_loop = FALSE;
422: subtest = 8;
423: for( index = 0; index < max_subf_1_index; index++ ) {
424: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
425: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
426: sgl_expected = subf_1_data[index].exp; /* get expected result */
427: /*
428: * If LOOP ON ERROR is set, this is the loop for this subtest.
429: * The force loop flag is set after the first error.
430: */
431: asm("_subf_8_lp1:");
432: asm("movl $0,r0"); /* clear r0 */
433: asm("ldf r0"); /* load the Acc. with 0.0 */
434: asm("addf _sgl_ld_acc"); /* add the 1st operand */
435: asm("subf _sgl_value_1"); /* subract the 2nd operand */
436: asm("stf _sgl_st_acc"); /* store the result */
437: if( force_loop )
438: asm("brb _subf_8_lp1");; /* loop on the error */
439: /*
440: * end error loop - test the results
441: */
442: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
443: errcnt++; /* bump the error count */
444: if( prt_error ) {
445: writes(" \n"); /* start a new print line */
446: writes("cycle: ");
447: writed( cycle );
448: writes(" SUBF test ");
449: writed( test_no );
450: writes(", subtest 8 (Piped Entry) - BAD FINAL ACC\n");
451: print_subf_data();
452: }
453: if( halt_flg )
454: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
455: if( loop_on_err ) {
456: force_loop = TRUE; /* set the force loop flag */
457: asm("brw _subf_8_lp1");; /* and loop on the error */
458: } /* end of loop on error */
459: } /* end of compare error */
460: } /* end of WHILE loop */
461: } /* end of subtest 8 */
462:
463:
464:
465: /************************************************************************
466: *
467: * SUBTEST 9 - pipelined exit test
468: *
469: ************************************************************************/
470: subf_9()
471: {
472: force_loop = FALSE;
473: subtest = 9;
474: for( index = 0; index < max_subf_1_index; index++ ) {
475: sgl_ld_acc = subf_1_data[index].op_1; /* get operand 1 */
476: sgl_value_1 = subf_1_data[index].op_2; /* get operand 2 */
477: sgl_expected = subf_1_data[index].exp; /* get expected result */
478: /*
479: * If LOOP ON ERROR is set, this is the loop for this subtest.
480: * The force loop flag is set after the first error.
481: */
482: asm("_subf_9_lp1:");
483: asm("movl $0,r0"); /* clear r0 */
484: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
485: asm("subf _sgl_value_1"); /* subract the 2nd operand */
486: asm("addf r0"); /* add a 0.0 to the result */
487: asm("stf _sgl_st_acc"); /* store the result */
488: if( force_loop )
489: asm("brb _subf_9_lp1");; /* loop on the error */
490: /*
491: * end error loop - test the results
492: */
493: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
494: errcnt++; /* bump the error count */
495: if( prt_error ) {
496: writes(" \n"); /* start a new print line */
497: writes("cycle: ");
498: writed( cycle );
499: writes(" SUBF test ");
500: writed( test_no );
501: writes(", subtest 9 (Piped Exit) - BAD FINAL ACC\n");
502: print_subf_data();
503: }
504: if( halt_flg )
505: subf_er_halt( BAD_ACC_HLT ); /* halt on the error */
506: if( loop_on_err ) {
507: force_loop = TRUE; /* set the force loop flag */
508: asm("brw _subf_9_lp1");; /* and loop on the error */
509: } /* end of loop on error */
510: } /* end of compare error */
511: } /* end of WHILE loop */
512: } /* end of subtest 9 */
513:
514:
515:
516: /**************************************************************************
517: *
518: * PRINT THE DATA AND STORE RESULTS
519: *
520: * initial Acc = xxxxxxxx, stored = xxxxxxxx, data index = xx
521: * operand = xxxxxxxx, expected = xxxxxxxx
522: **************************************************************************/
523: print_subf_data()
524: {
525: writes("initial Acc = ");
526: write32h( sgl_ld_acc );
527: writes(", stored = ");
528: write32h( sgl_st_acc );
529: writes(", data index = ");
530: writed( index );
531: writec('\n');
532: writes(" operand = ");
533: write32h( sgl_value_1 );
534: writes(", expected = ");
535: write32h( sgl_expected );
536: writec('\n');
537: }
538:
539:
540:
541: /**************************************************************************
542: *
543: * HALT ON ERROR ROUTINE
544: *
545: **************************************************************************/
546: subf_er_halt( halt_code )
547: int halt_code;
548: {
549: sgl_dummy1 = halt_code; /* get the error type */
550: asm("movl _test_no,r0"); /* r0 = test number */
551: asm("movl _subtest,r1"); /* r1 = subtest number */
552: asm("movl _sgl_dummy1,r2"); /* r2 = error code */
553: asm("movl _cycle,r3"); /* r3 = cycle count */
554: asm("movl _sgl_ld_acc,r4"); /* r4 = initial data */
555: asm("movl _sgl_value_1,r5"); /* r5 = data subtracted */
556: asm("movl _sgl_st_acc,r6"); /* r6 = data stored */
557: if(halt_code == BAD_ACC_HLT ) {
558: asm("movl _sgl_expected,r7"); /* r7 = data expected */
559: asm("movl _index,r8"); /* r8 = data index */
560: } else
561: if( halt_code == BAD_REG_HLT ) {
562: sgl_dummy1 = load_regs[index2];
563: sgl_dummy2 = store_regs[index2];
564: asm("movl _index2,r7"); /* r7 = bad register # */
565: asm("movl _sgl_dummy2,r8"); /* r8 = actual value */
566: asm("movl _sgl_dummy1,r9"); /* r9 = expected value */
567: } else
568: if( halt_code == BAD_PSL_HLT ) {
569: asm("movl _init_psl,r7"); /* r7 = initial PSL */
570: asm("movl _psl_val,r8"); /* r8 = final PSL */
571: asm("movl _exp_psl,r9"); /* r9 = expected PSL */
572: };
573: asm("halt"); /* HALT ... */
574: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.