Laboratory 5 Processor Datapath

Similar documents
Processor (I) - datapath & control. Hwansoo Han

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

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

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

The MIPS Processor Datapath

CENG 3420 Lecture 06: Datapath

ECE232: Hardware Organization and Design

The Processor: Datapath & Control

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

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

Chapter 4. The Processor

Single Cycle CPU Design. Mehran Rezaei

Review: Abstract Implementation View

CS3350B Computer Architecture Quiz 3 March 15, 2018

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

Chapter 4. The Processor

LECTURE 5. Single-Cycle Datapath and Control

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

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

Systems Architecture

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

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

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control

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

Inf2C - Computer Systems Lecture Processor Design Single Cycle

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

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

Chapter 4. The Processor Designing the datapath

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

Design of the MIPS Processor

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

CPE 335 Computer Organization. Basic MIPS Architecture Part I

CPE 335. Basic MIPS Architecture Part II

COMP303 Computer Architecture Lecture 9. Single Cycle Control

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

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

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

The overall datapath for RT, lw,sw beq instrucution

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

Pipeline design. Mehran Rezaei

CS61C : Machine Structures

Processor: Multi- Cycle Datapath & Control

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

CSE 378 Midterm 2/12/10 Sample Solution

CSEN 601: Computer System Architecture Summer 2014

ECE260: Fundamentals of Computer Engineering

CPU Design Steps. EECC550 - Shaaban

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

Introduction. Datapath Basics

MIPS-Lite Single-Cycle Control

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

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

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

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

CC 311- Computer Architecture. The Processor - Control

Designing a Multicycle Processor

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

Guerrilla Session 3: MIPS CPU

CPU Organization (Design)

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

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

Single Cycle Datapath

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

CSE 2021 COMPUTER ORGANIZATION

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

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

Fundamentals of Computer Systems

CS Computer Architecture Spring Week 10: Chapter

RISC Processor Design

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

CS222: Processor Design

Working on the Pipeline

Lecture #17: CPU Design II Control

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

UC Berkeley CS61C : Machine Structures

Single Cycle Datapath

Computer Architecture, IFE CS and T&CS, 4 th sem. Single-Cycle Architecture

Multiple Cycle Data Path

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

Design of the MIPS Processor (contd)

Chapter 5 Solutions: For More Practice

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

are Softw Instruction Set Architecture Microarchitecture are rdw

Chapter 4. The Processor

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

Processor (multi-cycle)

Major CPU Design Steps

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

UC Berkeley CS61C : Machine Structures

Project Description EEC 483 Computer Organization, Spring 2019

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

ECE 30, Lab #8 Spring 2014

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

COMPUTER ORGANIZATION AND DESIGN

Ch 5: Designing a Single Cycle Datapath

Single Cycle Data Path

Lecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl.

Final Exam Spring 2017

Transcription:

Laboratory 5 Processor Datapath Description of HW Instruction Set Architecture 16 bit data bus 8 bit address bus Starting address of every program = 0 (PC initialized to 0 by a reset to begin execution) PC incremented by 2 to move to the next instruction. 16 registers R0 = 0 (constant) R1 =1 (constant) R2-R15 general purpose

Instruction Set Instruction Meaning Op Rs Rt Rd 4-bit 4-bit 4-bit 4-bit LW Rs,Rt,offset Rt loaded with word from Data Memory at address(rs + offset) 0000 0-15 0-15 offset SW Rs,Rt,offset Data Memory address(rs + offset) stored with word from Rt 0001 0-15 0-15 offset ADD Rs,Rt,Rd Rd := Rs + Rt 0010 0-15 0-15 0-15 SUB Rs,Rt,Rd Rd := Rs - Rt 0011 0-15 0-15 0-15 AND Rs,Rt,Rd Rd := Rs AND Rt 0100 0-15 0-15 0-15 OR Rs,Rt,Rd Rd := Rs OR Rt 0101 0-15 0-15 0-15 BEQ Rs,Rt,offset If Rs=Rt then pc:=pc+2+(offset*2) else pc:=pc+2 0111 0-15 0-15 offset JMP offset Jump to abs. addr = offset*2 1000 ---12 bit offset-----

Instruction Fetch

