Single Cycle CPU Design. Mehran Rezaei

Similar documents
COMP303 Computer Architecture Lecture 9. Single Cycle Control

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

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

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

MIPS-Lite Single-Cycle Control

Lecture #17: CPU Design II Control

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

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

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

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

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures

CPU Organization (Design)

CS3350B Computer Architecture Quiz 3 March 15, 2018

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

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

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

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

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

CS61C : Machine Structures

The Processor: Datapath & Control

Processor (I) - datapath & control. Hwansoo Han

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

Working on the Pipeline

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

Major CPU Design Steps

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

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

CS61C : Machine Structures

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

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

CPU Design Steps. EECC550 - Shaaban

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

The MIPS Processor Datapath

CS61C : Machine Structures

Designing a Multicycle Processor

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

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

Systems Architecture

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

UC Berkeley CS61C : Machine Structures

ECE232: Hardware Organization and Design

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

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

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

LECTURE 5. Single-Cycle Datapath and Control

CPE 335 Computer Organization. Basic MIPS Architecture Part I

Laboratory 5 Processor Datapath

CENG 3420 Lecture 06: Datapath

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

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

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

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering

CSEN 601: Computer System Architecture Summer 2014

Ch 5: Designing a Single Cycle Datapath

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

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

Pipeline design. Mehran Rezaei

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

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

CC 311- Computer Architecture. The Processor - Control

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

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

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

Lecture 6 Datapath and Controller

RISC Processor Design

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

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Systems Architecture I

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

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

Lecture 8: Control COS / ELE 375. Computer Architecture and Organization. Princeton University Fall Prof. David August

Initial Representation Finite State Diagram. Logic Representation Logic Equations

Fundamentals of Computer Systems

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

CS 351 Exam 2 Mon. 11/2/2015

CPE 335. Basic MIPS Architecture Part II

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

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

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

Lecture 7 Pipelining. Peng Liu.

Chapter 5 Solutions: For More Practice

Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu (Guest starring: Frank K. Gürkaynak and Aanjhan Ranganathan)

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón

Review: Abstract Implementation View

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

Chapter 4. The Processor

CS61C : Machine Structures

Design of the MIPS Processor

ECS 154B Computer Architecture II Spring 2009

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

ECE369. Chapter 5 ECE369

Points available Your marks Total 100

Multi-cycle Approach. Single cycle CPU. Multi-cycle CPU. Requires state elements to hold intermediate values. one clock cycle or instruction

Inf2C - Computer Systems Lecture Processor Design Single Cycle

Single Cycle Datapath

Processor (multi-cycle)

Transcription:

Single Cycle CPU Design Mehran Rezaei

What does it mean? Instruction Fetch Instruction Memory clk pc 32 32 address add $t,$t,$t2 instruction Next Logic to generate the address of next instruction

The Branch Instruction beq rs, rt, imm6 mem[pc] Fetch the instruction from memory Equal <- R[rs] == R[rt] Calculate the branch condition if (COND) Calculate the next instruction s address PC <- PC + 4 + ( SignExt(imm6) x 4 ) else PC <- PC + 4

Next addr generation branch arch if branch taken pc branch target address else pc pc + 4 instruction imm 6 extend 32 pc 4 32 32 Shift left 2 + 32 32 32 + mux pc zero extension sign extension Branch taken

... Instruction Decode/Operand Fetch Next address pc Instruction 32 RS=2 RT=3 RD=5 5 5 5 Register file 6 32 32 busa 6 busb clk add $5,$2,$3

... Execution Next address 5 32 pc Instruction 5 5 6 32 32 6 result add clk add $5,$2,$3

... Write Back Next address pc Instruction RD=5 6 6 busa busb 6 result clk busw add $5,$2,$3

... Or immediate ORI R[rt] < R[rs] zero_ext(imm6);pc < PC + 4 Next address RgDst ALUsrc 5 pc Instruction 6 5 5 32 ALU 32 ext 32 ALUop EXop

... Load LOAD R[rt] < MEM[ R[rs] + sign_ext(imm6)];pc < PC + 4 Next address RgDst ALUsrc MemtoReg pc Instruction ALU Read data ext ALUop EXop MemRead

... Store STORE MEM[ R[rs] + sign_ext(imm6) ] < R[rt];PC < PC + 4 Next address RgDst ALUsrc MemWrite MemtoReg pc Instruction ALU Write data Read data ext ALUop EXop MemRead

... BEQ if ( R[rs] == R[rt] ) then PC < PC + 4 + [sign_ext(imm6) ] else PC < PC + 4 4 + Branch Shift Left 2 + RgDst ALUsrc MemWrite MemtoReg zero pc Instruction ALU Write data Read data ext ALUop cp EXop MemRead

