Annotation of cci/d/fpevent/pipe9.c, revision 1.1

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

unix.superglobalmegacorp.com

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