CS Computer Architecture Spring Week 10: Chapter

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

CENG 3420 Lecture 06: Datapath

CPE 335 Computer Organization. Basic MIPS Architecture Part I

Review: Abstract Implementation View

LECTURE 5. Single-Cycle Datapath and Control

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

Lecture 10: Simple Data Path

Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1

Processor (I) - datapath & control. Hwansoo Han

The MIPS Processor Datapath

Systems Architecture

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

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

Ch 5: Designing a Single Cycle Datapath

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

CS 351 Exam 2 Mon. 11/2/2015

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

ﻪﺘﻓﺮﺸﻴﭘ ﺮﺗﻮﻴﭙﻣﺎﻛ يرﺎﻤﻌﻣ MIPS يرﺎﻤﻌﻣ data path and ontrol control

CS3350B Computer Architecture Quiz 3 March 15, 2018

Single Cycle Data Path

The Processor: Datapath & Control

Topic #6. Processor Design

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

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

CSE140: Components and Design Techniques for Digital Systems

CC 311- Computer Architecture. The Processor - Control

Chapter 5: The Processor: Datapath and Control

CPU Organization (Design)

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

ECE260: Fundamentals of Computer Engineering

ECE232: Hardware Organization and Design

The Processor: Datapath & Control

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

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

CS222: Processor Design

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

ECE369. Chapter 5 ECE369

CS61C : Machine Structures

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

Chapter 4 The Processor 1. Chapter 4A. The Processor

CSEN 601: Computer System Architecture Summer 2014

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

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

Chapter 4. The Processor

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

RISC Processor Design

Systems Architecture I

Computer Science 61C Spring Friedland and Weaver. The MIPS Datapath

Introduction. ENG3380 Computer Organization and Architecture MIPS: Data Path Design Part 3. Topics. References. School of Engineering 1

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

CPE 335. Basic MIPS Architecture Part II

Single Cycle Datapath

Lets Build a Processor

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

Single Cycle Datapath

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

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

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

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

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

Chapter 4. The Processor

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

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

Laboratory 5 Processor Datapath

Single Cycle CPU Design. Mehran Rezaei

Computer Science 141 Computing Hardware

Inf2C - Computer Systems Lecture Processor Design Single Cycle

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

Review: MIPS Organization

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

ECS 154B Computer Architecture II Spring 2009

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

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

ENE 334 Microprocessors

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

Major CPU Design Steps

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

Final Project: MIPS-like Microprocessor

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

4. What is the average CPI of a 1.4 GHz machine that executes 12.5 million instructions in 12 seconds?

University of Jordan Computer Engineering Department CPE439: Computer Design Lab

are Softw Instruction Set Architecture Microarchitecture are rdw

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

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

CS61C : Machine Structures

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

Midterm. Sticker winners: if you got >= 50 / 67

MIPS-Lite Single-Cycle Control

Fundamentals of Computer Systems

Chapter 4. The Processor Designing the datapath

Lecture 5: The Processor

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

Data paths for MIPS instructions

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Introduction. Datapath Basics

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

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

Transcription:

CS 35101 Computer Architecture Spring 2008 Week 10: Chapter 5.1-5.3 Materials adapated from Mary Jane Irwin (www.cse.psu.edu/~mji) and Kevin Schaffer [adapted from D. Patterson slides] CS 35101 Ch 5.1

Head s Up Last course week s material Understanding performance, Ch. 4.1-4.6 This week s material Designing a MIPS single cycle datapath - ing assignment PH 5.1-5.3 Next week s material More on single and multi-cycle datapath design - ing assignment PH: 5.4-5.6 Reminders HW 3 is due Thursday, 3/27 by the start of class Project 2 is posted and due on 4/22 Exam #2 is Tuesday, April 15 CS 35101 Ch 5.2

Datapath design tended to just work Control paths are where the system complexity lives. Bugs spawned from control path design errors reside in the microcode flow, the finite-state machines, and all the special exceptions that inevitably spring up in a machine design like thistles in a flower garden. The Pentium Chronicles, Colwell, pg. 64 CS 35101 Ch 5.3

Review: Design Principles Simplicity favors regularity fixed size instructions 32-bits only three instruction formats Good design demands good compromises three instruction formats Smaller is faster limited instruction set limited number of registers in register file limited number of addressing modes Make the common case fast arithmetic operands from the register file (load-store machine) allow instructions to contain immediate operands CS 35101 Ch 5.4

The Processor: Datapath & Control We're ready to look at an implementation of the MIPS Simplified to contain only: memory-reference instructions: lw, sw arithmetic-logical instructions: add, addu, sub, subu, and, or, xor, nor, slt, sltu arithmetic-logical immediate instructions: addi, addiu, andi, ori, xori, slti, sltiu control flow instructions: beq, j Generic implementation: use the program counter (PC) to supply the instruction address and fetch the instruction from memory (and update the PC) decode the instruction (and read registers) execute the instruction Exec Fetch PC = PC+4 Decode CS 35101 Ch 5.5

