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