ECE260: Fundamentals of Computer Engineering

Similar documents
Chapter 4. The Processor

Chapter 4. The Processor

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

Processor (I) - datapath & control. Hwansoo Han

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

Chapter 4. The Processor Designing the datapath

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

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

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

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

Systems Architecture

The MIPS Processor Datapath

Introduction. Datapath Basics

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

Chapter 4. The Processor

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

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

Chapter 4. The Processor

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

COMPUTER ORGANIZATION AND DESIGN

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

ECE260: Fundamentals of Computer Engineering

ECE232: Hardware Organization and Design

Inf2C - Computer Systems Lecture Processor Design Single Cycle

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

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

LECTURE 5. Single-Cycle Datapath and Control

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

Single Cycle Datapath

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering

Single Cycle Datapath

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

CPE 335 Computer Organization. Basic MIPS Architecture Part I

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

COMPUTER ORGANIZATION AND DESIGN

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

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

Chapter 5: The Processor: Datapath and Control

COMPUTER ORGANIZATION AND DESIGN

CPU Organization (Design)

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

The Processor: Datapath & Control

Data paths for MIPS instructions

Review: Abstract Implementation View

ECE369. Chapter 5 ECE369

LECTURE 3: THE PROCESSOR

CS222: Processor Design

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

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

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

CENG 3420 Lecture 06: Datapath

Topic #6. Processor Design

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

CSE140: Components and Design Techniques for Digital Systems

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

CS Computer Architecture Spring Week 10: Chapter

Computer and Information Sciences College / Computer Science Department The Processor: Datapath and Control

Systems Architecture I

The Processor: Datapath & Control

RISC Processor Design

The overall datapath for RT, lw,sw beq instrucution

CPE 335. Basic MIPS Architecture Part II

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

Determined by ISA and compiler. We will examine two MIPS implementations. A simplified version A more realistic pipelined version

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

CC 311- Computer Architecture. The Processor - Control

Laboratory 5 Processor Datapath

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

CSSE232 Computer Architecture I. Datapath

Ch 5: Designing a Single Cycle Datapath

Design of the MIPS Processor

Lecture 5: The Processor

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

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

Computer Organization. Structure of a Computer. Registers. Register Transfer. Register Files. Memories

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

Chapter 4. The Processor

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

Chapter 4. The Processor

EIE/ENE 334 Microprocessors

Computer Architecture Computer Science & Engineering. Chapter 4. The Processor BK TP.HCM

Computer Hardware Engineering

Block diagram view. Datapath = functional units + registers

CS61C : Machine Structures

Major CPU Design Steps

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

Lecture 10: Simple Data Path

Processor: Multi- Cycle Datapath & Control

Chapter 4. The Processor

ECE260: Fundamentals of Computer Engineering

Single Cycle Data Path

Computer Science 61C Spring Friedland and Weaver. The MIPS Datapath

4. The Processor Computer Architecture COMP SCI 2GA3 / SFWR ENG 2GA3. Emil Sekerinski, McMaster University, Fall Term 2015/16

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

UC Berkeley CS61C : Machine Structures

Lecture 08: RISC-V Single-Cycle Implementa9on CSE 564 Computer Architecture Summer 2017

Transcription:

Datapath for a Simplified Processor James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy

Introduction What we ve done so far: Examined CPU performance factors Instruction count, clock rate, and cycle per instruction (CPI) Examined the instruction set for MIPS and how high-level languages are compiled into machine code Examined how computers do arithmetic Now, we ll look inside the processor to see how it s implemented Start by looking at a simplified MIPS processor Includes only a basic subset of instructions (lw, sw, add, sub, and, or, slt, beq, j) Later, we ll look at a more realistic MIPS processor Includes more instructions and a pipeline 2

