- What are the representations for,
- zero in 2's compliment
- the most positive integer that can be represented using 2's compliment
- the most negative integer that can be represented using 2's compliment
- Give the 8-digit hexadecimal equivalent of
- 3710
- -3276810
- 110111101010110110111110111011112
- Do the following using 6-bit 2's complement arithmetic (a fancy way of saying, ordinary addition in base 2 keeping only 6 bits of your answer). Work using binary (base 2) notation. Remember that subtraction can be performed by negating the second operand and then adding it to the first operand.
- 13 + 10
- 15 - 18
- 27 - 6
- -6 - 15
- 21 + (-21)
- 31 + 12
- What happened in the last addition and in what sense your answer is "right".
- "Complement and add 1" doesn't seem to be an obvious way to negate a two's complement number. By manipulating the expression A+(-A)=0, show that "complement and add 1" does produce the correct representation for the negative of a two's complement number. Hint: express 0 as (-1+1) and rearrange terms to get -A on one side and XXX+1 on the other and then think about how the expression XXX is related to A using only logical operations (AND, OR, NOT).
- What range of numbers can be represented with an N-bit sign-magnitude number? With an N-bit two's-complement number?
- Create a Verilog module that converts an N-bit sign-magnitude input into an N-bit two's complement output.
nice set of questions...
ReplyDeletei have a question
ReplyDeletewhy 2'scompliment is used more preferable to 1's complement in computer calculations
Its use is ubiquitous today because it doesn't require the addition and subtraction circuitry to examine the signs of the operands to determine whether to add or subtract, making it both simpler to implement and capable of easily handling higher precision arithmetic. Also, 0 has only a single representation, obviating the subtleties associated with negative zero (which exists in one's complement).
ReplyDelete