CSE140: Components and Design Techniques for Digital Systems

Similar documents
Register Transfer Level (RTL) Design

Processor (I) - datapath & control. Hwansoo Han

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

Chapter 4. The Processor

CPE 335 Computer Organization. Basic MIPS Architecture Part I

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

CENG 3420 Lecture 06: Datapath

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

Systems Architecture

Chapter 4. The Processor

Ch 5: Designing a Single Cycle Datapath

Lecture 10: Simple Data Path

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

CS Computer Architecture Spring Week 10: Chapter

Inf2C - Computer Systems Lecture Processor Design Single Cycle

Review: Abstract Implementation View

ECE260: Fundamentals of Computer Engineering

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

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

CS61C : Machine Structures

CS61C : Machine Structures

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

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

CS222: Processor Design

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

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

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

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

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

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

Chapter 4. The Processor Designing the datapath

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

The MIPS Processor Datapath

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

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

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

Computer and Information Sciences College / Computer Science Department The Processor: Datapath and Control

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

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

The overall datapath for RT, lw,sw beq instrucution

UC Berkeley CS61C : Machine Structures

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

Systems Architecture I

Chapter 5: The Processor: Datapath and Control

The Processor: Datapath & Control

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

CSE 141L Computer Architecture Lab Fall Lecture 3

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

Single Cycle Datapath

ECE232: Hardware Organization and Design

The Processor: Datapath & Control

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

CPU Organization (Design)

CS 152 Computer Architecture and Engineering Lecture 1 Single Cycle Design

CS61C : Machine Structures

Data paths for MIPS instructions

Topic #6. Processor Design

Single Cycle Datapath

Introduction. Datapath Basics

CC 311- Computer Architecture. The Processor - Control

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

Chapter 4. The Processor

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

Lecture 5: The Processor

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

RISC Processor Design

LECTURE 5. Single-Cycle Datapath and Control

Unsigned Binary Integers

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2)

Unsigned Binary Integers

EEC 483 Computer Organization

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

Processor Design CSCE Instructor: Saraju P. Mohanty, Ph. D. NOTE: The figures, text etc included in slides are borrowed

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

comp 180 Lecture 25 Outline of Lecture The ALU Control Operation & Design The Datapath Control Operation & Design HKUST 1 Computer Science

Major CPU Design Steps

Chapter 4. The Processor

ECE 2300 Digital Logic & Computer Organization. More Single Cycle Microprocessor

Lets Build a Processor

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

RISC Design: Multi-Cycle Implementation

COMPUTER ORGANIZATION AND DESIGN

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

ECE473 Computer Architecture and Organization. Processor: Combined Datapath

Laboratory 5 Processor Datapath

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

Levels in Processor Design

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

COMP303 Computer Architecture Lecture 9. Single Cycle Control

Merging datapaths: (add,lw, sw)

ECE369. Chapter 5 ECE369

ENE 334 Microprocessors

Computer Science 141 Computing Hardware

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

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

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

ECE260: Fundamentals of Computer Engineering

Transcription:

CSE4: Components and Design Techniques for Digital Systems Tajana Simunic Rosing

Announcements and Outline Check webct grades, make sure everything is there and is correct Pick up graded d homework at TA s or my assistant s t office Discussion session this week on Thursday during class time no prof. office hrs from Wed-Sunday this week due to travel Final exam Tuesday, June th, at 3pm, same location as the class Everything covered in lectures, whole book & all handouts Format: Problems similar to HW and previous exams Multiple choice and/or T/F questions on the assigned reading Discussion session will go over the previous year s final Today s topic: Review and CPU design 2

CSE4: Components and Design Techniques for Digital Systems Single Cycle CPU Design Tajana Simunic Rosing 3

4 MIPS Single-Cycle Datapath & Control PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend [5-] CONTROL 4

CPU Components Combinational logic: Boolean equations, logic gates Multiplexors and decoders : executes arithmetic /logical operations 5

2-input, 32-bit Selects one input as the output S I I 32 32 I 3 M U O 3 I 3 X I M 3 M U O 3 U 32 O I implementation 3 X X S I M U O I 6 X

Decoder 2 input, 2 2 = 4 outputs I I 2-to-4 DECODER O O O2 O3 I implementation Translates input into binary number B and turns on output B I I I O3 O2 O O O O O2 O3 7

Full 32-bit OP CODE A 32 CarryIn Performs: AND, OR, NOT, ADD, SUB, Overflow Detection, GTE B 32 32-bit 32 Result Overflow CarryOut 8

MSB OP Binvert CarryIn A3 B3 + ADD GTEin = If GTEout =, A B CarryOut xor 2 3 4 result GTEout xor 9 overflow

Design Example S2 S S Function B-A A-B A+B A xor B A or B A and B

CPU Components Combinational logic: Boolean equations, logic gates Multiplexors and decoders : executes arithmetic /logical operations Sequential logic: The clock Storage (memory) elements Counters

Determining Clock Frequency 5.4 Frequency limited by longest register-to-register delay Known as critical path If clock is any faster, incorrect data may be stored into register Longest path on right is 2 ns Ignoring wire delays, and register setup and hold times, skew clk a 2 ns delay + c b 2

A Circuit May Have Numerous Paths s a Combinational logic d 8 8 c tot_ld tot_clr ld clr tot tot_lt_s n (c) 8 n tot_lt_s 8-bit < 8-bit adder 8 clk s s State register (b) Datapath (a) 3

Memory elements: D-Latch Sets SR-latch (Q) to value of D when clock (C) is high; otherwise last Q retained D C Reset Set stores stores C R: reset nor Q Stored state value S: set nor Q D 4

