Computer Organization and Components

Similar documents
Computer Hardware Engineering

Computer Hardware Engineering

Computer Hardware Engineering

Computer Hardware Engineering

ENGN1640: Design of Computing Systems Topic 04: Single-Cycle Processor Design

Fundamentals of Computer Systems

Systems Architecture

Processor (I) - datapath & control. Hwansoo Han

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

CENG 3420 Lecture 06: Datapath

The MIPS Processor Datapath

CPE 335 Computer Organization. Basic MIPS Architecture Part I

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

LECTURE 5. Single-Cycle Datapath and Control

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

ENGN1640: Design of Computing Systems Topic 04: Single-Cycle Processor Design

Chapter 4. The Processor

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Chapter 4. The Processor

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan)

CS3350B Computer Architecture Quiz 3 March 15, 2018

Computer Organization and Components

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

Computer Hardware Engineering

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

ECE260: Fundamentals of Computer Engineering

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Systems Architecture I

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

Lecture 10: Simple Data Path

RISC Processor Design

Introduction. Datapath Basics

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

Chapter 4. The Processor Designing the datapath

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1

Chapter 4 The Processor 1. Chapter 4A. The Processor

Chapter 5: The Processor: Datapath and Control

Single Cycle Datapath

RISC Design: Multi-Cycle Implementation

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Single Cycle Datapath

How to design a controller to produce signals to control the datapath

Of course, the hardware doesn t really execute MIPS assembly language code.

ECE369. Chapter 5 ECE369

Chapter 4. The Processor

CS Computer Architecture Spring Week 10: Chapter

RISC Architecture: Multi-Cycle Implementation

Review: Abstract Implementation View

The Processor: Datapath & Control

CPU Organization (Design)

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

RISC Architecture: Multi-Cycle Implementation

Data paths for MIPS instructions

Design of the MIPS Processor

ECE232: Hardware Organization and Design

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

Design of the MIPS Processor (contd)

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control

Lecture 8: Control COS / ELE 375. Computer Architecture and Organization. Princeton University Fall Prof. David August

Computer Organization and Components

Single Cycle CPU Design. Mehran Rezaei

COMP303 Computer Architecture Lecture 9. Single Cycle Control

CPE 335. Basic MIPS Architecture Part II

COMPUTER ORGANIZATION AND DESIGN

The Processor: Datapath & Control

MIPS-Lite Single-Cycle Control

ENE 334 Microprocessors

Course Administration

Computer Science 141 Computing Hardware

ECE260: Fundamentals of Computer Engineering

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

Lecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl.

Chapter 4. The Processor

TDT4255 Computer Design. Lecture 4. Magnus Jahre. TDT4255 Computer Design

ECS 154B Computer Architecture II Spring 2009

CC 311- Computer Architecture. The Processor - Control

Lecture 7 Pipelining. Peng Liu.

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

CSEN 601: Computer System Architecture Summer 2014

Introduction. Chapter 4. Instruction Execution. CPU Overview. University of the District of Columbia 30 September, Chapter 4 The Processor 1

Inf2C - Computer Systems Lecture Processor Design Single Cycle

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control

Lecture 16: Pipeline Controls. Spring 2018 Jason Tang

Pipelined Processor Design

CS152 Computer Architecture and Engineering Lecture 10: Designing a Single Cycle Control. Recap: The MIPS Instruction Formats

Single Cycle Data Path

COMP2611: Computer Organization. The Pipelined Processor

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Transcription:

2 Computer Organization and Components Coue Structure Module : C and ssembly Programming IS, fall 2 Lecture 9: LU and s LE LE2 LE LE Module : Processor Design EX LB S LB2 LE9 LE ssistant Research Engineer, Univeity of California, Berkeley LE6 EX2 LE LB LE8 EX EX LE2 LB LE Proj. Expo Slides veion. EX S LE I bstractions in Computer Systems Computer System LB6 Module 6: Parallel Processo and Programs Module : Logic Design LE7 LB Module : Hierarchy Module 2: I/O Systems ssociate Professor, KTH Royal itute of Technology S2 LE genda etworked Systems and Systems of Systems pplication Software Software Operating System Set rchitecture Hardware/Software Interface Microarchitecture Logic and Building Blocks Digital Hardware Design Digital Circuits I nalog Circuits Devices and Physics nalog Design and Physics I I

6 (LU) cknowledgement: The structure and several of the good examples are derived from the book Digital Design and Computer rchitecture (2) by D. M. Harris and S. L. Harris. n LU saves hardware by combining different arithmetic and logic erations in one single unit/element. LU Y B F F LU LU symbol: both figures have the same function B Y Input F specifies the function that the LU should perform LUs can have different functions and be designed differently. n LU can also include output flags, for instance: Overflow flag (adder overflowed) Zero flag (output is zero) I I (LU) H E 7 8 F 2 B Exercise: Determine the functional behavior for each value of F. Most significant bit (number 2) [-] Bits to Zero Extend 2 F : Extracts the most significant bit. dds zeros for bits - to. Y F 2: Function D B OR B B not used D!B OR!B B SLT Zero extend examples (=): Input: xffff2. Output: x Input: xff676a. Output: x I cknowledgement: The structure and several of the good examples are derived from the book Digital Design and Computer rchitecture (2) by D. M. Harris and S. L. Harris. I

9 s Path and Control Unit In this lecture, we construct a microarchitecture for a subset of a MIPS processor with the following instructions processor is typically divided into two pas R-Type: add, sub, and, or, slt Path Operates on a word of data. Consists of elements such as registe, memory, LUs etc. / logic instructions instructions I-Type: ediate instruction J-Type: I The architectural states for this MIPS processor are the program counter () and the registe ($, $t, $s, $s, etc.) -bit address results in 2 = registe at the next clock cycle at the current clock cycle next Program Counter () -bit register j Reads -bit word of data -bit address 2 2 registe of size -bit simplified instruction memory, modeled as a read-only memory (ROM) Two read pos ( and 2) and one write po (). I -bit address 2 Writes on the rising clock edge and when write enable () is true I State Elements (2/) s and Memories Reads -bit data State Elements (/) Program Counter and Register File Branch instructions addi, lw, sw, beq Control Unit Gets the current instruction from the data path and tells the data path how to execute the instruction. ote! The register file, instruction memory, and the data memory read combinationally: when the address changes, the data on the read po changes after some pragation time. Reads or writes -bit word of data on-architectural states are used to simplify logic or improve performance (introduced in the next lecture). I

State Elements (/) Reading combinationally, writing at clock edge Read from the Current ll the blocks below read combinationally: when the address changes, the data on the read po change after some pragation time. There is no clock involved. 2 The register file and the data memory write at the raising clock edge. 2 next Fit step. Read the instruction at the current address. -bit instruction is fetched. I I 6 lw instruction Read Base ddress lw instruction Read Offset 26 2 6 bits bits 2 2 bits 6 6 bits Read out the base address from the register file. 2:2 cuts out the bits from the instruction. next 2:2 2 2 Example lw $s,($s) Base address in has now the address stored in $s (in the above example). I 26 2 6 bits bits next 2 2 The offset is found in the least significant 6 bits of the instruction. bits 6 : 2:2 2 6 bits 2 Example lw $s,($s) The offset is stored in the field. The offset is signed. Sign extend to bits. That is: : = : :6 = I

7 8 lw instruction Read Word lw instruction Write Back next The base address and the offset are added together : 2:2 2 2 Control code for 2 LU Example lw $s,($s) Reads out the data word from data memory. 26 2 next 2 2 Reads out bits of the register to enable write back of result. : 6 2:2 2 2:6 2 Write enable 2 LU Example lw $s,($s) Write back the result I I 9 2 next lw instruction Increment : 2:2 2 2:6 2 Increment the by. (ext instruction is at address ) 2 LU This is the complete data path for the load word (lw) instruction. next lw instruction Timing : 2:2 2 2:6 Combinational logic during clock cycle: read instruction, sign extend, read from register file, perform LU eration, and read from the data memory. 2 2 LU t the raising clock edge: Write to the register file and update the. I I

2 22 sw instruction Increment We need to read the base address, read the offset, and compute an address. Good news: We have already done that!. next The word to be stored is saved in a register (-field in the I-type) : 2:2 2:6 2 2:6 2 Write enable must be false 2 LU Example sw $s,($s) The data word is stored into the memory R-type instructions Machine Encoding We are now going to handle all R-type instructions the same uniform way. That is, we should handle add, sub, and, or, and slt. I-Type R-Type 26 2 6 bits bits 26 2 6 bits bits 2 2 2 2 bits bits 6 6 rd bits 6 bits The and fields are in the same place for both I-Type and R-Type shamt bits funct 6 bits 6 I I 2 2 R-type instructions LU Usage R-type instructions Write to Register We want to send the second erand to the LU, but still be compatible with the lw-instruction. Different LU control signals for different instructions. R-Type instructions write to registe and not to memory. Bypass the data memory if an R-Type instruction next : 2:2 2:6 2 : 2 LUSrc = LUControl MemWrite = LU next : 2:2 2:6 2 : 2 LUSrc = LUControl LU MemWrite = MemToReg = I I