Logic Design Basics All information is encoded in binary Low voltage = 0, High voltage = 1 One wire per bit Multi-bit data encoded on multi-wire buses (e.g. 32-bit values travel on 32-bit buses) Two different types of logic elements in hardware designs Combinational elements (a.k.a. combinational logic) Operate on data values Output is a function of input (same input always produces same output) State elements (a.k.a. sequential logic) Store information (e.g. registers and data memory) Can be written/updated to update state 3

Combinational Elements AND Gate Y = A & B Adder Y = A + B A A Y + Y B B Multiplexer Y = S? I1 : I0 Arithmetic Logic Unit Y = F(A, B) I0 I1 M u x Y A B ALU Y S F 4

Sequential Elements (State Elements) A register stores data in a circuit (i.e. it maintains the state of a computation) Uses a clock signal to determine when to update the stored value An edge-triggered register updates its contents on a clock edge Positive edge-triggered registers update when the clock changes from 0 to 1 Negative edge-triggered registers update when the clock changes from 1 to 0 A basic storage element, a positive edge-triggered D-type flip-flop; it can store a single bit of data Inputs are D and Clk; Output is Q Shortly after a positive clock edge, the input D is stored in the flip-flop and it becomes visible on the output Q. D Clk Q Clk D Q 5

Sequential Elements with More Control The clock signal is ALWAYS ticking and may not always want to store new data in a register A register with write control allows data to be stored only when directed Only updates register contents on clock edge AND when a write enable input is 1 Typically used when a stored value is still required Shortly after a positive clock edge, the input D is stored in the flip-flop IF the write enable was asserted at the clock edge A positive edge-triggered D-type flip-flop with write enable input Clk D Write Clk Q Write D Q 6

Clocking Methodology Combinational logic transforms data during clock cycles Between clock edges Receives input data from state elements, sends new output to state elements Combinational logic introduces delay (takes some time for data to pass through an AND gate!) Total delay through combinational logic is sum of delay through all elements (and wire) on path Longest combination logic delay determines clock period for entire processor!! data transformation happens in here small delay is desirable it s possible to modify the state of a register and write the new contents in a single clock cycle 7

Executing Instructions on a Processor For all instructions, the first two steps are the same: Use the Program Counter (PC) to access program memory and fetch an instruction Read the source registers (one or two) to be used for the instruction encoded into instruction Depending on instruction class Use the ALU to compute one of the following: An arithmetic result (e.g. add, sub) A memory address for a load/store (e.g. lw, sw) A branch target address (e.g. beq) Access data memory for load/store (only done for load/store instruction) Update the PC PC = PC + 4 OR PC = some branch target address 8

CPU Overview Shows major components and functionality, but abstracts away some of the detail 9

CPU Overview (continued) Can t just join wires together, need to use multiplexers 10

CPU Overview with Multiplexers and Control Multiplexers use a control line to select an output from multiple different inputs Three multiplexers added for this simplified version of MIPS Control uses information from the instruction word to assert/deassert various control lines Steers data though muxes Write enables for registers Read/Write enable for memory Specify ALU operation 11

Building a Datapath Datapath element is a unit used to operate on or store data within a processor Processor datapath is made up of multiple datapath elements Registers, ALUS, multiplexers, memories, etc. We will incrementally build a data path for a simplified MIPS processor Examine how each datapath element is used Examine which datapath elements are used for which instructions 12

Beginning of Datapath Instruction Fetch Recall first step for all instructions: Use the Program Counter (PC) to access program memory and fetch an instruction Need a Program Counter (PC) 32-bit register Points to program memory Need a memory Stores program Need an ALU (or simple adder) to increment the PC Increments PC by 4 to point to next instruction 13

Supporting the R-Type Instruction Format For R-Type instructions, read two source registers, perform an ALU operation, and write the result to destination register Need a collection of registers, called a register file Need an ALU to perform arithmetic ops Example Instruction: add $t0, $t1, $t2 A control signal specifies operation the to perform 32 32 32 32 32 32 14

