Can - PowerPoint PPT Presentation

About This Presentation
Title:

Can

Description:

Could use ripple carry of 4-bit CLA adders. Better: use ... 1s, add multiplicand to product (left half) 10: beginning of 1s, subtract multiplicand from product ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 18
Provided by: toda86
Learn more at: http://charm.cs.uiuc.edu
Category:

less

Transcript and Presenter's Notes

Title: Can


1
Use principle to build bigger adders
  • Cant build a 16 bit adder this way... (too big)
  • Could use ripple carry of 4-bit CLA adders
  • Better use the CLA principle again!

2
How much have we saved?
  • Calculate max gate delays thru ripple adder
  • 16X2 32
  • Calculate max gate delays through Look-ahead
    adder
  • 2 2 1 g gate delays

3
Multiplication
  • More complicated than addition
  • accomplished via shifting and addition
  • More time and more area
  • Let's look at 3 versions based on gradeschool
    algorithm 0010 (multiplicand) __x_101
    1 (multiplier)
  • Negative numbers convert and multiply
  • there are better techniques, ..

4
Multiplication Implementation
5
Second Version
6
Second Version
7
(No Transcript)
8
Final Version
9
Booths algorithm for multiplication
  • Note basic operations used are shift and add
  • Machines/ALUs are capable of subtraction as well
  • Further, on some machines shifting is faster than
    addition
  • Why?
  • How to take advantage of this?
  • Consider a sequence of bits in the multiplier
    xxx011110xxx
  • Effect is same if we add the larger power of two,
    and subtract the smallest
  • Change control looks at 2 rightmost bits of the
    multiplier, and deals with 4 cases..
  • 00 nothing
  • 01 end of 1s, add multiplicand to product (left
    half)
  • 10 beginning of 1s, subtract multiplicand from
    product (left half)
  • 11 Middle of a string of 1s Nothing
  • Shifts as before

10
Floating Point (a brief look)
  • We need a way to represent
  • numbers with fractions, e.g., 3.1416
  • very small numbers, e.g., .000000001
  • very large numbers, e.g., 3.15576 ? 109
  • Representation
  • sign, exponent, significand (1)sign
    ???significand ???2exponent
  • more bits for significand gives more accuracy
  • more bits for exponent increases range
  • IEEE 754 floating point standard
  • single precision 8 bit exponent, 23 bit
    significand
  • double precision 11 bit exponent, 52 bit
    significand

11
Floating point representation
  • The idea is to normalize all numbers, so the
    significand has exactly one digit to the left of
    the decimal point.
  • 12345 1.2345 104
  • .0000012345 1.2345 10-6
  • Do this in binary 1.01110 x 2(1011)
  • IEEE FP representation
  • (/-) 1.0101010101010101010101 2 ( 10101010)
  • This is single precision
  • Double precision 64 bits in all.
  • Where does one need accuracy of that level?

12
Floating point addition
  • The problem is the exponents of numbers being
    added may be different
  • 2.0 101 3.0 10(-1)
  • 2.0 101 .03 10 1 Now we can add them
  • 2.03 10 1
  • But we are not necessarily done!
  • E.g. 9.74 101 3.3 10(-1)
  • 10.37 101 is not correct form!
  • Shift again to get the correct form 1.037 102

13
You can get different results
  • A B C A (BC) (AB) C
  • Right?
  • Can you see a problem?
  • When do you lose bits?

14
Floating point multiplication
  • Add exponents, but subtract bias
  • Then multiply significands
  • Then normalize

15
IEEE 754 floating-point standard
  • Leading 1 bit of significand is implicit
  • Exponent is biased to make sorting easier
  • all 0s is smallest exponent all 1s is largest
  • bias of 127 for single precision and 1023 for
    double precision
  • summary (1)sign ?????significand)
    ???2exponent bias
  • Example
  • decimal -.75 -3/4 -3/22
  • binary -.11 -1.1 x 2-1
  • floating point exponent 126 01111110
  • IEEE single precision 10111111010000000000000000
    000000

16
Floating Point Complexities
  • Operations are somewhat more complicated (see
    text)
  • In addition to overflow we can have underflow
  • Accuracy can be a big problem
  • IEEE 754 keeps two extra bits, guard and round
  • four rounding modes
  • positive divided by zero yields infinity
  • zero divide by zero yields not a number
  • other complexities
  • Implementing the standard can be tricky
  • Not using the standard can be even worse
  • see text for description of 80x86 and Pentium bug!

17
Chapter Four Summary
  • Computer arithmetic is constrained by limited
    precision
  • Bit patterns have no inherent meaning but
    standards do exist
  • twos complement
  • IEEE 754 floating point
  • Computer instructions determine meaning of the
    bit patterns
  • Performance and accuracy are important so there
    are many complexities in real machines (i.e.,
    algorithms and implementation).
  • We are ready to move on (and implement the
    processor) you may want to look back (Section
    4.12 is great reading!)
Write a Comment
User Comments (0)
About PowerShow.com