I-Type R-Type R-type instructions Machine Encoding 26 2 6 bits bits 26 2 6 bits bits 2 2 2 2 bits bits 6 6 6 bits For the lw instruction, the target register is stored in the field (bits 2:6) For R-type instructions, the target register is stored in the rd field (bits :) rd bits shamt bits funct 6 bits 6 2 next R-type instructions Use the rd field Write to register using rd field instead of. 2:2 2:6 2 : RegWrite = 2 RegDst = LUSrc = 2:6 : LUControl LU MemWrite = 26 Create a control variable for register write. MemToReg = I I 27 28 beq instruction Machine Encoding beq instruction Compare if equal Recall that the beq instruction is a branch instruction, encoded in the I-Type. I-Type 26 2 6 bits bits 2 2 bits 6 The and fields specify the registe that should be compared. Recall how to compute the BT: BT = * 6 bits The field is used when computing the branch target address (BT) Example beq $s,$s,lo next Branch taken if equal, else increment by 2:2 2:6 2 : RegWrite = Branch = RegDst = LUSrc = LUControl 2 2:6 : Zero LU MemWrite = MemToReg = Compute BT I I

29 Pseudo-Direct ddressing (Revisited) The J and JL instructions are encoded using the J-type. But, the address is not bits, only 26 bits. 26 2 6 bits addr 26 bits -bit Pseudo-Direct ddress is computed as follows: Bits to (least significant) are always zero because word alignment of code. Bits 27 to 2 is taken directly from the addr field of the machine code instruction. Bits to 28 are obtained from the four most significant bits from. j instruction RegWrite Branch RegDst Jump LUSrc MemWrite LUControl MemToReg 2:2 Zero 2:6 2 2 :28 27: 2: : 2:6 : LU I I Path for s H add,sub,and,or,slt,addi,lw,sw,beq,j RegWrite Branch RegDst Jump LUSrc MemWrite LUControl MemToReg 2:2 Zero 2:6 2 2 :28 27: 2: : 2:6 : LU I cknowledgement: The structure and several of the good examples are derived from the book Digital Design and Computer rchitecture (2) by D. M. Harris and S. L. Harris. I I

What to Control We should set the control RegWrite Branch RegDst Jump signals depending on the LUSrc MemWrite instruction. LUControl MemToReg 2:2 Zero 2:6 2 2 :28 27: 2: : 2:6 : LU I R-Type I-Type J-Type Control Unit Input: Machine Code 6 bits bits bits rd bits shamt bits 6 bits bits bits 6 bits For I-Type and J-Type, the control signals depend on the field 6 bits addr 26 bits funct 6 bits For the R-Type, the field is. The control signals depend on the funct field I Control Unit Structure H LU Decoder 6 The 6 bits field from all instruction types Internal signal LUOp LUOp = means add LUOp = means subtract LUOp = look at the funct field LUOp = n/a 6 LUOp Main Decoder 2 RegWrite RegDst LUSrc Branch MemWrite MemToReg Jump Control signals to the data path Enough to check one bit (faster decoding) funct LUOp funct LUControl (add) (subtract) (add) (add) 6 LUOp 2 LU Decoder LUControl The 6 bits funct field from the R-type. Ignored if other types. funct 6 LU Decoder LUControl (sub) (subtract) (and) (and) (or) (or) (slt) (set less than) I I

Main Decoder H E 7 Performance nalysis (/2) General View 8 How should we analyze the performance of a computer By clock frequency By instructions per program RegWrite RegDst LUSrc Branch MemWrite MemToReg Jump LUOp R-Type lw Execution time (in seconds) = # instructions clock cycles instruction seconds clock cycle sw beq addi umber of instructions in a program (# = number of) Determined by programmer or the compiler or both. verage cycles per instruction (CPI) Determined by the microarchitecture implementation. Seconds per cycle = clock period T C. Determined by the critical path in the logic. j Problem: Your program may have many inputs. ot only one specific program might be interesting. Solution: Use a benchmark (a set of programs). Example: SPEC CPU Benchmark I I Performance nalysis (2/2) 9 Critical Path Example: Load Word (lw) Execution time (in seconds) = # instructions umber of instructions in a program (# = number of) Determined by programmer or the compiler or both. clock cycles instruction verage cycles per instruction (CPI) Determined by the microarchitecture implementation. Each instruction takes one clock cycle. That is, CPI =. The lw instruction has longer path than R-Type instructions. However, because of synchronous logic, the clock period is determined by the slowest instruction. seconds clock cycle Seconds per cycle = clock period T C. Determined by the critical path in the logic. The main problem with this design is the long critical path. RegWrite Branch RegDst Jump LUSrc MemWrite LUControl MemToReg 2:2 Zero 2:6 2 2 :28 27: 2: : 2:6 : LU I I

2 Reading Guidelines You can soon stretch your legs Module : Processor Design but wait just a second more Lecture 9: LU and Single-Cycled Processo H&H Chapte.2., 7.-7.. Lecture : Pipelined processo H&H Chapte 7., 7.8.-7.8.2, 7.9 Reading Guidelines See the coue webpage for more information. I Summary Some key take away points: The LU performs most of the arithmetic and logic computations in the processor. The data path consists of sequential logic that performs processing of words in the processor. The control unit decodes instructions and tells the data path what to do. The single-cycle processor has a long critical path. We will solve this in the next lecture by introducing a pipelined processor. Thanks for listening! I I