CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture MIPS Review & Pipelining I Steve Ko Computer Sciences and Engineering University at Buffalo.

Slides:



Advertisements
Similar presentations
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.
Advertisements

331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
Multi-cycle Implementations Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology January 13, 2012L6-1
1 RISC Pipeline Han Wang CS3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 4.6.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Cache II Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Pipelining III Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture ISAs and MIPS Steve Ko Computer Sciences and Engineering University at Buffalo.
CS 152 Computer Architecture and Engineering Lecture 4 - Pipelining Krste Asanovic Electrical Engineering and Computer Sciences University of California.
The Processor: Datapath & Control
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
January 26, 2011CS152, Spring 2011 CS 152 Computer Architecture and Engineering Lecture 3 - From CISC to RISC Krste Asanovic Electrical Engineering and.
January 26, 2010CS152, Spring 2010 CS 152 Computer Architecture and Engineering Lecture 3 - From CISC to RISC Krste Asanovic Electrical Engineering and.
©UCB CS 162 Computer Architecture Lecture 3: Pipelining Contd. Instructor: L.N. Bhuyan
Levels in Processor Design
Microprocessor Design
January 31, 2011CS152, Spring 2011 CS 152 Computer Architecture and Engineering Lecture 4 - Pipelining Krste Asanovic Electrical Engineering and Computer.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
CS 152 Computer Architecture and Engineering Lecture 4 - Pipelining Krste Asanovic Electrical Engineering and Computer Sciences University of California.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
Chapter 4 Sections 4.1 – 4.4 Appendix D.1 and D.2 Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
Asanovic/Devadas Spring Simple Instruction Pipelining Krste Asanovic Laboratory for Computer Science Massachusetts Institute of Technology.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
CSC 4250 Computer Architectures September 15, 2006 Appendix A. Pipelining.
Computer Organization CS224 Fall 2012 Lesson 26. Summary of Control Signals addsuborilwswbeqj RegDst ALUSrc MemtoReg RegWrite MemWrite Branch Jump ExtOp.
CSE 340 Computer Architecture Summer 2014 Basic MIPS Pipelining Review.
CS.305 Computer Architecture Enhancing Performance with Pipelining Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from.
CDA 3101 Fall 2013 Introduction to Computer Organization
CS 152 Computer Architecture and Engineering Lecture 3 - From CISC to RISC Krste Asanovic Electrical Engineering and Computer Sciences University of California.
Electrical and Computer Engineering University of Cyprus LAB 2: MIPS.
1/29/2013 CS152, Spring 2013 CS 152 Computer Architecture and Engineering Lecture 3 - From CISC to RISC Krste Asanovic Electrical Engineering and Computer.
POLITECNICO DI MILANO Parallelism in wonderland: are you ready to see how deep the rabbit hole goes? Pipelining Ver. Jan 14, 2014 Marco D. Santambrogio:
EECE 476: Computer Architecture Slide Set #5: Implementing Pipelining Tor Aamodt Slide background: Die photo of the MIPS R2000 (first commercial MIPS microprocessor)
Datapath and Control Unit Design
Oct. 18, 2000Machine Organization1 Machine Organization (CS 570) Lecture 4: Pipelining * Jeremy R. Johnson Wed. Oct. 18, 2000 *This lecture was derived.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
CMPE 421 REVIEW: MIDTERM 1. A MODIFIED FIVE-Stage Pipeline PC A Y R MD1 addr inst Inst Memory Imm Ext add rd1 GPRs rs1 rs2 ws wd rd2 we wdata addr wdata.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
1/27/2016 CS152, Spring 2016 CS 152 Computer Architecture and Engineering Lecture 3 - From CISC to RISC Dr. George Michelogiannakis EECS, University of.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
CS161 – Design and Architecture of Computer Systems
Electrical and Computer Engineering University of Cyprus
CS 230: Computer Organization and Assembly Language
ELEN 468 Advanced Logic Design
Processor Architecture: Introduction to RISC Datapath (MIPS and Nios II) CSCE 230.
Prof. Sirer CS 316 Cornell University
Instruction Format MIPS Instruction Set.
ECS 154B Computer Architecture II Spring 2009
CS 152 Computer Architecture and Engineering Lecture 4 - Pipelining
CS 152 Computer Architecture and Engineering Lecture 4 - Pipelining
School of Computing and Informatics Arizona State University
CSCI206 - Computer Organization & Programming
Dept. of Info. Sci. & Elec. Engg.
Systems Architecture II
Levels in Processor Design
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
The Processor Lecture 3.2: Building a Datapath with Control
Topic 5: Processor Architecture
COMS 361 Computer Organization
Prof. Sirer CS 316 Cornell University
Instruction Format MIPS Instruction Set.
Computer Architecture Processor: Datapath
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
Presentation transcript:

CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture MIPS Review & Pipelining I Steve Ko Computer Sciences and Engineering University at Buffalo

CSE 490/590, Spring Last Time… An ISA can have multiple implementations (Briefly) CISC vs. RISC –CISC: microcoded (macro instructions & microinstructions) –RISC: combinational logic MIPS microarchitecture –Good RISC example –Fixed format instructions –Load/store architecture with single address mode –Simple branch Will continue on this today…

CSE 490/590, Spring MIPS Instruction Formats Op Rs1Rd immediate Op Op Rs1Rs2 target RdFunc Register-Register Register-Immediate Op Rs1Rs2/Opx immediate Branch (Same format as Reg-Imm) Jump / Call

CSE 490/590, Spring 2011 Reg-Reg Instructions Op (e.g., 0) encodes that this is a reg-reg instruction Func encodes the datapath operations (add, sub, etc.) Rd  (Rs1) Func (Rs2) ADD R1,R2,R3 –Add –Reg[R1]  Regs[R2] + Regs[R3] 4 Op Rs1Rs2RdFunc Register-Register

CSE 490/590, Spring 2011 Reg-Imm Instructions Rd  (Rs1) Op (Imm) ADDI R1,R2,#3 –Add immediate –Regs[R1]  Regs[R2] + 3 LD R1,30(R2) –Load word –Regs[R1]  Mem[30 + Regs[R2]] BEQZ R4, name –Branch equal zero –If (Regs[R4] == 0) PC  name 5 Op Rs1Rd immediate Register-Immediate

CSE 490/590, Spring 2011 Jump / Call Rd  (Rs1) Op (Imm) J name –Jump –PC 6…31  name JAL name –Jump and link –Regs[R31]  PC + 4; PC 6…31  name 6 Op target Jump / Call

CSE 490/590, Spring Implementing MIPS: Single-cycle per instruction datapath & control logic

CSE 490/590, Spring Datapath: Reg-Reg ALU Instructions RegWrite Timing? rsrt rd 0 func rd  (rs) func (rt) x4 Add clk addr inst Inst. Memory PC inst OpCode z ALU Control RegWrite clk rd1 GPRs rs1 rs2 ws wd rd2 we

CSE 490/590, Spring Datapath: Reg-Imm ALU Instructions opcode rsrt immediate rt  (rs) op immediate Imm Ext ExtSel inst OpCode 0x4 Add clk addr inst Inst. Memory PC z ALU RegWrite clk rd1 GPRs rs1 rs2 ws wd rd2 we inst ALU Control

CSE 490/590, Spring Conflicts in Merging Datapath Imm Ext ExtSel OpCode 0x4 Add clk addr inst Inst. Memory PC z ALU RegWrite clk rd1 GPRs rs1 rs2 ws wd rd2 we inst ALU Control inst opcode rsrt immediate rt  (rs) op immediate rsrt rd 0 func rd  (rs) func (rt) Introduce muxes

CSE 490/590, Spring Datapath for ALU Instructions, opcode rsrt immediate rt  (rs) op immediate rsrt rd 0 func rd  (rs) func (rt) BSrc Reg / Imm RegDst rt / rd Imm Ext ExtSel OpCode 0x4 Add clk addr inst Inst. Memory PC z ALU RegWrite clk rd1 GPRs rs1 rs2 ws wd rd2 we OpSel ALU Control

CSE 490/590, Spring Datapath for Memory Instructions Should program and data memory be separate? Harvard style: separate (Aiken and Mark 1 influence) - read-only program memory - read/write data memory - Note: Somehow there must be a way to load the program memory Princeton style: the same (von Neumann’s influence) - single read/write memory for program and data - Note: A Load or Store instruction requires accessing the memory more than once during its execution

CSE 490/590, Spring Load/Store Instructions: Harvard Datapath WBSrc ALU / Mem rs is the base register rt is the destination of a Load or the source for a Store addressing mode opcode rsrt displacement (rs) + displacement RegDst BSrc “base” disp ExtSelOpCodeOpSel ALU Control z ALU 0x4 Add clk addr inst Inst. Memory PC RegWrite clk rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext clk MemWrite addr wdata rdata Data Memory we

CSE 490/590, Spring CSE 490/590 Administrivia Please purchase a BASYS2 board (100K) as soon as possible. –Projects should be done individually. Quiz 1 –Fri, 2/4 –Closed book, in-class –10% Class cancelled on Fri, 4/15 –Will update the schedule

