EECE476 Lecture 6: Designing a Single-Cycle CPU Datapath Chapter 5, Sections 5.2, 5.3 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.

Slides:



Advertisements
Similar presentations
Datorteknik DatapathControl bild 1 Designing a Single Cycle Datapath & Datapath Control.
Advertisements

EECE476 Lecture 7: Single-Cycle CPU Instruction Processing & Control Chapter 5, Sections 5.3, 5.4 The University of British ColumbiaEECE 476© 2005 Guy.
CS152 Lec9.1 CS152 Computer Architecture and Engineering Lecture 9 Designing Single Cycle Control.
361 datapath Computer Architecture Lecture 8: Designing a Single Cycle Datapath.
The Processor: Datapath & Control
CS61C L19 CPU Design : Designing a Single-Cycle CPU (1) Beamer, Summer 2007 © UCB Scott Beamer Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L20 Single-Cycle CPU Control (1) Beamer, Summer 2007 © UCB Scott Beamer Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture.
Savio Chau Single Cycle Controller Design Last Time: Discussed the Designing of a Single Cycle Datapath Control Datapath Memory Processor (CPU) Input Output.
Ceg3420 control.1 ©UCB, DAP’ 97 CEG3420 Computer Design Lecture 9.2: Designing Single Cycle Control.
CS61C L25 Single Cycle CPU Datapath (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
ECE 232 L13. Control.1 ©UCB, DAP’ 97 ECE 232 Hardware Organization and Design Lecture 13 Control Design
CS61C L25 CPU Design : Designing a Single-Cycle CPU (1) Garcia, Fall 2006 © UCB T-Mobile’s Wi-Fi / Cell phone  T-mobile just announced a new phone that.
CS 61C L17 Control (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #17: CPU Design II – Control
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 25 CPU design (of a single-cycle CPU) Intel is prototyping circuits that.
CS61C L25 CPU Design : Designing a Single-Cycle CPU (1) Garcia, Spring 2007 © UCB Google Summer of Code  Student applications are now open (through );
EECC550 - Shaaban #1 Lec # 4 Winter Major CPU Design Steps 1Using independent RTN, write the micro- operations required for all target.
EEM 486: Computer Architecture Lecture 3 Designing a Single Cycle Datapath.
CS61C L27 Single-Cycle CPU Control (1) Garcia, Spring 2010 © UCB inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 27 Single-cycle.
CS 61C L16 Datapath (1) A Carle, Summer 2004 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #16 – Datapath Andy.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single-Cycle CPU Datapath Control Part 1 Guest Lecturer: Sagar Karandikar.
361 control Computer Architecture Lecture 9: Designing Single Cycle Control.
ECE 232 L12.Datapath.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 12 Datapath.
CS61C L27 Single Cycle CPU Control (1) Garcia, Fall 2006 © UCB Wireless High Definition?  Several companies will be working on a “WirelessHD” standard,
CS3350B Computer Architecture Winter 2015 Lecture 5.6: Single-Cycle CPU: Datapath Control (Part 1) Marc Moreno Maza [Adapted.
55:035 Computer Architecture and Organization Lecture 9.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Designing a Single Cycle Datapath In this lecture, slides from lectures 3, 8 and 9 from the course Computer Architecture ECE 201 by Professor Mike Schulte.
EEM 486: Computer Architecture Designing a Single Cycle Datapath.
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
CS2100 Computer Organisation The Processor: Datapath (AY2015/6) Semester 1.
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
CPE 442 single-cycle datapath.1 Intro. To Computer Architecture CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath.
W.S Computer System Design Lecture 4 Wannarat Suntiamorntut.
CS3350B Computer Architecture Winter 2015 Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2) Marc Moreno Maza [Adapted.
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
Introduction to Computer Organization and Architecture Lecture 11 By Juthawut Chantharamalee wut_cha/home.htm.
By Wannarat Computer System Design Lecture 4 Wannarat Suntiamorntut.
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.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Csci 136 Computer Architecture II –Single-Cycle Datapath Xiuzhen Cheng
EEM 486: Computer Architecture Lecture 3 Designing Single Cycle Control.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single-Cycle CPU Datapath & Control Part 2 Instructors: Krste Asanovic & Vladimir Stojanovic.
Single Cycle Controller Design
CS 110 Computer Architecture Lecture 11: Single-Cycle CPU Datapath & Control Instructor: Sören Schwertfeger School of Information.
CS 61C: Great Ideas in Computer Architecture MIPS Datapath 1 Instructors: Nicholas Weaver & Vladimir Stojanovic
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Access the Instruction from Memory
Computer Architecture
IT 251 Computer Organization and Architecture
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
Datapath & Control MIPS
Topic 5: Processor Architecture Implementation Methodology
The Processor Lecture 3.2: Building a Datapath with Control
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Instructors: Randy H. Katz David A. Patterson
CS/COE0447 Computer Organization & Assembly Language
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

EECE476 Lecture 6: Designing a Single-Cycle CPU Datapath Chapter 5, Sections 5.2, 5.3 The University of British ColumbiaEECE 476© 2005 Guy Lemieux

2 Overview Brief look –Digital logic How to Design a CPU Datapath –MIPS Example

3 Digital Logic DQ D-type Flip-flop Clock (edge- triggered) S (Select input) A B F 0 1 Multiplexer D-type Flip-flop with Enable Clock (edge- triggered) DQ EN 0 1 DQ D Q (enable) Clock (edge- triggered)

4 Digital Logic 1 Bit DQ Clock (edge- triggered) EN 4 Bits Clock (edge- triggered) D3Q3 EN D2Q2 D1Q1 D0Q0 Registers N Bits DQ Clock (edge- triggered) EN

5 Digital Logic out in drive Tri-state Driver (Buffer) InDriveOut 00Z 10Z What is Z ??

6 Digital Logic Adder/Subtractor or ALU A B F Carry-out Add/sub or ALUop Carry-in

7 A Computer: ‘add r1,r0’ Behaviour: R1 ← R1 + R0 Operations: T ← R1 S ← R0 R1 ← T + S T,S are temp registers Register Transfer Language (RTL) DQ EN DQ DQ DQ R0 R1 T S driveR0 driveR1 driveALU loadR0 loadR1 loadT loadS

8 A Computer ‘add r2,r1,r0’ Behaviour: R2 ← R1 + R0 Operations: T ← R1 S ← R0 R2 ← T + S T,S are temp registers Register Transfer Language (RTL) DQ EN DQ DQ DQ R0 R1 T S driveR0 driveR1 driveALU loadR0 loadR1 loadT loadS DQ EN R2 driveR2 loadR2

9 Overview Brief look –Digital logic How to Design a CPU Datapath –MIPS Example

10 Designing a CPU: 5 Steps 1.Analyse the instruction set  datapath requirements –MIPS: ADD, SUB, ORI, LW, SW, BR –Meaning of each instruction given by RTL (register transfers) –2 types of registers: CPU/ISA registers, temporary registers 2.Datapath requirements  select the datapath components –ALU, register file, adder, data memory, etc 3.Assemble the datapath –Datapath must support planned register transfers –Ensure all instructions are supported 4.Analyse datapath control required for each instruction 5.Assemble the control logic Today, we’ll examine only Steps 1..3 Like good software development, there is overlap and iteration between the steps (successive refinement)!

11 Step 1a: Analyse ISA All MIPS instructions are 32 bits long. Three instruction formats: –R-type –I-type –J-type R: registers, I: immediate, J: jumps These formats intentionally chosen to simplify design optarget address bits26 bits oprsrtrdshamtfunct bits 5 bits oprsrt immediate bits16 bits5 bits

12 Step 1b: Analyse ISA Meaning of the fields: –op: operation of the instruction –rs, rt, rd: the source and destination register specifiers Destination is either rd (R-type), or rt (I-type) –shamt: shift amount –funct: selects the variant of the operation in the “op” field –immediate: address offset or immediate value –target address: target address of the jump instruction optarget address bits26 bits oprsrtrdshamtfunct bits 5 bits oprsrt immediate bits16 bits5 bits R-type I-type J-type

13 MIPS ISA: subset for today ADD and SUB –addU rd, rs, rt –subU rd, rs, rt OR Immediate: –ori rt, rs, imm16 LOAD and STORE Word –lw rt, rs, imm16 –sw rt, rs, imm16 BRANCH: –beq rs, rt, imm16 oprsrtrdshamtfunct bits 5 bits oprsrtimmediate bits16 bits5 bits oprsrtimmediate bits16 bits5 bits oprsrtimmediate bits16 bits5 bits

14 Step 2: Datapath Requirements REGISTER FILE MIPS ISA requires 32 registers, 32b each –Called a register file –Contains 32 entries –Each entry is 32b AddU rd,rs,rt or SubU rd,rs,rt –Read two sources rs, rt –Operation rs + rt or rs – rt –Write destination rd ← rs+/-rt Requirements –Read two registers (rs, rt) –Perform ALU operation –Write a third register (rd) RdReg1 RdReg2 WrReg WrData RdData1 RdData2 RegWrite REGFILE Register Numbers (5 bits ea) How to implement? ALU ALUop Result Zero?

15 Step 3: Datapath Assembly ADDU rd, rs, rtSUBU rd, rs, rt –Need an ALU Hook it up to REGISTER FILE REGFILE has 2 read ports (rs,rt), 1 write port (rd) RdReg1 RdReg2 WrReg WrData RdData1 RdData2 RegWrite REGFILE rs ALU ALUop Result Zero? Parameters Come From Instruction Fields rt rd Control Signals Depend Upon Instruction Fields Eg: ALUop = f(Instruction) = f(op, funct)

16 Steps 2 and 3: Datapath Components & Assembly, ORI Instruction ORI rt, rs, Imm16 –Need new ALUop for ‘OR’ function, hook up to REGFILE –1 read port (rs), 1 write port (rt), 1 const value (Imm16) RdReg1 RdReg2 WrReg WrData RdData1 RdData2 RegWrite REGFILE rs From Instruction rt rt rd ZERO- EXTEND ALU ALUop Result Zero? 16-bits Imm16 ALUsrc 0 1 X Control Signals Depend Upon Instruction Fields Eg: ALUsrc = f(Instruction) = f(op, funct)

17 Steps 2 and 3: Datapath Components & Assembly Must select proper destination, rd or rt –Depends on Instruction Type R-type may write rd I-type may write rt RdReg1 RdReg2 WrReg WrData RdData1 RdData2 REGFILE rs From Instruction rt rd ZERO- EXTEND ALU ALUop Result Zero? ALUsrc 0 1 RegDst bits Imm16 RegWrite

18 Steps 2 and 3: Datapath Components & Assembly LW rt, rs, Imm16 –Need Data Memory:data ← Mem[Addr] Addr is rs+Imm16, Imm16 is signed, use ALU for + –Store in rt:rt ← Mem[rs+Imm16] RdReg1 RdReg2 WrReg WrData RdData1 RdData2 REGFILE rs rt rd SIGN/ ZERO- EXTEND ALU ALUop Result Zero? ALUsrc 0 1 RegDst 1 0 Imm16 RegWrite Addr RdData MemtoReg 0 1 DATAMEM ExtOp

19 Steps 2 and 3: Datapath Components & Assembly SW rt, rs, Imm16 –Need Data Memory:Mem[Addr] ← data Addr is rs+Imm16, Imm16 is signed, use ALU for + –Store in Mem:Mem[rs+Imm16] ← rt RdReg1 RdReg2 WrReg WrData RdData1 RdData2 REGFILE rs rt rd SIGN/ ZERO- EXTEND ALU ALUop Result Zero? ALUsrc 0 1 RegDst 1 0 Imm16 RegWrite Addr RdData WrData MemtoReg 1 0 DATAMEM ExtOp MemWrite

20 Writes: Be Careful! Control Signal Timing Problem: write to data memory –Data can come anytime –Addr must come first –MemWrite must come after Addr Else? writes to wrong Addr! Solution: use ideal data memory –Assume everything works ok –How to fix this for real? –One solution: synchronous memory –Another solution: delay MemWr to come late Problems?: write to register file –Does RegWrite signal come after WrReg number? –When does the write to a register happen? –Read from same register as being written?