COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections 5.1-5.4.

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

1 Chapter Five The Processor: Datapath and Control.
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.
Levels in Processor Design
Lec 17 Nov 2 Chapter 4 – CPU design data path design control logic design single-cycle CPU performance limitations of single cycle CPU multi-cycle CPU.
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.
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.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
CSE331 W09.1Irwin Fall 2007 PSU CSE 331 Computer Organization and Design Fall 2007 Week 9 Section 1: Mary Jane Irwin (
Chapter 4 CSF 2009 The processor: Building the datapath.
Computer Architecture Chapter 5 Fall 2005 Department of Computer Science Kent State University.
Lec 15Systems Architecture1 Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some.
CSE431 Chapter 4A.1Irwin, PSU, 2008 CSE 431 Computer Architecture Fall 2008 Chapter 4A: The Processor, Part A Mary Jane Irwin ( )
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
ECE 445 – Computer Organization
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /19/2013 Lecture 17: The Processor - Overview Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
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.
CSE331 W10.1Irwin&Li Fall 2006 PSU CSE 331 Computer Organization and Design Fall 2006 Week 10 Section 1: Mary Jane Irwin (
CPU Overview Computer Organization II 1 February 2009 © McQuain & Ribbens Introduction CPU performance factors – Instruction count n Determined.
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.
Design a MIPS Processor
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.
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:
CS Computer Architecture Week 10: Single Cycle Implementation
CS 230: Computer Organization and Assembly Language
Single-Cycle Datapath and Control
Computer Architecture
Processor Design & Implementation
Morgan Kaufmann Publishers
Introduction CPU performance factors
Morgan Kaufmann Publishers The Processor
Morgan Kaufmann Publishers
Basic MIPS Architecture
Processor (I).
MIPS processor continued
CSCI206 - Computer Organization & Programming
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
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:

COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections

COSC 3430 L08 Basic MIPS Architecture.2 Introduction  CPU performance factors l Instruction count -Determined by ISA and compiler l CPI and Cycle time -Determined by CPU hardware  We will examine two MIPS implementations in this chapter l A simplified single cycle version l A multicycle implementation l In the next chapter we will see a more realistic pipelined version

COSC 3430 L08 Basic MIPS Architecture.3 Review: THE Performance Equation  The basic performance equation is CPU time = Instruction_count x CPI x clock_cycle Instruction_count x CPI clock_rate CPU time = or  These equations separate the three key factors that affect performance l Can measure the CPU execution time by running the program l The clock rate is usually given in the documentation l Can measure instruction count by using profilers/simulators without knowing all of the implementation details l CPI varies by instruction type and ISA implementation for which we must know the implementation details

COSC 3430 L08 Basic MIPS Architecture.4  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions: add, sub, and, or, slt control flow instructions: beq, j  Generic implementation l use the program counter (PC) to supply the instruction address and fetch the instruction from memory (and update the PC) l decode the instruction (and read registers) l execute the instruction  All instructions (except j ) use the ALU after reading the registers How? memory-reference? arithmetic? control flow? The Processor: Datapath & Control Fetch PC = PC+4 DecodeExec

COSC 3430 L08 Basic MIPS Architecture.5 Instruction Execution  PC  instruction memory, fetch instruction  Register numbers  register file, read registers  Depending on instruction class l Use ALU to calculate -Arithmetic result -Memory address for load/store -Branch target address l Access data memory for load/store l PC  target address or PC + 4

COSC 3430 L08 Basic MIPS Architecture.6 Clocking Methodologies  The clocking methodology defines when signals can be read and when they are written l An edge-triggered methodology  Typical execution l read contents of state elements l send values through combinational logic l write results to one or more state elements State element 1 State element 2 Combinational logic clock one clock cycle  Assumes state elements are written on every clock cycle; if not, need explicit write control signal l write occurs only when both the write control is asserted and the clock edge occurs

COSC 3430 L08 Basic MIPS Architecture.7 Clocking Methodology  Combinational logic transforms data during clock cycles l Between clock edges l Input from state elements, output to state element l Longest delay determines clock period

COSC 3430 L08 Basic MIPS Architecture.8 CPU Overview (Simplified example circuit)

COSC 3430 L08 Basic MIPS Architecture.9 Multiplexers  Can’t just join wires together l Use multiplexers

COSC 3430 L08 Basic MIPS Architecture.10 Building a Datapath  Datapath l Elements that process data and addresses in the CPU -Registers, ALUs, mux’s, memories, …  We will build a MIPS datapath incrementally l Refining the overview design

COSC 3430 L08 Basic MIPS Architecture.11 Fetching Instructions  Fetching instructions involves l reading the instruction from the Instruction Memory l updating the PC to hold the address of the next instruction Read Address Instruction Memory Add PC 4 l PC is updated every cycle, so it does not need an explicit write control signal l Instruction Memory is read every cycle, so it doesn’t need an explicit read control signal

COSC 3430 L08 Basic MIPS Architecture.12 Decoding Instructions  Decoding instructions involves l sending the fetched instruction’s opcode and function field bits to the control unit Instruction Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 Control Unit l reading two values from the Register File -Register File addresses are contained in the instruction

COSC 3430 L08 Basic MIPS Architecture.13 Executing R Format Operations  R format operations ( add, sub, slt, and, or ) l perform the (op and funct) operation on values in rs and rt l store the result back into the Register File (into location rd) Instruction Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU overflow zero ALU controlRegWrite R-type: oprsrtrdfunctshamt 10 The Register File is not written every cycle (e.g. sw ), so we need an explicit write control signal for the Register File

COSC 3430 L08 Basic MIPS Architecture.14 Executing Load and Store Operations  Load and store operations involves l compute memory address by adding the base register (read from the Register File during decode) to the 16-bit signed-extended offset field in the instruction l store value (read from the Register File during decode) written to the Data Memory l load value, read from the Data Memory, written to the Register File Instruction Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU overflow zero ALU controlRegWrite Data Memory Address Write Data Read Data Sign Extend MemWrite MemRead 1632

COSC 3430 L08 Basic MIPS Architecture.15 Executing Branch Operations  Branch operations involves compare the operands read from the Register File during decode for equality ( zero ALU output) l compute the branch target address by adding the updated PC to the 16-bit signed-extended offset field in the instr Instruction Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU zero ALU control Sign Extend 1632 Shift left 2 Add 4 PC Branch target address (to branch control logic)

COSC 3430 L08 Basic MIPS Architecture.16 Executing Jump Operations  Jump operation involves l replace the lower 28 bits of the PC with the lower 26 bits of the fetched instruction shifted left by 2 bits Read Address Instruction Memory Add PC 4 Shift left 2 Jump address

COSC 3430 L08 Basic MIPS Architecture.17 Creating a Single Datapath from the Parts  Assemble the datapath segments and add control lines and multiplexors as needed  Single cycle design – fetch, decode and execute each instructions in one clock cycle l no datapath resource can be used more than once per instruction, so some must be duplicated (e.g., separate Instruction Memory and Data Memory, several adders) l multiplexors needed at the input of shared elements with control lines to do the selection l write signals to control writing to the Register File and Data Memory  Cycle time is determined by length of the longest path

COSC 3430 L08 Basic MIPS Architecture.18 Fetch, R-type, and Memory Access Portions MemtoReg Read Address Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero ALU controlRegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 ALUSrc

COSC 3430 L08 Basic MIPS Architecture.19 Adding the Control  Selecting the operations to perform (ALU, Register File and Memory read/write)  Controlling the flow of data (multiplexor inputs) I-Type: oprsrt address offset R-type: oprsrtrdfunctshamt 10  Observations l op field always in bits l addr of registers to be read are always specified by the rs field (bits 25-21) and rt field (bits 20-16); for lw and sw rs is the base register l addr. of register to be written is in one of two places – in rt (bits 20-16) for lw; in rd (bits 15-11) for R-type instructions l offset for beq, lw, and sw always in bits 15-0 J-type: optarget address

COSC 3430 L08 Basic MIPS Architecture.20 Single Cycle Datapath with Control Unit Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.21 R-type Instruction Data/Control Flow Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.22 Load Word Instruction Data/Control Flow Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.23 Load Word Instruction Data/Control Flow Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.24 Branch Instruction Data/Control Flow Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.25 Branch Instruction Data/Control Flow Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch

COSC 3430 L08 Basic MIPS Architecture.26 Adding the Jump Operation Read Address Instr[31-0] Instruction Memory Add PC 4 Write Data Read Addr 1 Read Addr 2 Write Addr Register File Read Data 1 Read Data 2 ALU ovf zero RegWrite Data Memory Address Write Data Read Data MemWrite MemRead Sign Extend 1632 MemtoReg ALUSrc Shift left 2 Add PCSrc RegDst ALU control ALUOp Instr[5-0] Instr[15-0] Instr[25-21] Instr[20-16] Instr[15 -11] Control Unit Instr[31-26] Branch Shift left Jump 32 Instr[25-0] 26 PC+4[31-28] 28

COSC 3430 L08 Basic MIPS Architecture.27 An important point about the datapath  In this data path we see several shift left 2 functions and sign extend functions. They are crucial functions if the circuit is to work properly.  On the next chart is a circuit that will take the contents of a 4 bit register and shift it into a 4 bit register with its bits shifted 0, 1, 2, or 3 bits by using 4, 4 to 1 mulitplexers. This idea could be extended to a 32 bit multiplexer that would allow shifts of 0 to 31 bits (shamt is 5 bits)  The sign extend is relatively easy. All that needs to be done is feed the bits 0-15 into the least significant bits of a register and allow the 15 th bit to fill the remaining bits

COSC 3430 L08 Basic MIPS Architecture.28 A left shifter circuit, 0 to 3 bits x 0, x 1, x 2, x 3 are inputs from a 4 bit register z 0, z 1, z 2, z 3 are outputs to a 4 bit register. s1 and s0 are the selector inputs for the number of bits to shift, 00, 01, 10, 11. The input 5 is 0.

COSC 3430 L08 Basic MIPS Architecture.29 Problem  1. Discuss how the general shifter, (0 to 31 bits) could be implemented.  2. Since in our simple example we only need to shift left 2 bits, show how this can be done.

COSC 3430 L08 Basic MIPS Architecture.30 Next Lecture and Reminders  Next lecture l MIPS processor: single cycle control and multicycle -Reading assignment – PH, Chapter