简体   繁体   中英

Perform the following 1's complement fixed-point integer arithmetic operations

This question is from my digital logic class but I don't understand it. Please help me understand what it is asking me.

Lets say A1 and A2 are octal shorthand.

Perform the following 1's complement fixed-point integer arithmetic operations and note whether magnitude overflow has occurred in each case: (Hint: Use 7's complement arithmetic on the other octal shorthand),

i) A3= A1+A2
ii) A3= A1-A2

I thought you only take complements when you want to do subtraction. Can't I just do the subtraction in octal form? Can someone help me understand what the questions are ask?

I'm not sure how the obscure "octal short-hand"/"7s-complement" comes into play, but here is the "traditional" solution:

i) A3 = A1+A2
       1
       2631
       84268421
       01000000
    A1=10100001 = -94
  + A2=10100010 = -93
    ------------
    A3=01000011 = -187 < -127 so we know this is wrong 
co:    10100000

  CO = 1 which also indicates result is wrong


ii) A3 = A1-A2
        1000000
    A1=10100001 = -33
  - A2=10100010 = -34
    ------------
    A3=????????? =  1  < 127 so we know this is right
  ==
        0000010
    A1=10100001
  + A2=01011101
    ------------
    A3=11111110 = -67
co:    00000001 = 1

  CO = 0 which also indicates result is right

It's a trick question; or you misquoted it. I doubt your instructor would ask the former; so it must be the latter.

Recall that a 1s complement sum is the XOR of two operands (here A1 and A2). And that there is no carry and therefore no such thing as magnitude overflow in the 1s complement world.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM