Annotation of cci/d/macro4/mtpr.c, revision 1.1

1.1     ! root        1: 
        !             2: #include "fpp_defs.h"
        !             3: 
        !             4: #define TBL_SIZE 1024          /* size of the prom table */
        !             5: 
        !             6: /*****************************************************************************
        !             7: *
        !             8: *               MTPR - TEST THE "READ TABLE DATA" MTPR INSTRUCTION
        !             9: *
        !            10: *   This test checks the ability to use an MTPR to the Diagnostic Control
        !            11: *   Register (DCR) to read an entry in the FPP tables.
        !            12: *
        !            13: *   The instruction is:
        !            14: *       MTPR $2048,$DCR
        !            15: *       R0 = the table address to check
        !            16: *
        !            17: *   The MTPR instruction will put the table data into R1.
        !            18: *
        !            19: *****************************************************************************/
        !            20: mtpr_tst()
        !            21: {
        !            22:         asm(".globl _mtpr_t");
        !            23:         asm("_mtpr_t:");                        /* entry address            */
        !            24:         if( (cycle == 1) && (prt_hdrs) )        /* print headers on 1st cycle */
        !            25:            writes(" MTPR");
        !            26:         mtpr_1();                               /* read w/ sgl accumulator  */
        !            27:         mtpr_2();                               /* read w/ dbl accumulator  */
        !            28:         mtpr_3();                               /* read during "sinf"       */
        !            29:         asm("jmp *return");                     /* return to the test monitor */
        !            30: }
        !            31: 
        !            32: 
        !            33: 
        !            34: /************************************************************************
        !            35: *
        !            36: *       SUBTEST 1 - Read the tables with a single precision accumulator
        !            37: *
        !            38: ************************************************************************/
        !            39: mtpr_1() 
        !            40: {
        !            41:         force_loop = FALSE;
        !            42:        subtest = 1;
        !            43:         index = 0;
        !            44:         for( sgl_value_1 = 0; sgl_value_1 < TBL_SIZE; sgl_value_1++ ) { 
        !            45:              sgl_ld_acc   = ldf_1_data[index].ld;      /* get a sgl value   */
        !            46:              sgl_expected = ldf_1_data[index].exp;     /* & expected acc.   */
        !            47: /*
        !            48:  * If LOOP ON ERROR is set, this is the loop for this subtest.
        !            49:  * The force loop flag is set after the first error.
        !            50: */
        !            51:              asm("_mtpr_1_lp1:");
        !            52:              asm("ldf _sgl_ld_acc");            /* load the accumulator     */
        !            53:              asm("movl _sgl_value_1,r0");       /* move table address to r0 */
        !            54:              asm("clrl r1");                    /* clear R1                 */
        !            55:              asm("mtpr $0x800,$27");           /* read the table entry     */
        !            56:              asm("stf _sgl_st_acc");            /* save the accumulator     */
        !            57:              asm("movl r1,_sgl_value_2");       /* save the value read      */
        !            58:              if( force_loop )
        !            59:                   asm("brb _mtpr_1_lp1");;       /* loop on the error        */
        !            60: /* 
        !            61:  * end error loop 
        !            62: */
        !            63:              if( sgl_st_acc  != sgl_expected ) { /* verify the accumulator */
        !            64:                   errcnt++;                     /* bump the error count    */
        !            65:                   if( prt_error ) 
        !            66:                        print_mtpr_error(
        !            67:                             " (SGL Accumulator) -THE ACC WAS MODIFIED");
        !            68:                   if( halt_flg ) 
        !            69:                       mtpr_er_halt( 2 );
        !            70:                   if( loop_on_err ) {
        !            71:                        force_loop = TRUE;       /* set the force loop flag */
        !            72:                        asm("jmp _mtpr_1_lp1");  /* and loop                */
        !            73:                   }
        !            74:              }   /* end of compare error */
        !            75:              if( ++index > max_ldf_1_index )
        !            76:                   index = 0;                   /* reset the Acc's index */
        !            77:         }
        !            78: }  /* end of subtest 1 */
        !            79: 
        !            80: 
        !            81: 
        !            82: 
        !            83: 
        !            84: /************************************************************************
        !            85: *
        !            86: *       SUBTEST 2 - Read the tables with a double precision accumulator
        !            87: *
        !            88: ************************************************************************/
        !            89: mtpr_2() 
        !            90: {
        !            91:         force_loop = FALSE;
        !            92:        subtest = 2;
        !            93:         index = 0;
        !            94:         for( sgl_value_1 = 0; sgl_value_1 < TBL_SIZE; sgl_value_1++ ) { 
        !            95:              dbl_ld_acc   = ldd_1_data[index].ld;      /* get a dbl value   */
        !            96:              dbl_expected = ldd_1_data[index].exp;     /* & expected acc.   */
        !            97: /*
        !            98:  * If LOOP ON ERROR is set, this is the loop for this subtest.
        !            99:  * The force loop flag is set after the first error.
        !           100: */
        !           101:              asm("_mtpr_2_lp1:");
        !           102:              asm("ldd _dbl_ld_acc");            /* load the accumulator     */
        !           103:              asm("movl _sgl_value_1,r0");       /* move table address to r0 */
        !           104:              asm("clrl r1");                    /* clear R1                 */
        !           105:              asm("mtpr $0x800,$27");           /* read the table entry     */
        !           106:              asm("std _dbl_st_acc");            /* save the accumulator     */
        !           107:              asm("movl r1,_sgl_value_2");       /* save the value read      */
        !           108:              if( force_loop )
        !           109:                   asm("brb _mtpr_2_lp1");;       /* loop on the error        */
        !           110: /* 
        !           111:  * end error loop 
        !           112: */
        !           113:              if( (dbl_st_acc.m != dbl_expected.m) ||  /* verify the acc. */
        !           114:                  (dbl_st_acc.l != dbl_expected.l) ) { 
        !           115:                   errcnt++;                     /* bump the error count    */
        !           116:                   if( prt_error ) 
        !           117:                        print_mtpr_error(
        !           118:                             " (DBL Accumulator) -THE ACC WAS MODIFIED");
        !           119:                   if( halt_flg ) 
        !           120:                       mtpr_er_halt( 2 );
        !           121:                   if( loop_on_err ) {
        !           122:                        force_loop = TRUE;       /* set the force loop flag */
        !           123:                        asm("jmp _mtpr_2_lp1");  /* and loop                */
        !           124:                   }
        !           125:              }   /* end of compare error */
        !           126:              if( ++index > max_ldf_1_index )
        !           127:                   index = 0;                   /* reset the Acc's index */
        !           128:         }
        !           129: }  /* end of subtest 2 */
        !           130: 
        !           131: 
        !           132: 
        !           133: 
        !           134: 
        !           135: /************************************************************************
        !           136: *
        !           137: *       SUBTEST 3 - Read table data during a SINF function
        !           138: *
        !           139: * Read every 10th table entry while doing SINF's.
        !           140: * Read the entry once, read it again during a SINF, verify that the SINF
        !           141: * result is correct and that the same table data was read.
        !           142: ************************************************************************/
        !           143: mtpr_3() 
        !           144: {
        !           145: int max_index;
        !           146:         force_loop = FALSE;
        !           147:        subtest = 3;
        !           148:        max_index = TBL_SIZE / 10;
        !           149:        if( max_index > max_sinf_1_index )      /* don't go over the SIN data */
        !           150:             max_index = max_sinf_1_index;      /* set the max index value */
        !           151:         for( index = 0; index < max_sinf_1_index; index++ )  { 
        !           152:             sgl_value_1  = index * 10;         /* get table entry to read */
        !           153:              sgl_ld_acc   = sinf_1_data[index].ld;      /* get a sgl value */
        !           154:              sgl_expected = sinf_1_data[index].exp;     /* & expected acc. */
        !           155:              asm("movl _sgl_value_1,r0");       /* move table address to r0 */
        !           156:              asm("clrl r1");                    /* clear R1                 */
        !           157:              asm("mtpr $0x800,$27");           /* read the table entry     */
        !           158:              asm("movl r1,_sgl_value_3");       /* save the value read      */
        !           159: /*
        !           160:  * If LOOP ON ERROR is set, this is the loop for this subtest.
        !           161:  * The force loop flag is set after the first error.
        !           162: */
        !           163:              asm("_mtpr_3_lp1:");
        !           164:              asm("ldf _sgl_ld_acc");            /* load the accumulator     */
        !           165:              asm("movl _sgl_value_1,r0");       /* move table address to r0 */
        !           166:              asm("clrl r1");                    /* clear R1                 */
        !           167:             asm("sinf");                       /* start the SIN function   */
        !           168:              asm("mtpr $0x800,$27");           /* read the table entry     */
        !           169:              asm("stf _sgl_st_acc");            /* save the accumulator     */
        !           170:              asm("movl r1,_sgl_value_2");       /* save the value read      */
        !           171:              if( force_loop )
        !           172:                   asm("brb _mtpr_3_lp1");;       /* loop on the error        */
        !           173: /* 
        !           174:  * end error loop 
        !           175: */
        !           176:              if( sgl_value_2 != sgl_value_3 ) { /* verify the data read  */
        !           177:                   errcnt++;                     /* bump the error count  */
        !           178:                   if( prt_error ) 
        !           179:                        print_mtpr_error( bad_tbl_entry_msg );
        !           180:                   if( halt_flg ) 
        !           181:                       mtpr_er_halt( 1 );
        !           182:                   if( loop_on_err ) {
        !           183:                        force_loop = TRUE;       /* set the force loop flag */
        !           184:                        asm("jmp _mtpr_3_lp1");  /* and loop                */
        !           185:                   }
        !           186:              }   /* end of table data compare error */
        !           187:                if( sgl_st_acc != sgl_expected ) { /* verify the accumulator */
        !           188:                   errcnt++;                     /* bump the error count    */
        !           189:                   if( prt_error ) 
        !           190:                        print_mtpr_error("  -BAD FINAL ACC");
        !           191:                   if( halt_flg ) 
        !           192:                       mtpr_er_halt( 3 );
        !           193:                   if( loop_on_err ) {
        !           194:                        force_loop = TRUE;       /* set the force loop flag */
        !           195:                        asm("jmp _mtpr_3_lp1");  /* and loop                */
        !           196:                   }
        !           197:              }   /* end of SINF compare error */
        !           198:              if( ++index > max_sinf_1_index )
        !           199:                   index = 0;                   /* reset the Acc's index */
        !           200:         }
        !           201: }  /* end of subtest 3 */
        !           202: 
        !           203: 
        !           204: 
        !           205: /******************************************************************************
        !           206: *
        !           207: *      Print an error message of the form:
        !           208: *
        !           209: *  cycle: xx  MTPR test xx, subtest xx  <your message here>
        !           210: *  table index = xxxxxxxx,  table entry read = xxxxxxxx   (2nd read)
        !           211: *                             expected entry = xxxxxxxx   (1st read)
        !           212: * or
        !           213: *  cycle: xx  MTPR test xx, subtest xx  <your message here>
        !           214: *  table index = xxxxxxxx,  table entry = xxxxxxxx
        !           215: *  initial Acc = xxxxxxxx xxxxxxxx,    final Acc = xxxxxxxx xxxxxxxx
        !           216: *                                   expected Acc = xxxxxxxx xxxxxxxx
        !           217: ******************************************************************************/
        !           218: print_mtpr_error( msg )
        !           219: char *msg;
        !           220: {
        !           221:         writes(" \n");         /* start a new print line */
        !           222:        writes("cycle: ");
        !           223:        writed( cycle );
        !           224:        writes("  MTPR test ");
        !           225:        writed( test_no );
        !           226:        writes( msg );
        !           227:        writes("\ntable index = ");
        !           228:        write32h( sgl_value_1 );
        !           229:        if( msg == bad_tbl_entry_msg ) {        /* bad data read? */
        !           230:             writes(",  table entry = ");
        !           231:             write32h( sgl_value_2 );
        !           232:             writes("   (2nd read)\n");
        !           233:             writes("                      entry expected = ");
        !           234:             write32h( sgl_value_3 );
        !           235:             writes("   (1st read)\n");
        !           236:        } else {                                /* bad accumulator error */
        !           237:             writes(",  table entry = ");
        !           238:             write32h( sgl_value_2 );
        !           239:             writes("\ninitial Acc = ");
        !           240:             if( subtest == 2 ) {               /* DBL precision? */
        !           241:                 write32h( dbl_ld_acc.m );
        !           242:                 writec(' ');
        !           243:                 write32h( dbl_ld_acc.l );
        !           244:                 writes(",    final Acc = ");
        !           245:                 write32h( dbl_st_acc.m );
        !           246:                 writec(' ');
        !           247:                 write32h( dbl_st_acc.l );
        !           248:                 writes("\n                                 expected Acc = ");
        !           249:                 write32h( dbl_expected.m );
        !           250:                 writec(' ');
        !           251:                 write32h( dbl_expected.l );
        !           252:             } else {                           /* SGL precision */
        !           253:                 write32h( sgl_ld_acc );
        !           254:                 writes(",    final Acc = ");
        !           255:                 write32h( sgl_st_acc );
        !           256:                 writes("\n                        expected Acc = ");
        !           257:                 write32h( sgl_expected );
        !           258:             }
        !           259:        writec('\n');
        !           260:        }
        !           261: }
        !           262: 
        !           263: 
        !           264: 
        !           265: 
        !           266: /******************************************************************************
        !           267: *
        !           268: *      halt with the failure information in registers
        !           269: *
        !           270: ******************************************************************************/
        !           271: mtpr_er_halt( code )
        !           272: int code;                      /* error code to halt with */
        !           273: {
        !           274:        sgl_dummy1 = code;      /* get the halt code */
        !           275:        if( subtest != 2 ) {    /* check for DBL accumulator */
        !           276:             dbl_ld_acc.m = sgl_ld_acc;         /* get the init Acc */
        !           277:             dbl_ld_acc.l = 0;
        !           278:             dbl_st_acc.m = sgl_st_acc;         /* get the final Acc */
        !           279:             dbl_st_acc.l = 0;
        !           280:             dbl_expected.m = sgl_expected;     /* get the expected Acc */
        !           281:             dbl_expected.l = 0;
        !           282:        }
        !           283:        asm("movl _test_no,r0");                /* r0  = test number    */
        !           284:        asm("movl _subtest,r1");                /* r1  = subtest #      */
        !           285:        asm("movl _sgl_dummy1,r2");             /* r2  = error code     */
        !           286:        asm("movl _cycle,r3");                  /* r3  = cycle count    */
        !           287:        if( code == 2 ) {  /* corrupted Acc */
        !           288:             asm("movl _dbl_ld_acc,r4");        /* r4  = MS initial Acc */
        !           289:             asm("movl _dbl_ld_acc+4,r5");      /* r5  = LS initial Acc */
        !           290:             asm("movl _dbl_st_acc,r6");        /* r6  = MS final Acc   */
        !           291:             asm("movl _dbl_st_acc+4,r7");      /* r7  = LS final Acc   */
        !           292:             asm("movl _dbl_expected,r8");      /* r8  = MS expected    */
        !           293:             asm("movl _dbl_expected+4,r9");    /* r9  = LS expected    */
        !           294:             asm("movl _sgl_value_1,r10");      /* r10 = table addr.    */
        !           295:             asm("movl _sgl_value_2,r11");;     /* r11 = entry read     */
        !           296:        } else {  /* wrong data read or wrong final Acc */
        !           297:             asm("movl _sgl_value_1,r4");       /* r4  = table addr.    */
        !           298:             asm("movl _sgl_value_2,r5");       /* r5  = entry read     */
        !           299:             asm("movl _sgl_value_3,r6");       /* r6  = expected entry */
        !           300:             asm("movl _sgl_ld_acc,r7");        /* r7  = initial Acc    */
        !           301:             asm("movl _sgl_st_acc,r8");        /* r8  = final Acc      */
        !           302:             asm("movl _sgl_expected,r9");;     /* r9  = sgl expected   */
        !           303:        };
        !           304:        asm("halt");;                           /* HALT ...             */
        !           305: }

unix.superglobalmegacorp.com

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