Supporting the R-Type Instruction Format (continued) Register File in detail: Two 5-bit inputs specify source registers Values stored in the specified source registers are output on Read data 1/2 One 5-bit input specifies destination register Input Write Data is stored in Write register when write enable (RegWrite) is asserted ALU in detail: Has two 32-bit inputs, one for each source operand Has a single 32-bit output for the result of the arithmetic operation A control signal specifies operation the to perform Zero output is asserted anytime a result is 0 32 32 32 32 32 32 15

Supporting Load/Store Instructions Need a memory to write/read data to/from Must read register operands (two registers for a store, only one register for a load) One register contains the base memory address to read/write In case of store instruction, second register contains data to be written to memory In case of load instruction, second register is destination for data read from memory Must calculate effective address using the 16-bit offset embedded in the instruction word First, sign-extend the 16-bit offset (will need a sign-extension unit!) Next, use the ALU to add the offset to the register containing the base address Example Load Instruction: lw $t0, 4($t1) Example Store Instruction: sw $s5, 16($s1)

Supporting Load/Store Instructions Data memory in detail: Address input specifies the address that should be read/written Write data input has data to be written during a store instruction Ignored during a load instruction Sign-extension unit in detail: Single 16-bit input Single 32-bit output Simply duplicates MSB of input (bit 15) into bits 31 downto 16 of output Read data output has data read during load 32 32 Asserted for store 32 Asserted for load 17

Supporting Branch Instructions (only beq for now) Compares two source registers Example Instruction: beq $t1, $t2, offset Simply reroutes wires Instruction word contains 16-bit offset BranchAddr = { 14{immediate[15]}, immediate, 2 b0 } PC = PC + 4 + BranchAddr ALU is used to determine if inputs are equal Subtract sourcereg1 from sourcereg2 If result is 0, regs are equal, take branch Otherwise, PC = PC + 4 If asserted, branch will be taken An Adder computes Branch Target address if case branch is taken 18

Putting it all together: R-Type/Load/Store Datapath 19

Complete Datapath for Simplified MIPS Processor 20

Controlling the ALU ALU needs to perform different operations depending on the instruction For load/store instructions: For branch instructions: For R-type instructions : ALU performs add ALU performs subtract ALU performs operation specified in funct field (AND, OR, add, sub, ) 4-bit ALU Operation input to ALU tells ALU what operation to perform Need an ALU control unit to generate the 4-bit input to the ALU 21

The ALU Control Unit Generates the 4-bit ALU Operation input for the ALU Inputs include: 6-bit funct field directly from instruction word; used for R-type instructions only Ignored for load/store/branch instructions since they don t have a funct field 2-bit ALUOp value that is generated by a main control unit ALUOp is derived from the opcode in the main control unit 22

The Main Control Unit Input is 6-bit opcode from 32-bit instruction Control signals are all derived from the instruction Output includes many control signals Control signals for various muxes ALUOp for for controlling various muxes and the ALU control unit Read/Write signal to data memory Write signal to register file Branch instruction signal Bits 31:26 => opcode Bits 25:21 => source reg for all three ops Bits 20:16 => dest reg for load, source reg for store, branch, and R-type Bits 15:11 => dest reg for R-type Bits 15:0 => sign extend and add for branch and load/store R-Type 0 rs rt rd shamt funct 31:26 25:21 20:16 15:11 10:6 5:0 Load/Store 35 or 43 rs rt 16-bit offset I-Type 31:26 25:21 20:16 15:0 Branch 4 rs rt 16-bit offset I-Type 31:26 25:21 20:16 15:0 23

Complete Datapath With Control 24

Datapath During R-Type Instruction Darker colored paths and hardware units are in use. Lighter colored paths are not in use. Control Lines: asserted not asserted don t care 25

Datapath During Load Instruction Darker colored paths and hardware units are in use. Lighter colored paths are not in use. Control Lines: asserted not asserted don t care 26

Datapath During Branch-on-Equal Instruction Darker colored paths and hardware units are in use. Lighter colored paths are not in use. Control Lines: asserted not asserted don t care 27