Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design.

Slides:



Advertisements
Similar presentations
Combinational Circuits. Analysis Diagram Designing Combinational Circuits In general we have to do following steps: 1. Problem description 2. Input/output.
Advertisements

Comparator.
Arithmetic Functions and Circuits
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Lecture Adders Half adder.
DPSD This PPT Credits to : Ms. Elakya - AP / ECE.
Overview Iterative combinational circuits Binary adders
CSE-221 Digital Logic Design (DLD)
Overview Iterative combinational circuits Binary adders
ECE C03 Lecture 61 Lecture 6 Arithmetic Logic Circuits Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Lecture 8 Arithmetic Logic Circuits
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
1 COMP541 Arithmetic Circuits Montek Singh Mar 20, 2007.
Overview Iterative combinational circuits Binary adders
ECE 301 – Digital Electronics
Overview Iterative combinational circuits Binary adders
Chapter 5 Arithmetic Logic Functions. Page 2 This Chapter..  We will be looking at multi-valued arithmetic and logic functions  Bitwise AND, OR, EXOR,
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
©2008 The McGraw-Hill Companies, Inc. All rights reserved. Digital Electronics Principles & Applications Seventh Edition Chapter 10 Arithmetic Circuits.
CS 105 Digital Logic Design
Chapter 6-2 Multiplier Multiplier Next Lecture Divider
Outline Analysis of Combinational Circuits Signed Number Arithmetic
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
Logical Circuit Design Week 8: Arithmetic Circuits Mentor Hamiti, MSc Office ,
Basic Arithmetic (adding and subtracting)
Digital Arithmetic and Arithmetic Circuits
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Chapter # 5: Arithmetic Circuits
Chapter 6-1 ALU, Adder and Subtractor
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 4 – Arithmetic Functions Logic and Computer.
Arithmetic Functions and Circuits
Week #5 Arithmetic Circuits
Basic Arithmetic (adding and subtracting)
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
Logic Gates Logic gates are electronic digital circuit perform logic functions. Commonly expected logic functions are already having the corresponding.
درس مدارهای منطقی دانشگاه قم مدارهای منطقی محاسباتی تهیه شده توسط حسین امیرخانی مبتنی بر اسلایدهای درس مدارهای منطقی دانشگاه.
Arithmetic Functions BIL- 223 Logic Circuit Design Ege University Department of Computer Engineering.
CHAPTER 4 Combinational Logic Design- Arithmetic Operation (Section 4.6&4.9)
COE 202: Digital Logic Design Combinational Circuits Part 2 KFUPM Courtesy of Dr. Ahmad Almulhem.
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Logic and Computer Design.
1 CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits 4-1,2: Iterative Combinational Circuits and Binary Adders.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Combinational Circuits
Topics covered: Arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 10 Multiplexers MUX: –Selects binary information from one of many input lines and.
Digital Design Module –II Adders Amit Kumar Assistant Professor SCSE, Galgotias University, Greater Noida.
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
CS/EE 3700 : Fundamentals of Digital System Design Chris J. Myers Lecture 5: Arithmetic Circuits Chapter 5 (minus 5.3.4)
Computer Architecture
1 Chapter 4 Combinational Logic Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables,
CS 151: Digital Design Chapter 4: Arithmetic Functions and Circuits
CPEN Digital System Design
Addition, Subtraction, Logic Operations and ALU Design
Addition and multiplication Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
CS151 Introduction to Digital Design Chapter 4: Arithmetic Functions and HDLs 4-1: Iterative Combinational Circuits 4-2: Binary Adders 1Created by: Ms.Amany.
ETE 204 – Digital Electronics Combinational Logic Design Single-bit and Multiple-bit Adder Circuits [Lecture: 9] Instructor: Sajib Roy Lecturer, ETE,ULAB.
Arithmetic Circuits I. 2 Iterative Combinational Circuits Like a hierachy, except functional blocks per bit.
Addition and multiplication1 Arithmetic is the most basic thing you can do with a computer, but it’s not as easy as you might expect! These next few lectures.
Gunjeet Kaur Dronacharya Group of Institutions. Binary Adder-Subtractor A combinational circuit that performs the addition of two bits is called a half.
Haifeng Liu 2014 Fall College of Computer Science and Technology, Zhejiang University Chapter 4 – Arithmetic Functions and Circuits.
King Fahd University of Petroleum and Minerals
Arithmetic Functions & Circuits
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Overview Iterative combinational circuits Binary adders
ECE 352 Digital System Fundamentals
Presentation transcript:

Henry Hexmoor1 Chapter 5 Arithmetic Functions Arithmetic functions –Operate on binary vectors –Use the same subfunction in each bit position Can design functional block for subfunction and repeat to obtain functional block for overall function Cell - subfunction block Iterative array - a array of interconnected cells An iterative array can be in a single dimension (1D) or multiple dimensions

Henry Hexmoor2 Adders

Henry Hexmoor3 Block Diagram of a 1D Iterative Array Example: n = 32 –Number of inputs = ? –Truth table rows = ? –Equations with up to ? input variables –Equations with huge number of terms –Design impractical! Iterative array takes advantage of the regularity to make design feasible Figure 5-1

Henry Hexmoor4 Half-Adder 5-2 A 2-input, 1-bit width binary adder that performs the following computations: A half adder adds two bits to produce a two-bit sum The sum is expressed as a sum bit, S and a carry bit, C The half adder can be specified as a truth table for S and C  X Y C S X Y C S

Henry Hexmoor5 Half Adder 5-2XY S C YXC YXS   Figure 5-2

Henry Hexmoor6 Full-Adder A full adder is similar to a half adder, but includes a carry-in bit from lower stages. Like the half-adder, it computes a sum bit, S and a carry bit, C. –For a carry-in (Z) of 0, it is the same as the half-adder: –For a carry- in (Z) of 1: Z0000 X Y C S Z1111 X Y C S

Henry Hexmoor7 Full Adder Table ABC in n SC

Henry Hexmoor8 Logic Optimization: Full-Adder Full-Adder Truth Table: Full-Adder K-Maps: XYZCS X Y Z S X Y Z C

