Chapter 3. ALU Design

Similar documents
CPE 335 Computer Organization. MIPS Arithmetic Part I. Content from Chapter 3 and Appendix B

Chapter 3 Arithmetic for Computers

Part I: Translating & Starting a Program: Compiler, Linker, Assembler, Loader. Lecture 4

LECTURE 4. Logic Design

Computer Architecture Set Four. Arithmetic

CSE 141 Computer Architecture Summer Session Lecture 2 Performance, ALU. Pramod V. Argade

CS Computer Architecture. 1. Explain Carry Look Ahead adders in detail

Week 7: Assignment Solutions

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

Basic Arithmetic (adding and subtracting)

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Number Systems and Computer Arithmetic

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

CSE140: Components and Design Techniques for Digital Systems

Lets Build a Processor

Review: MIPS Organization

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

CS Computer Architecture Spring Week 10: Chapter

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

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

Boolean Algebra. Chapter 3. Boolean Algebra. Chapter 3 Arithmetic for Computers 1. Fundamental Boolean Operations. Arithmetic for Computers

We are quite familiar with adding two numbers in decimal

CENG 3420 Lecture 05: Arithmetic and Logic Unit

CENG3420 L05: Arithmetic and Logic Unit

The MIPS Processor Datapath

Lecture 14: Recap. Today s topics: Recap for mid-term No electronic devices in midterm

ECE468 Computer Organization & Architecture. The Design Process & ALU Design

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

CS222: Processor Design

Learning Outcomes. Spiral 2 2. Digital System Design DATAPATH COMPONENTS

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

Systems Architecture

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

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

Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS

CAD4 The ALU Fall 2009 Assignment. Description

Review. Steps to writing (stateless) circuits: Create a logic function (one per output)

CENG 3420 Lecture 06: Datapath

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Digital Logic. Copyright By NODIA & COMPANY

Arithmetic Logic Unit. Digital Computer Design

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

UC Berkeley College of Engineering, EECS Department CS61C: Combinational Logic Blocks

UC Berkeley College of Engineering, EECS Department CS61C: Combinational Logic Blocks

Review: Abstract Implementation View

Fast Arithmetic. Philipp Koehn. 19 October 2016

Systems Architecture I

ECE369. Chapter 5 ECE369

Tailoring the 32-Bit ALU to MIPS

Binvert Operation (add, and, or) M U X

Lecture 5. Other Adder Issues

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

Digital Electronics & Computer Engineering (E85)

Chapter 5: The Processor: Datapath and Control

Instruction Set Architecture (ISA) Data Types

Chapter 4. The Processor

Mark Redekopp, All rights reserved. EE 352 Unit 8. HW Constructs

To design a 4-bit ALU To experimentally check the operation of the ALU

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

ECE 341 Midterm Exam

ECE260: Fundamentals of Computer Engineering

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

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

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

CS429: Computer Organization and Architecture

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

Let s put together a Manual Processor

Lecture 21: Combinational Circuits. Integrated Circuits. Integrated Circuits, cont. Integrated Circuits Combinational Circuits

CS/COE 0447 Example Problems for Exam 2 Fall 2010

M.J. Flynn 1. Lecture 6 EE 486. Bit logic. Ripple adders. Add algorithms. Addition. EE 486 lecture 6: Integer Addition

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

CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

Chapter 4. The Processor

Arithmetic for Computers

Chapter 4. The Processor Designing the datapath

Processor (I) - datapath & control. Hwansoo Han

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

The Processor: Datapath & Control

Systems Programming. Lecture 2 Review of Computer Architecture I

Chapter 4. The Processor

Computer Hardware Engineering

MIPS Integer ALU Requirements

Addition and multiplication

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

Department of Electrical and Computer Engineering University of Wisconsin - Madison. ECE/CS 352 Digital System Fundamentals.

Implementing the Control. Simple Questions

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit

CS61C : Machine Structures

Topic #6. Processor Design

COMPUTER ORGANIZATION AND DESIGN

Single Cycle Datapath

Register Transfer Level (RTL) Design

Parallel logic circuits

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

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

Transcription:

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 ALU Design Review - A MIPS ALU Implementation add/subt A 0 op B 0 A 1 less + result 0 Zero detect (slt, slti,sltiu,sltu, beq,bne) result 1 B 1 0 0 set A 31 less + result 31 + B 31 less...... ovf zero Overflow bit setting for signed arithmetic (add, addi, sub) Chapter 3 Arithmetic for Computers 1

1-Bit ALU with Add, Or, And Multiplexor selects between Add, Or, And operations 32-bit Ripple Carry Adder 1-bit ALUs are connected in series with the carry-out of 1 box going into the carry-in of the next box Chapter 3 Arithmetic for Computers 2

