Computer Architecture Flashcards
What is the two’s compliment number representation?
It is the most common format used to represent signed integers in modern computers.
A positive integer in two’s complement always has a 0 in the leftmost bit (sign bit) and is represented the same way as an unsigned binary integer.
To negate a number we invert all the bits and add one.
What is two’s compliment of 0 (zero)?
0000 -> 1111 (inversion)
1111 + 1 -> 0000 (overflow is discarded)
Answer: 0
Given a negative number in two’s compliment form how to convert it to a human understandable form?
- Inverse the given binary number in two’s compliment
- Add 1 to the result of inversion
- Add minus sign to the result.
What is the range of number which can be represented by 8-bit binary in 2’s compliment format?
- 2^7 … (2^7) -1, or
-128 … 127
That is because +128 and -128 cannot be represented by the same pattern, 1000 0000. The best option for 1000 0000 is to represent -128
Convention steps of calling procedure on 32-bit architecture?
Caller:
- put calling procedure arguments on the stack
- put procedure return address on the stack
Callee:
- put previous base pointer address on the stack
- sync base pointer with the current stack pointer
- save CPU registers the callee procedure may modify in the stack