scieee AI-readable full text Open interactive document viewer

Repositorio Institucional de Documentos

Abstract

The general goal is to compare performance of two processors for the low-end embedded market: Intel Quark x1000 vs. ARM Cortex M3, with special emphasis in the memory hierarchy. To do that, first we will assess the cache potential varying sizes, associativities and line sizes by means of CACTI, a cache modeling tool. Then we will review relevant research literature to conclude about the importance and possibilities of the memory hierarchy in real-time embedded systems. Finally, we will write an specific benchmark suite, using it to test the two referenced processors. Pueyo Ramón, Pablo; Vaughan, John

Full text

University College Cork, Ireland Computer Science Department FINAL YEAR PROJECT April 2015 Caching in real-time and embedded systems Benchmarking the ARM Cortex-M3 and Quark SoC X1000 processors Student: Pablo Pueyo Ramon Student ID: 114102595 Supervisor: Dr John Vaughan Second Reader: Professor John Morrison 1 2 Contents 1 Introduction 5 2 Background 6 2.1 General view of the families and caching systems . . . . . . . 6 2.1.1 Description of the processor families . . . . . . . . . . 6 2.2 Little changes in the features of the caches to determine the influence on the final performance . . . . . . . . . . . . . . . . 11 2.2.1 Cachesize......................... 12 2.2.2 Linesize.......................... 16 2.2.3 Associativity ....................... 19 2.3 Systematic literature review about caching . . . . . . . . . . . 22 2.3.1 Questions for the analysis . . . . . . . . . . . . . . . . 23 2.3.2 Answers to the questions applied to the documents . . 24 2.3.3 Discussion......................... 25 3 Building the benchmark suite 28 3.1 Boards............................... 28 3.2 Environment and materials . . . . . . . . . . . . . . . . . . . . 29 3.3 Oscilloscope and wave generator . . . . . . . . . . . . . . . . . 30 3.4 Looking for other benchmark programs . . . . . . . . . . . . . 30 3.5 How the benchmark programs for real-time systems should be? 31 4 The benchmark suite 33 4.1 Performance in mathematical calculations . . . . . . . . . . . 33 4.1.1 Pi ............................. 33 4.2 Performance in mathematical calculations and memory performance.............................. 34 4.2.1 Quicksort ......................... 35 4.2.2 Determinant........................ 38 4.3 Performance in Input/Output . . . . . . . . . . . . . . . . . . 41 4.3.1 IRreceiver......................... 41 4.3.2 Interruption........................ 44 4.3.3 Potentiometer . . . . . . . . . . . . . . . . . . . . . . . 45 5 Results on the boards 47 5.1 IRReceiver and Potentiometer . . . . . . . . . . . . . . . . . . 47 5.2 Pi ................................. 47 5.3 Quicksort ............................. 47 5.4 Determinant............................ 49 3 5.5 Interruption............................ 51 5.5.1 Arduino .......................... 51 5.5.2 Galileo........................... 52 5.5.3 Comparisons of this program . . . . . . . . . . . . . . 52 6 Final highlights and conclusions 53 6.1 Tables with the results . . . . . . . . . . . . . . . . . . . . . . 53 6.2 Finalconclusion.......................... 55 4 1 Introduction Nowadays, the systems that are used in the field of the informatics are more and more different to each other. One of the most important systems are embedded system due to they are inside the devices that the current people use everyday such as cars, appliances, videoconsoles, other electronic devices. That is why these devices should work properly, without any problem, because they can affect sometimes the people’s security. So, the choice of a good embedded processor or a bad one, depending on the features, seems to be an important aspect. Therefore, it is important to create a good benchmark suite which is able to test the processor features as well as their performance in order to choice the most suitable one depending to its application. The end of this project is to compare two commercial processors, which will be described later, through a suite of benchmark created for the project. 5 2 Background 2.1 General view of the families and caching systems The processors used in this project are the following: -Intel Quark x1000 which is included into an Intel Galileo board and, -ARM Cortex M3, included in an Arduino DUE board. The processors will be described deeply in the following sections: 2.1.1 Description of the processor families 2.1.1.1 Quark x1000 General View of the chip This chip was designed by Intel. The first one was announced in September 2013 and started to be sold on the first months of 2014. The chip was developed to support embedded operating systems, with the goal of improving the consumption of power, but reaching good speed and performance too. It has only one core, manufactured on 32nm technology, and supports Pentium instruction set. It is capable of reaching clock frequency up to 400 MHz . These processors are slower and smaller than Intel previous one, Atom, but it consumes less power, feature which is more and more important to achieve a good embedded system-on chip nowadays. 6 Figure 1: Overview of the Quark x1000 chip [1] Memory System This family of processors has a unified 16 Kb cache for instructions and data, in order to improve the performance of the whole processor, since caches are becoming one of the most important aspects of a chip to achieve better performances. In Fig.1 (in blue) it is easy to notice that two buses of data and instructions access to the same cache. This cache is organize as a 4-way associative one. Therefore, it has 256 sets of 64 bytes each one. Each line of the cache, named blocks, has 16 bytes, 4 words. Thereby each set is comprised of 4 blocks. That is to say that the whole cache is capable to store up to 1024 blocks. This cache can either work with write-back mode or with write-through one, which can be set by the programmer or designer of the application that runs in the processor, depending of the well-known advantages and disadvantages of using each mode of writing from cache to main memory. 7 Write-back cache coherency To preserve the write-back cache coherency of block, this processor uses a MESI protocol, which is founded on 4 states of each block, in order to know if a block can be used, if it should write on main memory if it is replaced, or it is necessary to access main memory to read the block. The four states are M (modified - can be read or written), E (exclusive - this cache is the only owner of this modified block), S (shared - One or more caches have this clean block), I (Invalid - The block cannot be used because do not respect the coherency with main memory) 2.1.1.2 ARM Cortex General View of the chip ARM is a 32 bits RISC (Reduced instruction set computing) instruction set architecture. Its simplicity and reduced power consumption mean that the ARM is found in approximately 90% of the microcontrollers and microprocessors of the most of mobile and embedded systems, as smartphones, calculators, some computer devices, PDAs and videogames consoler processors. Big companies implement their chips with ARM architecture, such as Nvidia, Samsung, Qualcomm, Apple and Atmel among others. It is difficult to talk about the features of this processor, because there are a lot of subfamilies of ARM processor, each one with different features and properties. The subfamily that is going to be described is Cortex Family. Inside the Cortex subfamily, we can find up to 4 Cortex subfamilies. Those are, from the oldest to the newest, Cortex-M, Cortex-R, Cortex-A, Cortex A-50. Memory System The memory system depends of each processor again. There are Cortex processors with a high cache memory, separated into instruction and data ones, and Cortex processors without cache memory. Therefore, it is better to describe one by one each family of processors in the 8 field of cache memory, even though the family with which we will work will be the Cortex M3. Cortex-M Inside of this family, we can find various architectures. They are intended for microcontroller use. The first is ARMv6-M. Cortex M1 and M0 belong to this family. This architecture does not have cache, what can affect chip performance. After that, the next architecture inside this family is ARM v7-M. M3 and 4 processors do not have cache again, but the most recent processor in this family, Cortex M7, which was announced in 2014, may have cache. It meant a big improvement in the performance of its previous model, M4, with new features like the possibility of having cache. It may have one instruction cache from 0 to 64 Kb and one for data with the same size. Cortex-R The next step in ARM processors is Cortex-R. This was designed to work in real-time use, so its performance is better than the M ones. These processors are based on ARMv7 architecture, and may have cache. The first is Cortex-R4, which can have again 0-64 Kb separated caches for instructions and data. The next ones were optional - Multiple core processors. We can find 4–64 Kb separate caches for instructions and data again in Cortex R5 and Cortex R7 processors. Cortex-A The most known and used family of Cortex processors. They are designed to be used in an application level, so we can find Cortex-A processors in smartphones, videogames consoles, and others embedded systems. Inside this family, there are a lot of models, which was released in different year and which have different features. For example, there are 64 bit processors inside this subgroup Every processor has cache in this subfamily, in order to improve this speed and performance. The cache of each one, is, by release date: 9 2.2.2 Line size Now, the cache line size will be modified, in order to test how this can affect the whole cache performance. The rest of parameters will be fixed as Fig.10 shows. Figure 10: Parameters set in this section The results are shown in Fig.11. Figure 11: Table of results modifying the associativity 16 2.2.2.1 Plots with the results Figure 12: Plot Line size/Access time Figure 13: Plot Line size/Power 17 Figure 14: Plot Line size/Area Now in the plot in Fig.12, the access time rises when Line size does. It occurs because the bigger the line size is, the more information should be recovered in a cache access, so the time is higher. It is worth highlighting the striking change in the random cycle time when the line size is 8 words. It can be due to the relationship between the Cache size and the Line size. Again, in Fig.13, it can be noticed that the consumption of power is higher when the line size gears up. When the line size is 8 words, as it can be seen in the previous graphic, the clock frequency is low, so the power would be lower too. When line size is more than 16 words, the power consumption is unfeasible, so line size cannot be higher than 16 words in this cache due to the power limitation, one of the most important things in all current processors. As it can be noticed in the Fig.14, the value of total area rises again when line size does. Given the reference values, can be found in Fig.5, the whole processor should have an area of 0.488mm2so, assuming that, the only line 18 sizes can be set in this cache should be less than 16 words. It is totally impossible for current processors to have line size of 64 words, with a approximate area of 7mm2. 2.2.3 Associativity It is shown in Fig.15 how the rest of parameters will be set: Figure 15: Parameters set in this section The results are shown in Fig.16. Figure 16: Table of results modifying the associativity 19 2.2.3.1 Plots with the results Figure 17: Plot Associativity/Access time Figure 18: Plot Associativity/Power 20 Figure 19: Plot Associativity/Area Once again, in the Fig.17, everything rise when associativity rises. Those results are not really realistic, because increasing the associativity, a better performance of caches is achieved even though the access time is higher. Again, it can be noticed in Fig.18 that the power is proportional to the clock frequency. The energy is higher when the associativity rises. This test shows a less abrupt difference in the power than in the previous one. Seeing the Fig.19, the value of total area rises again when line size does. An associativity with value of 16, will not be accepted to this cache, because the area is higher than 0.48 mm2. The others values can be accepted. Now, it is understandable that the area is proportional to the associativity because the higher the associativity is, the more logic and physical hardware is needed to maintain the coherence between sets. 21 2.3 Systematic literature review about caching Caching is becoming one of the most important features in the most recent and updated processor devices such as real-time and embedded systems There are many different approaches of how caching can affect to the processor performance and energy consumption. While the performance is usually determined by the behavior of the application which is running, depending on the use of the spatial locality for example, cache energy consumption can affect up to 50% of the final processor energy use. We can find embedded systems everywhere -cars, small devices and appliances amog others-, they are becoming an important aspect in recent computing studies. As power consumption is more and more important in this field, because the increasingly dependence of batteries, there are a large number of papers and reviews which approach that subject, through loads of studies and experiments, trying to find the equilibrium between cache power consumption and performance. That is for why, this Systematic Literature Review will be made, to look for the best papers which are describing the cache model of a processor. The text will be found on the internet doing some searches on a searching engine such as google, doing queries related to the subject. 22 2.3.1 Questions for the analysis As a systematic literature review, a few question should be made in order to facilitate the searching of relevant documents. That documents will be chosen following the answer of the questions below, looking for this reports which can achieve the answer “yes” in the three proposed questions. Those documents will be the most important ones between all the selected at first in relation with the subject of this report “Caching in real-time and embedded systems”. In the first table, the questions are presented, followed by their possible answers. In the second table, all the documents found are placed, with its adequate answer for questions. Question Answer Q1. Does the text speak about the caching model in embedded/real-time systems? Yes/No Q2. Are some kind of experiments or comparisons about caching in real-time embedded systems presented? Yes/No Q3. Is any new method or improvement of the cache presented in the document? Yes/No 23 2.3.2 Answers to the questions applied to the documents No Author Year Topic Type Q1 Q2 Q3 [5] A. Marti Campoy, E. Tamura, S. Saez, F. Rodriguez, and J. V. Busquets- Mataix 2005 On Using Locking Caches in Embedded Real-Time Systems Y Y Y [6] Paul Markin 2003 A Case-Study On The Impact Of L2 Cache Size On CPU Performance N Y Y [7] Rogue Wave Software 2011 CPU Cache Optimization: Does It Matter? Should I Worry? Why? N Y Y [8] Dan Nicolaescu, Alex Veidenbaum, Alex Nicolaux - Reducing Power Consumption for High-Associativity Data Caches in Embedded Processors Y Y Y [9] Andhi Janapsatya, Aleksandar Ignjatovic, Sri Parameswaran 2006 Finding Optimal L1 Cache Configuration for Embedded Systems Y Y Y [10] Yujia Jin and Rong Chen - Instruction Cache Compression for Embedded Systems Y Y Y [11] Bruce Jacob 1999 Cache Design for Embedded Real-Time Systems Y Y Y [12] Norman P. Jouppi 1991 Cache Write Policies and Performance Y Y Y [13] Bruce Jacob 1998 Software-Managed Caches: Architectural Support for Real- Time Embedded Systems Y N N [14] Bach D. Bui, Marco Caccamo, Lui Sha, Joseph Martinez 2007 Impact of Cache Partitioning on Multi-Tasking Real Time Embedded Systems Y Y Y 24 No Author Year Topic Type Q1 Q2 Q3 [15] Prabhat Jain 2008 Software-assisted Cache Mechanisms for Embedded Systems Y Y Y [16] Emre Ozer, Resit Sendag and David Greggrr 2005 Multiple-Valued Caches for Power-Efficient Embedded Systems Y Y Y [17] Abu Asaduzzaman 2009 Cache optimization for real-time embedded systems Y Y Y [18] Abu Asaduzzaman - Block Cache for Embedded Systems Y Y Y [21] Frank Vahid, Walid Najjar and Chuanjun Zhang 2005 A Highly Configurable Cache for Low Energy Embedded Systems Y Y Y 2.3.3 Discussion In this section, the previous research questions will be answered, regarding the selected papers. RQ1. How important is the caching model to the processor performance? All text are speaking about this subject. We can start describing how the cache model can affect to the processor energy consumption, as we can see the importance of the caches energy consumption in many papers. Cache memories account for about 50% of the total energy consumed in the system, as we can read in [21]. Moreover, varying some cache parameters, the use of energy can be varied too. As [8] says, the difference between set-associative and non set-associative caches could be a critic decision if the designer wants to save energy, for example, for embedded systems, where energy consumption is one of the most important features. That is the same case in processor performance and speed. “Cache memories are crucial to obtain high performance on contemporary processors.” says [5]. And it is right. For example, following [6], doubling the L2 cache in the processor it talks about, can suppose an improvement of the computational performance of 4-5%, an important improvement in terms of processor performance. However, some texts says that the performance of the cache system is highly determined by the program behavior.[21] 25 Figure 25: Essential part of an embedded system. Source: [27] Therefore, what I want to measure is meanly the time. But, what tasks should I take the time for? Summarizing, The kinds of process which are measuring are those that are focused on, for example: -Multitasking -I/O -Memory management -Interrupt processing -Scheduling latency -Interprocess communications 32 4 The benchmark suite Thus the major features of embedded systems wanted to be tested, the suite of benchmarking programs of this project is divided in sections, depending on the feature of the system that it tests. The sections are the followings: 4.1 Performance in mathematical calculations The speed calculating and working with floating point numbers is remarkable in the effectiveness of an embedded system. For that, the program Pi was created: 4.1.1 Pi This program calculates the value of Pi using the Newton Approximation, though a big number of iterations using a loop. The number of iterations can be chosen, the more iterations you choose, the more accurate the value of Pi you will obtain, but it will take more time. The time taken in this program is that it uses since the first iteration to the value of Pi is calculated. // Pablo Pueyo // Program which c a l c u l a t e s the approximation of the pi // number using the Newton ’ s approximation . // Pi i s more accurate doing more i t e r a t i o n s , but i t // makes the processor to decrease the speed and to take // more time to execute the code . #define ITERATIONS 200000 // number of i t e r a t i o n s #define FLASH 1000 // b l i n k LED every 1000 // iterations void setup() { pinMode (13 , OUTPUT) ; S e r i a l . begin (960 0); } void loop () { unsigned long start , time ; 33 unsigned long n i t e r=ITERATIONS; unsigned long i , count =0; double x = 1 . 0 ; double temp , pi =1.0; s t a r t = m i l l i s ( ) ; S e r i a l . print ( ” Beginning ” ) ; S e r i a l . prin t ( n i t e r ) ; S e ri a l . pr i ntl n ( ” i t e r a t i o n s . . . ” ) ; S e r i a l . pr int ln ( ) ; for ( i = 2; i <n i t e r ; i++) { x∗=−1.0; pi += x / (2 .0 ∗(double) i −1); } time = m i l l i s () −s t a r t ; pi = pi ∗4 . 0 ; S e r i a l . print ( ”Number of i t e r a s = ” ) ; S e r i a l . p r i nt ln ( n i t e r ) ; S e r i a l . print ( ”Estimate of pi = ” ) ; S e r i a l . pr int ln ( pi , 1 0) ; S e r i a l . print ( ”Time : ” ) ; S e r i a l . print ( time ) ; S e r i a l . pr int ln ( ” ms” ) ; delay (10000); } 4.2 Performance in mathematical calculations and memory performance The two following programs have been created to test the performance of the memory management of the system. Moreover, it does some calculations with the arrays created, so the mathematical speed is also tested in these programs. 34 4.2.1 Quicksort It sorts a totally unsorted array, that is to say, an array sorted inversed, from the highest to the lowest number. The length of the array can be modified. After the creation of the array, it sorts the elements low to hight using the method called quicksort. Again, the longer the array is, the more time to complete the action it lasts. In this program, both the time of creating the array and of sorting the elements are taken. // QuickSort for benchmarking // // Pablo Pueyo // February 2015 // // This program create s a new array , with l eng th // i n dica ted in the constant LENGTH // I t f i l l s i t with random numbers , between 0 and // LENGHT and u t i l i s e s the method // qu ic k so r t to so rt the array . // After that , i t shows the times which the board // has used to create and f i l l the table , // and the time used to so rt the elements . I t a ls o // shows the f i r s t 50 elements of the t a b l e before // and a f t e r the s ort . // The le d i s on when the program i s s or ti ng the // elements // // Quicksort method obtained from the webpage // htt p ://www. cprogramto . com/c−program−quick−so r t / // with some modifications . #d efi ne LENGTH 2000 // l en gt h of the t a b l e void setup() { pinMode (13 , OUTPUT) ; S e r i a l . begin (960 0); } void loop () { unsigned long start , timeCreate , timeSort , show ; int table [LENGTH] ; 35 int i = 0 ; s t a r t = m i l l i s ( ) ; dig ita l Wr i te (13 , HIGH) ; while ( i != LENGTH −1){ table [ i ] = LENGTH −i−1; i++; } dig ita l Wr i te (13 , LOW) ; timeCreate = m i l l i s () −s t a r t ; i f (LENGTH <50){ show = LENGTH; } else { show=50; } S e r i a l . print ( ”Unsorted elements : [ ” ) ; for( i =0; i<show ; i++){ S e r i a l . print ( table [ i ] ) ; S e r i a l . print ( ” , ” ) ; } S e r i a l . pr int ln ( ” ] ” ) ; dig ita l Wr i te (13 , HIGH) ; s t a r t = m i l l i s ( ) ; quicksort ( table , 0 , LENGTH) ; timeSort = m i l l i s () −s t a r t ; dig ita l Wr i te (13 , LOW) ; S e r i a l . print ( ” Sorted elements : [ ” ) ; for( i =0; i<show ; i++){ S e r i a l . print ( table [ i ] ) ; S e r i a l . print ( ” , ” ) ; } S e r i a l . pr int ln ( ” ] ” ) ; S e r i a l . print ( ”Time to create : ” ) ; S e r i a l . pr int ln ( timeCreate ) ; S e r i a l . print ( ”Time to s or t : ” ) ; S e r i a l . pr int ln ( timeSort ) ; delay (10000); } 36 void quicksort ( int x [ ] , int first ,int l a s t ){ int pivot , j , temp , i ; i f ( f i r s t <l a s t ){ pivot=f i r s t ; i=f i r s t ; j=l a s t ; while( i<j ){ while( x [ i ]<=x [ pivot]&&i<l a s t ) i++; while(x [ j ]>x [ pivot ] ) j−−; i f ( i<j ){ temp=x [ i ] ; x [ i ]=x [ j ] ; x [ j ]=temp ; } } temp=x [ pivot ] ; x [ pivot ]=x [ j ] ; x [ j ]=temp ; quicksort (x , f i r s t , j −1); quicksort (x , j +1, l a s t ) ; } } 37 4.2.2 Determinant This program creates a matrix NxN (N indicated by the user) and calculates its determinant and matrix transpose using a recursive function. The time is again taken to make comparisons. // Pablo Pueyo Ramon // This program creat e s a matrix NxN (N ind i cate d by the // user ) and c a l c u l a t e s i t s determinant and matrix // transpose using a re cu rsi ve functi on . The time i s // again taken to make comparisons . // constants w i l l not change . They are used here to // se t pin numbers : const int ledPin = 13; // the number of the LED pin // v a r i a b l e s w i l l change : void setup() { // i n i t i a l i z e the LED pin as an output : pinMode ( ledPin , OUTPUT) ; S e r i a l . begin (960 0); } void loop () { int n = 9; double mat [ 1 0 ] [ 1 0 ] , tra s [ 1 0 ] [ 1 0 ] ; double inv[10][10]; // d i g i t a l W r i t e ( ledPin , LOW) ; for(int i =0; i<n ; i ++){ for(int j =0; j<n ; j++){ mat [ i ] [ j ] = ( rand () % 3) +1; } } long s t a r t = m i l l i s ( ) ; dig ita l Wr i te ( ledPin , LOW) ; double det1 = det (n , mat ) ; dig ita l Wr i te ( ledPin , HIGH) ; S e r i a l . pr int ln ( det1 ) ; 38 // d i g i t a l W r i t e ( ledPin , LOW) ; for(int i =0; i<n ; i++){ for(int j =0; j<n ; j++){ tra s [ i ] [ j ]=mat [ j ] [ i ] ; } // d i g i t a l W r i t e ( ledPin , HIGH) ; } S e r i a l . pr int ln ( m i l l i s ( ) −s t a r t ) ; delay (1000) ; } double det ( int n , double mat[10][10]) {double d = 0; int c , subi , i , j , subj ; double submat [ 1 0 ] [ 1 0 ] ; i f (n == 2) { return( (mat [ 0 ] [ 0 ] ∗mat[1][1]) − (mat [ 1 ] [ 0 ] ∗mat [ 0 ] [ 1 ] ) ) ; } else { for( c = 0; c <n ; c++) { subi = 0; for( i = 1; i <n ; i++) { subj = 0; for( j = 0; j <n ; j++) { i f ( j == c ) { continue ; } submat [ subi ] [ subj ] = mat [ i ] [ j ] ; subj++; } subi++; } d = d + (pow(−1 , c ) ∗mat [ 0 ] [ c ] ∗ 39 det (n −1 , submat ) ) ; } } return d ; } 40 4.3 Performance in Input/Output Probably the most important feature in the recent embedded processors. They should use the sensors/actuators to interact with the environment. The programs that take into account this function are: 4.3.1 IRreceiver Program created to benchmark the i/o of the board. In it, I used the infrared receiver as well as the remote control. Pushing 3 buttons of the remote, 3 leds of the board are turned on and off. Pushing the shutdown button, the three leds are turned off. In this case, the time since the signal is received and the led are turn off/on is taken. /∗Author : Pablo Pueyo Ramon ∗IRremote . Using the IR remote , the led 1 , 2 , 3 , ∗connected to the pins 4 , 5 , 6 , turn on when the ∗1 , 2 , 3 buttons of the remote are pushed . Pushing ∗the on/ o f f button , the three l e ds are turned o f f . ∗The time i s taken to know how f a s t i s the board ∗with the I /O s ince i t r ec e iv e s the Ir s i g n a l u n t i l ∗the le d i s on . ∗/ #include <IRremote2 . h> int RECV PIN = 18; int aPin = 4; int bPin = 5; int cPin = 6; int aOn = 0; int bOn = 0; int cOn = 0; decode results results ; IRrecv recept (RECV PIN ) ; void setup() { 41 Creating the table: Arduino DUE (ARM Cortex-M3): 280 µs Intel Galileo (Quark x1000): 2.2 ms The captions of the oscilloscope of this program are the following: Figure 26: Time creating the array to quicksort on Arduino Figure 27: Time creating the array to quicksort on Galileo Now, the time to create the table and write the 2000 elements on Cortex- M3 is much lower than on Quark x1000, 1000 times faster. That is to say that the memory management in the first processor is better than in the other one. It is curious because Quark counts with a cache, thus the memory access should be faster, and its RAM memory is much bigger, 512 KB vs 96 KB. The emulation of Arduino in the intel Galileo can affect this time. Sorting the table: Arduino DUE (ARM Cortex-M3): 270 ms Intel Galileo (Quark x1000): 85 ms 48 Figure 28: Time sorting the array to quicksort on Arduino Figure 29: Time sorting the array to quicksort on Galileo Now, the time sorting the elements is less in the Galileo Board, due to the faster clock frequency of the processor. 5.4 Determinant Again, the memory of the Cortex-M3 doesn’t allows to use more length of the matrix than 81 elements 9x9. But the results are big enough to make comparisons. Again, the results are separated in two different times, the times of the creation of the matrix and the time used to calculate the determinant of the matrix: Creating and storing the array: Arduino DUE (ARM M3): 300 µs Intel Galileo (Quark x1000): 2.4 ms The captions of the oscilloscope of this program are the following: 49 Figure 30: Time creating the matrix on Arduino Figure 31: Time creating the matrix on Galileo Again, the time to create a matrix 9x9 is 1000 times faster in Arduino than Galileo. It confirms that the memory management is better in Cortex- M3 than Quark x1000 that the results of the qsort experiment showed. Sorting the table: Arduino DUE (ARM M3): 1000 ms Intel Galileo (Quark x1000): 380 ms Figure 32: Time calculating the determinant of the matrix on Arduino Figure 33: Time calculating the determinant of the matrix on Galileo And, once again, the time calculating the determinant, working with floating point numbers again, is much less in Galileo than Arduino. It also confirms that Quark x1000 is faster doing mathematical calculations than Cortex-M3. 50 5.5 Interruption Now, we want to see which processor is better with the interruption management, one of the most important features of the embedded processors. For that, the program previously explained is executed in both boards with the next results: 5.5.1 Arduino First of all, experiments in Arduino board will be done. The board generates an output which variate depending on the branches and the machine instructions it should execute, as it can be seen in the following pictures (scale: 2µs per square) Figure 34: Minimum gap between waves in Arduino board (9µs) Figure 35: Maximum gap between waves in Arduino board (13µs) As it can be seen in the pictures, the gap between waves goes from 9 to 13 µ. That is why, the time for the arduino boards will be the average between them, 11 µs. This is the time the board uses to process an interruption. According to the manual, interrupt latency lasts 12 cycles. As the processor frequency is 84 Mhz (cycle time 0.0119 µs), 12 cycles would be 0,1547 µs. In this case, the information do not match with the information done by the board developer. 51 5.5.2 Galileo Now, the experiments will be executed in the Galileo board: Figure 36: Minimum gap between waves in Galileo board (14 ms) Figure 37: Maximum gap between waves in Galileo board (17.5 ms) It is important to remark that now, the scale is set as 2 ms per square, so the time taken will be much bigger. Again, the time taken will be the average between 14 and 17.5, so the time that Galileo needs to process a simple interruption would be 15,75 ms. 5.5.3 Comparisons of this program This experiment is very useful to know which board takes more time to process interruptions. Arduino lasts 11 µs, Galileo 15,75 ms. The result of this test is unusual. Galileo takes more than 1000 times more than Arduino Due does to process a simple interruption. It is strange because Galileo is a more powerful, newer board than Arduino. All the experiments done show that Galileo board takes much less time than Galileo processing data, even though it is less powerful processing interruptions. 52 6 Final highlights and conclusions 6.1 Tables with the results The overall results sorted in two tables (Table 1 and Table 2), after doing 10 iterations. Program t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 Average [1] Pi (ms) 3280 3280 3280 3280 3280 3280 3280 3280 3280 3280 3280 [2] Ir- Receiver(ms) 18 19 18 19 19 19 18 19 18 18 18,5 [3.1] Qsort(µs) -* - - - - - - - - - 280 [3.2] Qsort2(ms) 270 270 270 270 270 270 270 270 270 270 270 [4.1] Determinant (µs) -* - - - - - - - - - 300 [4.2] Determi- nant(ms) -* - - - - - - - - - 1000 [5] Interruption (µs) -*--------- 11 Table 1: Board with the results of the programs in the Arduino DUE (ARM Cortex-M3) 53 Program t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 Average [1] Pi(ms) 64 63 64 64 64 63 64 64 63 64 63.7 [3.1] Qsort (ms) -* - - - - - - - - - 2,2 [3.2] Qsort 2(ms) -* - - - - - - - - - 85 [4.1] Determi- nant(ms) -* - - - - - - - - - 2.4 [4.2] Determi- nant(ms) -* - - - - - - - - - 380 [5] Interrup- tion(ms) -* - - - - - - - - - 15.75 Table 2: Board with the results of the programs in the Intel Galileo (Quark X1000) The times taken are explained here: 1 - Pi: Time used calculating the Newton approximation of Pi, in 2000 loops. 3.1 - Qsort: Time needed to create the list of elements, which length is 2000. 3.2 - Qsort2: Time used to sort the array before created, totally unsorted. 4.1 - Determinant: Time taken to create and save in memory a matrix 9x9. 4.2 - Determinan2: Time taken to calculate the determinant of a matrix 9x9. 5 - Interrupt: Time to process a simple interruption. (*Taken with the oscilloscope, there is no average) 54 6.2 Final conclusion With these boards, it is possible to make final comparisons between both boards/processors. With these experiments, it is shown that the processor Quark X1000 is more powerful doing mathematical calculations and processing data in general. However, the ARM M3 is much more powerful and faster processing simple interruptions, what would be taken into account whether the interruptions in the embedded system where the processor will work are important or not. The Cortex-M3 is also faster in the programs in which the interaction with the memory play an important role. Therefore, it is difficult to choose only one processor. The election would depend on the application the processor is required to execute. Thus, if the embedded system is designed to interact with the I/O via interruptions, or the speed with the memory management is important, Cortex-M3 would be chosen. However, if the system has to work with mathematical calculations or calculations in general, and it is wanted that these calculations are fast, the election would be the Quark X1000. 55 References [1] Intel staff: Intel Quark Core HW Reference Manual. Site: http: //caxapa.ru/thumbs/497461/Intel_Quark_Core_HWRefMan_001.pdf . October 2013. [2] Intel staff: Intel Quark Core developer’s Manual. Site: http://download.intel.com/support/processors/quark/sb/ intelquarkcore_devman_001.pdf. October 2013. [3] Prof. Dan Grigoras: Slides from Mobile Devices and Systems 2015: University College Cork. [4] ARM staff: Cortex R4 datasheet Site: http://www.arm.com/products/ processors/cortex-r/cortex-r4.php [5] A. Marti Campoy, E. Tamura, S. Saez, F. Rodriguez, and J. V. Busquets- Mataix On Using Locking Caches in Embedded Real-Time Systems 2005: Departamento de Informatica de Sistemas y Computadores: Universidad Politecnica de Valencia, Grupo de Automatica y Robotica: Pontificia Universidad Javeriana - Cali, Colombia [6] Paul Markin A Case-Study On The Impact Of L2 Cache Size On CPU Performance 2003: www.overlockers.com [7] Rogue Wave Software CPU Cache Optimization: Does It Matter? Should I Worry? Why? 2011: United States of America [8] Dan Nicolaescu, Alex Veidenbaum, Alex Nicolau Reducing Power Consumption for High-Associativity Data Caches in Embedded Processors Dept. of Information and Computer Science, University of California at Irvine [9] Andhi Janapsatya, Aleksandar Ignjatovic, Sri Parameswaran Finding Optimal L1 Cache Configuration for Embedded Systems 2006: School of Computer Science and Engineering, The University of New South Wales at Sydney, Australia [10] Yujia Jin and Rong Chen Instruction Cache Compression for Embedded Systems Berkeley [11] Bruce Jacob Cache Design for Embedded Real-Time Systems 1999: Electrical & Computer Engineering Department, University of Maryland at College Park 56 [12] Norman P. Jouppi Cache Write Policies and Performance 1991: Western research laboratory at University Avenue Palo Alto, California [13] Bruce Jacob Software-Managed Caches: Architectural Support for Real- Time Embedded Systems 1998: Electrical Engineering Department, University of Maryland, College Park [14] Bach D. Bui, Marco Caccamo, Lui Sha, Joseph Martinez Impact of Cache Partitioning on Multi-Tasking Real Time Embedded Systems 2007: University of Illinois at Urbana-Champaign, Lockheed Martin Aeronautics Company [15] Prabhat Jain Software-assisted Cache Mechanisms for Embedded Systems 2008:Massachusetts institute of technology [16] Emre Ozer, Resit Sendag and David Greggr Multiple-Valued Caches for Power-Efficient Embedded Systems 2005: University of Rhode Island, Trinity College Dublin [17] Abu Asaduzzaman Cache optimization for real-time embedded systems 2009: Florida Atlantic University [18] Dominic Hillenbrand, Jorg Henkel Block Cache for Embedded Systems University of Karlsruhe [19] Raull Mata Botana Tablas en Latex 2008. [20] David R. Wilkins Getting started with Latex [21] Chuanjun Zhang, Frank Vahid and Walid Najjar A Highly Configurable Cache for Low Energy Embedded Systems 2005. [22] Venkat Rao, Gaurav Singhal, Anshul Kumar , Nicolas Navet Battery Model for Embedded Systems 2005: Random House, N.Y. [23] Software Engineering Group, Department of Computer Science Guidelines for performing Systematic Literature Reviews in Software Engineering 2007: Keele University and University of Durham. [24] Nabilah Kamarul Bahrin, Radziah Mohamadi A Systematic Literature Review of Test Case Generator for Embedded Real Time System 1986: Faculty of computing of Universiti Teknologi Malaysia 2005. [25] www.arduino.cc Arduino Due Board information Site: http://www. arduino.cc/en/Main/arduinoBoardDue 57