CS61C : Machine Structures

Similar documents
Lecture #17: CPU Design II Control

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

CS61C : Machine Structures

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

CS3350B Computer Architecture Winter Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2)

UC Berkeley CS61C : Machine Structures

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

CS61C : Machine Structures

COMP303 Computer Architecture Lecture 9. Single Cycle Control

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2

UC Berkeley CS61C : Machine Structures

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

EEM 486: Computer Architecture. Lecture 3. Designing Single Cycle Control

MIPS-Lite Single-Cycle Control

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

UC Berkeley CS61C : Machine Structures

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 19 CPU Design: The Single-Cycle II & Control !

CS61C : Machine Structures

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations

CS 61C: Great Ideas in Computer Architecture Control and Pipelining

How to design a controller to produce signals to control the datapath

CS 61C: Great Ideas in Computer Architecture Lecture 12: Single- Cycle CPU, Datapath & Control Part 2

Full Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU

CPU Design Steps. EECC550 - Shaaban

CPU Organization (Design)

CS359: Computer Architecture. The Processor (A) Yanyan Shen Department of Computer Science and Engineering

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

Working on the Pipeline

CS152 Computer Architecture and Engineering Lecture 10: Designing a Single Cycle Control. Recap: The MIPS Instruction Formats

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content

Single Cycle CPU Design. Mehran Rezaei

Designing a Multicycle Processor

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath Control Part 1

Recap: The MIPS Subset ADD and subtract EEL Computer Architecture shamt funct add rd, rs, rt Single-Cycle Control Logic sub rd, rs, rt

The Processor: Datapath & Control

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I ! Nasty new windows vulnerability!

Ch 5: Designing a Single Cycle Datapath

Instructor: Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #18. Warehouse Scale Computer

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering

CS 152 Computer Architecture and Engineering. Lecture 10: Designing a Multicycle Processor

Major CPU Design Steps

CPSC614: Computer Architecture

Recap: A Single Cycle Datapath. CS 152 Computer Architecture and Engineering Lecture 8. Single-Cycle (Con t) Designing a Multicycle Processor

Adding Support for jal to Single Cycle Datapath (For More Practice Exercise 5.20)

CS3350B Computer Architecture Quiz 3 March 15, 2018

Lecture 6 Datapath and Controller

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Guerrilla Session 3: MIPS CPU

CS61c Final Review Fall Andy Carle 12/12/2004

CS152 Computer Architecture and Engineering. Lecture 8 Multicycle Design and Microcode John Lazzaro (

CSE 141 Computer Architecture Summer Session I, Lecture 3 Performance and Single Cycle CPU Part 1. Pramod V. Argade

361 multipath..1. EECS 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

Lecture 12: Single-Cycle Control Unit. Spring 2018 Jason Tang

COMP303 - Computer Architecture Lecture 10. Multi-Cycle Design & Exceptions

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

add rd, rs, rt Review: A Single Cycle Datapath We have everything Lecture Recap: Meaning of the Control Signals

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

CS 61C Summer 2016 Guerrilla Section 4: MIPS CPU (Datapath & Control)

Pipeline design. Mehran Rezaei

CpE 442. Designing a Multiple Cycle Controller

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

CS 61C Fall 2016 Guerrilla Section 4: MIPS CPU (Datapath & Control)

UC Berkeley CS61C : Machine Structures

If you didn t do as well as you d hoped

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition. Chapter 4. The Processor

Final Exam Spring 2017

ECE4680 Computer Organization and Architecture. Designing a Pipeline Processor

CS61C : Machine Structures

Lecture 7 Pipelining. Peng Liu.

ECE 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

ECE 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller. Review of a Multiple Cycle Implementation

Midterm I March 1, 2001 CS152 Computer Architecture and Engineering

CS3350B Computer Architecture Winter 2015

CS 110 Computer Architecture Review Midterm II

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2. Clk

The MIPS Processor Datapath

CN Project : Verilog implementation of MIPS processor

Processor (I) - datapath & control. Hwansoo Han

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single Cycle MIPS CPU

ECE468. Computer Organization and Architecture. Designing a Multiple Cycle Processor

Lecture 10: Simple Data Path

ECE232: Hardware Organization and Design

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

ECE4680. Computer Organization and Architecture. Designing a Multiple Cycle Processor

Chapter 4. The Processor

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 27: Single- Cycle CPU Datapath Design

1048: Computer Organization

Laboratory 5 Processor Datapath

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

Computer Science 61C Spring Friedland and Weaver. The MIPS Datapath

Transcription:

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 34 Single Cycle CPU Control I 24-4-16 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia 1.5 Quake?! NBC movie on May 3 rd. Truth stranger than fiction? The San Andreas fault may be on the cusp of producing a flurry of quakes that could rattle SoCal w/a strong temblor every few decades or less cnn.com/24/tech/science/4/14/san.andreas.awakens.ap CS 61C L34 Single Cycle CPU Control I (1)

Anatomy Review: 5 components of any Computer Personal Computer Today Yesterday (& finish up) Computer Processor Control ( brain ) path ( brawn ) (where programs, data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, data live when not running) Display, Printer CS 61C L34 Single Cycle CPU Control I (2)

Review: How to Design a Processor: step-by-step 1. Analyze instruction set architecture (ISA) => datapath requirements meaning of each instruction is given by the register transfers datapath must include storage element for ISA registers datapath must support each register transfer 2. Select set of datapath components and establish clocking methodology 3. Assemble datapath meeting requirements 4. Analyze implementation of each instruction to determine setting of control points that effects the register transfer. 5. Assemble the control logic CS 61C L34 Single Cycle CPU Control I (3)

Register-Register Timing: One complete cycle PC Rs, Rt, Rd, Op, Func ALUctr Old Value New Value Old Value Old Value Instruction Access Time New Value Delay through Control Logic New Value RegWr Old Value New Value Register File Access busa, B Old Value Time New Value ALU Delay busw Old Value New Value busw Rd Rs Rt RegWr5 5 5 Rw Ra Rb -bit Registers busa busb ALUctr ALU Result Register Write Occurs Here CS 61C L34 Single Cycle CPU Control I (4)

3c: Logical Operations with Immediate R[rt] = R[rs] op ZeroExt[] ] RegDst busw RegWr Rd Rs Rt? 5 5 5 Rw Ra Rb -bit Registers 16 Rt 31 busb ZeroExt busa 26 21 op rs rt immediate 31 6 bits 5 bits 5 bits 16 15 rd? 16 bits 16 bits ALUSrc ALUct r ALU Result 16 11 immediate 16 bits What about Rt register read?? Already defined -bit MUX; Zero Ext? CS 61C L34 Single Cycle CPU Control I (5)

