Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 61C L35 Single Cycle CPU Control II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c.

Similar presentations


Presentation on theme: "CS 61C L35 Single Cycle CPU Control II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c."— Presentation transcript:

1 CS 61C L35 Single Cycle CPU Control II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 35 – Single Cycle CPU Control II 2004-04-19 Paper DVDs?!  Sony & Toppan Printing say they have developed an optical disk “mostly (51%) from paper”, which can store 5x today’s disks, because of blue lasers. cnn.com/2004/TECH/ptech/04/16/sony.toppan.reut

2 CS 61C L35 Single Cycle CPU Control II (2) Garcia, Spring 2004 © UCB °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 Source registers always in same place Immediates same size, location Operations always on registers/immediates Review: Single cycle datapath Control Datapath Memory Processor Input Output

3 CS 61C L35 Single Cycle CPU Control II (3) Garcia, Spring 2004 © UCB Single Cycle Datapath during Or Immediate? oprsrtimmediate 016212631 32 ALUctr = Clk busW RegWr = 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = Extender Mux 32 16 imm16 ALUSrc = ExtOp = Mux MemtoReg = Clk Data In WrEn 32 Adr Data Memory 32 MemWr = ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt nPC_sel = R[rt] = R[rs] OR ZeroExt[Imm16]

4 CS 61C L35 Single Cycle CPU Control II (4) Garcia, Spring 2004 © UCB 32 ALUctr = Or Clk busW RegWr = 1 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = 0 Extender Mux 32 16 imm16 ALUSrc = 1 ExtOp = 0 Mux MemtoReg = 0 Clk Data In WrEn 32 Adr Data Memory 32 MemWr = 0 ALU Instruction Fetch Unit Clk Zero Instruction R[rt] = R[rs] OR ZeroExt[Imm16] 0 1 0 1 01 Imm16RdRsRt oprsrtimmediate 016212631 nPC_sel= +4 Single Cycle Datapath during Or Immediate?

5 CS 61C L35 Single Cycle CPU Control II (5) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Load? 32 ALUctr = Clk busW RegWr = 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = Extender Mux 32 16 imm16 ALUSrc = ExtOp = Mux MemtoReg = Clk Data In WrEn 32 Adr Data Memory 32 MemWr = ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt R[rt] = Data Memory {R[rs] + SignExt[imm16]} oprsrtimmediate 016212631 nPC_sel=

6 CS 61C L35 Single Cycle CPU Control II (6) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Load 32 ALUctr = Add Clk busW RegWr = 1 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = 0 Extender Mux 32 16 imm16 ALUSrc = 1 ExtOp = 1 Mux MemtoReg = 1 Clk Data In WrEn 32 Adr Data Memory 32 MemWr = 0 ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt R[rt] = Data Memory {R[rs] + SignExt[imm16]} oprsrtimmediate 016212631 nPC_sel= +4

7 CS 61C L35 Single Cycle CPU Control II (7) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Store? oprsrtimmediate 016212631 32 ALUctr = Clk busW RegWr = 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = Extender Mux 32 16 imm16 ALUSrc = ExtOp = Mux MemtoReg = Clk Data In WrEn 32 Adr Data Memory 32 MemWr = ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt nPC_sel = Data Memory {R[rs] + SignExt[imm16]} = R[rt]

8 CS 61C L35 Single Cycle CPU Control II (8) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Store 32 ALUctr = Add Clk busW RegWr = 0 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = x Extender Mux 32 16 imm16 ALUSrc = 1 ExtOp = 1 Mux MemtoReg = x Clk Data In WrEn 32 Adr Data Memory 32 MemWr = 1 ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt Data Memory {R[rs] + SignExt[imm16]} = R[rt] oprsrtimmediate 016212631 nPC_sel= +4

9 CS 61C L35 Single Cycle CPU Control II (9) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Branch? 32 ALUctr = Clk busW RegWr = 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = Extender Mux 32 16 imm16 ALUSrc = ExtOp = Mux MemtoReg = x Clk Data In WrEn 32 Adr Data Memory 32 MemWr = ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt if (R[rs] - R[rt] == 0) then Zero = 1 ; else Zero = 0 oprsrtimmediate 016212631 nPC_sel=

