Alternative to single cycle. Drawbacks of single cycle implementation. Multiple cycle implementation. Instruction fetch

Similar documents
Control Unit for Multiple Cycle Implementation

Processor: Multi- Cycle Datapath & Control

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón

CPE 335. Basic MIPS Architecture Part II

CSE 2021 COMPUTER ORGANIZATION

LECTURE 6. Multi-Cycle Datapath and Control

CSE 2021 COMPUTER ORGANIZATION

ALUOut. Registers A. I + D Memory IR. combinatorial block. combinatorial block. combinatorial block MDR

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

ECE369. Chapter 5 ECE369

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

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

Topic #6. Processor Design

CC 311- Computer Architecture. The Processor - Control

Single vs. Multi-cycle Implementation

Chapter 5: The Processor: Datapath and Control

Chapter 4 The Processor (Part 2)

ENE 334 Microprocessors

Multicycle Approach. Designing MIPS Processor

Design of the MIPS Processor

EECE 417 Computer Systems Architecture

Systems Architecture I

RISC Processor Design

Chapter 5 Solutions: For More Practice

The Processor: Datapath & Control

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

Design of the MIPS Processor (contd)

Lets Build a Processor

Major CPU Design Steps

Multiple Cycle Data Path

Points available Your marks Total 100

RISC Architecture: Multi-Cycle Implementation