Abstract Implementation View Two types of functional units: elements that operate on data values (combinational) elements that contain state (sequential) PC Address Memory Register Reg Addr File Reg Addr Reg Addr Data Data ALU Address Data Memory Data Single cycle operation Split memory model - one memory for instructions and one for data CS 35101 Ch 5.6

Clocking Methodologies Clocking methodology defines when signals can be read and when they can be written falling (negative) edge clock cycle rising (positive) edge clock rate = 1/(clock cycle) e.g., 10 nsec clock cycle = 100 MHz clock rate 1 nsec clock cycle = 1 GHz clock rate State element design choices level sensitive latch master-slave and edge-triggered flipflops CS 35101 Ch 5.7

State Elements Set-reset latch R S Q(t+1)!Q(t+1) R Q 1 0 0 1 0 1 1 0 S!Q 0 1 0 1 Q(t) 0!Q(t) 0 Level sensitive D latch clock D Q!Q D clock Q latch is transparent when clock is high (copies input to output) CS 35101 Ch 5.8

Two-Sided Clock Constraint Race problem with latch based design D Q D-latch0 D Q D-latch1 clock!q clock!q clock Consider the case when D-latch0 holds a 0 and D- latch1 holds a 1 and you want to transfer the contents of D-latch0 to D-latch1 and vica versa must have the clock high long enough for the transfer to take place must not leave the clock high so long that the transferred data is copied back into the original latch Two-sided clock constraint CS 35101 Ch 5.9

State Elements, con t Solution is to use flipflops that change state (Q) only on clock edge (master-slave) D clock D Q D-latch clock!q D Q D-latch clock!q Q!Q D clock Q master (first D-latch) copies the input when the clock is high (the slave (second D-latch) is locked in its memory state and the output does not change) slave copies the master when the clock goes low (the master is now locked in its memory state so changes at the input are not loaded into the master D-latch) CS 35101 Ch 5.10

One-Slided Clock Constraint Master-slave (edge-triggered) flipflops removes one of the clock constraints D Q MS-ff0 D MS-ff1 Q clock!q clock!q clock Consider the case when MS-ff0 holds a 0 and MS-ff1 holds a 1 and you want to transfer the contents of MS-ff0 to MS-ff1 and vica versa must have the clock cycle time long enough to accommodate the worst case delay path One-sided clock constraint CS 35101 Ch 5.11

Latches vs Flipflops Output is equal to the stored value inside the element Change of state (value) is based on the clock Latches: output changes whenever the inputs change and the clock is asserted (level sensitive methodology) - Two-sided timing constraint Flip-flop: output changes only on a clock edge (edgetriggered methodology) - One-sided timing constraint A clocking methodology defines when signals can be read and written wouldn t want to read a signal at the same time it was being written CS 35101 Ch 5.12

Our Implementation An edge-triggered methodology, typical execution read contents of some state elements (combinational activity, so no clock control signal needed) send values through some combinational logic write results to one or more state elements on clock edge State element 1 Combinational logic State element 2 clock one clock cycle Assumes state elements are written on every clock cycle; if not, need explicit write control signal write occurs only when both the write control is asserted and the clock edge occurs CS 35101 Ch 5.13

Fetching s Fetching instructions involves reading the instruction from the Memory updating the PC value to be the address of the next (sequential) instruction clock Exec Fetch PC = PC+4 Decode PC 4 Address Add Memory CS 35101 Ch 5.14 PC is updated every clock cycle, so it does not need an explicit write control signal just a clock signal ing from the Memory is a combinational activity, so it doesn t need an explicit read control signal

Formats Review op rs rt rd shamt funct 31:26 25:21 20:16 15:11 10:6 5:0 op rs rt immed 31:26 25:21 20:16 15:0 op address 31:26 25:0 CS 35101 Ch 5.15

Decoding s Decoding instructions involves sending the fetched instruction s opcode and function field bits to the control unit Fetch PC = PC+4 Control Unit Exec Decode and Addr 1 Register Addr 2 File Write Addr Data 1 Data 2 reading two values from the Register File - Register File addresses are contained in the instruction CS 35101 Ch 5.16

ing Registers Just in Case Note that both RegFile read ports are active for all instructions during the Decode cycle using the rs and rt instruction field addresses Since haven t decoded the instruction yet, don t know what the instruction is! Just in case the instruction uses values from the RegFile do work ahead by reading the two source operands Which instructions do make use of the RegFile values? Also, all instructions (except j) use the ALU after reading the registers Why? memory-reference? arithmetic? control flow? CS 35101 Ch 5.17

Executing R Format Operations R format operations (add, sub, slt, and, or) R-type: 31 25 20 15 10 5 0 op rs rt rd shamt funct perform operation (op and funct) on values in rs and rt store the result back into the Register File (into location rd) RegWrite ALU control Exec Fetch PC = PC+4 Decode Addr 1 Register Addr 2 File Write Addr Data 1 Data 2 ALU overflow zero Note that Register File is not written every cycle (e.g. sw), so we need an explicit write control signal for the Register File CS 35101 Ch 5.18

