UC Berkeley CS61C : Machine Structures

Similar documents
CS61C : Machine Structures

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

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

CS61C : Machine Structures

361 datapath.1. Computer Architecture EECS 361 Lecture 8: 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 (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

CS61C : Machine Structures

COMP303 - Computer Architecture 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

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

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

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

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

Ch 5: Designing a Single Cycle Datapath

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

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

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

Lecture #17: CPU Design II Control

UC Berkeley CS61C : Machine Structures

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

CPU Organization (Design)

CS61C : Machine Structures

COMP303 Computer Architecture Lecture 9. Single Cycle Control

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

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

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

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

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

UC Berkeley CS61C : Machine Structures

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

UC Berkeley CS61C : Machine Structures

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

MIPS-Lite Single-Cycle Control

Major CPU Design Steps

CPU Design Steps. EECC550 - Shaaban

CS61C : Machine Structures

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 Control and Pipelining

Working on the Pipeline

Single Cycle CPU Design. Mehran Rezaei

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

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

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering

If you didn t do as well as you d hoped

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

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

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

The Processor: Datapath & Control

Clever Signed Adder/Subtractor. Five Components of a Computer. The CPU. Stages of the Datapath (1/5) Stages of the Datapath : Overview

Lecture 6 Datapath and Controller

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

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

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

Designing a Multicycle Processor

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

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

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

Chapter 4. The Processor

The MIPS Processor Datapath

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

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

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

Chapter 4. The Processor

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

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits

Processor (I) - datapath & control. Hwansoo Han

1048: Computer Organization

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

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

CENG 3420 Lecture 06: Datapath

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

Lecture 10: Simple Data Path

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

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

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

CS3350B Computer Architecture Winter 2015

CS3350B Computer Architecture Quiz 3 March 15, 2018

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

CS61C : Machine Structures

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

CpE 442. Designing a Multiple Cycle Controller

ECE260: Fundamentals of Computer Engineering

CSE140: Components and Design Techniques for Digital Systems

CN Project : Verilog implementation of MIPS processor

Chapter 4. The Processor

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

The overall datapath for RT, lw,sw beq instrucution

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

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

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

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

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

Midterm I March 1, 2001 CS152 Computer Architecture and Engineering

CS61C : Machine Structures

Chapter 4. The Processor Designing the datapath

Systems Architecture

Transcription:

inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 25 CPU Design: Designing a Single-cycle CPU Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia T-Mobile s Wi-Fi / Cell phone T-mobile just announced a new phone that can operate normally as a cell phone, but when it s near a T-mobile wireless hotspot (you could own at home), it switches to Wi-Fi & calls are FREE. Yes, FREE. CS61C L25 CPU Design : Designing a Single-Cycle CPU (1) 2006-10-27 theonlyphoneyouneed.com

Five Components of a Computer Processor Control Datapath Computer Memory (passive) (where programs, data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, data live when not running) Display, Printer CS61C L25 CPU Design : Designing a Single-Cycle CPU (2)

Datapath Summary The datapath based on data transfers required to perform instructions A controller causes the right transfers to happen PC instruction memory rd rs rt registers ALU Data memory +4 imm opcode, funct Controller CS61C L25 CPU Design : Designing a Single-Cycle CPU (3)

CPU clocking For each instruction, how do we control the flow of information though the datapath? Single Cycle CPU: All stages of an instruction are completed within one long clock cycle. The clock cycle is made sufficient long to allow each instruction to complete all stages without interruption and within one cycle. 1. Instruction Fetch 2. Decode/ Register Read 3. Execute 4. Memory 5. Reg. Write CS61C L25 CPU Design : Designing a Single-Cycle CPU (4)

Outline of Today s Lecture Design a processor: step-by-step Requirements of the Instruction Set Hardware components that match the instruction set requirements Partial Datapath in detail CS61C L25 CPU Design : Designing a Single-Cycle CPU (5)

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 CS61C L25 CPU Design : Designing a Single-Cycle CPU (6)

Review: The MIPS Instruction Formats All MIPS instructions are bits long. 3 formats: R-type I-type J-type 31 31 31 op rs rt rd shamt funct 6 bits 5 bits 5 bits 16 bits 26 op 26 21 target address 6 bits 26 bits The different fields are: op: operation ( opcode ) of the instruction rs, rt, rd: the source and destination register specifiers shamt: shift amount funct: selects the variant of the operation in the op field address / immediate: address offset or immediate value target address: target address of jump instruction 16 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits 26 21 16 op rs rt address/immediate 11 6 0 0 0 CS61C L25 CPU Design : Designing a Single-Cycle CPU (7)

Step 1a: The MIPS-lite Subset for today ADDU and SUBU 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: 31 31 31 31 beq rs,rt,imm16 26 21 16 op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits 26 21 op rs rt immediate 6 bits 5 bits 5 bits 16 bits 26 21 op rs rt immediate 6 bits 5 bits 5 bits 16 bits 26 21 op rs rt immediate 6 bits 5 bits 5 bits 16 bits 16 16 16 11 6 0 0 0 0 CS61C L25 CPU Design : Designing a Single-Cycle CPU (8)

Register Transfer Language RTL gives the meaning of the instructions {op, rs, rt, rd, shamt, funct} MEM[ PC ] {op, rs, rt, Imm16} MEM[ PC ] All start by fetching the instruction inst Register Transfers ADDU R[rd] R[rs] + R[rt]; PC PC + 4 SUBU R[rd] R[rs] R[rt]; PC PC + 4 ORI R[rt] R[rs] zero_ext(imm16); PC PC + 4 LOAD R[rt] MEM[ R[rs] + sign_ext(imm16)]; PC PC + 4 STORE MEM[ R[rs] + sign_ext(imm16) ] R[rt]; PC PC + 4 BEQ if ( R[rs] == R[rt] ) then PC PC + 4 + (sign_ext(imm16) 00) else PC PC + 4 CS61C L25 CPU Design : Designing a Single-Cycle CPU (9)

Step 1: Requirements of the Instruction Set Memory (MEM) instructions & data (will use one for each) Registers (R: x ) read RS read RT Write RT or RD PC Extender (sign/zero extend) Add/Sub/OR unit for operation on register(s) or extended immediate Add 4 or extended immediate to PC Compare registers? CS61C L25 CPU Design : Designing a Single-Cycle CPU (10)

Step 2: Components of the Datapath Combinational Elements Storage Elements Clocking methodology CS61C L25 CPU Design : Designing a Single-Cycle CPU (11)

Combinational Logic Elements (Building Blocks) Adder A B Select Adder CarryIn Sum CarryOut MUX A Y B MUX OP ALU A B ALU Result CS61C L25 CPU Design : Designing a Single-Cycle CPU (12)

ALU Needs for MIPS-lite + Rest of MIPS Addition, subtraction, logical OR, ==: ADDU R[rd] = R[rs] + R[rt];... SUBU R[rd] = R[rs] R[rt];... ORI R[rt] = R[rs] zero_ext(imm16)... BEQ if ( R[rs] == R[rt] )... Test to see if output == 0 for any ALU operation gives == test. How? P&H also adds AND, Set Less Than (1 if A < B, 0 otherwise) ALU follows chap 5 CS61C L25 CPU Design : Designing a Single-Cycle CPU (13)

Administrivia Read the book! Important to understand lecture and for project. P&H 5.1-5.4 CS61C L25 CPU Design : Designing a Single-Cycle CPU (14)

Storage Element: Idealized Memory Memory (idealized) Data In One input bus: Data In One output bus: Data Out Clk Memory word is selected by: Address selects the word to put on Data Out Write Enable = 1: address selects the memory word to be written via the Data In bus Clock input (CLK) The CLK input is a factor ONLY during write operation During read operation, behaves as a combinational logic block: Write Enable Address DataOut Address valid Data Out valid after access time. CS61C L25 CPU Design : Designing a Single-Cycle CPU (15)

Storage Element: Register (Building Block) Similar to D Flip Flop except N-bit input and output Write Enable input Write Enable: negated (or deasserted) (0): Data Out will not change Data In asserted (1): Data Out will become Data In on positive edge of clock N Write Enable clk Data Out N CS61C L25 CPU Design : Designing a Single-Cycle CPU (16)

Storage Element: Register File Register File consists of registers: Two -bit output busses: busa and busb One -bit input bus: busw Register is selected by: Clk RA (number) selects the register to put on busa (data) RB (number) selects the register to put on busb (data) RW (number) selects the register to be written via busw (data) when Write Enable is 1 Clock input (clk) The clk input is a factor ONLY during write operation During read operation, behaves as a combinational logic block: RWRA RB Write Enable 5 5 5 busw -bit Registers RA or RB valid busa or busb valid after access time. busa busb CS61C L25 CPU Design : Designing a Single-Cycle CPU (17)

Step 3: Assemble DataPath meeting requirements Register Transfer Requirements Datapath Assembly Instruction Fetch Read Operands and Execute Operation CS61C L25 CPU Design : Designing a Single-Cycle CPU (18)

3a: Overview of the Instruction Fetch Unit The common RTL operations Fetch the Instruction: mem[pc] Update the program counter: Sequential Code: PC PC + 4 Branch and Jump: PC something else clk PC Next Address Logic Address Instruction Memory Instruction Word CS61C L25 CPU Design : Designing a Single-Cycle CPU (19)

3b: Add & Subtract R[rd] = R[rs] op R[rt] Ex.: addu rd,rs,rt Ra, Rb, and Rw come from instruction s Rs, Rt, and Rd fields 31 26 21 16 11 6 ALUctr and RegWr: control logic after decoding the instruction busw Rd Rs Rt RegWr 5 5 5 clk Rw Ra Rb -bit Registers op rs rt rd shamt funct 0 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits busa busb ALUctr ALU Result Already defined the register file & ALU CS61C L25 CPU Design : Designing a Single-Cycle CPU (20)

Peer Instruction A. Our ALU is a synchronous device B. We should use the main ALU to compute PC=PC+4 C. The ALU is inactive for memory reads or writes. CS61C L25 CPU Design : Designing a Single-Cycle CPU (21) ABC 1: FFF 2: FFT 3: FTF 4: FTT 5: TFF 6: TFT 7: TTF 8: TTT

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 (hard part!) CS61C L25 CPU Design : Designing a Single-Cycle CPU (22)