|
|
1.1 root 1: #include "fpp_defs.h"
2:
3:
4:
5: /***************************************************************************
6: *
7: * CMPD -COMPARE SGL ACCUMULATOR TO SGL OPERAND
8: *
9: *****************************************************************************/
10: cmpd()
11: {
12: asm(".globl _cmpd_t");
13: asm("_cmpd_t:"); /* entry address */
14: if( ( cycle == 1 ) && ( prt_hdrs ) ) /* print headers on 1st pass */
15: {
16: writes(" CMPD");
17: }
18: cmpd_1(); /* test via registers */
19: cmpd_2(); /* test via cache */
20: cmpd_3(); /* register corruption test */
21: cmpd_4(); /* acc. corruption test */
22: asm("jmp *return"); /* return to the test monitor */
23: }
24:
25:
26:
27: /****************************************************************************
28: *
29: * SUBTEST 1 - CMPD status test -register data
30: *
31: ****************************************************************************/
32: cmpd_1()
33: {
34: force_loop = FALSE;
35: subtest = 1;
36: index = 0;
37: do
38: {
39: dbl_value_1 = cmpd_1_data[index].one; /* get the data operands */
40: dbl_value_2 = cmpd_1_data[index].two;
41: sgl_expected = cmpd_1_data[index].flag; /* get expected results */
42: sgl_value_1 = dbl_value_1.m;
43: sgl_value_2 = dbl_value_1.l;
44: sgl_value_3 = dbl_value_2.m;
45: sgl_value_4 = dbl_value_2.l;
46: status_index = 0; /* clear the status index */
47: do
48: {
49: sgl_dummy1 = status_array[status_index]; /* array = +, -, 0 */
50: /*
51: * If LOOP ON ERROR is set, this is the loop for this subtest.
52: * The force loop flag is set after the first error.
53: */
54: asm("_cmpd_1_lp1:");
55: asm("movl _sgl_value_1,r4"); /* move operand #1 to r4 */
56: asm("movl _sgl_value_2,r5"); /* move operand #1 to r5 */
57: asm("movl _sgl_value_3,r6"); /* move operand #2 to r6 */
58: asm("movl _sgl_value_4,r7"); /* move operand #2 to r7 */
59: asm("ldd r4"); /* load the operand */
60: asm("tstl _sgl_dummy1"); /* generate initial status */
61: asm("movpsl _init_psl"); /* save the initial status */
62: asm("cmpd r6"); /* compare the operands */
63: asm("movpsl _psl_val"); /* save the final status */
64: if( force_loop ) /* loop? */
65: asm("brb _cmpd_1_lp1");; /* run the loop again */
66: exp_psl = init_psl; /* get the initial PSL */
67: exp_psl &= 0xfffffff3; /* clear ZERO, NEGATIVE */
68: if( sgl_expected == ZERO )
69: exp_psl |= PSL_Z; /* expect the ZERO bit set */
70: if( sgl_expected == NEGATIVE )
71: exp_psl |= PSL_N; /* expect the NEG bit set */
72: if( psl_val != exp_psl ) { /* COMPARE the values */
73: errcnt++; /* bump the error count */
74: if ( prt_error ) {
75: writes(" \n"); /* start a new print line */
76: writes("cycle: ");
77: writed( cycle );
78: writes(" CMPD test ");
79: writed( test_no );
80: writes(", subtest 1 (Reg. Data) - BAD FINAL PSL\n");
81: print_cmpd_data();
82: writes(", index = ");
83: writed( index );
84: writes("\ninitial PSL = ");
85: write32h( init_psl );
86: writes(", final PSL = ");
87: write32h( psl_val );
88: writes(", expected PSL = ");
89: write32h( exp_psl );
90: writes("\n");
91: }
92: if ( halt_flg )
93: cmpd_er_halt( BAD_PSL_HLT );/* halt on the error */
94: if ( loop_on_err ) {
95: force_loop = TRUE; /* set the force loop flag */
96: asm("brw _cmpd_1_lp1"); /* and loop on the error */
97: } /* end of loop on error */
98: } /* end of compare error */
99: } while( ++status_index < 3 ); /* end of WHILE loop */
100: } while ( index++ < max_cmpd_1_index ); /* end of WHILE loop */
101: } /* end of subtest 1 */
102:
103:
104:
105: /****************************************************************************
106: *
107: * SUBTEST 2 - CMPD status test -cache data
108: *
109: ****************************************************************************/
110: cmpd_2()
111: {
112: force_loop = FALSE;
113: subtest = 2;
114: index = 0;
115: do
116: {
117: dbl_value_1 = cmpd_1_data[index].one; /* get the data operands */
118: dbl_value_2 = cmpd_1_data[index].two;
119: sgl_expected = cmpd_1_data[index].flag;/* get expected results */
120: status_index = 0; /* clear the status index */
121: do
122: {
123: sgl_dummy1 = status_array[status_index]; /* array = +, -, 0 */
124: /*
125: * If LOOP ON ERROR is set, this is the loop for this subtest.
126: * The force loop flag is set after the first error.
127: */
128: asm("_cmpd_2_lp1:");
129: asm("ldd _dbl_value_1"); /* load the 1st operand */
130: asm("tstl _sgl_dummy1"); /* generate initial status */
131: asm("movpsl _init_psl"); /* save the initial status */
132: asm("cmpd _dbl_value_2"); /* compare the operands */
133: asm("movpsl _psl_val"); /* save the final status */
134: if( force_loop ) /* loop? */
135: asm("brb _cmpd_2_lp1");; /* run the loop again */
136: exp_psl = init_psl; /* get the initial PSL */
137: exp_psl &= 0xfffffff3; /* clear ZERO, NEGATIVE */
138: if( sgl_expected == ZERO )
139: exp_psl |= PSL_Z; /* expect the ZERO bit set */
140: if( sgl_expected == NEGATIVE )
141: exp_psl |= PSL_N; /* expect the NEG bit set */
142: if( psl_val != exp_psl ) { /* COMPARE the values */
143: errcnt++; /* bump the error count */
144: if ( prt_error ) {
145: writes(" \n"); /* start a new print line */
146: writes("cycle: ");
147: writed( cycle );
148: writes(" CMPD test ");
149: writed( test_no );
150: writes(", subtest 2 (Cache Data) - BAD FINAL PSL\n");
151: print_cmpd_data();
152: writes(", index = ");
153: writed( index );
154: writes("\ninitial PSL = ");
155: write32h( init_psl );
156: writes(", final PSL = ");
157: write32h( psl_val );
158: writes(", expected PSL = ");
159: write32h( exp_psl );
160: writes("\n");
161: }
162: if ( halt_flg )
163: cmpd_er_halt( BAD_PSL_HLT ); /* halt on the error */
164: if ( loop_on_err ) {
165: force_loop = TRUE; /* set the force loop flag */
166: asm("brw _cmpd_2_lp1"); /* and loop on the error */
167: } /* end of loop on error */
168: } /* end of compare error */
169: } while( ++status_index < 3 ); /* end of WHILE loop */
170: } while ( index++ < max_cmpd_1_index ); /* end of WHILE loop */
171: } /* end of subtest 2 */
172:
173:
174:
175: /************************************************************************
176: *
177: * SUBTEST 3 - Check for register corruption
178: *
179: ************************************************************************/
180: cmpd_3()
181: {
182: force_loop = FALSE; /* clear force_loop flg */
183: subtest = 3;
184: fill_reg_buf( load_regs ); /* get pattern for regs */
185: index = 0;
186: do
187: {
188: dbl_value_1 = cmpd_1_data[index].one; /* data to load */
189: dbl_value_2 = cmpd_1_data[index].two; /* data to compare */
190: dbl_expected = cmpd_1_data[index].one; /* expected result */
191: /*
192: * If LOOP ON ERROR is set, this is the loop for this subtest.
193: * The force loop flag is set after the first error.
194: */
195: asm("_cmpd_3_lp1:");
196: asm("ldd _dbl_value_1"); /* LOAD the accumulator */
197: asm("nop");
198: asm("loadr $0x1fff,_load_regs"); /* load regs 0 - 12 */
199: asm("nop");
200: asm("cmpd _dbl_value_2"); /* test the values */
201: asm("nop");
202: asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */
203: if( force_loop ) /* loop? */
204: asm("brb _cmpd_3_lp1");; /* run the loop again */
205: /*
206: * Now compare the stored register values to those that were loaded
207: */
208: index2 = 0;
209: while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) )
210: index2++; /* check reg values */
211: if( index2 < 13 ) { /* error if index2 < 13 */
212: errcnt++; /* bump the error count */
213: if ( prt_error ) {
214: writes(" \n"); /* start a new print line */
215: writes("cycle: ");
216: writed( cycle );
217: writes(", CMPD test ");
218: writed( test_no );
219: writes(", subtest 3 - A REGISTER WAS MODIFIED\n");
220: print_cmpd_data(); /* print the operands */
221: writes("\n");
222: writes("register "); /* print the information */
223: writed( index2 ); /* about the corrupted */
224: writes(" = "); /* register */
225: write32h( store_regs[index2] );
226: writes(", should be = ");
227: write32h( load_regs[index2] );
228: writes("\n");
229: }
230: if ( halt_flg ) /* halt on error? */
231: cmpd_er_halt( BAD_REG_HLT ); /* PC after halt */
232: if ( loop_on_err ) {
233: force_loop = TRUE; /* set force loop flag */
234: asm("brw _cmpd_3_lp1"); /* and loop on error */
235: } /* end of loop on error */
236: } /* end of register corruption error */
237: } while ( index++ < max_cmpd_1_index ); /* end of WHILE loop */
238: } /* end of subtest 3 */
239:
240:
241:
242: /************************************************************************
243: *
244: * SUBTEST 4 - Check for accumulator corruption
245: *
246: ************************************************************************/
247: cmpd_4()
248: {
249: force_loop = FALSE; /* clear force_loop flg */
250: index = 0;
251: do
252: {
253: dbl_value_1 = cmpd_1_data[index].one; /* data to load */
254: dbl_value_2 = cmpd_1_data[index].two;
255: dbl_expected = cmpd_1_data[index].one; /* expected result */
256: if( !(dbl_value_1.m & 0x7f800000) ) { /* */
257: dbl_expected.m = 0; /* */
258: dbl_expected.l = 0; /* ignore bad 0's */
259: } /* */
260: sgl_value_1 = dbl_value_1.m;
261: sgl_value_2 = dbl_value_1.l;
262: sgl_value_3 = dbl_value_2.m;
263: sgl_value_4 = dbl_value_2.l;
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("_cmpd_4_lp1:");
269: asm("movl _sgl_value_1,r4"); /* r4 = operand #1's MSW */
270: asm("movl _sgl_value_2,r5"); /* r5 = operand #1's LSW */
271: asm("movl _sgl_value_3,r6"); /* r6 = operand #2's MSW */
272: asm("movl _sgl_value_4,r7"); /* r7 = operand #2's LSW */
273: asm("ldd r4"); /* store the accumulator */
274: asm("cmpd r6"); /* test the values */
275: asm("std r8"); /* store the accumulator */
276: if( force_loop ) /* loop? */
277: asm("brb _cmpd_4_lp1");; /* run the loop again */
278: asm("movl r8,_sgl_value_5"); /* move results to cache */
279: asm("movl r9,_sgl_value_6");
280: if ( (sgl_value_5 != dbl_expected.m) || /* COMPARE the values */
281: (sgl_value_6 != dbl_expected.l) ){
282: errcnt++; /* bump the error count */
283: if ( prt_error ) {
284: writes(" \n"); /* start a new print line */
285: writes("cycle: ");
286: writed( cycle );
287: writes(", CMPD test ");
288: writed( test_no );
289: writes(", subtest 4 - THE ACC WAS MODIFIED\n");
290: print_cmpd_data();
291: writes(", index = ");
292: writed( index );
293: writec('\n');
294: writes(" final Acc = ");
295: write32h( sgl_value_5 );
296: writec(' ');
297: write32h( sgl_value_6 );
298: writec('\n');
299: writes(" expected = ");
300: write32h( dbl_expected.m );
301: writec(' ');
302: write32h( dbl_expected.l );
303: writec('\n');
304: }
305: if ( halt_flg ) /* halt on error? */
306: cmpd_er_halt( BAD_ACC_HLT ); /* halt on the error */
307: if ( loop_on_err ) {
308: force_loop = TRUE; /* set the force loop flag */
309: asm("brw _cmpd_4_lp1"); /* and loop on the error */
310: } /* end of loop on error */
311: } /* end of compare error */
312: } while ( index++ < max_cmpd_1_index ); /* end of WHILE loop */
313: } /* end of subtest 4 */
314:
315:
316:
317: /**************************************************************************
318: *
319: * PRINT THE DATA AND STORE RESULTS
320: *
321: * initial Acc = xxxxxxxx xxxxxxxx, operand = xxxxxxxx xxxxxxxx
322: **************************************************************************/
323: print_cmpd_data()
324: {
325: writes("initial Acc = ");
326: write32h( dbl_value_1.m );
327: writec(' ');
328: write32h( dbl_value_1.l );
329: writes(" operand = ");
330: write32h( dbl_value_2.m );
331: writec(' ');
332: write32h( dbl_value_2.l );
333: }
334:
335:
336:
337: /**************************************************************************
338: *
339: * HALT ON ERROR ROUTINE
340: *
341: **************************************************************************/
342: cmpd_er_halt( halt_code )
343: int halt_code;
344: {
345: sgl_value_1 = dbl_value_1.m;
346: sgl_value_2 = dbl_value_1.l;
347: sgl_value_3 = dbl_value_2.m;
348: sgl_value_4 = dbl_value_2.l;
349: sgl_value_5 = dbl_st_acc.m;
350: sgl_value_6 = dbl_st_acc.l;
351: sgl_dummy1 = halt_code; /* get the error type */
352: asm("movl _test_no,r0"); /* r0 = test number */
353: asm("movl _subtest,r1"); /* r1 = subtest number */
354: asm("movl _sgl_dummy1,r2"); /* r2 = error code */
355: asm("movl _cycle,r3"); /* r3 = cycle count */
356: asm("movl _sgl_value_1,r4"); /* r4 = MS operand 1 */
357: asm("movl _sgl_value_2,r5"); /* r5 = LS operand 1 */
358: asm("movl _sgl_value_3,r6"); /* r6 = MS operand 2 */
359: asm("movl _sgl_value_4,r7"); /* r7 = MS operand 2 */
360: asm("movl _psl_val,r8"); /* r8 = actual PSL */
361: if( halt_code == BAD_ACC_HLT ) {
362: sgl_value_1 = dbl_expected.m;
363: sgl_value_2 = dbl_expected.l;
364: asm("movl _sgl_value_5,r9"); /* r9 = MS stored */
365: asm("movl _sgl_value_6,r10"); /* r10 = LS stored */
366: asm("movl _sgl_value_1,r11"); /* r11 = MS expected */
367: asm("movl _sgl_value_2,r12"); /* r12 = LS expected */
368: } else
369: if( halt_code == BAD_REG_HLT ) {
370: sgl_dummy1 = load_regs[index2];
371: sgl_dummy2 = store_regs[index2];
372: asm("movl _index2,r9"); /* r9 = bad register # */
373: asm("movl _sgl_dummy2,r10"); /* r10 = actual value */
374: asm("movl _sgl_dummy1,r11"); /* r11 = expected value */
375: } else
376: if( halt_code == BAD_PSL_HLT ) {
377: asm("movl _exp_psl,r9"); /* r9 = expected PSL */
378: asm("movl _index,r10"); /* r10 = data index */
379: };
380: asm("halt"); /* HALT ... */
381: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.