Wednesday, February 20, 2008

basic arithmetic of digital elctronics

  • What are the representations for,
    1. zero in 2's compliment
    2. the most positive integer that can be represented using 2's compliment
    3. the most negative integer that can be represented using 2's compliment
  • Give the 8-digit hexadecimal equivalent of
    1. 3710
    2. -3276810
    3. 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.
    1. 13 + 10
    2. 15 - 18
    3. 27 - 6
    4. -6 - 15
    5. 21 + (-21)
    6. 31 + 12
    7. 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.

No comments:

Archive