Arithmetic Logic Unit. Digital Computer Design

Similar documents
Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

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

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

CO Computer Architecture and Programming Languages CAPL. Lecture 9

Tailoring the 32-Bit ALU to MIPS

Fundamentals of Computer Systems

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

REGISTER TRANSFER LANGUAGE

ECE 341 Midterm Exam

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

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

Chapter 3 Arithmetic for Computers

Basic Arithmetic and the ALU. Basic Arithmetic and the ALU. Background. Background. Integer multiplication, division

Computer Architecture and Organization: L04: Micro-operations

ENGR 303 Introduction to Logic Design Lecture 7. Dr. Chuck Brown Engineering and Computer Information Science Folsom Lake College

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

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

Computer Architecture Set Four. Arithmetic

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

Introduction to Digital Logic Missouri S&T University CPE 2210 Multipliers/Dividers

Microcomputers. Outline. Number Systems and Digital Logic Review

CS/COE 0447 Example Problems for Exam 2 Spring 2011

Introduction to Boole algebra. Binary algebra

ECE 341 Midterm Exam

Chapter 4. Combinational Logic

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

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

Week 7: Assignment Solutions

COMP 303 Computer Architecture Lecture 6

CPE300: Digital System Architecture and Design

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

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

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

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

Computer Architecture and Organization

Arithmetic Logic Unit (ALU)

Chapter 3: part 3 Binary Subtraction

Parallel logic circuits

EXPERIMENT NUMBER 11 REGISTERED ALU DESIGN

Addition and multiplication

Fundamentals of Computer Systems

Basic Arithmetic (adding and subtracting)

Lec-6-HW-3-ALUarithmetic-SOLN

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

Arithmetic and Logical Operations

Combinational Circuits

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

Principles of Computer Architecture. Chapter 3: Arithmetic

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Week 6: Processor Components

R a) Simplify the logic functions from binary to seven segment display code converter (8M) b) Simplify the following using Tabular method

BINARY SYSTEM. Binary system is used in digital systems because it is:

Chapter 10 Binary Arithmetics

ECE331: Hardware Organization and Design

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

EKT 422/4 COMPUTER ARCHITECTURE. MINI PROJECT : Design of an Arithmetic Logic Unit

Let s put together a Manual Processor

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

ECE 30 Introduction to Computer Engineering

Advanced Computer Architecture-CS501

Chapter 4. The Processor

University of Illinois at Chicago. Lecture Notes # 10

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

ELCT 501: Digital System Design

EE 109 Unit 6 Binary Arithmetic

Number Systems and Computer Arithmetic

ALU Design. 1-bit Full Adder 4-bit Arithmetic circuits. Arithmetic and Logic Unit Flags. Add/Subtract/Increament/Decrement Circuit

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

Chapter 4. The Processor

Digital Logic Design Exercises. Assignment 1

Experiment 7 Arithmetic Circuits Design and Implementation

CS/COE0447: Computer Organization

CS/COE0447: Computer Organization

Code No: R Set No. 1

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

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

Overview. EECS Components and Design Techniques for Digital Systems. Lec 16 Arithmetic II (Multiplication) Computer Number Systems.

CHAPTER 6 ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS

CARLETON UNIVERSITY. Laboratory 2.0

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

Chapter 4 Arithmetic

Outline. Introduction to Structured VLSI Design. Signed and Unsigned Integers. 8 bit Signed/Unsigned Integers

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

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

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

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

Binary Adders. Ripple-Carry Adder

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

ECE 341. Lecture # 6

Combinational Circuit Design

Chap.3 3. Chap reduces the complexity required to represent the schematic diagram of a circuit Library

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

CAD4 The ALU Fall 2009 Assignment. Description

Injntu.com Injntu.com Injntu.com R16

END-TERM EXAMINATION

Review: MIPS Organization

Transcription:

Arithmetic Logic Unit Digital Computer Design

Arithmetic Circuits Arithmetic circuits are the central building blocks of computers. Computers and digital logic perform many arithmetic functions: addition, subtraction, comparisons, shifts, multiplication and division 2

-Bit Adders Half Adder Full Adder A B A B C out + C out + C in S S A B C out S = A B C out = AB S C in A B C out S S = A B C in C out = AB + AC in + BC in 3

Multibit Adders - Carry Propagate Adders (CPAs) An N-bit adder sums two N-bit inputs A and B, and a carry in C in to produce an N-bit result S and a carry out C out. A N B N C out + S N C in Multibit adder is commonly called a carry propagate adder (CPA) because the carry out of one bit propagates into the next bit. 4

CPAs: - Ripple-Carry Adder Chain together N full adders. The C out of one stage acts as the C in of the next stage A 3 B 3 A 3 B 3 A B A B C out + C + 3 C 29 C + C + C in S 3 S 3 S S The ripple-carry adder is slow when N is large. For an 32-bit adder, S 3 depends on C 3, which depends on C 29, which depends on C 28, and so forth all the way back to C in. 5

CPAs: - Ripple-Carry Adder The fundamental reason that large ripple-carry adders are slow is that the carry signals must propagate through every bit in the adder. A 3 B 3 A 3 B 3 A B A B C out + C + 3 C 29 C + C + C in S 3 S 3 S S tripple = Nt FA where t FA is the delay of a -bit full adder 6

CPAs: 2- Carry-Lookahead Adder (CLA) Generate (G i ): Column i will generate a carry out if A i and B i are both. C i- A i A i- G i = A i B i Propagate (P i ): Column i will propagate a carry in B i B i- C i S i S i- (C i- ) to the carry out if A i or B i is. P i = A i + B i Carry out (C i ): The carry out of column i is: C i = A i B i + (A i +B i )C i- = G i + P i C i- 7

