unit 16
play

Unit 16 Computer Organization and Instruction Sets 16.2 You Can - PowerPoint PPT Presentation

16.1 Unit 16 Computer Organization and Instruction Sets 16.2 You Can Do That Cloud & Distributed Computing Scripting & (CyberPhysical, Databases, Data Networked Interfaces Mining,etc.) Applications Applications SW (AI,


  1. 16.1 Unit 16 Computer Organization and Instruction Sets

  2. 16.2 You Can Do That… Cloud & Distributed Computing Scripting & (CyberPhysical, Databases, Data Networked Interfaces Mining,etc.) Applications Applications SW (AI, Robotics, Graphics, Mobile) Applications C / C++ / Java Systems & Networking OS Libraries (Embedded Systems, Networks) Assembly / Machine Code Processor / Memory / I/O Architecture (Processor & Embedded HW) Functional Units (Registers, Adders, Muxes) Where we will head now… HW Logic Gates Devices & Integrated Circuits (Semiconductors & Fabrication) Transistors Voltage / Currents

  3. 16.3 Motivation • Now that you have some understanding… – Of how hardware is designed and works – Of how software can be used to control hardware • We will look at how to improve efficiency of computer systems and software so that… – …we can start to understand why HW companies create the structures they do (multicore processors) – …we can begin to intelligently take advantage of the capabilities the HW gives us – …we can start to understand why SW companies deal with some of the issues they do (efficiencies, etc.)

  4. 16.4 Computer Organization • Three primary sets of components – Processor – Memory – I/O (everything else) • Tell us where things live? – Running code – Compiled program (not running) – Circuitry to execute code – Source code file – Data variables – Data for the pixels being displayed on your screen

  5. 16.5 Input / Output • Processor performs reads and writes to communicate with I/O devices just as it does with memory – I/O devices have locations (i.e. registers ) that contain data that the processor can access – These registers are assigned unique addresses just like memory Processor Memory 0 … 3FF A D C Video Interface 800 FE may FE 800 FE signify a WRITE … white dot at 01 a particular location ‘a’ = 61 hex Keyboard in ASCII Interface This could just as easily be the command and data register from 400 61 the LCD shield… Or the PORT/DDR registers.

  6. 16.6 Processor • 3 Primary Components inside a processor – ALU – Registers – Control Circuitry • Connects to memory and I/O via address , data , and control buses ( bus = group of wires) Bus Processor Memory Addr 0 1 2 Data 3 4 5 Control 6

  7. 16.7 Arithmetic and Logic Unit (ALU) • Executes arithmetic operations like addition and subtraction along with logical operations (AND, OR, etc.) Processor Memory Addr 0 op. 1 ALU 2 ADD, out in1 SUB, Data 3 AND, 4 in2 OR 5 Control 6

  8. 16.8 Registers • Some are for general use by software – Registers provide fast, temporary storage locations within the processor (to avoid having to read/write slow memory) • Others are required for specific purposes to ensure proper operation of the hardware Processor Memory PC Addr 0 op. 1 ALU 2 ADD, out in1 SUB, Data 3 AND, 4 in2 OR 5 R0-R15 Control 6

  9. 16.9 General Purpose Registers • Registers available to software instructions for use by the programmer/compiler • Instructions use these registers as inputs (source locations) and outputs (destination locations) Processor Memory PC Addr 0 op. 1 ALU 2 ADD, out in1 SUB, Data 3 AND, 4 in2 OR 5 R0-R15 Control 6

  10. 16.10 What if we didn’t have registers? • Example w/o registers: F = (X+Y) – (X*Y) – Requires an ADD instruction, MULtiply instruction, and SUBtract Instruction – w/o registers • ADD: Load X and Y from memory, store result to memory • MUL: Load X and Y again from mem., store result to memory • SUB: Load results from ADD and MUL and store result to memory • 9 memory accesses Processor Memory PC Addr 0 X op. 1 Y ALU 2 ADD, out in1 SUB, Data 3 F AND, 4 in2 OR 5 R0-R15 Control 6

  11. 16.11 What if we have registers? • Example w/ registers: F = (X+Y) – (X*Y) – Load X and Y into registers – ADD: R0 + R1 and store result in R2 – MUL: R0 * R1 and store result in R3 – SUB: R2 – R3 and store result in R4 – Store R4 back to memory – 3 total memory access Processor Memory PC Addr 0 X op. 1 Y ALU 2 X ADD, out in1 SUB, Y Data 3 F AND, 4 in2 OR 5 R0-R15 Control 6

  12. 16.12 Other Registers • Some bookkeeping information is needed to make the processor operate correctly • Example: Program Counter (PC) – Recall that the processor must fetch instructions from memory before decoding and executing them – PC register holds the address of the currently executing instruction Processor Memory PC Addr 0 op. 1 ALU 2 ADD, out in1 SUB, Data 3 AND, 4 in2 OR 5 R0-R15 Control 6

  13. 16.13 Fetching an Instruction • To fetch an instruction – PC contains the address of the instruction – The value in the PC is placed on the address bus and the memory is told to read – The PC is incremented, and the process is repeated for the next instruction Processor Memory PC = Addr = 0 0 PC Addr 0 inst. 1 op. 1 inst. 2 ALU Data = inst.1 machine code 2 inst. 3 ADD, out in1 SUB, Data 3 inst. 4 AND, 4 inst. 5 in2 OR Control = Read … R0-R15 Control FF

  14. 16.14 Fetching an Instruction • To fetch an instruction – PC contains the address of the instruction – The value in the PC is placed on the address bus and the memory is told to read – The PC is incremented, and the process is repeated for the next instruction Processor Memory PC = Addr = 1 1 PC Addr 0 inst. 1 op. 1 inst. 2 ALU Data = inst.2 machine code 2 inst. 3 ADD, out in1 SUB, Data 3 inst. 4 AND, 4 inst. 5 in2 OR Control = Read … R0-R15 Control FF

  15. 16.15 Control Circuitry • Control circuitry is used to decode the instruction and then generate the necessary signals to complete its execution • Controls the ALU • Selects registers to be used as source and destination locations (using muxes) Processor Memory 0 PC Addr Control 0 inst. 1 op. 1 inst. 2 ALU 2 inst. 3 ADD, out in1 SUB, Data 3 inst. 4 AND, 4 inst. 5 in2 OR … R0-R15 Control FF

  16. 16.16 Control Circuitry • Assume 0x0201 is machine code for an ADD instruction of R2 = R0 + R1 • Control Logic will… – select the registers (R0 and R1) – tell the ALU to add – select the destination register (R2) Processor Memory 0 0 PC Addr Control 0 0201 ADD 1 inst. 2 0201 2 inst. 3 out ALU in1 Data 3 inst. 4 ADD 4 inst. 5 in2 … R0-R15 Control FF

  17. 16.17 INSTRUCTION SETS

  18. 16.18 INSTRUCTION SET OVERVIEW

  19. 16.19 Instruction Sets • Defines the software interface of the processor and memory system • Instruction set is the vocabulary the HW processor can understand and the SW is composed with – Usually the compiler is the one that translates the software • Most assembly/machine instructions fall into one of three categories – Arithmetic/Logic – Data Transfer (to and from memory) – Control (branch, subroutine call, etc.)

  20. 16.20 Instruction Set Architecture (ISA) • 2 approaches – CISC = Complex instruction set computer • Large, rich vocabulary • More work per instruction, slower clock cycle – RISC = Reduced instruction set computer • Small, basic, but sufficient vocabulary • Less work per instruction, faster clock cycle • Usually a simple and small set of instructions with regular format facilitates building faster processors

  21. 16.21 Historical Instruction Format Options • Instruction sets limit the number of operands used in an instruction due to… – To limit the complexity of the hardware – So that when an instruction is coded to binary it can fit in a certain # of bits • Different instruction sets specify these differently – 3 operand instruction set (ARM, PPC) -> (32-bit processors) • Usually all 3 operands in registers • Format: ADD DST, SRC1, SRC2 (DST = SRC1 + SRC2) – 2 operand instructions (Intel / Motorola 68K) • Second operand doubles as source and destination • Format: ADD SRC1, S2/D (S2/D = SRC1 + S2/D) – 1 operand instructions (Low-End Embedded, Java Virtual Machine) • Implicit operand to every instruction usually known as the Accumulator (or ACC) register • Format: ADD SRC1 (ACC = ACC + SRC1) – 0 operand instructions / stack architecture • Push operands on a stack: PUSH X, PUSH Y • ALU operation: ADD (Implicitly adds top two items on stack: X + Y & replaces them with the sum)

  22. 16.22 General Instruction Format Issues • Consider the high-level code – F = X + Y – Z – G = A + B • Simple embedded computers often use single operand format – Smaller data size (8-bit or 16-bit machines) means limited instruction size • Modern, high performance processors (Intel, ARM) use 2- and 3-operand formats Three-Operand Two-Operand Single-Operand Stack Arch. ADD F,X,Y MOVE F,X LOAD X PUSH Z SUB F,F,Z ADD F,Y ADD Y PUSH Y ADD G,A,B SUB F,Z SUB Z SUB MOVE G,A STORE F PUSH X ADD G,B LOAD A ADD ADD B POP F STORE G (+) More natural (+) Smaller size to program style encode each instruction (+) Smaller instruction count

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend