UC Berkeley CS61C : Machine Structures

Similar documents
UC Berkeley CS61C : Machine Structures

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

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

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

Lecture #17: CPU Design II Control

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

COMP303 Computer Architecture Lecture 9. Single Cycle Control

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

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

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

CS61C : Machine Structures

CS61C : Machine Structures

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

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

MIPS-Lite Single-Cycle Control

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

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

Working on the Pipeline

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

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

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

Single Cycle CPU Design. Mehran Rezaei

CS61C : Machine Structures

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

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

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

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

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

CPU Organization (Design)

UC Berkeley CS61C : Machine Structures

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

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

CPU Design Steps. EECC550 - Shaaban

The Processor: Datapath & Control

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

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

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

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

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

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering

Designing a Multicycle Processor

Major CPU Design Steps

Lecture 6 Datapath and Controller

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

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

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

CS61C : Machine Structures

CS3350B Computer Architecture Quiz 3 March 15, 2018

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

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

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

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

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

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

CpE 442. Designing a Multiple Cycle Controller

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

Ch 5: Designing a Single Cycle Datapath

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

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

The MIPS Processor Datapath

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

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

CS 110 Computer Architecture Review Midterm II

Guerrilla Session 3: MIPS CPU

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

CPSC614: Computer Architecture

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

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

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

ECE4680 Computer Organization and Architecture. Designing a Pipeline Processor

CS61c Final Review Fall Andy Carle 12/12/2004

If you didn t do as well as you d hoped

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

CENG 3420 Lecture 06: Datapath

Processor (I) - datapath & control. Hwansoo Han

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

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

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

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

Laboratory 5 Processor Datapath

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

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

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

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

Pipeline design. Mehran Rezaei

Midterm I March 1, 2001 CS152 Computer Architecture and Engineering

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

Lecture 7 Pipelining. Peng Liu.

Initial Representation Finite State Diagram Microprogram. Sequencing Control Explicit Next State Microprogram counter

CPE 335 Computer Organization. Basic MIPS Architecture Part I

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

LECTURE 5. Single-Cycle Datapath and Control

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

Systems Architecture

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

CN Project : Verilog implementation of MIPS processor

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

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

CPU Organization Datapath Design:

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

Transcription:

inst.eecs.berkeley.edu/~cs6c UC Berkeley CS6C : Machine Structures Lecture 26 Single-cycle CPU Control 27-3-2 Exhausted TA Ben Sussman www.icanhascheezburger.com Qutrits Bring Quantum Computers Closer: An Australian group has built and tested logic gates that convert qubits into qutrits (three-level quantum states)! But who cares: new iphones soon? Ben hopes so CS6C L27 Single-Cycle CPU Control () www.slashdot.org

Review: A Single Cycle Datapath We have everything except control signals RegDst Rd RegWr busw 5 imm6 npc_sel Rt Rs Rt 5 5 Rw Ra Rb RegFile 6 Extender busa busb instr fetch unit zero Instruction<3:> <2:25> Rs ALUctr = ALU Data In <6:2> Rt MemWr <:5> Rd WrEn Adr <:5> Data Imm6 MemtoReg CS6C L27 Single-Cycle CPU Control (2) ExtOp ALUSrc

Recap: Meaning of the Control Signals npc_sel: +4 PC < PC + 4 n =next br PC < PC + 4 + {SignExt(Im6), } Later in lecture: higher-level connection between mux and branch condition 4 PC Ext Adder Adder npc_sel Mux PC Inst Address CS6C L27 Single-Cycle CPU Control (3) imm6

Recap: Meaning of the Control Signals ExtOp: zero, sign ALUsrc: regb; MemWr: write memory MemtoReg: ALU; Mem immed RegDst: rt ; rd ALUctr: ADD, SUB, OR RegWr: write register RegDst RegWr busw Rd 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp Extender busa busb ALUSrc ALUctr MemtoReg MemWr ALU Data In WrEn Adr Data CS6C L27 Single-Cycle CPU Control (4)

RTL: The Add Instruction 3 26 2 6 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 CS6C L27 Single-Cycle CPU Control (5)

Instruction Fetch Unit at the Beginning of Add Fetch the instruction from Instruction memory: Instruction = MEM[PC] same for all instructions Inst Instruction<3:> 4 PC Ext Adder Adder npc_sel PC Mux Inst Address imm6 CS6C L27 Single-Cycle CPU Control (6)

The Single Cycle Datapath during Add 3 26 2 6 op rs rt rd shamt funct R[rd] = R[rs] + R[rt] RegDst= Rd RegWr= busw npc_sel=+4 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp=x Extender busa busb instr fetch unit zero 6 ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr=ADD MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (7)

Instruction Fetch Unit at the End of Add PC = PC + 4 This is the same for all instructions except: Branch and Jump Inst 4 PC Ext npc_sel=+4 Adder Adder PC Mux Inst Address imm6 CS6C L27 Single-Cycle CPU Control (8)

Single Cycle Datapath during Or Immediate? 3 26 2 6 op rs rt immediate R[rt] = R[rs] OR ZeroExt[Imm6] RegDst= Rd RegWr= busw npc_sel= 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp= Extender busa busb instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr= MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (9)