CPAs: 2- Carry-Lookahead Adder (CLA) A 3 A 2 A A C in B 3 B 2 B B C 3: S 3 S 2 S S Propagate and generate signals for 4-bit blocks (P 3: and G 3: ): P 3: = P 3 P 2 P P G 3: = G 3 + P 3 (G 2 + P 2 (G + P G ) C 3: = G 3: + P 3: C in 8

CPAs: 2- Carry-Lookahead Adder (CLA) B 3:28 A 3:28 B 27:24 A 27:24 B 7:4 A 7:4 B 3: A 3: C out 4-bit CLA Block C 27 4-bit CLA Block C 23 C 7 4-bit CLA Block C 3 4-bit CLA Block C in S 3:28 S 27:24 S 7:4 S 3: All G i:j and P i:j are computed in parallel C out B 3 A 3 + S 3 G 3: C 2 B 2 A 2 + S 2 C B A + S C B + S A C in G 3 P 3 G 2 P 2 G P G independently C in propagates through each k-bit propagate/ generate logic (meanwhile computing sums) C out C in P 3: P 3 P 2 P P 32-bit CLA with 4-bit Blocks 9

CPAs: 2- Carry-Lookahead Adder (CLA) For N-bit CLA with k-bit blocks, the delay is: t CLA = t pg + t pg_block + (N/k )t AND_OR + kt FA t pg : generate all P i, G i t pg_block : generate all P i:j, G i:j t AND_OR t pg_block t pg

CPAs: Ripple-Carry Adder vs CLA Assume that each two-input gate delay is ps and that a full adder delay is 3 ps. The CLA has t pg = ps, t pg_block =6x ps = 6 ps, and t AND_OR = 2x ps = 2 ps. 32-bit ripple-carry adder Delay is 32x3 ps = 9.6 ns. 32-bit carry-lookahead adder with 4-bit blocks Delay is ps+ 6 ps + (32/4 )x2 ps + (4x3 ps) = 3.3 ns. CLA is almost three times faster than the ripple-carry adder.

Subtracter Subtraction is almost as easy: flip the sign of the second number, then add. Symbol Implementation A N - Y B N N N A B Flipping the sign of a two s complement number is done by inverting the bits and adding. + Y N N N 2

Comparator: Equality A comparator determines whether two binary numbers are equal or if one is greater or less than the other. Symbol Implementation A 3 B 3 A 4 = B 4 A 2 B 2 A Equal Equal B A B 3

Comparator: Less Than Compute A B and looking at the sign (most significant bit) of the result. If the result is negative (i.e., the sign bit is ), then A is less than B. Otherwise A is greater than or equal to B. A B N N - N [N-] A < B Sign bit This comparator, however, functions incorrectly upon overflow. 4

ALU: Arithmetic Logic Unit An Arithmetic/Logical Unit (ALU ) combines a variety of mathematical and logical operations into a single unit. The ALU forms the heart of most computer systems. ALUControl : Function Add Subtract AND OR The ALU receives a 2-bit control signal ALUControl that specifies which function to perform. 5

ALU Implementation ALUControl : Function Add Subtract AND OR 6

ALU Implementation ALUControl : Function Add Subtract AND OR Example: Perform A OR B ALUControl : = Mux selects output of OR gate as Result Result = A OR B 7

ALU Implementation ALUControl : Function Add Subtract AND OR Example: Perform A + B ALUControl : = C in to adder = 2 nd input to adder is B Mux selects Sum as Result Result = A + B 8

ALU with Status Flags Flag N Z C V Description Result is Negative Result is Zero Adder produces Carry out Adder overflowed Some ALUs produce extra outputs, called flags, that indicate information about the ALU output. 9

ALU with Status Flags 2

ALU with Status Flags: Negative N = if: Result is negative So, N is connected to most significant bit of Result 2

ALU with Status Flags: Zero Z = if: all of the bits of Result are 22

ALU with Status Flags: Carry C = if: C out of Adder is AND ALU is adding or subtracting (ALUControl is or ) 23

ALU with Status Flags: overflow V = if: The addition of 2 samesigned numbers produces a result with the opposite sign. (the result is too big to fit in the available digits.) 24

ALU with Status Flags: overflow V = if: ALU is performing addition or subtraction (ALUControl = ) 25

ALU with Status Flags: overflow V = if: ALU is performing addition or subtraction (ALUControl = ) AND A and Sum have opposite signs 26

ALU with Status Flags: overflow V = if: ALU is performing addition or subtraction (ALUControl = ) AND A and Sum have opposite signs AND A and B have same signs upon addition (ALUControl = ) OR A and B have different signs upon subtraction (ALUControl = ) 27

Shifters/Rotators Shifters and rotators move bits and multiply or divide by powers of 2. As the name implies, a shifter shifts a binary number left or right by a specified number of positions. Logical shifter: shifts value to left or right and fills empty spaces with s Ex: >> 2 = Ex: << 2 = 28

Shifters/Rotators Arithmetic shifter: right shift, fills empty spaces with the old most significant bit (msb) Ex: >>> 2 = Ex: <<< 2 = Rotator: rotates bits in a circle, such that bits shifted off one end are shifted into the other end Ex: ROR 2 = Ex: ROL 2 = 29

Example: Logical Shift Right Implementation An N-bit shifter can be built from N N: multiplexers. The input is shifted by to N bits, depending on the value of the log 2 N-bit select lines. A 3 A 2 A A shamt : 2 S : S : Y 3 Y 2 shamt : A Y 3: >> 3: 2 4 4 S : Y Depending on the value of the 2-bit shift amount shamt :, the output Y receives the input A shifted by to 3 bits. (Ground) S : Y 3

Further Reading You can read Chapter 5 of your book From Section 5. to 5.2.5 3