Annotation of cci/d/fpevent/pipe16.c, revision 1.1.1.1

1.1       root        1: 
                      2: #include "evt_defs.h"
                      3: 
                      4: /*
                      5:  *********************************************************************
                      6:  *     FPP PIPELINED EVENTS TEST #16
                      7:  *
                      8:  *  This test will execute the following code: "LDD ADDD STD"
                      9:  * with an overflow fault on the ADDD. We will make sure that:
                     10:  * 1. The fault is detected, 
                     11:  * 2. the accumulator is cleared, and
                     12:  * 3. that a floating '0' is stored by the STD or that there is no store.
                     13:  *********************************************************************
                     14: */
                     15: pipe16()
                     16: {
                     17: #define PIPE16_PAT1 0x11223344
                     18: #define PIPE16_PAT2 0x55667788
                     19:        asm("moval (r13),_pre_event_fp");       /* save the frame pointer */
                     20:        asm("moval (r14),_pre_event_sp");       /* save the stack pointer */
                     21:        precision = DBL;
                     22:        test_event = ARITH_CODE;                /* expect an arithmetic fault */
                     23:        exp_code = FLT_OVFL_CODE;               /*  - specificly overflow     */
                     24:        exp_event = FALSE;                      /* ... but not yet            */
                     25:        asm("movab _pipe16_ret,_event_return"); /* set event return address   */
                     26:        max_index = add_ov_cnt;                 /* set max operand index      */
                     27:        for( index = 0; index < max_index; index++ )
                     28:        {
                     29:             dbl_ld_acc = add_ov_dat[index].op_1;       /* get the Acc data  */
                     30:             dbl_value_1 = add_ov_dat[index].op_2;      /* get the B operand */
                     31:             dbl_value_2.m = PIPE16_PAT1;               /* set the initial   */
                     32:             dbl_value_2.l = PIPE16_PAT2;               /* STD op's contents */
                     33:             asm(".globl _pipe16_lp1");
                     34:             asm("_pipe16_lp1:");
                     35:             asm("bispsw $0x60");                       /* enable ovfl,undfl */
                     36:             asm("ldd _dbl_ld_acc");                    /* load the Acc.     */
                     37:             exp_event = test_event;                    /* expect event soon */
                     38:             asm("addd _dbl_value_1");                  /* trigger the event */
                     39:             asm("std _dbl_value_2");                   /* shouldn't get here*/
                     40: /*
                     41:  * If we got to here then there was no event
                     42: */
                     43:             if( force_loop )
                     44:                  asm("brw _pipe16_lp1");;      /* loop on the error         */
                     45:             exp_event = FALSE;                 /* reset event expected flag */
                     46:             asm("movl _pre_event_fp,fp");      /* restore the frame pointer */
                     47:             asm("movl _pre_event_sp,sp");      /* restore the stack pointer */
                     48:             asm("bicpsw $0x60");               /* disable ovfl & undfl evts */
                     49:             no_pipe16_evt();;                  /* report the error          */
                     50: /*
                     51:  * Come here after the event
                     52: */
                     53:             asm(".globl _pipe16_ret");
                     54:             asm("_pipe16_ret:");
                     55:             asm("movl _pre_event_fp,fp");      /* restore the frame pointer */
                     56:             asm("movl _pre_event_sp,sp");      /* restore the stack pointer */
                     57:             if( force_loop )
                     58:                  asm("brw _pipe16_lp1");;      /* loop on the error         */
                     59:             asm("bicpsw $0x60");               /* disable ovfl & undfl evts */
                     60:             if( (post_evt_acc.m) || (post_evt_acc.l) )  /* is Acc = 0? */
                     61:                  bad_pipe16_result();          /* incorrect result error    */
                     62:             else if( ( (dbl_value_2.m) ||
                     63:                        (dbl_value_2.l) )       /* either a '0' s/b stored,  */
                     64:                   && (dbl_value_2.m != 0x80000000)  /* or a RESERVED OP, or */
                     65:                   && ( (dbl_value_2.m != PIPE16_PAT1) || /* there s/b no    */
                     66:                        (dbl_value_2.l != PIPE16_PAT2) ) )  /* store at all  */
                     67:                  bad_pipe16_store();           /* incorrect store error     */
                     68:        }
                     69: }
                     70: 
                     71: 
                     72: 
                     73: /****************************************************************************
                     74: *              Report an "EVENT NOT DETECTED" error
                     75: *
                     76: * Cycle: xx. EVT test xx. subtest xx. No overflow fault seen. index = xx
                     77: * inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
                     78: * op1 = xxxxxxxx xxxxxxxx,   initial op3 = xxxxxxxx xxxxxxxx
                     79: * op2 = xxxxxxxx xxxxxxxx,     final op3 = xxxxxxxx xxxxxxxx
                     80: ****************************************************************************/
                     81: no_pipe16_evt()
                     82: {
                     83:        errcnt++;                               /* bump the error count    */
                     84:        if ( prt_error ) 
                     85:        {
                     86:             sgl_value_1 = PIPE16_PAT1;
                     87:             sgl_value_2 = PIPE16_PAT2;
                     88:             print_pipe16_er( ". No overflow fault seen." );
                     89:             writes("op1 = ");
                     90:             write32h( dbl_ld_acc.m );
                     91:             writec(' ');
                     92:             write32h( dbl_ld_acc.l );
                     93:             writes(",   initial op3 = ");
                     94:             write32h( sgl_value_1 );
                     95:             writec(' ');
                     96:             write32h( sgl_value_2 );
                     97:             writes("\nop2 = ");
                     98:             write32h( dbl_value_1.m );
                     99:             writec(' ');
                    100:             write32h( dbl_value_1.l );
                    101:             writes(",     final op3 = ");
                    102:             write32h( dbl_value_2.m );
                    103:             writec(' ');
                    104:             write32h( dbl_value_2.l );
                    105:             writec('\n');
                    106:        }
                    107:        if ( halt_flg )                         /* halt on error?          */
                    108:             pipe16_halt( 1 );                  /* halt with a code of 1   */
                    109:        if ( loop_on_err ) 
                    110:        {
                    111:             force_loop = TRUE;                 /* set the force loop flag */
                    112:             asm("jmp _pipe16_lp1");            /* and loop                */
                    113:        };
                    114: }
                    115: 
                    116: 
                    117: 
                    118: 
                    119: /****************************************************************************
                    120: *              Report an "BAD ACCUMULATOR AFTER THE EVENT" error
                    121: *
                    122: * Cycle: xx. EVT test xx. subtest xx. Bad final Accumulator. index = xx
                    123: * inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
                    124: * op1 = xxxxxxxx xxxxxxxx,  final Acc = xxxxxxxx xxxxxxxx
                    125: * op2 = xxxxxxxx xxxxxxxx,   expected = xxxxxxxx xxxxxxxx
                    126: * init op3 = xxxxxxxx xxxxxxxx,  final op3 = xxxxxxxx xxxxxxxx
                    127: ****************************************************************************/
                    128: bad_pipe16_result()
                    129: {
                    130:        errcnt++;                               /* bump the error count    */
                    131:        if ( prt_error ) 
                    132:        {
                    133:             sgl_value_1 = PIPE16_PAT1;
                    134:             sgl_value_2 = PIPE16_PAT2;
                    135:             print_pipe16_er( ". Bad final Accumulator" );
                    136:             writes("op1 = ");
                    137:             write32h( dbl_ld_acc.m );
                    138:             writec(' ');
                    139:             write32h( dbl_ld_acc.l );
                    140:             writes(", final Acc. = ");
                    141:             write32h( post_evt_acc.l );
                    142:             writec(' ');
                    143:             write32h( post_evt_acc.l );
                    144:             writes("\nop2 = ");
                    145:             write32h( dbl_value_1.m );
                    146:             writec(' ');
                    147:             write32h( dbl_value_1.l );
                    148:             writes(",   expected = ");
                    149:             write32h( 0 );                     /* the expected result = 0 */
                    150:             writec(' ');
                    151:             write32h( 0 );
                    152:             writes("\ninit op3 = ");
                    153:             write32h( sgl_value_1 );
                    154:             writec(' ');
                    155:             write32h( sgl_value_2 );
                    156:             writes(",  final op3 = ");
                    157:             write32h( dbl_value_2.m );
                    158:             writec(' ');
                    159:             write32h( dbl_value_2.l );
                    160:             writec('\n');
                    161:        }
                    162:        if ( halt_flg )                         /* halt on error?           */
                    163:             pipe16_halt( 2 );                  /* halt with a code of 2    */
                    164:        if ( loop_on_err ) 
                    165:        {
                    166:             force_loop = TRUE;                 /* set the force loop flag */
                    167:             asm("jmp _pipe16_lp1");            /* and loop                */
                    168:        };
                    169: }
                    170: 
                    171: 
                    172: 
                    173: 
                    174: 
                    175: /****************************************************************************
                    176: *              Report an "BAD VALUE STORED INTO OPERAND 3" error
                    177: *
                    178: * Cycle: xx. EVT test xx. subtest xx. Bad STD OP3 result. index = xx
                    179: * inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
                    180: *      op1 = xxxxxxxx xxxxxxxx,     final Acc = xxxxxxxx xxxxxxxx
                    181: *      op2 = xxxxxxxx xxxxxxxx,  expected op3 = xxxxxxxx xxxxxxxx
                    182: * init op3 = xxxxxxxx xxxxxxxx,     final op3 = xxxxxxxx xxxxxxxx
                    183: ****************************************************************************/
                    184: bad_pipe16_store()
                    185: {
                    186:        errcnt++;                               /* bump the error count    */
                    187:        if ( prt_error ) 
                    188:        {
                    189:             sgl_value_1 = PIPE16_PAT1;
                    190:             sgl_value_2 = PIPE16_PAT2;
                    191:             print_pipe16_er( ".  Bad STD OP3 result" );
                    192:             writes("     op1 = ");
                    193:             write32h( dbl_ld_acc.m );
                    194:             writec(' ');
                    195:             write32h( dbl_ld_acc.l );
                    196:             writes(",    final Acc. = ");
                    197:             write32h( post_evt_acc.l );
                    198:             writec(' ');
                    199:             write32h( post_evt_acc.l );
                    200:             writes("\n     op2 = ");
                    201:             write32h( dbl_value_1.m );
                    202:             writec(' ');
                    203:             write32h( dbl_value_1.l );
                    204:             writes(",  expected op3 = ");
                    205:             write32h( 0x80000000 );            /* the expected result = 0 */
                    206:             writec(' ');
                    207:             write32h( 0 );
                    208:             writes("\ninit op3 = ");
                    209:             write32h( sgl_value_1 );
                    210:             writec(' ');
                    211:             write32h( sgl_value_2 );
                    212:             writes(",     final op3 = ");
                    213:             write32h( dbl_value_2.m );
                    214:             writec(' ');
                    215:             write32h( dbl_value_2.l );
                    216:             writec('\n');
                    217:        }
                    218:        if ( halt_flg )                         /* halt on error?           */
                    219:             pipe16_halt( 3 );                  /* halt with a code of 2    */
                    220:        if ( loop_on_err ) 
                    221:        {
                    222:             force_loop = TRUE;                 /* set the force loop flag */
                    223:             asm("jmp _pipe16_lp1");            /* and loop                */
                    224:        };
                    225: }
                    226: 
                    227: 
                    228: 
                    229: 
                    230: 
                    231: 
                    232: /****************************************************************************
                    233: *              Report an error message of the form:
                    234: *
                    235: * Cycle: xx. EVT test xx. subtest xx. <your message here>. index = xx
                    236: * inst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)
                    237: ****************************************************************************/
                    238: print_pipe16_er( msg )
                    239: char *msg;                                     /* error message to print   */
                    240: {
                    241:             if( errcnt == 1 )                  /* 1st error?               */
                    242:                  writes(" \n");                /* start a new print line   */
                    243:             writes("Cycle: ");
                    244:             writed( cycle );
                    245:             writes("  EVT test ");
                    246:             writed( test_no );
                    247:             writes(". subtest ");
                    248:             writed( subtest );
                    249:             writes( msg );                     /* print the message */
                    250:             writes(". index = ");
                    251:             writed( index );
                    252:             writes(
                    253:     "\ninst = LDD op1, ADDD op2, STD op3    (overflow fault on the ADDD)\n");
                    254: }
                    255: 
                    256: 
                    257: 
                    258: /****************************************************************************
                    259: *              halt on error routine
                    260: ****************************************************************************/
                    261: pipe16_halt( code )
                    262: int code;                              /* error code to halt with */
                    263: {
                    264:        err_code = code;
                    265:        sgl_value_1 = dbl_ld_acc.m;
                    266:        sgl_value_2 = dbl_ld_acc.l;
                    267:        sgl_value_3 = dbl_value_1.m;
                    268:        sgl_value_4 = dbl_value_1.l;
                    269:        sgl_value_5 = post_evt_acc.m;
                    270:        sgl_value_6 = post_evt_acc.l;
                    271:        sgl_value_7 = dbl_value_2.m;
                    272:        sgl_value_8 = dbl_value_2.l;
                    273:        asm("movl _test_no,r0");                /* r0  = test number       */
                    274:        asm("movl _subtest,r1");                /* r1  = subtest number    */
                    275:        asm("movl _err_code,r2");               /* r2  = error code        */
                    276:        asm("movl _cycle,r3");                  /* r3  = cycle count       */
                    277:        asm("movl _sgl_value_1,r4");            /* r4  = MSW of operand 1  */
                    278:        asm("movl _sgl_value_2,r5");            /* r5  = LSW of operand 1  */
                    279:        asm("movl _sgl_value_3,r6");            /* r6  = MSW of operand 2  */
                    280:        asm("movl _sgl_value_4,r7");            /* r7  = LSW of operand 2  */
                    281:        asm("movl _sgl_value_5,r8");            /* r8  = MSW of final Acc. */
                    282:        asm("movl _sgl_value_6,r9");            /* r9  = LSW of final Acc. */
                    283:        asm("clrl r10");                        /* r10 = 0 (expected Acc.) */
                    284:        asm("movl _sgl_value_7,r11");           /* r11 = MSW of store data */
                    285:        asm("movl _sgl_value_8,r12");           /* r12 = LSW of store data */
                    286:        asm("movl _index,r13");                 /* r13 = data index        */
                    287:        asm("halt");                            /* HALT ...                */
                    288: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.