Designing a Pipelined CPU

Similar documents
Designing a Pipelined CPU

Midnight Laundry. IC220 Set #19: Laundry, Co-dependency, and other Hazards of Modern (Architecture) Life. Return to Chapter 4

Pipeline Data Hazards. Dealing With Data Hazards

Pipelining. Pipeline performance

ECE154A Introduction to Computer Architecture. Homework 4 solution

ECE260: Fundamentals of Computer Engineering

COMP2611: Computer Organization. The Pipelined Processor

Lecture Topics. Announcements. Today: Data and Control Hazards (P&H ) Next: continued. Exam #1 returned. Milestone #5 (due 2/27)

Data Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard

ECEC 355: Pipelining

CPE 335 Computer Organization. Basic MIPS Pipelining Part I

COSC 6385 Computer Architecture - Pipelining

SI232 Set #20: Laundry, Co-dependency, and other Hazards of Modern (Architecture) Life. Chapter 6 ADMIN. Reading for Chapter 6: 6.1,

ECS 154B Computer Architecture II Spring 2009

Pipelined datapath Staging data. CS2504, Spring'2007 Dimitris Nikolopoulos

EE2011 Computer Organization Lecture 10: Enhancing Performance with Pipelining ~ Pipelined Datapath

ECE260: Fundamentals of Computer Engineering

Chapter 3 & Appendix C Pipelining Part A: Basic and Intermediate Concepts

DLX Unpipelined Implementation

RISC Pipeline. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter 4.6

Slides for Lecture 15

Outline. A pipelined datapath Pipelined control Data hazards and forwarding Data hazards and stalls Branch (control) hazards Exception

Processor Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processor Architecture

CS 2506 Computer Organization II Test 2

ECE 2300 Digital Logic & Computer Organization. Caches

Perfect Student CS 343 Final Exam May 19, 2011 Student ID: 9999 Exam ID: 9636 Instructions Use pencil, if you have one. For multiple choice

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

ECE232: Hardware Organization and Design

Processor (II) - pipelining. Hwansoo Han

CSEE 3827: Fundamentals of Computer Systems

Pipelining. Ideal speedup is number of stages in the pipeline. Do we achieve this? 2. Improve performance by increasing instruction throughput ...

Parallelism via Multithreaded and Multicore CPUs. Bradley Dutton March 29, 2010 ELEC 6200

Computer Architecture

Control Hazards - branching causes problems since the pipeline can be filled with the wrong instructions.

Full Datapath. Chapter 4 The Processor 2

CS 251, Winter 2018, Assignment % of course mark

ECE473 Computer Architecture and Organization. Pipeline: Data Hazards

zhandling Data Hazards The objectives of this module are to discuss how data hazards are handled in general and also in the MIPS architecture.

CS422 Computer Architecture

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

Modern Computer Architecture

CS 251, Winter 2019, Assignment % of course mark

Laboratory Pipeline MIPS CPU Design (2): 16-bits version

Chapter 4 The Processor 1. Chapter 4B. The Processor

Pipelining Analogy. Pipelined laundry: overlapping execution. Parallelism improves performance. Four loads: Non-stop: Speedup = 8/3.5 = 2.3.

CENG 3531 Computer Architecture Spring a. T / F A processor can have different CPIs for different programs.

ECE331: Hardware Organization and Design

Instruction Pipelining

ECE 331 Hardware Organization and Design. UMass ECE Discussion 10 4/5/2018

LECTURE 3: THE PROCESSOR

Instruction word R0 R1 R2 R3 R4 R5 R6 R8 R12 R31

Lecture 3. Pipelining. Dr. Soner Onder CS 4431 Michigan Technological University 9/23/2009 1

mywbut.com Pipelining

MIPS An ISA for Pipelining

Lecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University

What is Pipelining. work is done at each stage. The work is not finished until it has passed through all stages.

14:332:331 Pipelined Datapath

Question 1: (20 points) For this question, refer to the following pipeline architecture.

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

ECE331: Hardware Organization and Design

Computer Architecture Spring 2016

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

Computer Systems Architecture Spring 2016

CISC 662 Graduate Computer Architecture Lecture 6 - Hazards

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

LECTURE 9. Pipeline Hazards

ECE 2300 Digital Logic & Computer Organization. More Caches Measuring Performance

Lecture 6: Pipelining

Chapter 4. The Processor

EI338: Computer Systems and Engineering (Computer Architecture & Operating Systems)

COMPUTER ORGANIZATION AND DESIGN

Pipeline Hazards. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Pipelining. lecture 15. MIPS data path and control 3. Five stages of a MIPS (CPU) instruction. - factory assembly line (Henry Ford years ago)

Chapter 3. Pipelining. EE511 In-Cheol Park, KAIST

What is Pipelining? Time per instruction on unpipelined machine Number of pipe stages

Assignment 1 solutions

What do we have so far? Multi-Cycle Datapath (Textbook Version)

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

Computer and Information Sciences College / Computer Science Department Enhancing Performance with Pipelining

Pipelining. CSC Friday, November 6, 2015

Outline Marquette University

