CS3350B Computer Architecture Winter 2015

Similar documents
CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 27: Single- Cycle CPU Datapath Design

UC Berkeley CS61C : Machine Structures

Clever Signed Adder/Subtractor. Five Components of a Computer. The CPU. Stages of the Datapath (1/5) Stages of the Datapath : Overview

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

Truth Table! Review! Use this table and techniques we learned to transform from 1 to another! ! Gate Diagram! Today!

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

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I ! Nasty new windows vulnerability!

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

CS61C : Machine Structures

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

Chapter 4. The Processor

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

CS3350B Computer Architecture Winter Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2)

Computer Architecture. Lecture 6.1: Fundamentals of

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

Chapter 4. The Processor

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

Review: Abstract Implementation View

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

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.

ECE232: Hardware Organization and Design

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath Control Part 1

CS3350B Computer Architecture Quiz 3 March 15, 2018

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

Computer Architecture

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

The MIPS Processor Datapath


Chapter 4. The Processor Designing the datapath

Processor (I) - datapath & control. Hwansoo Han

Systems Architecture

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

CPU Organization (Design)

CS3350B Computer Architecture

LECTURE 5. Single-Cycle Datapath and Control

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

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

are Softw Instruction Set Architecture Microarchitecture are rdw

UC Berkeley CS61C : Machine Structures

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

CENG 3420 Lecture 06: Datapath

ECE 486/586. Computer Architecture. Lecture # 7

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

CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

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

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

ECE260: Fundamentals of Computer Engineering

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

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

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

Adding Support for jal to Single Cycle Datapath (For More Practice Exercise 5.20)

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

EN2910A: Advanced Computer Architecture Topic 02: Review of classical concepts

Introduction. Datapath Basics

EC 413 Computer Organization - Fall 2017 Problem Set 3 Problem Set 3 Solution

Lecture 10: Simple Data Path

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

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

The Processor: Datapath & Control

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

Chapter 4. The Processor

LECTURE 3: THE PROCESSOR

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

CS3350B Computer Architecture MIPS Instruction Representation

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

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

CS 351 Exam 2 Mon. 11/2/2015

The Evolution of Microprocessors. Per Stenström

CS61C : Machine Structures

CS Computer Architecture Spring Week 10: Chapter

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Topic Notes: MIPS Instruction Set Architecture

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

CS222: Processor Design

ECE331: Hardware Organization and Design

Ch 5: Designing a Single Cycle Datapath

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

CS61C : Machine Structures

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

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

3/12/2014. Single Cycle (Review) CSE 2021: Computer Organization. Single Cycle with Jump. Multi-Cycle Implementation. Why Multi-Cycle?

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

CPE 335 Computer Organization. Basic MIPS Architecture Part I

CS 251, Winter 2018, Assignment % of course mark

CSE 378 Midterm 2/12/10 Sample Solution

Chapter 4. The Processor

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

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

Lecture #17: CPU Design II Control

Major CPU Design Steps

ECE331: Hardware Organization and Design

ECE260: Fundamentals of Computer Engineering

Processor: Multi- Cycle Datapath & Control

Data paths for MIPS instructions

Programmable Machines

Levels in Processor Design

COMPUTER ORGANIZATION AND DESIGN

Transcription:

CS3350B Computer Architecture Winter 2015 Lecture 5.5: Single-Cycle CPU Datapath Design Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design, Patterson & Hennessy, 5 th edition, 2013]

Review Use muxes to select among inputs S control bits selects from 2 S inputs Each input can be n-bits wide, indep of S Can implement muxes hierarchically ALU can be implemented using a mux Coupled with basic block elements N-bit adder-subtractor done using N 1- bit adders with XOR gates on input XOR serves as conditional inverter

Plan Stages of the Datapath Datapath Instruction Walkthroughs Datapath Design

Five Components of a Computer Processor Control Datapath Computer Memory (passive) (where programs, data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, data live when not running) Display, Printer

The CPU Processor (CPU): the active part of the computer that does all the work (data manipulation and decision-making) Datapath: portion of the processor that contains hardware necessary to perform operations required by the processor (the brawn) Control: portion of the processor (also in hardware) that tells the datapath what needs to be done (the brain)

Stages of the Datapath : Overview Problem: a single, atomic block that executes an instruction (performs all necessary operations beginning with fetching the instruction) would be too bulky and inefficient Solution: break up the process of executing an instruction into stages, and then connect the stages to create the whole datapath smaller stages are easier to design easy to optimize (change) one stage without touching the others

Five Stages of the Datapath Stage 1: Instruction Fetch Stage 2: Instruction Decode Stage 3: ALU (Arithmetic-Logic Unit) Stage 4: Memory Access Stage 5: Register Write

Stages of the Datapath (1/5) There is a wide variety of MIPS instructions: so what general steps do they have in common? Stage 1: Instruction Fetch no matter what the instruction, the 32-bit instruction word must first be fetched from memory (the cache-memory hierarchy) also, this is where we Increment PC (that is, PC = PC + 4, to point to the next instruction: byte addressing so + 4)

Stages of the Datapath (2/5) Stage 2: Instruction Decode upon fetching the instruction, we next gather data from the fields (decode all necessary instruction data) first, read the opcode to determine instruction type and field lengths second, read in data from all necessary registers for add, read two registers for addi, read one register for jal, no reads necessary

Stages of the Datapath (3/5) Stage 3: ALU (Arithmetic-Logic Unit) the real work of most instructions is done here: arithmetic (+, -, *, /), shifting, logic (&, ), comparisons (slt) what about loads and stores? lw $t0, 40($t1) the address we are accessing in memory = the value in $t1 PLUS the value 40 so we do this addition in this stage

