Lecture: Pipelining Extensions. Topics: control hazards, multi-cycle instructions, pipelining equations



Similar documents
WAR: Write After Read

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

INSTRUCTION LEVEL PARALLELISM PART VII: REORDER BUFFER

PROBLEMS #20,R0,R1 #$3A,R2,R4

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Pipelining Review and Its Limitations

CS352H: Computer Systems Architecture

Solutions. Solution The values of the signals are as follows:

CPU Performance Equation

Design of Pipelined MIPS Processor. Sept. 24 & 26, 1997

Data Dependences. A data dependence occurs whenever one instruction needs a value produced by another.

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

PROBLEMS. which was discussed in Section


Using Graphics and Animation to Visualize Instruction Pipelining and its Hazards

Computer Organization and Components

Course on Advanced Computer Architectures

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

A Lab Course on Computer Architecture

Pipeline Hazards. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by Arvind and Krste Asanovic

Central Processing Unit (CPU)

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Instruction scheduling

Module: Software Instruction Scheduling Part I

CS521 CSE IITG 11/23/2012

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Giving credit where credit is due

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

Chapter 5 Instructor's Manual

LSN 2 Computer Processors

EE361: Digital Computer Organization Course Syllabus

VLIW Processors. VLIW Processors

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Static Scheduling. option #1: dynamic scheduling (by the hardware) option #2: static scheduling (by the compiler) ECE 252 / CPS 220 Lecture Notes

This Unit: Multithreading (MT) CIS 501 Computer Architecture. Performance And Utilization. Readings

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

Computer Architecture TDTS10

An Introduction to the ARM 7 Architecture

PART B QUESTIONS AND ANSWERS UNIT I

Lecture 7: Clocking of VLSI Systems

picojava TM : A Hardware Implementation of the Java Virtual Machine

The Microarchitecture of Superscalar Processors

MACHINE ARCHITECTURE & LANGUAGE

BEAGLEBONE BLACK ARCHITECTURE MADELEINE DAIGNEAU MICHELLE ADVENA

Administration. Instruction scheduling. Modern processors. Examples. Simplified architecture model. CS 412 Introduction to Compilers

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

MICROPROCESSOR AND MICROCOMPUTER BASICS

Week 1 out-of-class notes, discussions and sample problems

Execution Cycle. Pipelining. IF and ID Stages. Simple MIPS Instruction Formats

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

Delay Time Analysis of Reconfigurable Firewall Unit

Let s put together a Manual Processor

Slide Set 8. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng

Lecture 11: Multi-Core and GPU. Multithreading. Integration of multiple processor cores on a single chip.

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

Introduction to Cloud Computing

EE482: Advanced Computer Organization Lecture #11 Processor Architecture Stanford University Wednesday, 31 May ILP Execution

StrongARM** SA-110 Microprocessor Instruction Timing

Quiz for Chapter 1 Computer Abstractions and Technology 3.10

Microprocessor & Assembly Language

Computer Organization. and Instruction Execution. August 22

Instruction Level Parallelism I: Pipelining

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

The 104 Duke_ACC Machine

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

VHDL DESIGN OF EDUCATIONAL, MODERN AND OPEN- ARCHITECTURE CPU

CSE 141L Computer Architecture Lab Fall Lecture 2

Application Note 195. ARM11 performance monitor unit. Document number: ARM DAI 195B Issued: 15th February, 2008 Copyright ARM Limited 2007

Lecture 2: Computer Hardware and Ports.

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

2

Thread level parallelism

Levels of Programming Languages. Gerald Penn CSC 324

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Lecture-3 MEMORY: Development of Memory:

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

TIMING DIAGRAM O 8085

CHAPTER 7: The CPU and Memory

An Overview of Stack Architecture and the PSC 1000 Microprocessor

EC 362 Problem Set #2

Computer organization

PowerPC Microprocessor Clock Modes

An Out-of-Order RiSC-16 Tomasulo + Reorder Buffer = Interruptible Out-of-Order

CUDA Optimization with NVIDIA Tools. Julien Demouth, NVIDIA

Remote Copy Technology of ETERNUS6000 and ETERNUS3000 Disk Arrays

Software Pipelining - Modulo Scheduling

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

Serial Communications

Modbus RTU Communications RX/WX and MRX/MWX

8. Hardware Acceleration and Coprocessing

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

BASIC COMPUTER ORGANIZATION AND DESIGN

IA-64 Application Developer s Architecture Guide

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Transcription:

Lecture: Pipelining Extensions Topics: control hazards, multi-cycle instructions, pipelining equations 1

Problem 6 Show the instruction occupying each stage in each cycle (with bypassing) if I1 is R1+R2 R3 and I2 is R3+R4 R5 and I3 is R3+R8 R9. Identify the input latch for each input operand. CYC-1 CYC-2 CYC-3 CYC-4 CYC-5 CYC-6 CYC-7 CYC-8 IF I1 IF I2 IF I3 IF I4 IF I5 IF IF IF D/R ALU D/R I1 ALU D/R I2 ALU I1 D/R I3 ALU I2 D/R I4 L3 L3 L4 L3 L5 L3 ALU I3 D/R ALU D/R ALU D/R ALU DM DM DM DM I1 DM I2 DM I3 DM DM RW RW RW RW RW I1 RW I2 RW I3 RW

