home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / PowerPC / Dev / PPCRelease / Examples / Bustest / BusTestPPC.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-06  |  19.6 KB  |  717 lines

  1. /*
  2.  * Open: - Cache speed measurement is obviously broken
  3.  *         I suppose the PPC notices that the code does
  4.  *         nothing..but somehow it does this nothing pretty fast
  5.  *         ..too fast imho.
  6.  *
  7.  *
  8.  *
  9.  */
  10. #include <exec/types.h>
  11. #include <exec/memory.h>
  12. #include <hardware/custom.h>
  13. #include <hardware/intbits.h>
  14. #include <math.h>
  15. #include <exec/types.h>
  16. #include <utility/tagitem.h>
  17. #include <dos/dos.h>
  18. #include <powerup/gcclib/powerup_protos.h>
  19. #include <powerup/ppclib/time.h>
  20. #include <powerup/ppclib/memory.h>
  21. #include <powerup/ppcinline/exec.h>
  22. #include <powerup/ppcinline/dos.h>
  23.  
  24. //UBYTE vers[] = VERSTAG;
  25.  
  26. #ifndef max
  27. #define   max(a,b)    ((a) > (b) ? (a) : (b))
  28. #endif
  29.  
  30. #ifndef min
  31. #define   min(a,b)    ((a) <= (b) ? (a) : (b))
  32. #endif
  33.  
  34.  
  35. #define    INDEX_SIZE        0
  36. #define    INDEX_LOOP        1
  37. #define    INDEX_ADDRESS        2
  38. #define    INDEX_ADDRESSSIZE    3
  39. #define    INDEX_FULL        4
  40. #define    INDEX_CHIP        5
  41. #define    INDEX_ROM        6
  42. #define    INDEX_MMU        7
  43. #define    INDEX_CACHE        8
  44. #define    INDEX_COUNT        9
  45.  
  46. /* M68k */
  47. #define    M68KCACHEINHIBITED_SERIALIZED    (0x40)
  48. #define    M68KCACHE_WRITETHROUGH        (0x00)
  49. #define    M68KCACHE_COPYBACK            (0x20)
  50. #define    M68KCACHEINHIBITED_NONSERIALIZED    (0x60)
  51. #define    M68KCACHE_MASK            (0x60)
  52. #define    PAGE_SIZE    4096
  53. #define    PAGE_MASK    (PAGE_SIZE-1)
  54.  
  55.  
  56. #define    MEMSIZE        MemSize
  57. #define    ALLOCSIZE    (max(MEMSIZE,CacheBorder)+PAGE_SIZE)
  58. #define    INTOFF        FALSE
  59.  
  60. #define    TIMEPRE        PPCCacheFlushAll();            \
  61.                         PPCSetTimerObject(MyTimerObject,PPCTIMERTAG_START,NULL);
  62.  
  63. #define    TIMEPOST    PPCSetTimerObject(MyTimerObject,PPCTIMERTAG_STOP,NULL);    \
  64.                         CalcTimer();
  65.  
  66. /* The Cache measurement is broken
  67.  */
  68. #define    CACHETEST    FALSE
  69.  
  70. void    memreadlinetime(APTR,ULONG,ULONG);
  71. void    memwritelinetime(APTR,ULONG,ULONG);
  72. void    memwritelinetime2(APTR,ULONG,ULONG);
  73. void    memreadline(APTR,ULONG,ULONG);
  74. void    memwriteline(APTR,ULONG,ULONG);
  75. void    memwriteline2(APTR,ULONG,ULONG);
  76.  
  77. void    memreadlonglongtime(APTR,ULONG,ULONG);
  78. void    memreadlongtime(APTR,ULONG,ULONG);
  79. void    memreadwordtime(APTR,ULONG,ULONG);
  80. void    memreadbytetime(APTR,ULONG,ULONG);
  81. void    memwritelonglongtime(APTR,ULONG,ULONG);
  82. void    memwritelongtime(APTR,ULONG,ULONG);
  83. void    memwritewordtime(APTR,ULONG,ULONG);
  84. void    memwritebytetime(APTR,ULONG,ULONG);
  85. void    memreadlonglong(APTR,ULONG,ULONG);
  86. void    memreadword(APTR,ULONG,ULONG);
  87. void    memreadbyte(APTR,ULONG,ULONG);
  88. void    memwritelonglong(APTR,ULONG,ULONG);
  89. void    memwritelong(APTR,ULONG,ULONG);
  90. void    memwriteword(APTR,ULONG,ULONG);
  91. void    memwritebyte(APTR,ULONG,ULONG);
  92.  
  93. #if INTOFF
  94.  
  95. #define    DISABLE      Intenar    =    ((struct Custom*) 0xdff000)->intenar;\
  96.                                         ((struct Custom*) 0xdff000)->intena    =    (UWORD) ((~INTF_PORTS)&(~INTF_SETCLR))
  97. #define    ENABLE      ((struct Custom*) 0xdff000)->intena    =    INTF_SETCLR|Intenar;
  98.  
  99. #else
  100.  
  101. #define    DISABLE
  102. #define    ENABLE
  103.  
  104. #endif
  105.  
  106. LONG            *MyArgs[INDEX_COUNT];
  107. struct Library        *SysBase;
  108. struct Library        *DOSBase;
  109. long long        Result;
  110. void            *MyTimerObject;
  111. ULONG            ticks;
  112. long long        allticks;
  113. long long        loopticks=0;
  114. ULONG            LoopCount=100;
  115. ULONG            MemSize;
  116. UWORD            Intenar;
  117. ULONG            CacheBorder;
  118. ULONG            CacheSize;
  119. char            *ArgumentString = "Size/N,Loop/N,Address/N,ASize/N,Full/S,Chip/S,Rom/S,MMU/S,CACHE/S";
  120.  
  121. void    CalcTimer(void);
  122. void    CacheTest(APTR    Source,
  123.                   APTR    Dest);
  124. void    MemoryBurstTest(APTR    Source,
  125.                         APTR    Dest,
  126.                         ULONG    Mode);
  127. void    MemorySingleTest(APTR    Source,
  128.                          APTR    Dest);
  129.  
  130.  
  131. /*------------------------------------------------------------------------*/
  132. /*------------------------------------------------------------------------*/
  133. /*------------------------------------------------------------------------*/
  134. /*------------------------------------------------------------------------*/
  135. /*------------------------------------------------------------------------*/
  136. /*------------------------------------------------------------------------*/
  137. /*------------------------------------------------------------------------*/
  138. /*------------------------------------------------------------------------*/
  139.  
  140. int    main(void)
  141. {
  142. struct RDArgs        *rdargs;
  143. struct TagItem        MyTags[2];
  144. APTR            Source;
  145. APTR            Dest;
  146.  
  147.   SysBase    =(struct Library*) *((ULONG*)4L);
  148.  
  149.   if (DOSBase=OpenLibrary("dos.library",0))
  150.   {
  151.     if (!(rdargs=ReadArgs(ArgumentString,(LONG*) &MyArgs[0],NULL)))
  152.     {
  153.       PPCprintf("Commandline Error\n");
  154.       return(20);
  155.     }
  156.     else
  157.     {
  158.       if (MyArgs[INDEX_LOOP])
  159.       {
  160.         LoopCount    =    *MyArgs[INDEX_LOOP];
  161.       }
  162.   
  163.       MyTags[0].ti_Tag    =    PPCTIMERTAG_CPU;
  164.       MyTags[0].ti_Data    =    TRUE;
  165.       MyTags[1].ti_Tag    =    TAG_END;
  166.       if (MyTimerObject=PPCCreateTimerObject(MyTags))
  167.       {
  168.         CacheBorder    =    0x10000;
  169.         CacheSize    =    0x8000;
  170.   
  171.         if (MyArgs[INDEX_SIZE])
  172.         {
  173.           MemSize    =    (*MyArgs[INDEX_SIZE] + 0xfff) & ~0xfff;
  174.         }
  175.  
  176.         MemSize    =    max(CacheBorder,MemSize);
  177.   
  178.  
  179.  
  180.         if ((MyArgs[INDEX_CACHE])    ||
  181.             (MyArgs[INDEX_FULL]))
  182.         {
  183.           if (CacheSize > 0)
  184.           {
  185.             if (Source=PPCAllocVec(CacheSize,
  186.                                    MEMF_FAST))
  187.             {
  188.               if (Dest=PPCAllocVec(CacheSize,
  189.                                    MEMF_FAST))
  190.               {
  191.                 CacheTest(Source,
  192.                           Dest);
  193.   
  194.                 PPCFreeVec(Dest);
  195.               }
  196.               else
  197.               {
  198.                 PPCprintf("Error: Can`t alloc Dest Fastram:\n");
  199.               }
  200.               PPCFreeVec(Source);
  201.             }
  202.             else
  203.             {
  204.               PPCprintf("Error: Can`t alloc Source Fastram:\n");
  205.             }
  206.           }
  207.         }
  208.  
  209.  
  210.   
  211.         if ((!MyArgs[INDEX_ADDRESS]) ||
  212.             (MyArgs[INDEX_FULL]))
  213.         {
  214.           if (Source=PPCAllocVec(ALLOCSIZE,
  215.                                  MEMF_FAST))
  216.           {
  217.             if (Dest=PPCAllocVec(ALLOCSIZE,
  218.                                  MEMF_FAST))
  219.             {
  220.               PPCprintf("CopyBack ");
  221.               MemoryBurstTest(Source,
  222.                               Dest,
  223.                               M68KCACHE_COPYBACK);
  224.   
  225.               PPCFreeVec(Dest);
  226.             }
  227.             else
  228.             {
  229.               PPCprintf("Error: Can`t alloc Dest Fastram:\n");
  230.             }
  231.             PPCFreeVec(Source);
  232.           }
  233.           else
  234.           {
  235.             PPCprintf("Error: Can`t alloc Source Fastram:\n");
  236.           }
  237.  
  238.  
  239.  
  240.           if ((MyArgs[INDEX_MMU]) ||
  241.               (MyArgs[INDEX_FULL]) )
  242.           {
  243.             if (Source=PPCAllocVec(ALLOCSIZE,
  244.                                    MEMF_FAST|MEMF_WRITETHROUGHPPC))
  245.             {
  246.               if (Dest=PPCAllocVec(ALLOCSIZE,
  247.                                    MEMF_FAST|MEMF_WRITETHROUGHPPC))
  248.               {
  249.                 PPCprintf("WriteThrough ");
  250.                 MemoryBurstTest(Source,
  251.                                 Dest,
  252.                                 M68KCACHE_WRITETHROUGH);
  253.   
  254.                 PPCFreeVec(Dest);
  255.               }
  256.               else
  257.               {
  258.                 PPCprintf("Error: Can`t alloc Dest Fastram:\n");
  259.               }
  260.               PPCFreeVec(Source);
  261.             }
  262.             else
  263.             {
  264.               PPCprintf("Error: Can`t alloc Source Fastram:\n");
  265.             }
  266.  
  267.  
  268.             if (Source=PPCAllocVec(ALLOCSIZE,
  269.                                    MEMF_FAST|MEMF_NOCACHEPPC))
  270.             {
  271.               if (Dest=PPCAllocVec(ALLOCSIZE,
  272.                                    MEMF_FAST|MEMF_NOCACHEPPC))
  273.               {
  274.                 PPCprintf("NoCache ");
  275.                 MemorySingleTest(Source,
  276.                                  Dest);
  277.   
  278.                 PPCFreeVec(Dest);
  279.               }
  280.               else
  281.               {
  282.                 PPCprintf("Error: Can`t alloc Dest Fastram:\n");
  283.               }
  284.               PPCFreeVec(Source);
  285.             }
  286.             else
  287.             {
  288.               PPCprintf("Error: Can`t alloc Source Fastram:\n");
  289.             }
  290.  
  291.  
  292.             if (Source=PPCAllocVec(ALLOCSIZE,
  293.                                    MEMF_FAST|MEMF_NOCACHESYNCPPC))
  294.             {
  295.               if (Dest=PPCAllocVec(ALLOCSIZE,
  296.                                    MEMF_FAST|MEMF_NOCACHESYNCPPC))
  297.               {
  298.                 PPCprintf("NoCacheSync ");
  299.                 MemorySingleTest(Source,
  300.                                  Dest);
  301.   
  302.                 PPCFreeVec(Dest);
  303.               }
  304.               else
  305.               {
  306.                 PPCprintf("Error: Can`t alloc Dest Fastram:\n");
  307.               }
  308.               PPCFreeVec(Source);
  309.             }
  310.             else
  311.             {
  312.               PPCprintf("Error: Can`t alloc Source Fastram:\n");
  313.             }
  314.           }
  315.         }
  316.  
  317.  
  318.         if ((MyArgs[INDEX_CHIP]) ||
  319.             (MyArgs[INDEX_FULL]))
  320.         {
  321.           if (Source=PPCAllocVec(ALLOCSIZE,
  322.                                  MEMF_CHIP))
  323.           {
  324.             if (Dest=PPCAllocVec(ALLOCSIZE,
  325.                                  MEMF_CHIP))
  326.             {
  327.               PPCprintf("Chipram:\n");
  328.               MemorySingleTest(Source,
  329.                                Dest);
  330.               PPCFreeVec(Dest);
  331.             }
  332.             else
  333.             {
  334.               PPCprintf("Error: Can`t alloc Source Fastram:\n");
  335.             }
  336.             PPCFreeVec(Source);
  337.           }
  338.           else
  339.           {
  340.             PPCprintf("Error: Can`t alloc Source Fastram:\n");
  341.           }
  342.         }
  343.  
  344.         if ((MyArgs[INDEX_ROM]) ||
  345.             (MyArgs[INDEX_FULL]))
  346.         {
  347.           PPCprintf("Rom:\n");
  348.           MemoryBurstTest((APTR) 0xf80000,
  349.                           NULL,
  350.                           M68KCACHE_COPYBACK);
  351.         }
  352.   
  353.         if (MyArgs[INDEX_ADDRESS])
  354.         {
  355.           if (MyArgs[INDEX_ADDRESSSIZE])
  356.           {
  357.             MemSize    =    (*MyArgs[INDEX_ADDRESSSIZE] + 0xfff) & ~0xfff;
  358.           }
  359.           PPCprintf("Ram Size 0x%lx Loop Count %ld\n",
  360.                     MemSize,
  361.                     LoopCount);
  362.   
  363.           PPCprintf("0x%08lx - 0x%08lx: assumes cacheoff at the address\n",
  364.                     *MyArgs[INDEX_ADDRESS],
  365.                     *MyArgs[INDEX_ADDRESS] + MemSize);
  366.   
  367.           MemorySingleTest((APTR) *MyArgs[INDEX_ADDRESS],
  368.                            NULL);
  369.         }
  370.         PPCDeleteTimerObject(MyTimerObject);
  371.       }
  372.     }
  373.     CloseLibrary(DOSBase);
  374.     return(0);
  375.   }
  376.   else
  377.   {
  378.     PPCprintf("Can`t open dos.library\n");
  379.   }
  380.   return(20);
  381. }
  382.  
  383. /*------------------------------------------------------------------------*/
  384. /*------------------------------------------------------------------------*/
  385. /*------------------------------------------------------------------------*/
  386. /*------------------------------------------------------------------------*/
  387. /*------------------------------------------------------------------------*/
  388. /*------------------------------------------------------------------------*/
  389. /*------------------------------------------------------------------------*/
  390. /*------------------------------------------------------------------------*/
  391.  
  392. void    CalcTimer(void)
  393. {
  394.   PPCGetTimerObject(MyTimerObject,
  395.                     PPCTIMERTAG_TICKSPERSEC,
  396.                     &Result);
  397.  
  398.   ticks        =    Result;
  399.  
  400.   PPCGetTimerObject(MyTimerObject,
  401.                     PPCTIMERTAG_DIFFTICKS,
  402.                     &Result);
  403.  
  404.   allticks    =    Result;
  405. #if 0
  406.   PPCprintf("%Ld ticks\n",Result);
  407. #endif
  408.  
  409. }
  410.  
  411. /*------------------------------------------------------------------------*/
  412. /*------------------------------------------------------------------------*/
  413. /*------------------------------------------------------------------------*/
  414. /*------------------------------------------------------------------------*/
  415. /*------------------------------------------------------------------------*/
  416. /*------------------------------------------------------------------------*/
  417. /*------------------------------------------------------------------------*/
  418. /*------------------------------------------------------------------------*/
  419.  
  420. void    CacheTest(APTR    Source,
  421.                   APTR    Dest)
  422. {
  423. long long    Size;
  424. ULONG        LoopCount;
  425.  
  426.   PPCprintf("CPU Cache isn`t working yet..measurements are wrong\n");
  427.  
  428. #if CACHETEST
  429.   LoopCount    =    100*100;
  430. //  Size    =    CacheSize;
  431.   Size        =    4096;
  432.  
  433.   PPCprintf("CPU Cache Performance Statistics\n");
  434.  
  435.   DISABLE;
  436.  
  437.   TIMEPRE;
  438.   memreadlonglongtime(Source,Size>>5,LoopCount);
  439.   TIMEPOST;
  440.   loopticks=allticks;
  441.  
  442.   TIMEPRE;
  443.   memreadlonglong(Source,Size>>5,LoopCount);
  444.   TIMEPOST;
  445.  
  446.   PPCprintf("%16Ld 64Bit   Read\t%4g MB/s Mem Bandwidth\n",
  447.             Size,
  448.             ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  449.  
  450.  
  451.   TIMEPRE;
  452.   memreadlongtime(Source,Size>>5,LoopCount);
  453.   TIMEPOST;
  454.   loopticks=allticks;
  455.  
  456.   TIMEPRE;
  457.   memreadlong(Source,Size>>5,LoopCount);
  458.   TIMEPOST;
  459.  
  460.   PPCprintf("%16Ld Long   Read\t%4g MB/s Mem Bandwidth\n",
  461.             Size,
  462.             ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  463.  
  464.  
  465.   TIMEPRE;
  466.   memreadwordtime(Source,Size>>5,LoopCount);
  467.   TIMEPOST;
  468.   loopticks=allticks;
  469.  
  470.   TIMEPRE;
  471.   memreadword(Source,Size>>5,LoopCount);
  472.   TIMEPOST;
  473.   PPCprintf("%16Ld Word   Read\t%4g MB/s Mem Bandwidth\n",
  474.             Size,
  475.             ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  476.  
  477.  
  478.   TIMEPRE;
  479.   memreadbytetime(Source,Size>>5,LoopCount);
  480.   TIMEPOST;
  481.   loopticks    =    allticks;
  482.  
  483.   TIMEPRE;
  484.   memreadbyte(Source,Size>>5,LoopCount);
  485.   TIMEPOST;
  486.   PPCprintf("%16Ld Byte   Read\t%4g MB/s Mem Bandwidth\n",
  487.             Size,
  488.             ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  489.  
  490.  
  491.   ENABLE;
  492.  
  493. #endif
  494. }
  495.  
  496. /*------------------------------------------------------------------------*/
  497. /*------------------------------------------------------------------------*/
  498. /*------------------------------------------------------------------------*/
  499. /*------------------------------------------------------------------------*/
  500. /*------------------------------------------------------------------------*/
  501. /*------------------------------------------------------------------------*/
  502. /*------------------------------------------------------------------------*/
  503. /*------------------------------------------------------------------------*/
  504.  
  505. void    MemoryBurstTest(APTR    Source,
  506.                         APTR    Dest,
  507.                         ULONG    Mode)
  508. {
  509. long long    Size;
  510.  
  511.   DISABLE;
  512.  
  513.   PPCprintf("Bus Burst Performance Statistics\n");
  514.  
  515.   for (Size=CacheBorder;Size<=MEMSIZE;Size<<=1)
  516.   {
  517.     TIMEPRE;    
  518.     memreadlinetime(Source,(ULONG)(Size>>5),LoopCount);
  519.     TIMEPOST;
  520.     loopticks=allticks;
  521.  
  522.     TIMEPRE;    
  523.     memreadline(Source,(ULONG) (Size>>5),LoopCount);
  524.     TIMEPOST;
  525.  
  526.     PPCprintf("%16Ld Line   Read\t%4g MB/s Mem Bandwidth\n",
  527.               Size,
  528.               ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  529.  
  530.     if (PPCSetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
  531.     {
  532.       return;
  533.     }
  534.  
  535.   }
  536.  
  537.   if ((ULONG) Source != 0xf80000)
  538.   {
  539.     if (Mode == M68KCACHE_WRITETHROUGH)
  540.     {
  541.       /* To use the Writebuffer in writethrough
  542.        * we have to use linear write accesses
  543.        */
  544.       for (Size=CacheBorder;Size<=MEMSIZE;Size<<=1)
  545.       {
  546.         TIMEPRE;
  547.         memwritelinetime2(Source,(ULONG) (Size>>5),LoopCount);
  548.         TIMEPOST;
  549.         loopticks    =    allticks;
  550.  
  551.         TIMEPRE;
  552.         memwriteline2(Source,(ULONG) (Size>>5),LoopCount);
  553.         TIMEPOST;
  554.         PPCprintf("%16Ld Line   Write\t%4g MB/s Mem Bandwidth\n",
  555.                   Size,
  556.                   ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  557.  
  558.         if (PPCSetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
  559.         {
  560.           return;
  561.         }
  562.  
  563.       }
  564.     }
  565.     else
  566.     {
  567.       /* For copyback modes it`s enough to read the first long
  568.        * from the cacheline. The buscontroller stalls the cpu
  569.        * until the whole line is loaded so additional loads
  570.        * would only add additional cache accesses though the
  571.        * line is already loaded
  572.        */
  573.       for (Size=CacheBorder;Size<=MEMSIZE;Size<<=1)
  574.       {
  575.         TIMEPRE;
  576.         memwritelinetime(Source,(ULONG) (Size>>5),LoopCount);
  577.         TIMEPOST;
  578.         loopticks    =    allticks;
  579.  
  580.         TIMEPRE;
  581.         memwriteline(Source,(ULONG) (Size>>5),LoopCount);
  582.         TIMEPOST;
  583.         PPCprintf("%16Ld Line   Write\t%4g MB/s Mem Bandwidth\n",
  584.                   Size,
  585.                   ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  586.  
  587.  
  588.         if (PPCSetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
  589.         {
  590.           return;
  591.         }
  592.       }
  593.     }
  594.   }
  595.   ENABLE;
  596. }
  597.  
  598.  
  599. /*------------------------------------------------------------------------*/
  600. /*------------------------------------------------------------------------*/
  601. /*------------------------------------------------------------------------*/
  602. /*------------------------------------------------------------------------*/
  603. /*------------------------------------------------------------------------*/
  604. /*------------------------------------------------------------------------*/
  605. /*------------------------------------------------------------------------*/
  606. /*------------------------------------------------------------------------*/
  607.  
  608. void    MemorySingleTest(APTR    Source,
  609.                          APTR    Dest)
  610. {
  611. long long    Size;
  612.  
  613.   PPCprintf("- Bus CacheMode Performance Statistics\n");
  614.  
  615.   DISABLE;
  616.  
  617.   for (Size=4096;Size<=MEMSIZE;Size<<=1)
  618.   {
  619.     TIMEPRE;    
  620.     memreadlongtime(Source,(ULONG) (Size>>5),LoopCount);
  621.     TIMEPOST;
  622.     loopticks=allticks;
  623.  
  624.     TIMEPRE;    
  625.     memreadlong(Source,(ULONG) (Size>>5),LoopCount);
  626.     TIMEPOST;
  627.  
  628.     PPCprintf("%16Ld Long   Read\t%4g MB/s Mem Bandwidth\n",
  629.               Size,
  630.               ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  631.  
  632.     TIMEPRE;
  633.     memreadwordtime(Source,(ULONG) (Size>>5),LoopCount);
  634.     TIMEPOST;
  635.     loopticks=allticks;
  636.  
  637.     TIMEPRE;
  638.     memreadword(Source,(ULONG) (Size>>5),LoopCount);
  639.     TIMEPOST;
  640.     PPCprintf("%16Ld Word   Read\t%4g MB/s Mem Bandwidth\n",
  641.               Size,
  642.               ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  643.  
  644.  
  645.     TIMEPRE;
  646.     memreadbytetime(Source,(ULONG) (Size>>5),LoopCount);
  647.     TIMEPOST;
  648.     loopticks    =    allticks;
  649.  
  650.     TIMEPRE;
  651.     memreadbyte(Source,(ULONG) (Size>>5),LoopCount);
  652.     TIMEPOST;
  653.     PPCprintf("%16Ld Byte   Read\t%4g MB/s Mem Bandwidth\n",
  654.               Size,
  655.               ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  656.  
  657.     if (PPCSetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
  658.     {
  659.       return;
  660.     }
  661.   }
  662.  
  663.   if ((ULONG) Source != 0xf80000)
  664.   {
  665.     for (Size=4096;Size<=MEMSIZE;Size<<=1)
  666.     {
  667.       TIMEPRE;
  668.       memreadlongtime(Source,(ULONG) (Size>>5),LoopCount);
  669.       TIMEPOST;
  670.       loopticks    =    allticks;
  671.  
  672.       TIMEPRE;
  673.       memwritelong(Source,(ULONG) (Size>>5),LoopCount);
  674.       TIMEPOST;
  675.       PPCprintf("%16Ld Long   Write\t%4g MB/s Mem Bandwidth\n",
  676.                 Size,
  677.                 ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  678.  
  679.       TIMEPRE;
  680.       memreadwordtime(Source,(ULONG) (Size>>5),LoopCount);
  681.       TIMEPOST;
  682.       loopticks    =    allticks;
  683.  
  684.       TIMEPRE;
  685.       memwriteword(Source,(ULONG) (Size>>5),LoopCount);
  686.       TIMEPOST;
  687.       PPCprintf("%16Ld Word   Write\t%4g MB/s Mem Bandwidth\n",
  688.                 Size,
  689.                 ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  690.  
  691.       TIMEPRE;
  692.       memreadbytetime(Source,(ULONG) (Size>>5),LoopCount);
  693.       TIMEPOST;
  694.       loopticks    =    allticks;
  695.  
  696.       TIMEPRE;
  697.       memwritebyte(Source,(ULONG) (Size>>5),LoopCount);
  698.       TIMEPOST;
  699.       PPCprintf("%16Ld Byte   Write\t%4g MB/s Mem Bandwidth\n",
  700.                 Size,
  701.                 ((double) ((Size * LoopCount * ticks ) / (allticks - loopticks))) / (1024*1024));
  702.  
  703.  
  704.       if (PPCSetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
  705.       {
  706.         return;
  707.       }
  708.     }
  709.   }
  710.  
  711.  
  712.   ENABLE;
  713. }
  714.  
  715.  
  716.  
  717.