"LISARM: Embedded ARM Platform Design and Optimization" Thesis
Total Page:16
File Type:pdf, Size:1020Kb
POLITECNICO DI TORINO III Facolt`adi Ingegneria Corso di Laurea in Ingegneria Elettronica Tesi di Laurea LISARM: embedded ARM platform design and optimization Relatori: Prof. Guido Masera Ing. Maurizio Martina Ing. Fabrizio Vacca Candidato: Carlo Ceriani Aprile 2007 A mia madre, a mio padre e . a chi ha avuto ¯ducia in me I Acknowledgements Il primo e pi`ugrande ringraziamento va a mia madre, per il fondamentale supporto datomi in questi lunghi anni di studi, per non avermi mai fatto mancare la propria ¯ducia ed avermi saputo dare i giusti stimoli, soprattutto nei momenti pi`udi±cili. In queste righe non posso non ricordare mio padre, in particolare per avermi insegnato che, rimboccandosi le maniche ed avendo ¯ducia nelle proprie capacit`a,ci si pu`o sempre spingere oltre, allargando i propri orizzonti. Ringrazio il mio relatore, prof. Guido Masera, ed i miei corelatori, Maurizio Martina e Fabrizio Vacca, per le essenziali consulenze, per avermi saputo indirizzare negli snodi cruciali del mio lavoro e per avermi messo a disposizione le risorse di cui necessitavo. Ringrazio gli altri componenti del VLSILab, con i quali ho avuto il piacere di condividere questa esperienza, per essersi sempre dimostrati disponibili a risolvere una moltitudine di ordinari problemi presentatisi. Un particolare ringraziamento va a Federico Quaglio, per l'aiuto che mi ha dato sia nella fase di ricerca e sviluppo del progetto, che in quella di stesura di questo elaborato. Trattandosi dell'atto conclusivo di un lungo percorso di studi, ma anche e soprat- tutto per suggellare un tratto importante della mia vita, ringrazio tutti coloro che in questo cammino hanno saputo arricchire la mia vita di conoscenza, di esperienza, ma anche semplicemente di piacevoli momenti di svago. I Summary The di®usion of electronic devices in many aspects of the common life has deeply changed not only the industrial production constraints but also the technologies the applications required by the market are based on. Although System-on-Chip technology allows to put heterogeneous components on the same die, the devel- opment time of hardwired technologies and the noteworthy constraints imposed by economic return reasons, have led to ¯nd new approaches. Hardware-software partitioning is one of the most applied techniques; it allows to divide the target application complexity on two di®erent levels: powerful and flexible programmable system design and complex algorithm implementation for the market demand satis- faction. The development phase must be performed in a coordinated way between the designer groups, so that this approach can ensure reduced times for the product implementation. Other constraints, for power consumption and occupied area, are also important, particularly for mobile devices which have to give long endurance for batteries and higher performance with respect to preceding applications, as required by the customers. In this technology branch, microprocessor based platforms are the most di®used and the ARM7TDMI processor represents a successful product, thanks to its noteworhty performance and low power characteristics. Embedded processors use is not the unique solution, although architectures available on the market furnish many of the characteristics requested by manufacturers, sometimes they are not tailor-made for critical applications or their structure is too complex, with dramatic e®ects on power consumption and area occupation. A di®erent so- lution is represented by the ASIPs, i.e. processors speci¯cally designed for target applications, that provide a dedicated instruction-set, built on the software algo- rithms which have to be executed on them. The programmable architectures design uses particular software environments which allow to describe the instruction-set in a flexible manner, enabling the code reuse by writing it with an Architecture Descrip- tion Language like LISA 2.0. LISATek Toolsuite and Language for Instruction-Set Architecture allow the processor behavior description in all its aspects, also by a temporal point of view, integrating technologies like pipelining and caching and allowing to obtain an hardware description in HDL, a powerful simulator and all the dedicated tools for software development. Aim of this thesis work is to explore II the possibilities o®ered by the software environment in the development of a pro- grammable platform based on the ARM7 processor, whose available documentation, due to a number of its applications, allows to analyse in-depth the characteristics to be transferred to the model. Chapter 1 Contains a brief review of all the topics treated in this thesis and an extended summary in italian, as required by the university rules for foreign language thesis. Chapter 2 Introduces some concepts about computer architectures, reporting some historical outlines about the evolution of computers and microprocessors. Chapter 3 Describes the ARM7TDMI processor from its programmer's model to an in-depth architecture analysis, describing its instruction set and the core inter- facing with external systems. Chapter 4 Introduces the LISATek toolsuite, a powerful software environment for ASIP modeling, the principal instrument used for the LISARM development and veri¯cation. Chapter 5 Describes the LISARM processor model by reporting the guidelines fol- lowed in the development of its various parts and the architectural solutions adopted to obtain a coherent ARM7 model, for both behavior and internal structure. Chapter 6 Describes the tools obtained from the model description by using the LISATek automatic generation tools and some external solutions for the compati- bility issues, like memory wrapping and toolchain adaption. Chapter 7 Contains some conclusive considerations about the thesis work and traces some hypothesis about future applications of the produced material. III Contents Acknowledgements I Summary II 1 Sintesi 1 1.1 Introduzione . 1 1.2 L'architettura dei processori RISC . 2 1.3 Architettura del microprocessore ARM7 . 8 1.4 L'ambiente di sviluppo LISATek . 14 1.5 Il modello LISA dell'ARM7 . 19 1.6 Strumenti di sviluppo per ARM7 . 26 1.7 Conclusioni e sviluppi futuri . 29 2 The RISC microprocessor architecture 31 2.1 The Von Neumann architecture . 31 2.2 Harvard architecture . 33 2.3 The increased processor complexity . 34 2.4 The RISC architecture . 36 2.5 Pipelining and cache technology . 41 2.6 RISC vs CISC architecture . 45 3 The ARM microprocessor architecture 49 3.1 The ARM processor family . 50 3.2 The Thumb concept . 51 3.3 The programmer model . 53 3.3.1 Operating states and state switching . 53 3.3.2 Memory formats and data types . 53 3.3.3 Operating modes . 54 3.3.4 Processor resources . 55 3.3.5 The Processor Status Registers (PSRs) . 56 3.4 The exception handling . 57 IV 3.4.1 Processor reset . 60 3.4.2 Interrupt and fast interrupt requests . 60 3.4.3 Abort conditions . 61 3.4.4 Software interrupts and supervisor mode . 62 3.4.5 Unde¯ned instruction . 62 3.4.6 Exception priorities . 63 3.5 ARM instruction set . 63 3.5.1 Conditional execution . 63 3.5.2 Branch and exchange (BX) . 64 3.5.3 Branch and branch with link (B-BL) . 66 3.5.4 Data processing instructions . 67 3.5.5 PSR transfer instructions . 71 3.5.6 Multiply and multiply and accumulate (MUL-MLA) . 73 3.5.7 Multiply and multiply and accumulate long (MULL-MLAL) . 75 3.5.8 Single data transfer operations (LDR-STR) . 77 3.5.9 Halfword and signed data transfer operations . 79 3.5.10 Block data transfer operations (LDM-STM) . 80 3.5.11 Single data swap (SWP) . 82 3.5.12 Software interrupt . 83 3.5.13 Coprocessor instructions . 83 3.5.14 Unde¯ned instruction . 84 3.6 Thumb instruction set . 85 3.7 The memory interface . 86 3.8 The coprocessor interface . 89 3.9 The debugging system . 90 4 LISATek toolsuite 94 4.1 The ASIP design flow . 95 4.2 Architecture exploration . 97 4.3 The architecture description: the LISA language . 99 4.3.1 Memory model . 99 4.3.2 Resource model . 101 4.3.3 Instruction-set model . 102 4.3.4 Behavioral model . 103 4.3.5 Timing model . 104 4.3.6 Microarchitecture model . 105 4.4 The LISATek model development tools . 105 4.4.1 The Processor Designer . 105 4.4.2 The Instruction-set Designer . 106 4.4.3 The Syntax Debugger . 107 4.5 The architecture implementation . 108 V 4.6 The application software design . 110 4.6.1 Assembler and linker . 110 4.6.2 Disassembler . 110 4.6.3 Simulator: the \Processor Debugger" . 111 4.6.4 The C-Compiler . 113 4.7 The system integration and veri¯cation . 114 5 The LISARM model 116 5.1 The model structure . 116 5.1.1 Processor resources, interface, internal units . 117 5.1.2 The main LISA operation . 120 5.1.3 The coding tree and the decoding mechanism . 123 5.2 The processor datapath . 124 5.2.1 The barrel shifter unit . 124 5.2.2 The arithmetic logic unit . 127 5.2.3 The 32x8 bit multiplier . 128 5.3 Other LISA operations . 130 5.4 The branch instructions . 131 5.5 Data processing instructions . 133 5.6 PSR transfer instructions . 136 5.7 Multiplication instructions . 138 5.8 Single data transfer instructions . 140 5.9 Block data transfer instructions . 145 5.10 The data swap instruction . 146 5.11 Software interrupt and unde¯ned instructions . 147 6 LISARM support tools 149 6.1 The ARM LISA simulator . 149 6.2 The memory wrapping . 150 6.3 ARM commercial toolchains . 152 6.4 ARM model toolchain adaption . 153 6.5 HDL generation and tests . 155 7 Conclusions and possible future applications 158 7.1 Conclusions . 158 7.2 Possible future applications . 159 A Model LISA operations summary 161 Bibliography 166 VI Chapter 1 Sintesi 1.1 Introduzione La di®usione dei dispositivi elettronici in molti aspetti della vita comune ha cambia- to profondamente gli assetti della produzione industriale e le tecnologie che stanno alla base delle applicazioni che il mercato richiede.