Note- E~ S. \3 \S U\e. ~ ~s ~. 4. \\ o~ (fw' \i<.t. (~e., 3\0)

CSE 2021: Computer Organization Fall 2010 Solution to Assignment # 3: Multicycle Implementation

RISC Architecture: Multi-Cycle Implementation

Mapping Control to Hardware

Processor (multi-cycle)

Computer Science 141 Computing Hardware

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Using a Hardware Description Language to Design and Simulate a Processor 5.8

COMP303 - Computer Architecture Lecture 10. Multi-Cycle Design & Exceptions

Initial Representation Finite State Diagram. Logic Representation Logic Equations

EE457. Note: Parts of the solutions are extracted from the solutions manual accompanying the text book.

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

RISC Design: Multi-Cycle Implementation

Lecture 5: The Processor

CSE 2021 Computer Organization. Hugh Chesser, CSEB 1012U W10-M

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

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

EE457 Lab 4 Part 4 Seven Questions From Previous Midterm Exams and Final Exams ee457_lab4_part4.fm 10/6/04

Pipelining. Pipeline performance

Processor (I) - datapath & control. Hwansoo Han

TDT4255 Computer Design. Lecture 4. Magnus Jahre. TDT4255 Computer Design

Multicycle conclusion

Digital Design & Computer Architecture (E85) D. Money Harris Fall 2007

Microprogramming. Microprogramming

Implementing the Control. Simple Questions

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

Processor Implementation in VHDL. University of Ulster at Jordanstown University of Applied Sciences, Augsburg

Computer Architecture Chapter 5. Fall 2005 Department of Computer Science Kent State University

Control & Execution. Finite State Machines for Control. MIPS Execution. Comp 411. L14 Control & Execution 1

THE HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY Computer Organization (COMP 2611) Spring Semester, 2014 Final Examination

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

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

LECTURE 5. Single-Cycle Datapath and Control

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

CSEN 601: Computer System Architecture Summer 2014

Initial Representation Finite State Diagram Microprogram. Sequencing Control Explicit Next State Microprogram counter

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.

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Lab 8: Multicycle Processor (Part 1) 0.0

Computer and Information Sciences College / Computer Science Department Enhancing Performance with Pipelining

Chapter 4. The Processor

Final Project: MIPS-like Microprocessor

Chapter 4. The Processor

October 24. Five Execution Steps

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

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

Systems Architecture

Review: Abstract Implementation View

Chapter 4. The Processor

CSSE232 Computer Architecture I. Mul5cycle Datapath

Week 6: Processor Components

Chapter 4. The Processor

ECE 3056: Architecture, Concurrency and Energy of Computation. Single and Multi-Cycle Datapaths: Practice Problems

Design of Digital Circuits Lecture 13: Multi-Cycle Microarch. Prof. Onur Mutlu ETH Zurich Spring April 2017

ECE232: Hardware Organization and Design

Lecture 2: MIPS Processor Example

The overall datapath for RT, lw,sw beq instrucution

CS232 Final Exam May 5, 2001

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

Beyond Pipelining. CP-226: Computer Architecture. Lecture 23 (19 April 2013) CADSL

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

CSE Lecture In Class Example Handout

Lecture 9: Microcontrolled Multi-Cycle Implementations. Who Am I?

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

COMPUTER ORGANIZATION AND DESIGN

Transcription:

Drawbacks of single cycle implementation Alternative to single cycle All instructions take the same time although some instructions are longer than others; e.g. load is longer than add since it has to access data memory in addition to all the other steps that add does thus the cycle has to be for the longest path Some combinational units must be replicated since used in the same cycle e.g., ALU for computing branch address and ALU for computing branch outcome but this is no big deal (these duplicate resources will be needed when we will pipeline instructions) 4/22/2004 CSE378 Multicycle impl,. 1 Have a shorter cycle and instructions execute in multiple (shorter) cycles The (shorter) cycle time determined by the longest delay in individual functional units (e.g., memory or ALU etc.) Possibility to streamline some resources since they will be used at different cycles Since there is need to keep information between cycles, we ll need to add some stable storage (registers) not visible at the ISA level Not all instructions will require the same number of cycles 4/22/2004 CSE378 Multicycle impl,. 2 Multiple cycle implementation Follows the decomposition of the steps for the execution of instructions Cycle 1. and increment PC Cycle 2. Instruction decode and read source registers and branch address computation Cycle 3. ALU execution or memory address calculation or set PC if branch successful Cycle 4. Memory access (load/store) or write register (arith/log) Cycle 5 Write register (load) Note that branch takes 3 cycles, load takes 5 cycles, all others take 4 cycles 4/22/2004 CSE378 Multicycle impl,. 3 Because fields in the instruction are needed at different cycles, the instruction has to be kept in stable storage, namely an Instruction Register (IR) The register transfer level actions during this step IR Memory[PC] PC PC + 4 Resources required Memory (but no need to distinguish between instruction and data memories; later on we will because the need will reappear when we pipeline instructions) Adder to increment PC IR 4/22/2004 CSE378 Multicycle impl,. 4 Instruction decode and read source registers ALU execution Instruction decode: send opcode to control unit and (see later) Perform optimistic computations that are not harmful Read rs and rt and store them in non-isa visible registers A and B that will be used as input to ALU A REG[IR[25:21]] (read rs) B REG[IR[20:16]] (read rt) Compute the branch address just in case we had a branch! ALUout PC +(sign-ext(ir[15:0]) *4 (ALUout is also a non-isa visible register) New resources A, B, ALUout 4/22/2004 CSE378 Multicycle impl,. 5 If instruction is R-type ALUout A op. B If instruction is Immediate ALUout A op. sign-extend(ir[15:0]) If instruction is Load/Store ALUout A + sign-extend(ir[15:0]) If instruction is branch If (A=B) then PC ALUout (note this is the ALUout computed in the previous cycle) No new resources 4/22/2004 CSE378 Multicycle impl,. 6 1

Memory access or ALU completion Load completion If Load MDR Memory[ALUout] (MDR is the Memory Data Register non-isa visible register) If Store Memory[ALUout] B If arith Reg[IR[15:11]] ALUout New resources MDR Write result register Reg[IR[20:16]] MDR 4/22/2004 CSE378 Multicycle impl,. 7 4/22/2004 CSE378 Multicycle impl,. 8 Streamlining of resources (cf. Figure 5.31) No distinction between instruction and data memory Only one ALU But a few more muxes and registers (IR, MDR etc.) Control Unit for Multiple Cycle Implementation Control is more complex than in single cycle since: Need to define control signals for each step Need to know which step we are on Two methods for designing the control unit Finite state machine and hardwired control (extension of the single cycle implementation) Microprogramming (read the book about it) 4/22/2004 CSE378 Multicycle impl,. 9 4/22/2004 CSE378 Multicycle impl,. 10 What are the control signals needed? (cf. Fig 5.32) Let s look at control signals needed at each of 5 steps Signals needed for reading/writing memory reading/writing registers control the various muxes control the ALU (recall how it was done for single cycle implementation) Need to read memory Choose input address (mux with signal IorD = 0) Set MemRead signal Set IRwrite signal (note that there is no write signal for MDR; Why?) Set sources for ALU Source 1: mux set to come from PC (signal ALUSrcA = 0) Source 2: mux set to constant 4 (signal ALUSrcB = 01) Set ALU control to + (e.g., ALUop = 00 and don t care for the function bits) 4/22/2004 CSE378 Multicycle impl,. 11 4/22/2004 CSE378 Multicycle impl,. 12 2

(PC increment; cf. Figure 5.33) Set the mux to store in PC as coming from ALU (signal PCsource = 01) Set PCwrite Note: this could be wrong if we had a branch but it will be overwritten in that case; see step 3 of branch instructions Instruction decode and read source registers Read registers in A and B No need for control signals. This will happen at every cycle. No problem since neither IR (giving names of the registers) nor the registers themselves are modified. When we need A and B as sources for the ALU, e.g., in step 3, the muxes will be set accordingly Branch target computations. Select inputs for ALU Source 1: mux set to come from PC (signal ALUSrcA = 0) Source 2: mux set to come from IR, sign-extended, shifted left 2 (signal ALUSrcB = 11) Set ALU control to + (ALUop = 00) 4/22/2004 CSE378 Multicycle impl,. 13 4/22/2004 CSE378 Multicycle impl,. 14 Concept of state The first two states During steps 1 and 2, all instructions do the same thing At step 3, opcode is directing What control lines to assert (it will be different for a load, an add, a branch etc.) What will be done at subsequent steps (e.g., access memory, writing a register, fetching the next instruction) At each cycle, the control unit is put in a specific state that depends only on the previous state and the opcode (current state, opcode) (next state) Finite state machine (cf. CSE370, CSE 322) Since the data flow and the control signals are the same for all instructions in step 1 (instr. fetch) there is only one state associated with step 1, say state 0 And since all operations in the next step are also always the same, we will have the transition (state 0, all) (state 1) 4/22/2004 CSE378 Multicycle impl,. 15 4/22/2004 CSE378 Multicycle impl,. 16 Customary notation Transitions from State 1 (state 0) Memread ALUSrcA = 0 IorD = 0 Irwrite ALUsrcB = 01 ALUop =00 Pcwrite Pcsource = 00 No label because transition is always taken Instruction decode and read source registers (state 1) ALUSrcA = 0 ALUsrcB = 11 ALUop =00 After the decode, the data flow depends on the type of instructions: Register-Register : Needs to compute a result and store it Load/Store: Needs to compute the address, access memory, and in the case of a load write the result register Branch: test the result of the condition and, if need be, change the PC Jump: need to change the PC Immediate: Not shown in the figures. Do it as an exercise 4/22/2004 CSE378 Multicycle impl,. 17 4/22/2004 CSE378 Multicycle impl,. 18 3

State transitions from State 1 State 2: Memory Address Computation State 0 State 1 Start Opcode = etc Opcode Mem op. Opcode R-R. Opcode branch. Opcode jump. State 2 Set sources for ALU Source 1: mux set to come from A (signal ALUSrcA = 1) Source 2: mux set to imm. extended (signal ALUSrcB = 10) Set ALU control to + (ALUop = 00) Transition from State 2 If we have a load transition to State 3 If we have a store transition to State 5 4/22/2004 CSE378 Multicycle impl,. 19 4/22/2004 CSE378 Multicycle impl,. 20 State 2: Memory address computation One more example: State 5 --Store Opcode load State 3 ALUSrcA =1 ALUSrcB = 10 ALUop = 00 State 2 Opcode store State 5 The control signals are: Set mux for address as coming from ALUout (IorD = 1) Set MemWrite Note that what has to be written has been sitting in B all that time (and was rewritten, unmodified, at every cycle). Since the instruction is completed, the transition from State 5 is always to State 0 to fetch a new instruction. (State 5, always) (State 0) 4/22/2004 CSE378 Multicycle impl,. 21 4/22/2004 CSE378 Multicycle impl,. 22 Multiple Cycle Implementation: the whole story Data path with control lines: Figure 5.33 Control unit Finite State Machine Figure 5.42 Immediate instructions are not there Hardwired implementation of the control unit Single cycle implementation: Input (Opcode) Combinational circuit (PAL) Output signals (data path) Input (Opcode + function bits) ALU control Multiple cycle implementation Need to implement the finite state machine Input (Opcode + Current State -- stable storage) Combinational circuit (PAL) Output signals (data path + setting next state) Input (Opcode + function bits + Current State) ALU control 4/22/2004 CSE378 Multicycle impl,. 23 4/22/2004 CSE378 Multicycle impl,. 24 4

Hardwired diagram PAL Output To data path Input Opcode + function bits State Reg 4/22/2004 CSE378 Multicycle impl,. 25 5