3d: Load Operations R[rt] = Mem[R[rs] + SignExt[]] Example: lw rt, rs, busw 31 26 Rd Rt RegDst Rs Rt? RegWr 5 5 5 21 16 op rs rt immediate 6 bits 5 bits 5 bits 16 bits Rw Ra Rb -bit Registers 16 busb Extender busa ALUctr ALU In?? ALUSrc MemWr WrEn Adr W_Src ExtOp CS 61C L34 Single Cycle CPU Control I (6)

3e: Store Operations Mem[ R[rs] + SignExt[] ] = R[rt] Ex.: sw rt, rs, 31 26 21 16 op rs rt immediate 6 bits 5 bits 5 bits 16 bits Rd Rt ALUctr MemWr RegDst Rs Rt RegWr5 5 5 busa busw Rw Ra Rb -bit Registers 16 busb Extender ALU In WrEnAdr W_Src Mu x CS 61C L34 Single Cycle CPU Control I (7) ExtOp ALUSrc

3f: The Branch Instruction beq rs, rt, mem[pc] Fetch the instruction from memory Equal = R[rs] == R[rt] Calculate the branch condition if (Equal) Calculate the next instruction s address - PC = PC + 4 + ( SignExt() x 4 ) else - PC = PC + 4 31 26 21 16 op rs rt immediate 6 bits 5 bits 5 bits 16 bits CS 61C L34 Single Cycle CPU Control I (8)

path for Branch Operations beq rs, rt, path generates condition (equal) 4 PC Ext 31 Adder 26 21 16 op rs rt immediate 6 bits 5 bits 5 bits 16 bits Adder npc_sel PC CS 61C L34 Single Cycle CPU Control I (9) Inst Address RegWr busw Rs Rt 5 5 5 busa Rw Ra Rb -bit Registers busb Cond Already MUX, adder, sign extend, zero Equal?

Putting it All Together:A Single Cycle path 4 PC Ext Adder Adder npc_sel Inst Adr PC <21:25> Rs <16:2> Rt Rd <11:15> RegDst Rd Rt Equal 1 Rs Rt RegWr5 5 5 busa busw Rw Ra Rb -bit Registers busb 1 16 Extender <:15> Imm16 Instruction<31:> ALUctr = ALU MemWr In WrEn Adr MemtoReg 1 CS 61C L34 Single Cycle CPU Control I (1) ExtOp ALUSrc

An Abstract View of the Implementation Instruction Address Next Address Ideal Instruction PC Rd 5 Instruction Rs 5 Rt 5 Rw Ra Rb -bit Registers A B Control Control Signals Conditions ALU Address In Ideal Out path CS 61C L34 Single Cycle CPU Control I (11)

