EEE2243 Digital System Design Chapter 10: Advanced Topic: Programmable Processor by Muhazam Mustapha extracted from Frank Vahid’s slides, May 2012.

Slides:



Advertisements
Similar presentations
Machine cycle.
Advertisements

Arithmetic Logic Unit (ALU)
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
INTRODUCTION TO THE ARM PROCESSOR – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
CSE115: Introduction to Computer Science I
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
Computer Systems. Computer System Components Computer Networks.
Digital Design – Programmable Processors Chapter 8 - Programmable Processors.
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic Combinational logic elements and design (DeMorgan’s Law)
Topics covered: CPU Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
State Machines Used to Design Sequential Circuits.
S. Barua – CPSC 440 CHAPTER 5 THE PROCESSOR: DATAPATH AND CONTROL Goals – Understand how the various.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4: IT Students.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 4:
Digital Design Copyright © 2006 Frank Vahid 1 Digital Design Chapter 8: Programmable Processors Slides to accompany the textbook Digital Design, First.
Digital Design 2e Copyright © 2010 Frank Vahid 1 1 Digital Design Chapter 8: Programmable Processors Slides to accompany the textbook Digital Design, with.
Chapter 5 Basic Processing Unit
Chapter 1 Basic Structure of Computers. Chapter Outline computer types, structure, and operation instructions and programs numbers, arithmetic operations,
Introduction to Computer Architecture and System
BASIC COMPUTING CONCEPTS Part 3 Dr. Abdel-Rahman Al-Qawasmi INSIDE THE MACHINE by Jon Stokes.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use ECE/CS 352: Digital Systems.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Chapter 4 MARIE: An Introduction to a Simple Computer.
CPU Design. Introduction – The CPU must perform three main tasks: Communication with memory – Fetching Instructions – Fetching and storing data Interpretation.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 5:
Chapter 4 The Processor. Chapter 4 — The Processor — 2 Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined.
CSE 340 Computer Architecture Summer 2014 Basic MIPS Pipelining Review.
EEC4133 Computer Organization & Architecture Chapter 5: Datapath & Control by Muhazam Mustapha, April 2014.
Fetch-execute cycle.
CDA 3101 Fall 2013 Introduction to Computer Organization
Computer Architecture Lecture 03 Fasih ur Rehman.
Datapath and Control Unit Design
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
D ATA P ATH OF A PROCESSOR (MIPS) Module 1.1 : Elements of computer system UNIT 1.
Microarchitecture. Outline Architecture vs. Microarchitecture Components MIPS Datapath 1.
Our programmer needs to do this !
Computer Architecture Lecture 9 MIPS ALU and Data Paths Ralph Grishman Oct NYU.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
CBP 2002ITY 270 Computer Architecture1 Module Structure Whirlwind Review – Fetch-Execute Simulation Instruction Set Architectures RISC vs x86 How to build.
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
CS161 – Design and Architecture of Computer Systems
Control Unit Lecture 6.
CPU Organisation & Operation
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Decode and Operand Read
CS/COE0447 Computer Organization & Assembly Language
The fetch-execute cycle
Chapter 8: Programmable Processors
Computer Organization “Central” Processing Unit (CPU)
Topic 6 LC-3.
MIPS Processor.
Figure 8.1 Architecture of a Simple Computer System.
Morgan Kaufmann Publishers The Processor
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Fundamental Concepts Processor fetches one instruction at a time and perform the operation specified. Instructions are fetched from successive memory locations.
Systems Architecture I
COMS 361 Computer Organization
MARIE: An Introduction to a Simple Computer
The Von Neumann Architecture Odds and Ends
Morgan Kaufmann Publishers The Processor
Processor: Datapath and Control
Little Man Computer.
Presentation transcript:

EEE2243 Digital System Design Chapter 10: Advanced Topic: Programmable Processor by Muhazam Mustapha extracted from Frank Vahid’s slides, May 2012

Learning Outcome By the end of this chapter, students are expected to have some surface idea about the construction of programmable processor

Chapter Content Processor Control Unit Instruction

Processor

