Home
Running the Dhrystone Benchmark for the MPC500 Family
Contents
1. Figure 1 File Directory Structure The makefile illustrates the steps necessary to compile the Dhrystone example The comments in the makefile serve as instructions The Dhrystone code is compiled by placing all of the source files in one directory and using the make f makefile instruction on a command line The output file is named in the EXECUTABLE DhryOut line and will be called DhryOut elf The makefile is used with the make command In the makefile a list of modules can be used as variables for building an object and source file list Suffixes are included with the variables of the makefile Diab Data includes a dmake command line tool which requires a slightly altered version of the makefile This version shown in Section 3 3 Listing 2 The Dmakefile is called the dmakefile The calling Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 3 Compiling and Running the Dhrystone Program for the MPC500 Family command for this version is dmake f dmakefile The dmake file requires the object file list to be specifically spelled out In dmake the file suffixes are added on a separate command line in the dmakefile Either the make or dmake command will work with the appropriate syntax 3 2 Listing 1 The Makefile HEIDE a IE IIIS III IIIS I II HO I IIIS II II III II II III III III IIA IIIA akefile for Motorola MPC500 Power PC compatible compiled code for Dhrystone ver 2 1 U
2. Int 1 Loc 3 Int 2 Loc 3 Int 3 Loc 7 Proc 8 Arr 1 Glob Arr 2 Glob Int 1 Loc Int 3 Loc Int Glob Proc 1 Ptr Glob Dej for Ch Index A Ch Index lt Ch 2 Glob Ch Index if Enum Loc then no loop body executed twice Func 1 Ch Index C t executed Proc 6 Ident 1 amp Enum Loc strcpy Str 2 Loc DHRYSTONE PROGRAM 3 RD STRING Int 2 Loc R Int Glob Ru Int 1 Loc Int 2 Loc Int 2 Int 1 Loc Int 2 Int 2 Loc 7 Int 1 Loc 1 Proc 2 amp Int 1 Lo Int 1 Loc un Index n Index 3 Int 2 Loc 3 Int 3 Loc 7 Loc Int 1 Loc Loc Int 3 Loc Int 2 Loc Int 3 Loc Int 1 Loc Int 2 Loc 13 Int 3 Loc 7 c 5 loop for Run Index KR KK x e e x e A e x Stop timer f kk x e e x e e e x x ifdef TIMES times amp time info End Time long t endif ifdef TIME End Time time endif ifdef MSC CLOCK End Time clock endif Jk ke ke ek e begin GJ ime info tms utime long 0 changes CkCkCk ck k kc kckckckckckckckckck kk kk ke Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Code Listings Freescale Semiconductor 23 errr Code Listings New function for PPC compatible clock x x x EndTime clock Look at register value for Dhry Ticks a
3. printf Int Glob Sd n Int Glob JI printf should be Sa n v 5 printf Bool Glob sd n Bool Glob printf should be Sd n 1 printf Ch 1 Glob sc n Ch 1 Glob printf should be Sc n A printf Ch 2 Glob sc n Ch 2 Glob printf should be Sc n B printf Arr 1 Glob 8 sd n Arr 1 Glob 8 printf should be dWn 7 printf Arr 2 Glob 8 7 d n Arr 2 Glob 8 7 Lf printf C should be Number Of Runs 10 n printf Ptr Glob in printf Ptr Comp sd n int Ptr Glob Ptr Comp printf should be implementation dependent Nn printf Discr sd n Ptr Glob gt Discr Running the Dhrystone Benchmark for the MPC500 Family Rev 1 24 Freescale Semiconductor Code Listings printf should be Sa n 0 printf Enum Comp sd n Ptr Glob gt variant var 1 Enum Comp printf should be dWn 2 printf Int Comp d n Ptr Glob variant var 1 Int Comp printf should be Sdin 17 printf Str Comp sWn Ptr Glob variant var 1 Str Comp printf should be DHRYSTONE PROGRAM SOME STRING n printf Next Ptr Glob gt n printf Ptr Comp sd n int Next Ptr Glob Ptr Comp printf should be implementation dependent same as above n printf Discr sd n Next Ptr Glob gt D
4. 4 3 3 Listing 2 The Dmakelile acoso 5 3 4 Listing 3 The Linkfile evb lin 6 3 5 Running Code for the Dhrystone Program 7 Code Compressed Version of the Dhirystone Program 3 2 5 4424 e pre RE ERR 7 4 1 Compiling Code for Compression 7 4 2 Running Compressed Dhrystone Code 8 Conclusions and RESURS r urhe be Pes 9 5 1 Calculating the Results 9 5 2 Running and Viewing Results 10 5 3 OOneisonS z 425458 REPE PP CO d ss 11 Gode Listinig amp reris sanai iik fedi donde 2 11 6 1 Lis ng4 Dhty Fi csse kr rS Ren dl 62 Sina Dry 18 375 204 bene kho eed 19 6 3 SINGS Diet ovs vehe yr eects eee saat 28 B Sn T COCKE iro oc rapan rae eee AI Ear 31 6 5 Listing 8 CHOS e ices zo bi c av agke beds tns 32 Document Revision History sess ener m 34 zx freescale semiconductor Detailed Description application code results will depend on the system configuration code function and whether the code is structured to take full advantage of the MPC500 family features 2 Detailed Description Five program files are required for this application to compile Three of the files are the original Dhrystone 2 1 files Dhry h Dhry 1 c and Dhry 2 c The two remaining files clock c and Crt0 s are used to support the specific timing needs of the MPC500 PowerPC compatible family Two additional files evb lin the link file and the makefile are inc
5. define Mic secs Per Second 1000000 0 Berkeley UNIX C returns process times in seconds HZ end GJ changes KCKCkCk Ck k Ck k ck kckckckckckckokckok ck ke kk ke ex ifdef define else define endif NOSTRUCTASSIGN structassign d s memcpy amp d amp s sizeof d structassign d s d s ifdef define define define NOENUM Ident_1 0 Ident_2 1 Ident 3 2 define Ident 4 3 define Ident 5 4 typedef int else typedef Enumeration enum Ident 1 Enumeration Ident 2 Ident 3 Ident 4 Ident 5 endif for boolean and enumeration types in Ada Pascal General definitions include lt stdio h gt for strcpy strcmp define Null 0 Value of a Null pointer define true 1 Running the Dhrystone Benchmark for the MPC500 Family Rev 1 18 Freescale Semiconductor gt Code Listings define false 0 typedef int One Thirty typedef int One Fifty typedef char Capital Letter typedef int Boolean typedef char Str 30 31 typedef int Arr 1 Dim 50 typedef int Arr 2 Dim 50 50 typedef struct record struct record Ptr Comp Enumeration Disexr union struct Enumeration Enum Comp int Int Comp char Str Comp 31 var 1 struct Enumeration E Comp 2 char Str 2 Comp 31 var 2 struct char Ch 1 Comp char Ch 2 Comp k vat variant Rec Type Rec Pointer 6 2 Listing 5 Dhry1 c KKK KK
6. addis r12 r0 0x0 stw r12 0 r11 Turn on the Time Base addis r11 r0 0x002F ori r11 r11 0xc200 addis r12 r0 0x0 ori r12 r12 0x1 sth r12 0 r11 Turn off serialization for benchmarking purposes Can t modify ICTRL from running code while using a debugger Has to set ICTRL from a debugger Set ICTRL to 0x7 to turn off the show cycles addis r12 r0 0x0 ori rl12 r12 0x7 mtspr 158 r12 isync Running the Dhrystone Benchmark for the MPC500 Family Rev 1 32 Freescale Semiconductor nop Enable the Floating Point mfmsr r3 ori r3 r3 0x2000 mtmsr r3 isync nop isync sync addis rl1 r0 SP INITGha 4 Initialize stack pointer rl to ori rl rll SP INITG1 4 value in linker command file addis r13 r0 SDA BASE ha Initialize r13 to sdata base ori r13 r13 SDA BASE 1 provided by linker addis r2 r0 SDA2 BASE ha Initialize r2 to sdata2 base ori r2 r2 SDA2 BASE 1 provided by linker addi r0 r0 0 Clear r0 stwu r0 64 r1 4 Terminate stack P4 Insert other initialize code here P4 bl init main Finish initialization call main b exit Never returns bl main Dummy to pull in main as soon as possible AE sinit SECU ONY 5 5 5 6 56 section init 00 2 C globl init Entry to init called by mfspr r0 8 init main called above stwu r1 64 r1 Stw r0 68 r1 Linker places init sections from other
7. the code is compiled with the hooks that are needed later for compression Next a vocabulary is generated for code decompression Third the code is compressed and stored as a loadable elf file Finally the compressed code can be run after loading the DECRAM The file structure is kept simple to serve as a quick and easy example The file structure is illustrated in Figure 2 The command line instructions including the compression instructions are invoked from this directory Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 7 Code Compressed Version of the Dhrystone Program Directory Address HOMEdirectory dhrystones Z Source Files Output Files E Command line instructions are Dhry h DhryOutc elf invoked in this directory Dhry 1 c DhryOutc s19 Dhry 2 c DhryOutc map c DhryOutc cmap Subdirectory Address rt0 s Dh elf makefile Woo HOMEdirectory dhrystones sqz vocs C evb lin sqz_vocs Base ace the c file into this sub directory DO24 4005 cfb Figure 2 Code Compression File Directory Structure To compile with compression hooks the makefiles illustrated above need only their COPTS AOPTS and LOPTS lines altered The alternative lines are present in the makefiles and may be commented in after the original lines are commented out For COPTS and AOPTS the Xprepare compress option is added For LOPTS linker options the option of X
8. Ptr Glob Ptr Glob Discr Ident 1 Ptr Glob variant var 1 Enum Comp Ident 3 Ptr Glob gt variant var 1 Int Comp 40 strcpy Ptr Glob gt variant var 1 Str Comp DHRYSTONE PROGRAM SOME STRING strcpy Str 1 Loc DHRYSTONE PROGRAM 1 ST STRING Arr 2 Glob 8 7 10 Was missing in published program Without this statement Arr 2 Glob 8 7 would have an undefined value Warning With 16 Bit processors and Number Of Runs 32000 overflow may occur for this array element f kx x e e x begin Gis changes EK KK KK KKK kA KK comment out printf statements Xe KK printf in printf Dhrystone Benchmark Version 2 1 Language C n printf in if Reg zy Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Code Listings Freescale Semiconductor 21 errr Code Listings 1 printf Program compiled with register attribute n printf n else 1 printf Program compiled without register attribute n printf n printf Please give the number of runs through the benchmark n 4 Lf bt 8 Comment out and bypass the scanf input GJ 112901 scanf d amp n Number Of Runs 1000000 printf Nn prin Execution starts d runs roug rystone n Number uns tf t tart d th h Dhrystone n Number Of Runs KK KKK x x x x end GJ changes XO
9. 1 Par Val int Int 2 Par Val REG One Fifty Int Loc Int Loc Int 1 Par Val Arr 1 Par Ref Int Loc Arr 1 Par Ref Int Loc Arr 1 Par Ref Int Loc REG One Fifty Int Index L 5 Int_2 Par Val tl Arr 1 Par Ref Int Loc 30 Int Loc for Int Index Int Loc Int Index lt Int Loc 1 Int Index Arr 2 Par Ref Int Loc Int Index Int Loc Arr 2 Par Ref Int Loc Int Loc 1 1 Arr 2 Par Ref Int Loci Int Glob 5 Proc 8 20 Int Loc Arr 1 Par Ref Int Loc Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Code Listings Freescale Semiconductor 29 eer Code Listings Enumeration Func 1 Ch 1 Par Val Ch 2 Par Val KKK kk kk kA I kk ke kk kk ke ke ke ke kk ek ke ke ke ek executed three times aA pe first call Ch 1 Par Val H Ch 2 Par Val R x second call Ch 1 Par Val A Ch 2 Par Val C 27 third call Ch 1 Par Val B Ch 2 Par Val C A Capital Letter Ch 1 Par Val Capital Letter Ch 2 Par Val Capital Letter Ch 1 Loc Capital Letter Ch 2 Loc Ch 1 Loc Ch 1 Par Val Ch 2 Loc Ch 1 Loc if Ch 2 Loc Ch 2 Par Val then executed return Ident 1 else not executed Ch 1 Glob Ch 1 Loc return Ident 2 Z Funes I Boolean Func 2 Str 1 Par Ref Str 2 Par Ref J KCKCECK Ck kk kk kk Kk kk kk CK k kok k kok k kok kk kok k ke koe ek ek eee e
10. 66 hardware must be initialized in compression mode This can be performed with the reset configuration word bits 21 comp en bit and 22 exc comp bit set at power on reset The Flash Running the Dhrystone Benchmark for the MPC500 Family Rev 1 8 Freescale Semiconductor Conclusions and Results programmer tools will work in this configuration With the DhryOutc sqz elf file loaded into Flash the IP must be set to a program location that will load the DECRAM with the vocabulary After the vocabulary is loaded the program will proceed to the beginning of the program and continue to run until completion If the DECRAM has been loaded further compression mode runs will work with the IP set to the beginning of the program In code compression mode the IP address value must be shifted left by two bits If the initial IP address is 0x10000 then the value of 0x40000 must be entered into the IP value This is the major difference between compressed and non compressed operation When observing code in the debug window the non compressed address will be visible and the IP will point to this non compressed address The initial IP address is found in the DhryOutc elf cmap file The sqz dib text address is the first address location at which the IP setting will download the DECRAM and proceed on to the regular program For additional runs of the Dhrystone program the IP can be set to the text address in the cmap file left shift this address b
11. ABLE s19 EXECUTABLE elf 3 4 Listing 3 The Linkfile evb lin The program in listing 3 shows the link file evb lin The memory area sets the starting location and length of the code The starting point of RAM values and length are also set in this area The main code is organized at 0x2000 because the address space between 0x0 and Ox 1FFF is reserved for an exception table Exceptions are not used in this example so that a minimal Dhrystone version can be illustrated The Sections part of the code provides structure definitions used in the Diab Data C compile The variables at the end of the link file assign actual address values to each of the groups and subsections RK KK k k KA Kk Kk KA kk kk A K Ak Ak kk ke kk Ak kc ke kk kk kk ke koe ke e e evb lin link file for MPC500 Memory locations 0x0 0x2000 are reserved for exception table MEMORY internal flash org 0x2000 len 0x10000 internal ram org 0x3f9800 len 0x57F0 stack org Ox3ff000 len OxFFO SECTIONS The following instructions will only work with an exceptions s file reset exception 0x100 ext irq exception 0x500 Xy GROUP text TEXT s text rodata rdata init fini eini Sdata2 TEXT Running the Dhrystone Benchmark for the MPC500 Family Rev 1 6 Freescale Semiconductor Code Compressed Ve
12. C Author Glenn J Motorola Date 12 07 01 Copyright 2001 Motorola All Rights Reserved KK A CkCKCK CK KC XX A AA CK kk k kk kk kk k Kok A kk oko ke ke ke ke e ke e x x void InitTimer unsigned long clock void IntHdlr static long counter The interrupt handler is not implemented yet void IntHdlr Interrupt handler to be located at 900 for ppc decrementer counter increment roll over count void InitTimer Set decrementer to max value Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 31 errr Code Listings May want this to be a macro asm lis r3 0xFFFF asm ori r3 r3 OxFFFF asm mtspr 22 DS y unsigned long clock Read PPC decrementer and return count asm mfspr r3 22 6 5 Listing 8 Crt0 s FILE CRTO S startup for an embedded environment PowerPC Author Djonli Motorola GSD Global Software Division Austin Center Changes 12 07 01 GJ Shortened the file for Dhrystone Date 03 30 99 Copyright 1999 Motorola 7 All Rights Reserved file crt0gc Cex globl start align 2 addi r0 r0 0 Debuggers may object to starting at 0 Start Disable Watchdog addis r11 r0 0x002F ori rll1 r11 0xC004 addis r12 r0 0x0 ori r12 r12 0xFF00 stw r12 0 r11 Set IMB to Full Speed addis rl11 r0 0x0030 ori rl1 r11 0x7f80
13. Freescale Semiconductor Application Note Document Number AN2354 Rev 1 08 2008 Running the Dhrystone Benchmark for the MPC500 Family by Glenn Jackson TECD Applications This application note provides an adaptation of the standard Dhrystone version 2 1 to the Motorola MPC500 family of PowerPC architecture compliant MCUs Dhrystone version 2 1 is a publicly available standard for benchmarking various CPUs All benchmarks are made relative to the original VAX Dhrystone The original Dhrystone 2 1 function remains intact for this application with changes made only to the wrapper code that permits timing for the MPC500 PowerPC architecture compliant family 1 Overview The Dhrystone benchmark is intended to provide a compact benchmark The user will be able to run the Dhrystone program to detect relative performance differences between internal and external memory settings and other system configurations Due to the universal nature of the Dhrystone benchmark results will not confirm optimal performance for the MPC500 PowerPC architecture family The user s final Freescale Semiconductor Inc 2003 2008 All rights reserved Contents OVEMIEW cube ci db bod dd RP REDE don Shak 1 Detalled DasErlptlOl lt itioserrtaroaeeuneieetdadees 2 Compiling and Running the Dhrystone Program for the MPC500 Family 3 3 4 Compiling Code for the Dhrystone Program 3 3 2 Listing 1 The Makefile 4 4
14. KCkCk Ck kokck kk kk kk ke ke ee ee e e x KR KKK e e e e Start timer f A kx ke e e e e e e e e X ifdef TIMES times amp time info Begin Time long time info tms utime endif ifdef TIME Begin Time time long 0 endif ifdef MSC CLOCK InitTimer Begin Time clock endif begin GJ additions for PowerPC Architecture k Conditional printout to mark beginning of benchmark ifdef PRINTOUT printf Dhrystone BENCHMARKS STARTS gt gt gt gt gt gt gt gt gt gt gt n n fendif x Initialize timer and get start time value Xe f InitTimer BeginTime clock f kx x e e x end GJ changes CKCkCk ck k KK KK KK kk ke ke e START Dhrystone Benchmark for Run Index 1 Run Index lt Number Of Runs Run Index Proc 5 Proc 4 Ch 1 Glob A Ch 2 Glob B Bool Glob true Running the Dhrystone Benchmark for the MPC500 Family Rev 1 22 Freescale Semiconductor Int Loc 9 Int 2 Loc 3 strcpy Str 2 Loc Enum Loc Ident 2 DHRYSTONE PROGRAM 2 ND STRING T Bool Glob Func 2 Str 1 Loc Str 2 Loc Bool Glob 1 while Int 1 Loc lt Int 2 Loc loop body executed once Int 3 Loc 5 Int 1 Loc Int 2 Loc Int 3 Loc 7 Proc 7 Int 1 Loc Int 2 Loc amp Int 3 Loc Int 3 Loc 7 Int 1 Loc 1 while
15. Ox3F9B3C in the internal RAM In the Lauterbach debug tool the variables can be observed with the Var view Dhry Ticks and Var view Seconds commands In the SDS debug tool the variables can be observed with the watch Dhry_Ticks and watch Seconds commands A watch window will pop up and reveal the variable values This value is the number of seconds entered into the equation above Note that a change in compile or make options may change the hex address location for Dhry_Ticks and Seconds Results from Dhrystone running times are shown in Table 1 below The internal Flash times were run on an MPC555 at 40MHz and an MPC563 at 56MHz The external Flash times were run on an MPC561 with a sample burst mode timing of 4 1 1 1 and a sample extended burst mode timing of 4 1 1 1 1 1 1 1 The external times were run on the MPC561 at 32MHz and the results were interpolated up to the 56MHz value This is legitimate since the results of these benchmarks are linear with respect to clock speed The 32MHz clock speed is the fastest time that the evaluation board would run and still achieve the 1 clock secondary burst timings This timing simulates results that will be possible for future external Flashes Table 1 MPC500 Dhrystone Results Device Speed System Config BTB Dhry_ticks Seconds MB yog MPC555 40 MHz Internal Flash Off 10 375 000 10 375 62 59 Ox2BDO MPC56x 56 MHz Internal Flash On 7 321 428 7 32 88 71 Ox2BDO MPC56x 56 MHz Internal Flas
16. Runs Dhrystones Per Second float Number Of Runs float User Time else Microseconds float User Time Mic secs Per Second s float HZ float Number Of Runs Dhrystones Per Second float HZ float Number Of Runs float User Time endif Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 25 errr Code Listings printf Microseconds for one run through Dhrystone printf 6 1f n Microseconds printf Dhrystones per Second printf 6 1f Mn Dhrystones Per Second printf Mn 3 end GJ changes to comment out original timing effort KK KK KK RK x x end GJ changes kkkkkkkk RK ee e e x Proc 1 Ptr Val Par f Kk e e k e ke e e e KK x REG Rec Pointer Ptr Val Par executed once REG Rec Pointer Next Record Ptr Val Par gt Ptr Comp Ptr Glob Next Local variable initialized with Ptr Val Par gt Ptr Comp corresponds to rename in Ada with in Pascal structassign Ptr Val Par Ptr Comp Ptr Glob Ptr Val Par variant var 1 Int Comp 5 Next Record variant var l Int Comp Ptr Val Par variant var l Int Comp Next Record gt Ptr Comp Ptr Val Par gt Ptr Comp Proc 3 amp Next Record Ptr Comp Ptr Val Par gt Ptr Comp gt Ptr Comp Ptr Glob gt Ptr Comp if Next Record Discr Ident 1 then executed N
17. added to the if statement in K Func 3 and a non executed else part removed from Proc 3 Ck ck ck ck ck kock kk ck A KA A AA Ck Ck ZK AZ A A Ck AXA ZA ZAK AZ A A ZA ZAZ AK AA ZA A KA ZAZ ZK AA kk kk Sk Ck Sk A kA ko ko ko ko ko KK KK Defines The following Defines are possible DREG register default Not defined i As an approximation to what an average C programmer might do the register storage class is applied if enabled by DREG register i for local variables if they are used dynamically five or more times u for parameters if they are used dynamically Six or more times W Note that an optimal register strategy is compiler dependent and that register declarations do not necessarily lead to faster execution DNOSTRUCTASSIGN default Not defined Define if the C compiler does not support i assignment of structures i DNOENUMS default Not defined d Define if the C compiler does not support enumeration types DTIMES default x DTIME The times function of UNIX returning process times or the time function returning wallclock time X is used for measurement x For single user machines time is adequate For i multi user machines where you cannot get single user A access use the times function If you have d neither use a stopwatch in the dead of night printf s are provided marking the points Start Timer and Stop Timer DO NOT use
18. ams The variables and structure definitions affect the functioning of the Dhrystone program and have not been changed e The Dhryl c program consists of a wrapper and main program The wrapper portion contains timing definitions and variables that have been added for MPC500 operation Timer variables for processors other than the MPC500 have been commented out There are also printf statements in the Dhryl c program which have been commented out The printf statements may be reactivated as they are not required to generate the resulting Dhrystone data e The clock val variable is assigned a value based on a 4 MHz crystal If a 20 MHz crystal is used then the 4 MHz assignment should be commented out and the assignment for the 20 MHz crystal should be commented in the next line of code The main function of the Dhrystone program is located in Dhryl c No changes have been made that affect the operation of this part of the code This assures consistency across processors and configurations in the resulting data from the Dhrystone benchmark runs The Dhry2 c program contains other Dhrystone process functions These functions are part of the inner working of the Dhrystone program Theclock c program is a support program for the MPC500 configuration It includes functions that initialize the timer read the timer value and calculate the total time for the benchmark execution Running the Dhrystone Benchmark for the MPC500 Family Rev 1 2 Fr
19. associate headers is added The resulting output elf file will run without compression but will be ready for compression A unique output name could be generated by changing the output to EXECUTABLE DhryOutC where C denotes a compiled non compressed output elf file DhryOutC elf that can be compressed This application note uses the MPC566 to provide an overview of the compression process A vocabulary file is used by the hardware to decompress the instructions The vocabulary is generated by the VocGEN tool in a command line DOS window using the following command vocgen bs 4 tp MPC565 00 DhryOutc elf gt This will output a cfb file The newly generated vocabulary will be called DO24 4005 cfb or something similar and must be placed into a subdirectory called sqz_vocs where the Squeezard tool will be used see Figure 2 The vocabulary file and the DhryOutc elf source file will both be used to generate the compressed file The command line window used to invoke the Squeezard compression tool should be located at the source file directory location with the sqz_vocs as a subdirectory to this location Squeezard is invoked with the following command squeezard tp MPC565 00 sd 20000 o m evf DO24 4005 cfb DhryOutc elf This will generate the output compressed elf file which is renamed DhryOutc sqz elf Load this file into Flash in the same manner as any other elf format file 4 2 Running Compressed Dhrystone Code The MPC5
20. c 3 Enum Val Par then not executed Enum Ref Par Ident 4 switch Enum Val Par case Ident 1 Enum Ref Par Ident 1 break case Ident 2 if Int Glob 100 then Running the Dhrystone Benchmark for the MPC500 Family Rev 1 28 Freescale Semiconductor Enum Ref Par Ident 1 else Enum Ref Par break Ident 4 case Ident 3 executed break case Ident 4 break case Ident 5 break switch Proc 6 Enum Ref Par Ident 2 Enum Ref Par Ident 3 Proc 7 Int 1 Par Val Int 2 Par Val Int Par Ref KKK kk A kk kk kk kk kk kk K K kk kk kk k kk kk kk ek ek ke x executed three times y first call Int 1 Par Val 2 Int 2 Par Val 3 Int Par Ref becomes 7 E second call Int 1 Par Val 10 Int 2 Par Val 5 Le Int Par Ref becomes 17 a third call Int 1 Par Val 6 Int 2 Par Val 10 Int Par Ref becomes 18 xy One Fifty Int 1 Par Val One Fifty Int 2 Par Val One Fifty Int Par Ref One Fifty Int Loc Int Loc Int 1 Par Val 2 Int Par Ref Proc 7 Int 2 Par Val Int Loc Proc 8 Arr 1 Par Ref Arr 2 Par Ref Int 1 Par Val Int 2 Par Val KOK KK KK KI A k kok k k okokok kok k A kk ko kk kk CK Kok kk kok kk kok ek ke e ke e e x x executed once Int Par Val 1 3 Int Par Val 2 7 Arr 1 Dim Arr 1 Par Ref Arr 2 Dim Arr 2 Par Ref int Int
21. e e x executed once Str 1 Par Ref DHRYSTONE PROGRAM 1 ST STRING Str 2 Par Re DHRYSTONE PROGRAM 2 ND STRING Str 30 Str 1 Par Ref Str 30 Str 2 Par Ref REG One_Thirty Int_Loc Capital Letter Ch Loc Int Loc 2 while Int Loc lt 2 loop body executed once if Func 1 Str 1 Par Ref Int Loc Str 2 Par Ref Int Loc 1 Ident 1 then executed Ch Loc A Int Loc 1 if while if Ch_Loc gt W amp amp Ch Loc lt Z then not executed Int Loc 7 if Ch Loc R then not executed return true lse executed Running the Dhrystone Benchmark for the MPC500 Family Rev 1 30 Freescale Semiconductor e Code Listings if strcmp Str 1 Par Ref Str 2 Par Ref gt 0 then not executed Int Loc 7 Int Glob Int Loc return true lse executed return false if Ch Loc bof E nes2 Boolean Func 3 Enum Par Val KOK KK ke ke k ke ke ke ke ke k e ke e e ee x executed once f Enum Par Val Ident 3 Enumeration Enum Par Val Enumeration Enum Loc Enum Loc Enum Par Val if Enum_Loc Ident_3 then executed return true else not executed return false E Func 3 Fy 6 4 Listing 7 clock c RR KK Kk kk ke k k kk k oko KC k k kk k k kok k Kok Ck OK KC KC k kok kkk CK Kok k k ko ek ek k kok e e k FILE CLOCK
22. easonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part RoHS compliant and or Pb free versions of Freescale products have the functionality and electrical characteristics as their non RoHS compliant and or non Pb free counterparts For further information see http www freescale com or contact your Freescale sales representative For information on Freescale s Environmental Products program go to http www freescale com epp Freescale and the Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2003 2008 All rights reserved Z freescale semiconductor
23. eescale Semiconductor Compiling and Running the Dhrystone Program for the MPC500 Family e The Crt0 s program is a support program for the MPC500 configuration The Crt0 s includes required startup code that establishes compiler structural definitions and initializations for the Wind River Diab Data C compiler Most of the initializations in the Crt0 s are necessary for all compiles of the MPC500 regardless of the compiler tool involved An example listing of the code is available in Section 6 Code Listings 3 Compiling and Running the Dhrystone Program for the MPC500 Family 3 1 Compiling Code for the Dhrystone Program Two files are used to generate the initial compile of the Dhrystone program The makefile activates the commands that bring the program segments together with specific compiler configuration options The evb lin program is the linker program that determines where the Dhrystone program will reside in memory The evb lin also establishes the locations for internal modules required for the C compile The file structure shown in Figure 1 is kept simple to serve as a quick and easy example The command line instructions are invoked in this directory location Directory Address HOMEdirectory dhrystones Command line instructions are Z Source Files Output Files A invoked in this directory Dhry h DhryOut elf Dhry 1 c DhryOut s19 Dhry 2 c DhryOut map Clock c Crt0 s makefile K evbllin W
24. ext Record variant var 1 Int Comp 6 Proc 6 Ptr Val Par variant var 1 Enum Comp amp Next Record variant var 1 Enum Comp Next Record gt Ptr Comp Ptr Glob Ptr Comp Proc 7 Next Record variant var 1 Int Comp 10 amp Next Record variant var 1 Int Comp else not executed structassign Ptr Val Par Ptr Val Par gt Ptr Comp jhe Broe Ty Proc 2 Int Par Ref f Kk ke ke ke ke ke e e e e e e x x executed once Int Par Ref 1 becomes 4 One Fifty Int Par Ref One Fifty Int Loc Enumeration Enum Loc Int Loc Int Par Ref 10 Running the Dhrystone Benchmark for the MPC500 Family Rev 1 26 Freescale Semiconductor do executed once if Ch 1 Glob A then executed Int Loc 1 Int Par Ref Int Loc Int Glob Enum Loc Ident 1 put 8 while Enum Loc Ident 1 true Proc 2 Proc 3 Ptr Ref Par f Kk e e k e e e e e k e x executed once Ptr Ref Par becomes Ptr Glob Rec Pointer Ptr Ref Par if Ptr Glob Null then executed Ptr Ref Par Ptr Glob gt Ptr Comp Proc 7 10 Int Glob amp Ptr Glob gt variant var l Int Comp X Proc 8 Proc 4 without parameters executed once Boolean Bool Loc Bool Loc Ch 1 Glob A Bool Glob Bool Loc Bool Glob Ch 2 Glob B Proc 4 Proc 5 without parameters executed
25. h Off 7 464 286 7 46 87 04 Ox2BDO MPC56x 56 MHz Internal Flash On 7 642 858 7 64 84 99 0x1264 Compressed Running the Dhrystone Benchmark for the MPC500 Family Rev 1 10 Freescale Semiconductor Code Listings Table 1 MPC500 Dhrystone Results continued A 1 Dhrystone text Size Device Speed System Config BTB Dhry ticks Seconds VAX MIPS bytes MPC561 56 MHz External Burst On 16 857 143 16 86 38 51 Ox2BDO MPC561 56 MHz External Burst On 15 392 857 15 39 42 18 Ox2BDO MPC561 56 MHz Ext Extended On 13 107 144 13 11 49 54 Ox2BDO Burst MPC561 56 MHz Compressed On 11 839 287 11 84 54 84 0x1264 Ext Extended Burst The BTB is the Branch Target Buffer The x may represent the MPC563 or the MPC565 without compression mode The x may represent the MPC564 or MPC566 in compression mode External BBC burst with 4 1 1 1 timing External USIU burst with 4 1 1 1 timing External extended USIU burst with 4 1 1 1 1 1 1 1 timing Compressed external extended USIU burst with 4 1 1 1 1 1 1 1 timing o oc fF NN The system configuration generates a variety of results from the Dhrystone benchmark Running Dhrystone from internal Flash with the branch target buffer activated yields the fastest completion time Other result times scale linearly according to the processor speed For example it is possible to achieve a 41 improvement by moving f
26. iscr printf should be d n 0 printf Enum Comp sd n Next Ptr Glob variant var 1 Enum Comp I printe C should be dWn 1 printf Int Comp sd n Next Ptr Glob variant var l Int Comp T printf should be dNn 18 printf Str Comp sNn Next Ptr Glob gt variant var 1 Str Comp printf should be DHRYSTONE PROGRAM SOME STRING n L4 p inet Intl hoe dNn Int 1 Loc printf should be Sa n v 5 printf Int 2 Loc sd n Int 2 Loc printf should be Sdin 13 printf Int 3 Loc sd n Int 3 Loc printf should be d n 7 printf Enum_Loc sd n Enum Loc printf should be d n 1 printf Str 1 Loc s n Str 1 Loc printf should be DHRYSTONE PROGRAM 1 ST STRING n printf Str 2 Loc s n Str 2 Loc printf should be DHRYSTONE PROGRAM 2 ND STRING n printf n Begin GJ changes to Comment out original timing effort User Time Begin Time End Time printf TotalTime X n User Time printf Too Small Time X n Too Small Time printf HZ X n HZ if User Time Too Small Time printf Measured time too small to obtain meaningful results n printf Please increase number of runs Mn printf Nn 3 else ifdef TIME Microseconds float User Time Mic secs Per Second float Number Of
27. kk KA A k Ck KA Ck KA Ck I Ak Ak Ak Ak I I A KK KK Kk ke kk kk I IK Changes 11 29 01 G J Added variables for Power PC compatible MPC500 timings Also commented out printf statements DHRYSTONE Benchmark Program a S S eec Version C Version 2 1 c Ede dhry l c part 2 of 3 Date May 25 1988 Author Reinhold P Weicker Ck Ck ck ck Ck ck ck ck ck KA Ck Sk A K KA KA A KA K KA A ZK KA ck AA K KA Z A K AK KA K AK KA Ck ZA K KA ck ck A kk ck ck A kc k kc k ko ko kc kck kk k ai define HZ 60 include Dhry h Global Variables Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 19 errr Code Listings Rec Pointer Ptr Glob Next Ptr Glob int Int Glob Boolean Bool Glob char Ch 1 Glob Ch 2 Glob int Arr 1 Glob 50 int Arr 2 Glob 50 50 f Ak e e e e e x begin GJ addition x xxx kk ke o e e x x x unsigned long BeginTime unsigned long EndTime unsigned long Dhry Ticks float clock val float Seconds Ckckck ck ck kck ck ck kk 1 1 Ckckck ck ck ckck kck ck k k kk kk end GJ addition extern char malloc Enumeration Func 1 forward declaration necessary since Enumeration may not simply be int ifndef REG Boolean Reg false define REG REG becomes defined as empty i e no register variables else Boolean Reg true endif variables for time meas
28. lete information should be given on hardware and software used Hardware information includes Machine type CPU type and size of caches for microprocessors clock frequency memory speed number of wait states Software information includes Compiler and runtime library manufacturer and version compilation switches OS version The Operating System version may give an indication about the compiler Dhrystone itself performs no OS calls in the measurement loop The complete output generated by the program should be mailed such that at least some checks for correctness can be made Ck ck ck ck KK KKK KK KK KK KK KK A A KK KKK KK KK KK KK KK KK KK KKK KK KK AZ A A KA KK KKK ck KA A Sk Sk KKK KK ko kokok History This version C 2 1 has been made for two reasons 1 There is a need for a common C version of Dhrystone a since C is at present the most popular system programming language for the class of processors microcomputers minicomputers where Dhrystone is used most Running the Dhrystone Benchmark for the MPC500 Family Rev 1 12 Freescale Semiconductor X 0 0X F F FF F 0k F FF 0X 0k F F 0X F 0X F F F FF F F F F 0X F 0 F F 0X F F F RS F X F F F F X FF F F X F X F F F ox F F F OF Changes Code Listings There should be as far as possible only one C version of Dhrystone such that results can be compared without restrictions In the past the C versions distributed by Rick Richardson Version 1 1 and by Reinh
29. luded in this application to perform a C compile operation The example compiler is the Wind River Diab Data C compiler The Crt0 s file mentioned above replaces the default Wind River Diab Data Crt0 s file used in the C compiler compilation Changes made to the Dhrystone program must not have any effect on the internal Dhrystone operation The changes made in this application only effect the wrapper code used to record the begin and end times of the Dhrystone run Because the original code accounted for many other processors and software packages portions of the original wrapper code have been commented out to assure no interference with the MPC500 timing adaptations however the original code remains in the software so that a user can confirm that the changes do not alter the validity of the original Dhrystone software Also numerous printf statements have been left in the code but are also commented out Following is a review of each program segment that includes a general description and a description of changes needed for proper MPC500 operation e The Dhry h program is composed of a header global timer global variable and structure definitions The header describes the structure and workings of the Dhrystone program in detail Because the timer definitions were written for non MPC500 family processors they have been commented out however they have not been removed so that the user could confirm the changes to the original Dhrystone progr
30. mation Center EL516 2100 East Elliot Road Tempe Arizona 85284 1 800 521 6274 or 1 480 768 2130 www freescale com support Europe Middle East and Africa Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen Germany 44 1296 380 456 English 46 8 52200080 English 49 89 92103 559 German 33 1 69 35 48 48 French www freescale com support Japan Freescale Semiconductor Japan Ltd Headquarters ARCO Tower 15F 1 8 1 Shimo Meguro Meguro ku Tokyo 153 0064 Japan 0120 191014 or 81 3 5437 9125 support japan freescale com Asia Pacific Freescale Semiconductor China Ltd Exchange Building 23F No 118 Jianguo Road Chaoyang District Beijing 100022 China 86 10 5879 8000 support asia freescale com For Literature Requests Only Freescale Semiconductor Literature Distribution Center P O Box 5405 Denver Colorado 80217 1 800 441 2447 or 303 675 2140 Fax 303 675 2150 LDCForFreescaleSemiconductor hibbertgroup com Document Number AN2354 Rev 1 08 2008 Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Freescale Semiconductor reserves the right to make changes without further notice to any product
31. modules containing calls to initialize global objects here section init 99 2 C lwz r0 68 rl1 f Return from init addi rl rl 64 mtspr 8 r0 blr eo PIN section P 2Fe nsP section fini 00 2 C globl fini Entry to _ fini called by exit mfspr r0 8 stwu r1 64 r1 stw r0 68 r1 Linker places fini sections from other modules containing calls to destroy global objects here Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Code Listings Freescale Semiconductor 33 Document Revision History section fini 99 2 C lwz r0 68 rl1 f Return from _ fini addi rl r1 64 mtspr 8 r0 blr 7 Document Revision History Table 2 provides a revision history for this application note Table 2 Document Revision History Rev No Substantive Change s Date of Release Initial release January 2003 Corrected value in equation in section Calculating the Results Reformatted document to Freescale look and feel August 2008 Running the Dhrystone Benchmark for the MPC500 Family Rev 1 34 Freescale Semiconductor THIS PAGE IS INTENTIONALLY BLANK Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 35 How to Reach Us Home Page www freescale com Web Support http www freescale com support USA Europe or Locations Not Listed Freescale Semiconductor Inc Technical Infor
32. n C Version 2 1 File dhry h part 1 of 3 Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 11 errr Code Listings X 0X F F 0k F 0 F F 0X 0k F F F F FF F F F F 0X F F F F F FF Oo 0X OX 0X F F OX Xo X oS F Xo F Xo RS F Xo xk F x F HF x Date May 25 1988 Author Reinhold P Weicker Siemens AG E STE 35 Postfach 3240 8520 Erlangen Germany West Phone xxx 49 9131 7 20330 8 17 Central European Time Usenet mcvax unido estevax weicker Original Version in Ada published in Communications of the ACM vol 27 no 10 Oct 1984 pp 1013 1030 together with the statistics on which the distribution of statements etc is based In this C version the following C library functions are used strcpy strcmp inside the measurement loop printf scanf outside the measurement loop In addition Berkeley UNIX system calls times or time are used for execution time measurement For measurements on other systems these calls have to be changed Changes 11 29 01 G J commented out variables for non Power PC compatible MPC500 timings Collection of Results Reinhold Weicker address see above and Rick Richardson PC Research Inc 94 Apple Orchard Drive Tinton Falls NJ 07724 Phone 201 389 8963 9 17 EST Usenet uunet pcrat rick Please send results to Rick Richardson and or Reinhold Weicker Comp
33. nd Seconds to see the value Dhry Ticks BeginTime EndTime The Crystal speed will effect the number of clock ticks per second From table 6 6 of the MPC565 E User s manual a 4 MHz crystal will generate 999 999 ticks per second A 20 MHz crystal will generate a period that is 5 times smaller which is 5 000 000 ticks per second Select the appropriate value below for the crystal speed in use clock val 1000000 For a 4 MHz crystal clock val 5000000 For a 20 MHz crystal Different internal clock speeds MF bit x will have no effect on the number of recorded Dhry Ticks since the Dhry Ticks are recorded off of the ef crystal speed If the TBS bit were set to one A Then a separate calculation would have to be made for each clock speed ie 20MHz 40MHz 56MHz etc Seconds float Dhry Ticks clock val Print results if PRINTOUT is defined ifdef PRINTOUT printf Total Execution time of Dhrystone in clock ticks d n Dhry Ticks printf Total Execution time of Dhrystone in seconds f n Seconds printf Dhrystone benchmark ends n n fendif kk end GJ changes CKCkCk Ck k ck kckckckckckckckckok ck kk kk ex ke Comment out unused printf statements printf Execution ends n printf n printf Final values of the variables used in the benchmark n printf n
34. of statements operand types and locality still hold Except for sophisticated optimizing compilers execution times for this version should be the same as for previous versions Since it has proven difficult to subtract the time for the measurement loop overhead in a correct way the loop check has been made a part of the benchmark This does have an impact though a very minor one on the distribution statistics which have been updated for this version All changes within the measurement loop are described and discussed in the companion paper Rationale for Dhrystone version 2 Because of the self imposed limitation that the order and distribution of th xecuted statements should not be changed there are still cases where optimizing compilers may not generate code for some statements To a certain degree this is unavoidable for small synthetic benchmarks Users of the benchmark are advised to check code listings whether code is generated for all statements of Dhrystone Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 13 errr Code Listings i Version 2 1 is identical to version 2 0 distributed via 2 the UNIX network Usenet in March 1988 except that it corrects some minor deficiencies that were found by users of version 2 0 al The only change within the measurement loop is that a x non executed else part was
35. old Weicker had small though not significant differences 2 As far as it is possible without changes to the Dhrystone statistics optimizing compilers should be prevented from removing significant statements This C version has been developed in cooperation with Rick Richardson Tinton Falls NJ it incorporates many ideas from the Version 1 1 distributed previously by him over the UNIX network Usenet I also thank Chaim Benedelac National Semiconductor David Ditzel SUN Earl Killian and John Mashey MIPS Alan Smith and Rafael Saavedra Barrera UC at Berkeley for their help with comments on earlier versions of the benchmark In the initialization part this version follows mostly Rick Richardson s version distributed via Usenet not the version distributed earlier via floppy disk by Reinhold Weicker As a concession to older compilers names have been mad unique within the first 8 characters Inside the measurement loop this version follows the version previously distributed by Reinhold Weicker At several places in the benchmark code has been added but within the measurement loop only in branches that are not executed The intention is that optimizing compilers should be prevented from moving code out of the measurement loop or from removing code altogether Since the statements that are executed within the measurement loop have NOT been changed the numbers defining the Dhrystone distribution distribution
36. onale for Dhrystone Version 2 for a more detailed discussion of these ground rules For 16 Bit processors e g 80186 80286 times for all compilation models small together with a definition of these models for the compiler system used medium large etc should be given if possible Ck Ck ck ck kk ck Ck ck K KA KA A Ck A K KA AAA K KA AA K KA Z A K AA KA A ZA KA A kk K KA ck ck A K ZA KA K kc k ck ck kk ko kck ko kk ko Dhrystone C version statistics Comment from the first distribution updated for version 2 Note that because of language differences the numbers are slightly the Ada version The following program contains statements of a high level programming C in a distribution considered representativ 103 statements are dynamically executed The program is balanced with respect to the three aspects statement type operand type operand locality operand global local parameter or constant of these thr aspects is balanced only approximately 1 Statement Type MS number Vl V2 9 incl V1 Flea V Constant 12 Assignment 7 ud with array element X Assignment 6 B with record component 34 34 X Y as Z 5 X Y Constant 6 X X 1 3 X Y Z 2 X Expression 1 two operators Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Code Listings Freescale Semiconductor 15 errr Code Li
37. once Ch 1 Glob A Bool Glob false Proc 5 Procedure for the assignment of structures if the C compiler doesn t support this feature ifdef NOSTRUCTASSIGN memcpy d s 1 register char xd register char s register int ls while 1 d st Running the Dhrystone Benchmark for the MPC500 Family Rev 1 By X Code Listings Freescale Semiconductor 27 eer Code Listings fendif l 6 3 Listing 6 Dhry2 c Ck Ck ck ck Ck ck ck ck ck kk Ck ck A K KA KA A KA K KA ck AK KA ck AA K KA Z A KA K KA KA Sk KK A ZA K KA Ck ck A KA ck ck A ko Mk k kc kc k ko k kck kk ok DHRYSTONE Benchmark Program a o hn eee ee oe EE a P S Version C Version 2 1 File dhry 2 c part 3 of 3 Date May 25 1988 Author Reinhold P Weicker Ck Ck ck ck Ck ck ck ck Sk kk Ck Sk A K KA KA A KA K KA Ck AK KA ck ck ck K KA Z A KA Sk KA KA Sk KK A AA K KA Ck ck A KA ck ck A ko ZA kc k ko ko kc kck ko kk x include dhry h ifndef REG define REG REG becomes defined as empty i e no register variables endif extern int Int Glob extern char Ch 1 Glob Proc 6 Enum Val Par Enum Ref Par ORK KKK kok k kok kk kk kk kk kok k e ke e k kok k e e x x executed once Enum Val Par Ident 3 Enum Ref Par becomes Ident 2 Enumeration Enum Val Par Enumeration Enum Ref Par Enum Ref Par Enum Val Par if Fun
38. rations will affect a final application system solution The Dhry Ticks count is established by 1 Starting the timebase in crt0 s Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 9 Conclusions and Results 2 Initializing the PPC decrementer timer to the value of OXFFFFFFFF called in Dhry1 c function is in Clock c 3 Setting the Begin Time variable to the PPC decrementer value just before entering the Dhrystone program dhryl c 4 Setting the End Time variable to the PPC decrementer value just after leaving the Dhrystone program dhryl c 5 Determining the value of Dhry Ticks calculating the difference between Begin Time and End Time dhryl c From the Decrementer Time Out Periods table Table 6 6 in the MPC565 User s Manual one can observe that with a 4 MHz crystal 999 999 PPC decrementer ticks equals approximately 1 0 second Therefore dividing the value of Dhry Ticks by one million 1 000 000 will yield the results of the Dhrystone run in seconds 5 2 Running and Viewing Results Running the program involves loading DhryOut elf into the internal Flash of the MPC500 device with any available Flash loader Before starting the program the program counter instruction pointer should be set to address 0x2004 To read the results of a run open a memory window to view the two output variables Dhry_Ticks and Seconds Dhry_Ticks is located at 0x3F9B38 and Seconds is located at
39. rom 40MHz to 56MHz Running the program with code compression creates a 4 time penalty with internal Flash but it reduces code size by more than 50 Using a BBC burst with a 4 1 1 1 beat data access runs at 43 of the fastest internal speed and using the USIU with a burst of 4 1 1 1 beats for data accesses runs at 48 of the fastest internal speed Using the USIU extended eight beat burst with cycle timings of 4 1 1 1 1 1 1 1 for data accesses improves the external access time to 5696 of the fastest internal speed Code compression improves external access times because more than one instruction is retrieved with each external access Using external code compression with the USIU extended eight beat burst will yield a running time that is 62 of the fastest internal speed These are example results for this version of the Dhrystone benchmark User applications should yield similar results though the form of the application code and the final application system structure may cause some variation The Dhrystone benchmark can be used as a concise code example that users can incorporate into their system to test for functionality and compare to the results of this application note 6 Code Listings 6 1 Listing 4 Dhry h KKEKKKKKKK kk ck Ck Ck A KZ A A KA Ck Ck AZ KZ AA AXA A kk Ck Ck AZ K AA X A Ck ck kk A Z K A A X A ZA ZK A ZA A KZ KA Sk Sk AZ K A ZA A A k ko ko ko Ao DHRYSTONE Benchmark Program PF a ee RN PEDE OU cee E E Versio
40. rsion of the Dhrystone Program internal flash End of added sections GROUP data DATA LOAD ADDR sdata2 SIZEOF sdata2 sdata DATA LOAD ADDR sdata2 SIZEOF sdata2 SIZEOF data sbss BSS 11 bss BSS internal ram __SP_INIT ADDR stack SIZEOF stack __SP_END ADDR stack DATA ROM ADDR sdata2 SIZEOF sdata2 DATA RAM ADDR data DATA END ADDR sdata SIZEOF sdata BSS START ADDR sbss BSS END ADDR bss SIZEOF bss __HEAP START ADDR bss SIZEOF bss HEAP END ADDR internal ram SIZEOF internal ram 3 5 Running Code for the Dhrystone Program In order to run the compiled elf file the file should be loaded into Flash The instruction pointer IP in the debug tool should be set to 0x2004 which is the start of the program Start the program running with any go command The program will run to completion The instructions for viewing the results are found in Section 5 2 Running and Viewing Results 4 Code Compressed Version of the Dhrystone Program 4 41 Compiling Code for Compression The following description is intended to show the minimum additional steps required for code compression operation This section is not intended as a discussion of all aspects of the code compression process Code compressed operation is achieved with a few additional steps First
41. rt0 o in LOPTS crt0 0o crt0 s AS S AOPTS crt0 s EXECUTABLE elf OBJECTS Running the Dhrystone Benchmark for the MPC500 Family Rev 1 4 Freescale Semiconductor o a ee ee eee Compiling and Running the Dhrystone Program for the MPC500 Family LD LOPTS OBJECTS o EXECUTABLE elf Wm evb lin gt EXECUTABLE map DUMP tv EXECUTABLE elf gt gt EXECUTABLE map OBJECTS SOURCES CC S COPTS c AS S AOPTS s Generate s record file for flashing EXECUTABLE s19 EXECUTABLE elf DUMP Rv o EXECUTABLE s19 EXECUTABLE elf 3 3 Listing 2 The Dmakefile KK KK KK KA A kok kk k k k KA Kk Kk Ck kk Ck I IA k AA A AA IA A ko kk ke ke koe ke ke e e dmakefile for Motorola MPC500 Power PC compatible compiled code for Dhrystone ver 2 1 Used with the dmake command and DiabData compiler version 4 3g Object and source file lists are generated her from the modules listed abov OBJECTS Dhry 1 0 Dhry 2 0 clock o Variable commands set up for the compile CC dcc AS das LD dcc DUMP ddump Non compressed regular run command options NOTE Using g3 is only slightly faster than no g3 in COPTS 0 5 Dhrystones NOTE Use the much slower g option for a full deb
42. s herein Freescale Semiconductor makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application Buyer shall indemnify and hold Freescale Semiconductor and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and r
43. sed with the make command and DiabData compiler version 4 3g Put the supporting files here MODULES Dhry 1 Dhry 2 clock Object and source file lists are generated her from the modules listed abov OBJECTS S MODULI O SOURCES MODULI G 9 oo oe ES ES oO a Variable commands set up for the compile ec dcc AS das LD dcc DUMP ddump Non compressed regular run command options NOTE Using g3 is only slightly faster than no g3 in COPTS 0 5 Dhrystones OTE Use the much slower g option for a full debug NOTE Using XO and g3 for speed options fastest combination COPTS tPPC555EH cross E terr log g3 S XO AOPTS tPPC555EH cross Eterr log g LOPTS tPPC555EH cross Et terr log Wscrt0 o m2 lm NOTE When using code compression remove the comments here for COPTS AOPTS and LOPTS Also comment out COPTS AOPTS and LOPTS above Code compression command options COPTS tPPC555CH cross Xprepare compress Eterr log g S c XO AOPTS tPPC555CH cross Xprepare compress Eterr log g LOPTS tPPC555CH cross Xassociate headers Et terr log Wscrt0 o m2 lm Set up the name of the output executable file s EXECUTABLE DhryOut default crt0 o EXECUTABLE elf S EXECUTABLE s19 Compile crt0 o from src crt0 s Use the local crt0 o with Wsc
44. stings 0X FF F 0X F F F F F 0k F 0o F F FF F F F F OX FF RS XS RS F XS F F F F X KF x X X X F X Xo F X X F Xo F F Xo F F ox F ox X Expression three operators LE An with else without else executed not executed for while do while switch break declaration with initialization P procedure call user procedure 18 10 library procedure 1 X Rou function user function library function The averag call 5 p mpnmp xx l 34 11 17 counted every time the loop condition is evaluated 34 17 103 number of parameters in procedure or function calls is 1 82 not counting the function values aX Operators Arithmetic int div Comparison Logic Running the Dhrystone Benchmark for the MPC500 Family Rev 1 number ewur O o A Bw OV OF U WOO DW W approximate percentage 16 Freescale Semiconductor X 0X FF F F 0X 0X X ok X Xo F 2 F X X Ro F Ro F X xXx ox F X X F F Xo X X F Xo F F F FF F F F HF ox Code Listings amp amp AND THEN 1 1 6 OR 1 1 6 NOT 2 3 2 63 100 1 3 Operand Type counted once per operand reference number approximate percentage Integer 175 1235 Character 45 18 6 5 Pointer 12 5 0 String30 6 Dio Array 2 0 8 Record 2 0 8 242 100 0 When there is an access path leading to the final operand e g a record component only the final data type on
45. the UNIX time 1 command as this will measure the total time to run this program which will erroneously include the time to allocate storage malloc and to perform x the initialization DHZ nnn In Berkeley UNIX the function times returns process d time in 1 HZ seconds with HZ 60 for most systems CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY A VALUE Ck ck ck ck ck KK kk Ck A KA A AA AXA KK AXA A Ck AXA X ck ZK AX A A ZA KA AK AA ZA A KA ZAZ ZK A A AA kk Sk Ck Sk AZ KA ko ko ko ko ko kk Compilation model and measurement IMPORTANT This C version of Dhrystone consists of three files dhry h this file containing global definitions and comments dhry 1 c containing the code corresponding to Ada package Pack 1 dhry 2 c containing the code corresponding to Ada package Pack 2 Running the Dhrystone Benchmark for the MPC500 Family Rev 1 14 Freescale Semiconductor different from language here The combination X 0X 0X F 0X F 0 0X F 0X 0 F F 0X F 0X F F 0X F F Ro F F Xo F F F F X F F X F F KF OF assignments 52 51 0 control statements 33 32 4 procedure function calls 17 16 7 5 The following ground rules apply for measurements Separate compilation No procedure merging Otherwise compiler optimizations are allowed but should be indicated Default results are those without register declarations See the companion paper Rati
46. the access path is counted 4 Operand Locality number approximate percentage local variable 114 47 1 global variable 22 9 1 parameter 45 18 6 value 23 9 5 reference 22 9 1 function result 6 2 5 constant 55 22 7 5 242 100 0 The program does not compute anything meaningful but it is syntactically and semantically correct All variables have a value assigned to them before they are used as a source operand There has been no explicit effort to account for the effects of a cache or to balance the use of long or short displacements for code or data kk ck ck kck ck ck ck KA ck ck A K AKA KAZ A kk K KA KKK KA ck ck A K AKA KA A ZA K KA kk K KA ck ck KKK KKK ck ZA Ck ck ck ko kc k KKK ko kc k ck kk Ky Compiler and system dependent definitions fk KK KKK begin GJ changes eK KK OK kk KK Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 17 Code Listings Commenting out non PPC timing variables Remove non used timing variables ifndef TIME undef TIMES define TIMES endif Use times 2 time function unless explicitly defined otherwis x tifdef MSC CLOCK undef HZ undef TIMES include lt time h gt define HZ CLK_TCK endif Use Microsoft C hi res clock ifdef TIMES include sys types h include lt sys times h gt for times endif
47. ug NOTE Use XO and g3 for speed options fastest combination COPTS tPPC555EH cross E err log g3 c XO AOPTS tPPC555EH cross Eterr log g LOPTS tPPC555EH cross Et terr log Wscrt0 o m2 lm Code compression command options COPTS tPPC555CH cross Xprepare compress Eterr log g3 c XO AOPTS tPPC555CH cross Xprepare compress Eterr log g LOPTS tPPC555CH cross Xassociate headers Et terr log Wscrt0 o m2 1m Set up the name of the output executable file s EXECUTABLE DhryOutd n UFFIXES c s default crt0 o EXECUTABLE elf EXECUTABLE s19 Compile crt0 o from src crt0 s Use the local crt0 o with Wscrt0 o in LOPTS crt0 0o crt0 s S AS S AOPTS crtO0 s Running the Dhrystone Benchmark for the MPC500 Family Rev 1 Freescale Semiconductor 5 Compiling and Running the Dhrystone Program for the MPC500 Family dcc COPTS o clock o clock c das AOPTS clock c CC S COPTS o 0 lt AS S AOPTS lt EXECUTABLE elf OBJECTS S LD LOPTS OBJECTS o EXECUTABLE elf Wm evbdec lin gt EXECUTABLE map DUMP tv EXECUTABLE elf gt gt S EXECUTABLE map Generate s record file for flashing EXECUTABLE s19 S EXECUTABLE elf DUMP Rv o EXECUT
48. urement ifndef ETAS ifdef TIMES struct tms time info extern int times see library function times define Too Small Time 2 HZ Measurements should last at least about 2 seconds endif endif ifdef TIME extern long time see library function time define Too Small Time 2 Measurements should last at least 2 seconds endif ifdef MSC CLOCK extern clock t clock undef HZ define HZ 1000000 define Too Small Time 2 HZ endif KK KK KK KKK begin GJ change KOK ck ke ke e e e e x X Running the Dhrystone Benchmark for the MPC500 Family Rev 1 20 Freescale Semiconductor Comment out original timing variables long Begin Time End Time User Time float Microseconds Dhrystones Per Second end of variables for time measurement f KKK KKK KK end GJ change KOK k ke ke e e e e x amp main x f main program corresponds to procedures Main and Proc 0 in the Ada version x One Fifty Int_1_Loc REG One Fifty Int 2 Loc One Fifty Int 3 Loc REG char Ch Index Enumeration Enum Loc Str 30 Str 1 Loc Str 30 Str 2 Loc REG int Run Index REG int Number Of Runs Initializations ifdef ETAS setbuf stdout 0 setbuf stderr 0 setbuf stdin 0 endif Next Ptr Glob Rec Pointer malloc sizeof Rec_Type Ptr Glob Rec Pointer malloc sizeof Rec Type Ptr Glob gt Ptr Comp Next
49. y two bits This will set the IP to the start of the program The Dhry tics and Seconds results may be viewed in the same variable window as in a non compressed run See Section 5 2 Running and Viewing Results 5 Conclusions and Results 5 1 Calculating the Results The results of the Dhrystone program are based on the speed of the original VAX computer The VAX equivalent for Dhrystone version 2 1 is 1757 Dhrystone cycles VAX MIPS The number of seconds that the Dhrystone program takes to run is calculated from the number of clock ticks The number of clock ticks are stored in the Dhry Ticks variable found in the program The Dhry_Ticks number of clock ticks are divided by one million to derive the number of seconds The equation involved is as follows 1 000 000 Dhrystones cycles number of seconds x 1757 Dhrystones cycles VAX mips This yields X VAX mips second The resulting number X is the number of times faster the MPC500 will be than the original VAX speed This will yield a standard output value in Dhrystone units that can be compared to other processors However the user must keep in mind that such a benchmark number may not reveal all of the processing power of the MPC500 family When the Dhrystone benchmark is used across various configurations of the MPC500 family 1 e internal or external various speeds different internal settings varying wait states etc the user can compare how changing the system configu
Download Pdf Manuals
Related Search
Related Contents
Samsung SF-650 用戶手冊 Samsung Galaxy Y Seri User Manual Samsung 1080P User's Manual HP Z30i PCIe Summit Z3-16 User Manual OIL INDIA LIMITED N8160-26 Upgrade型DLTライブラリ取扱説明書 (No.005164) Sepam 2000 D22 - D32 Merlin Gerin Installation and user's manual Copyright © All rights reserved.
Failed to retrieve file