Problem 7 Consider this 8-stage pipeline (RR and RW take a full cycle) IF DE RR AL AL DM DM RW For the following pairs of instructions, how many stalls will the 2 nd instruction experience (with and without bypassing)? ADD R1+R2 R3 ADD R3+R4 R5 without: 5 with: 1 LD [R1] R2 ADD R2+R3 R4 without: 5 with: 3 LD [R1] R2 SD [R2] R3 without: 5 with: 3 LD [R1] R2 SD [R3] R2 without: 5 with: 1 3

Hazards Structural Hazards Data Hazards Control Hazards 4

Control Hazards Simple techniques to handle control hazard stalls: for every branch, introduce a stall cycle (note: every 6 th instruction is a branch on average!) assume the branch is not taken and start fetching the next instruction if the branch is taken, need hardware to cancel the effect of the wrong-path instructions predict the next PC and fetch that instr if the prediction is wrong, cancel the effect of the wrong-path instructions fetch the next instruction (branch delay slot) and execute it anyway if the instruction turns out to be on the correct path, useful work was done if the instruction turns out to be on the wrong path, hopefully program state is not lost 5

Branch Delay Slots 6

Problem 1 Consider a branch that is taken 80% of the time. On average, how many stalls are introduced for this branch for each approach below: Stall fetch until branch outcome is known Assume not-taken and squash if the branch is taken Assume a branch delay slot o You can t find anything to put in the delay slot o An instr before the branch is put in the delay slot o An instr from the taken side is put in the delay slot o An instr from the not-taken side is put in the slot 7

Problem 1 Consider a branch that is taken 80% of the time. On average, how many stalls are introduced for this branch for each approach below: Stall fetch until branch outcome is known 1 Assume not-taken and squash if the branch is taken 0.8 Assume a branch delay slot o You can t find anything to put in the delay slot 1 o An instr before the branch is put in the delay slot 0 o An instr from the taken side is put in the slot 0.2 o An instr from the not-taken side is put in the slot 0.8 8

Multicycle Instructions 9

Effects of Multicycle Instructions Potentially multiple writes to the register file in a cycle Frequent RAW hazards WAW hazards (WAR hazards not possible) Imprecise exceptions because of o-o-o instr completion Note: Can also increase the width of the processor: handle multiple instructions at the same time: for example, fetch two instructions, read registers for both, execute both, etc. 10

Precise Exceptions On an exception: must save PC of instruction where program must resume all instructions after that PC that might be in the pipeline must be converted to NOPs (other instructions continue to execute and may raise exceptions of their own) temporary program state not in memory (in other words, registers) has to be stored in memory potential problems if a later instruction has already modified memory or registers A processor that fulfils all the above conditions is said to provide precise exceptions (useful for debugging and of course, correctness) 11

Dealing with these Effects Multiple writes to the register file: increase the number of ports, stall one of the writers during ID, stall one of the writers during WB (the stall will propagate) WAW hazards: detect the hazard during ID and stall the later instruction Imprecise exceptions: buffer the results if they complete early or save more pipeline state so that you can return to exactly the same state that you left at 12

Slowdowns from Stalls Perfect pipelining with no hazards an instruction completes every cycle (total cycles ~ num instructions) speedup = increase in clock speed = num pipeline stages With hazards and stalls, some cycles (= stall time) go by during which no instruction completes, and then the stalled instruction completes Total cycles = number of instructions + stall cycles Slowdown because of stalls = 1/ (1 + stall cycles per instr) 13

Pipelining Limits Gap between indep instrs: T + Tovh Gap between dep instrs: T + Tovh A B C A B C Gap between indep instrs: T/3 + Tovh Gap between dep instrs: T + 3Tovh A B C D E F A B C D E F Gap between indep instrs: T/6 + Tovh Gap between dep instrs: T + 6Tovh Assume that there is a dependence where the final result of the first instruction is required before starting the second instruction 14

Problem 2 Assume an unpipelined processor where it takes 5ns to go through the circuits and 0.1ns for the latch overhead. What is the throughput for 20-stage and 40-stage pipelines? Assume that the P.O.P and P.O.C in the unpipelined processor are separated by 2ns. Assume that half the instructions do not introduce a data hazard and half the instructions depend on their preceding instruction. 15

Problem 2 Assume an unpipelined processor where it takes 5ns to go through the circuits and 0.1ns for the latch overhead. What is the throughput for 1-stage, 20-stage and 50-stage pipelines? Assume that the P.O.P and P.O.C in the unpipelined processor are separated by 2ns. Assume that half the instructions do not introduce a data hazard and half the instructions depend on their preceding instruction. 1-stage: 1 instr every 5.1ns 20-stage: first instr takes 0.35ns, the second takes 2.8ns 50-stage: first instr takes 0.2ns, the second takes 4ns 16

Title Bullet 17