Single Cycle Datapath during Or Immediate? 3 26 2 op rs rt immediate R[rt] = R[rs] OR ZeroExt[Imm6] RegDst= Rd RegWr= busw npc_sel=+4 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp=zero Extender busa busb 6 instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr=OR MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control ()

The Single Cycle Datapath during Load? 3 26 2 6 op rs rt immediate R[rt] = Data {R[rs] + SignExt[imm6]} RegDst= Rd RegWr= busw npc_sel= 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp= Extender busa busb instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr= MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control ()

The Single Cycle Datapath during Load 3 26 2 6 op rs rt immediate R[rt] = Data {R[rs] + SignExt[imm6]} RegDst= Rd RegWr= busw npc_sel=+4 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp=sign Extender busa busb instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr=ADD MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (2)

The Single Cycle Datapath during Store? 3 26 2 6 op rs rt immediate Data {R[rs] + SignExt[imm6]} = R[rt] RegDst= Rd RegWr= busw npc_sel= 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp= Extender busa busb instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr= MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (3)

The Single Cycle Datapath during Store 3 26 2 op rs rt immediate Data {R[rs] + SignExt[imm6]} = R[rt] RegDst=x Rd RegWr= busw npc_sel=+4 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp=sign Extender busa busb 6 instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr=ADD MemtoReg=x = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (4)

The Single Cycle Datapath during Branch? 3 26 2 op rs rt immediate if (R[rs] - R[rt] == ) then Zero = ; else Zero = RegDst= Rd RegWr= busw npc_sel= 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp= Extender busa busb 6 instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr= MemtoReg= = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (5)

The Single Cycle Datapath during Branch 3 26 2 op rs rt immediate if (R[rs] - R[rt] == ) then Zero = ; else Zero = RegDst=x Rd RegWr= busw npc_sel=br 5 Rt imm6 Rs Rt 5 5 Rw Ra Rb RegFile 6 ExtOp=x Extender busa busb 6 instr fetch unit zero ALUSrc= Instruction<3:> <2:25> Rs Rt Rd Imm6 ALUctr=SUB MemtoReg=x = ALU Data In <6:2> <:5> MemWr= WrEn Adr <:5> Data CS6C L27 Single-Cycle CPU Control (6)

Instruction Fetch Unit at the End of Branch if (Zero == ) then PC = PC + 4 + SignExt[imm6]*4 ; else PC = PC + 4 npc_sel Zero imm6 4 PC Ext 3 26 op rs rt immediate Adder Adder MUX npc_sel ctrl Mux CS6C L27 Single-Cycle CPU Control (7) 2 Inst PC Adr 6 Instruction<3:> What is encoding of npc_sel? Direct MUX select? Branch inst. / not branch Letʼs pick 2nd option npc_sel zero? MUX x Q: What logic gate?

Administrivia Sorry about Proj woes Grading is rough stuff. Donʼt blame Ben, heʼs innocent. HW6 Due imminently! Students have claimed it takes a very long time Remember MODULAR DESIGN. This could save you a lot of time. HW7 Out Now! Get started soon. Proj3 is on its way, will be out soon after the weekend. CS6C L27 Single-Cycle CPU Control (8)

Step 4: Given Datapath: RTL Control Instruction<3:> Inst Adr <26:3> Op <:5> Fun Rt <2:25> <:5> <:5> <6:2> Rs Rd Imm6 Control npc_sel RegWrRegDstExtOpALUSrcALUctr MemWr MemtoReg DATA PATH CS6C L27 Single-Cycle CPU Control (9)

inst A Summary of the Control Signals (/2) Register Transfer add R[rd] R[rs] + R[rt]; PC PC + 4 ALUsrc = RegB, ALUctr = ADD, RegDst = rd, RegWr, npc_sel = +4 sub R[rd] R[rs] R[rt]; PC PC + 4 ALUsrc = RegB, ALUctr = SUB, RegDst = rd, RegWr, npc_sel = +4 ori R[rt] R[rs] + zero_ext(imm6); PC PC + 4 ALUsrc = Im, Extop = Z,ALUctr = OR, RegDst = rt,regwr, npc_sel = +4 lw R[rt] MEM[ R[rs] + sign_ext(imm6)];pc PC + 4 ALUsrc = Im, Extop = sn, ALUctr = ADD, MemtoReg, RegDst = rt, RegWr, npc_sel = +4 sw MEM[ R[rs] + sign_ext(imm6)] R[rs];PC PC + 4 ALUsrc = Im, Extop = sn, ALUctr = ADD, MemWr, npc_sel = +4 beq if ( R[rs] == R[rt] ) then PC PC + sign_ext(imm6)] else PC PC + 4 npc_sel = br, ALUctr = SUB CS6C L27 Single-Cycle CPU Control (2)