Introduction Programmable (general-purpose) processor –Mass-produced, then programmed to implement different processing tasks Well-known common programmable processors: Pentium, Sparc, PowerPC Lesser-known but still common: ARM, MIPS, 8051, PIC –Low-cost embedded processors found in cell phones, blinking shoes, etc. –Instructive to design a very simple programmable processor Real processors can be much more complex Seatbelt warning light single-purpose processor 2x4 e c0c1c2 xt1 reg xt0xt2 ++  x(t)x(t-1)x(t-2) Instruction memoryI Controller PCIR 0 Register file RF Data memory D ALU n-bit 2x1 Seatbelt warning light program 3-tap FIR filter program Other programs 3-tap FIR filter single-purpose processor General-purpose processor Control unit Datapat h

Basic Architecture Processing generally consists of: –Loading some data –Transforming that data –Storing that data Basic datapath: Useful circuit in a programmable processor –Can read/write data memory, where main data exists –Has register file to hold data locally –Has ALU to transform local data Register file RF Data memory D ALU n-bit 2x1 somehow connected to the outside world Datapath

Basic Datapath Operations Load operation: Load data from data memory to RF ALU operation: Transforms data by passing one or two RF register values through ALU, performing operation (ADD, SUB, AND, OR, etc.), and writing back into RF. Store operation: Stores RF register value back into data memory Each operation can be done in one clock cycle Register file RF Data memory D ALU n-bit 2x1 Register file RF Data memory D ALU n-bit 2x1 Register file RF Data memory D ALU n-bit 2x1 Load operation ALU operation Store operation

Basic Datapath Operations Q: Which are valid single-cycle operations for given datapath? –Move D[1] to RF[1] (i.e., RF[1] = D[1]) A: YES – That's a load operation –Store RF[1] to D[9] and store RF[2] to D[10] A: NO – Requires two separate store operations –Add D[0] plus D[1], store result in D[9] A: NO – ALU operation (ADD) only works with RF. Requires two load operations (e.g., RF[0]=D[0]; RF[1]=D[1], an ALU operation (e.g., RF[2]=RF[0]+RF[1]), and a store operation (e.g., D[9]=RF[2]) Register file RF Data memory D ALU n-bit 2x1 Register file RF Data memory D ALU n-bit 2x1 Register file RF Data memory D ALU n-bit 2x1 Load operation ALU operationStore operation

Control Unit

Basic Architecture D[9] = D[0] + D[1] – requires a sequence of four datapath operations: 0: RF[0] = D[0] 1: RF[1] = D[1] 2: RF[2] = RF[0] + RF[1] 3: D[9] = RF[2] Each operation is an instruction –Sequence of instructions – program –Looks cumbersome, but that's the world of programmable processors – Decomposing desired computations into processor-supported operations –Store program in Instruction memory –Control unit reads each instruction and executes it on the datapath PC: Program counter – address of current instruction IR: Instruction register – current instruction Register file RF Data memory D ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PCIR 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2]

Basic Architecture To carry out each instruction, the control unit must: –Fetch – Read instruction from inst. mem. –Decode – Determine the operation and operands of the instruction –Execute – Carry out the instruction's operation using the datapath RF[0]=D[0] 0  1 R[0]: ??  99 "load" Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] ( a ) Fetch RF[0]=D[0] Instruction memory I Control unit PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] 1 ( b ) Controller Decode Register file RF Data memory D D[0]: 99 ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] RF[0]=D[0] 1 ( c ) Execute

Basic Architecture To carry out each instruction, the control unit must: –Fetch – Read instruction from inst. mem. –Decode – Determine the operation and operands of the instruction –Execute – Carry out the instruction's operation using the datapath RF[1]=D[1} 1  2 R[1]: ??  102 "load" Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] ( a ) Fetch RF[1]=D[1] Instruction memory I Control unit PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] 2 ( b ) Controller Decode Register file RF Data memory D D[1]: 102 ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] RF[1]=D[1] 2 ( c ) Execute

Basic Architecture To carry out each instruction, the control unit must: –Fetch – Read instruction from inst. mem. –Decode – Determine the operation and operands of the instruction –Execute – Carry out the instruction's operation using the datapath RF[2]=RF[0]+RF[1] 2  3 R[2]: ??  201 "ALU (add)" Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] ( a ) Fetch RF[2]=RF[0]+RF[1] Instruction memory I Control unit PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] 3 ( b ) Controller Decode Register file RF Data memory D ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] RF[2]=RF[0]+RF[1] 3 ( c ) Execute

