|
|
1.1 root 1:
2: #include "evt_defs.h"
3:
4: /*
5: *********************************************************************
6: * FPP PIPELINED EVENTS TEST #15
7: *
8: * This test will execute the following code: "LDF MULF STF"
9: * with an overflow fault on the MULF. We will make sure that:
10: * 1. The fault is detected,
11: * 2. the accumulator is cleared, and
12: * 3. a floating '0' is stored if anything.
13: *********************************************************************
14: */
15: pipe15()
16: {
17: #define PIPE15_PAT 0x12341234
18: asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
19: asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
20: precision = SGL;
21: test_event = ARITH_CODE; /* expect an arithmetic fault */
22: exp_code = FLT_OVFL_CODE; /* - specificly overflow */
23: exp_event = FALSE; /* ... but not yet */
24: asm("movab _pipe15_ret,_event_return"); /* set event return address */
25: max_index = muf_ov_cnt; /* set max operand index */
26: for( index = 0; index < max_index; index++ ) {
27: dbl_ld_acc = muf_ov_dat[index].op_1; /* get the Acc data */
28: dbl_value_1 = muf_ov_dat[index].op_2; /* get the '0' data */
29: dbl_value_2.m = PIPE15_PAT; /* background for STF*/
30: asm(".globl _pipe15_lp1");
31: asm("_pipe15_lp1:");
32: asm("bispsw $0x60"); /* enable ovfl & undfl events*/
33: asm("ldf _dbl_ld_acc"); /* load the Acc. */
34: exp_event = test_event; /* set the expect event flag */
35: asm("mulf _dbl_value_1"); /* trigger the event */
36: asm("stf _dbl_value_2"); /* FPP stores before the evt.*/
37: /*
38: * If we got to here then there was no event
39: */
40: if( force_loop )
41: asm("jmp _pipe15_lp1");; /* loop on the error */
42: exp_event = FALSE; /* reset event expected flag */
43: asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
44: asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
45: asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
46: no_pipe15_evt();; /* report the error */
47: /*
48: * Come here after the event
49: */
50: asm(".globl _pipe15_ret");
51: asm("_pipe15_ret:");
52: asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
53: asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
54: if( force_loop )
55: asm("jmp _pipe15_lp1");; /* loop on the error */
56: asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
57: if( post_evt_acc.m ) /* was the Acc cleared? */
58: bad_pipe15_result(); /* incorrect result error */
59: else if( (dbl_value_2.m ) && /* either a ZERO s/b stored, */
60: (dbl_value_2.m != 0x80000000) && /* or a RESERVED OP, */
61: (dbl_value_2.m != PIPE15_PAT) ) /* or no store at all */
62: bad_pipe15_store(); /* incorrect store error */
63: }
64: }
65:
66:
67:
68: /****************************************************************************
69: * Report an "EVENT NOT DETECTED" error
70: *
71: * Cycle: xx. EVT test xx. subtest xx. No overflow fault seen. index = xx
72: * inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
73: * op1 = xxxxxxxx, op2 = xxxxxxxx, init op3 = xxxxxxxx, final op3 = xxxxxxxx
74: ****************************************************************************/
75: no_pipe15_evt()
76: {
77: errcnt++; /* bump the error count */
78: if ( prt_error )
79: {
80: print_pipe15_er( ". No overflow fault seen" );
81: writes("op1 = ");
82: write32h( dbl_ld_acc.m );
83: writes(", op2 = ");
84: write32h( dbl_value_1.m );
85: writes(", init op3 = ");
86: write32h( PIPE15_PAT );
87: writes(", final op3 = ");
88: write32h( dbl_value_2.m );
89: writec('\n');
90: }
91: if ( halt_flg ) /* halt on error? */
92: pipe15_halt( 1 ); /* halt with a code of 1 */
93: if ( loop_on_err )
94: {
95: force_loop = TRUE; /* set the force loop flag */
96: asm("jmp _pipe15_lp1"); /* and loop */
97: };
98: }
99:
100:
101:
102:
103: /****************************************************************************
104: * Report an "BAD ACCUMULATOR AFTER THE EVENT" error
105: *
106: * Cycle: xx. EVT test xx. subtest xx. Bad final Accumulator. index = xx
107: * inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
108: * op1 = xxxxxxxx, final Acc. = xxxxxxxx, initial op3 = xxxxxxxx
109: * op2 = xxxxxxxx, expected = xxxxxxxx, final op3 = xxxxxxxx
110: ****************************************************************************/
111: bad_pipe15_result()
112: {
113: errcnt++; /* bump the error count */
114: if ( prt_error )
115: {
116: print_pipe15_er( ". Bad final Accumulator" );
117: writes("op1 = ");
118: write32h( dbl_ld_acc.m );
119: writes(", final Acc. = ");
120: write32h( post_evt_acc.m );
121: writes(", initial op3 = ");
122: write32h( PIPE15_PAT );
123: writes("\nop2 = ");
124: write32h( dbl_value_1.m );
125: writes(", expected = ");
126: write32h( 0 ); /* the expected result = 0 */
127: writes(", final op3 = ");
128: write32h( dbl_value_2.m );
129: writec('\n');
130: }
131: if ( halt_flg ) /* halt on error? */
132: pipe15_halt( 2 ); /* halt with a code of 2 */
133: if ( loop_on_err )
134: {
135: force_loop = TRUE; /* set the force loop flag */
136: asm("jmp _pipe15_lp1"); /* and loop */
137: };
138: }
139:
140:
141:
142:
143: /****************************************************************************
144: * Report a "BAD RESULT STORED AFTER THE EVENT" error
145: *
146: * Cycle: xx. EVT test xx. subtest xx. Bad STF OP3 result. index = xx
147: * inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
148: * op1 = xxxxxxxx, initial op3 = xxxxxxxx, final Acc. = xxxxxxxx
149: * op2 = xxxxxxxx, final op3 = xxxxxxxx, op3 expected = xxxxxxxx
150: ****************************************************************************/
151: bad_pipe15_store()
152: {
153: errcnt++; /* bump the error count */
154: if ( prt_error )
155: {
156: print_pipe15_er( ". Bad STF OP3 result" );
157: writes("op1 = ");
158: write32h( dbl_ld_acc.m );
159: writes(", initial op3 = ");
160: write32h( PIPE15_PAT );
161: writes(", final Acc. = ");
162: write32h( post_evt_acc.m );
163: writes("\nop2 = ");
164: write32h( dbl_value_1.m );
165: writes(", final op3 = ");
166: write32h( dbl_value_2.m );
167: writes(", op3 expected = 80000000\n"); /* exp = Reserved Op */
168: }
169: if ( halt_flg ) /* halt on error? */
170: pipe15_halt( 3 ); /* halt with a code of 2 */
171: if ( loop_on_err )
172: {
173: force_loop = TRUE; /* set the force loop flag */
174: asm("jmp _pipe15_lp1"); /* and loop */
175: };
176: }
177:
178:
179:
180:
181:
182:
183: /****************************************************************************
184: * Report an error message of the form:
185: *
186: * Cycle: xx. EVT test xx. subtest xx. <your message here>. index = xx
187: * inst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)
188: ****************************************************************************/
189: print_pipe15_er( msg )
190: char *msg; /* error message to print */
191: {
192: if( errcnt == 1 ) /* 1st error? */
193: writes(" \n"); /* start a new print line */
194: writes("Cycle: ");
195: writed( cycle );
196: writes(" EVT test ");
197: writed( test_no );
198: writes(". subtest ");
199: writed( subtest );
200: writes( msg ); /* print the message */
201: writes(". index = ");
202: writed( index );
203: writes(
204: "\ninst = LDF op1, MULF op2, STF op3 (overflow fault on the MULF)\n");
205: }
206:
207:
208:
209: /****************************************************************************
210: * halt on error routine
211: ****************************************************************************/
212: pipe15_halt( code )
213: int code; /* error code to halt with */
214: {
215: err_code = code;
216: sgl_value_1 = dbl_ld_acc.m;
217: sgl_value_2 = dbl_value_1.m;
218: sgl_value_3 = post_evt_acc.m;
219: sgl_value_4 = PIPE15_PAT;
220: sgl_value_5 = dbl_value_2.m;
221: asm("movl _test_no,r0"); /* r0 = test number */
222: asm("movl _subtest,r1"); /* r1 = subtest number */
223: asm("movl _err_code,r2"); /* r2 = error code */
224: asm("movl _cycle,r3"); /* r3 = cycle count */
225: asm("movl _sgl_value_1,r4"); /* r4 = initial acc. */
226: asm("movl _sgl_value_2,r5"); /* r5 = MULF operand */
227: asm("movl _sgl_value_3,r6"); /* r6 = final acc. */
228: asm("clrl r7"); /* r7 = expected acc. */
229: asm("movl _sgl_value_4,r8"); /* r8 = initial op3 value */
230: asm("movl _sgl_value_5,r9"); /* r9 = final op3 value */
231: asm("clrl r10"); /* r10 = expected op3 value */
232: asm("movl _index,r11"); /* r11 = data index */
233: asm("halt"); /* HALT ... */
234: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.