CoE EE 00142 Computer Organization Set 3 Multiplication and Division PowerPoint PPT Presentation

presentation player overlay
1 / 69
About This Presentation
Transcript and Presenter's Notes

Title: CoE EE 00142 Computer Organization Set 3 Multiplication and Division


1
CoE - EE 00142Computer OrganizationSet 3
Multiplication and Division
  • Ron Hoelzeman

2
ALU Block Diagram
Normally, the accumulator has logical and
arithmetic shift capability, both left and right
3
Another Symbol for ALU
4
Binary Multiply
Binary
Decimal
5
Simultaneous Multiplication
6
Equations
  • P0 X0Y0
  • P1 (X0Y1) add to (X1Y0)
  • use half adder
  • P2 (X0Y2) add to (X1Y1) add to (X2y0) add to
    Cin
  • use half adder full adder
  • P3 etc.

7
Simultaneous Multiplier
8
Multiplication Example
  • 1011 Multiplicand (11 dec)
  • x 1101 Multiplier (13 dec)
  • 1011 Partial products
  • 0000 Note if multiplier bit is 1 copy
  • 1011 multiplicand (place value)
  • 1011 otherwise zero
  • 10001111 Product (143 dec)
  • Note need double length result

9
Binary Multiplication Example
10
Example Multiply Algorithm
Multiplicand 0100 4 Multiplier 0101 5 20
11
Example using AU-AL Lft Shft
12
Example Hardware
Multiplicand left - Multiplier right - PP
stationary
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
Multiplicand stationary - Multiplier right - PP
right
17
Multiplicand stationary - Multiplier right - PP
right
18
Example (3 x 2)
19
Another Example - Right Shift
0
0
1
20
Multiplying Negative Numbers
  • This does not work as is
  • Solution
  • Convert to positive if required
  • Multiply as above
  • If signs were different, negate answer
  • Use Booths algorithm

21
Booths Algorithm
  • Designed to improve speed by using fewer adds
  • Works best on strings of 1s
  • Example premise
  • 7 8 1
  • 0111 1000 0001 (3 adds vs 1 add 1 sub)
  • Algorithm modified to allow for multiplication
    with negative numbers

22
Multiply in MIPS
23
Hardware - Software
  • Some compilers replace constants with a series of
    shifts, add, and subtracts
  • Particularly valuable when multiplying by a power
    of 2

24
Division
  • More complex than multiplication
  • Negative numbers are really bad
  • Based on long division

25
Long Hand Division
013
11
147
11
037
Partial Remainders
33
4
26
Division of Unsigned Binary Integers
Quotient
00001101
1011
10010011
Divisor
Dividend
1011
001110
Partial Remainders
1011
001111
1011
Remainder
100
27
Long Division
28
Long Division
29
Long Division
30
Long Division
31
Long Division
32
Division Algorithm
33
Division Algorithm
34
Divide Example
15 - 01111 divided by 5 - 00101
35
Long Hand Division Hardware
36
Long Hand Division Hardware Algorithm
37
Realistic Division Hardware
38
Realistic Division Hardware Algorithm
39
Divide in MIPS
40
Hardware Control Aspects
  • How do we create the control within the ALU
  • Use examples from 0132 text

41
Unsigned Binary Multiplication
42
Consider Multiplier Schematic
43
Execution of Example
44
Binary Multiplier Block Diagram
Figure 8-6 Page 368
45
Algorithmic State Machine
Figure 8-1 Page 362
46
ASM Block Example
Figure 8-2 Page 363
47
Binary Multiplier ASM Chart
Figure 8-7 Page 369
48
Binary Multiplier Sequencing
Figure 8-8 Page 372
49
Implementation Mechanisms
Algorithmic State Machine ASM
50
Binary Multiplier Block Diagram
Figure 8-6 Page 368
51
Control Signals
Table 8-1 Page 371
52
Multiplier Control Unit
Go
LSB of Multiplier
Figure 8-9 Page 375
53
Microprogrammed Control Unit
Figure 8-12 Page 379
54
Example Microinstruction
Typically in ROM Each Cn bit is a control
line Nxt is next address, depending on decision
55
Floating Point Operations
  • Review of IEEE Floating Point
  • How would we implement?
  • Example flowcharts for
  • Addition/Subtraction
  • Multiplication
  • Division

56
Real Numbers
  • Numbers with fractions
  • Could be done in pure binary
  • 1001.1010 24 20 2-1 2-3 9.625
  • Fixed point
  • Very limited
  • Moving or floating point
  • How do you show where binary point is

57
Floating Point
  • (/-) x 1.significand x 2(exponent-127)
  • Exponent indicates position of binary point

58
Normalization
  • FP numbers are usually normalized
  • i.e. exponent is adjusted so that leading bit
    (MSB) of mantissa is 1
  • Example - Scientific notation where numbers are
    normalized to give a single digit before the
    decimal point
  • e.g. 3.123 x 103
  • Because it is always 1, there is no need to store
    it

59
FP Ranges
  • For a 32 bit number
  • 8 bit exponent
  • /- 2256 ? 1.5 x 1077
  • Accuracy
  • The effect of changing lsb of mantissa
  • 23 bit mantissa 2-23 ? 1.2 x 10-7
  • About 6 decimal places

60
IEEE Standard 754
  • Standard for floating point storage
  • 32 and 64 bit standards
  • 8 and 11 bit exponent respectively
  • Extended formats (both mantissa and exponent) for
    intermediate results

61
Floating Point Arithmetic
  • Addition Subtraction
  • Must align binary points
  • e.g. adjust exponents
  • Multiplication Division
  • Add/sub unbiased exponents
  • e.g. adjust exponents
  • Normalize the results

62
FP Addition - Subtraction
63
FP Addition Algorithm
64
FP Addition Hardware
65
FP Arithmetic x/?
  • Check for zero
  • Add/subtract exponents
  • Multiply/divide significands
  • watch sign
  • Normalize
  • Round
  • Double length intermediate results

66
FP Multiply Flowchart
67
FP Multiplication Algorithm
68
FP Divide Flowchart
69
End of Set 3
Write a Comment
User Comments (0)
About PowerShow.com