开发者

Binary Multiplication, 2's complement

开发者 https://www.devze.com 2023-01-19 14:56 出处:网络
I am trying to learn Binary Multiplication, 2\'s complement negative numbers. -10 x 3 I know ther开发者_Go百科e is a simple way of doing this. Like sign extension and initial partial product.

I am trying to learn Binary Multiplication, 2's complement negative numbers.

-10
x 3

I know ther开发者_Go百科e is a simple way of doing this. Like sign extension and initial partial product.

-10         0110 twos complement
x 3       x 0011
----      ------
          000000  (initial partial product) with sign extension at the MSB
          10110  (bit 0 of the 3 times 10, sign extended at MSB)

          110110  (sign extended sum of initial partial product and
                           Multiplicand)

          10110- (bit 1 of the 3 multiplied by the 10. sign extension at the MSB Note the
                         Multiplicand is shifted left by one bit)

I am lost on how to continue. I am not even sure if i was completely right up to this point. Can someone show me how to do it by steps? I dont want to do it any other way. If i do it the traditional way big numbers could be bad. Thank you


Your interpretation of -10 is off.

   ..11110110  (-10)
×    00000011    (3)
-------------
   ..11110110  (-10)
+ ..111101100  (-20)
-------------
   ..11100010  (-30)


Hope This will help you. Use 2's complement. Overflows are discarded.

-10 in 2's complement is 0110. Add 1111 in front to make it 8 bits.

    11110110  (-10)
    00000011  (3)
  -----------
    11110110
   11110110
  -----------
  1011100010 (discard [10]) 

answer = 11100010

when converted back, it's 30. that means the number represented by,11100010 is -30. (2's comp.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号