Basic Architecture To carry out each instruction, the control unit must: –Fetch – Read instruction from inst. mem. –Decode – Determine the operation and operands of the instruction –Execute – Carry out the instruction's operation using the datapath D[9]=RF[2] 3  4 R[2]: 201 "store" Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] ( a ) Fetch D[9]=RF[2] Instruction memory I Control unit PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] 4 ( b ) Controller Decode Register file RF Data memory D ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PC I R 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] D[9]=RF[2] 4 ( c ) Execute D[9]=??  201

Basic Architecture Register file RF Data memory D ALU n-bit 2 x 1 Datapath Instruction memory I Control unit Controller PCIR 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2]

Instruction

Sequence of Instructions Q: Create sequence of instructions to compute D[3] = D[0]+D[1]+D[2] on earlier-introduced processor A1: One possible sequence First load data memory locations into register file R[3] = D[0] R[4] = D[1] R[2] = D[2] (Note arbitrary register locations) Next, perform the additions R[1] = R[3] + R[4] R[1] = R[1] + R[2] Finally, store result D[3] = R[1] A2: Alternative sequence First load D[0] and D[1] and add them R[1] = D[0] R[2] = D[1] R[1] = R[1] + R[2] Next, load D[2] and add R[2] = D[2] R[1] = R[1] + R[2] Finally, store result D[3] = R[1]

Number of Cycles Q: How many cycles are needed to execute six instructions using the earlier-described processor? A: Each instruction requires 3 cycles – 1 to fetch, 1 to decode, and 1 to execute Thus, 6 instr * 3 cycles/instr = 18 cycles

Three-Instruction Processor Instruction Set – List of allowable instructions and their representation in memory, e.g., –Load instruction—0000 r 3 r 2 r 1 r 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 –Store instruction—0001 r 3 r 2 r 1 r 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 –Add instruction—0010 ra 3 ra 2 ra 1 ra 0 rb 3 rb 2 rb 1 rb 0 rc 3 rc 2 rc 1 rc 0 Instruction memory I 0: : : : : RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2} Desired program opcodeoperands Instructions in 0s and 1s – machine code

Three-Instruction Program Register file RF Data memory D ALU n-bit 2  1 Datapath Instruction memory I Control unit Controller PC I R 0: : : : : RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2} Desired program Computes D[9]=D[0]+D[1]

Three-Instruction Program Another example program in machine code –Compute D[5] = D[5] + D[6] + D[7] –Load instruction—0000 r 3 r 2 r 1 r 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 –Store instruction—0001 r 3 r 2 r 1 r 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 –Add instruction—0010 ra 3 ra 2 ra 1 ra 0 rb 3 rb 2 rb 1 rb 0 rc 3 rc 2 rc 1 rc 0

Assembly Code Machine code (0s and 1s) hard to work with Assembly code – Uses mnemonics –Load instruction—MOV Ra, d specifies the operation RF[a]=D[d]. a must be 0,1,..., or 15—so R0 means RF[0], R1 means RF[1], etc. d must be 0, 1,..., 255 – Store instruction—MOV d, Ra specifies the operation D[d]=RF[a] – Add instruction—ADD Ra, Rb, Rc specifies the operation RF[a]=RF[b]+RF[c] machine codeassembly code 0: MOV R0, 0 1: MOV R1, 1 2: ADD R2, R0, R1 3: MOV 9, R2 0: RF[0]=D[0] 1: RF[1]=D[1] 2: RF[2]=RF[0]+RF[1] 3: D[9]=RF[2] Desired program 0: : : :

Six-Instruction Processor Let's add three more instructions: –Load-constant instruction—0011 r 3 r 2 r 1 r 0 c 7 c 6 c 5 c 4 c 3 c 2 c 1 c 0 MOV Ra, #c—specifies the operation RF[a]=c –Subtract instruction—0100 ra 3 ra 2 ra 1 ra 0 rb 3 rb 2 rb 1 rb 0 rc 3 rc 2 rc 1 rc 0 SUB Ra, Rb, Rc—specifies the operation RF[a]=RF[b] – RF[c] –Jump-if-zero instruction—0101 ra 3 ra 2 ra 1 ra 0 o 7 o 6 o 5 o 4 o 3 o 2 o 1 o 0 JMPZ Ra, offset—specifies the operation PC = PC + offset if RF[a] is 0

Six-Instruction Program Example program – Count number of non-zero words in D[4] and D[5] –Result will be either 0, 1, or 2 –Put result in D[9]