Instruction Set Architecture

Total Page:16

File Type:pdf, Size:1020Kb

Instruction Set Architecture Instruction Set Architecture Background & Introduction CS 160 Ward 1 CS 160 Ward 2 Computers and Programs Machine Code • A simplified model of a computer consists of a • An executable program is a sequence of processing unit (CPU) and a memory. these simple instructions. • CPU can understand simple instructions: • The sequence is stored in memory (Von – read/write a memory location Neumann architecture). – add two numbers • The CPU processes the simple instructions – compare numbers sequentially. – etc. – Some instructions can tell the CPU to jump to a new place in memory to get the next instruction. CS 160 Ward 3 CS 160 Ward 4 Instructions Sample Program in Words • Each instruction is stored in memory as a bunch of bits. # Instruction 1 Set memory[801] to hold 00000001 • The CPU decodes the bits to determine what 2 Set memory[802] to hold 00000000 should happen. 3 If memory[802] = 10 jump to instruction #8 4 increment memory[802] • For example, the instruction to add 2 5 set memory[803] to 2 times memory[801] numbers might look like this: 6 put memory[803] in to memory[801] 7 jump to instruction #3 10100110 8 print memory[801] CS 160 Ward 5 CS 160 Ward 6 A Picture Human vs Machine Programs MEMORY Address • The computer can only understand the bits (the Instruction #1 0 encoded program) 1 Instruction #2 Instruction #3 CPUCPU 2 Machine Language 3 Instruction #4 4 Instruction #5 5 Instruction #6 • Humans don't like to deal with bits, so they ... ... developed English-like abbreviations for programs. 801 Assembly Language 802 803 • Typically, one-to-one relationship between the two CS 160 Ward 7 CS 160 Ward 8 Assembly & Machine Language An Assembler Our Sample Program Assembly Language Machine Language AssemblyAssembly ST 1,[801] 00100101 11010011 MachineMachine LanguageLanguage ST 0,[802] 00100100 11010100 AssemblerAssembler LanguageLanguage ProgramProgram TOP: BEQ [802],10,BOT 10001010 01001001 11110000 ProgramProgram INCR [802] 01000100 01010100 01001000 10100111 10100011 ST 1,[801] MUL [801],2,[803] ST 1,[801] 01001001 11100101 10101011 00000010 . 01001001 ST [803],[801] . 10010100 00101001 10010100 JMP TOP 11010101 BOT: LD A,[801] 11010100 10101000 CALL PRINT 10010001 01000100 CS 160 Ward 9 CS 160 Ward 10 Higher-Level Languages High-Level Languages • Assembly Language is much easier to deal • Many high-level languages have been with than Machine Language, but you still developed. need to know about all the instructions. – Different ways of representing • People/Companies have developed languages computations. that were independent of the specific – Different languages for different needs: machine language (i.e., portable). • symbolic vs. numeric computation – More abstract representation of • human efficiency vs. program efficiency instructions. • portability • extensibility CS 160 Ward 11 CS 160 Ward 12 Examples of High Level Languages Sample Program In C • C • C++ set memory[801] to hold 00000001 x=1; • Fortran set memory[802] to hold 00000000 i=0; • Java if memory[802] = 10 jump to instruction #8 while (i!=10) { increment memory[802] i++; • Ada set memory[803] to 2 times memory[801] x=x*2; • Basic put memory[803] in to memory[801] } } • Algo jump to instruction #3 print memory[801] printf("%d",x); Some High-Level Languages are “higher” than others. CS 160 Ward 13 CS 160 Ward 14 Compiler Many Different Compilers • Sample C Compilers: CC Program Program MachineMachine – GNU gcc CC CompilerCompiler LanguageLanguage ProgramProgram – Portland pgcc intint main() main() {{ intint i=1; i=1; – Keil C .. .. .. 0100100101001001 – Intel Win32 C 1001010010010100 – Sun C – Fujitsu C Created with text editor or – IBM AIX C development environment – . CS 160 Ward 15 CS 160 Ward 16 Elements of an Instruction • Operation code (Op code) – Do this Instruction Set • Source Operand(s) reference Characteristics & Functions – To this • Result Operand reference – Put the answer here • Next Instruction Reference (rare) – When you have done that, do this... CS 160 Ward 17 CS 160 Ward 18 Instruction Cycle State Diagram Simple Instruction Format (without Interrupts) • How many instructions (Opcodes) can we have in our Instruction Set? 24 = 16 • How much memory (or virtual memory) can we directly access in our system? 26 = 64 CS 160 Ward 19 CS 160 Ward 20 Number of Addresses [1] Number of Addresses [2] • 3 addresses • 2 addresses – Operand 1, Operand 2, Result – One address doubles as operand and result – a = b + c; – a = a + b – May be a fourth - next instruction (rare - – Reduces length of instruction usually implicit) – Requires some extra work – Needs very long words to hold everything. • Temporary storage to hold some results Why? – Typically indirect addressing using registers CS 160 Ward 21 CS 160 Ward 22 Number of Addresses [3] Number of Addresses [4] • 1 address • 0 (zero) addresses – Implicit second address – All addresses implicit – Usually a register (accumulator) – Uses a stack – Common on early machines – e.g. push a – push b – add – pop c – c = a + b CS 160 Ward 23 CS 160 Ward 24 How Many Addresses Types of Operand • More addresses • Addresses – More complex (powerful?) instructions • Numbers – More registers • Inter-register operations are quicker – Integer/floating point – Fewer instructions per program • Characters • Fewer addresses – ASCII, etc. – Less complex (powerful?) instructions • Logical Data – More instructions per program – Bits or flags – Faster fetch/execution of instructions CS 160 Ward 25 CS 160 Ward 26 Instructions: Types of Operation Two different classifications • Data Transfer • Data Access & Transfer Operations • Arithmetic • Arithmetic • Logical • Logical • Conversion • Floating-Point • I/O • Conditional & • Transfer of Control Unconditional Branch • System Control • Processor Control CS 160 Ward 27 CS 160 Ward 28 Common Data Transfer Operations Common Arithmetic Operations • Specify • Add, Subtract, Multiply, Divide – Source • Signed Integer – Destination • Floating point ? – Amount of data • May be different instructions for • May include different movements – Increment (a++) – e.g. IBM 370 – Decrement (a--) • Or one instruction and different – Negate (-a) addresses – e.g. VAX CS 160 Ward 29 CS 160 Ward 30 Common Shift and Rotate Operations Common Logical Operations • Bitwise operations • AND, OR, NOT CS 160 Ward 31 CS 160 Ward 32 Common Conversion Operations Common Input/Output Operations • E.g. Binary to Decimal • May be specific instructions • May be done using data movement instructions (memory mapped) • May be done by a separate controller (DMA) CS 160 Ward 33 CS 160 Ward 34 Common Transfer of Control Operations Branch Instruction • Branch – e.g. branch to x if result is zero • Skip – e.g. increment and skip if zero ISZ Register1 Branch xxxx ADD A • Subroutine call – c.f. interrupt call CS 160 Ward 35 CS 160 Ward 36 Nested Procedure Calls Use of Stack CS 160 Ward 37 CS 160 Ward 38 Common Systems Control Operations Example Instruction Set • Privileged instructions MIPS Instruction Set • CPU needs to be in specific state – Ring 0 on 80386+ • Early RISC Design – Kernel mode • Design goals: • For operating systems use – Speed • Ensure one instruction can complete every clock cycle – Minimalistic • Contain the fewest possible instructions necessary CS 160 Ward 39 CS 160 Ward 40 MIPS Instruction Set (Part I) MIPS Instruction Set (Part II) CS 160 Ward 41 CS 160 Ward 42 MIPS Floating-Point Instructions Aesthetics of Instruction Sets • Elegance – Balanced – No frivolous or useless instructions • Orthogonality – No unnecessary duplication – No overlap among instructions CS 160 Ward 43 CS 160 Ward 44 Prinicple of Orthogonality Typical Simple RISC Design The principle of orthogonality specifies • Instructions designed to that each instruction should perform a – Complete in one clock cycle unique task without duplicating or • Performs a basic computation overlapping the function of other – Support restricted set of operations instructions • Register operations • Load/Store operations – Fixed instruction length CS 160 Ward 45 CS 160 Ward 46 Addressing Modes • Immediate • Direct Addressing Modes • Register • Indirect – Memory – Register • Displacement/Indexed – various types • Stack CS 160 Ward 47 CS 160 Ward 48 Immediate Addressing Immediate Addressing Diagram • Operand is part of instruction • Operand = address field Instruction • e.g. ADD 5 Opcode Operand – Add 5 to contents of accumulator – 5 is operand • No memory reference to fetch data • Fast • Limited range CS 160 Ward 49 CS 160 Ward 50 Direct Addressing Direct Addressing Diagram • Address field contains address of operand Instruction • Effective address (EA) = address field (A) Opcode Address A • e.g. ADD A Memory – Add contents of cell A to accumulator – Look in memory at address A for operand • Single memory reference to access data • No additional calculations to work out Operand effective address • Limited address space CS 160 Ward 51 CS 160 Ward 52 Register Addressing (1) Register Addressing (2) • Operand is held in register named in • No memory access address filed • Very fast execution • EA = R • Large number of registers helps • Limited number of registers performance – Very small address field needed – Requires good assembly programming or – Shorter instructions compiler writing – Faster instruction fetch • Good (multiple) use of operands after in registers • Very limited address space – C programming – Number of registers much smaller than • register int a; memory • Compare: direct addressing CS 160 Ward 53 CS 160 Ward 54 Register Addressing Diagram
Recommended publications
  • The Instruction Set Architecture
    Quiz 0 Lecture 2: The Instruction Set Architecture COS / ELE 375 Computer Architecture and Organization Princeton University Fall 2015 Prof. David August 1 2 Quiz 0 CD 3 Miles of Music 3 4 Pits and Lands Interpretation 0 1 1 1 0 1 0 1 As Music: 011101012 = 117/256 position of speaker As Number: Transition represents a bit state (1/on/red/female/heads) 01110101 = 1 + 4 + 16 + 32 + 64 = 117 = 75 No change represents other state (0/off/white/male/tails) 2 10 16 (Get comfortable with base 2, 8, 10, and 16.) As Text: th 011101012 = 117 character in the ASCII codes = “u” 5 6 Interpretation – ASCII Princeton Computer Science Building West Wall 7 8 Interpretation Binary Code and Data (Hello World!) • Programs consist of Code and Data • Code and Data are Encoded in Bits IA-64 Binary (objdump) As Music: 011101012 = 117/256 position of speaker As Number: 011101012 = 1 + 4 + 16 + 32 + 64 = 11710 = 7516 As Text: th 011101012 = 117 character in the ASCII codes = “u” CAN ALSO BE INTERPRETED AS MACHINE INSTRUCTION! 9 Interfaces in Computer Systems Instructions Sequential Circuit!! Software: Produce Bits Instructing Machine to Manipulate State or Produce I/O Computers process information State Applications • Input/Output (I/O) Operating System • State (memory) • Computation (processor) Compiler Firmware Instruction Set Architecture Input Output Instruction Set Processor I/O System Datapath & Control Computation Digital Design Circuit Design • Instructions instruct processor to manipulate state Layout • Instructions instruct processor to produce I/O in the same way Hardware: Read and Obey Instruction Bits 12 State State – Main Memory Typical modern machine has this architectural state: Main Memory (AKA: RAM – Random Access Memory) 1.
    [Show full text]
  • Simple Computer Example Register Structure
    Simple Computer Example Register Structure Read pp. 27-85 Simple Computer • To illustrate how a computer operates, let us look at the design of a very simple computer • Specifications 1. Memory words are 16 bits in length 2. 2 12 = 4 K words of memory 3. Memory can be accessed in one clock cycle 4. Single Accumulator for ALU (AC) 5. Registers are fully connected Simple Computer Continued 4K x 16 Memory MAR 12 MDR 16 X PC 12 ALU IR 16 AC Simple Computer Specifications (continued) 6. Control signals • INCPC – causes PC to increment on clock edge - [PC] +1 PC •ACin - causes output of ALU to be stored in AC • GMDR2X – get memory data register to X - [MDR] X • Read (Write) – Read (Write) contents of memory location whose address is in MAR To implement instructions, control unit must break down the instruction into a series of register transfers (just like a complier must break down C program into a series of machine level instructions) Simple Computer (continued) • Typical microinstruction for reading memory State Register Transfer Control Line(s) Next State 1 [[MAR]] MDR Read 2 • Timing State 1 State 2 During State 1, Read set by control unit CLK - Data is read from memory - MDR changes at the Read beginning of State 2 - Read is completed in one clock cycle MDR Simple Computer (continued) • Study: how to write the microinstructions to implement 3 instructions • ADD address • ADD (address) • JMP address ADD address: add using direct addressing 0000 address [AC] + [address] AC ADD (address): add using indirect addressing 0001 address [AC] + [[address]] AC JMP address 0010 address address PC Instruction Format for Simple Computer IR OP 4 AD 12 AD = address - Two phases to implement instructions: 1.
    [Show full text]
  • Historical Perspective and Further Reading 162.E1
    2.21 Historical Perspective and Further Reading 162.e1 2.21 Historical Perspective and Further Reading Th is section surveys the history of in struction set architectures over time, and we give a short history of programming languages and compilers. ISAs include accumulator architectures, general-purpose register architectures, stack architectures, and a brief history of ARMv7 and the x86. We also review the controversial subjects of high-level-language computer architectures and reduced instruction set computer architectures. Th e history of programming languages includes Fortran, Lisp, Algol, C, Cobol, Pascal, Simula, Smalltalk, C+ + , and Java, and the history of compilers includes the key milestones and the pioneers who achieved them. Accumulator Architectures Hardware was precious in the earliest stored-program computers. Consequently, computer pioneers could not aff ord the number of registers found in today’s architectures. In fact, these architectures had a single register for arithmetic instructions. Since all operations would accumulate in one register, it was called the accumulator , and this style of instruction set is given the same name. For example, accumulator Archaic EDSAC in 1949 had a single accumulator. term for register. On-line Th e three-operand format of RISC-V suggests that a single register is at least two use of it as a synonym for registers shy of our needs. Having the accumulator as both a source operand and “register” is a fairly reliable indication that the user the destination of the operation fi lls part of the shortfall, but it still leaves us one has been around quite a operand short. Th at fi nal operand is found in memory.
    [Show full text]
  • PIC Family Microcontroller Lesson 02
    Chapter 13 PIC Family Microcontroller Lesson 02 Architecture of PIC 16F877 Internal hardware for the operations in a PIC family MCU direct Internal ID, control, sequencing and reset circuits address 7 14-bit Instruction register 8 MUX program File bus Select 8 Register 14 8 8 W Register (Accumulator) ADDR Status Register MUX Flash Z, C and DC 9 Memory Data Internal EEPROM RAM 13 Peripherals 256 Byte Program Registers counter Ports data 368 Byte 13 bus 2011 Microcontrollers-... 2nd Ed. Raj KamalA to E 3 8-level stack (13-bit) Pearson Education 8 ALU Features • Supports 8-bit operations • Internal data bus is of 8-bits 2011 Microcontrollers-... 2nd Ed. Raj Kamal 4 Pearson Education ALU Features • ALU operations between the Working (W) register (accumulator) and register (or internal RAM) from a register-file • ALU operations can also be between the W and 8-bits operand from instruction register (IR) • The operations also use three flags Z, C and DC/borrow. [Zero flag, Carry flag and digit (nibble) carry flag] 2011 Microcontrollers-... 2nd Ed. Raj Kamal 5 Pearson Education ALU features • The destination of result from ALU operations can be either W or register (f) in file • The flags save at status register (STATUS) • PIC CPU is a one-address machine (one operand specified in the instruction for ALU) 2011 Microcontrollers-... 2nd Ed. Raj Kamal 6 Pearson Education ALU features • Two operands are used in an arithmetic or logic operations • One is source operand from one a register file/RAM (or operand from instruction) and another is W-register • Advantage—ALU directly operates on a register or memory similar to 8086 CPU 2011 Microcontrollers-..
    [Show full text]
  • A Simple Processor
    CS 240251 SpringFall 2019 2020 FoundationsPrinciples of Programming of Computer Languages Systems λ Ben Wood A Simple Processor 1. A simple Instruction Set Architecture 2. A simple microarchitecture (implementation): Data Path and Control Logic https://cs.wellesley.edu/~cs240/s20/ A Simple Processor 1 Program, Application Programming Language Compiler/Interpreter Software Operating System Instruction Set Architecture Microarchitecture Digital Logic Devices (transistors, etc.) Hardware Solid-State Physics A Simple Processor 2 Instruction Set Architecture (HW/SW Interface) processor memory Instructions • Names, Encodings Instruction Encoded • Effects Logic Instructions • Arguments, Results Registers Data Local storage • Names, Size • How many Large storage • Addresses, Locations Computer A Simple Processor 3 Computer Microarchitecture (Implementation of ISA) Instruction Fetch and Registers ALU Memory Decode A Simple Processor 4 (HW = Hardware or Hogwarts?) HW ISA An example made-up instruction set architecture Word size = 16 bits • Register size = 16 bits. • ALU computes on 16-bit values. Memory is byte-addressable, accesses full words (byte pairs). 16 registers: R0 - R15 • R0 always holds hardcoded 0 Address Contents • R1 always holds hardcoded 1 0 First instruction, low-order byte • R2 – R15: general purpose 1 First instruction, Instructions are 1 word in size. high-order byte 2 Second instruction, Separate instruction memory. low-order byte Program Counter (PC) register ... ... • holds address of next instruction to execute. A Simple Processor 5 R: Register File M: Data Memory Reg Contents Reg Contents Address Contents R0 0x0000 R8 0x0 – 0x1 R1 0x0001 R9 0x2 – 0x3 R2 R10 0x4 – 0x5 R3 R11 0x6 – 0x7 R4 R12 0x8 – 0x9 R5 R13 0xA – 0xB R6 R14 0xC – 0xD R7 R15 … Program Counter IM: Instruction Memory PC Address Contents 0x0 – 0x1 ß Processor 1.
    [Show full text]
  • MIPS: Design and Implementation
    FACULTEIT INGENIEURSWETENSCHAPPEN MIPS: Design and Implementation Computerarchitectuur 1MA Industriele¨ Wetenschappen Elektronica-ICT 2014-10-20 Laurent Segers Contents Introduction......................................3 1 From design to VHDL4 1.1 The factorial algorithm.............................4 1.2 Building modules................................5 1.2.1 A closer look..............................6 1.2.2 VHDL..................................7 1.3 Design in VHDL................................8 1.3.1 Program Counter............................8 1.3.2 Instruction Memory........................... 14 1.3.3 Program Counter Adder........................ 15 1.4 Bringing it all together - towards the MIPS processor............ 15 2 Design validation 19 2.1 Instruction Memory............................... 19 2.2 Program Counter................................ 22 2.3 Program Counter Adder............................ 23 2.4 The MIPS processor.............................. 23 3 Porting to FPGA 25 3.1 User Constraints File.............................. 25 4 Additional features 27 4.1 UART module.................................. 27 4.1.1 Connecting the UART-module to the MIPS processor........ 28 4.2 Reprogramming the MIPS processor..................... 29 A Xilinx ISE software 30 A.1 Creating a new project............................. 30 A.2 Adding a new VHDL-module......................... 30 A.3 Creating an User Constraints File....................... 30 A.4 Testbenches................................... 31 A.4.1 Creating testbenches.......................... 31 A.4.2 Running testbenches.......................... 31 2 Introduction Nowadays, most programmers write their applications in what we call \the Higher Level Programming languages", such as Java, C#, Delphi, etc. These applications are then compiled into machine code. In order to run this machine code the underlying hardware needs be able to \understand" the proposed code. The aim of this practical course is to give an inside on the principles of a working system.
    [Show full text]
  • Computer Organization EECC 550 • Introduction: Modern Computer Design Levels, Components, Technology Trends, Register Transfer Week 1 Notation (RTN)
    Computer Organization EECC 550 • Introduction: Modern Computer Design Levels, Components, Technology Trends, Register Transfer Week 1 Notation (RTN). [Chapters 1, 2] • Instruction Set Architecture (ISA) Characteristics and Classifications: CISC Vs. RISC. [Chapter 2] Week 2 • MIPS: An Example RISC ISA. Syntax, Instruction Formats, Addressing Modes, Encoding & Examples. [Chapter 2] • Central Processor Unit (CPU) & Computer System Performance Measures. [Chapter 4] Week 3 • CPU Organization: Datapath & Control Unit Design. [Chapter 5] Week 4 – MIPS Single Cycle Datapath & Control Unit Design. – MIPS Multicycle Datapath and Finite State Machine Control Unit Design. Week 5 • Microprogrammed Control Unit Design. [Chapter 5] – Microprogramming Project Week 6 • Midterm Review and Midterm Exam Week 7 • CPU Pipelining. [Chapter 6] • The Memory Hierarchy: Cache Design & Performance. [Chapter 7] Week 8 • The Memory Hierarchy: Main & Virtual Memory. [Chapter 7] Week 9 • Input/Output Organization & System Performance Evaluation. [Chapter 8] Week 10 • Computer Arithmetic & ALU Design. [Chapter 3] If time permits. Week 11 • Final Exam. EECC550 - Shaaban #1 Lec # 1 Winter 2005 11-29-2005 Computing System History/Trends + Instruction Set Architecture (ISA) Fundamentals • Computing Element Choices: – Computing Element Programmability – Spatial vs. Temporal Computing – Main Processor Types/Applications • General Purpose Processor Generations • The Von Neumann Computer Model • CPU Organization (Design) • Recent Trends in Computer Design/performance • Hierarchy
    [Show full text]
  • Overview of the MIPS Architecture: Part I
    Overview of the MIPS Architecture: Part I CS 161: Lecture 0 1/24/17 Looking Behind the Curtain of Software • The OS sits between hardware and user-level software, providing: • Isolation (e.g., to give each process a separate memory region) • Fairness (e.g., via CPU scheduling) • Higher-level abstractions for low-level resources like IO devices • To really understand how software works, you have to understand how the hardware works! • Despite OS abstractions, low-level hardware behavior is often still visible to user-level applications • Ex: Disk thrashing Processors: From the View of a Terrible Programmer Letter “m” Drawing of bird ANSWERS Source code Compilation add t0, t1, t2 lw t3, 16(t0) slt t0, t1, 0x6eb21 Machine instructions A HARDWARE MAGIC OCCURS Processors: From the View of a Mediocre Programmer • Program instructions live Registers in RAM • PC register points to the memory address of the instruction to fetch and execute next • Arithmetic logic unit (ALU) performs operations on PC registers, writes new RAM values to registers or Instruction memory, generates ALU to execute outputs which determine whether to branches should be taken • Some instructions cause Devices devices to perform actions Processors: From the View of a Mediocre Programmer • Registers versus RAM Registers • Registers are orders of magnitude faster for ALU to access (0.3ns versus 120ns) • RAM is orders of magnitude larger (a PC few dozen 32-bit or RAM 64-bit registers versus Instruction GBs of RAM) ALU to execute Devices Instruction Set Architectures (ISAs)
    [Show full text]
  • Phaser 600 Color Printer User Manual
    WELCOME! This is the home page of the Phaser 600 Color Printer User Manual. See Tips on using this guide, or go immediately to the Contents. Phaser® 600 Wide-Format Color Printer Tips on using this guide ■ Use the navigation buttons in Acrobat Reader to move through the document: 1 23 4 5 6 1 and 4 are the First Page and Last Page buttons. These buttons move to the first or last page of a document. 2 and 3 are the Previous Page and Next Page buttons. These buttons move the document backward or forward one page at a time. 5 and 6 are the Go Back and Go Forward buttons. These buttons let you retrace your steps through a document, moving to each page or view in the order visited. ■ For best results, use the Adobe Acrobat Reader version 2.1 to read this guide. Version 2.1 of the Acrobat Reader is supplied on your printer’s CD-ROM. ■ Click on the page numbers in the Contents on the following pages to open the topics you want to read. ■ You can click on the page numbers following keywords in the Index to open topics of interest. ■ You can also use the Bookmarks provided by the Acrobat Reader to navigate through this guide. If the Bookmarks are not already displayed at the left of the window, select Bookmarks and Page from the View menu. ■ If you have difficultly reading any small type or seeing the details in any of the illustrations, you can use the Acrobat Reader’s Magnification feature.
    [Show full text]
  • Reverse Engineering X86 Processor Microcode
    Reverse Engineering x86 Processor Microcode Philipp Koppe, Benjamin Kollenda, Marc Fyrbiak, Christian Kison, Robert Gawlik, Christof Paar, and Thorsten Holz, Ruhr-University Bochum https://www.usenix.org/conference/usenixsecurity17/technical-sessions/presentation/koppe This paper is included in the Proceedings of the 26th USENIX Security Symposium August 16–18, 2017 • Vancouver, BC, Canada ISBN 978-1-931971-40-9 Open access to the Proceedings of the 26th USENIX Security Symposium is sponsored by USENIX Reverse Engineering x86 Processor Microcode Philipp Koppe, Benjamin Kollenda, Marc Fyrbiak, Christian Kison, Robert Gawlik, Christof Paar, and Thorsten Holz Ruhr-Universitat¨ Bochum Abstract hardware modifications [48]. Dedicated hardware units to counter bugs are imperfect [36, 49] and involve non- Microcode is an abstraction layer on top of the phys- negligible hardware costs [8]. The infamous Pentium fdiv ical components of a CPU and present in most general- bug [62] illustrated a clear economic need for field up- purpose CPUs today. In addition to facilitate complex and dates after deployment in order to turn off defective parts vast instruction sets, it also provides an update mechanism and patch erroneous behavior. Note that the implementa- that allows CPUs to be patched in-place without requiring tion of a modern processor involves millions of lines of any special hardware. While it is well-known that CPUs HDL code [55] and verification of functional correctness are regularly updated with this mechanism, very little is for such processors is still an unsolved problem [4, 29]. known about its inner workings given that microcode and the update mechanism are proprietary and have not been Since the 1970s, x86 processor manufacturers have throughly analyzed yet.
    [Show full text]
  • RISC-V Geneology
    RISC-V Geneology Tony Chen David A. Patterson Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2016-6 http://www.eecs.berkeley.edu/Pubs/TechRpts/2016/EECS-2016-6.html January 24, 2016 Copyright © 2016, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission. Introduction RISC-V is an open instruction set designed along RISC principles developed originally at UC Berkeley1 and is now set to become an open industry standard under the governance of the RISC-V Foundation (www.riscv.org). Since the instruction set architecture (ISA) is unrestricted, organizations can share implementations as well as open source compilers and operating systems. Designed for use in custom systems on a chip, RISC-V consists of a base set of instructions called RV32I along with optional extensions for multiply and divide (RV32M), atomic operations (RV32A), single-precision floating point (RV32F), and double-precision floating point (RV32D). The base and these four extensions are collectively called RV32G. This report discusses the historical precedents of RV32G. We look at 18 prior instruction set architectures, chosen primarily from earlier UC Berkeley RISC architectures and major proprietary RISC instruction sets. Among the 122 instructions in RV32G: ● 6 instructions do not have precedents among the selected instruction sets, ● 98 instructions of the 116 with precedents appear in at least three different instruction sets.
    [Show full text]
  • Introduction to Cpu
    microprocessors and microcontrollers - sadri 1 INTRODUCTION TO CPU Mohammad Sadegh Sadri Session 2 Microprocessor Course Isfahan University of Technology Sep., Oct., 2010 microprocessors and microcontrollers - sadri 2 Agenda • Review of the first session • A tour of silicon world! • Basic definition of CPU • Von Neumann Architecture • Example: Basic ARM7 Architecture • A brief detailed explanation of ARM7 Architecture • Hardvard Architecture • Example: TMS320C25 DSP microprocessors and microcontrollers - sadri 3 Agenda (2) • History of CPUs • 4004 • TMS1000 • 8080 • Z80 • Am2901 • 8051 • PIC16 microprocessors and microcontrollers - sadri 4 Von Neumann Architecture • Same Memory • Program • Data • Single Bus microprocessors and microcontrollers - sadri 5 Sample : ARM7T CPU microprocessors and microcontrollers - sadri 6 Harvard Architecture • Separate memories for program and data microprocessors and microcontrollers - sadri 7 TMS320C25 DSP microprocessors and microcontrollers - sadri 8 Silicon Market Revenue Rank Rank Country of 2009/2008 Company (million Market share 2009 2008 origin changes $ USD) Intel 11 USA 32 410 -4.0% 14.1% Corporation Samsung 22 South Korea 17 496 +3.5% 7.6% Electronics Toshiba 33Semiconduc Japan 10 319 -6.9% 4.5% tors Texas 44 USA 9 617 -12.6% 4.2% Instruments STMicroelec 55 FranceItaly 8 510 -17.6% 3.7% tronics 68Qualcomm USA 6 409 -1.1% 2.8% 79Hynix South Korea 6 246 +3.7% 2.7% 812AMD USA 5 207 -4.6% 2.3% Renesas 96 Japan 5 153 -26.6% 2.2% Technology 10 7 Sony Japan 4 468 -35.7% 1.9% microprocessors and microcontrollers
    [Show full text]