Download presentation

Presentation is loading. Please wait.

Published byBrianne Woodhouse Modified over 2 years ago

1
Comp Sci 251 -- Floating Point Arithmetic 1 Ch. 10 Floating Point Unit

2
Comp Sci 251 -- Floating Point Arithmetic 2 MIPS Floating point arithmetic Floating point Coprocessor "Coprocessor 1" Processor System bus MemoryCoprocessor 1 l.s

3
Comp Sci 251 -- Floating Point Arithmetic 3 Coprocessor architecture Floating point registers: $f0, …, $f31 Each 32 bits wide Single precision value: one register Double precision value: – Even/odd pair of registers – Examples: $f0:$f1$f4:$f5$f28:$f29 $f3:$f4

4
Comp Sci 251 -- Floating Point Arithmetic 4 Floating point MIPS assembly code Data definitions x:.float 32.568# single precision y:.double 32.568# double precision Load/store instructions l.s $f5, x# load single s.s $f5, x# store single

5
Comp Sci 251 -- Floating Point Arithmetic 5 Floating Point Arithmetic Logical Unit (FALU) Control Unit Main Memory FP Register Registe r load: l.s or l.d mov.s or mov.d store: s.s or s.d mfc1 or mtc1

6
Comp Sci 251 -- Floating Point Arithmetic 6 Instructions Condition Code Control unit and clocks Operands Register unit (16 x 64) Exponent part fraction A B result Exponent Unit A B result Add Unit A B result Divide unit A B result Multiply unit Data Bus

7
Comp Sci 251 -- Floating Point Arithmetic 7 Floating point instructions Register register copy mov.s $f5, $f23# move single, $f5 $f23 CPU FPU copy mfc1 $t0, $f5# move from coprocessor1, $t0 $f5 mtc1 $t0, $f5# move to coprocessor1, $t0 $f5

8
Comp Sci 251 -- Floating Point Arithmetic 8 Floating point instructions Arithmetic (replace s with d for double precision) add.s $f2, $f4, $f6# $f2 $f4 + $f6 sub.s $f2, $f4, $f6# $f2 $f4 - $f6 mul.s $f2, $f4, $f6# $f2 $f4 * $f6 div.s $f2, $f4, $f6# $f2 $f4 / $f6 abs.s $f2, $f4# $f2 |$f4|

9
Comp Sci 251 -- Floating Point Arithmetic 9 Floating point instructions Comparison: affects coprocessor status flag (replace s with d for double precision) c.eq.s $f0, $f6# flag $f0 == $f6 c.le.s $f0, $f6# flag $f0 <= $f6 c.lt.s $f0, $f6# flag $f0 < $f6 Conditional branches bc1t label# branch if flag == true bc1f label# branch if flag == false

10
Comp Sci 251 -- Floating Point Arithmetic 10 Floating point instructions Type conversion – between integer ( w ), single ( s ), double ( d ) data types – Examples: # convert to word (int) in $f0 from single in $f2 cvt.w.s $f0, $f2 # convert to single in $f0 from word (int) in $f2 cvt.s.w $f0, $f2

11
Comp Sci 251 -- Floating Point Arithmetic 11 Exercise Write MIPS for the following statements float f = 4.99; cout << (int) f << endl;

Similar presentations

OK

Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.

Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on bombay film industry Mit lecture ppt on probability concepts Ppt on judicial system in india Ppt on van de graaff generator belt Ppt on architecture of mughal period Ppt on as 14 amalgamation symbol Ppt on sources of water pollution Ppt on instrument landing system outer Ppt on production planning Ppt on number system for class 7