CS/COE0447: Computer Organization

Similar documents
CS/COE0447: Computer Organization

Design of the MIPS Processor

Design of the MIPS Processor (contd)

Processor: Multi- Cycle Datapath & Control

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

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

CPE 335. Basic MIPS Architecture Part II

Inf2C - Computer Systems Lecture 12 Processor Design Multi-Cycle

LECTURE 5. Single-Cycle Datapath and Control

CSE 2021 COMPUTER ORGANIZATION

Systems Architecture I

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

Processor (I) - datapath & control. Hwansoo Han

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

CC 311- Computer Architecture. The Processor - Control

LECTURE 6. Multi-Cycle Datapath and Control

ECE369. Chapter 5 ECE369

Topic #6. Processor Design

RISC Processor Design

The Processor: Datapath & Control

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

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

CSEN 601: Computer System Architecture Summer 2014

CSE 2021 COMPUTER ORGANIZATION

Chapter 5 Solutions: For More Practice

Chapter 5: The Processor: Datapath and Control

Systems Architecture

ENE 334 Microprocessors

EECE 417 Computer Systems Architecture

CPE 335 Computer Organization. Basic MIPS Architecture Part I

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

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control

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

Points available Your marks Total 100

Lets Build a Processor

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

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

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

Processor (multi-cycle)

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

Computer Science 141 Computing Hardware

Multiple Cycle Data Path

Lecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl.

Chapter 4 The Processor (Part 2)

The Processor: Datapath & Control

Single vs. Multi-cycle Implementation

RISC Architecture: Multi-Cycle Implementation

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

RISC Design: Multi-Cycle Implementation

Multicycle Approach. Designing MIPS Processor

Single Cycle Data Path

MIPS-Lite Single-Cycle Control

Laboratory 5 Processor Datapath

CS3350B Computer Architecture Quiz 3 March 15, 2018

CENG 3420 Lecture 06: Datapath

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

The MIPS Processor Datapath

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

COMP2611: Computer Organization. The Pipelined Processor

Major CPU Design Steps

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

Single Cycle CPU Design. Mehran Rezaei

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

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

RISC Architecture: Multi-Cycle Implementation

Chapter 4. The Processor

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

Review: Abstract Implementation View

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

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

Lecture 5: The Processor

Implementing the Control. Simple Questions

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

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

Multicycle conclusion

Fundamentals of Computer Systems

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

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

CPU Design Steps. EECC550 - Shaaban

CPU Organization (Design)

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

Chapter 4. The Processor

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

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

ECE232: Hardware Organization and Design

Initial Representation Finite State Diagram. Logic Representation Logic Equations

Computer Hardware Engineering

Project Description EEC 483 Computer Organization, Spring 2019

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

Chapter 4. The Processor Designing the datapath

Mapping Control to Hardware

Adding Support for jal to Single Cycle Datapath (For More Practice Exercise 5.20)

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

Learning Outcomes. Spiral 3-3. Sorting: Software Implementation REVIEW

Computer Architecture, IFE CS and T&CS, 4 th sem. Single-Cycle Architecture

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

ECS 154B Computer Architecture II Spring 2009

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

Inf2C - Computer Systems Lecture Processor Design Single Cycle

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

Transcription:

CS/COE0447: Computer Organization and Assembly Language Datapath and Control Sangyeun Cho Dept. of Computer Science A simple MIPS We will design a simple MIPS processor that supports a small instruction set with Memory access instructions lw (load word) and sw (store word) Arithmetic-logic instructions add, sub, and, or, and slt Control-transfer instructions beq (branch if equal) j (unconditional jump) 2

Initial ideas Send program counter (PC) to code memory and fetch an instruction from there PC keeps the address (i.e., pointer) where the target instruction is Read one or two registers Depending on the instruction we fetched, we need to perform different actions with the values read from the register file Instructions of the same type (e.g., arithmetic-logic) will incur a similar sequence of actions 3 Abstract implementation 4

Datapath elements Arithmetic logic unit (ALU) Combinational logic (=function) Input: a, b, ALU operation (carryin is hidden) Output: result, zero, overflow, carryout Adders For PC incrementing, branch target calculation, Mux We need a lot of these Registers Register file, PC, (architecturally visible registers) Temporary registers to keep intermediate values 5 Register file Interface: read port, write port, clock, control signal 6

Register file 0 1 1 0x11223344 0 0 0x11223344 7 Processor building blocks 8

Abstract implementation 9 Analyzing instruction execution lw (load word) Fetch instruction Read a base register Sign-extend the immediate offset Add the two numbers made available in the above two steps Access data memory with the address computed in the above step Store the value from the memory to the target register specified in the instruction 10

Analyzing instruction execution add (add) Fetch instruction Read from two source registers Add the two numbers made available in the above step Store the result to the target register specified in the instruction 11 Analyzing instruction execution j (jump) Fetch instruction Extend the 26-bit immediate field Shift left by 2 bits (28 bits now) Extract the most significant 4 bits from the current PC and concatenate to form a 32-bit value Assign this value to PC 12

Common steps in inst. execution Fetching the instruction word from the instruction memory Decoding the instruction and reading from the register file Or prepare a value from the immediate value (and PC) Performing g an ALU operation p Accessing the data memory (if needed) Making a jump (assigning a computed value to PC) (if needed) Writing to the register file Designing D i i a control t l logic l i is i b based d on our ((more fformal) l) analysis of instruction execution Consider all instructions 13 Fetching an instruction Instruction width is 4 bytes! PC keeps the current dd memory address from which instruction is fetched Instruction memory here is read-only! 14

