Designing MIPS Processor (Single-Cycle) Presentation G

Slides:



Advertisements
Similar presentations
331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
Advertisements

The Processor: Datapath & Control
1  1998 Morgan Kaufmann Publishers Chapter Five The Processor: Datapath and Control.
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
331 W9.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 9 Building a Single-Cycle Datapath [Adapted from Dave Patterson’s.
331 Lec 14.1Fall 2002 Review: Abstract Implementation View  Split memory (Harvard) model - single cycle operation  Simplified to contain only the instructions:
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
Chapter Five The Processor: Datapath and Control.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:
Chapter 4 Sections 4.1 – 4.4 Appendix D.1 and D.2 Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Processor: Datapath and Control
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
CS2100 Computer Organisation
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
MIPS processor continued. In Class Exercise Question Show the datapath of a processor that supports only R-type and jr reg instructions.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
MIPS processor continued
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.
May 22, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 14: A Simple Implementation of MIPS * Jeremy R. Johnson Mon. May 17, 2000.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Single-cycle CPU Control
Access the Instruction from Memory
EE204 Computer Architecture
CS Computer Architecture Week 10: Single Cycle Implementation
Single Cycle CPU - Control
CS161 – Design and Architecture of Computer Systems
Electrical and Computer Engineering University of Cyprus
CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
Basic MIPS Architecture
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for Single-Cycle Instruction Execution
MIPS processor continued
CSCI206 - Computer Organization & Programming
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
Design of the Control Unit for One-cycle Instruction Execution
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
Datapath & Control MIPS
Topic 5: Processor Architecture Implementation Methodology
Rocky K. C. Chang 6 November 2017
Composing the Elements
Composing the Elements
The Processor Lecture 3.2: Building a Datapath with Control
Topic 5: Processor Architecture
Systems Architecture I
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 14: Single Cycle MIPS Processor
Processor: Multi-Cycle Datapath & Control
Computer Architecture Processor: Datapath
Chapter Four The Processor: Datapath and Control
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
Processor: Datapath and Control
ELEC / Computer Architecture and Design Spring 2015 Pipeline Control and Performance (Chapter 6) Vishwani D. Agrawal James J. Danaher.
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Designing MIPS Processor (Single-Cycle) Presentation G CSE 675.02: Introduction to Computer Architecture Designing MIPS Processor (Single-Cycle) Presentation G Slides by Gojko Babić 08/01/2005

Introduction We're now ready to look at an implementation of the system that includes MIPS processor and memory. The design will include support for execution of only: memory-reference instructions: lw & sw, arithmetic-logical instructions: add, sub, and, or, slt & nor, control flow instructions: beq & j, exception handling: illegal instruction & overflow. But that design will provide us with principles, so many more instructions could be easily added such as: addu, lb, lbu, lui, addi, adiu, sltu, slti, andi, ori, xor, xori, jal, jr, jalr, bne, beqz, bgtz, bltz, nop, mfhi, mflo, mfepc, mfco, lwc1, swc1, etc. g. babic Presentation G

Single Cycle Design We shall first design a simpler processor that executes each instruction in only one clock cycle time. This is not efficient from performance point of view, since: a clock cycle time (i.e. clock rate) must be chosen such that the longest instruction can be executed in one clock cycle and that makes shorter instructions execute in one unnecessary long cycle. Additionally, no resource in the design may be used more than once per instruction, thus some resources will be duplicated. Because of that, the singe cycle design will require: two memories (instruction and data), two additional adders. g. babic Presentation G

Elements for Datapath Design C a . r o g m c u n t e 32 M e m R a d W r i t D o y . u n A s 32 c . A L U o n t r l e s u Z 4 32 1 6 3 2 S i g n e x t d . - s o u I n s t r u c i o m e y a d f . 32 MemRead=1 MemWrite =0 R e g W r i t s a d 1 2 D n u m b . File 5 32 A d S u m . e r 32 32 3 2 h. Shift left 2 Shift Left 2 g. babic Presentation G

Abstract /Simplified View (1st look) g i s t r # D a m o y A d P C I n u c L U Generic implementation: use the program counter (PC) to supply instruction address, get the instruction from memory, read registers, use the instruction to decide exactly what to do. g. babic Presentation G

Abstract /Simplified View (2nd look) Figure 5.1 PC is incremented by 4, by most instructions, and by 4 + 4×offset, by branch instructions. Jump instructions change PC differently (not shown). g. babic Presentation G

Our Implementation An edge triggered methodology Typical execution: read contents of some state elements at the beginning of the clock cycle, send values through some combinational logic, write results to one or more state elements at the end of the clock cycle. C l o c k y e S t a m n 1 b i g 2 Figure 5.5 An edge triggered methodology allows a state element to be read and written in the same clock cycle without creating a race that could to indeterminate data. g. babic Presentation G

Incrementing PC & Fetching Instruction y R a d 4 A Clock Figure 5.6 with addition in red g. babic Presentation G

Datapath for R-type Instructions g W a d 1 2 A L U l Z 4 I25-21 I20-16 I15-11 Clock ALU control add = 32 sub = 34 slt = 42 and = 36 or = 37 nor = 39 R-type 000000 rs rt rd 00000 funct 31 26 25 21 20 16 15 11 10 6 5 0 g. babic Presentation G

Complete Datapath for R-type Instructions Based on contents of op-code and funct fields, Control Unit sets ALU control appropriately and asserts RegWrite, i.e. RegWrite = 1. P C I n s t r u c i o m e y R a d 4 A clock R e g i s t r W a d 1 2 A L U u l Z o 4 I25-21 I20-16 I15-11 Clock ALU control g. babic Presentation G

Datapath for LW and SW Instructions 31 26 25 21 20 16 15 0 sw or lw opcode rs rt offset M e m W r i t Clock I n s t r u c i o 1 6 3 2 R e g W a d D m y S x A L U l Z M 4 I25-21 I20-16 I15-0 control Control Unit sets: ALU control = 0010 (add) for address calculation for both lw and sw MemRead=0, MemWrite=1 and RegWrite=0 for sw MemRead=1, MemWrite=0 and RegWrite=1 for lw g. babic Presentation G

Datapath for R-type, LW & SW Instructions m e y R a d 1 6 3 2 g W S x A L U l Z D 4 U control M RegDst Clock rs rt rd MemRead =1 MemWrite =0 offset Let us determine setting of control lines for R-type, lw & sw instructions. g. babic Presentation G

Datapath for BEQ Instruction 31 26 25 21 20 16 15 0 beq rs rt offset Branch target = [PC] + 4 + 4×offset 1 6 3 2 S i g n e x t d Z r o A L U u m h f l T b a c B P C + 4 s p I R W U control rs rt Figure 5.9 with additions in red offset g. babic Presentation G

Datapath for R-type, LW, SW & BEQ M e m t o R g a d A L U S r c D s P C I n u i y [ 3 1 – ] 2 6 5 4 W x l Z h f ALU control clock MemRead=1 MemWrite=0 rs rt rd offset Clock Figure 5.15 with additions in red g. babic Presentation G

Control Unit and Datapath s t r u c i o m e y R a d [ 3 1 – ] 2 6 5 A M g L U O p W B h D S 4 x l Z f opcode Clock anded rs Clock anded rt Clock rd MemRead=1 MemWrite=0 offset funct Figure 5.17 with additions in red g. babic Presentation G

Truth Table for (Main) Control Unit ALUOp[1-0] = 00  signal to ALU Control unit for ALU to perform add function, i.e. set Ainvert = 0, Binvert=0 and Operation=10 ALUOp[1-0] = 01  signal to ALU Control unit for ALU to perform subtract function, i.e. set Ainvert = 0, Binvert=1 and Operation=10 ALUOp[1-0] = 10  signal to ALU Control unit to look at bits I[5-0] and based on its pattern to set Ainvert, Binvert and Operation so that ALU performs appropriate function, i.e. add, sub, slt, and, or & nor Input Output Op-code RegDst ALUSrc Memto- Reg Write Mem Read Branch ALUOp1 ALUp0 000000 1 d 100011 101011 000100 R-type lw sw beq g. babic Presentation G

Truth Table of ALU Control Unit ALUOp Funct field ALU Control ALUOp1 ALUOp0 F5 F4 F3 F2 F1 F0 d 0 0 10 1 0 1 10 0 0 00 0 0 01 0 1 11 add sub and or slt nor Input Output 1 1 00 Ainvert Bivert Operation g. babic

Design of (Main) Control Unit Op-code bits 5 4 3 2 1 0 RegDst ALUSrc Memto- Reg Write Mem Read Branch ALUOp1 ALUp0 0 0 0 0 0 0 1 d 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 … … R - f o r m a t I w s b e q O p 1 2 3 4 5 n u g D A L U S c M W i d B h Figure C.2.5 RegDst =Op5Op4Op3Op2Op1Op0 ALUSrc= Op5Op4Op3Op2Op1Op0 +Op5Op4Op3Op2Op1Op0 g. babic

Datapath for R-type, LW, SW, BEQ & J 31 26 25 0 j jump_target PC  PC31-28 || jump_target || 00 Add 2 zeros P C I n s t r u c i o m e y R a d [ 3 1 – ] D W g 2 5 6 A L U l Z M O p B h J S 4 x f 8 shift left 2 PC[31-28] P C + 4 [ 3 1 – 2 8 ] Figure 5.24 with correction in red g. babic

Design of Control Unit (J included) Op-code bits 5 4 3 2 1 0 RegDst ALUSrc Memto- Reg Write Mem Read Branch ALUOp1 ALUp0 0 0 0 0 0 0 1 d 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 Jump 1 J 0 0 0 0 1 0 d d d 0 d 0 d d d … R - f o r m a t I w s b e q O p 1 2 3 4 5 n u g D A L U S c M W i d B h Jump Jump =Op5Op4Op3Op2Op1Op0 No changes in ALU Control unit g. babic

Design of 7-Function ALU Control Unit Input Output ALUOp Funct field ALU Control ALUOp1 ALUOp0 F5 F4 F3 F2 F1 F0 d 010 1 110 000 001 111 add sub and or slt F 3 2 1 A L U O P 1 P 0 5 4 Bivert Operation Figure C.2.3 with improvements ALU Control Lines (Binvert & Operation) g. babic

Cycle Time Calculation Let us assume that the only delays introduced are by the following tasks: Memory access (read and write time = 3 nsec) Register file access (read and write time = 1 nsec) ALU to perform function (= 2 nsec) Under those assumption here are instruction execution times: Instr Reg ALU Data Reg fetch read oper memory write Total R-type 3 + 1 + 2 + 1 = 7 nsec lw 3 + 1 + 2 + 3 + 1 = 10 nsec sw 3 + 1 + 2 + 3 = 9 nsec branch 3 + 1 + 2 = 6 nsec jump 3 = 3 nsec Thus a clock cycle time has to be 10nsec, and clock rate = 1/10 nsec = 100MHz g. babic Presentation G

Single Cycle Processor: Conclusion Single Cycle Problems: what if we had a more complicated instruction like floating point? a clock cycle would be much longer, thus for shorter and more often used instructions, such as add & lw, wasteful of time. One Solution: use a “smaller” cycle time, and have different instructions take different numbers of cycles. And that is a “multi-cycle” processor. g. babic Presentation G

Datapath for R-type, LW, SW, BEQ & J PC[31-28] Add 2 zeros P C I n s t r u c i o m e y R a d [ 3 1 – ] D W g 5 6 A L U l Z M O p B h J S 4 x 8 shift left 2

Control Unit Truth Table and Design Op-code bits 5 4 3 2 1 0 RegDst ALUSrc Memto- Reg Write Mem Read Branch ALUOp1 ALUp0 0 0 0 0 0 0 1 d 1 0 0 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 Jump 1 0 0 0 0 1 0 d d d 0 d 0 d d d R - f o r m a t I w s b e q O p 1 2 3 4 5 n u g D A L U S c M W i d B h Jump