basic arithmetic

MG
Written by
3
      • 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.

                                  Post a Comment

                                  3Comments

                                  Your comments will be moderated before it can appear here. Win prizes for being an engaged reader.

                                  1. i have a question
                                    why 2'scompliment is used more preferable to 1's complement in computer calculations

                                    ReplyDelete
                                  2. 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
                                  Post a Comment

                                  #buttons=(Ok, Go it!) #days=(20)

                                  Our website uses cookies to enhance your experience. Learn more
                                  Ok, Go it!