Fetching operands For branches! Two reads at a time! 15 Handling memory access Data to store! I ff t Imm. offset for address Load data from memory Data to be in g a register! 16

Datapath so far j instruction not considered d so far! 17 Revisiting MIPS inst. format 18

More elaborate datapath Write register # selection ALU control bits from Inst[5:0] 19 First look at control 20

Control signals overview RegDst: which instr. field to use for dst. register specifier? Inst[20:16] vs. Inst[15:11] ALUSrc: which one to use for ALU src 2? Immediate vs. register read port 2 MemtoReg: is it memory load? RegWrite: update register? MemRead: read memory? MemWrite: write to memory? Branch: is it a branch? ALUop: what type of ALU operation? 21 Example: lw r8, 32(r18) Let s assume r18 has 1,000 Let s assume M[1032] has 0x11223344 22

Example: lw r8, 32(r18) (PC+4) (PC+4) Branch=0 (PC+4) 35 RegWrite 18 1000 8 0x11223344 RegDest=0 8 ALUSrc=1 1032 0 32 MemtoReg=1 0x11223344 32 32 MemRead 0x11223344 23 Control sequence for lw OP code=35 RegDst=0 ALUSrc=1 MemtoReg=1 RegWrite=1 MemRead=1 MemWrite=0 Branch=0 ALUop=0 (i.e., add) why add? 24

Control signals in a table 25 ALU control Depending on instruction, we perform different ALU operation Example lw or sw: ADD and: AND beq: SUB ALU control input (3 bits) 000: AND 001: OR 010: ADD 110: SUB 111: SET-IF-LESS-THAN (similar to SUB) 26

ALU control ALUop 00: lw/sw, 01: beq, 10: arithmetic, 11: jump 27 ALU control truth table input output 28

ALU control logic implementation products sums 29 Supporting j instruction 30

Resource usage 31 Single-cycle execution timing (in pico-seconds) 32

Single-cycle execution problem The cycle time depends on the most time-consuming instruction What happens if we implement a more complex instruction, e.g., a floating-point multiplication All resources are simultaneously active there is no sharing of resources We ll adopt a multi-cycle solution which allows us to Use a faster clock; Adopt a different number of clock cycles per instruction; and Reduce physical resources 33 Multi-cycle implementation Reusing functional units Break up instruction execution into smaller steps Each functional unit is used for a specific purpose in any cycle ALU is used for additional functions: calculation and PC increment Memory used for instructions and data At the end of a cycle, keep results in registers Additional registers Now, control signals are NOT solely determined by the instruction bits Controls will be generated by a FSM! 34

Five instruction execution steps Instruction fetch Instruction decode and register read Execution, memory address calculation, or branch completion Memory access or R-type instruction completion Write-back Instruction execution takes 3~5 cycles! 35 Step 1: instruction fetch Access memory w/ PC to fetch instruction and store it in Instruction Register (IR) Increment PC by 4 using ALU and put the result back in the PC We can do this because ALU is not busy in this cycle Actual PC Update is done at the next clock rising i edge 36

Step 2: decode & operand fetch Read registers rs and rt We read both of them regardless of necessity Compute the branch address using ALU in case the instruction is a branch We can do this because ALU is not busy ALUOut will keep the target address We have not set any control signals based on the instruction type yet Instruction is being decoded now in the control logic! 37 Step 3: actions, actions, actions ALU performs one of three functions based on instruction type Memory reference ALUOut <= A + sign-extend(ir[15:0]); R-type ALUOut <= A op B; Branch: if (A==B) PC <= ALUOut; Jump: PC <= {PC[31:28],IR[25:0],2 b00}; // verilog notation 38

Step 4: memory access If the instruction is memory reference MDR <= Memory[ALUOut]; Memory[ALUOut] <= B; Store is complete! // if it is a load // if it is a store If the instruction is R-type Reg[IR[15:11]] <= ALUOut; Now the instruction is complete! 39 Step 5: register write-back Only memory load instruction reaches this step Reg[IR[20:16]] <= MDR; 40

Multi-cycle datapath & control 41 Multi-cycle control design 42

Example: lw, 1 st cycle 00 1 0 1 0 1 0 01 00 43 Example: lw, 2 nd cycle 0 11 00 44

Example: lw, 3 rd cycle 1 10 00 45 Example: lw, 4 th cycle 1 1 0 46

Example: lw, 5 th cycle 1 0 1 47 Example: j, 1 st cycle 00 1 0 1 0 1 0 01 00 48

Example: j, 2 nd cycle 0 11 00 49 Example: j, 3 rd cycle 10 1 50

To wrap up From a number of building blocks, we constructed a datapath for a subset of the MIPS instruction set First, we analyzed instructions for functional requirements Second, we connected buildings blocks in a way that accommodates instructions Third, we kept refining the datapath 51 To wrap up We looked at how an instruction is executed on the datapath in a pictorial i way Control signals were connected to functional blocks in the datapath How execution ecut sequence of an instruction change the control signals was analyzed We looked at the multi-cycle control scheme in some detail Multi-cycle control can be implemented using FSM 52

To wrap up We looked at the multi-cycle control scheme in some detail Multi-cycle control can be implemented using FSM 53