You are on page 1of 3

Language of the Machine Assembly

MIPS Arithmetic Instruction


Used by NEC, Nintendo, Silicon Graphics, Sony
Accumulator (1 Register)
1 address

add A acc

acc + mem[A]

1+x address

addx A

acc

acc + mem[A+x]

Stack:
0 address

add

tos

tos + next

General Purpose Register:


2 address
add A B
3 address
add A B C

EA(A) EA(A) + EA(B)


EA(A) EA(B) + EA(C)

Load/ Store:
Load Ra Rb
Store Ra Rb

mem[Rb]
Ra

Ra
mem[Rb]

Memory to Memory:
All operands and destinations are ..
Code sequence for C = A + B for four classes of instruction sets:
Stack
Accumulator
Register(r-m)
Register (l-s)
Pop A
Load A
Load R1, A
Load R1, A
Pop B
Add B
Add R1, B
Load R2, B
Add
Store C
Store C, R1
Add R3, R2, R1
Push C
Store C. R3

Big Endian: address of most significant byte = word address (xx00 = Big End of
word)
- IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA
Little Endian: address of least significant byte = word address
(xx00 = Little End of word)
- Intel 80x86, DEC Vax, DEC Alpha
Sign magnitude:
000= +0
001= +1
010= +2
011= +3
100= -0
101= -1
110= -2
111= -3

Ones Complement
000= +0
001= +1
010= +2
011= +3
100= -3
101= -2
110= -1
111= -0

Ones complement
0 0 0 +0
0 0 1 +1
1 1 1 -0
1 1 0 -1

0 1 0 +2
1 0 1 -2

Twos complement
Only 000 = 0
0 0 1 +1
0 1 0 +2
1 1 0 -2
1 0 1 -3
1 1 1 -1
1 1 0 -2

0 1 1 +3
1 0 0 -4
1 0 1 -3

Twos Complement:
000= +0
001= +1
010= +2
011= +3
100= -4
101= -3
110= -2
111= -1

Floating Point represent type of variable which is float.


- To describe number with fraction. E.g. 3.1416
- To describe very small number. E.g. 000000000000001
- To describe very big number. E.g. 3.15776 x 109
Represent:
- Sign, exponent, significant: (-1)sign x significand x 2exponent
- More bits for significand give more accuracy
- More bits for exponent increases range

IEEE 754 floating point standard:


- Single precision: 8 bit exponent, 23 bit significand
- Double precision: 11 bit exponent, 52 bit significand
- Leading 1 bit of significand is implicit.
- Exponent is biased to make sorting easier.
a. All 0 is smallest exponent all 1s is largest
b. Bias of 127 for single precision and 1023 for double precision
c. Summary (-1) x (1+significand) x 2exponent bias

You might also like