You are on page 1of 6

CMPT215

Tutorial 04

Coprocessor

32 floating point registers

$f0 - $f31

Separate intstruction set

Immidiate li!s $f0"4!4

#rit$metic add!s" mul!d

Con%ersions c%t!s!& $f0"$f0

'ata transfer l&c1" mfc1" mtc1 $t0"$f0

(ranc$es )c1t" c!lt!s



*+ercise 1
'eclare a PI constant in ,our !data
section using !float directi%e!
In ,our main function load t$e
%alue in t$e appropriate register
and print t$e %alue of PI on t$e
screen!

*+ercise 2
-rite a procedure t$at returns in $%0
a s.ure of a floating point %alue
passed as t$e first argument /$a00!
1e+t" print t$e returned %alue as a
floating point!
2ou ma, use t$e code from t$e
pre%ious e+ercise!

1on-leaf procedures

Call ot$er procedures

3sing stac4

$ra

$s50!!67

-$ate%er is necessar,

*+ercise 3
-rite a procedure t$at calls t$e
procedure from e+ercise2 t$ree
times &it$ different arguments and
adds t$em toget$er!

You might also like