|
|
1.1 root 1:
2: #include "fpp_defs.h"
3:
4:
5: /*****************************************************************************
6: *
7: * LNF - SINGLE PRECISION FLOATING POINT LOAD_NEGATE TEST
8: *
9: *****************************************************************************/
10: lnf()
11: {
12: asm(".globl _lnf_t");
13: asm("_lnf_t:"); /* entry address */
14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */
15: writes(" LNF");
16: lnf_1(); /* load through a register */
17: lnf_2(); /* load through the cache */
18: lnf_3(); /* register stability */
19: lnf_4(); /* PSL stability test */
20: lnf_5(); /* pipelined entry test */
21: if ( !no_fpp_wcs )
22: lnf_6();; /* pipelined exit test */
23: asm("jmp *return"); /* return to the test monitor */
24: }
25:
26:
27:
28: /************************************************************************
29: *
30: * SUBTEST 1 - load_negate through a register
31: *
32: ************************************************************************/
33: lnf_1()
34: {
35: force_loop = FALSE;
36: subtest = 1;
37: for( index = 0; index < max_lnf_1_index; index++ ) {
38: sgl_ld_acc = lnf_1_data[index].ld; /* get value to negate */
39: sgl_expected = lnf_1_data[index].exp; /* 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("_lnf_1_lp1:");
45: asm("movl _sgl_ld_acc,r4"); /* get the value to negate */
46: asm("lnf r4"); /* load and negate value */
47: asm("stf r5"); /* store the result in R5 */
48: if( force_loop )
49: asm("brb _lnf_1_lp1");; /* loop on the error */
50: /*
51: * end error loop - test the results
52: */
53: asm("movl r5,_sgl_st_acc"); /* move R5 data to cache */
54: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
55: errcnt++; /* bump the error count */
56: if( prt_error ) {
57: writes(" \n"); /* start a new print line */
58: writes("cycle: ");
59: writed( cycle );
60: writes(" LNF test ");
61: writed( test_no );
62: writes(", subtest 1 (Reg. Data) - BAD FINAL ACC\n");
63: print_lnf_data();
64: writes(" Acc expected = ");
65: write32h( sgl_expected );
66: writec('\n');
67: }
68: if( halt_flg )
69: lnf_er_halt( BAD_ACC_HLT ); /* halt on the error */
70: if( loop_on_err ) {
71: force_loop = TRUE; /* set the force loop flag */
72: asm("brw _lnf_1_lp1");; /* and loop on the error */
73: } /* end of loop on error */
74: } /* end of compare error */
75: } /* end of WHILE loop */
76: } /* end of subtest 1 */
77:
78:
79:
80: /************************************************************************
81: *
82: * SUBTEST 2 - load_negate through memory
83: *
84: ************************************************************************/
85: lnf_2()
86: {
87: force_loop = FALSE;
88: subtest = 2;
89: for( index = 0; index < max_lnf_1_index; index++ ) {
90: sgl_ld_acc = lnf_1_data[index].ld; /* get value to negate */
91: sgl_expected = lnf_1_data[index].exp; /* get expected result */
92: /*
93: * If LOOP ON ERROR is set, this is the loop for this subtest.
94: * The force loop flag is set after the first error.
95: */
96: asm("_lnf_2_lp1:");
97: asm("lnf _sgl_ld_acc"); /* load and negate the value */
98: asm("stf _sgl_st_acc"); /* store the result */
99: if( force_loop )
100: asm("brb _lnf_2_lp1");; /* loop on the error */
101: /*
102: * end error loop - test the results
103: */
104: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
105: errcnt++; /* bump the error count */
106: if( prt_error ) {
107: writes(" \n"); /* start a new print line */
108: writes("cycle: ");
109: writed( cycle );
110: writes(" LNF test ");
111: writed( test_no );
112: writes(", subtest 2 (Cache Data) - BAD FINAL ACC\n");
113: print_lnf_data();
114: writes(" Acc expected = ");
115: write32h( sgl_expected );
116: writec('\n');
117: }
118: if( halt_flg )
119: lnf_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 _lnf_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 - Check for register corruption
133: *
134: ************************************************************************/
135: lnf_3()
136: {
137: force_loop = FALSE; /* clear force_loop flg */
138: subtest = 3;
139: fill_reg_buf( load_regs ); /* get patterns for regs */
140: index = 0;
141: sgl_ld_acc = lnf_1_data[0].ld; /* get value to negate */
142: sgl_expected = lnf_1_data[0].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("_lnf_3_lp1:");
148: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */
149: asm("nop");
150: asm("lnf _sgl_ld_acc"); /* load and negate the value */
151: asm("nop");
152: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */
153: asm("stf _sgl_st_acc"); /* save the accumulator */
154: if( force_loop )
155: asm("brb _lnf_3_lp1");; /* loop on the error */
156: /*
157: * Now compare the stored register values to those that were loaded
158: */
159: index2 = 0;
160: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) )
161: index2++; /* check reg values */
162: if( index2 < 13 ) { /* error if index2 < 13 */
163: errcnt++; /* bump the error count */
164: if( prt_error ) {
165: writes(" \n"); /* start a new print line */
166: writes("cycle: ");
167: writed( cycle );
168: writes(" LNF test ");
169: writed( test_no );
170: writes(", subtest 3 - A REGISTER WAS MODIFIED\n");
171: print_lnf_data(); /* print the operands */
172: writes("register "); /* print the information */
173: writed( index2 ); /* about the corrupted */
174: writes(" = "); /* register */
175: write32h( store_regs[index2] );
176: writes(", should be = ");
177: write32h( load_regs[index2] );
178: writes("\n");
179: }
180: if( halt_flg )
181: lnf_er_halt( BAD_REG_HLT ); /* halt on the error */
182: if( loop_on_err ) {
183: force_loop = TRUE; /* set the force loop flag */
184: asm("brw _lnf_3_lp1");; /* and loop on the error */
185: } /* end of loop on error */
186: } /* end of register corruption error */
187: } /* end of subtest 3 */
188:
189:
190:
191: /************************************************************************
192: *
193: * SUBTEST 4 - Check for PSL corruption
194: *
195: ************************************************************************/
196: lnf_4()
197: {
198: force_loop = FALSE; /* clear force_loop flg */
199: subtest = 4;
200: fill_reg_buf( load_regs ); /* get patterns for regs */
201: for( index = 0; index < 3; index++ ) {
202: sgl_ld_acc = lnf_1_data[index].ld; /* get value to negate */
203: sgl_expected = lnf_1_data[index].exp; /* get expected */
204: sgl_dummy1 = status_array[status_index]; /* status = +, -, 0 */
205: /*
206: * If LOOP ON ERROR is set, this is the loop for this subtest.
207: * The force loop flag is set after the first error.
208: */
209: asm("_lnf_4_lp1:");
210: asm("tstl _sgl_dummy1"); /* set the PSL status */
211: asm("movpsl _init_psl"); /* save the initial PSL */
212: asm("lnf _sgl_ld_acc"); /* load and negate the value */
213: asm("nop");
214: asm("movpsl _psl_val"); /* save the final PSL */
215: asm("stf _sgl_st_acc"); /* save the accumulator */
216: if( force_loop )
217: asm("brb _lnf_4_lp1");; /* loop on the error */
218: /*
219: * Now compare the final PSL to the initial PSL -they should be the same
220: */
221: exp_psl = init_psl;
222: if( psl_val != init_psl ) {
223: errcnt++; /* bump the error count */
224: if( prt_error ) {
225: writes(" \n"); /* start a new print line */
226: writes("cycle: ");
227: writed( cycle );
228: writes(" LNF test ");
229: writed( test_no );
230: writes(", subtest 4 - INCORRECT FINAL PSL\n");
231: print_lnf_data(); /* print the operands */
232: writes("initial PSL = ");
233: write32h( init_psl );
234: writes(", final PSL = ");
235: write32h( psl_val );
236: writes(", expected PSL = ");
237: write32h( exp_psl );
238: writes("\n");
239: }
240: if( halt_flg )
241: lnf_er_halt( BAD_PSL_HLT ); /* halt on the error */
242: if( loop_on_err ) {
243: force_loop = TRUE; /* set the force loop flag */
244: asm("brw _lnf_4_lp1");; /* and loop on the error */
245: } /* end of loop on error */
246: } /* end of PSL corruption error */
247: } /* end of WHILE loop */
248: } /* end of subtest 4 */
249:
250:
251:
252: /************************************************************************
253: *
254: * SUBTEST 5 - pipelined entry test
255: *
256: ************************************************************************/
257: lnf_5()
258: {
259: force_loop = FALSE;
260: subtest = 8;
261: for( index = 0; index < max_lnf_1_index; index++ ) {
262: sgl_ld_acc = lnf_1_data[index].ld; /* get value to negate */
263: sgl_expected = lnf_1_data[index].exp; /* get expected result */
264: /*
265: * If LOOP ON ERROR is set, this is the loop for this subtest.
266: * The force loop flag is set after the first error.
267: */
268: asm("_lnf_5_lp1:");
269: asm("movl $0,r0"); /* clear r0 */
270: asm("ldf r0"); /* load the Acc. with 0.0 */
271: asm("lnf _sgl_ld_acc"); /* load and negate the value */
272: asm("stf _sgl_st_acc"); /* store the result */
273: if( force_loop )
274: asm("brb _lnf_5_lp1");; /* loop on the error */
275: /*
276: * end error loop - test the results
277: */
278: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
279: errcnt++; /* bump the error count */
280: if( prt_error ) {
281: writes(" \n"); /* start a new print line */
282: writes("cycle: ");
283: writed( cycle );
284: writes(" LNF test ");
285: writed( test_no );
286: writes(", subtest 5 (Piped Entry) - BAD FINAL ACC\n");
287: print_lnf_data();
288: }
289: if( halt_flg )
290: lnf_er_halt( BAD_ACC_HLT ); /* halt on the error */
291: if( loop_on_err ) {
292: force_loop = TRUE; /* set the force loop flag */
293: asm("brw _lnf_5_lp1");; /* and loop on the error */
294: } /* end of loop on error */
295: } /* end of compare error */
296: } /* end of WHILE loop */
297: } /* end of subtest 5 */
298:
299:
300:
301: /************************************************************************
302: *
303: * SUBTEST 6 - pipelined exit test
304: *
305: ************************************************************************/
306: lnf_6()
307: {
308: force_loop = FALSE;
309: subtest = 8;
310: for( index = 0; index < max_lnf_1_index; index++ ) {
311: sgl_ld_acc = lnf_1_data[index].ld; /* get value to negate */
312: sgl_expected = lnf_1_data[index].exp; /* get expected result */
313: /*
314: * If LOOP ON ERROR is set, this is the loop for this subtest.
315: * The force loop flag is set after the first error.
316: */
317: asm("_lnf_6_lp1:");
318: asm("movl $0,r0"); /* clear r0 */
319: asm("lnf _sgl_ld_acc"); /* load and negate the value */
320: asm("addf r0"); /* add a zero to the acc. */
321: asm("stf _sgl_st_acc"); /* store the result */
322: if( force_loop )
323: asm("brb _lnf_6_lp1");; /* loop on the error */
324: /*
325: * end error loop - test the results
326: */
327: if( sgl_st_acc != sgl_expected ) { /* COMPARE the values */
328: errcnt++; /* bump the error count */
329: if( prt_error ) {
330: writes(" \n"); /* start a new print line */
331: writes("cycle: ");
332: writed( cycle );
333: writes(" LNF test ");
334: writed( test_no );
335: writes(", subtest 6 (Piped Exit) - BAD FINAL ACC\n");
336: print_lnf_data();
337: }
338: if( halt_flg )
339: lnf_er_halt( BAD_ACC_HLT ); /* halt on the error */
340: if( loop_on_err ) {
341: force_loop = TRUE; /* set the force loop flag */
342: asm("brw _lnf_6_lp1");; /* and loop on the error */
343: } /* end of loop on error */
344: } /* end of compare error */
345: } /* end of WHILE loop */
346: } /* end of subtest 6 */
347:
348:
349:
350: /**************************************************************************
351: *
352: * PRINT THE DATA AND STORE RESULTS
353: *
354: * initial Acc = xxxxxxxx, stored = xxxxxxxx, data index = xx
355: **************************************************************************/
356: print_lnf_data()
357: {
358: writes("initial Acc = ");
359: write32h( sgl_ld_acc );
360: writes(", Acc stored = ");
361: write32h( sgl_st_acc );
362: writes(", data index = ");
363: writed( index );
364: writec('\n');
365: }
366:
367:
368:
369: /**************************************************************************
370: *
371: * HALT ON ERROR ROUTINE
372: *
373: **************************************************************************/
374: lnf_er_halt( halt_code )
375: int halt_code;
376: {
377: sgl_dummy1 = halt_code; /* get the error type */
378: asm("movl _test_no,r0"); /* r0 = test number */
379: asm("movl _subtest,r1"); /* r1 = subtest number */
380: asm("movl _sgl_dummy1,r2"); /* r2 = error code */
381: asm("movl _cycle,r3"); /* r3 = cycle count */
382: asm("movl _sgl_ld_acc,r4"); /* r4 = initial data */
383: asm("movl _sgl_st_acc,r5"); /* r5 = data stored */
384: if( halt_code == BAD_ACC_HLT ) {
385: asm("movl _sgl_expected,r6"); /* r6 = data expected */
386: asm("movl _index,r7"); /* r7 = data index */
387: } else
388: if( halt_code == BAD_REG_HLT ) {
389: sgl_dummy1 = load_regs[index2];
390: sgl_dummy2 = store_regs[index2];
391: asm("movl _index2,r6"); /* r6 = bad register # */
392: asm("movl _sgl_dummy2,r7"); /* r7 = actual value */
393: asm("movl _sgl_dummy1,r8"); /* r8 = expected value */
394: } else
395: if( halt_code == BAD_PSL_HLT ) {
396: asm("movl _init_psl,r6"); /* r6 = initial PSL */
397: asm("movl _psl_val,r7"); /* r7 = final PSL */
398: asm("movl _exp_psl,r8"); /* r8 = expected PSL */
399: };
400: asm("halt"); /* HALT ... */
401: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.