An Abstract View of the Critical Path This affects how much you can overclock your PC! Instruction Address Next Address Ideal Instruction PC Rd 5 Instruction Rs 5 Rw Ra Rb -bit Registers Critical Path (Load Operation) = Delay clock through PC (FFs) + Instruction s Access Time + Register File s Access Time + ALU to Perform a -bit Add + Access Time + Stable Time for Register File Write Rt 5 Imm 16 A B ALU Address In Ideal CS 61C L34 Single Cycle CPU Control I (12)

An Abstract View of the Implementation Instruction Address Next Address Ideal Instruction PC Rd 5 Instruction Rs 5 Rt 5 Rw Ra Rb -bit Registers A B Control Control Signals Conditions ALU Address In Ideal Out path CS 61C L34 Single Cycle CPU Control I (13)

Recap: A Single Cycle path Rs, Rt, Rd, Imed16 connected to datapath We have everything except control signals npc_sel Rd Rt RegDst 1 Rs Rt RegWr 5 5 5 busw Rw Ra Rb -bit Registers 16 busa busb Extender 1 ALUctr ALUSrc Instruction Fetch Unit ALU In Instruction<31:> Rt Zero <21:25> <16:2> Rs Rd MemWr <11:15> WrEn Adr <:15> Imm16 1 MemtoReg ExtOp CS 61C L34 Single Cycle CPU Control I (14)

Recap: Meaning of the Control Signals npc_mux_sel: PC < PC + 4 n =next 1 PC < PC + 4 + {SignExt(Im16), } Later in lecture: higher-level connection between mux and branch cond npc_mux_sel Adder Adder CS 61C L34 Single Cycle CPU Control I (15) 4 PC Ext PC Adr Inst

Recap: Meaning of the Control Signals ExtOp: zero, sign MemWr: 1 write memory ALUsrc: regb; MemtoReg: ALU; 1 Mem 1 immed RegDst: rt ; 1 rd ALUctr: add, sub, or RegWr: 1 write register RegDst Rd Rt Equal 1 Rs Rt RegWr 5 5 5 busa busw Rw Ra Rb -bit Registers busb 1 16 Extender ALUctr = ALU MemWr In WrEn Adr MemtoReg 1 CS 61C L34 Single Cycle CPU Control I (16) ExtOp ALUSrc

Administrivia Final Exam will be here! (25 VLSB) Sat, 24-5-22, 12:3 3:3pm Take EECS Survey this week! (results will be presented to Faculty; you CAN make a difference in your education & undergraduate experience) http://eecssurvey.berkeley.edu CS 61C L34 Single Cycle CPU Control I (17)

RTL: The Add Instruction 31 26 21 16 11 6 op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits add rd, rs, rt MEM[PC] Fetch the instruction from memory R[rd] = R[rs] + R[rt] The actual operation PC = PC + 4 Calculate the next instruction s address CS 61C L34 Single Cycle CPU Control I (18)

Instruction Fetch Unit at the Beginning of Add Fetch the instruction from Instruction memory: Instruction = MEM[PC] same for all instructions npc_mux_sel Inst Adr Instruction<31:> PC Ext Adder Adder CS 61C L34 Single Cycle CPU Control I (19) 4 PC

RegDst = 1 The Single Cycle path during Add RegWr = 1 busw 31 R[rd] = R[rs] + R[rt] 1 Rd Rt 5 5 26 Rs 5 Rw Ra Rb -bit Registers 16 Rt ExtOp = x busb Extender 21 busa ALUctr = Add 1 16 op rs rt rd shamt funct npc_sel= +4 In ALUSrc = 11 Instruction Fetch Unit ALU Zero Instruction<31:> Rt <21:25> 6 WrEn Rs <16:2> MemtoReg = MemWr = Adr Rd <11:15> <:15> Imm16 1 CS 61C L34 Single Cycle CPU Control I (2)

Instruction Fetch Unit at the End of Add PC = PC + 4 This is the same for all instructions except: Branch and Jump npc_mux_sel Inst Adr Instruction<31:> 4 Adder Adder 1 PC CS 61C L34 Single Cycle CPU Control I (21)

Summary: Single cycle datapath 5 steps to design a processor 1. Analyze instruction set => datapath requirements 2. Select set of datapath components & establish clock methodology 3. Assemble datapath meeting the requirements 4. Analyze implementation of each instruction to determine setting of control points that effects the register transfer. 5. Assemble the control logic Control is the hard part MIPS makes that easier Instructions same size Processor Control path Source registers always in same place Immediates same size, location Operations always on registers/immediates Input Output CS 61C L34 Single Cycle CPU Control I (23)