Stages of the Datapath (4/5) Stage 4: Memory Access actually only the load and store instructions do anything during this stage; the others remain idle during this stage or skip it all together since these instructions have a unique step, we need this extra stage to account for them as a result of the cache system, this stage is expected to be fast

Stages of the Datapath (5/5) Stage 5: Register Write most instructions write the result of some computation into a register examples: arithmetic, logical, shifts, loads, slt what about stores, branches, jumps? don t write anything into a register at the end these remain idle during this fifth stage or skip it all together

PC instruction memory registers Data memory Generic Steps of Datapath rd rs rt ALU +4 imm 1. Instruction Fetch 2. Decode/ Register Read 3. Execute 4. Memory 5. Register Write

Datapath Walkthroughs (1/3) add $r3,$r1,$r2 # r3 = r1+r2 Stage 1: fetch this instruction, increment PC Stage 2: decode to determine it is an add, then read registers $r1 and $r2 Stage 3: add the two values retrieved in Stage 2 Stage 4: idle (nothing to write to memory) Stage 5: write result of Stage 3 into register $r3

add r3, r1, r2 PC instruction memory registers Data memory Example: add Instruction 3 reg[1] reg[1]+ reg[2] 1 2 reg[2] ALU +4 imm

Datapath Walkthroughs (2/3) slti $r3,$r1,17 # if (r1 <17 ) r3 = 1 else r3 = 0 Stage 1: fetch this instruction, increment PC Stage 2: decode to determine it is an slti, then read register $r1 Stage 3: compare value retrieved in Stage 2 with the integer 17 Stage 4: idle Stage 5: write the result of Stage 3 (1 if reg source was less than signed immediate, 0 otherwise) into register $r3

slti r3, r1, 17 PC instruction memory registers Data memory Example: slti Instruction x reg[1] reg[1] <17? 1 3 ALU +4 imm 17

Datapath Walkthroughs (3/3) sw $r3,17($r1) # Mem[r1+17]=r3 Stage 1: fetch this instruction, increment PC Stage 2: decode to determine it is a sw, then read registers $r1 and $r3 Stage 3: add 17 to value in register $r1 (retrieved in Stage 2) to compute address Stage 4: write value in register $r3 (retrieved in Stage 2) into memory address computed in Stage 3 Stage 5: idle (nothing to write into a register)

SW r3, 17(r1) MEM[r1+17]<=r3 PC instruction memory registers Data memory Example: sw Instruction x reg[1] reg[1] +17 1 3 reg[3] ALU +4 imm 17

Why Five Stages? (1/2) Could we have a different number of stages? Yes, and other architectures do So why does MIPS have five if instructions tend to idle for at least one stage? Five stages are the union of all the operations needed by all the instructions. One instruction uses all five stages: the load

Why Five Stages? (2/2) lw $r3,17($r1) # r3=mem[r1+17] Stage 1: fetch this instruction, increment PC Stage 2: decode to determine it is a lw, then read register $r1 Stage 3: add 17 to value in register $r1 (retrieved in Stage 2) Stage 4: read value from memory address computed in Stage 3 Stage 5: write value read in Stage 4 into register $r3

LW r3, 17(r1) instruction memory registers Data memory MEM[r1+17] PC Example: lw Instruction x reg[1] reg[1] +17 1 3 ALU +4 imm 17

Exercise: How many places in this diagram will need a multiplexor to select one from multiple inputs? a) 0 b) 1 c) 2 d) 3 e) 4 or more

Exercise Answer How many places in this diagram will need a multiplexor to select one from multiple inputs a) 0 b) 1 c) 2 d) 3 e) 4 or more

PC instruction memory registers Data memory Datapath and Control Datapath based on data transfers required to perform instructions Controller causes the right transfers to happen rd rs rt ALU +4 imm opcode, funct Controller

What Hardware Is Needed? (1/2) PC: a register that keeps track of address of the next instruction to be fetched General Purpose Registers Used in Stages 2 (Read) and 5 (Write) MIPS has 32 of these Memory Used in Stages 1 (Fetch) and 4 (R/W) Caches makes these stages as fast as the others (on average, otherwise multicycle stall)

What Hardware Is Needed? (2/2) ALU Used in Stage 3 Performs all necessary functions: arithmetic, logicals, etc. Miscellaneous Registers One stage per clock cycle: Registers inserted between stages to hold intermediate data and control signals as they travel from stage to stage Note: Register is a general purpose term meaning something that stores bits. Realize that not all registers are in the register file

CPU Clocking (1/2) For each instruction, how do we control the flow of information though the datapath? Single Cycle CPU: All stages of an instruction completed within one long clock cycle Clock cycle sufficiently long to allow each instruction to complete all stages without interruption within one cycle 1. Instruction Fetch 2. Decode/ Register Read 3. Execute 4. Memory 5. Reg. Write

CPU Clocking (2/2) Alternative multiple-cycle CPU: only one stage of instruction per clock cycle Clock is made as long as the slowest stage 1. Instruction Fetch 2. Decode/ Register Read 3. Execute 4. Memory 5. Register Write Several significant advantages over single cycle execution: Unused stages in a particular instruction can be skipped OR instructions can be pipelined (overlapped)

Processor Design Analyze instruction set architecture (ISA) to determine datapath requirements Meaning of each instruction is given by register transfers Datapath must include storage element for ISA registers Datapath must support each register transfer Select set of datapath components and establish clocking methodology Assemble datapath components to meet requirements Analyze each instruction to determine sequence of control point settings to implement the register transfer Assemble the control logic to perform this sequencing

Summary CPU design involves Datapath, Control 5 Stages for MIPS Instructions 1. Instruction Fetch 2. Instruction Decode & Register Read 3. ALU (Execute) 4. Memory 5. Register Write Datapath timing: single long clock cycle or one short clock cycle per stage