floating point representation of real numbersjorgev/cs333/readings/csf-fpoint.pdf10 (a) i (010001...

30
19

Upload: others

Post on 22-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

19

Page 2: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

20

Page 3: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

Floating point representation of real numbers

21

Page 4: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

22

Page 5: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

23

Page 6: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

24

Page 7: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

25

Page 8: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

ten two

Floating point representation of real numbers

26

Page 9: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

27

Page 10: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

28

Page 11: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

ten two-4

29

Page 12: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

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

-1

-2

30

Page 13: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

31

Page 14: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

32

Page 15: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

33

Page 16: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

34

Page 17: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

35

Page 18: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

36

Page 19: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

37

Page 20: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

38

Page 21: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

39

Page 22: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

40

Page 23: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

41

Page 24: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

42

Page 25: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

MM: li $t1, 32li $so, 0

L1: li $s1, 0L2: li $s2, 0

sll $t2, $s0, 5addu $t2, $t2, $s1sll $t2, $t2, 3addu $t2, $a0, $t2l.d. $f4, 0($t2)

L3: sll $t0, $s0, 5addu $t0, $t0, $s1sll $t0, $t0, 3addu $t0, $a2, $t0l.d. $f16, 0($t0)

sll $t2, $s0, 5addu $t0, $t0, $s2sll $t0, $t0, 3addu $t0, $a1, $t0l.d. $f18, 0($t0)

mul.d $f16, $f18, $f16add.d $f4, $f4, $f16

addiu $s2, $s2, 1bne $s2, $t1, L3s.d. $f4, 0($t2)

addiu $s1, $s1, 1bne $s1, $t1, L2addiu $s0, $s0, 1bne $s0, $t1, L1………......

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 ZEach 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

Example of a 4x4 matrix

X00 X01 X02 X03X10 X11 X12 X13X20 X21 X22 X23X30 X31 X32 X33

Xij=[Yi0 Yi1 Yi2 Yi3]x Zj0 Zj1 Zj2 Zj3

sll instruction can be used for multiplies by a power of 2

3 loops:L1 is i loop.L2 is j loopL3 is k loop

43

Page 26: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

44

Page 27: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

45

Page 28: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

46

Page 29: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

47

Page 30: Floating point representation of real numbersjorgev/cs333/readings/CSF-fpoint.pdf10 (a) I (010001 1010001000000010000001000 63Bï'Z5 33BIZ5 x x 20 0 1 90Tlt3 This roe stored binary

nd

48