Download Arithmetic Instructions 1 CS 217 • Arithmetic operations on data in registers

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Arithmetic Instructions
CS 217
Arithmetic Instructions
• Arithmetic operations on data in registers
add{x}{cc} src1, src2, dst
sub{x}{cc} src1, src2, dst
dst = src1 + src2
dst = src1 - src2
• Examples:
add %o1,%o2,%g3
sub %i1,2,%g3
1
Number Systems
Conversion
2
Addition
Multiplication
3
Machine Arithmetic
Signed Magnitude
4
One’s Complement
− k1C =^ k
a − b = a + ( r n − 1 − b) + 1
a − b = a +b1C + 1
Two’s Complement
− k2C =^ k + 1
5
Two’s Complement (cont)
a − b = a + ( r n − 1 − b) + 1
a − b = a +b2 C
Sign Extension
6
Floating Point Instructions
• Performed by floating point unit (FPU)
• Use 32 floating point registers: %f0…%f31
• Load and store instructions
–
–
–
–
ld [address],freg
ldd [address],freg
st freg,[address]
std freg,[address]
• Other instructions are FPU-specific
– fmovs,fsqrt,fadd,fsub,fmul,fdiv,…
Floating Point Numbers
7
Floating Point Numbers (cont)
IEEE Floating Point
8
IEEE Floating Point (cont)
9
Related documents