CS3350B Computer Architecture Winter Lecture 5.6: Single-Cycle CPU: Datapath Control (Part 1)

Similar documents
Review: MIPS Addressing Modes/Instruction Formats

Computer organization

Reduced Instruction Set Computer (RISC)

Solutions. Solution The values of the signals are as follows:

Pipeline Hazards. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by Arvind and Krste Asanovic

Introducción. Diseño de sistemas digitales.1

Design of Pipelined MIPS Processor. Sept. 24 & 26, 1997

Computer Organization and Components

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Chapter 9 Computer Design Basics!

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

Design of Digital Circuits (SS16)

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture

CS352H: Computer Systems Architecture

Generating MIF files

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

A SystemC Transaction Level Model for the MIPS R3000 Processor

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Assembly Language Programming

A FPGA Implementation of a MIPS RISC Processor for Computer Architecture Education

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

Microprocessor & Assembly Language

The 104 Duke_ACC Machine

CPU Organization and Assembly Language

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

Chapter 2 Logic Gates and Introduction to Computer Architecture

(Refer Slide Time: 00:01:16 min)

Memory Elements. Combinational logic cannot remember

Execution Cycle. Pipelining. IF and ID Stages. Simple MIPS Instruction Formats

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Memory ICS 233. Computer Architecture and Assembly Language Prof. Muhamed Mudawar

Central Processing Unit (CPU)

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

CSE 141 Introduction to Computer Architecture Summer Session I, Lecture 1 Introduction. Pramod V. Argade June 27, 2005

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

MICROPROCESSOR AND MICROCOMPUTER BASICS

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

16-bit ALU, Register File and Memory Write Interface

Central Processing Unit

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

CSE 141L Computer Architecture Lab Fall Lecture 2

Instruction Set Design

CPU Organisation and Operation

BASIC COMPUTER ORGANIZATION AND DESIGN

Let s put together a Manual Processor

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

Summary of the MARIE Assembly Language

EE361: Digital Computer Organization Course Syllabus

PART B QUESTIONS AND ANSWERS UNIT I

WAR: Write After Read

EECS 427 RISC PROCESSOR

Systems I: Computer Organization and Architecture

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Systems I: Computer Organization and Architecture

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

ASYNCHRONOUS COUNTERS

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

TIMING DIAGRAM O 8085

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Lecture-3 MEMORY: Development of Memory:

Solution: start more than one instruction in the same clock cycle CPI < 1 (or IPC > 1, Instructions per Cycle) Two approaches:

BINARY CODED DECIMAL: B.C.D.

Systems I: Computer Organization and Architecture

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Computer Organization and Components

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

LSN 2 Computer Processors

Intel 8086 architecture

Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

Understanding Verilog Blocking and Non-blocking Assignments

Computer Organization and Architecture

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

1 Classical Universal Computer 3

INSTRUCTION LEVEL PARALLELISM PART VII: REORDER BUFFER

Digital Logic Design Sequential circuits

CPU Performance Equation

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Using Graphics and Animation to Visualize Instruction Pipelining and its Hazards

