# The shown discussion is a proof that Booth's Algorithm

Document Sample

```					1
2
3
4
5
6
Used for multiplying numbers in 2's
complement format

7
8
9
10
11
12
The shown discussion is
a “proof” that Booth’s
Algorithm yield the
correct product when the
multiplier is positive or
negative

13
2 bits at a time

3 bits at a time

14
at most
minimum total
number of arithmetic operations

15
16
17
18
19
20
Floating point representation of real numbers

21
22
23
24
25
Floating point representation of real numbers

ten         two

26
27
28
-4
ten   two

29
Why is number with
smaller exponent shifted to
right for alignment?

-1

-2

30
31
32
33
34
35
36
37
38
39
40
41
42
X=X+Y*Z X is a 32x32 matrix. Same for Y and Z.
\$s0        i          \$s1         j           \$s2         k
\$a0        X          \$a1         Y           \$a2         Z
Each matrix element has 8 bytes (floating point double precision)
Each row of X is stored in memory as consecutive 32*8 bytes.
The 32 rows are stored as consecutive 32*32*8 bytes.
Same for Y and Z
MM:           li          \$t1, 32
li          \$so, 0             sll instruction   Example of a 4x4 matrix
L1:           li          \$s1, 0             can be used for
L2:           li          \$s2, 0                               X00 X01 X02 X03
multiplies by a
X10 X11 X12 X13
power of 2        X20 X21 X22 X23
3 loops:        sll         \$t2, \$s0, 5                          X30 X31 X32 X33
L1 is i loop.   addu        \$t2, \$t2, \$s1
L2 is j loop    sll         \$t2, \$t2, 3                          Xij=[Yi0 Yi1 Yi2 Yi3]x Zj0
L3 is k loop                                                                            Zj1
addu        \$t2, \$a0, \$t2
l.d.        \$f4, 0(\$t2)                                                 Zj2
Zj3

L3:           sll         \$t0, \$s0, 5
addu        \$t0, \$t0, \$s1
sll         \$t0, \$t0, 3
addu        \$t0, \$a2, \$t0
l.d.        \$f16, 0(\$t0)

sll         \$t2, \$s0, 5
addu        \$t0, \$t0, \$s2
sll         \$t0, \$t0, 3
addu        \$t0, \$a1, \$t0
l.d.        \$f18, 0(\$t0)

mul.d       \$f16, \$f18, \$f16
add.d       \$f4, \$f4, \$f16

addiu       \$s2, \$s2, 1
bne         \$s2, \$t1, L3
s.d.        \$f4, 0(\$t2)

addiu       \$s1, \$s1, 1
bne         \$s1, \$t1, L2
addiu       \$s0, \$s0, 1
bne         \$s0, \$t1, L1
………......

43
44
45
46
47
nd

48
333 Required Problems

49

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 82 posted: 6/24/2010 language: English pages: 49
How are you planning on using Docstoc?