4 Shift Left 2 Branch pc Opcode Instruction ExtOp Cont Unit RegWrite RegDst Read Addr Read Addr2 Write Addr Write Data ALUSrc Read Data Read Data2 MemWrite OVF Zero ALUCtr MemtoReg Write Data MemRead Read Data Funct Extension ALUOp ALU Cont

4 Shift Left 2 Branch pc Opcode Instruction ExtOp Cont Unit RegWrite RegDst Read Addr Read Addr2 Write Addr Write Data ALUSrc Read Data Read Data2 MemWrite OVF Zero or ALUCtr MemtoReg Write Data MemRead Read Data Funct Extension ALUOp ALU Cont ORI R[rt] < R[rs] zero_ext(imm6);pc < PC + 4

An Abstract View Inst. Mem Control Unit Instruction<3:> Datapath

4 Shift Left 2 Branch pc Instruction Opcode ExtOp Cont Unit RegWrite ALUSrc RegDst Read Addr Read Addr2 Write Addr Write Data Read Data Read Data2 MemWrite OVF Zero ALUCtr MemtoReg MemRead Write Data Rea d Data Extension ALUOp Funct ALU Cont

The control system alone Branch Opcode Cont Unit RegWrite ALUSrc MemWrite MemtoReg MemRead RegDst ExtOp ALUCtr ALUOp Funct ALU Cont

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

The Concept of Local Decoding op R-type ori lw sw beq addi RegDst ALUSrc MemtoReg RegWrite MemWrite Branch Jump ExtOp ALUop<N:> x R-type Or Add x x Add x x x Subtract Add op 6 Main Control func 6 ALUop 3 ALU Control (Local) ALUctr 3 ALU

PLA Implementation of the Main Control minus ALUop... <>.. <>.. <>.. <>. <>.. op<> R-type ori lw sw beq addi RegWrite ALUSrc RegDst MemtoReg MemWrite Branch ExtOp

The Truth Table for the Main Control op 6 Main Control RegDst ALUSrc MemtoReg RegWrite MemWrite Branch Jump ExtOp ALUop (Symbolic) RegDst ALUSrc : ALUop 3 func 6 ALU Control (Local) ALUctr 3 op R-type ori lw sw beq addi x x x x x x R-type Or Add Add Subtract Add ALUop <2> ALUop <> ALUop <>

The Truth Table for RegWrite op RegWrite = R-type + ori + lw + addi R-type ori lw sw beq addi RegWrite =! &!op<4> &!op<3> &!op<2> &!op<> &!op<> (R-type) +! &!op<4> & op<3> & op<2> &!op<> & op<> (ori) + &!op<4> &!op<3> &!op<2> & op<> & op<> (lw) +! &!op<4> & op<3> & &!op<2> &!op<> &!op<> (addi).... <> <>.. <>.. <>.. <>.. op<> R-type ori lw sw beq addi RegWrite

PLA Implementation of the Main Control.......... <> <> <> <> <>.. op<> R-type ori lw sw beq addi RegWrite ALUSr c RegDst MemtoReg MemWrite Branch ExtOp ALUop<2> ALUop<> ALUop<>

The ALU control system ALUctr 3 6 Function ALU Control 3 ALUopt

ALU control unit s truth table + + output input input operation TYPE ALUctr ALUopt opcode function ADD R "" "" "" "" ADD I "" "" addi+lw +sw XXXXXXX SUB R "" "" "" "" SUB I "" "" beq+bne XXXXXXX OR R "" "" "" "" OR I "" "" "" XXXXXXX AND R "" "" "" "" SLT R "" "" "" "" + Not part of the table

ALU control unit s truth table (cont d) Input Output operation TYPE ALUopt function ALUctr ADD R ADD I XXXXXXX SUB R SUB I XXXXXXX OR R OR I XXXXXXX AND R SLT R

ALU control unit s truth table (cont d) Input Output operation TYPE ALUopt function ALUctr ADD R SUB R OR R AND R SLT R ADD I XXXXXXX SUB I XXXXXXX OR I XXXXXXX

The logic of ALU control unit 6 Function X 3 3 3 3 ALUctr ALUopt ALUopt<2> ALU Control

X truth table operation function ALUctr ADD "" "" SUB "" "" OR "" "" AND "" "" SLT "" "" ALUctr<2> = F<5> &!F<4> &!F<> (!F<3> & F<2> &!F<> + F<3> &!F<2> & F<>) ALUctr<> = ALUctr<2> + F<5> &!F<4> &!F<3> & F<2> &!F<> & F<> ALUctr<> = F<5> &!F<4> &!F<2> & F<> &!F<>