Full text
PROJECTE DE FI DE CARRERA TÍTOL DEL PFC: Benchmarks en diferents microprocessadors TITULACIÓ: Enginyeria de Telecomunicació (segon cicle) AUTOR: Josep Caubet Gomà DIRECTOR: Bengt Koren. Royal Institute of Technology, Estocolm (Suècia) DATA: 19 de juliol de 2006
Títol: Benchmarks en diferents microprocessadors Autor: Josep Caubet Gomà Director: Bengt Koren. Royal Institute of Technology, Estocolm (Suècia) Data: 19 de juliol de 2006 Resum L’objectiu d’aquest projecte és obtenir resultats de diferents benchmarks entre diferents plaques; RCM3720 de Rabbit Semiconductor i SNAP i IM3000 de Imsys Technologies. S’han utilitzat tres llenguatges diferents de programació: C, Java i assembler. S’han executat un conjunt de diferents algoritmes en diferents microprocessadors, en un cas el processador va ser simulat a partir d’un simulador (El IM3000 Simulador de cicle real). Els tests que s’han dut a terme tenien en compte diferents aspectes d’un microprocessador: el temps d’execució de diferents algoritmes, l’execució de benchmarks populars (Whetstone i Dhrystone) i el rendiment TCP/IP en l’SNAP. L’anàlisi dels resultats obtinguts conclou que IM3000, programat en assembler, és la placa més ràpida. L’SNAP, programat en Java, és la més lenta. IM3000 triplica la velocitat de l’SNAP. RCM3720 és entre 5 i 10 vegades més lent que IM3000. La transferència de dades TCP/IP en l’SNAP està al voltant dels 4,7 Mbps (en ambdós sentits).
Title: Benchmarks of different microprocessors Author: Josep Caubet-Gomà Director: Bengt Koren. Royal Institute of Technology, Stockholm (Sweden) Date: July, 19th 2006 Overview The objective of this thesis is to obtain results of benchmarking between different boards; RCM3720 of Rabbit Semiconductor and SNAP and IM3000 of Imsys Technologies. Three different computer languages have been used: C, Java, and assembler. A set of algorithms have been run on different microprocessors and in one case the processor was simulated using a processor simulator (The IM3000 True cycle simulator). The tests that have been carried out contain important different aspects of a microprocessor: the execution time of different algorithms, the execution of popular benchmarks (Whetstone and Dhrystone) and TCP/IP performances in SNAP. The analysis of the obtained results concludes that IM3000, programmed in assembler is the quickest board. The SNAP, programmed in Java, is the slowest. IM3000 triplicates the SNAP speed. RCM3720 is around 5-10 times execution speed slower than IM3000. The transfer of data TCP/IP in SNAP is around 4,7 Mbps (both ways).
Acknowledgements First of all, I would like to express my most sincere gratitude to Roger Sundman, my supervisor at Imsys Technologies AB for giving me the opportunity to perform this thesis, providing me with relevant information, and advice. I would also like to thank all the people at Imsys for creating such a good atmosphere that made my work easier and more comfortable. Thanks to Christian Blixt, Anders Gradén and Per Alm for their technical help. Thanks to Yingqing Zhou and Sarat Samanta for their kind advice and support when I needed. Many thanks also to Bengt Koren, my examiner and supervisor at the Royal Institute of Technology. Last but not least. Many thanks to my parents for their love, unending support and encouragement over the years. Stockholm, July 2006. Josep Caubet Gomà
Acronyms ARM – Acorn/Advanced RISC Machine CAN – Controller Area Network DMIPS – Dhrystone MIPS EEMBC – Embedded Microprocessor Benchmark Consortium HDLC – High-Level Data Link Control I2C – Intelligent Interface Controller ICE – In-Circuit Emulator IDE – Integrated Development Environment IP – Internet Protocol IrDA – Infrared Data Association JVM – Java Virtual Machine MIPS – Million Instructions Per Second POSIX – Portable Operating System Interface RISC – Reduced Instruction Set Computing SDLC – Synchronous Data Link Control SPI – Serial Peripheral Interface TCP – Transport Control Protocol TDMI – Thumb Instruction, Debugger, Multiplier, ICE (ARM CPU features) UART – Universal Asynchronous Receiver-Transmitter USB – Universal Serial Bus WIPS – Whetstone Instructions Per Second
TABLE OF CONTENTS INTRODUCTION ..................................................................................................................9 CHAPTER 1. BACKGROUND...........................................................................................11 1.1 Benchmarking.................................................................................................................. 11 1.2 Embedded systems......................................................................................................... 11 CHAPTER 2. BOARD FEATURES....................................................................................13 2.1 RCM3720 of Rabbit Semiconductor .............................................................................. 13 2.2 SNAP of Imsys Technologies......................................................................................... 14 2.3 IM3000 of Imsys Technologies....................................................................................... 16 2.4 CerfBoard 270 Linux of Intrinsyc................................................................................... 16 2.5 Bitfire ARM of Arrow Engineering ................................................................................. 16 2.6 Comparative table ........................................................................................................... 17 CHAPTER 3. BENCHMARKS ...........................................................................................19 3.1 Execution time................................................................................................................. 19 3.2 Whetstone and Dhrystone.............................................................................................. 21 3.3 TCP/IP performance........................................................................................................ 21 CHAPTER 4. RESULTS.....................................................................................................23 4.1 Execution time................................................................................................................. 23 4.2 Whetstone and Dhrystone.............................................................................................. 25 4.3 TCP/IP performance........................................................................................................ 26 4.4 Comparing everything .................................................................................................... 28 CONCLUSIONS .................................................................................................................29 APPENDIX .........................................................................................................................31 APPENDIX A: OTHER STUDIED BOARDS......................................................................33 A.1 CerfBoard 270 Linux of Intrinsyc................................................................................... 33 A.2 Bitfire ARM of Arrow Engineering ................................................................................. 34 A.3 Comparative table ........................................................................................................... 37 APPENDIX B: MEASURING EXECUTION TIME IN IMSYS DEVELOPER ......................39 B.1 With ftime() function........................................................................................................ 39 B.2 With the memory address .............................................................................................. 39 APPENDIX C: ENCOUNTERED PROBLEMS ..................................................................43 APPENDIX D: DHRYSTONE’S CHARACTERISTICS ......................................................45 APPENDIX E: SET OF SIMPLE APPLICATIONS.............................................................49 REFERENCES ...................................................................................................................63 BIBLIOGRAPHY ................................................................................................................65
9 INTRODUCTION This report is the presentation of a Master Project Degree, part of Master of Science in Telecommunication Engineering at The Royal Institute of Technology, Stockholm, Sweden and the Technical University of Catalonia, Barcelona, Spain. The project was conducted between February and July of 2006 at Imsys Technologies AB “Imsys” in Upplands Väsby, Sweden. The objective of this thesis is to obtain results in benchmarking of different microprocessors with an emphasis of Imsys proprietary architecture and comparison between an older versus a new processor design and with a special reference to power efficient computing. The organization of the report in chapters coincides with the steps that have been carried out to obtain the results. The previous work and background information is described in the section Background followed by the section of Board Features, where the microprocessors are explained in more detail. The chapter of Benchmarks shows the tests carried out and the different benchmark types that have been carried out using different programming languages (C, Asm and Java), including some generally well known benchmarks (Dhrystone and Whetstone). A specific TCP/IP test program was also included in the test suite. Finally, after having carried out the planning and the execution of the benchmarks to fulfil the thesis, a conclusion with an analysis of the obtained results is made.
11 CHAPTER 1. BACKGROUND A large number of benchmarks have been carried out using more than 10 different algorithms or tasks. Three different computer languages have been used, (C, Asm and Java) and the combinations of algorithms and languages have been executed on several microprocessors and in one case the processor, the new Imsys IM3000, was simulated using a true cycle processor simulator. This was some of the basic prerequisite to carry out this project. A large portion of time have been spent on learning and programming the different boards and languages used and also to set up the different units with their power supplies, cables, software, and other needed housekeeping functions. (For more information, see CHAPTER 2). 1.1 Benchmarking To define benchmarking [1] is difficult since there are of many types (according to the objective that is pursued) but basically and without going into details, a benchmark [2] is the result of running an algorithm, or a set of algorithms, in order to assess the relative performance of an object, by running a number of standard tests and trials. Benchmarking is usually associated with assessing performance characteristics of computer hardware, for example, the floating point operation performance of a CPU, but there are circumstances when the technique is also applicable to software, for example, efficiency of different compilers with respect to for example code size or execution time. Benchmarks provide a method of comparing the performance across different chip/system architectures. There are many benchmarks types that can be carried out with the processors, for example of energy consumption, of algorithm execution time, code size, compiler optimization, communication efficiency and so on. The benchmarking makes sense against processors from other vendors to compare features. For this reason it is very important to make clear the context of the test (frequency of the processor, word length, bus width etc). 1.2 Embedded systems An embedded system is usually designed in order to do a very specific function as efficient and cost effective as possible and unlike general-purpose computers such as the PC. An embedded system performs well and pre-defined tasks, usually with very specific requirements. Since the system is dedicated to a specific task, design engineers can optimize it, thereby reducing it to the least possible size and cost of the product.
12 The core of any embedded system is formed by one or more microprocessors or microcontrollers, programmed to perform well defined tasks. The software on an embedded system is usually semi-permanent; and it is often called "firmware" [6]. Embedded and real-time systems aren’t synonymous. Most embedded systems are realtime and most real-time systems are embedded [7]. Figure 1. Most embedded systems are real-time and most real-time systems are embedded
20 Table 5. Features of set of simple applications 8-bit_math.c Source file containing three math functions. One function performs addition of two 8 bit numbers, one performs multiplication, and one performs division. The “main()” function calls each of these functions 16-bit_math.c Source file containing three math functions. One function performs addition of two 16 bit numbers, one performs multiplication, and one performs division. The “main()” function calls each of these functions. 32-bit_math.c Source file containing three math functions. One function performs addition of two 32 bit numbers, one performs multiplication, and one performs division. The “main()” function calls each of these functions. floating_point_math.c Source file containing three math functions. One function performs addition of two floating-point numbers, one performs multiplication, and one performs division. The “main()” function calls each of these functions. 8-bit_switch_case.c Source file with one function containing a switch statement having 16 cases. An 8 bit value is used to select a particular case. The “main()” function calls the “switch” function with an input parameter selecting the last case. 16-bit_switch_case.c Source file with one function containing a switch statement having 16 cases. A 16 bit value is used to select a particular case. The “main()” function calls the “switch” function with an input parameter selecting the last case. 8-bit_2-dim_matrix.c Source file containing 3 two-dimensional arrays containing 8 bit values–one of which is initialized. The “main()” function copies values from array 1 to array 2, then from array 2 to array 3. 16-bit_2-dim_matrix.c source file containing 3 two-dimensional arrays containing 16 bit values–one of which is initialized. The “main()” function copies values from array 1 to array 2, then from array 2 to array 3. fir_filter.c Source file containing code that calculates the output from a 17- coefficient tap filter using simulated ADC input data. matrix_multiplication.c Source file containing code that multiplies a 3x4 matrix by a 4x5 matrix. RSA_multiplication.c Source file containing multiplication code. The obtained results and their graphic representation are shown in the following section [see 4.1].
21 3.2 Whetstone and Dhrystone The Whetstone and Dhrystone benchmark was introduced at the time of minicomputers and workstations. Today they have almost no meaning but companies like MIPS and ARM still publish this kind of number for each new processor design. When this benchmark was designed the PC was not even invented and different type of computations, integer or floating point was the main use for the equipment of the time. Today need is dominated by streaming data, driven by the Internet and TCP/IP. However, they can be interesting to use such as to measure the performance of a given architecture family. So is the case with Imsys SNAP and the IM3000. In this case both the performance increase and power efficiency (MIPS/P), can be measured. The power efficiency is becoming more and more important with battery power devices. 3.2.1 Whetstone benchmark The Whetstone benchmark was written in November of 1972 by Harold Curnow of CCTA in Algol 60 in, based on work by Brian Wichmann of the National Physical Laboratory [4]. The Whetstone benchmark primarily measures the floating-point arithmetic performance. The Whetstone benchmark originally produced speed ratings in terms of Thousands of Whetstone Instructions Per Second (KWIPS), later produced speed ratings in MOPS (Millions of Operations Per Second) and MFLOPS (Floating Point) and overall rating in MWIPS (= 1000 KWIPS). 3.2.2 Dhrystone benchmark Developed in 1984 by Rheinhold Weicker, Dhrystone is a benchmark program written in C or Pascal (and now even in Java) that tests a system's integer performance and string handling. The program is CPU bound, performing no I/O functions or operating system calls [3]. There are two Dhrystone versions 1.1 (1984) and the current version Dhrystone 2.1 (1988) [5]. Anyway Dhrystone doesn't take into account some details [see APPENDIX D:]. Dhrystones per second is the typical metric used to measure the number of times the program can run in a second. Although there are derived calculations, most scores are reported as Dhrystone MIPS/megahertz (abbreviated as DMIPS/MHz) and/or as VAX Dhrystone MIPS (sometimes just called DMIPS) [5]. 3.3 TCP/IP performance It is possible to determine the TCP/IP performances of the SNAP that has Ethernet port. In this sense it has been developed a client and a server that data are sent among them, the purpose is to determine rate of transmission of data in uplink and in downlink.
22 The client is always a PC and the server is SNAP [see Figure 7]. Downlink refers when SNAP receives data and uplink when it sends data. Figure 7. Scenario for determining TCP/IP performance In the [Figure 8] the procedure for measure the TCP/IP performance is shown. Initially the client informs the server of the characteristics of the test that will be carried out sending the size of the packet, the number of packets to send and the number of times that will repeat the test (loops). Figure 8. Diagram of the procedure of the benchmark Immediately afterwards the client or the server – according to if it is uplink or downlink – it sends the number of packets of defined size. This size will fix to 1460 bytes (payload) and knowing that the headers are of 54 bytes, the total of the packet will be 1514 bytes, in fact the maximum size of a packet TCP [see Figure 9]. This way it is known that quantity of bytes is sent and its payload, let us remember that if the data overcome the 1514 bytes, the protocol TCP/IP cuts them in blocks of this same size. Figure 9. TCP packet
23 CHAPTER 4. RESULTS The results of executing the different benchmarks [see CHAPTER 3] are shown in this chapter. 4.1 Execution time The [Table 6] briefly describe for each system the available languages, number of bits and frequency used. Table 6. Features of different boards Manufacturer Language Bits Frequency RCM3720 Rabbit semiconductor C 8 bits 22 MHz SNAP_C / J / ASM Imsys Technologies C / J / Asm 8 bits 40 MHz IM3000_C / J / ASM Imsys Technologies C / J / Asm 8 bits 67 MHz Number of Loops 1.000 The figure given in Table 10 is execution time in milliseconds for all boards except the IM3000 that are simulated. Table 7. Execution time in milliseconds Boards IM3000_ASM IM3000_C SNAP_ASM SNAP_C RCM3720 SNAP_J 8 bit Math 6 10 19 31 95 240 8 bit 2 Dim Matrix 221 293 577 838 1840 1710 8 bit Switch Case 2 3 6 9 55 80 16 Bit Math 7 10 19 31 84 246 16 Bit 2 Dim Matrix 221 352 580 1043 1980 1715 16 Bit Switch Case 2 3 6 9 51 77 32 Bit Math 7 10 20 27 185 255 Floating-point Math 10 13 30 37 145 274 FIR Filter 1794 2001 6314 6751 14300 10505 Matrix Multiplication 283 342 757 993 1890 1536 Algorithms RSA Multiplication 65262 91800 191030 273600 1418000 420000 The [Figure 11] shows the proportion of time that each board spends to execute an application. It is easy to see in this graph the quickest and slowest board. In the [Figure 10] shows the order of the different boards in relation to the execution time. Figure 10. Orderly boards according to the execution time
24 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% 8 bit Math 8 bit 2 Dim Matrix 8 bit Switch Case 16 Bit Math 16 Bit 2 Dim Matrix 16 Bit Switch Case 32 Bit Math Floating-point Math FIR Filter Matrix Multiplication RSA Multiplication IM3000-ASM IM3000-C SNAP-ASM SNAP-C RCM3720 SNAP-J Figure 11. Proportion of time that each board spends to execute an application
25 4.2 Whetstone and Dhrystone 4.2.1 Whetstone The obtained results of applying this benchmark can be seen in the [Table 8]. The execution of Whetstone in some boards has not been possible [see APPENDIX C:]. Table 8. Whetstone results KWIPS RCM3720 256,4 SNAP_C 322,6 IM3000 1021,03 In [Figure 12] one can see the graphic representation of the results. 0 200 400 600 800 1000 1200 RCM3720 SNAP_C IM3000 KWIPS Figure 12. Whetstone results IM3000 has three more times KWIPS faster that SNAP_C. RCM3720 is a little below SNAP. 4.2.2 Dhrystone The obtained results of applying this benchmark are visualized in the [Table 9]. The execution of Whetstone in some boards has not been possible [see APPENDIX C:]. Table 9. Dhrystone 2.1 results (LOOP = 100.000, C code) Dhrystones per Second SNAP_C 4.347,8 IM3000 12.853,5 In [Figure 13] one can see the graphic representation of the results.
26 0 4000 8000 12000 16000 SNAP_C IM3000 Dhrystones per Second Figure 13. Dhrystone results The relation among boards of the [Figure 10] it is like in Whetstone benchmark. IM3000 has three more times Dhrystones per second that SNAP_C. 4.3 TCP/IP performance To obtain results of this benchmark it has been developed a client and a server. Initially it was developed a client and a server in Java. It was checked their correct operation starting from Ethereal – a network protocol analyzer – with which the sent and received packets were studied. Nevertheless, the results were not satisfactory because the obtained rate didn't fulfil the predictions. They were obtained around some 400 Kbps of maximum rate in the uplink and about 40 Kbps in the downlink. The reason that was identified in its moment is that Java consumes many resources and this affects to the performances of this type of tests, more in an embedded system, since the same performance tests worked without any problem when being executed between two PCs [Figure 14]. Figure 14. Results of the execution of the client-server between two PCs To solve this problem another client-server it was developed in C with which the wanted results were obtained. In the [Table 10] TCP uplink performance is shown, where SNAP sends packets (total packet size: 1514 bytes payload: 1460 bytes) to a PC that finally calculates Rate payload and Rate total data.
27 Table 10. TCP rate uplink performance SNAP SEND DATA PC RECEIVE DATA Num Packets Total Payload (Mbits) Total data (Mbits) Rate Payload (Mbps) Rate total data (Mbps) 1000 11,68 12,11 3,03 3,14 2000 23,36 24,22 3,62 3,76 5000 58,40 60,56 4,09 4,24 10000 116,80 121,12 4,29 4,44 20000 233,60 242,24 4,39 4,55 40000 467,20 484,48 4,45 4,61 Size packets 100000 1168,00 1211,20 4,48 4,64 In the [Table 11] TCP downlink performance is shown, where SNAP receives packets (total packet size: 1514 bytes payload: 1460 bytes) of a PC. Table 11. TCP rate downlink performance PC SEND DATA SNAP RECEIVE DATA Num Packets Total Payload (Mbits) Total data (Mbits) Rate Payload (Mbps) Rate total data (Mbps) 1000 11,68 12,11 4,53 4,70 2000 23,36 24,22 4,55 4,72 5000 58,40 60,56 4,55 4,71 10000 116,80 121,12 4,53 4,70 20000 233,60 242,24 4,53 4,70 40000 467,20 484,48 4,54 4,70 Size packets 100000 1168,00 1211,20 4,53 4,70 The [Figure 15] shows the uplink and downlink transmission rates. Figure 15. TCP rates uplink and downlink The maximum rate of transmission in uplink and in downlink is around 4,7 Mbps. In downlink the rate is constant independently of the number of sent packets, on the other hand in uplink, when SNAP sends data, the rate increases with the number of sent packets. The relation is proportional until the 5000 packets.
28 4.4 Comparing everything In this section, the obtained results of the previous sections will be compared among them. The [Figure 16] shows a graph that relates benchmark performance and price. In the graph there are as many points as boards and programming languages [see Table 6]. In the [Figure 16], the benchmark performance showed in the X axis is the execution time obtained from the set of simple applications [see 3.1]. The [Figure 16], obtained from [Table 7], have been done in the following way: - First, the percentage of time that each board invests in executing an algorithm, has been calculated. - Then, with these results, the total percentage of time (axis X), that each board spend in executing the algorithms, has been calculated. The percentage of prices (in relation of the addition of all prices) is showed in the axis Y. 10% 12% 14% 16% 18% 20% 22% 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% Benchmark performances (execution time) Price IM3000-ASM IM3000-C SNAP-ASM SNAP-C RCM3720 SNAP-J Figure 16. Comparison among boards
29 CONCLUSIONS • Conclusions of the benchmarks This thesis shows the results of the benchmarking carried out to different boards: RCM3720 of Rabbit Semiconductor, SNAP and IM3000 of Imsys Technologies. The tests that have been carried out contain important different aspects of a microprocessor, the execution time, the execution of popular benchmarks (Whetstone and Dhrystone) and TCP/IP performances in SNAP. A large number of benchmarks have been carried out using more than 10 different algorithms or tasks. Three different computer languages have been used, (C, Java and Asm) and the combinations of algorithms have been running on different microprocessors and in one case the processor was simulated using a processor simulator (The IM3000 True cycle simulator). The analysis of the obtained results concludes that IM3000 (programmed in Asm) is the quickest board and SNAP (programmed in Java) is the slowest. IM3000, the third generation of processors of Imsys, triplicates the speed of SNAP (programmed in Asm or C). With RCM3720 is around 5-10 times execution speed faster. Two popular benchmarks, Whetstone and Dhrystone have been executed too. Both are programmed in C and they show the Whetstone Instructions Per Second and Dhrystones per second units respectively. The Dhrystone relation between SNAP and IM3000 is approximately 3. This relation in Whetstone benchmark stays and the number of Whetstones Instructions per second in RCM3720 is a little below SNAP. The transfer of data TCP in SNAP, around 4,7 Mbps (both ways), fulfil for example the necessary specifications to be installed in a printer without any problem. This thesis has also required important knowledge about networks and operating systems since it has been had to develop a client and a server TCP with sockets, first in Java and later in C on different platforms (Windows and Linux). Finally, the difference between boards and its development environments (except SNAP and IM3000) has added complication to the project. It has been programmed in JAVA, C (with different variants according to the board) and Asm (with also different variants, for example the RCM3720 didn't have the division function). The adaptation of Dhrystone and Whetstone have been difficult, in some boards it has been impossible to execute them. Therefore, the arisen problems have gone adapting the objectives throughout the project.
37 A.3 Comparative table The [Table 15] shown all the boards studied in this thesis. Table 15. All boards specific features RCM3720 Bitfire ARM SNAP IM3000 CerfBoard 270 Linux Manufacturer Rabbit Semiconductor Arrow Engineering Imsys Technologies Imsys Technologies Intrinsyc Processor RABBIT 3000 ARM7TDMI IM1000 IM3000 PXA270 XScale Intel family Frequency 22,1 MHz 60 MHz 40 MHz 67 MHz 416 MHz Bits 8 32 8 8 32 Power Supply 4,75 to 5,25 V 10 to 23 V 5 V 3.0 to 3.6 V 6 to 12 V Temperature range -40° to +70° C - -20° to +70° C -40° to +85° C 0° to +50°C Flash 512 KB 256 KB 2 MB - 16 MB Memory 256 KB SRAM 16 KB RAM 8 MB DRAM 80 KB ROM 40 KB SRAM 64 MB SDRAM Ethernet port 10Base-T - 10/100Base-T Dual 10/100Base-T 10/100Base-T Interfaces IrDA SDLC/HDLC I2C SPI 33 digital I/O 2 serial ports 2 CAN I2C SPI 3 serial ports Wire I2C SPI CAN 3 serial ports I2C SPI 2 serial ports 2 USB 2.0 1 USB 1.1 client & host support 4 wire, I2C Development kit Dynamic C Eclipse GCC Compiler Imsys Developer Imsys Developer HyperTerminal Shell Compiler Dynamic C GCC UCC UCC GCC Languages C Asm C Asm C Asm JAVA C Asm JAVA C Asm Others 4 PWM output channels Big high intensity bicolor LED-matrix 4 canals A/D - 8 channel A/D (16 bit) 2 channel D/A (16 bit) Linux environment 2 CompactFlash connec Audio connectors Processor price (10k) $9,25 $7,4 $10 $15 $32 Website www.rabbitsemiconductor.com www.bitfire.com www.imsystech.com www.imsystech.com www.intrinsyc.com
39 APPENDIX B: Measuring execution time in Imsys Developer Measuring the time of execution of an algorithm [see Figure 6] in SNAP and IM3000 it is possible to make it in several ways how it explains next. B.1 With ftime() function The library time.h has the function ftime(&tb) that returns the current time in seconds [tb.time] and milliseconds [tb.millitm]. If you proceed in the following way the time of execution of the algorithm it is obtained: #include <stdio.h> #include <time.h> void main(void) { unsigned short aa_mm,bb_ms; long aa_s,bb_s; struct timeb tb; ftime(&tb); //Start aa_s = tb.time; aa_ms = tb.millitm; //Code to measure the time of execution ftime(&tb); //Stop bb_s = tb.time; bb_ms = tb.millitm; printf (“Time: %d s and %d ms”,(bb_s-aa_s),(bb_ms-aa_ms)); } B.2 With the memory address It is possible to visualize the time of execution of the algorithm with the memory address 0xFE4, but not without before to activate a bit: *(unsigned char *)0xFD0 |= 0x08; The time in milliseconds is shown of 0xFE4 - 0xFE7. If one wants more precision in 0xFE8 - 0xFE9 parts of 1/65536 are visualized [see Figure 22].
40 Figure 22. SNAP and IM3000 memory B.2.1 First option To calculate the time, it is only necessary to subtract the time START and time STOP [see Figure 6]. To make it simpler, the time START will be erased and we will only notice time STOP to know the time of execution. The function in Asm _eraseTime erases these memory addresses: _eraseTime:: ldw.a 0FE4H ld 0 st The code would be in the following way: #include <stdio.h> void main(void) { *(unsigned char *)0xFD0 |= 0x08; eraseTime(); //Code to measure the time of execution //Look time lapsed in the memory } In any case a deviation of time takes place since when erasing these addresses by memory it lapses time and also times of Imsys Developer also influences. The best option to measure the time is the Second option [B.2.2]. B.2.2 Second option This option solves the problems explained in the previous section.
41 The code to execute would be: #include <stdio.h> void main(void) { unsigned int t1,t2; *(unsigned char *)0xFD0 |= 0x08; t1 = *(unsigned int*)0xFE4; //Start //Code to measure the time of execution t2 = *(unsigned int*)0xFE4; //Stop printf (“Time: %d ms”,(t2-t1)); }
43 APPENDIX C: Encountered problems This section lists and explains the problems that have been found throughout the thesis and they have not found solution. • TTCP benchmark [10] TTCP is a benchmarking tool for measuring TCP and UDP performance. It was possible to execute the application satisfactorily between two PCs, but not in SNAP, due to problems related with unknown functions. • CerfBoard 270 Linux of Intrinsyc This board works with the operating system Linux. It was configured the net connection satisfactorily. According to the manufacture's recommendations they set the packages of development IPKG but it was not possible to compile any program. As alternative, Cygwin (explained previously in this thesis) was used that allows to work with an environment Linux in Windows. I settled the development software for processors ARM Intel XScale with the objective of building in the PC and later to download the executable to CerfBoard 270 Linux. The result neither was satisfactory. • Dhrystone benchmark It was not possible the execution of this benchmark in RCM3720 of Rabbit Semiconductor, due to problems related with unknown functions.
45 APPENDIX D: Dhrystone’s characteristics To use a popular benchmark has their advantages but sometimes also some disadvantages like Dhrystone. The [Table 16] provides a concise summary of Dhrystone’s characteristics and corresponding strength or weakness [5]: Table 16. Dhrystone’s strength and weakness Characteristic Strength and Weakness Written in C language code Strength: Allows code to be ported to a large number of platforms and architectures. Very small size Strength: An engineer can quickly master Dhrystone. Weakness: A compiler writer, or architect, can quickly defeat Dhrystone and "design to a benchmark." Minimizes or eliminates stress on memory subsystems and easily fits inside L1 caches. Cannot hope to mimic the breadth of applications encountered by a processorbased system. Is based on a single benchmark comprised of three files: dhry_1.c, dhry_2.c, and dhry.h. There is only one set of functions. Single, easy-to-report score Strength: Reported as a single figure of merit, similar to the ‘marks’ used by EEMBC, has allowed it to gain industry traction. Dhrystone is formally reported as "Dhrystone 2.1 MIPS". Weakness: Dhrystone users employ confusing and ambiguous terminology such as DMIPS, DMIPS/MHz, Rounded Dhrystones/ second, and Dhrystones/CPU cycle. Furthermore, a "MIP" is actually 1.75 DEC VAX MIPS. Synthetic Weakness: Dhrystone only measures a few mathematical and basic operations.
46 Integer only code Strength: This makes it potentially useful for simple 8 and 16-bit microcontrollers, assuming people don't care about relating anything to real world applications. Weakness: Does not measure multiply accumulate, floating-point, SIMD, or any other type of operations. Library dependent performance Weakness: Dhrystone’s execution is largely spent in standard C library functions, such as strcmp(),strcpy(), and memcpy ( ). Compiler vendors generally provide these libraries that are typically optimized and hand-written in assembly language. While you may think you are benchmarking a processor, you are really benchmarking are the compiler writer’s optimizations of the C library functions for a particular platform. No Evolution Weakness: Compiler writers have long ago determined Dhrystone’s functionality. The secret to good benchmarks, as SPEC and EEMBC have shown, is to stay ahead of the compiler writers to ensure that the processor and system is benchmarked, not just the compiler. No Third-Party Certification Weakness: Dhrystone’s lack of an official certification process has eliminated this benchmark’s credibility. Certification can only come from inherent value, and there is very little value in Dhrystone to modern processors or compilers. No Source Control Weakness: Dhrystone is available from multiple sources, and while most companies attempt to use Weicker's original source, some servers have "gone dark" as the age of the Web increases. There is great potential that a company, or an individual, has modified the code to its advantage. Some companies report Dhrystone 1.1 scores - an even older version of the code. No Standard Run Rules Weakness:
47 Due to the lack of a standards organization, Dhrystone’s original runtime rules have eroded into a state of confusion, thereby turning it into a performance measurement that is easily circumvented. No Disclosure of Benchmark Environment Weakness: The benchmarking environment, including processor and memory clock speed, compiler switches, and libraries, are not disclosed nor required. Inlining or excessive compiler optimization destroys the benchmark Weakness: Instructing the compiler to inline the code, greatly increasing the benchmark's susceptibility to code elimination, typically breaks Dhrystone's apocryphal "rules". The benchmark essentially vanishes and scores get unrealistically good.
49 APPENDIX E: Set of simple applications The algorithms that have been used in the benchmarks are included in this section. All of them, except the last one, come from MSP430 Competitive Benchmarking of Texas Instrument [9]. 8-bit Math.c /************************************************************************ * * Name : 8-bit Math * Purpose : Benchmark 8-bit math functions. * ************************************************************************/ typedef unsigned char UInt8; UInt8 add(UInt8 a, UInt8 b) { return (a + b); } UInt8 mul(UInt8 a, UInt8 b) { return (a * b); } UInt8 div(UInt8 a, UInt8 b) { return (a / b); } void main(void) { volatile UInt8 result[4]; result[0] = 12; result[1] = 3; result[2] = add(result[0], result[1]); result[1] = mul(result[0], result[2]); result[3] = div(result[1], result[2]); return; }
50 8-bit 2-dim Matrix.c /************************************************************************ * * Name : 8-bit 2-dim Matrix * Purpose : Benchmark copying 8-bit values. * ************************************************************************/ typedef unsigned char UInt8; const UInt8 m1[16][4] = { {0x12, 0x56, 0x90, 0x34}, {0x78, 0x12, 0x56, 0x90}, {0x34, 0x78, 0x12, 0x56}, {0x90, 0x34, 0x78, 0x12}, {0x12, 0x56, 0x90, 0x34}, {0x78, 0x12, 0x56, 0x90}, {0x34, 0x78, 0x12, 0x56}, {0x90, 0x34, 0x78, 0x12}, {0x12, 0x56, 0x90, 0x34}, {0x78, 0x12, 0x56, 0x90}, {0x34, 0x78, 0x12, 0x56}, {0x90, 0x34, 0x78, 0x12}, {0x12, 0x56, 0x90, 0x34}, {0x78, 0x12, 0x56, 0x90}, {0x34, 0x78, 0x12, 0x56}, {0x90, 0x34, 0x78, 0x12} }; void main (void) { int i, j; volatile UInt8 m2[16][4], m3[16][4]; for(i = 0; i < 16; i++) { for(j=0; j < 4; j++) { m2[i][j] = m1[i][j]; m3[i][j] = m2[i][j]; } } return; }
57 32-bit Math.c /************************************************************************ * * Name : 32-bit Math * Purpose : Benchmark 32-bit math functions. * ************************************************************************/ #include <math.h> typedef unsigned long UInt32; UInt32 add(UInt32 a, UInt32 b) { return (a + b); } UInt32 mul(UInt32 a, UInt32 b) { return (a * b); } UInt32 div(UInt32 a, UInt32 b) { return (a / b); } void main(void) { volatile UInt32 result[4]; result[0] = 43125; result[1] = 14567; result[2] = add(result[0], result[1]); result[1] = mul(result[0], result[2]); result[3] = div(result[1], result[2]); return; }
58 Floating-point Math.c /************************************************************************ * * Name : Floating-point Math * Purpose : Benchmark floating-point math functions. * ************************************************************************/ float add(float a, float b) { return (a + b); } float mul(float a, float b) { return (a * b); } float div(float a, float b) { return (a / b); } void main(void) { volatile float result[4]; result[0] = 54.567; result[1] = 14346.67; result[2] = add(result[0], result[1]); result[1] = mul(result[0], result[2]); result[3] = div(result[1], result[2]); return; }
59 FIR Filter.c /************************************************************************ * * Name : FIR Filter * Purpose : Benchmark a FIR filter. The input values for the filter * is an array of 51 16-bit values. The order of the filter 17. * ************************************************************************/ #include <math.h> #define FIR_LENGTH 17 const float COEFF[FIR_LENGTH] = { -0.000091552734, 0.000305175781, 0.004608154297, 0.003356933594, -0.025939941406, -0.044006347656, 0.063079833984, 0.290313720703, 0.416748046875, 0.290313720703, 0.063079833984, -0.044006347656, -0.025939941406, 0.003356933594, 0.004608154297, 0.000305175781, -0.000091552734 }; /* The following array simulates input A/D converted values */ const unsigned int INPUT[] = { 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000, 0x0C00, 0x0800, 0x0400, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000, 0x0C00, 0x0800, 0x0400, 0x0400, 0x0800, 0x0C00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x2400, 0x2000, 0x1C00, 0x1800, 0x1400, 0x1000, 0x0C00, 0x0800, 0x0400 }; void main(void) { int i, y; /* Loop counters */ volatile float OUTPUT[36]; for(y = 0; y < 36; y++) { for(i = 0; i < FIR_LENGTH/2; i++) { OUTPUT[y] = COEFF[i] * ( INPUT[y + 16 - i] + INPUT[y + i] );
60 } OUTPUT[y] = OUTPUT[y] + ( INPUT[y + 16 - i] * COEFF[i] ); } return; }
61 Matrix Multiplication.c /************************************************************************ * * Name : Matrix Multiplication * Purpose : Benchmark multiplying a 3x4 matrix by a 4x5 matrix. * Matrix contains 16-bit values. * ************************************************************************/ typedef unsigned short UInt16; const UInt16 m1[3][4] = { {0x01, 0x02, 0x03, 0x04}, {0x05, 0x06, 0x07, 0x08}, {0x09, 0x0A, 0x0B, 0x0C} }; const UInt16 m2[4][5] = { {0x01, 0x02, 0x03, 0x04, 0x05}, {0x06, 0x07, 0x08, 0x09, 0x0A}, {0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, {0x10, 0x11, 0x12, 0x13, 0x14} }; void main(void) { int m, n, p; volatile UInt16 m3[3][5]; for(m = 0; m < 3; m++) { for(p = 0; p < 5; p++) { m3[m][p] = 0; for(n = 0; n < 4; n++) { m3[m][p] += m1[m][n] * m2[n][p]; } } } return; }
62 RSA_Multiplication.c /************************************************************************ * * Name : RSA Multiplication * Purpose : Benchmark multiplying vectors. * ************************************************************************/ unsigned char f1[256]; unsigned char f2[256]; unsigned char p[256]; void main(void) { unsigned long i,j; unsigned long acc; unsigned long loop; t1 = *(unsigned int*)0xFE4; //Start for (i=0; i<256; i++) { f1[255-i] = (unsigned char)i; f2[i] = (unsigned char)i; } for (loop=0; loop<1000; loop++) { acc = (f1[0] * f2[0]); p[0] = (unsigned char)acc; acc >>= 8; for (j=1; j<256; j++) { for (i=0; i<=j; i++) { acc += (f1[i] * f2[j-i]); } p[j] = (unsigned char)acc; acc >>= 8; } } }
63 REFERENCES [1] Gustavo Morales. Benchmarking, http://www.monografias.com/trabajos3/bench/bench.shtml [Date of access: 11/06/2006] [2] Wikipedia contributors. Benchmark (computing), http://en.wikipedia.org/wiki/Benchmark_%28computing%29 [Date of access: 22/04/2006] [3] Wikipedia contributors. Dhrystone, http://en.wikipedia.org/wiki/Dhrystone [Date of access: 23/04/2006] [4] Classic Benchmarks, http://homepage.virgin.net/roy.longbottom/classic.htm [Date of access: 23/04/2006] [5] Alan R. Weiss. Dhrystone Benchmark: History, Analysis, "Scores" and Recommendations. USA: ECL,2002 http://ebenchmarks.com/download/ECLDhrystoneWhitePaper2.pdf [Date of access: 02/05/2006] [6] Wikipedia contributors. Embedded system, http://en.wikipedia.org/wiki/Embedded_system [Date of access: 11/06/2006] [7] Jakob Engblom. Embedded Systems Computer Architecture. Sweden: Virtutech AB & Uppsala University, 2002 [8] IEARobotics. Desarrollo de aplicaciones multiplataforma Linux/Windows, para consola, con Cygwin. http://www.iearobotics.com/proyectos/cuadernos/ct6/ct6.html [Date of access: 13/6/2006] [9] Greg Morton. MSP430 Competitive Benchmarking. USA: Texas Instruments, 2005 http://focus.ti.com/lit/an/slaa205a/slaa205a.pdf [Date of access: 29/2/2006] [10] TTCP. Test TCP and UDP connection ftp://ftp.sgi.com/sgi/src/ttcp [Date of access: 03/07/2006]
65 BIBLIOGRAPHY Jakob Engblom. Embedded Systems Computer Architecture. Sweden: Virtutech AB & Uppsala University, 2002 IEARobotics. Desarrollo de aplicaciones multiplataforma Linux/Windows, para consola, con Cygwin. http://www.iearobotics.com/proyectos/cuadernos/ct6/ct6.html [Date of access: 13/6/2006] The Embedded Microprocessor Benchmark Consortium (EEMBC) http://www.eembc.com [Date of access: 12/3/2005] EEMBC Certification Laboratory http://www.ebenchmarks.com [Date of access: 12/3/2005] SPEC - Standard Performance Evaluation Corporation http://www.specbench.org [Date of access: 12/3/2005] Linux man pages online http://man.he.net [Date of access: 17/6/2005] Alphabetical Directory of Linux Commands http://www.oreillynet.com/linux/cmd [Date of access: 22/6/2005] Lenguajes y Herramientas de Programación, Universidad de La Laguna. Las clases Java Socket y ServerSocket. Spain, 2004-2005. José Luis Elvira Valenzuela. Paso de mensajes en ambientes distribuidos Sockets. Beginning Linux Programming. Mexico, 2005. http://iteso.mx/~jluis/sd/diapositivas/02-Sockets.pdf [Date of access: 10/6/2006] Greg Morton. MSP430 Competitive Benchmarking. USA: Texas Instruments, 2005 http://focus.ti.com/lit/an/slaa205a/slaa205a.pdf [Date of access: 29/2/2006]
FIGURE LIST INTRODUCTION ............................................................................................................9 CHAPTER 1. BACKGROUND.....................................................................................11 Figure 1. Most embedded systems are real-time and most real-time systems are embedded............................................................................................................................ 12 CHAPTER 2. BOARD FEATURES..............................................................................13 Figure 2. RCM3720 Ethernet Connection Kit...................................................................... 13 Figure 3. Rabbit Development kit (Dynamic C)................................................................... 14 Figure 4. SNAP board with IM1000..................................................................................... 15 Figure 5. Imsys Developper ................................................................................................ 15 CHAPTER 3. BENCHMARKS .....................................................................................19 Figure 6. Procedure to calculate the execution time........................................................... 19 Figure 7. Scenario for determining TCP/IP performance.................................................... 22 Figure 8. Diagram of the procedure of the benchmark ....................................................... 22 Figure 9. TCP packet .......................................................................................................... 22 CHAPTER 4. RESULTS............................................................................................... 23 Figure 10. Orderly boards according to the execution time ................................................ 23 Figure 11. Proportion of time that each board spends to execute an application............... 24 Figure 12. Whetstone results .............................................................................................. 25 Figure 13. Dhrystone results ............................................................................................... 26 Figure 14. Results of the execution of the client-server between two PCs......................... 26 Figure 15. TCP rates uplink and downlink .......................................................................... 27 Figure 16. Comparison among boards................................................................................ 28 CONCLUSIONS ........................................................................................................... 29 APPENDIX ................................................................................................................... 31 APPENDIX A: OTHER STUDIED BOARDS................................................................33 Figure 17. CerfBoard 270 Linux of Intrinsyc........................................................................ 33 Figure 18. HyperTerminal, terminal emulation program of Windows.................................. 34 Figure 19. Bitfire board by Arrow engineering..................................................................... 35 Figure 20. Shell Cygwin ...................................................................................................... 35 Figure 21. Philips Flash Utility............................................................................................. 36 APPENDIX B: MEASURING EXECUTION TIME IN IMSYS DEVELOPER ................39 Figure 22. SNAP and IM3000 memory ............................................................................... 40 APPENDIX C: ENCOUNTERED PROBLEMS ............................................................43 APPENDIX D: DHRYSTONE’S CHARACTERISTICS ................................................45 APPENDIX E: SET OF SIMPLE APPLICATIONS....................................................... 49 REFERENCES ............................................................................................................. 63 BIBLIOGRAPHY .......................................................................................................... 65
TABLE LIST INTRODUCTION ............................................................................................................9 CHAPTER 1. BACKGROUND.....................................................................................11 CHAPTER 2. BOARD FEATURES..............................................................................13 Table 1. RabbitCore RCM3720 main specifications ........................................................... 14 Table 2. SNAP main specifications ..................................................................................... 15 Table 3. IM3000 main specifications................................................................................... 16 Table 4. Boards specific features........................................................................................ 17 CHAPTER 3. BENCHMARKS .....................................................................................19 Table 5. Features of set of simple applications................................................................... 20 CHAPTER 4. RESULTS............................................................................................... 23 Table 6. Features of different boards .................................................................................. 23 Table 7. Execution time in milliseconds .............................................................................. 23 Table 8. Whetstone results.................................................................................................. 25 Table 9. Dhrystone 2.1 results (LOOP = 100.000, C code) ................................................ 25 Table 10. TCP rate uplink performance .............................................................................. 27 Table 11. TCP rate downlink performance.......................................................................... 27 CONCLUSIONS ........................................................................................................... 29 APPENDIX ................................................................................................................... 31 APPENDIX A: OTHER STUDIED BOARDS................................................................33 Table 12. CerfBoard 270 Linux Specifications.................................................................... 34 Table 13. Bitfire main specifications.................................................................................... 36 Table 14. Execution time in milliseconds in Bitfire ARM ..................................................... 36 Table 15. All boards specific features ................................................................................. 37 APPENDIX B: MEASURING EXECUTION TIME IN IMSYS DEVELOPER ................39 APPENDIX C: ENCOUNTERED PROBLEMS ............................................................43 APPENDIX D: DHRYSTONE’S CHARACTERISTICS ................................................45 Table 16. Dhrystone’s strength and weakness ................................................................... 45 APPENDIX E: SET OF SIMPLE APPLICATIONS....................................................... 49 REFERENCES ............................................................................................................. 63 BIBLIOGRAPHY .......................................................................................................... 65