.1 1999 ©UCB CS 161Computer Architecture Chapter 5 Lecture 11 Instructor: L.N. Bhuyan Adapted from notes by Dave Patterson (http.cs.berkeley.edu/~patterson)

Slides:



Advertisements
Similar presentations
Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
Advertisements

©UCB CS 161Computer Architecture Chapter 5 Lecture 9 Instructor: L.N. Bhuyan Adapted from notes by Dave Patterson (http.cs.berkeley.edu/~patterson)
1 Chapter Five The Processor: Datapath and Control.
The Processor: Datapath & Control
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
1 5.5 A Multicycle Implementation A single memory unit is used for both instructions and data. There is a single ALU, rather than an ALU and two adders.
©UCB CS 162 Computer Architecture Lecture 3: Pipelining Contd. Instructor: L.N. Bhuyan
CS 161Computer Architecture Chapter 5 Lecture 12
EECE476 Lectures 10: Multi-cycle CPU Control Chapter 5: Section 5.5 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
CS 161, Spring 2006 Test 2 Answers. Q1(a) +10 = in 2’s complement. And in sign-extended -12 = in 2’s comp And.
331 W10.1Spring :332:331 Computer Architecture and Assembly Language Spring 2005 Week 10 Building a Multi-Cycle Datapath [Adapted from Dave Patterson’s.
©UCB CS 161Computer Architecture Chapter 5 Instructor: L.N. Bhuyan LECTURE 10.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
1. 2 Multicycle Datapath  As an added bonus, we can eliminate some of the extra hardware from the single-cycle datapath. —We will restrict ourselves.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
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.
EECS 322 Sample Test 2 Solutions Wednesday March 21, 2001 Problem 1 (50%): A group of EECS students have decided to compete with Intel Corporation in the.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Datapath and Control: MultiCycle Implementation. Performance of Single Cycle Machines °Assume following operation times: Memory units : 200 ps ALU and.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
1 CS/COE0447 Computer Organization & Assembly Language Multi-Cycle Execution.
©UCB CS 161 Review for Test 2 Instructor: L.N. Bhuyan Adapted from notes by Dave Patterson (http.cs.berkeley.edu/~patterson)
MIPS processor continued. In Class Exercise Question Show the datapath of a processor that supports only R-type and jr reg instructions.
Chapter 5 Instructor: Mozafar Bag-Mohammadi Spring 2010 Ilam University.
IT 251 Computer Organization and Architecture Multi Cycle CPU Datapath Chia-Chi Teng.
LECTURE 6 Multi-Cycle Datapath and Control. SINGLE-CYCLE IMPLEMENTATION As we’ve seen, single-cycle implementation, although easy to implement, could.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
Fall 2015, Sep ELEC / Lecture 5 1 ELEC / Computer Architecture and Design Fall 2015 Datapath and Control (Chapter.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 2.
MIPS processor continued
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 10: Control Design
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 7: Multicycle CPU Instructor: Francis G. Wolff Case Western Reserve University.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 3.
1 The final datapath. 2 Control  The control unit is responsible for setting all the control signals so that each instruction is executed properly. —The.
EECS 322 Test 3 SolutionsWednesday March 22, 2000 Problem 1 (50%): A group of EECS students have decided to compete with Intel Corporation in the microcontroller.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 9: MIPS Lite 4 th edition: Chapter.
Design a MIPS Processor (II)
Multi-Cycle Datapath and Control
Chapter 5: A Multi-Cycle CPU.
IT 251 Computer Organization and Architecture
ECE/CS 552: Multicycle Data Path
Systems Architecture I
Multi-Cycle CPU.
Extensions to the Multicycle CPU
Single Cycle Processor
D.4 Finite State Diagram for the Multi-cycle processor
Multi-Cycle CPU.
CS/COE0447 Computer Organization & Assembly Language
MIPS processor continued
The Multicycle Implementation
CS/COE0447 Computer Organization & Assembly Language
Processor: Datapath and Control (part 2)
The Multicycle Implementation
Systems Architecture I
Vishwani D. Agrawal James J. Danaher Professor
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Chapter Four The Processor: Datapath and Control
5.5 A Multicycle Implementation
Processor Design Datapath and Design.
MIPS processor continued
Systems Architecture I
CS161 – Design and Architecture of Computer Systems
Presentation transcript:

©UCB CS 161Computer Architecture Chapter 5 Lecture 11 Instructor: L.N. Bhuyan Adapted from notes by Dave Patterson (http.cs.berkeley.edu/~patterson)

©UCB Implementing Main Control Main Control RegDst Branch MemRead MemtoReg ALUop MemWrite ALUSrc RegWrite op 2 Main Control has one 6-bit input, 9 outputs (7 are 1-bit, ALUOp is 2 bits) To build Main Control as sum-of-products: (1) Construct a minterm for each different instruction (or R-type); each minterm corresponds to a single instruction (or all of the R- type instructions), e.g., M R-format, M lw (2) Determine each main control output by forming the logical OR of relevant minterms (instructions), e.g., RegWrite: M R-format OR M lw

©UCB Single-Cycle MIPS-lite CPU Regs Read Reg1 Read data1 ALUALU Read data2 Read Reg2 Write Reg Write Data Zero ALU- con RegWrite Address Read data Write Data Sign Extend Dmem MemRead MemWrite MuxMux MemTo- Reg MuxMux Read Addr Instruc- tion Imem 4 PCPC addadd addadd << 2 MuxMux ALU Control 5:0 ALUOp (2) ALU- src MuxMux 25:21 20:16 15:11 RegDst 15:0 31:0 Branch Main Control op=[31:26] PCSrc

©UCB Fig Datapath with Control Signals

©UCB Fig Setting Control Lines Depend on Opcode

©UCB Control Design °Simple combinational logic (truth tables)

©UCB Fig R-type operation, add $t1, $t2, $t3 Active parts are highlighted

©UCB Fig Active parts for a Load instruction

©UCB Fig Active parts for a beq instruction

©UCB Fig Extension for Jump instruction

©UCB Single-Cycle Machine: Appraisal °All instructions complete in one clock cycle (CPI = 1) °Some instructions take more steps than others lw is most expensive (5 steps, vs. 4 for R-type and sw, 3 for beq ) °Clock cycle must cover longest instruction  inefficient suppose mul is added? 32-shift/add steps  would delay every other instruction

©UCB Example °Assume 2ns for instruction/data memory, 1ns for decode/register read, 2ns for ALU and 1 ns for register write. °Single-cycle datapath clock period = 8 ns. °Assume an instn mix of 24% loads, 12% stores, 44% R-format, 18% branches, and 2% jumps. °Assuming a variable-cycle datapath, average clock period = 6.3 ns. °Possible Speed-up = 1.27

©UCB Multicycle Implementation (MIPS-lite v.2) °Want more efficient implementation °Each step will take one clock cycle (not each instruction) [CPI > 1]  shorter clock cycle: cycle time constrained by longest step, not longest instruction °simpler instructions take fewer cycles  higher overall performance °complex control: finite state machine °Versatile (can extend for new instructions: add3, swap, etc.)

©UCB Recap: Clocking: single-cycle vs. multicycle add $t0,$t1,$t2 beq $t0,$t1,L Single-cycle Implementation Multicycle Implementation add $t0,$t1,$t2 beq $t0,$t1,L Multicycle Implementation: less waste=higher performance waste clock

©UCB Recap: How fast can we run the clock? °Depends on how much want done per clock cycle Can do: several “inexpensive” datapath operations per clock -simple gates (AND, OR, …) -single datapath registers (PC) -sign extender, left shifter, multiplexor PLUS: exactly one “expensive” datapath operation per clock -ALU operation -Register File access (2 reads, or 1 write) -Memory access (read or write)

©UCB Multicycle Datapath (overview) Registers Read Reg1 ALUALU Read Reg2 Write Reg Data PCPC Address Instruction or Data Memory MIPS-lite Multicycle Version A B ALU- Out Instruction Register Data Memory Data Register Read data 1 Read data 2 One ALU (no extra adders) One Memory (no separate Imem, Dmem) New Temporary Registers (“clocked”/require clock input)

©UCB Multicycle Implementation °Datapath changes one memory: both instructions and data (because can access on separate steps) one ALU (eliminate extra adders) extra “invisible” registers to capture intermediate (per-step) datapath results °Controller changes controller must fire control lines in correct sequence and correct time  controller must remember current execution step, advance to next step

©UCB Multicycle Datapath: Add Multiplexors ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 zero 15:11 Note inputs to multiplexors

©UCB Datapath + Control Points ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 IorD MemRead MemWrite IRWrite RegDst RegWrite ALUSrcA ALUSrcB MemtoReg ALU Control ALUOp (funct) 5:0 MuxMux PCSrc PCWrite PCWrite- Cond

©UCB Multicycle Instruction Execution °All instructions execute in 3-5 cycles 3 cycles: beq 4 cycles:R-type, sw 5 cycles: lw °1: fetch instruction, PC=PC+4 °2: decode, fetch registers, brnch target °3: execute/compute address/branch °4: access memory/complete R-type °5: ( lw ) store memory

©UCB Cycle 1 Datapath: IR=Mem[PC]; PC=PC+4 ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 ALU Control (funct) 5:0 MuxMux IR=Mem[PC]; PC=PC+4

©UCB Cycle 2: A=Reg[IR25:21]; ALUOut= PC + sgn-ext(IR15:0) << 2 ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 ALU Control (funct) 5:0 MuxMux A=Reg[IR 25:21 ]; B=Reg[IR 20:16 ]; ALUOut= PC + sgn-ext(IR 15:0 ) << 2

©UCB Cycle 3: R-format: ALUOut = A op B ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 ALU Control (funct) 5:0 MuxMux ALUOut=A op B

©UCB Cycle 4 R-format: Reg[IR15:11] = ALUOut ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 ALU Control (funct) 5:0 MuxMux Reg[IR 15:11 ] = ALUOut How many times use ALU?

©UCB Cycle 3 beq: if (A==B) PC =ALUOut ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 ALU Control (funct) 5:0 MuxMux if (A==B) PC =ALUOut

©UCB Cycle 3 lw: ALUOut = A + sgn-ext(IR15:0) ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 IorD=x MemRead MemWrite IRWrite RegDst=x RegWrite ALUSrcA=1 ALUSrcB=2 MemtoReg=x ALU Control ALUOp= (funct) 5:0 MuxMux PCSrc=x PCWrite PCWrite- Cond ALUOut = A + sgn-ext(IR 15:0 )

©UCB Cycle 4 lw : MDR = Mem[ALUout] ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 IorD=1 MemRead MemWrite IRWrite RegDst=x RegWrite ALUSrcA=x ALUSrcB=x MemtoReg=x ALU Control ALUOp=x (funct) 5:0 MuxMux PCSrc=x PCWrite PCWrite- Cond MDR = Mem[ALUout]

©UCB Cycle 5 lw: Reg[IR15:11] = MDR ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 IorD=x MemRead MemWrite IRWrite RegDst=0 RegWrite ALUSrcA=x ALUSrcB=x MemtoReg=1 ALU Control ALUOp=x (funct) 5:0 MuxMux PCSrc=x PCWrite PCWrite- Cond Reg[IR 15:11 ] = MDR

©UCB Cycle 4 ( sw ): Mem[ALUOut] = B ALUALU Regs Read Reg1 Read data1 Read data2 Read Reg2 Write Reg Write Data Sgn Ext- end PCPC << 2 A B ALU- Out Address Read Data Mem Write Data MDRMDR MuxMux 25:21 20:16 15:0 0 1M2 u 3 x MuxMux MuxMux MuxMux IR 4 z 15:11 IorD=1 MemRead MemWrite IRWrite RegDst RegWrite ALUSrcA ALUSrc MemtoReg ALU Control ALUOp (funct) 5:0 MuxMux PCSrc PCWrite PCWrite- Cond Mem[ALUOut] = B