10 CS 61C L35 Single Cycle CPU Control II (10) Garcia, Spring 2004 © UCB The Single Cycle Datapath during Branch 32 ALUctr =Sub Clk busW RegWr = 0 32 busA 32 busB 555 RwRaRb 32 32-bit Registers Rs Rt Rd RegDst = x Extender Mux 32 16 imm16 ALUSrc = 0 ExtOp = x Mux MemtoReg = x Clk Data In WrEn 32 Adr Data Memory 32 MemWr = 0 ALU Instruction Fetch Unit Clk Zero Instruction 0 1 0 1 01 Imm16RdRsRt if (R[rs] - R[rt] == 0) then Zero = 1 ; else Zero = 0 oprsrtimmediate 016212631 nPC_sel= “Br”

11 CS 61C L35 Single Cycle CPU Control II (11) Garcia, Spring 2004 © UCB Instruction Fetch Unit at the End of Branch if (Zero == 1) then PC = PC + 4 + SignExt[imm16]*4 ; else PC = PC + 4 oprsrtimmediate 016212631 What is encoding of nPC_sel? Direct MUX select? Branch / not branch Let’s pick 2nd option Adr Inst Memory Adder PC Clk 00 Mux 4 nPC_sel imm16 Instruction 0 1 Zero nPC_MUX_sel Q: What logic gate?

12 CS 61C L35 Single Cycle CPU Control II (12) Garcia, Spring 2004 © UCB Step 4: Given Datapath: RTL -> Control ALUctr RegDst ALUSrc ExtOp MemtoRegMemWr Zero Instruction Imm16RdRsRt nPC_sel Adr Inst Memory DATA PATH Control Op Fun RegWr

13 CS 61C L35 Single Cycle CPU Control II (13) Garcia, Spring 2004 © UCB A Summary of the Control Signals (1/2) inst Register Transfer ADDR[rd] <– R[rs] + R[rt];PC <– PC + 4 ALUsrc = RegB, ALUctr = “add”, RegDst = rd, RegWr, nPC_sel = “+4” SUBR[rd] <– R[rs] – R[rt];PC <– PC + 4 ALUsrc = RegB, ALUctr = “sub”, RegDst = rd, RegWr, nPC_sel = “+4” ORiR[rt] <– R[rs] + zero_ext(Imm16); PC <– PC + 4 ALUsrc = Im, Extop = “Z”, ALUctr = “or”, RegDst = rt, RegWr, nPC_sel =“+4” LOADR[rt] <– MEM[ R[rs] + sign_ext(Imm16)];PC <– PC + 4 ALUsrc = Im, Extop = “Sn”, ALUctr = “add”, MemtoReg, RegDst = rt, RegWr, nPC_sel = “+4” STOREMEM[ R[rs] + sign_ext(Imm16)] <– R[rs];PC <– PC + 4 ALUsrc = Im, Extop = “Sn”, ALUctr = “add”, MemWr, nPC_sel = “+4” BEQif ( R[rs] == R[rt] ) then PC <– PC + sign_ext(Imm16)] || 00 else PC <– PC + 4 nPC_sel = “Br”, ALUctr = “sub”

14 CS 61C L35 Single Cycle CPU Control II (14) Garcia, Spring 2004 © UCB A Summary of the Control Signals (2/2) addsuborilwswbeqjump RegDst ALUSrc MemtoReg RegWrite MemWrite nPCsel Jump ExtOp ALUctr 1 0 0 1 0 0 0 x Add 1 0 0 1 0 0 0 x Subtract 0 1 0 1 0 0 0 0 Or 0 1 1 1 0 0 0 1 Add x 1 x 0 1 0 0 1 x 0 x 0 0 1 0 x Subtract x x x 0 0 0 1 x xxx optarget address oprsrtrdshamtfunct 061116212631 oprsrt immediate R-type I-type J-type add, sub ori, lw, sw, beq jump func op00 0000 00 110110 001110 101100 010000 0010 Appendix A 10 0000See10 0010We Don’t Care :-)

