Computer Architecture Flashcards

1
Q

What is the two’s compliment number representation?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is two’s compliment of 0 (zero)?

A

0000 -> 1111 (inversion)
1111 + 1 -> 0000 (overflow is discarded)
Answer: 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Given a negative number in two’s compliment form how to convert it to a human understandable form?

A
  1. Inverse the given binary number in two’s compliment
  2. Add 1 to the result of inversion
  3. Add minus sign to the result.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the range of number which can be represented by 8-bit binary in 2’s compliment format?

A
  • 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Convention steps of calling procedure on 32-bit architecture?

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly