|
|
1.1 root 1:
2: #include "fpp_defs.h"
3:
4:
5: /*****************************************************************************
6: *
7: * MULF - SINGLE PRECISION FLOATING POINT ADD TEST
8: *
9: *****************************************************************************/
10: mulf()
11: {
12: asm(".globl _mulf_t");
13: asm("_mulf_t:"); /* entry address */
14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */
15: writes(" MULF");
16: mulf_1(); /* multiply through a register*/
17: mulf_2(); /* multiply through the cache */
18: mulf_3(); /* wait 3 NOPs */
19: mulf_4(); /* wait 2 NOPs */
20: mulf_5(); /* wait 1 NOP before storing */
21: mulf_6(); /* register stability test */
22: mulf_7(); /* PSL stability test */
23: mulf_8(); /* pipelined entry test */
24: mulf_9(); /* pipelined exit test */
25: asm("jmp *return"); /* return to the test monitor */
26: }
27:
28:
29:
30: /************************************************************************
31: *
32: * SUBTEST 1 - multiply through a register
33: *
34: ************************************************************************/
35: mulf_1()
36: {
37: force_loop = FALSE;
38: subtest = 1;
39: for( index = 0; index < max_mulf_1_index; index++ ) {
40: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
41: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
42: sgl_expected = mulf_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("_mulf_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("mulf r4"); /* mul the 2nd operand */
52: asm("stf _sgl_st_acc"); /* store the result */
53: if( force_loop )
54: asm("brb _mulf_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(" MULF test ");
65: writed( test_no );
66: writes(", subtest 1 (Reg. Data) - BAD FINAL ACC\n");
67: print_mulf_data();
68: }
69: if( halt_flg )
70: mulf_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 _mulf_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 - multiply through memory
84: *
85: ************************************************************************/
86: mulf_2()
87: {
88: force_loop = FALSE;
89: subtest = 2;
90: for( index = 0; index < max_mulf_1_index; index++ ) {
91: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
92: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
93: sgl_expected = mulf_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("_mulf_2_lp1:");
99: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
100: asm("mulf _sgl_value_1"); /* mul the 2nd operand */
101: asm("stf _sgl_st_acc"); /* store the result */
102: if( force_loop )
103: asm("brb _mulf_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(" MULF test ");
114: writed( test_no );
115: writes(", subtest 2 (Cache Data) - BAD FINAL ACC\n");
116: print_mulf_data();
117: }
118: if( halt_flg )
119: mulf_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 _mulf_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: mulf_3()
136: {
137: force_loop = FALSE;
138: subtest = 3;
139: for( index = 0; index < max_mulf_1_index; index++ ) {
140: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
141: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
142: sgl_expected = mulf_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("_mulf_3_lp1:");
148: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
149: asm("nop"); /* delay */
150: asm("mulf _sgl_value_1"); /* multiply 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 _mulf_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(" MULF test ");
167: writed( test_no );
168: writes(", subtest 3 (Cache Data - 3 NOPs) - BAD FINAL ACC\n");
169: print_mulf_data();
170: }
171: if( halt_flg )
172: mulf_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 _mulf_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: mulf_4()
189: {
190: force_loop = FALSE;
191: subtest = 4;
192: for( index = 0; index < max_mulf_1_index; index++ ) {
193: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
194: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
195: sgl_expected = mulf_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("_mulf_4_lp1:");
201: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
202: asm("nop"); /* delay */
203: asm("mulf _sgl_value_1"); /* multiply 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 _mulf_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(" MULF test ");
219: writed( test_no );
220: writes(", subtest 4 (Cache Data - 2 NOPs) - BAD FINAL ACC\n");
221: print_mulf_data();
222: }
223: if( halt_flg )
224: mulf_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 _mulf_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: mulf_5()
241: {
242: force_loop = FALSE;
243: subtest = 5;
244: for( index = 0; index < max_mulf_1_index; index++ ) {
245: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
246: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
247: sgl_expected = mulf_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("_mulf_5_lp1:");
253: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
254: asm("nop"); /* delay */
255: asm("mulf _sgl_value_1"); /* multiply 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 _mulf_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(" MULF test ");
270: writed( test_no );
271: writes(", subtest 5 (Cache Data - 1 NOPs) - BAD FINAL ACC\n");
272: print_mulf_data();
273: }
274: if( halt_flg )
275: mulf_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 _mulf_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: mulf_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 = mulf_1_data[0].op_1; /* get operand 1 */
298: sgl_value_1 = mulf_1_data[0].op_2; /* get operand 2 */
299: sgl_expected = mulf_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("_mulf_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("mulf _sgl_value_1"); /* do the multiply */
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 _mulf_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(" MULF test ");
328: writed( test_no );
329: writes(", subtest 6 - A REGISTER WAS MODIFIED\n");
330: print_mulf_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: mulf_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 _mulf_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: mulf_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 = mulf_1_data[index].op_1; /* get operand 1 */
362: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
363: sgl_expected = mulf_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("_mulf_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("mulf _sgl_value_1"); /* do the multiply */
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 _mulf_7_lp1");; /* loop on the error */
380: /*
381: * Now compare the final PSL to the initial PSL -they should be the same
382: */
383: if( psl_val != init_psl ) {
384: errcnt++; /* bump the error count */
385: if( prt_error ) {
386: writes(" \n"); /* start a new print line */
387: writes("cycle: ");
388: writed( cycle );
389: writes(" MULF test ");
390: writed( test_no );
391: writes(", subtest 7 - INCORRECT FINAL PSL\n");
392: print_mulf_data(); /* print the operands */
393: writes("initial PSL = ");
394: write32h( init_psl );
395: writes(", final PSL = ");
396: write32h( psl_val );
397: writes(", expected PSL = ");
398: write32h( exp_psl );
399: writes("\n");
400: }
401: if( halt_flg )
402: mulf_er_halt( BAD_PSL_HLT ); /* halt on the error */
403: if( loop_on_err ) {
404: force_loop = TRUE; /* set the force loop flag */
405: asm("brw _mulf_7_lp1");; /* and loop on the error */
406: } /* end of loop on error */
407: } /* end of PSL corruption error */
408: } /* end of WHILE loop */
409: } /* end of subtest 7 */
410:
411:
412:
413: /************************************************************************
414: *
415: * SUBTEST 8 - pipelined entry test
416: *
417: ************************************************************************/
418: mulf_8()
419: {
420: force_loop = FALSE;
421: subtest = 8;
422: for( index = 0; index < max_mulf_1_index; index++ ) {
423: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
424: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
425: sgl_expected = mulf_1_data[index].exp; /* get expected result */
426: /*
427: * If LOOP ON ERROR is set, this is the loop for this subtest.
428: * The force loop flag is set after the first error.
429: */
430: asm("_mulf_8_lp1:");
431: asm("movl $0,r0"); /* clear r0 */
432: asm("ldf r0"); /* load the Acc. with 0.0 */
433: asm("addf _sgl_ld_acc"); /* add the 1st operand */
434: asm("mulf _sgl_value_1"); /* multiply the 2nd operand */
435: asm("stf _sgl_st_acc"); /* store the result */
436: if( force_loop )
437: asm("brb _mulf_8_lp1");; /* loop on the error */
438: /*
439: * end error loop - test the results
440: */
441: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
442: errcnt++; /* bump the error count */
443: if( prt_error ) {
444: writes(" \n"); /* start a new print line */
445: writes("cycle: ");
446: writed( cycle );
447: writes(" MULF test ");
448: writed( test_no );
449: writes(", subtest 8 (Piped Entry) - BAD FINAL ACC\n");
450: print_mulf_data();
451: }
452: if( halt_flg )
453: mulf_er_halt( BAD_ACC_HLT ); /* halt on the error */
454: if( loop_on_err ) {
455: force_loop = TRUE; /* set the force loop flag */
456: asm("brw _mulf_8_lp1");; /* and loop on the error */
457: } /* end of loop on error */
458: } /* end of compare error */
459: } /* end of WHILE loop */
460: } /* end of subtest 8 */
461:
462:
463:
464: /************************************************************************
465: *
466: * SUBTEST 9 - pipelined exit test
467: *
468: ************************************************************************/
469: mulf_9()
470: {
471: force_loop = FALSE;
472: subtest = 9;
473: for( index = 0; index < max_mulf_1_index; index++ ) {
474: sgl_ld_acc = mulf_1_data[index].op_1; /* get operand 1 */
475: sgl_value_1 = mulf_1_data[index].op_2; /* get operand 2 */
476: sgl_expected = mulf_1_data[index].exp; /* get expected result */
477: /*
478: * If LOOP ON ERROR is set, this is the loop for this subtest.
479: * The force loop flag is set after the first error.
480: */
481: asm("_mulf_9_lp1:");
482: asm("movl $0,r0"); /* clear r0 */
483: asm("ldf _sgl_ld_acc"); /* load the 1st operand */
484: asm("mulf _sgl_value_1"); /* multiply the 2nd operand */
485: asm("addf r0"); /* add a 0.0 to the result */
486: asm("stf _sgl_st_acc"); /* store the result */
487: if( force_loop )
488: asm("brb _mulf_9_lp1");; /* loop on the error */
489: /*
490: * end error loop - test the results
491: */
492: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
493: errcnt++; /* bump the error count */
494: if( prt_error ) {
495: writes(" \n"); /* start a new print line */
496: writes("cycle: ");
497: writed( cycle );
498: writes(" MULF test ");
499: writed( test_no );
500: writes(", subtest 9 (Piped Exit) - BAD FINAL ACC\n");
501: print_mulf_data();
502: }
503: if( halt_flg )
504: mulf_er_halt( BAD_ACC_HLT ); /* halt on the error */
505: if( loop_on_err ) {
506: force_loop = TRUE; /* set the force loop flag */
507: asm("brw _mulf_9_lp1");; /* and loop on the error */
508: } /* end of loop on error */
509: } /* end of compare error */
510: } /* end of WHILE loop */
511: } /* end of subtest 9 */
512:
513:
514:
515: /**************************************************************************
516: *
517: * PRINT THE DATA AND STORE RESULTS
518: *
519: * initial Acc = xxxxxxxx, stored = xxxxxxxx, data index = xx
520: * operand = xxxxxxxx, expected = xxxxxxxx
521: **************************************************************************/
522: print_mulf_data()
523: {
524: writes("initial Acc = ");
525: write32h( sgl_ld_acc );
526: writes(", stored = ");
527: write32h( sgl_st_acc );
528: writes(", data index = ");
529: writed( index );
530: writec('\n');
531: writes(" operand = ");
532: write32h( sgl_value_1 );
533: writes(", expected = ");
534: write32h( sgl_expected );
535: writec('\n');
536: }
537:
538:
539:
540: /**************************************************************************
541: *
542: * HALT ON ERROR ROUTINE
543: *
544: **************************************************************************/
545: mulf_er_halt( halt_code )
546: int halt_code;
547: {
548: sgl_dummy1 = halt_code; /* get the error type */
549: asm("movl _test_no,r0"); /* r0 = test number */
550: asm("movl _subtest,r1"); /* r1 = subtest number */
551: asm("movl _sgl_dummy1,r2"); /* r2 = error code */
552: asm("movl _cycle,r3"); /* r3 = cycle count */
553: asm("movl _sgl_ld_acc,r4"); /* r4 = initial data */
554: asm("movl _sgl_value_1,r5"); /* r5 = data multiplied */
555: asm("movl _sgl_st_acc,r6"); /* r6 = data stored */
556: if( halt_code == BAD_ACC_HLT ) {
557: asm("movl _sgl_expected,r7"); /* r7 = data expected */
558: asm("movl _index,r8"); /* r8 = data index */
559: } else
560: if( halt_code == BAD_REG_HLT ) {
561: sgl_dummy1 = load_regs[index2];
562: sgl_dummy2 = store_regs[index2];
563: asm("movl _index2,r7"); /* r7 = bad register # */
564: asm("movl _sgl_dummy2,r8"); /* r8 = actual value */
565: asm("movl _sgl_dummy1,r9"); /* r9 = expected value */
566: } else
567: if( halt_code == BAD_PSL_HLT ) {
568: asm("movl _init_psl,r7"); /* r7 = initial PSL */
569: asm("movl _psl_val,r8"); /* r8 = final PSL */
570: asm("movl _exp_psl,r9"); /* r9 = expected PSL */
571: };
572: asm("halt"); /* HALT ... */
573: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.