15 CS 61C L35 Single Cycle CPU Control II (15) Garcia, Spring 2004 © UCB Administrivia Final Exam will be here! (2050 VLSB) Sat, 2004-05-22, 12:30–3:30pm 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 Friday’s lecture will be an archived webcast due to EECS faculty retreat. Feel free to watch from home… You’re responsible for the material… Project due Wednesday 11:59pm

16 CS 61C L35 Single Cycle CPU Control II (16) Garcia, Spring 2004 © UCB Review: Finite State Machine (FSM) States represent possible output values. Transitions represent changes between states based on inputs. Implement with CL and clocked register feedback.

17 CS 61C L35 Single Cycle CPU Control II (17) Garcia, Spring 2004 © UCB Finite State Machines extremely useful! They define How output signals respond to input signals and previous state. How we change states depending on input signals and previous state The output signals could be our familiar control signals Some control signals may only depend on CL, not on state at all… We could implement very detailed FSMs w/Programmable Logic Arrays

18 CS 61C L35 Single Cycle CPU Control II (18) Garcia, Spring 2004 © UCB Taking advantage of sum-of-products Since sum-of-products is a convenient notation and way to think about design, offer hardware building blocks that match that notation One example is Programmable Logic Arrays (PLAs) Designed so that can select (program) ands, ors, complements after you get the chip Late in design process, fix errors, figure out what to do later, …

19 CS 61C L35 Single Cycle CPU Control II (19) Garcia, Spring 2004 © UCB inputs AND array outputs OR array product terms Programmable Logic Arrays Pre-fabricated building block of many AND/OR gates “Programmed” or “Personalized" by making or breaking connections among gates Programmable array block diagram for sum of products form And Programming: How many inputs? How to combine inputs? How many product terms? Or Programming: How to combine product terms? How many outputs?

20 CS 61C L35 Single Cycle CPU Control II (20) Garcia, Spring 2004 © UCB example: F0 = A + B' C' F1 = A C' + A B F2 = B' C' + A B F3 = B' C + A personality matrix 1 = uncomplemented in term 0 = complemented in term – = does not participate 1 = term connected to output 0 = no connection to output input side: 3 inputs output side: 4 outputs Product inputsoutputs termABCF0F1F2F3 AB11–0110 B'C–010001 AC'1–00100 B'C'–001010 A1––1001 reuse of terms; 5 product terms Enabling Concept Shared product terms among outputs

21 CS 61C L35 Single Cycle CPU Control II (21) Garcia, Spring 2004 © UCB Before Programming All possible connections available before "programming"

22 CS 61C L35 Single Cycle CPU Control II (22) Garcia, Spring 2004 © UCB After Programming Unwanted connections are "blown" Fuse (normally connected, break unwanted ones) Anti-fuse (normally disconnected, make wanted connections)

23 CS 61C L35 Single Cycle CPU Control II (23) Garcia, Spring 2004 © UCB notation for implementing F0 = A B + A' B' F1 = C D' + C' D AB+A'B' CD'+C'D AB A'B' CD' C'D ABCD Alternate Representation Short-hand notation--don't have to draw all the wires X Signifies a connection is present and perpendicular signal is an input to gate

24 CS 61C L35 Single Cycle CPU Control II (24) Garcia, Spring 2004 © UCB Peer Instruction A. MemToReg=‘x’ & ALUctr=‘sub’. SUB or BEQ? B. ALUctr=‘add’. Which 1 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? ABC 1: SRF 2: SRT 3: SEF 4: SET 5: BRF 6: BRT 7: BEF 8: BET

25 CS 61C L35 Single Cycle CPU Control II (25) Garcia, Spring 2004 © UCB °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 Source registers always in same place Immediates same size, location Operations always on registers/immediates And in Conclusion… Single cycle control Control Datapath Memory Processor Input Output


Download ppt "CS 61C L35 Single Cycle CPU Control II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia inst.eecs.berkeley.edu/~cs61c."

Similar presentations


Ads by Google