1

A signed number in $2's$ compliment notation with $16-$bit register $P=DFA0$

What is the value of $P*4$?

I have tried $P*4=0111111010000000$ but sign bit changed from $1$ to $0$. What is wrong with my solution?

  • The shifted value 11 0111 1110 1000 0000 does not fit into a 16-bit register, i.e. the multiplication overflows. If you ignore overflow your value is correct. – gammatester Jun 28 '18 at 14:42
  • $DFA0$ in twos complement represents $-8288$ in decimal. $4 \times -8288 = -32384 < -2^{15}$ so you have an overflow condition. – gandalf61 Jun 28 '18 at 14:50

1 Answers1

0

The value overflowed the range of the register. A $16$ bit twos complement register can represent $-2^{15}$ to $2^{15}-1$ or $-32768$ to $32767$. $DFA0$ is a little more negative than $-5\cdot 2^{12}$, so when you multiply it by $4$ you get something like $-20\cdot 2^{12}=-81920$, which is out of range. I ignored the lower order bits because they do not impact the problem.

Ross Millikan
  • 374,822