|
|
1.1 root 1: #include "fpp_defs.h"
2:
3:
4: /***************************************************************************
5: *
6: * MULL3 -MULTIPLY INTEGER 3 INSTRUCTION TEST
7: *
8: *****************************************************************************/
9: mull3()
10: {
11: asm(".globl _mull3_t");
12: asm("_mull3_t:"); /* entry address */
13: if( (cycle == 1) && (prt_hdrs) ) /* print headers on 1st cycle */
14: {
15: writes(" MULL3");
16: }
17: mull3_1(); /* register data / SGL acc. */
18: mull3_2(); /* memory data / DBL acc. */
19: mull3_3(); /* register corruption test */
20: mull3_4(); /* PSL corruption test */
21: mull3_5(); /* pipelined entry test */
22: mull3_6(); /* pipelined exit test */
23: asm("jmp *return"); /* return to the test monitor */
24: }
25:
26:
27:
28: /************************************************************************
29: *
30: * SUBTEST 1 - register addressing / single precsion accumulator
31: *
32: ************************************************************************/
33: mull3_1()
34: {
35: force_loop = FALSE;
36: subtest = 1;
37: for( index = 0; index < max_mull_1_index; index++ ) {
38: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
39: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
40: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
41: sgl_ld_acc = 0x12345678; /* set acc data pattern */
42: sgl_expected = sgl_ld_acc; /* final Acc expected */
43: /*
44: * If LOOP ON ERROR is set, this is the loop for this subtest.
45: */
46: asm("_mull3_1_lp1:");
47: asm("movl _sgl_value_1,r3"); /* move the 1st data to r3 */
48: asm("movl _sgl_value_2,r4"); /* move the 2nd data to r4 */
49: asm("ldf _sgl_ld_acc"); /* load the acc */
50: asm("mull3 r3,r4,r5"); /* do the multiply */
51: asm("nop");
52: asm("stf _sgl_st_acc"); /* save the acc */
53: if( force_loop )
54: asm("brb _mull3_1_lp1");;
55: asm("movl r5,_sgl_value_3");
56: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */
57: errcnt++; /* bump the error count */
58: if ( prt_error ) {
59: print_mull3_error("(Reg. Data) -THE ACC WAS MODIFIED");
60: writes("initial Acc = ");
61: write32h( sgl_ld_acc );
62: writes(", final Acc = ");
63: write32h( sgl_st_acc );
64: writes("\n expected Acc = ");
65: write32h( sgl_expected );
66: writec('\n');
67: }
68: if ( halt_flg ) /* halt on error? */
69: mull3_halt( 4 );
70: if ( loop_on_err ) {
71: force_loop = TRUE; /* set the force loop flag */
72: asm("jmp _mull3_1_lp1"); /* and loop */
73: } /* end of loop-on-error */
74: } /* end of acc corr error */
75: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */
76: {
77: errcnt++; /* bump the error count */
78: if ( prt_error ) {
79: print_mull3_error("(Reg. Data) -BAD MULTIPLY RESULT");
80: }
81: if ( halt_flg ) /* halt on error? */
82: mull3_halt( 1 );
83: if ( loop_on_err ) {
84: force_loop = TRUE; /* set the force loop flag */
85: asm("jmp _mull3_1_lp1"); /* and loop */
86: } /* end of loop-on-error */
87: } /* end of multiply error */
88: }
89: } /* end of subtest 1 */
90:
91:
92:
93: /************************************************************************
94: *
95: * SUBTEST 2 - cache addressing / double precsion accumulator
96: *
97: ************************************************************************/
98: mull3_2()
99: {
100: force_loop = FALSE;
101: subtest = 2;
102: for( index = 0; index < max_mull_1_index; index++ ) {
103: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
104: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
105: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
106: dbl_ld_acc.m = 0x12345678; /* set acc data pattern */
107: dbl_ld_acc.l = 0x9abcdef0;
108: dbl_expected.m = dbl_ld_acc.m; /* final Acc expected */
109: dbl_expected.l = dbl_ld_acc.l;
110: /*
111: * If LOOP ON ERROR is set, this is the loop for this subtest.
112: */
113: asm("_mull3_2_lp1:");
114: asm("ldd _dbl_ld_acc"); /* load the acc */
115: asm("mull3 _sgl_value_1,_sgl_value_2,_sgl_value_3");
116: asm("nop");
117: asm("std _dbl_st_acc"); /* save the acc */
118: if( force_loop )
119: asm("brb _mull3_2_lp1");;
120: if( (dbl_expected.m != dbl_st_acc.m) || /* COMPARE the Acc */
121: (dbl_expected.l != dbl_st_acc.l) ) {
122: errcnt++; /* bump the error count */
123: if ( prt_error ) {
124: print_mull3_error("(Memory data) -THE ACC WAS MODIFIED");
125: writes("initial Acc = ");
126: write32h( dbl_ld_acc.m );
127: writec(' ');
128: write32h( dbl_ld_acc.l );
129: writes(", final Acc = ");
130: write32h( dbl_st_acc.m );
131: writec(' ');
132: write32h( dbl_st_acc.l );
133: writes("\n expected Acc = ");
134: write32h( dbl_expected.m );
135: writec(' ');
136: write32h( dbl_expected.l );
137: writec('\n');
138: }
139: if ( halt_flg ) /* halt on error? */
140: mull3_halt( 4 );
141: if ( loop_on_err ) {
142: force_loop = TRUE; /* set the force loop flag */
143: asm("jmp _mull3_2_lp1"); /* and loop */
144: } /* end of loop-on-error */
145: } /* end of acc corr error */
146: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */
147: {
148: errcnt++; /* bump the error count */
149: if ( prt_error ) {
150: print_mull3_error("(Memory data) -BAD MULTIPLY RESULT");
151: }
152: if ( halt_flg ) /* halt on error? */
153: mull3_halt( 1 );
154: if ( loop_on_err ) {
155: force_loop = TRUE; /* set the force loop flag */
156: asm("jmp _mull3_2_lp1"); /* and loop */
157: } /* end of loop-on-error */
158: } /* end of multiply error */
159: }
160: } /* end of subtest 2 */
161:
162:
163:
164: /************************************************************************
165: *
166: * SUBTEST 3 - register corruption test
167: *
168: ************************************************************************/
169: mull3_3()
170: {
171: force_loop = FALSE;
172: subtest = 2;
173: fill_reg_buf( load_regs ); /* get pattern for registers */
174: for( index = 0; index < max_mull_1_index; index++ ) {
175: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
176: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
177: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
178: /*
179: * If LOOP ON ERROR is set, this is the loop for this subtest.
180: */
181: asm("_mull3_3_lp1:");
182: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */
183: asm("mull3 _sgl_value_1,_sgl_value_2,_sgl_value_3");
184: asm("nop");
185: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */
186: if( force_loop )
187: asm("brb _mull3_3_lp1");
188: /*
189: * Now check the result
190: */
191: index2 = 0;
192: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) )
193: index2++; /* check reg values */
194: if( index2 < 13 ) { /* error if index2 < 13 */
195: errcnt++; /* bump the error count */
196: if ( prt_error ) {
197: print_mull3_error(" -A REGISTER WAS MODIFIED");
198: writes("register ");
199: writeh( index2 );
200: writes(" = ");
201: write32h( store_regs[index2] );
202: writes(", should be = ");
203: write32h( load_regs[index2] );
204: writec('\n');
205: }
206: if ( halt_flg ) /* halt on error? */
207: mull3_halt( 2 );
208: if ( loop_on_err ) {
209: force_loop = TRUE; /* set the force loop flag */
210: asm("jmp _mull3_3_lp1"); /* and loop */
211: }; /* end of loop-on-error */
212: } /* end of multiply error */
213: }
214: } /* end of subtest 3 */
215:
216:
217:
218: /************************************************************************
219: *
220: * SUBTEST 4 - PSL corruption test
221: *
222: ************************************************************************/
223: mull3_4()
224: {
225: force_loop = FALSE;
226: subtest = 4;
227: status_index = 0;
228: for( index = 0; index < max_mull_1_index; index++ ) {
229: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
230: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
231: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
232: sgl_dummy1 = status_array[status_index]; /* status = +, -, 0 */
233: /*
234: * If LOOP ON ERROR is set, this is the loop for this subtest.
235: */
236: asm("_mull3_4_lp1:");
237: asm("tstl _sgl_dummy1");
238: asm("movpsl _init_psl"); /* save the initial PSL */
239: asm("mull3 _sgl_value_1,_sgl_value_2,_sgl_value_3");
240: asm("movpsl _psl_val"); /* save the final PSL */
241: if( force_loop )
242: asm("brb _mull3_4_lp1");
243: /*
244: * Now check the result
245: */
246: exp_psl = init_psl & 0xffffff3; /* strip off the PSL status */
247: if( sgl_value_4 < 0 ) /* check the MULL result */
248: exp_psl |= PSL_N; /* set the NEGATIVE bit */
249: if( !sgl_value_4 )
250: exp_psl |= PSL_Z; /* set the ZERO bit */
251: if( psl_val != exp_psl ) { /* was the final PSL correct */
252: errcnt++; /* bump the error count */
253: if ( prt_error ) {
254: print_mull3_error(" -INCORRECT FINAL PSL");
255: writes("initial PSL = ");
256: write32h( init_psl );
257: writes(", final PSL = ");
258: write32h( psl_val );
259: writes(", expected PSL = ");
260: write32h( exp_psl );
261: writec('\n');
262: }
263: if ( halt_flg ) /* halt on error? */
264: mull3_halt( 3 );
265: if ( loop_on_err ) {
266: force_loop = TRUE; /* set the force loop flag */
267: asm("jmp _mull3_4_lp1"); /* and loop */
268: }; /* end of loop-on-error */
269: }; /* end of error */
270: if( ++status_index >= 3 )
271: status_index = 0;
272: }
273: } /* end of subtest 4 */
274:
275:
276:
277: /************************************************************************
278: *
279: * SUBTEST 5 - Pipelined Entry test
280: *
281: ************************************************************************/
282: mull3_5()
283: {
284: force_loop = FALSE;
285: subtest = 5;
286: for( index = 0; index < max_mull_1_index; index++ ) {
287: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
288: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
289: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
290: sgl_ld_acc = 0x12345678; /* set acc data pattern */
291: sgl_expected = sgl_ld_acc; /* final Acc expected */
292: sgl_value_10 = 0x40800000; /* floating "1.0" */
293: /*
294: * If LOOP ON ERROR is set, this is the loop for this subtest.
295: */
296: asm("_mull3_5_lp1:");
297: asm("ldf _sgl_ld_acc"); /* load the acc */
298: asm("mulf _sgl_value_10"); /* do a floating multiply */
299: asm("mull3 _sgl_value_1,_sgl_value_2,_sgl_value_3");
300: asm("stf _sgl_st_acc"); /* save the acc */
301: if( force_loop )
302: asm("brb _mull3_5_lp1");;
303: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */
304: errcnt++; /* bump the error count */
305: if ( prt_error ) {
306: print_mull3_error("(Piped Entry) -BAD FINAL ACC");
307: writes("initial Acc = ");
308: write32h( sgl_ld_acc );
309: writes(", final Acc = ");
310: write32h( sgl_st_acc );
311: writes("\nFPP operand = ");
312: write32h( sgl_value_10 );
313: writes(", expected Acc = ");
314: write32h( sgl_expected );
315: writec('\n');
316: }
317: if ( halt_flg ) /* halt on error? */
318: mull3_halt( 5 );
319: if ( loop_on_err ) {
320: force_loop = TRUE; /* set the force loop flag */
321: asm("jmp _mull3_5_lp1"); /* and loop */
322: } /* end of loop-on-error */
323: } /* end of acc corr error */
324: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */
325: {
326: errcnt++; /* bump the error count */
327: if ( prt_error ) {
328: print_mull3_error("(Piped Entry) -BAD MULTIPLY RESULT");
329: }
330: if ( halt_flg ) /* halt on error? */
331: mull3_halt( 1 );
332: if ( loop_on_err ) {
333: force_loop = TRUE; /* set the force loop flag */
334: asm("jmp _mull3_5_lp1"); /* and loop */
335: } /* end of loop-on-error */
336: } /* end of multiply error */
337: }
338: } /* end of subtest 5 */
339:
340:
341:
342: /************************************************************************
343: *
344: * SUBTEST 6 - Pipelined Exit test
345: *
346: ************************************************************************/
347: mull3_6()
348: {
349: force_loop = FALSE;
350: subtest = 6;
351: for( index = 0; index < max_mull_1_index; index++ ) {
352: sgl_value_1 = mull_1_data[index].op_1; /* get operand 1 */
353: sgl_value_2 = mull_1_data[index].op_2; /* get operand 2 */
354: sgl_value_4 = mull_1_data[index].exp; /* get expected results */
355: sgl_ld_acc = 0x40800000; /* floating "1.0" */
356: sgl_value_10 = 0x12345678; /* set acc data pattern */
357: sgl_expected = sgl_value_10; /* final Acc expected */
358: /*
359: * If LOOP ON ERROR is set, this is the loop for this subtest.
360: */
361: asm("_mull3_6_lp1:");
362: asm("ldf _sgl_ld_acc"); /* load the acc */
363: asm("mull3 _sgl_value_1,_sgl_value_2,_sgl_value_3");
364: asm("mulf _sgl_value_10"); /* do a floating multiply */
365: asm("stf _sgl_st_acc"); /* save the acc */
366: if( force_loop )
367: asm("brb _mull3_6_lp1");;
368: if( sgl_expected != sgl_st_acc ) { /* COMPARE the values */
369: errcnt++; /* bump the error count */
370: if ( prt_error ) {
371: print_mull3_error("(Piped Exit) -BAD FINAL ACC");
372: writes("initial Acc = ");
373: write32h( sgl_ld_acc );
374: writes(", final Acc = ");
375: write32h( sgl_st_acc );
376: writes("\nFPP operand = ");
377: write32h( sgl_value_10 );
378: writes(", expected Acc = ");
379: write32h( sgl_expected );
380: writec('\n');
381: }
382: if ( halt_flg ) /* halt on error? */
383: mull3_halt( 5 );
384: if ( loop_on_err ) {
385: force_loop = TRUE; /* set the force loop flag */
386: asm("jmp _mull3_6_lp1"); /* and loop */
387: } /* end of loop-on-error */
388: } /* end of acc corr error */
389: if( sgl_value_4 != sgl_value_3 ) /* COMPARE the values */
390: {
391: errcnt++; /* bump the error count */
392: if ( prt_error ) {
393: print_mull3_error("(Piped Exit) -BAD MULTIPLY RESULT");
394: }
395: if ( halt_flg ) /* halt on error? */
396: mull3_halt( 1 );
397: if ( loop_on_err ) {
398: force_loop = TRUE; /* set the force loop flag */
399: asm("jmp _mull3_6_lp1"); /* and loop */
400: } /* end of loop-on-error */
401: } /* end of multiply error */
402: }
403: } /* end of subtest 6 */
404:
405:
406:
407: /*****************************************************************************
408: *
409: * Print an error message of the form:
410: *
411: * cycle: xx MULL3 test xx, subtest xx <"your message here">
412: * operand 1 = xxxxxxxx, result = xxxxxxxx, data index = xx
413: * operand 2 = xxxxxxxx, expected = xxxxxxxx
414: *
415: *****************************************************************************/
416: print_mull3_error(msg)
417: char *msg; /* addressing mode msg */
418: {
419: writes(" \n"); /* start a new print line */
420: writes("cycle: ");
421: writed( cycle );
422: writes(" MULL3 test ");
423: writed( test_no );
424: writes(", subtest ");
425: writed( subtest );
426: writes(" ");
427: writes( msg );
428: writes("\n operand 1 = ");
429: write32h( sgl_value_1 );
430: writes(", result = ");
431: write32h( sgl_value_3 );
432: writes(", data index = ");
433: writed( index );
434: writes("\n operand 2 = ");
435: write32h( sgl_value_2 );
436: writes(", expected = ");
437: write32h( sgl_value_4 );
438: writec('\n');
439: }
440:
441:
442:
443: /***************************************************************************
444: *
445: * HALT ON AN ERROR
446: *
447: ***************************************************************************/
448: mull3_halt( code )
449: int code; /* error code to use */
450: {
451: sgl_dummy1 = code; /* save the error code */
452: asm("movl _test_no,r0"); /* r0 = test number */
453: asm("movl _subtest,r1"); /* r1 = subtest number */
454: asm("movl _sgl_dummy1,r2"); /* r2 = error code */
455: asm("movl _cycle,r3"); /* r3 = cycle count */
456: asm("movl _sgl_value_1,r4"); /* r4 = operand 1 */
457: asm("movl _sgl_value_2,r5"); /* r5 = operand 2 */
458: asm("movl _sgl_value_3,r6"); /* r6 = MULL3's result */
459: if( code == 1 ) {
460: asm("movl _sgl_value_4,r7"); /* r7 = expected result */
461: asm("movl _index,r8");; /* r8 = data index */
462: }
463: else if( code == 2 ) { /* corrupted register */
464: sgl_dummy1 = store_regs[index2]; /* get the actual reg data */
465: sgl_dummy2 = load_regs[index2]; /* get the data expected */
466: asm("movl _index2,r7"); /* r7 = register number */
467: asm("movl _sgl_dummy1,r8"); /* r8 = final reg value */
468: asm("movl _sgl_dummy2,r9"); /* r9 = expected value */
469: }
470: else if( code == 3 ) { /* corrupted PSL */
471: asm("movl _init_psl,r7"); /* r7 = initial PSL */
472: asm("movl _psl_val,r8"); /* r8 = final PSL */
473: asm("movl _exp_psl,r9"); /* r9 = expected PSL */
474: }
475: else if( code == 4 ) { /* corrupted Acc */
476: if( subtest == 1 ) { /* single precision */
477: dbl_ld_acc.m = sgl_ld_acc;
478: dbl_ld_acc.l = 0;
479: dbl_st_acc.m = sgl_st_acc;
480: dbl_st_acc.l = 0;
481: dbl_expected.m = sgl_expected;
482: dbl_expected.l = 0;
483: };
484: asm("movl _index,r7"); /* r7 = data index */
485: asm("movl _dbl_ld_acc,r8"); /* r8 = MS initial Acc. */
486: asm("movl _dbl_ld_acc+4,r9"); /* r9 = LS initial Acc. */
487: asm("movl _dbl_st_acc,r10"); /* r10 = MS final Acc. */
488: asm("movl _dbl_st_acc+4,r11"); /* r11 = LS final Acc. */
489: asm("movl _dbl_expected,r12"); /* r12 = MS expected Acc. */
490: asm("movl _dbl_expected+4,r13"); /* r13 = LS expected Acc. */
491: }
492: else if( code == 5 ) { /* bad final Acc */
493: asm("movl _index,r7"); /* r7 = data index */
494: asm("movl _sgl_ld_acc,r8"); /* r8 = initial Acc. */
495: asm("movl _sgl_value_10,r9"); /* r9 = fpp operand */
496: asm("movl _sgl_st_acc,r10"); /* r10 = final Acc. */
497: asm("movl _sgl_expected,r11"); /* r11 = expected Acc. */
498: };
499: asm("halt"); /* HALT ... */
500: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.