Henry Hexmoor9 Equations: Full-Adder From the K-Map, we get: The S function is the three-bit XOR function: The Carry bit C is 1 if both X and Y are 1 (the sum is 2), or if the sum is 1 and a carry-in (Z) occurs. Thus C can be re-written as: The term X·Y is carry generate. The term X  Y is carry propagate. ZYZXYXC ZYXZYXZYXZYXS   ZYXS  Z)YX(YXC 

Henry Hexmoor10 Full Adder

Henry Hexmoor11 4 bit Full Adder

Henry Hexmoor12 4-bit Ripple-Carry Binary Adder A four-bit Ripple Carry Adder made from four 1-bit Full Adders. A carry 1 may propagate through many FAs to the most significant bit just as a wave ripples outward… Figure 5-5

Henry Hexmoor13 Carry Propagation & Delay One problem with the addition of binary numbers is the length of time to propagate the ripple carry from the least significant bit to the most significant bit. The gate-level propagation path for a 4-bit ripple carry adder of the last example: Note: The "long path" is from A 0 or B 0 though the circuit to S 3.

Henry Hexmoor14 Carry Lookahead Given Stage i from a Full Adder, we know that there will be a carry generated when A i = B i = "1", whether or not there is a carry-in. Alternately, there will be a carry propagated if the “half-sum” is "1" and a carry-in, C i occurs. These two signal conditions are called generate, denoted as G i, and propagate, denoted as P i respectively and are identified in the circuit: AiAi BiBi CiCi C i+1 GiGi PiPi SiSi

Henry Hexmoor15 Carry Lookahead (continued) In the ripple carry adder: –Gi, Pi, and Si are local to each cell of the adder –Ci is also local each cell In the carry lookahead adder, in order to reduce the length of the carry chain, C i is changed to a more global function spanning multiple cells Defining the equations for the Full Adder in term of the P i and G i : iiiiii BAGBAP  iii1iiii CPGCCPS  

Henry Hexmoor16 Group Carry Lookahead Logic Figure 5-6 in the text shows shows the implementation of these equations for four bits. This could be extended to more than four bits; in practice, due to limited gate fan-in, such extension is not feasible. Instead, the concept is extended another level by considering group generate (G 0-3 ) and group propagate (P 0-3 ) functions: Using these two equations: It is possible to have four 4-bit adders use one of the same carry lookahead circuit to speed up 16-bit addition PPPPP GPPPPGPPGPGG     CPGC  

Henry Hexmoor17 Subtraction table b in xyb out D

Henry Hexmoor18 Half subtractor Half Subtractor X Y D B-OUT XYXY Difference D B-out

Henry Hexmoor19 Full Subtraction circuit for A - B D = (A B) BI BO = A’(B + BI )+ A B BI 

Henry Hexmoor20 Binary Subtraction 5-3 A Subtraction of two n-digit numbers, M – N 1.Subtract the subtrahend N from the minuend M. 2. if no end borrow occurs, then M>= N, and the result is nonnegative and correct. 3. If an end borrow occurs, then N > M, and the difference, M – N + 2 n, is subtracted from 2 n, and a minus sign is appended to the result. See Example 5-1 and Figure  0111   1101 (  ) 0011

Henry Hexmoor21 Figure 5-7 Adder-subtractor

Henry Hexmoor22 Complements 5-3 1’s complement of a binary n digit number N is obtained by changing all 1’s to 0 and all 0’s to 1. 2’s complement of a binary n digit number N is obtained by adding 1 to its 1’s complement. e.g., 1’s complement:   ’s complement:  =

Henry Hexmoor23 Alternate 2’s Complement Method Given: an n-bit binary number, beginning at the least significant bit and proceeding upward: –Copy all least significant 0’s –Copy the first 1 –Complement all bits thereafter. 2’s Complement Example: –Copy underlined bits: 100 –and complement bits to the left:

Henry Hexmoor24 Subtraction with complements 5-3 OR Gate A 1.Add the 2’s complement of the subtrahend N to the minuend M. 2.If M>= N, the sum produces an end carry, 2 n. Discard the end carry, leaving result M – N. 1.If M < N, the sum does not produce an end carry since it is equal to 2 n – (N – M), the 2’s complement of N –M. Perform a correction, taking the 2’s complement of the sum and placing a minus sign in front to obtain the result – (N – M).

Henry Hexmoor25 Unsigned 2’s Complement Subtraction Example 1 Find – – The carry of 1 indicates that no correction of the result is required. 1 2’s comp

Henry Hexmoor26 Binary Adder-Subtractors 5-4 OR Gate A Figure 5-8 S = 0, adder S = 1, subtractor

Henry Hexmoor27 Overflow Detection Overflow occurs if n + 1 bits are required to contain the result from an n-bit addition or subtraction Overflow can occur for: –Addition of two operands with the same sign –Subtraction of operands with different signs Detection can be performed by examining the result signs which should match the signs of the top operand

Henry Hexmoor28 Two bit Multiplication

Henry Hexmoor29 Three bit Multiplication Partial products are: 101 × 1, 101 × 1, and 101 × 0 Note that the partial product summation for n digit, base 2 numbers requires adding up to n digits (with carries) in a column. Note also n × m digit multiply generates up to an m + n digit result (same as decimal). 101 ×

Henry Hexmoor30 Multiplier Boolean Equations We can also make an n × m “block” multiplier and use that to form partial products. Example: 2 × 2 – The logic equations for each partial-product binary digit are shown below: We need to "add" the columns to get the product bits P0, P1, P2, and P3. Note that some columns may generate carries. b1b1 b0b0  a1a1 a0a0 (a 0  b1)b1)  b0)b0) + (a 1  b1)b1)  b0)b0) P3P3 P2P2 P1P1 P 0

Henry Hexmoor31 A 2x2 binary multiplier The AND gates produce the partial products. For a 2-bit by 2-bit multiplier, we can just use two half adders to sum the partial products. In general, though, we’ll need full adders. Here C 3 -C 0 are the product, not carries! HA

Henry Hexmoor32 Multiplication: a special case In decimal, an easy way to multiply by 10 is to shift all the digits to the left, and tack a 0 to the right end. 128 x 10 = 1280 We can do the same thing in binary. Shifting left is equivalent to multiplying by 2: 11 x 10 = 110(in decimal, 3 x 2 = 6) Shifting left twice is equivalent to multiplying by 4: 11 x 100 = 1100(in decimal, 3 x 4 = 12) As an aside, shifting to the right is equivalent to dividing by ÷ 10 = 11(in decimal, 6 ÷ 2 = 3)

Henry Hexmoor33 Other Arithmetic Functions 5-7 Convenient to design the functional blocks by contraction - removal of redundancy from circuit to which input fixing has been applied Functions –Incrementing –Decrementing –Multiplication by Constant –Division by Constant –Zero Fill and Extension

Henry Hexmoor34 HW 5 1.Perform the indicated subtraction with the following unsigned binary numbers by taking the 2’s complement of the subtrahend: (a)1111 – 10000, (b) – 1111, (c) – , (d) 101 – (Q 5-4) 2. Design a circuit that multiplies two 4-bit unsigned numbers. Use AND gates and binary adders. (Q 5-18)

Henry Hexmoor35