Annotation of cci/d/macro4/cmpf2.c, revision 1.1.1.1

1.1       root        1: #include "fpp_defs.h"
                      2: 
                      3: 
                      4: 
                      5: /***************************************************************************
                      6: *
                      7: *       CMPF2  -COMPARE 2 SGL OPERANDS TO EACH OTHER -IGNORE THE ACCUMULATOR
                      8: *
                      9: *****************************************************************************/
                     10: cmpf2()
                     11: {
                     12:         asm(".globl _cmpf2_t");
                     13:         asm("_cmpf2_t:");                       /* entry address            */
                     14:         if( ( cycle == 1 ) && ( prt_hdrs ) )    /* print headers on 1st pass */
                     15:            writes(" CMPF2");
                     16:         cmpf2_1();                              /* register / register data   */
                     17:         cmpf2_2();                              /* cache    / cache    data   */
                     18:         cmpf2_3();                              /* cache    / register data   */
                     19:         cmpf2_4();                              /* register / cache    data   */
                     20:         cmpf2_5();                              /* acc. corruption test       */
                     21:         cmpf2_6();                              /* register corruption test   */
                     22:        if( !no_fpp_wcs ) {
                     23:              cmpf2_7();                         /* pipelined entry test       */
                     24:              cmpf2_8();                         /* pipelined exit test        */
                     25:         };
                     26:        asm("jmp *return");                     /* return to the test monitor */
                     27: }
                     28:   
                     29: 
                     30: 
                     31: /****************************************************************************
                     32: *
                     33: *               SUBTEST 1 - CMPF2 test  -register / register data
                     34: *
                     35: ****************************************************************************/
                     36: cmpf2_1() 
                     37: {
                     38:      force_loop = FALSE;
                     39:      subtest = 1;
                     40:      index = 0;
                     41:      do 
                     42:      {
                     43:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                     44:         sgl_value_2  = cmpf_1_data[index].two;
                     45:         sgl_expected = cmpf_1_data[index].flag; /* get expected results */
                     46:         index2 = 0;                             /* clear Acc. data index */
                     47:         do
                     48:         {
                     49:            sgl_ld_acc = ldf_1_data[index2++].ld; /* get the Accumulator data */
                     50:            status_index = 0;                     /* clear the status index */
                     51:            do
                     52:            {
                     53:                sgl_dummy1 = status_array[status_index]; /* array = +, -, 0  */
                     54: /*
                     55:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                     56:  * The force loop flag is set after the first error.
                     57: */
                     58:                asm("_cmpf2_1_lp1:");
                     59:                asm("movl _sgl_ld_acc,r3");      /* get the accmulator data  */
                     60:                asm("movl _sgl_value_1,r4");     /* move operand #1 to r4    */
                     61:                asm("movl _sgl_value_2,r5");     /* move operand #2 to r5    */
                     62:                asm("ldf r3");                   /* load the accumulator     */
                     63:                asm("tstl _sgl_dummy1");         /* generate initial status  */
                     64:                asm("movpsl _init_psl");         /* save the initial status  */
                     65:                asm("cmpf2 r4,r5");              /* compare the operands     */
                     66:                asm("movpsl _psl_val");          /* save the final status    */
                     67:                asm("stf r6");                   /* save the accumulator     */
                     68:                if( force_loop )                 /* loop?                    */
                     69:                    asm("brb _cmpf2_1_lp1");;    /* run the loop again       */
                     70:                asm("movl r6,_sgl_st_acc");      /* put the acc into cache   */
                     71:               exp_psl = init_psl;              /* get the initial PSL      */
                     72:                exp_psl &= 0xfffffff3;           /* clear ZERO, NEGATIVE     */
                     73:                if( sgl_expected == ZERO )
                     74:                    exp_psl |= PSL_Z;            /* expect the ZERO bit set  */
                     75:                if( sgl_expected == NEGATIVE )
                     76:                    exp_psl |= PSL_N;            /* expect the NEG bit set   */
                     77:                if( psl_val != exp_psl )         /* COMPARE the values       */
                     78:                {
                     79:                   errcnt++;                     /* bump the error count     */
                     80:                   if ( prt_error ) {
                     81:                      writes(" \n");         /* start a new print line   */
                     82:                      writes("cycle: ");
                     83:                      writed( cycle );
                     84:                      writes("  CMPF2 test ");
                     85:                     writed( test_no );
                     86:        writes(", subtest 1 (Reg./Reg. Data) - BAD FINAL PSL\n");
                     87:                      print_cmpf2_data();
                     88:                      writes(",  data index = ");
                     89:                      writed( index );
                     90:                      writec('\n');
                     91:                      writes("   final Acc = ");
                     92:                      write32h( sgl_st_acc );
                     93:                      writes(",  operand 2 = ");
                     94:                      write32h( sgl_value_2 );
                     95:                      writec('\n');
                     96:                      writes(" initial PSL = ");
                     97:                      write32h( init_psl );
                     98:                      writes(",  final PSL = ");
                     99:                      write32h( psl_val );
                    100:                      writes(",  expected PSL = ");
                    101:                      write32h( exp_psl );
                    102:                      writes(" \n");
                    103:                   }
                    104:                   if ( halt_flg )
                    105:                      cmpf2_er_halt( BAD_PSL_HLT );  /* halt on the error    */
                    106:                   if ( loop_on_err ) {
                    107:                      force_loop = TRUE;         /* set the force loop flag */
                    108:                      asm("brw _cmpf2_1_lp1");   /* and loop                */
                    109:                   };  /* end of loop-on-error    */
                    110:                }   /* end of compare error    */
                    111:             } while( ++status_index < 3 );
                    112:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    113:      } while( index++ < max_cmpf_1_index );
                    114: }  /* end of subtest 1 */
                    115:   
                    116: 
                    117: 
                    118: /****************************************************************************
                    119: *
                    120: *               SUBTEST 2 - CMPF2 test  - cache / cache data
                    121: *
                    122: ****************************************************************************/
                    123: cmpf2_2() 
                    124: {
                    125:      force_loop = FALSE;
                    126:      subtest = 2;
                    127:      index = 0;
                    128:      do 
                    129:      {
                    130:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    131:         sgl_value_2  = cmpf_1_data[index].two;
                    132:         sgl_expected = cmpf_1_data[index].flag; /* get expected results */
                    133:         index2 = 0;                             /* clear Acc. data index */
                    134:         do
                    135:         {
                    136:            sgl_ld_acc = ldf_1_data[index2++].ld; /* get the Accumulator data */
                    137:            status_index = 0;                     /* clear the status index */
                    138:            do
                    139:            {
                    140:                sgl_dummy1 = status_array[status_index]; /* array = +, -, 0  */
                    141: /*
                    142:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    143:  * The force loop flag is set after the first error.
                    144: */
                    145:                asm("_cmpf2_2_lp1:");
                    146:                asm("movl _sgl_ld_acc,r3");      /* get the accmulator data  */
                    147:                asm("ldf _sgl_ld_acc");          /* load the accumulator     */
                    148:                asm("tstl _sgl_dummy1");         /* generate initial status  */
                    149:                asm("movpsl _init_psl");         /* save the initial status  */
                    150:                asm("cmpf2 _sgl_value_1,_sgl_value_2");  /* compare the data */
                    151:                asm("movpsl _psl_val");          /* save the final status    */
                    152:                asm("stf _sgl_st_acc");         /* save the acc             */
                    153:               if( force_loop )                 /* loop?                    */
                    154:                    asm("brb _cmpf2_2_lp1");;    /* run the loop again       */
                    155:                exp_psl = init_psl;              /* get the initial PSL      */
                    156:                exp_psl &= 0xfffffff3;           /* clear ZERO, NEGATIVE     */
                    157:                if( sgl_expected == ZERO )
                    158:                    exp_psl |= PSL_Z;            /* expect the ZERO bit set  */
                    159:                if( sgl_expected == NEGATIVE )
                    160:                    exp_psl |= PSL_N;            /* expect the NEG bit set   */
                    161:                if( psl_val != exp_psl )         /* COMPARE the values       */
                    162:                {
                    163:                   errcnt++;                     /* bump the error count     */
                    164:                   if ( prt_error ) {
                    165:                      writes(" \n");         /* start a new print line   */
                    166:                      writes("cycle: ");
                    167:                      writed( cycle );
                    168:                      writes("  CMPF2 test ");
                    169:                     writed( test_no );
                    170:        writes(", subtest 2 (Cache/Cache Data) - BAD FINAL PSL\n");
                    171:                      print_cmpf2_data();
                    172:                      writes(",  data index = ");
                    173:                      writed( index );
                    174:                      writec('\n');
                    175:                      writes("   final Acc = ");
                    176:                      write32h( sgl_st_acc );
                    177:                      writes(",  operand 2 = ");
                    178:                      write32h( sgl_value_2 );
                    179:                      writec('\n');
                    180:                      writes(" initial PSL = ");
                    181:                      write32h( init_psl );
                    182:                      writes(",  final PSL = ");
                    183:                      write32h( psl_val );
                    184:                      writes(",  expected PSL = ");
                    185:                      write32h( exp_psl );
                    186:                      writes(" \n");
                    187:                   }
                    188:                   if ( halt_flg )
                    189:                      cmpf2_er_halt( BAD_PSL_HLT );  /* halt on the error   */
                    190:                   if ( loop_on_err ) 
                    191:                   {
                    192:                      force_loop = TRUE;         /* set the force loop flag */
                    193:                      asm("brw _cmpf2_2_lp1");   /* and loop                */
                    194:                   };  /* end of loop-on-error    */
                    195:                }   /* end of compare error    */
                    196:             } while( ++status_index < 3 );
                    197:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    198:      } while( index++ < max_cmpf_1_index );
                    199: }  /* end of subtest 2 */
                    200:   
                    201: 
                    202: 
                    203: /****************************************************************************
                    204: *
                    205: *               SUBTEST 3 - CMPF2 test  - cache / register data
                    206: *
                    207: ****************************************************************************/
                    208: cmpf2_3() 
                    209: {
                    210:      force_loop = FALSE;
                    211:      subtest = 3;
                    212:      index = 0;
                    213:      do 
                    214:      {
                    215:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    216:         sgl_value_2  = cmpf_1_data[index].two;
                    217:         sgl_expected = cmpf_1_data[index].flag; /* get expected results */
                    218:         index2 = 0;                             /* clear Acc. data index */
                    219:         do
                    220:         {
                    221:            sgl_ld_acc = ldf_1_data[index2++].ld; /* get the Accumulator data */
                    222:            status_index = 0;                     /* clear the status index */
                    223:            do
                    224:            {
                    225:                sgl_dummy1 = status_array[status_index]; /* array = +, -, 0  */
                    226: /*
                    227:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    228:  * The force loop flag is set after the first error.
                    229: */
                    230:                asm("_cmpf2_3_lp1:");
                    231:                asm("ldf _sgl_ld_acc");          /* load the accmulator      */
                    232:                asm("movl _sgl_value_2,r5");     /* move operand #2 to r5    */
                    233:                asm("tstl _sgl_dummy1");         /* generate initial status  */
                    234:                asm("movpsl _init_psl");         /* save the initial status  */
                    235:                asm("cmpf2 _sgl_value_1,r5");    /* compare the data         */
                    236:                asm("movpsl _psl_val");          /* save the final status    */
                    237:                asm("stf _sgl_st_acc");         /* save the acc             */
                    238:               if( force_loop )                 /* loop?                    */
                    239:                    asm("brb _cmpf2_3_lp1");;    /* run the loop again       */
                    240:                exp_psl = init_psl;              /* get the initial PSL      */
                    241:                exp_psl &= 0xfffffff3;           /* clear ZERO, NEGATIVE     */
                    242:                if( sgl_expected == ZERO )
                    243:                    exp_psl |= PSL_Z;            /* expect the ZERO bit set  */
                    244:                if( sgl_expected == NEGATIVE )
                    245:                    exp_psl |= PSL_N;            /* expect the NEG bit set   */
                    246:                if( psl_val != exp_psl )         /* COMPARE the values       */
                    247:                {
                    248:                   errcnt++;                     /* bump the error count     */
                    249:                   if ( prt_error ) {
                    250:                      writes(" \n");         /* start a new print line   */
                    251:                      writes("cycle: ");
                    252:                      writed( cycle );
                    253:                      writes("  CMPF2 test ");
                    254:                     writed( test_no );
                    255:        writes(", subtest 3 (Cache/Reg. Data) - BAD FINAL PSL\n");
                    256:                      print_cmpf2_data();
                    257:                      writes(",  data index = ");
                    258:                      writed( index );
                    259:                      writec('\n');
                    260:                      writes("   final Acc = ");
                    261:                      write32h( sgl_st_acc );
                    262:                      writes(",  operand 2 = ");
                    263:                      write32h( sgl_value_2 );
                    264:                      writec('\n');
                    265:                      writes(" initial PSL = ");
                    266:                      write32h( init_psl );
                    267:                      writes(",  final PSL = ");
                    268:                      write32h( psl_val );
                    269:                      writes(",  expected PSL = ");
                    270:                      write32h( exp_psl );
                    271:                      writes(" \n");
                    272:                   }
                    273:                   if ( halt_flg )
                    274:                      cmpf2_er_halt( BAD_PSL_HLT ); /* halt on the error    */
                    275:                   if ( loop_on_err ) 
                    276:                   {
                    277:                      force_loop = TRUE;         /* set the force loop flag */
                    278:                      asm("brw _cmpf2_3_lp1");   /* and loop                */
                    279:                   };  /* end of loop-on-error    */
                    280:                }   /* end of compare error    */
                    281:             } while( ++status_index < 3 );
                    282:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    283:      } while( index++ < max_cmpf_1_index );
                    284: }  /* end of subtest 3 */
                    285:   
                    286: 
                    287: 
                    288: /****************************************************************************
                    289: *
                    290: *               SUBTEST 4 - CMPF2 test  - register / cache data
                    291: *
                    292: ****************************************************************************/
                    293: cmpf2_4() 
                    294: {
                    295:      force_loop = FALSE;
                    296:      subtest = 4;
                    297:      index = 0;
                    298:      do 
                    299:      {
                    300:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    301:         sgl_value_2  = cmpf_1_data[index].two;
                    302:         sgl_expected = cmpf_1_data[index].flag; /* get expected results */
                    303:         index2 = 0;                             /* clear Acc. data index */
                    304:         do
                    305:         {
                    306:            sgl_ld_acc = ldf_1_data[index2++].ld; /* get the Accumulator data */
                    307:            status_index = 0;                     /* clear the status index */
                    308:            do
                    309:            {
                    310:                sgl_dummy1 = status_array[status_index]; /* array = +, -, 0  */
                    311: /*
                    312:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    313:  * The force loop flag is set after the first error.
                    314: */
                    315:                asm("_cmpf2_4_lp1:");
                    316:                asm("movl _sgl_ld_acc,r3");      /* get the accmulator data  */
                    317:                asm("movl _sgl_value_1,r4");     /* move operand #1 to r4    */
                    318:                asm("ldf r3");                   /* load the accumulator     */
                    319:                asm("tstl _sgl_dummy1");         /* generate initial status  */
                    320:                asm("movpsl _init_psl");         /* save the initial status  */
                    321:                asm("cmpf2 r4,_sgl_value_2");    /* compare the data         */
                    322:                asm("movpsl _psl_val");          /* save the final status    */
                    323:                asm("stf _sgl_st_acc");         /* save the acc             */
                    324:               if( force_loop )                 /* loop?                    */
                    325:                    asm("brb _cmpf2_4_lp1");;    /* run the loop again       */
                    326:                exp_psl = init_psl;              /* get the initial PSL      */
                    327:                exp_psl &= 0xfffffff3;           /* clear ZERO, NEGATIVE     */
                    328:                if( sgl_expected == ZERO )
                    329:                    exp_psl |= PSL_Z;            /* expect the ZERO bit set  */
                    330:                if( sgl_expected == NEGATIVE )
                    331:                    exp_psl |= PSL_N;            /* expect the NEG bit set   */
                    332:                if( psl_val != exp_psl )         /* COMPARE the values       */
                    333:                {
                    334:                   errcnt++;                     /* bump the error count     */
                    335:                   if ( prt_error ) {
                    336:                      writes(" \n");         /* start a new print line   */
                    337:                      writes("cycle: ");
                    338:                      writed( cycle );
                    339:                      writes("  CMPF2 test ");
                    340:                     writed( test_no );
                    341:        writes(", subtest 4 (Reg./Cache Data) - BAD FINAL PSL\n");
                    342:                      print_cmpf2_data();
                    343:                      writes(",  data index = ");
                    344:                      writed( index );
                    345:                      writec('\n');
                    346:                      writes("   final Acc = ");
                    347:                      write32h( sgl_st_acc );
                    348:                      writes(",  operand 2 = ");
                    349:                      write32h( sgl_value_2 );
                    350:                      writec('\n');
                    351:                      writes(" initial PSL = ");
                    352:                      write32h( init_psl );
                    353:                      writes(",  final PSL = ");
                    354:                      write32h( psl_val );
                    355:                      writes(",  expected PSL = ");
                    356:                      write32h( exp_psl );
                    357:                      writes(" \n");
                    358:                   }
                    359:                   if ( halt_flg )
                    360:                      cmpf2_er_halt( BAD_PSL_HLT ); /* halt on the error    */
                    361:                   if ( loop_on_err ) 
                    362:                   {
                    363:                      force_loop = TRUE;         /* set the force loop flag */
                    364:                      asm("jmp _cmpf2_4_lp1");   /* and loop                */
                    365:                   }  /* end of loop-on-error    */
                    366:                }  /* end of compare error    */
                    367:             } while( ++status_index < 3 );
                    368:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    369:      } while( index++ < max_cmpf_1_index );
                    370: }  /* end of subtest 4 */
                    371:   
                    372: 
                    373: 
                    374: /************************************************************************
                    375: *
                    376: *       SUBTEST 5 - Check for register corruption
                    377: *
                    378: ************************************************************************/
                    379: cmpf2_5() 
                    380: {
                    381:         force_loop = FALSE;                     /* clear force_loop flg */
                    382:         subtest = 5;
                    383:         fill_reg_buf( load_regs );              /* get pattern for regs */
                    384:         index = 0;
                    385:         do 
                    386:         {
                    387:              sgl_value_1  = cmpf_1_data[index].one;   /* data to load    */
                    388:              sgl_value_2  = cmpf_1_data[index].two;   /* data to compare */
                    389: /*
                    390:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    391:  * The force loop flag is set after the first error.
                    392: */
                    393:              asm("_cmpf2_5_lp1:");
                    394:              asm("ldf $0x40800000");            /* LOAD the accumulator  */
                    395:              asm("loadr $0x1fff,_load_regs");   /* load regs 0 - 12       */
                    396:              asm("cmpf2 _sgl_value_1,_sgl_value_2"); /* compare the data  */
                    397:              asm("storer $0x1fff,_store_regs"); /* store regs 0 - 12 */
                    398:              asm("stf _sgl_st_acc");           /* save the acc           */
                    399:             if( force_loop )                   /* loop?                    */
                    400:                    asm("brb _cmpf2_5_lp1");;    /* run the loop again       */
                    401: /*
                    402:  * Now compare the stored register values to those that were loaded
                    403: */
                    404:              index2 = 0;
                    405:              while( (load_regs[index2] == store_regs[index2]) && (index2 < 13) )
                    406:                   index2++;                     /* check reg values */
                    407:             
                    408:              if( index2 < 13 ) {                /* error if index2 < 13 */
                    409:                   errcnt++;                     /* bump the error count */
                    410:                   if ( prt_error ) {
                    411:                        writes(" \n");      /* start a new print line   */
                    412:                        writes("cycle: ");
                    413:                        writed( cycle );
                    414:                        writes(", CMPF2 test ");
                    415:                       writed( test_no );
                    416:        writes(", subtest 5 - A REGISTER WAS MODIFIED\n");
                    417:                        print_cmpf2_data();
                    418:                        writec('\n');
                    419:                       writes("   final Acc = ");
                    420:                        write32h( sgl_st_acc );
                    421:                        writes(",  operand 2 = ");
                    422:                        write32h( sgl_value_2 );
                    423:                        writec('\n');
                    424:                        writes("register ");
                    425:                        writed( index2 );
                    426:                        writes(" = ");
                    427:                        write32h( store_regs[ index2 ] );
                    428:                        writes(",  should be = ");
                    429:                        write32h( load_regs[ index2 ] );
                    430:                        writes("\n");
                    431:                   }
                    432:                   if ( halt_flg )
                    433:                        cmpf2_er_halt( BAD_REG_HLT ); /* halt on the error  */
                    434:                   if ( loop_on_err ) 
                    435:                   {
                    436:                      force_loop = TRUE;         /* set the force loop flag */
                    437:                      asm("jmp _cmpf2_5_lp1");   /* and loop                */
                    438:                   };   /* end of loop-on-error    */
                    439:              }    /* end of compare error    */
                    440:         } while( index++ < max_cmpf_1_index );
                    441: }  /* end of subtest 5 */
                    442:   
                    443: 
                    444: 
                    445: /****************************************************************************
                    446: *
                    447: *               SUBTEST 6 - CMPF2 test  Accumulator stability test
                    448: *
                    449: ****************************************************************************/
                    450: cmpf2_6() 
                    451: {
                    452:      force_loop = FALSE;
                    453:      subtest = 6;
                    454:      index = 0;
                    455:      do 
                    456:      {
                    457:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    458:         sgl_value_2  = cmpf_1_data[index].two;
                    459:         index2 = 0;                             /* clear Acc. data index */
                    460:         do
                    461:         {
                    462:            sgl_ld_acc   = ldf_1_data[index2].ld; /* get the Accumulator data */
                    463:            sgl_expected = ldf_1_data[index2++].exp; /* get expected Acc. */
                    464: /*
                    465:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    466:  * The force loop flag is set after the first error.
                    467: */
                    468:                asm("_cmpf2_6_lp1:");
                    469:                asm("movl _sgl_ld_acc,r3");      /* get the accmulator data  */
                    470:                asm("ldf r3");                   /* load the accumulator     */
                    471:                asm("cmpf2 _sgl_value_1,_sgl_value_2");/* compare the operands */
                    472:                asm("stf _sgl_st_acc");           /* store the accumulator    */
                    473:                if( force_loop )                 /* loop?                    */
                    474:                    asm("brb _cmpf2_6_lp1");;    /* run the loop again       */
                    475:                if( sgl_st_acc != sgl_expected ) { /* COMPARE the values     */
                    476:                   errcnt++;                     /* bump the error count     */
                    477:                   if ( prt_error ) {
                    478:                      writes(" \n");         /* start a new print line   */
                    479:                      writes("cycle: ");
                    480:                      writed( cycle );
                    481:                      writes("  CMPF2 test ");
                    482:                     writed( test_no );
                    483:        writes(", subtest 6 (Acc. Corr.) - THE ACC WAS MODIFIED\n");
                    484:                      print_cmpf2_data();
                    485:                      writes(",  index = ");
                    486:                     writed( index );
                    487:                     writec('\n');
                    488:                      writes("   final Acc = ");
                    489:                      write32h( sgl_st_acc );
                    490:                      writes(",  operand 2 = ");
                    491:                      write32h( sgl_value_2 );
                    492:                      writec('\n');
                    493:                      writes("expected Acc = ");
                    494:                      write32h( sgl_expected );
                    495:                      writec('\n');
                    496:                   }
                    497:                   if ( halt_flg )                   /* halt on error?      */
                    498:                      cmpf2_er_halt( BAD_ACC_HLT );
                    499:                   if ( loop_on_err ) 
                    500:                   {
                    501:                      force_loop = TRUE;         /* set the force loop flag */
                    502:                      asm("jmp _cmpf2_6_lp1");   /* and loop                */
                    503:                   };   /* end of loop-on-error    */
                    504:                }   /* end of compare error    */
                    505:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    506:      } while( index++ < max_cmpf_1_index );
                    507: }  /* end of subtest 6 */
                    508:   
                    509: 
                    510: 
                    511: /****************************************************************************
                    512: *
                    513: *               SUBTEST 7 - CMPF2 test  - piped entry
                    514: *
                    515: ****************************************************************************/
                    516: cmpf2_7()
                    517: {
                    518:      force_loop = FALSE;
                    519:      subtest = 7;
                    520:      index = 0;
                    521:      do 
                    522:      {
                    523:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    524:         sgl_value_2  = cmpf_1_data[index].two;
                    525:         sgl_expected = cmpf_1_data[index].flag; /* get expected results */
                    526:         index2 = 0;                             /* clear Acc. data index */
                    527:         do
                    528:         {
                    529:            sgl_ld_acc = ldf_1_data[index2++].ld; /* get the Accumulator data */
                    530:            status_index = 0;                     /* clear the status index */
                    531:            do
                    532:            {
                    533:                sgl_dummy1 = status_array[status_index]; /* array = +, -, 0  */
                    534: /*
                    535:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    536:  * The force loop flag is set after the first error.
                    537: */
                    538:                asm("_cmpf2_7_lp1:");
                    539:                asm("movl $0,r0");               /* zero the reg             */
                    540:                asm("ldf r0");                   /* load a zero in the acc   */
                    541:                asm("addf _sgl_ld_acc");         /* add initial data to acc  */
                    542:                asm("tstl _sgl_dummy1");         /* generate initial status  */
                    543:                asm("movpsl _init_psl");         /* save the initial status  */
                    544:                asm("cmpf2 _sgl_value_1,_sgl_value_2");  /* compare the data */
                    545:               asm("movpsl _psl_val");          /* save the final status    */
                    546:                asm("stf _sgl_st_acc");         /* save the acc             */
                    547:                if( force_loop )                 /* loop?                    */
                    548:                    asm("brb _cmpf2_7_lp1");;    /* run the loop again       */
                    549:                exp_psl = init_psl;              /* get the initial PSL      */
                    550:                exp_psl &= 0xfffffff3;           /* clear ZERO, NEGATIVE     */
                    551:                if( sgl_expected == ZERO )
                    552:                    exp_psl |= PSL_Z;            /* expect the ZERO bit set  */
                    553:                if( sgl_expected == NEGATIVE )
                    554:                    exp_psl |= PSL_N;            /* expect the NEG bit set   */
                    555:                if( psl_val != exp_psl )         /* COMPARE the values       */
                    556:                {
                    557:                   errcnt++;                     /* bump the error count     */
                    558:                   if ( prt_error ) {
                    559:                      writes(" \n");         /* start a new print line   */
                    560:                      writes("cycle: ");
                    561:                      writed( cycle );
                    562:                      writes("  CMPF2 test ");
                    563:                     writed( test_no );
                    564:        writes(", subtest 7 (Piped Entry) - BAD FINAL PSL\n");
                    565:                      print_cmpf2_data();
                    566:                      writes(",  data index = ");
                    567:                      writed( index );
                    568:                      writec('\n');
                    569:                      writes("   final Acc = ");
                    570:                      write32h( sgl_st_acc );
                    571:                      writes(",  operand 2 = ");
                    572:                      write32h( sgl_value_2 );
                    573:                      writec('\n');
                    574:                      writes(" initial PSL = ");
                    575:                      write32h( init_psl );
                    576:                      writes(",  final PSL = ");
                    577:                      write32h( psl_val );
                    578:                      writes(",  expected PSL = ");
                    579:                      write32h( exp_psl );
                    580:                      writes(" \n");
                    581:                   }
                    582:                   if ( halt_flg )
                    583:                      cmpf2_er_halt( BAD_PSL_HLT );  /* halt on the error   */
                    584:                   if ( loop_on_err ) 
                    585:                   {
                    586:                      force_loop = TRUE;         /* set the force loop flag */
                    587:                      asm("brw _cmpf2_7_lp1");   /* and loop                */
                    588:                   };  /* end of loop-on-error    */
                    589:                }   /* end of compare error    */
                    590:             } while( ++status_index < 3 );
                    591:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    592:      } while( index++ < max_cmpf_1_index );
                    593: }  /* end of subtest 7 */
                    594:   
                    595: 
                    596: 
                    597: /****************************************************************************
                    598: *
                    599: *               SUBTEST 8 - CMPF2  piped exit test
                    600: *
                    601: ****************************************************************************/
                    602: cmpf2_8() 
                    603: {
                    604:      force_loop = FALSE;
                    605:      subtest = 6;
                    606:      index = 0;
                    607:      do 
                    608:      {
                    609:         sgl_value_1  = cmpf_1_data[index].one; /* get the data operands  */
                    610:         sgl_value_2  = cmpf_1_data[index].two;
                    611:         index2 = 0;                             /* clear Acc. data index */
                    612:         do
                    613:         {
                    614:            sgl_ld_acc   = ldf_1_data[index2].ld; /* get the Accumulator data */
                    615:            sgl_expected = ldf_1_data[index2++].exp; /* get expected Acc. */
                    616: /*
                    617:  * If LOOP ON ERROR is set, this is the loop for this subtest.
                    618:  * The force loop flag is set after the first error.
                    619: */
                    620:                asm("_cmpf2_8_lp1:");
                    621:                asm("movl $0,r0");              /* move a zero to r0        */
                    622:                asm("movl _sgl_ld_acc,r3");      /* get the accmulator data  */
                    623:                asm("ldf r3");                   /* load the accumulator     */
                    624:                asm("cmpf2 _sgl_value_1,_sgl_value_2");/* compare the operands */
                    625:                asm("addf r0");                 /* add a zero to the acc    */
                    626:               asm("stf _sgl_st_acc");          /* store the accumulator    */
                    627:                if( force_loop )                 /* loop?                    */
                    628:                    asm("brb _cmpf2_8_lp1");;    /* run the loop again       */
                    629:                if( sgl_st_acc != sgl_expected ) { /* COMPARE the values     */
                    630:                   errcnt++;                     /* bump the error count     */
                    631:                   if ( prt_error ) {
                    632:                      writes(" \n");         /* start a new print line   */
                    633:                      writes("cycle: ");
                    634:                      writed( cycle );
                    635:                      writes("  CMPF2 test ");
                    636:                     writed( test_no );
                    637:        writes(", subtest 8 (Piped Exit) - THE ACC WAS MODIFIED\n");
                    638:                      print_cmpf2_data();
                    639:                      writes(",  data index = ");
                    640:                      writed( index );
                    641:                      writec('\n');
                    642:                      writes("   final Acc = ");
                    643:                      write32h( sgl_st_acc );
                    644:                      writes(",  operand 2 = ");
                    645:                      write32h( sgl_value_2 );
                    646:                      writec('\n');
                    647:                      writes("expected Acc = ");
                    648:                      write32h( sgl_expected );
                    649:                      writec('\n');
                    650:                   }
                    651:                   if ( halt_flg )                   /* halt on error?      */
                    652:                      cmpf2_er_halt( BAD_ACC_HLT );
                    653:                   if ( loop_on_err ) 
                    654:                   {
                    655:                      force_loop = TRUE;         /* set the force loop flag */
                    656:                      asm("jmp _cmpf2_8_lp1");   /* and loop                */
                    657:                   };   /* end of loop-on-error    */
                    658:                }   /* end of compare error    */
                    659:         } while( (index2 < 10) && (index2 < max_ldf_1_index) );
                    660:      } while( index++ < max_cmpf_1_index );
                    661: }  /* end of subtest 8 */
                    662:   
                    663: 
                    664: 
                    665: /**************************************************************************
                    666: *
                    667: *       PRINT THE DATA AND STORE RESULTS
                    668: *
                    669: *  initial Acc = xxxxxxxx,     stored = xxxxxxxx,   data index = xx
                    670: *      operand = xxxxxxxx,   expected = xxxxxxxx
                    671: **************************************************************************/
                    672: print_cmpf2_data()
                    673: {
                    674:         writes(" initial Acc = ");
                    675:         write32h( sgl_ld_acc );
                    676:         writes(",  operand 1 = ");
                    677:         write32h( sgl_value_1 );
                    678: }
                    679:    
                    680: 
                    681: 
                    682: /**************************************************************************
                    683: *
                    684: *               HALT ON ERROR ROUTINE 
                    685: *
                    686: **************************************************************************/
                    687: cmpf2_er_halt( halt_code )
                    688: int halt_code;
                    689: {
                    690:         sgl_dummy1 = halt_code;                 /* get the error type    */
                    691:         asm("movl _test_no,r0");                /* r0  = test number     */
                    692:         asm("movl _subtest,r1");                /* r1  = subtest number  */
                    693:         asm("movl _sgl_dummy1,r2");             /* r2  = error code      */
                    694:         asm("movl _cycle,r3");                  /* r3  = cycle count     */
                    695:         asm("movl _sgl_ld_acc,r4");             /* r4  = initial data    */
                    696:         asm("movl _sgl_value_1,r5");            /* r5  = operand 1       */
                    697:         asm("movl _sgl_value_2,r6");            /* r6  = operand 2       */
                    698:         asm("movl _psl_val,r7");                /* r7  = actual PSL      */
                    699:         if( halt_code == BAD_ACC_HLT ) {
                    700:              asm("movl _sgl_st_acc,r8");        /* r8  = actual value    */
                    701:              asm("movl _sgl_expected,r9");      /* r9  = expected value  */
                    702:         } else
                    703:         if( halt_code == BAD_REG_HLT ) {
                    704:              sgl_dummy1 = load_regs[index2];
                    705:              sgl_dummy2 = store_regs[index2];
                    706:              asm("movl _index2,r8");            /* r8  = bad register #  */
                    707:              asm("movl _sgl_dummy2,r9");        /* r9  = actual value    */
                    708:              asm("movl _sgl_dummy1,r10");       /* r10 = expected value  */
                    709:         } else
                    710:           if( halt_code == BAD_PSL_HLT ) {
                    711:              asm("movl _exp_psl,r7");           /* r8  = expected PSL    */
                    712:              asm("movl _index,r9");             /* r9  = data index      */
                    713:         };
                    714:         asm("halt");                            /* HALT ...              */
                    715: }  

unix.superglobalmegacorp.com

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