Memory elements: Flip-Flop Stores new value of D in Q when C falls, otherwise current stored value of Q is retained: falling edge-triggered clocking methodology C (clock) D (data) C D Q D LATCH Q C2 Q2 D LATCH 2 D2 Q2 Q Q 5

Read/Write Register File Input Read Reg #. selects Q for that t set of FFs as output t Input Write Reg # and Value. Write Value goes to each FF. Write Reg # turns on C to only FF, where Value is stored. Clock D E C O D E R O C FF Q D Reg C FF Q Write O Reg # (5 bits) Write Value O3 D Reg C FF Q D Reg 3 3 M U X Read Reg # (5 bits) Read Value 6

2-bit Reset/Inc Falling Edge Counter clock inc reset + C Q Bit BIT BIT FF D Q C Q Bit + FF D Q 7

CPU Components Combinational logic: Boolean equations, logic gates Multiplexors and decoders : executes arithmetic /logical operations Sequential logic: The clock Storage (memory) elements Counters Datapath and Control: logic block that executes machine language instructions 8

Control and Datapath Execute Instruction Set Processor Control Datapath PC R E G I S T E R S Main Memory DEVICES IN PUT OUT PUT Control takes program as input; it interprets each instruction and tells the Datapath to operate on data via, memory and registers 9

CPU Components Single Cycle Execution Assumptions: Every machine language instruction happens in Clock Cycle MIPS architecture Microprocessor without interlocked pipeline stages reg-reg architecture: all operands must be in registers (total 24) 3 Instruction Types; each instruction 32 bits long. R-type: all data in registers (most arithmetic and logical) e.g. add $s, $s2, $s3 2. J-type: jumps and calls e.g. j Label; 3. I-type: branches, memory transfers, constants e.g. beq $s, $s2, Label; lw $s, 32($s2) add $s, $s, $s2 7 8 6 32 2

4 PC [3-] When an assembly language program is run: [3-26] REG_DST BRANCH CON TROL Is assembled, REG_ linked, loaded into instruction MEM_,MEM_ memory _SRC _OP PC initialized to the address of the first instruction [25-2] EM_TO_REG REGISTER [2-6] the PC is really a 32-bit register REGISTER 2 ZERO INST[5-] REGISTERS by separate adders counting is done REGISTER << 2 rest of clock cycle used to fetch/execute I, update PC ME [5-] Sign Extend [5-] CONTROL 2

R-type Instruction: reg-reg ops (e.g. add, and) Tells operation to be performed Tells specific variant of operation (e.g. add/sub have same opcode) R-type Instruction OPCODE = RS shamt RT RD FUNCT = 32 or 34 3-26 25-2 2-6 5- -6 5- ADD $S, $S2, $S3 ADD RD, RS, RT Source Register (attached to Read Register input) Source Register 2 (attached dt to Read Register 2 input) Shift amount (for sll, srl etc.) Destination Register (attached to Write Register input) 22

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step (R-type): Fetch instruction and advance PC [5-] CONTROL 23

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 2 (R-type): Read two registers and set control signals [5-] CONTROL 24

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 3 (R-type): Perform the operation [5-] CONTROL 25

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 4 (R-type): Write result to register [5-] CONTROL 26

I-Type: Store Instruction Tells operation to be performed Store Instruction OPCODE = 35 or 43 RS RT OFFSET 3-26 25-2 2-6 5- Base Address Register (attached to Read Register input) SW $S, 32($S2) SW RT, #(RS) Source register whose value will be stored to memory (attached to Read Register 2 input) Constant offset (added to the base address in RS) Note: same as x86 MOV [ebx+32], eax 27

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step (store): Fetch instruction and advance PC [5-] CONTROL 28

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 2 (store): Read register values and set control signals [5-] CONTROL 29

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 3 (store): Compute the address [5-] CONTROL 3

4 << 2 [3-] [3-26] [25-2] [2-6] INST[5-] PC REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 4 (store): Write the value to memory [5-] CONTROL 3

I-Type: Conditional Branch BEQ/BNE Instruction OPCODE =4or5 RS RT BRANCH TARGET S OFFSET 3-26 25-2 2-6 5- Source Register Source register 2 (attached to Read (attached to Read Register input) Register 2 input) BEQ Source, Source2, Offset BEQ $S, $S2, = AL 4 7 8 25 = ML (in binary) Word Offset, which we multiply by 4 (via <<2) to get Bit Offset, then add to PC+4 to get the address of the instruction to which we branch if RS = RT) PC-relative address 32

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend [5-] Step (beq): Fetch instruction and advance PC CONTROL 33

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend Step 2 (beq): Read register values and set control signals [5-] CONTROL 34

4 PC << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH MEM_,MEM_ ME EM_TO_REG [5-] Sign Extend [5-] Step 3 (beq): Compare registers, calculate branch target, and choose new PC CONTROL 35

J-Type: Unconditional Branch JMP/JAL Instruction OPCODE BRANCH TARGET =2or3 3-26 25- J Offset J = AL 2 25 = ML (in binary) Actual Address (in words) which we multiply by 4 (<<2) to get 28-Bit Address, then concatenate to upper 4 bits of PC+4 to get the 32-bit addresss of instruction to which we branch unconditionally 36

4 PC+4 [3-28] JMP [3-] PC I[25-] JMP [25-] << 2 << 2 [3-] [3-26] [25-2] [2-6] INST[5-] REG_DST REGISTER REGISTER 2 REGISTER REG_ REGISTERS 2 CON TROL _SRC _OP ZERO BRANCH JUMP MEM_,MEM_ MEM M_TO_REG [5-] Sign Extend Single-Cycle Datapath with Support for the Jump Instruction [5-] CONTROL 37