Consider slt R format operations (add, sub, slt, and, or) R-type: 31 25 20 15 10 5 0 op rs rt rd shamt funct perform operation (op and funct) on values in rs and rt store the result back into the Register File (into location rd) RegWrite ALU control Exec Fetch PC = PC+4 Decode Addr 1 Register Addr 2 File Write Addr Data 1 Data 2 ALU overflow zero Note that Register File is not written every cycle (e.g. sw), so we need an explicit write control signal for the Register File CS 35101 Ch 5.19

Consider the slt Remember the R format instruction slt slt $t0, $s0, $s1 # if $s0 < $s1 # then $t0 = 1 # else $t0 = 0 Where does the 1 (or 0) come from to store into $t0 in the Register File at the end of the execute cycle? RegWrite ALU control Addr 1 Register Addr 2 File Write Addr Data 1 Data 2 ALU overflow zero CS 35101 Ch 5.20

CS 35101 Ch 5.21

Executing Load and Store Operations Load and store operations have to 31 25 20 15 0 I-Type: op rs rt address offset compute a memory address by adding the base register (in rs) to the 16-bit signed offset field in the instruction - base register was read from the Register File during decode - offset value in the low order 16 bits of the instruction must be sign extended to create a 32-bit signed value store value, read from the Register File during decode, must be written to the Data Memory load value, read from the Data Memory, must be stored in the Register File CS 35101 Ch 5.22

Executing Load and Store Operations, con t RegWrite ALU control MemWrite Addr 1 Register Addr 2 File Write Addr Data 1 Data 2 overflow zero ALU Address Data Memory Data Sign Extend Mem CS 35101 Ch 5.23

Executing Branch Operations Branch operations have to 31 25 20 15 0 I-Type: op rs rt address offset CS 35101 Ch 5.25 compare the operands read from the Register File during decode (rs and rt values) for equality (zero ALU output) compute the branch target address by adding the updated PC to the sign extended16-bit signed offset field in the instruction - base register is the updated PC - offset value in the low order 16 bits of the instruction must be sign extended to create a 32-bit signed value and then shifted left 2 bits to turn it into a word address

Executing Branch Operations, con t 4 Add Shift left 2 Add Branch target address ALU control PC Addr 1 Register Addr 2 Data 1 File Write Addr Data 2 ALU zero (to branch control logic) Sign 16 Extend 32 CS 35101 Ch 5.26

Executing Jump Operations Jump operations have to 31 25 0 J-Type: op jump target address replace the lower 28 bits of the PC with the lower 26 bits of the fetched instruction shifted left by 2 bits Add PC 4 Address Memory 26 Shift left 2 4 28 Jump address CS 35101 Ch 5.28

Creating a Single Datapath from the Parts Assemble the datapath elements, add control lines as needed, and design the control path Fetch, decode and execute each instructions in one clock cycle single cycle design no datapath resource can be used more than once per instruction, so some must be duplicated (e.g., why we have a separate Memory and Data Memory) to share datapath elements between two different instruction classes will need multiplexors at the input of the shared elements with control lines to do the selection Cycle time is determined by length of the longest path CS 35101 Ch 5.29

Fetch, R, and Memory Access Portions PC 4 Address Add Memory RegWrite Addr 1 Register Addr 2 Data 1 File Write Addr Data 2 ALU control ovf zero ALU MemWrite Address Data Memory Data Sign 16 Extend 32 Mem CS 35101 Ch 5.30

Multiplexor Insertion PC 4 Address Add Memory RegWrite Addr 1 Register Addr 2 Data 1 File Write Addr Data 2 ALUSrc ALU control ovf zero ALU MemWrite Address Data Memory Data MemtoReg Sign 16 Extend 32 Mem CS 35101 Ch 5.31

Clock Distribution System Clock clock cycle RegWrite MemWrite PC 4 Address Add Memory Addr 1 Register Addr 2 Data 1 File Write Addr Data 2 ALUSrc ALU control ovf zero ALU Address Data Memory Data MemtoReg Sign 16 Extend 32 Mem CS 35101 Ch 5.32

Adding the Branch Portion 4 Add PC Address Memory RegWrite Addr 1 Register Addr 2 Data 1 File Write Addr Data 2 ALUSrc ALU control ovf zero ALU Address MemWrite Data Memory Data MemtoReg Sign 16 Extend 32 Mem CS 35101 Ch 5.33

Our Simple Control Structure We wait for everything to settle down ALU might not produce right answer right away Memory and RegFile reads are combinational (as are ALU, adders, muxes, shifter, signextender) Use write signals along with the clock edge to determine when to write to the sequential elements (to the PC, to the Register File and to the Data Memory) The clock cycle time is determined by the logic delay through the longest path We are ignoring some details like register setup and hold times CS 35101 Ch 5.35