Professional Documents
Culture Documents
Organization
Stack Organization
Current
• LIFO Top of Stack
Last In First Out
TOS 0
1
2
3
4
5
SP 6 0 1 2 3
7 0 0 5 5
FULL EMPTY 8 0 0 0 8
9 0 0 2 5
Stack Bottom 10 0 0 1 5
Stack
Stack Organization
Current 1 6 9 0
• PUSH Top of Stack
SP ← SP – 1
TOS 0
1
M[SP] ← DR
2
If (SP = 0) then (FULL ← 1)
3
EMPTY ← 0
4
5 1 6 9 0
SP 6 0 1 2 3
7 0 0 5 5
FULL EMPTY 8 0 0 0 8
9 0 0 2 5
Stack Bottom 10 0 0 1 5
Stack
Stack Organization
Current
• POP Top of Stack
DR ← M[SP]
TOS 0
1
SP ← SP + 1
2
If (SP = 11) then (EMPTY ← 1)
3
FULL ← 0
4
5 1 6 9 0
SP 6 0 1 2 3
7 0 0 5 5
FULL EMPTY 8 0 0 0 8
9 0 0 2 5
Stack Bottom 10 0 0 1 5
Stack
Stack Organization
• Memory Stack
• PUSH
PC 0
SP ← SP – 1 1
2
M[SP] ← DR
• POP
DR ← M[SP] AR 100
101
SP ← SP + 1 102
200
SP 201
202
Floating Point
Representation
A sample representation
1 7 24
If the number is shifted so that as many significant digits are brought into
7 available slots:
x = 0.4056781 x 109 = 0.0004056 x 1012
0001101000(10110) x 28 = 1101000101(10) x 25
Normalization (contd..)
•A floating point number is in normalized form if the most significant
1 in the mantissa is in the most significant bit of the mantissa.
•All normalized floating point numbers in this system will be of the form:
0.1xxxxx.......xx
x = m 16e
Then:
y = (m.16) .16e-1 (m.24) .16e-1 = m . 16e = x
This is because the IEEE uses the exponents -127 and 128 (and -1023 and
1024), that is the actual values 0 and 255 to represent special conditions:
- Exact zero
- Infinity
Floating point arithmetic
Addition:
3.1415 x 108 + 1.19 x 106 = 3.1415 x 108 + 0.0119 x 108 = 3.1534 x 108
Multiplication:
3.1415 x 108 x 1.19 x 106 = (3.1415 x 1.19 ) x 10(8+6)
Division:
3.1415 x 108 / 1.19 x 106 = (3.1415 / 1.19 ) x 10(8-6)
Division:
3.1415 x 108 / 1.19 x 106 = (3.1415 / 1.19 ) x 10(8-6)