A Summary of the Control Signals (2/2) See func We Don t Care :-) Appendix A op add sub ori lw sw beq jump RegDst ALUSrc MemtoReg RegWrite MemWrite npcsel Jump ExtOp ALUctr<2:> x Add x Subtract Or Add x x Add x x x Subtract x x x? x x R-type 3 26 2 6 6 op rs rt rd shamt funct add, sub I-type op rs rt immediate ori, lw, sw, beq J-type op target address jump CS6C L27 Single-Cycle CPU Control (2)

Boolean Expressions for Controller RegDst = add + sub ALUSrc = ori + lw + sw MemtoReg = lw RegWrite = add + sub + ori + lw MemWrite = sw npcsel = beq Jump = jump ExtOp = lw + sw ALUctr[] = sub + beq (assume ALUctr is ADD, : SUB, : OR) ALUctr[] = or where, rtype = ~op 5 ~op 4 ~op 3 ~op 2 ~op ~op, ori = ~op 5 ~op 4 op 3 op 2 ~op op lw = op 5 ~op 4 ~op 3 ~op 2 op op sw = op 5 ~op 4 op 3 ~op 2 op op beq = ~op 5 ~op 4 ~op 3 op 2 ~op ~op jump = ~op 5 ~op 4 ~op 3 ~op 2 op ~op add = rtype func 5 ~func 4 ~func 3 ~func 2 ~func ~func sub = rtype func 5 ~func 4 ~func 3 ~func 2 func ~func How do we implement this in gates? CS6C L27 Single-Cycle CPU Control (22)

Controller Implementation opcode func AND logic add sub ori lw sw beq jump OR logic RegDst ALUSrc MemtoReg RegWrite MemWrite npcsel Jump ExtOp ALUctr[] ALUctr[] CS6C L27 Single-Cycle CPU Control (23)

Peer Instruction Instruction<3:> npc_sel Instruction Rd Rt Fetch Unit Clk RegDst Mux Rs Rt Rt Rs Rd Imm6 RegWr 5 5 5 ALUctr Zero busa MemWr MemtoReg Rw Ra Rb busw -bit Registers busb Clk WrEn Adr Data In imm6 6 Data Clk ALUSrc Extender ExtOp A. MemToReg=ʻxʼ & ALUctr=ʻsubʼ. SUB or BEQ? B. ALUctr=ʻaddʼ. Which signal is different for all 3 of: ADD, LW, & SW? RegDst or ExtOp? C. Donʼt Care signals are useful because we can simplify our PLA personality matrix. F / T? Mux ALU <2:25> <6:2> <:5> <:5> Mux ABC : SRF : SRT 2: SEF 3: SET 4: BRF 5: BRT 6: BEF 7: BET CS6C L27 Single-Cycle CPU Control (24)

Summary: Single-cycle Processor 5 steps to design a processor. 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 Formulate Logic Equations Design Circuits Processor Control Input Datapath Output CS6C L27 Single-Cycle CPU Control (25)

Bonus slides These are extra slides that used to be included in lecture notes, but have been moved to this, the bonus area to serve as a supplement. The slides will appear in the order they would have in the normal presentation CS6C L27 Single-Cycle CPU Control (26)

J-type The Single Cycle Datapath during Jump 3 op Jump= Instruction<3:> npc_sel= Instruction Rd Rt Fetch Unit RegDst = Clk Mux RegWr = Rs Rt ALUctr = Rt Rs Rd Imm6 TA26 5 5 5 MemtoReg = busa Zero MemWr = Rw Ra Rb busw -bit Registers busb Clk WrEnAdr imm6 26 25 6 Extender target address New PC = { PC[3..28], target address, } Mux ALUSrc = ALU Data In Clk <2:25> <6:2> Data <:5> jump <:5> Mux <:25> ExtOp = CS6C L27 Single-Cycle CPU Control (27)

The Single Cycle Datapath during Jump J-type 3 op Jump= Instruction<3:> npc_sel=? Instruction Rd Rt Fetch Unit RegDst = x Clk Mux RegWr = Rs Rt ALUctr =x Rt Rs Rd Imm6 TA26 5 5 5 MemtoReg = x busa Zero MemWr = Rw Ra Rb busw -bit Registers busb Clk WrEnAdr imm6 26 25 6 Extender target address New PC = { PC[3..28], target address, } Mux ALUSrc = x ALU Data In Clk <2:25> <6:2> Data <:5> jump <:5> Mux <:25> ExtOp = x CS6C L27 Single-Cycle CPU Control (28)

Instruction Fetch Unit at the End of Jump J-type New PC = { PC[3..28], target address, } Jump npc_sel Zero 3 op 26 25 Inst Adr target address Instruction<3:> jump npc_mux_sel 4 imm6 Adder Adder Mux PC Clk How do we modify this to account for jumps? CS6C L27 Single-Cycle CPU Control (29)

Instruction Fetch Unit at the End of Jump J-type New PC = { PC[3..28], target address, } Jump npc_sel Zero 3 op 26 25 target address Inst Adr jump Instruction<3:> 4 npc_mux_sel TA 26 Query Can Zero still get asserted? imm6 Adder Adder Mux 4 (MSBs) Mux PC Clk Does npc_sel need to be? If not, what? CS6C L27 Single-Cycle CPU Control (3)