Lecture 5: Pipelining Implementation Kai Bu

Slides:



Advertisements
Similar presentations
COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes.
Advertisements

Pipelining Preview Basics & Challenges
CS252/Patterson Lec 1.1 1/17/01 Pipelining: Its Natural! Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer.
Lecture 6: Pipelining MIPS R4000 and More Kai Bu
Instruction-Level Parallelism (ILP)
CIS429/529 Winter 2007 Pipelining II- 1 Additional pipelining topics Why pipelining is so hard: exception handling ILP techniques: loop unrolling.
CIS429/529 Winter 2007 Pipelining-1 1 Pipeling RISC/MIPS64 five stage pipeline Basic pipeline performance Pipeline hazards Branch hazards More pipeline.
Review: MIPS Pipeline Data and Control Paths
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
MIPS64 Instruction Format
Appendix A Pipelining: Basic and Intermediate Concepts 吳俊興 高雄大學資訊工程學系 October 2004 EEF011 Computer Architecture 計算機結構.
CIS629 Fall 2002 Pipelining 2- 1 Control Hazards Created by branch statements BEQZLOC ADDR1,R2,R3. LOCSUBR1,R2,R3 PC needs to be computed but it happens.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
DLX Instruction Format
EENG449b/Savvides Lec 4.1 1/25/05 January 25 and 25, 2005 Prof. Andreas Savvides Spring g449b EENG 449b/CPSC.
ENGS 116 Lecture 61 Pipelining Difficulties and MIPS R4000 Vincent H. Berk October 6, 2008 Reading for today: A.3 – A.4, article: Yeager Reading for Wednesday:
Appendix A Pipelining: Basic and Intermediate Concepts
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
EECC551 - Shaaban #1 Lec # 4 winter Data Hazards Requiring Stall Cycles In some code sequence cases, potential data hazards cannot be handled.
ENGS 116 Lecture 51 Pipelining and Hazards Vincent H. Berk September 30, 2005 Reading for today: Chapter A.1 – A.3, article: Patterson&Ditzel Reading for.
EECC551 - Shaaban #1 Lec # 2 Winter DLX Instruction Format 16 bits6 bits5 bits Immediate rdrs1Opcode 6 bits5 bits 11 bits Opcoders1rs2rdfunc.
Pipelining Basics Assembly line concept An instruction is executed in multiple steps Multiple instructions overlap in execution A step in a pipeline is.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
CSC 4250 Computer Architectures September 15, 2006 Appendix A. Pipelining.
Lecture 7: Pipelining Review Kai Bu
COMP381 by M. Hamdi 1 Pipelining Improving Processor Performance with Pipelining.
Lecture 05: Pipelining Basics & Hazards Kai Bu
Pipelined Datapath and Control
CPE432 Chapter 4B.1Dr. W. Abu-Sufah, UJ Chapter 4B: The Processor, Part B-2 Read Section 4.7 Adapted from Slides by Prof. Mary Jane Irwin, Penn State University.
1 Pipelining Part I CS What is Pipelining? Like an Automobile Assembly Line for Instructions –Each step does a little job of processing the instruction.
Processor Design CT101 – Computing Systems. Content GPR processor – non pipeline implementation Pipeline GPR processor – pipeline implementation Performance.
Oct. 18, 2000Machine Organization1 Machine Organization (CS 570) Lecture 4: Pipelining * Jeremy R. Johnson Wed. Oct. 18, 2000 *This lecture was derived.
Appendix A. Pipelining: Basic and Intermediate Concept
CMSC 611: Advanced Computer Architecture Pipelining Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
EE524/CptS561 Jose G. Delgado-Frias 1 Processor Basic steps to process an instruction IFID/OFEXMEMWB Instruction Fetch Instruction Decode / Operand Fetch.
CMSC 611: Advanced Computer Architecture Pipelining Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
CSC 4250 Computer Architectures September 22, 2006 Appendix A. Pipelining.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
CSE 340 Computer Architecture Spring 2016 Overcoming Data Hazards.
Computer Organization
Exceptions Another form of control hazard Could be caused by…
Lecture 07: Pipelining Multicycle, MIPS R4000, and More
CMSC 611: Advanced Computer Architecture
Pipelining Wrapup Brief overview of the rest of chapter 3
Pipelining: Implementation
Exceptions & Multi-cycle Operations
School of Computing and Informatics Arizona State University
Chapter 3: Pipelining 순천향대학교 컴퓨터학부 이 상 정 Adapted from
Pipelining: Advanced ILP
Review: MIPS Pipeline Data and Control Paths
Lecture 3 Instruction Level Parallelism (Pipelining)
Design of the Control Unit for One-cycle Instruction Execution
CSC 4250 Computer Architectures
\course\cpeg323-05F\Topic6b-323
The Processor Lecture 3.6: Control Hazards
An Introduction to pipelining
Project Instruction Scheduler Assembler for DLX
Overview What are pipeline hazards? Types of hazards
ECE 463/563 Fall `18 RISC-V instruction formats
Pipeline Control unit (highly abstracted)
Control Hazards Branches (conditional, unconditional, call-return)
Pipelining Appendix A and Chapter 3.
Control unit extension for data hazards
Lecture 06: Pipelining Implementation
Interrupts and exceptions
COMS 361 Computer Organization
CMSC 611: Advanced Computer Architecture
Need to stall for one cycle.
Presentation transcript:

Lecture 5: Pipelining Implementation Kai Bu

Lab 1 Report Submission Register addr Report Due Date: March 28 Demo 70% + Report 30% report template: ab_report_template.doc ab_report_template.doc

Appendix C.3-C.4

Data Path Underneath Pipelining IF ID EX MEM WB

Outline Unpipelined MIPS Pipelined MIPS Other Pipelining Challenges

Outline Unpipelined MIPS Pipelined MIPS Other Pipelining Challenges

MIPS Instruction at most 5 clock cycles per instruction IF ID EX MEM WB

MIPS Instruction IF ID EX MEM WB Instruction Fetch cycle IR ← Mem[PC]; NPC ← PC + 4; IR: instruction register NPC: next sequential PC

MIPS Instruction IF ID EX MEM WB Instruction Decode/register fetch A ← Regs[rs]; B ← Regs[rt]; Imm ← sign-extended immediate field of IR (lower 16 bits)

MIPS Instruction IF ID EX MEM WB Execution/effective address cycle ALU operates on the operands from ID: Memory reference 4 functions depending on the instr type -Memory reference Register-register ALU instruction -Register-register ALU instruction Register-immediate ALU instruction -Register-immediate ALU instruction Branch -Branch

MIPS Instruction IF ID EX MEM WB Execution/effective address cycle Memory reference -Memory reference ALUOutput ← A + Imm; ALU adds the operands

MIPS Instruction IF ID EX MEM WB Execution/effective address cycle Register-register ALU instr -Register-register ALU instr ALUOutput ← A func B; ALU performs the operation specified by function code on the value in register A and on the value in register B

MIPS Instruction IF ID EX MEM WB Execution/effective address cycle Register-Immediate ALU Instr -Register-Immediate ALU Instr ALUOutput ← A op Imm; ALU performs the operation specified by opcode on the value in register A and on the value in register Imm

MIPS Instruction IF ID EX MEM WB Execution/effective address cycle Branch -Branch ALUOutput ← NPC + (Imm<<2); Cond ← (A == 0); ALUOutput -> branch target BEQZ: comparison against 0

MIPS Instruction IF ID EX MEM WB MEMory access/branch completion update PC for all instr: PC ← NPC; Memory Access -Memory Access LMD ← Mem[ALUOutput]; load Mem[ALUOutput] ← B; store Branch -Branch if (cond) PC ← ALUOutput;

MIPS Instruction IF ID EX MEM WB Write-Back cycle Register-register ALU instruction -Register-register ALU instruction Regs[rd] ← ALUOutput; Register-immediate ALU instruction -Register-immediate ALU instruction Regs[rt] ← ALUOutput; Load instruction - Load instruction LMD Regs[rt] ← LMD; Load Memory Data reg

Put It All Together

MIPS Instruction IF ID EX MEM WB IR ← Mem[PC]; NPC ← PC + 4;

MIPS Instruction IF ID EX MEM WB A ← Regs[rs]; B ← Regs[rt]; Imm ← sign-extended immediate field of IR (lower 16 bits)

MIPS Instruction IF ID EX MEM WB ALUOutput ← A + Imm; ALUOutput ← A func B; ALUOutput ← A op Imm; ALUOutput ← NPC + (Imm<<2); Cond ← (A == 0);

MIPS Instruction IF ID EX MEM WB LMD ← Mem[ALUOutput]; Mem[ALUOutput] ← B; if (cond) PC ← ALUOutput;

MIPS Instruction IF ID EX MEM WB Regs[rd] ← ALUOutput; Regs[rt] ← ALUOutput; Regs[rt] ← LMD;

MIPS Instruction Demo Prof. Gurpur Prabhu, Iowa State Univ torial/PIPELINE/DLXimplem.html torial/PIPELINE/DLXimplem.html Load, Store Register-register ALU Register-immediate ALU Branch

Load

Store

Register-Register ALU

Register-Immediate ALU

Branch

Outline Unpipelined MIPS Pipelined MIPS Other Pipelining Challenges

Pipelined MIPS NPC IR A B IMM Cond ALUOutput LMDPipeline Registers/Latches

Instruction Type decides actions on a pipeline stage

Pipelined MIPS: IF, ID The first two stages are independent of instruction type because the instruction is not decoded until the end of ID; PC update

Pipelined MIPS: EX, MEM, WB Any value needed on a later pipeline stage must be placed in a pipeline register, and copied from one pipeline register to the next, until it is no longer needed.

Data Hazard Instruction Issue: ID -> EX If a data hazard exists, the instruction is stalled before it is issued. For integer pipeline, data hazards and forwarding can be checked during ID Detect hazards by comparing the destination and sources of adjacent instruction

Data Hazard Example Data hazards from Load Comparison between the destination of Load and the sources on the following two instr

Stall Prevent instructions in IF and ID from advancing Change the control portion of ID/EX to be a no-op Recirculate the contents of IF/ID registers to hold the stalled instr

Forwarding Data path: from the ALU or data memory output to the ALU input, the data memory input, or the zero detection unit. Compare the destination registers of EX/MEM.IR and MEM/WB.IR against the source registers of ID/EX.IR and EX/MEM.IR

Example: forwarding result is an ALU input

MEM/WRID/EXEX/MEM Data Memory ALU mux Registers NextPC Immediate mux Source  sink EX/Mem.ALUoutput  ALU input MEM/WB.ALUoutput  ALU input MEM/WB.LMD  ALU input Forwarding: hw change

store load MEM/WB.LMD  DM input Forwarding: hw change ?

Branch Move zero test to the ID stage with an additional ADDer computing target address

Outline Unpipelined MIPS Pipelined MIPS Other Pipelining Challenges

Exceptions: Instruction Execution Order interrupt/fault/exception When the normal execution order of instruction is changed May force CPU to abort the instructions in the pipeline before they complete

Exceptions Type I/O device request invoking os service from user program tracing instruction execution breakpoint integer arithmetic overflow FP arithmetic anomaly page fault misaligned memory address memory protection violation using undefined/unimplemented instruction hardware malfunctions power failure

Exceptions: Requirements Synchronous vs asynchronous User requested vs coerced User maskable vs user nonmaskable Within vs between instructions Resume vs terminate

Instruction Set Complications Instruction set specific factors that make pipelining harder to implement PP. C-49 – C.51

?