Software Pipelining. for (i=1, i<100, i++) { x := A[i]; x := x+1; A[i] := x

SMIPS Processor Specification

EC 362 Problem Set #2

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

An Introduction to the ARM 7 Architecture

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Transcription:

CS3350B Computer Architecture Winter 2015 Lecture 56: Single-Cycle CPU: Datapath Control (Part 1) Marc Moreno Maza wwwcsduwoca/courses/cs3350b [Adapted from lectures on Computer Organization and Design, Patterson & Hennessy, 5 th edition, 2013]

Review CPU design involves Datapath, Control 5 Stages for MIPS Instructions 1 Instruction Fetch 2 Instruction Decode & Register Read 3 ALU (Execute) 4 Memory 5 Register Write Datapath timing: single long clock cycle or one short clock cycle per stage 2

PC instruction memory registers Data memory Datapath and Control Datapath based on data transfers required to perform instructions Controller causes the right transfers to happen rd rs rt ALU +4 imm opcode, funct Controller 3

CPU Clocking (1/2) For each instruction, how do we control the flow of information though the datapath? Single Cycle CPU: All stages of an instruction completed within one long clock cycle Clock cycle sufficiently long to allow each instruction to complete all stages without interruption within one cycle 1 Instruction Fetch 2 Decode/ Register Read 3 Execute 4 Memory 5 Reg Write 4

CPU Clocking (2/2) Alternative multiple-cycle CPU: only one stage of instruction per clock cycle Clock is made as long as the slowest stage 1 Instruction Fetch 2 Decode/ Register Read 3 Execute 4 Memory 5 Register Write Several significant advantages over single cycle execution: Unused stages in a particular instruction can be skipped OR instructions can be pipelined (overlapped) 5

Plan Stages of the Datapath Datapath Instruction Walkthroughs Datapath Design 6

Five Components of a Computer Processor Control Datapath Computer Memory (passive) (where programs, data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, data live when not running) Display, Printer 7

Processor Design: 5 steps Step 1: Analyze instruction set to determine datapath requirements Meaning of each instruction is given by register transfers Datapath must include storage element for ISA registers Datapath must support each register transfer Step 2: Select set of datapath components & establish clock methodology Step 3: Assemble datapath components that meet the requirements Step 4: Analyze implementation of each instruction to determine setting of control points that realizes the register transfer Step 5: Assemble the control logic 8

The MIPS Instruction Formats All MIPS instructions are bits long 3 formats: R-type I-type J-type 31 31 31 op rs rt rd shamt funct 6 bits 5 bits 5 bits 16 bits 26 op 26 target address 6 bits 26 bits The different fields are: op: operation ( opcode ) of the instruction rs, rt, rd: the source and destination register specifiers shamt: shift amount funct: selects the variant of the operation in the op field address / immediate: address offset or immediate value target address: target address of jump instruction 21 16 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits 26 21 16 op rs rt address/immediate 11 6 9 0 0 0

The MIPS-lite Subset ADDU and SUBU addu rd,rs,rt 31 26 21 16 op rs rt rd shamt funct 11 6 0 subu rd,rs,rt 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits OR Immediate: ori rt,rs,imm16 LOAD and STORE Word lw rt,rs,imm16 31 31 26 21 op rs rt immediate 6 bits 5 bits 5 bits 16 bits 26 21 op rs rt immediate 6 bits 5 bits 5 bits 16 bits 16 16 0 0 sw rt,rs,imm16 BRANCH: beq rs,rt,imm16 31 26 21 op rs rt immediate 16 0 6 bits 5 bits 5 bits 16 bits 10

Register Transfer Language (RTL) RTL gives the meaning of the instructions All start by fetching the instruction {op, rs, rt, rd, shamt, funct} MEM[ PC ] {op, rs, rt, Imm16} MEM[ PC ] Inst Register Transfers ADDU R[rd] R[rs] + R[rt]; PC PC + 4 SUBU R[rd] R[rs] R[rt]; PC PC + 4 ORI R[rt] R[rs] zero_ext(imm16); PC PC + 4 LOAD R[rt] MEM[ R[rs] + sign_ext(imm16)]; PC PC + 4 STORE MEM[ R[rs] + sign_ext(imm16) ] R[rt]; PC PC + 4 BEQ if ( R[rs] == R[rt] ) then PC PC + 4 + (sign_ext(imm16) 00) else PC PC + 4 11

Step 1: Requirements of the Instruction Set Memory (MEM) Instructions & data (will use one for each) Registers (R: x ) Read RS Read RT Write RT or RD PC Extender (sign/zero extend) Add/Sub/OR unit for operation on register(s) or extended immediate Add 4 (+ maybe extended immediate) to PC Compare registers? 12

Step 2: Components of the Datapath A B Combinational Elements Storage Elements + Clocking Methodology Building Blocks Adder CarryIn Select A Sum CarryOut B MUX Adder Multiplexer A Y B OP ALU ALU Result 13

ALU Needs for MIPS-lite + Rest of MIPS Addition, subtraction, logical OR, ==: ADDU R[rd] = R[rs] + R[rt]; SUBU R[rd] = R[rs] R[rt]; ORI R[rt] = R[rs] zero_ext(imm16) BEQ if ( R[rs] == R[rt] ) Test to see if output == 0 for any ALU operation gives == test How? P&H also adds AND, Set Less Than (1 if A < B, 0 otherwise) ALU follows Chapter 5 14

Storage Element: Idealized Memory Write Enable Address Memory (idealized) One input bus: Data In Data In One output bus: Data Out Clk Memory word is found by: Address selects the word to put on Data Out Write Enable = 1: address selects the memory word to be written via the Data In bus Clock input (CLK) CLK input is a factor ONLY during write operation During read operation, behaves as a combinational logic block: Address valid Data Out valid after access time DataOut 15

Storage Element: Register (Building Block) Similar to D Flip Flop except N-bit input and output Write Enable input Write Enable: Data In Negated (or deasserted) (0): Data Out will not change Asserted (1): Data Out will become Data In on positive edge of clock N Write Enable clk Data Out N 16

Storage Element: Register File Register File consists of registers: Two -bit output busses: busa and busb One -bit input bus: busw Register is selected by: Write Enable busw RA (number) selects the register to put on busa (data) RB (number) selects the register to put on busb (data) RW (number) selects the register to be written via busw (data) when Write Enable is 1 Clock input (clk) Clk input is a factor ONLY during write operation During read operation, behaves as a combinational logic block: RA or RB valid busa or busb valid after access time Clk RW RA RB 5 5 5 x -bit Registers busa busb 17

Step 3a: Instruction Fetch Unit Register Transfer Requirements Datapath Assembly Instruction Fetch Read Operands and Execute Operation Common RTL operations Fetch the Instruction: mem[pc] Update the program counter: Sequential Code: PC PC + 4 Branch and Jump: PC something else clk PC Address Instruction Memory Next Address Logic Instruction Word 18

Step 3b: Add & Subtract R[rd] = R[rs] op R[rt] (addu rd,rs,rt) Ra, Rb, and Rw come from instruction s Rs, Rt, and Rd fields 31 26 21 16 11 6 0 op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits ALUctr and RegWr: control logic after decoding the instruction busw clk RegWr Rd Rs Rt 5 5 5 Rw Ra Rb x -bit Registers busa busb Already defined the register file & ALU ALUctr ALU Result 19

Clocking Methodology Clk Storage elements clocked by same edge Flip-flops (FFs) and combinational logic have some delays Gates: delay from input change to output change Signals at FF D input must be stable before active clock edge to allow signal to travel within the FF (set-up time), and we have the usual clock-to-q delay Critical path (longest path through logic) determines length of clock period 20

Register-Register Timing: One Complete Cycle Clk PC Old Value Rs, Rt, Rd, Op, Func ALUctr New Value Old Value Old Value Instruction Memory Access Time New Value Delay through Control Logic New Value RegWr Old Value New Value Register File Access Time busa, B Old Value New Value ALU Delay busw Old Value New Value RegWr busw clk Rd 5 5 Rw Rs Rt Ra Rb RegFile 5 busa busb ALUctr ALU Register Write Occurs Here 21

Putting it All Together: A Single Cycle Datapath 00 4 PC Ext imm16 Adder Adder npc_sel Mux Inst Memory PC clk Adr Rs RegDst RegWr busw Rd 1 clk <21:25> Rt 5 5 imm16 0 <16:20> Rt Rs Rw Ra Rb RegFile 16 Rd Rt 5 <11:15> Extender busa busb ExtOp <0:15> Imm16 Equal Instruction<31:0> 0 1 ALUSrc ALUctr MemtoReg MemWr = ALU Data In clk WrEn Adr Data Memory 0 1 22

Processor Design: 3 of 5 steps Step 1: Analyze instruction set to determine datapath requirements Meaning of each instruction is given by register transfers Datapath must include storage element for ISA registers Datapath must support each register transfer Step 2: Select set of datapath components & establish clock methodology Step 3: Assemble datapath components that meet the requirements Step 4: Analyze implementation of each instruction to determine setting of control points that realizes the register transfer Step 5: Assemble the control logic 23