Incorporating Subtraction Must invert bits of B and add a 1 Include an inverter. CarryIn for the first bit is 1. The CarryIn signal (for the first bit) can be the same as the Binvert signal. Incorporating NOR and NAND Chapter 3 Arithmetic for Computers 3

Incorporating slt Perform a b and check the sign New signal (Less) that is zero for ALU boxes 1-31 The 31 st box has a unit to detect overflow and sign the sign bit serves as the Less signal for the 0 th box Incorporating beq Perform a b and confirms that the result is all zero s Chapter 3 Arithmetic for Computers 4

Control Lines Control Lines What are the values of the control lines and what operations do they correspond to? Ai Bn Op AND 0 0 00 OR 0 0 01 Add 0 0 10 Sub 0 1 10 SLT 0 1 11 NOR 1 1 00 Chapter 3 Arithmetic for Computers 5

Speed of Ripple Carry The carry propagates through every 1-bit box: each 1-bit box sequentially implements AND and OR total delay is the time to go through 64 gates! You know that any logic equation can be expressed as the sum of products so it should be possible to compute the result by going through only 2 gates! Caveat: need many parallel gates and each gate may have a very large number of inputs it is difficult to efficiently build such large gates, so we ll find a compromise: moderate number of gates. moderate number of inputs to each gate. moderate number of sequential gates traversed. Computing CarryOut CarryIn1 = b0.carryin0 + a0.carryin0 + a0.b0 CarryIn2 = b1.carryin1 + a1.carryin1 + a1.b1 = b1.b0.c0 + b1.a0.c0 + b1.a0.b0 + a1.b0.c0 + a1.a0.c0 + a1.a0.b0 + a1.b1 CarryIn32 = a really large sum of really large products Potentially fast implementation as the result is computed by going thru just 2 levels of logic unfortunately, each gate is enormous and slow. Chapter 3 Arithmetic for Computers 6

Generate and Propagate Equation re-phrased: Ci+1 = ai.bi + ai.ci + bi.ci = (ai.bi) + (ai + bi).ci Stated verbally, the current pair of bits will generate a carry if they are both 1 and the current pair of bits will propagate a carry if either is 1 Generate signal = ai.bi Propagate signal = ai + bi Therefore, Ci+1 = Gi + Pi. Ci Generate and Propagate c1 = g0 + p0.c0 c2 = g1 + p1.c1 = g1 + p1.g0 + p1.p0.c0 c3 = g2 + p2.g1 + p2.p1.g0 + p2.p1.p0.c0 c4 = g3 + p3.g2 + p3.p2.g1 + p3.p2.p1.g0 + p3.p2.p1.p0.c0 Either, a carry was just generated, or a carry was generated in the last step and was propagated, or a carry was generated two steps back and was propagated by both the next two stages, or a carry was generated N steps back and was propagated by every single one of the N next stages Chapter 3 Arithmetic for Computers 7

Divide and Conquer The equations on the previous slide are still difficult to implement as logic functions for the 32 nd bit, we must AND every single propagate bit to determine what becomes of c0 (among other things). Hence, the bits are broken into groups (of 4) and each group computes its group-generate and group-propagate. For example, to add 32 numbers, you can partition the task as a tree...................... P and G for 4-bit Blocks Compute P0 and G0 (super-propagate and super-generate) for the first group of 4 bits (and similarly for other groups of 4 bits) P0 = p0.p1.p2.p3 G0 = g3 + g2.p3 + g1.p2.p3 + g0.p1.p2.p3 Carry out of the first group of 4 bits is C1 = G0 + P0.c0 C2 = G1 + P1.G0 + P1.P0.c0 By having a tree of sub-computations, each AND, OR gate has few inputs and logic signals have to travel through a modest set of gates (equal to the height of the tree). Chapter 3 Arithmetic for Computers 8

Example Add A 0001 1010 0011 0011 and B 1110 0101 1110 1011 g 0000 0000 0010 0011 p 1111 1111 1111 1011 P 1 1 1 0 G 0 0 1 0 C4 = 1 Carry Look-Ahead Adder 16-bit Ripple-carry takes 32 steps This design takes how many steps? Chapter 3 Arithmetic for Computers 9

Implementation Overview We need memory to store instructions to store data for now, let s make them separate units We need registers, ALU, and a whole lot of control logic CPU operations common to all instructions: use the program counter (PC) to pull instruction out of instruction memory read register values Big Picture Note: we haven t bothered showing multiplexors What is the role of the Add units? Explain the inputs to the data memory unit. Explain the inputs to the ALU. Explain the inputs to the register unit. Chapter 3 Arithmetic for Computers 10

Clocking Methodology Which of the above units need a clock? What is being saved (latched) on the rising edge of the clock? Keep in mind that the latched value remains there for an entire cycle. Chapter 3 Arithmetic for Computers 11