|
|
1.1 root 1:
2: #include "evt_defs.h"
3:
4: /*
5: *********************************************************************
6: * FPP PIPELINED EVENTS TEST #8
7: *
8: * This test will execute the following code: "LDF EXPF CVLF"
9: * with an underflow fault on the EXPF. We will make sure that:
10: * 1. The fault is detected, and
11: * 2. the convert long to float instruction is not executed.
12: *********************************************************************
13: */
14: pipe8()
15: {
16: asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
17: asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
18: precision = SGL;
19: test_event = ARITH_CODE; /* expect an arithmetic fault */
20: exp_code = FLT_UNDFL_CODE; /* - an specificly underflow */
21: exp_event = FALSE; /* ... but not yet */
22: asm("movab _pipe8_ret,_event_return"); /* set event return address */
23: max_index = exf_u_cnt; /* set max operand index */
24: for( index = 0; index < max_index; index++ )
25: {
26: dbl_ld_acc = exf_u_dat[index].op_1; /* get the data */
27: asm(".globl _pipe8_lp1");
28: asm("_pipe8_lp1:");
29: asm("bispsw $0x60"); /* enable ovfl,undfl */
30: asm("ldf _dbl_ld_acc"); /* load the Acc. */
31: exp_event = test_event; /* expect event soon */
32: asm("expf"); /* get undfl. event */
33: asm("cvlf $2"); /* queue the convert */
34: /*
35: * If we got to here then there was no event
36: */
37: if( force_loop )
38: asm("brw _pipe8_lp1");; /* loop on the error */
39: exp_event = FALSE; /* reset event expected flag */
40: asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
41: asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
42: asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
43: no_pipe8_evt();; /* report the error */
44: /*
45: * Come here after the event
46: */
47: asm(".globl _pipe8_ret");
48: asm("_pipe8_ret:");
49: asm("movl _pre_event_fp,fp"); /* restore the frame pointer */
50: asm("movl _pre_event_sp,sp"); /* restore the stack pointer */
51: if( force_loop )
52: asm("brw _pipe8_lp1");; /* loop on the error */
53: asm("bicpsw $0x60"); /* disable ovfl & undfl evts */
54: if( post_evt_acc.m == 0x41000000 ) /* is the Acc. = floating 2? */
55: pipe8_queue_er(); /* queue not cleared error */
56: else if( post_evt_acc.m ) /* is the Acc. non zero? */
57: bad_pipe8_result(); /* incorrect result error */
58:
59: }
60: }
61:
62:
63:
64: /****************************************************************************
65: * Report an "EVENT NOT DETECTED" error
66: *
67: * Cycle: xx. EVT test xx. subtest xx. No underflow fault detected. index = xx
68: * inst = LDD op_1, EXPF, CVLF '2' (underflow fault on EXPF)
69: * op_1 = xxxxxxxx
70: ****************************************************************************/
71: no_pipe8_evt()
72: {
73: errcnt++; /* bump the error count */
74: if ( prt_error )
75: {
76: print_pipe8_er( ". No underflow fault detected." );
77: writes("op_1 = ");
78: write32h( dbl_ld_acc.m );
79: writec('\n');
80: }
81: if ( halt_flg ) /* halt on error? */
82: pipe8_halt( 1 ); /* halt with a code of 1 */
83: if ( loop_on_err )
84: {
85: force_loop = TRUE; /* set the force loop flag */
86: asm("jmp _pipe8_lp1"); /* and loop */
87: };
88: }
89:
90:
91:
92:
93: /****************************************************************************
94: * Report an "BAD ACCUMULATOR AFTER THE EVENT" error
95: *
96: * Cycle: xx. EVT test xx. subtest xx. Bad final Accumulator. index = xx
97: * inst = LDD op_1, EXPF, CVLF '2' (underflow fault on EXPF)
98: * The 'Convert '2' to Floating Point' should not be executed.
99: * op_1 = xxxxxxxx, final Acc. = xxxxxxxx, expected = xxxxxxxx
100: ****************************************************************************/
101: bad_pipe8_result()
102: {
103: errcnt++; /* bump the error count */
104: if ( prt_error )
105: {
106: print_pipe8_er( ". Bad final Accumulator" );
107: writes(
108: "The 'Convert '2' to Floating Point' should not be executed\n");
109: writes("op_1 = ");
110: write32h( dbl_ld_acc.m );
111: writes(", final Acc. = ");
112: write32h( post_evt_acc.m );
113: writes(", expected = ");
114: write32h( 0 ); /* the expected result = 0 */
115: writec('\n');
116: }
117: if ( halt_flg ) /* halt on error? */
118: pipe8_halt( 2 ); /* halt with a code of 2 */
119: if ( loop_on_err )
120: {
121: force_loop = TRUE; /* set the force loop flag */
122: asm("jmp _pipe8_lp1"); /* and loop */
123: };
124: }
125:
126:
127:
128:
129:
130: /****************************************************************************
131: * Report an "FPP queue not cleared" message
132: *
133: * Cycle: xx. EVT test xx. subtest xx. Fpp queue not cleared. index = xx
134: * inst = LDD op_1, EXPF, CVLF '2' (underflow fault on EXPF)
135: * The 'Convert '2' to Floating Point' was apparently executed.
136: * op_1 = xxxxxxxx, final Acc. = xxxxxxxx, expected = xxxxxxxx
137: ****************************************************************************/
138: pipe8_queue_er()
139: {
140: errcnt++; /* bump the error count */
141: if ( prt_error )
142: {
143: print_pipe8_er( ". Fpp queue not cleared" );
144: writes(
145: "The 'Convert '2' to Floating Point' was apparently executed.\n");
146: writes("op_1 = ");
147: write32h( dbl_ld_acc.m );
148: writes(", final Acc. = ");
149: write32h( post_evt_acc.m );
150: writes(", expected = ");
151: write32h( 0 ); /* expected result = 0 */
152: writec('\n');
153: }
154: if ( halt_flg ) /* halt on error? */
155: pipe8_halt( 3 ); /* halt with a code of 3 */
156: if ( loop_on_err )
157: {
158: force_loop = TRUE; /* set the force loop flag */
159: asm("jmp _pipe8_lp1"); /* and loop */
160: };
161: }
162:
163:
164:
165:
166: /****************************************************************************
167: * Report an error message of the form:
168: *
169: * Cycle: xx. EVT test xx. subtest xx. <your message here> index = xx
170: * inst = LDD op_1, EXPF, CVLF '2' (underflow fault on EXPF)
171: ****************************************************************************/
172: print_pipe8_er( msg )
173: char *msg; /* error message to print */
174: {
175: if( errcnt == 1 ) /* 1st error? */
176: writes(" \n"); /* start a new print line */
177: writes("Cycle: ");
178: writed( cycle );
179: writes(" EVT test ");
180: writed( test_no );
181: writes(". subtest ");
182: writed( subtest );
183: writes( msg ); /* print the message */
184: writes(" index = ");
185: writed( index );
186: writes(
187: "\ninst = LDD op_1, EXPF, CVLF '2' (underflow fault on EXPF)\n");
188: }
189:
190:
191:
192: /****************************************************************************
193: * halt on error routine
194: ****************************************************************************/
195: pipe8_halt( code )
196: int code; /* error code to halt with */
197: {
198: err_code = code;
199: sgl_value_1 = dbl_ld_acc.m;
200: sgl_value_2 = post_evt_acc.m;
201: sgl_value_3 = dbl_expected.m;
202: asm("movl _test_no,r0"); /* r0 = test number */
203: asm("movl _subtest,r1"); /* r1 = subtest number */
204: asm("movl _err_code,r2"); /* r2 = error code */
205: asm("movl _cycle,r3"); /* r3 = cycle count */
206: asm("movl _sgl_value_1,r4"); /* r4 = initial operand */
207: asm("movl _sgl_value_2,r5"); /* r5 = final accumulator */
208: asm("movl _sgl_value_3,r6"); /* r6 = expected accumulator */
209: asm("movl _index,r7"); /* r7 = data index */
210: asm("halt"); /* HALT ... */
211: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.