CSE 490/590, Spring MIPS Control Instructions Conditional (on GPR) PC-relative branch Unconditional register-indirect jumps Unconditional absolute jumps PC-relative branches add offset4 to PC+4 to calculate the target address (offset is in words): 128 KB range Absolute jumps append target4 to PC to calculate the target address: 256 MB range jump-&-link stores PC+4 into the link register (R31) opcode rs offset BEQZ, BNEZ 6 26 opcode targetJ, JAL opcode rsJR, JALR

CSE 490/590, Spring Conditional Branches (BEQZ, BNEZ) 0x4 Add PCSrc clk WBSrcMemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSelOpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext ALU Control Add br pc+4 RegWrite

CSE 490/590, Spring Register-Indirect Jumps (JR) 0x4 RegWrite Add clk WBSrcMemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSelOpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext ALU Control PCSrc br pc+4 rind

CSE 490/590, Spring Register-Indirect Jump-&-Link (JALR) 0x4 RegWrite Add clk WBSrcMemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSelOpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext ALU Control 31 PCSrc br pc+4 rind

CSE 490/590, Spring Absolute Jumps (J, JAL) 0x4 RegWrite Add clk WBSrcMemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSelOpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext ALU Control 31 PCSrc br pc+4 rind jabs

CSE 490/590, Spring Harvard-Style Datapath for MIPS 0x4 RegWrite Add clk WBSrcMemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSelOpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd1 GPRs rs1 rs2 ws wd rd2 we Imm Ext ALU Control 31 PCSrc br rind jabs pc+4

CSE 490/590, Spring Single-Cycle Hardwired Control: Harvard architecture We will assume clock period is sufficiently long for all of the following steps to be “completed”: 1. instruction fetch 2. decode and register fetch 3. ALU operation 4. data fetch if required 5. register write-back setup time   t C > t IFetch + t RFetch + t ALU + t DMem + t RWB At the rising edge of the following clock, the PC, the register file and the memory are updated

CSE 490/590, Spring Pipelined MIPS

CSE 490/590, Spring An Ideal Pipeline All objects go through the same stages No sharing of resources between any two stages Propagation delay through all pipeline stages is equal The scheduling of an object entering the pipeline is not affected by the objects in other stages stage 1 stage 2 stage 3 stage 4 These conditions generally hold for industrial assembly lines. But can an instruction pipeline satisfy the last condition?

CSE 490/590, Spring Pipelined MIPS To pipeline MIPS: First build MIPS without pipelining with CPI=1 Next, add pipeline registers to reduce cycle time while maintaining CPI=1

CSE 490/590, Spring Pipelined Datapath Clock period can be reduced by dividing the execution of an instruction into multiple cycles t C > max {t IM, t RF, t ALU, t DM, t RW } ( = t DM probably) However, CPI will increase unless instructions are pipelined write -back phase fetch phase execute phase decode & Reg-fetch phase memory phase addr wdata rdata Data Memory we ALU Imm Ext 0x4 Add addr rdata Inst. Memory rd1 GPRs rs1 rs2 ws wd rd2 we IR PC

CSE 490/590, Spring “Iron Law” of Processor Performance Time = Instructions Cycles Time Program Program * Instruction * Cycle –Instructions per program depends on source code, compiler technology, and ISA –Cycles per instructions (CPI) depends upon the ISA and the microarchitecture –Time per cycle depends upon the microarchitecture and the base technology MicroarchitectureCPIcycle time Microcoded>1short Single-cycle unpipelined1long Pipelined1short

CSE 490/590, Spring 2011 CPI Examples 27 Time Inst 3 7 cycles Inst 1Inst 2 5 cycles10 cycles Microcoded machine 3 instructions, 22 cycles, CPI=7.33 Unpipelined machine 3 instructions, 3 cycles, CPI=1 Inst 1Inst 2Inst 3 Pipelined machine 3 instructions, 3 cycles, CPI=1 Inst 1 Inst 2 Inst 3

CSE 490/590, Spring Technology Assumptions Thus, the following timing assumption is reasonable A small amount of very fast memory (caches) backed up by a large, slower memory Fast ALU (at least for integers) Multiported Register files (slower!) t IM t RF t ALU t DM t RW A 5-stage pipeline will be the focus of our detailed design - some commercial designs have over 30 pipeline stages to do an integer add!

CSE 490/590, Spring Acknowledgements These slides heavily contain material developed and copyright by –Krste Asanovic (MIT/UCB) –David Patterson (UCB) And also by: –Arvind (MIT) –Joel Emer (Intel/MIT) –James Hoe (CMU) –John Kubiatowicz (UCB) MIT material derived from course UCB material derived from course CS252