Branch Address Either PC + 2 or PC + 2 + (2*offset) is the next value of the PC. On a BEQ instruction, BEQ Rs,Rt,offset The offset = number of instructions away from the next value of the PC to branch to, so must be multiplied by 2. Since offset is 4 bits, it must be sign-extended to 8 bits to be added to the PC. A 2x8 multiplexer circuit to selects the next value of the PC. The value of the Branch and Zero bits are used to determine which is used: The Branch control line = 1 if a BEQ instruction is being executed. The Zero bit from the ALU is used to check whether Rs = Rt: it is 1 if Rs Rt = 0 (meaning they re equal). If Branch = 1 and Zero = 1, then the next value of the PC will be the branch address ; otherwise, it will simply be PC + 2:

Register File and ALU R-type instructions ADD,SUB,AND,OR,SLT (opcode Rs Rt Rd) read Rs and Rt from register file perform an ALU operation on the contents of the registers write the result to register Rd in register file Memory Access instructions LW,SW (opcode Rs Rt offset) memory address = Rs + sign-extended 4-bit offset if SW, the value to be stored to memory is from Rt. if LW, Rt is loaded with the value read from memory Register written to (Write Register) is Rd or Rt if a LW instruction (chosen by a 2x4 MUX which is controlled by RegDst ) ALU calculates Rs + Rt, or Rs + sign-extended offset. - Input A of the ALU is always Rs - Input B of the ALU is Rt or the offset (chosen by a 2x16 multiplexer, which is controlled by ALUSrc):

Data Memory We need an additional memory for values loaded or stored (LW or SW) during execution of the program (the instruction memory is only used to store program instructions). RegDst (chooses whether Rd or Rt goes to the Write data input on the Regfile) If 0, destination is Rd. If 1, destination is Rt. RegWr (control line to RegFile) If 1, writes the value on the Write data input to the register specified by Write register ALUSrc (chooses the source of the second ALU operand) If 0, the operand is the second register file output. If 1, the operand is the sign-extended, lowest 4 bits of the instruction. MemRd (control signal to data memory) If 0, value stored at address in data memory is read from Read data. MemWr (control signal to data memory) If 0, data memory address written with value from Rt on the Write data input. MemtoReg (chooses the value to be written back to the Regfile) If 0, the value comes from the ALU (R-type instruction) If 1, the value comes from data memory (LW ALUop(4 bits) ALU function 0 a AND b 1 a OR b 2 a + b (add) 6 a - b 7 set on less than

ALU can perform 5 possible operations: ALUop ALU function 0 a AND b 1 a OR b 2 a + b (add) 6 a - b 7 set on less than

Need an ALU Control Unit to select the proper operation for each instruction: Instruction Opcode ALU operation ALUop LW 0 add 2 SW 1 add 2 ADD 2 add 2 SUB 3 sub 6 AND 4 and 0 OR 5 or 1 SLT 6 slt 7 BEQ 7 sub 6 JMP 8 don t care don t care Op3 Op2 Op1 Op0 ALUop3 ALUop2 ALUop1 ALUop0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 0 0 1 1 1 0 1 1 1 0 1 1 0 Can use a 3x8 decoder to produce the ALUop

Control Unit Must provide control signals for all other devices in datapath (MUXs, Regfile, Data Memory) Instruction Opcode RegDst RegWr ALUSrc MemRd MemWr MemtoReg LW 0000 1 1 1 0 1 1 SW 0001 1 0 1 1 0 0 ADD 0010 0 1 0 1 1 0 SUB 0011 0 1 0 1 1 0 AND 0100 0 1 0 1 1 0 OR 0101 0 1 0 1 1 0 SLT 0110 0 1 0 1 1 0 BEQ 0111 0 0 0 1 1 0 JMP 1000 0 0 0 1 1 0

Full Implementation Procedure to Load/Execute a New Program 1. Disconnect the address bus of the Instruction Memory from the CPU 2. Set LOAD = 0 3. Set address and data switches for instruction 4. Set WR = 0, then back to 1 5. Repeat steps 3 and 4 until all instructions are loaded to memory 6. Set LOAD = 1 7. Reconnect address bus to CPU 8. Set Reset = 1, then back to 0 9. Set CLK = 1, then back to 0, for each instruction.