Pipeline design. Mehran Rezaei

Pipeline Overview. Dr. Jiang Li. Adapted from the slides provided by the authors. Jiang Li, Ph.D. Department of Computer Science

Department of Computer and IT Engineering University of Kurdistan. Computer Architecture Pipelining. By: Dr. Alireza Abdollahpouri

ECE/CS 552: Pipeline Hazards

Instruction Pipelining

Thomas Polzer Institut für Technische Informatik

COMPUTER ORGANIZATION AND DESIGN

CSE Lecture 13/14 In Class Handout For all of these problems: HAS NOT CANNOT Add Add Add must wait until $5 written by previous add;

EE557--FALL 1999 MIDTERM 1. Closed books, closed notes

CS/CoE 1541 Exam 1 (Spring 2019).

C.1 Introduction. What Is Pipelining? C-2 Appendix C Pipelining: Basic and Intermediate Concepts

ELCT 501: Digital System Design

CMSC 411 Computer Systems Architecture Lecture 6 Basic Pipelining 3. Complications With Long Instructions

COMPUTER ORGANIZATION AND DESIGN

Beyond Pipelining. CP-226: Computer Architecture. Lecture 23 (19 April 2013) CADSL

Lecture 1: Introduction

Full Datapath. Chapter 4 The Processor 2

Instr. execution impl. view

Transcription:

Designing a Pipelined CPU Peer Instruction Lecture Materials for Computer Architecture by Dr. Leo Porter, adapted by Janet Davis, are licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 3. Unported License.

Review -- Single Cycle CPU

Which of the statements below is true about a pipelined processor? Choice A B C Statement Both instruction latency and throughput remain essentially unchanged Instruction latency remains essentially unchanged from single-cycle; Instruction throughput increases by a factor of 5 Instruction latency improves by a factor of 5 over singlecycle; Instruction throughput remains essentially unchanged D Both latency and throughput improve by a factor of 5 over single-cycle E Instruction Latencies and Throughput None of the above

Idea for a Pipelined Datapath

Execution in a Pipelined Datapath CC CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 IF ID EX MEM WB IF ID EX MEM WB

Execution in a Pipelined Datapath CC CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 IF ID EX MEM WB IF ID EX MEM WB steady state

Pipeline Stages Should we force every instruction to go through all 5 stages? Can R-type taking 4 cycles instead of 5? Selection Yes/No Reason (Choose BEST answer) A Yes Decreasing R-type to 4 cycles improves instruction throughput B Yes Decreasing R-type to 4 cycles improves instruction latency C No Decreasing R-type to 4 cycles causes hazards D No Decreasing R-type to 4 cycles doesn t improve throughput E No Decreasing R-type to 4 cycles doesn t improve latency

Mixed Instructions in the Pipeline CC CC2 CC3 CC4 CC5 CC6 add

Pipeline Principles All instructions that share a pipeline must have the same stages in the same order. therefore, add does nothing during Mem stage sw does nothing during WB stage All intermediate values must be latched each cycle. There is no functional block reuse IF ID EX MEM WB

Instruction Fetch M Pipelined Datapath Instruction Decode/ ister Fetch registers! Execute/ ress Calculation Memory Access Back IF/ID ID/EX EX/MEM MEM/WB 4 Shift left 2 result PC ress Instruction memory register register 2 isters 2 register 6 Sign extend 32 M Zero result ress Data memory M

M Which is the best statement? IF/ID ID/EX EX/MEM MEM/WB 4 Shift left 2 result PC ress Instruction memory register register 2 isters 2 register 6 Sign extend 32 M Zero result ress Data memory M A. All the pipeline registers are the same size. B. The ID/EX register is the same size as the EX/MEM register. C. The IF/ID register is the largest; MEM/WB is the smallest. D. The ID/EX register is the largest; IF/ID is the smallest. E. None of the above.

Where does multiplication execute? M IF/ID ID/EX EX/MEM MEM/WB 4 Shift left 2 result PC ress Instruction memory register register 2 isters 2 register 6 Sign extend 32 M Zero result ress Data memory M A. The ID stage B. The EX stage C. The MEM stage D. The WB stage E. None of the above

The Pipeline with Control Logic

Execution in a Pipelined Datapath CC CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 IF ID EX MEM WB IF ID EX MEM WB

CC CC2 CC3 CC4 CC5 CC6 CC7 CC8 sub $2, $, $3 and $2, $2, $5 or $3, $6, $2 add $4, $2, $2 sw $5, ($2) What just happened here which is problematic (BEST ANSWER)? A. The register file is trying to read and write the same register. B. The and memory are both active in the same cycle. C. A value is used before it is produced. D. Both A and B E. Both A and C

Data Hazards When a result is needed in the pipeline before it is available, a hazard occurs. R2 Available CC CC2 CC3 CC4 CC5 CC6 CC7 CC8 sub $2, $, $3 and $2, $2, $5 or $3, $6, $2 R2 Needed add $4, $2, $2 sw $5, ($2)

What happens when... add $3, $, $ $8, ($3) sub $, $8, $7 Hazards continued