Computer Arithmetic - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Computer Arithmetic

Description:

We can add two bits according to the following truth table: ... Ripple through carry. The previous circuit is called the ripple through carry adder. ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 28
Provided by: duncanfyf
Category:

less

Transcript and Presenter's Notes

Title: Computer Arithmetic


1
Lecture 13
  • Computer Arithmetic

2
Single Bit Arithmetic
  • We can add two bits according to the following
    truth table

Designing with minterms gives us the Boolean
equations SUM A' B A B'
CARRY A B
3
Exclusive Or
  • The truth table for sum is an exclusive or
  • SUM A' B A B' A?B
  • It is possible to make exclusive or gates very
    simply at the transistor level, so we will use
    them in our designs

4
Exclusive Nor
  • The Exclusive Nor is also easy to manufacture

5
EOR Simplification Rules
  • We can add the exclusive or and nor as
    simplification rules in Boolean Algebra
  • A'B AB' A?B
  • AB A'B' (A?B)
  • (proof by truth table)
  • But we cannot spot them easily on the Karnaugh
    map

6
The Half Adder
  • A one bit adder, called a half adder is
    represented by the following equation and
    circuit
  • CARRY AB SUM A?B

7
The full adder
  • To add numbers of more than one bit we need to
    include a carry in

8
Equations of the full adder
  • SUM A'B'C A'BC' AB'C' ABC
  • A'(B'CBC') A(B'C'BC)
  • A'(B?C) A(B?C)'
  • A?B?C
  • CARRY A'BC AB'C ABC' ABC
  • C(A'BAB') AB
  • C(A?B) AB

9
Circuit of the full adder
10
Building an n-bit adder
11
Ripple through carry
  • The previous circuit is called the ripple through
    carry adder.
  • There are faster circuits which are designed to
    propagate the carry faster. In the books you will
    find many others, e.g. the look ahead carry
    adder.
  • We will not discuss these further here.

12
The serial adder bits arrive "least significant
first"
13
Subtraction
  • Subtraction is done by the normal borrow and
    payback method

14
Problem Break
  • Evaluate 11001 - 10110 using the truth table
    below

15
Subtractor circuit
  • The minterm method can be used to determine a
    circuit for the subtractor.
  • We will not bother with the algebra, but must
    note that the simplified equations are
  • DIFFERENCE A?B?P (again!)
  • BORROW BP A'(BP)

16
One bit full subtractor
17
Two's complement subtractor
  • It is more usual to use a two's complement
    subtractor in hardware.
  • A - B A TwosComplement(B)
  • The two's complement is formed by flipping each
    bit of a number and adding one.

18
Notice the use of carry-in for increment
19
Multiplication
  • Consider how we multiply two digit numbers
  • A1A0B1B0
  • A1B1102 A1B010 A0B110 A0B0
  • or, for binary numbers
  • A1A0B1B0
  • A1B122 A1B02 A0B12 A0B0

20
Multiplication
  • For binary digits, the AND operator is the same
    as multiply, so
  • A1A0B1B0
  • A1B122 A1B02 A0B12 A0B0
  • And multiplying by 2 can be replaced by shifting

21
The 2 bit multiplier
22
A four bit multiplier
  • Essentially a four bit multiplier works just like
    a base four multiplier.
  • If we write two four bit numbers as PQ and RS,
    where P,Q,R and S are 2 bit numbers then
  • PQRS
  • PR42 PS4 QR4 QS
  • The products can be computed using the two bit
    multiplier just designed.

23
The four bit multiplier
24
The eight bit multiplier
  • The same principal can be used to make an eight
    bit multiplier from four four bit multipliers.
  • Multipliers of size 2n can be designed using four
    multipliers of size 2n-1

25
Division
  • There are hardware circuits for divide, but they
    are quite complex.
  • We will not discuss them on this course

26
The ALU
  • In practice, arithmetic circuits are bundled
    together in a multi-function package called the
  • Arithmetic and Logic Unit (ALU)
  • We will look at a commercial ALU next lecture,
    but for now we illustrated the principal by
    designing an add/subtract circuit.

27
Add/ Subtract circuit
Write a Comment
User Comments (0)
About PowerShow.com