The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:

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.
Processor II CPSC 321 Andreas Klappenecker. Midterm 1 Tuesday, October 5 Thursday, October 7 Advantage: less material Disadvantage: less preparation time.
331 W9.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 9 Building a Single-Cycle Datapath [Adapted from Dave Patterson’s.
Levels in Processor Design
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.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
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.
1 The Processor: Datapath and Control We will design a microprocessor that includes a subset of the MIPS instruction set: –Memory access: load/store word.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
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
Chapter 4 CSF 2009 The processor: Building the datapath.
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Datapath Design Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Composing the Elements First-cut data path does an instruction.
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.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
D ATA P ATH OF A PROCESSOR (MIPS) Module 1.1 : Elements of computer system UNIT 1.
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.
CS.305 Computer Architecture The Processor: Datapath and Control Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from.
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.
1 Chapter 5: Datapath and Control (Part 2) CS 447 Jason Bakos.
Morgan Kaufmann Publishers The Processor
May 22, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 14: A Simple Implementation of MIPS * Jeremy R. Johnson Mon. May 17, 2000.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
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
Multi-Cycle Datapath and Control
CS161 – Design and Architecture of Computer Systems
Single-Cycle Datapath and Control
Computer Architecture
Multi-Cycle CPU.
Processor (I).
MIPS processor continued
Designing MIPS Processor (Single-Cycle) Presentation G
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
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
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Lecture 14: Single Cycle MIPS Processor
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

The Processor: Datapath & Control

Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions: add, sub, and, or, slt control flow instructions: beq (bne), j (jal) Generic implementation: 1. PC to supply instruction address 2. get the instruction from memory 3. use the instruction to decide what to do 4. read registers Majority of instructions use the ALU the actions differ.

Clocking Methodology 1/2 Edge-triggered methodology values stored in a sequential logic elements are updated only on clock edge Typical execution: read contents of state elements, send values through some combinational logic write results to one or more state elements state element 1 state element 2 Combinational Logic

Clocking Methodology 2/2 An edge-triggered methodology allows a state element to be read and written in the same clock cycle state element Combinational Logic

Abstract View of Datapath Two types of functional units: combinational, e.g. ALU sequential, e.g. registers Add ALU Address Data Memory Data Registers Reg. No Instruction Memory Address Instruction PC Add 4

Datapath Including Control ALU Address Data Memory Data Registers Reg. No Instruction Memory Address Instruction PC Add 4 MemWrite MemRead RegWrite C ontrol zero branch

Register File Read register number 1 Read register number 2 Write register Write data Register file read data 1 read data 2 Write

ALU Symbol & Control ALU control lines Function 0000AND 0001OR 0010add 0110subtract 0111slt 1100NOR ALU 32 a b Result 32 Zero Overflow CarryOut ALU Control 4

Instruction Fetch Add Instruction Memory Address Instruction PC 4 Instruction

R-Type Instructions ALU Control Instruction read register 1 Read register 2 Write register Write data Register file read data 1 read data 2 Write ALU Zero Overflow CarryOut 4 rs rt rd oprsrtrdshamtfunct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits add rd, rs, rt

Implementing Load & Stores rt rs rt ALU Address Data Memory Write Data Write Data Registers Read Reg. 1 MemWrite MemRead RegWrite zero Read Reg. 2 Write Reg. Read Data 1 Read Data 2 Read Data Sign Extend 32 Instruction 16 Immediate ALU Control oprsrtImm 6 bits 5 bits 5 bits 16 bits lw rt, index(rs)

Implementing Branches ALU Write Data Registers Read Reg. 1 RegWrite zero Read Reg. 2 Write Reg. Read Data 1 Read Data 2 Sign Extend 32 Instruction rs rt 16 Immediate ALU Control Add Shift left 2 PC+4 Branch Target Address To Branch Control Logic oprsrtImm 6 bits 5 bits 5 bits 16 bits beq rs, rt, Label

Building the Datapath Idea: Use multiplexors to stitch them together rs rt Imm rd

Implementing Jump opAddress 6 bits 26 bits j Label ALU Write Data Registers Read Reg. 1 RegWrite Read Reg. 2 Write Reg. Read Data 1 Read Data 2 Instruction rs rt ALU Control Shift left 2 PC+4 [31 : 28] Jump Target Address [27 : 0] 26

Complete Datapath with Control

Control Control Signals Selecting the operations to perform Controlling the flow of data (via MUX) Read/write enable inputs of memory and register file Information comes from the instruction Example: add $t0, $s0, $s1 op rs rt rd shamt funct ALU operation is based on instruction type and function code

ALU Control Example: lw $t0, 100($s2) What should the ALU do with this instruction? ALU Control linesFunction 0000AND 0001OR 0010add 0110subtract 0111set on less than 1100NOR op rs rt address

ALU Control Unit ALU performs addition for loads and stores subtraction for branches (beq) no operation for jumps or the operation is determined by the function field for R-type instructions. ALU Control unit will have the following inputs: 2-bit control field called ALUOp 6-bit function field

ALU Control Unit Instruction opcode Instruction operation ALUopFunct field Desired ALU action ALU Control lw Load word00xxxxxxadd0010 sw Store word00xxxxxxadd0010 beq Branch equal01xxxxxxsubtract0110 R-typeAdd add0010 R-typeSubtract subtract0110 R-typeAND and0000 R-typeOR or0001 R-typeslt slt0111

Main Control Unit 0rsrtrdshamtfunct rsrtImm address 35 or rsrtImm R-type Load or store jump branch Fields of Different Instruction Classes:

Datapath with Control Signals

Seven Control Signals Signal nameEffect when de- asserted Effect when asserted RegDst The destination register number comes from rt. The destination register number comes from rd. RegWrite NoneDestination register is written with value on Writedata ALUSrc 2 nd ALU operand comes from Read_Data_2 2 nd ALU operand is the sign extended, lower 16 bit of the instruction PCSrc The PC is replaced by PC + 4 The PC is replaced by the branch target address MemRead NoneMemory is read MemWrite NoneMemory is written MemtoReg The value to the register Writedata input comes from the ALU. The value to the register Writedata input comes from the data memory

RegDst & RegWrite read register #1 read register #2 write register write data Register file read #1 Write read #1 RegWrite RegDst 0 1 rt: Ins[20-16] rd: Ins[15-11] load R-type

ALUSrc read register #1 read register #2 write register write data Register file read #1 RegWrite ALUSrc 0 1 sign extend Imm: Ins[15-0] 3216 result Zero ALU

MemtoReg Address write data Data Memory read data MemtoReg 1 0 Zero To the write data input of Register File From the read data 2 output of Register File

PCSrc Add PCSrc 0 1 PC Shift left by 2 Imm: Ins[15-0] 32 sign extend Add 4 zero branch

Datapath & Control

Operation of the Datapath X0Xbeq X1Xsw lw R-format ALU Op0 ALU Op1 BranchMem Write Mem Read Reg Write Memto -Reg ALUSrcRegDestInstruction Example Flow: beq $s0, $s1, address The instruction is fetched from memory and PC is incremented Read two register values Subtract one from the other, calculate the branch address Use the zero signal to determine which of the addresses is to be used for fetching the next instruction

Control Function Input or output Signal nameR-formatlwswbeq Inputs Op Op Op Op Op Op Outputs RegDst 10xx ALUSrc 0110 MemtoReg 01xx RegWrite 1100 MemRead 0100 MemWrite 0010 Branch 0001 ALUOp ALIOp0 0001

Cycle Time The control logic is combinational every instruction is executed in one clock cycle Cycle time determined by length of the longest path state element 1 state element 2 Combinational Logic

Single Cycle Approach Different instructions have different execution times Add: 3 ns Subtract: 3.5 ns Memory access: 10 ns Multiplication: 20 ns In single cycle approach, the slowest instruction determines the clock cycle time. Another approach, divide instruction into smaller parts and execute each in a shorter clock cycle

Instruction in Datapath

Instruction Timings Instruction class Functional Units used by the instruction class R-typeInstruction fetch Register access ALURegister access Load wordInstruction fetch Register access ALUMemory access Register access Store wordInstruction fetch Register access ALUMemory access BranchInstruction fetch Register access ALU JumpInstruction fetch

Example Memory access: 200 ps ALU and addition operations: 100 ps Register file access (read or write): 50 ps And assume other parts (multiplexors, control units, etc) have no delay. Instruction mix: 25% loads, 10% stores, 45% ALU ops, 15% branches, 5% jumps Compare two approaches: single fixed clock cycle and multiple clock cycle per instruction, i.e. what is the clock period per instruction and CPI for a fixed cycle what is the nominal clock period and CPI for the multiple cycle approach Execution times?