Binary multiplication

Thread Starter

aceminer

Joined Aug 26, 2011
21
Hi guys,

I am having a problem with signed binary multiplication

The question would be : 110101 x 0110

could someone explain to me in detailed steps on how to do this.

my working is as follows:

110101
x 0110
----------
000000
110101
----------
11101010
010101
-----------
100111110

however, this is not the correct answer. Can someone enlighten me on what would be the proper working?

sorry if this is a very simple question as i am extremely new to digital logic questions.

any help is greatly appreciated.
 

Georacer

Joined Nov 25, 2009
5,182
It is performed exactly as the normal multiplication, with 1x1=1 and 1x0=0.
Also remember that 1+1=0 and 1 carry for the vertical addition.

Post your work in a picture however, because the spaces in your post are a bit messed up.
 

ErnieM

Joined Apr 24, 2011
8,042
-Look at LSB of bottom. If one, copy top. If zero, copy zero.
-Shift top one spot to the left (same as multiply by 2)
-look at next bit to the left in bottom
-rince, lather, repeat till bottom is gone

Then add all intermediate products

Rich (BB code):
      110101
      x 0110
  ----------
      000000 
     110101        
    110101         
 + 000000         
  ----------             
   100111110
 

Thread Starter

aceminer

Joined Aug 26, 2011
21
Hey guys,

correct me if i am wrong,

isn't
110101 = -21
0110 = 6

so in decimal,
-21 x 6 = -126

however, 100111110 would give u -62 only.
 

MrChips

Joined Oct 2, 2009
21,132
No, you are incorrect on two counts - You are assuming the numbers are signed integers. Secondly, you are incorrectly applying the MSB as the sign bit.

010101 = 21
but
110101 is not -21 if you use 2's complement representation

Similarly,
100111110 is not -62

The left most bit does not automatically represent the sign of the number.
Firstly, you must define the number of bits in the word.
Secondly, you must define the representation you are adopting, signed short or long, unsigned short or long etc.

The result of the binary multiplication is correct if we assume unsigned integers.
53 x 6 = 318

There are only 10 types of people in the world - those who understand binary and those who don't:)
 
I guess this problem is one of the basics in logic, the length might be 8 bits. so that 110101= 0011 0101
and 0110= 0000 0110
then from this perform the multiplication for signed integers.

It is just an idea from me.
thank you!!
=)
 

MrChips

Joined Oct 2, 2009
21,132
You have to understand the definition of 1's complement and 2's complement.

11 (base 10) = 0000 1011 (8-bit word)

1's complement is: 1111 0100
2's complement is: 1111 0101

Here are a couple more ways to appreciate this:

-11 (base 10) = 1111 1111 1111 0101 (16-bit word)

(1) If you increment this register 11 times you should end up with zero.

(2) If you add 21 to -21 you should end up with a zero result.
 
Last edited:

Thread Starter

aceminer

Joined Aug 26, 2011
21
Hi just to check, so would it be such that since 110101 is negative, it would mean that -10101. However, to take the 2's complement of it, you would invert the bits and add one.

after inverting = 01010
adding 1 = 01011
therefore = 01011 = 11
 

MrChips

Joined Oct 2, 2009
21,132
That is correct.

The 2's complement of a negative number would result in a positive number of equal absolute value.

Because by definition, -(-X) = X

Here is a trick question.
What is 1000 0000 if the word length is 8 bits?
 
Last edited:

Thread Starter

aceminer

Joined Aug 26, 2011
21
would it be 0? invert the bits and add 1. however, ignore the last carry. so that makes it 0?

anyway according to my question, what would be the exact working? do i invert the bits and calculate or just calculate from it offhand. either way i couldnt get -66 after i convert to dec.
 

MrChips

Joined Oct 2, 2009
21,132
would it be 0? invert the bits and add 1. however, ignore the last carry. so that makes it 0?
The correct answer is -128. How many times would you have to increment 1000 0000 before it reaches zero?

anyway according to my question, what would be the exact working? do i invert the bits and calculate or just calculate from it offhand. either way i couldnt get -66 after i convert to dec.
I apologize for the error I made when I said the answer is -66. You are correct in pointing out that the answer is not -66. We have to back up to posts #5, #6 and #7.

The statement "2's complement multiply" does not make any sense.

The leftmost bit does not automatically mean the number is negative. The sign of a 2's complement binary number is represented in the MSB of the entire word or register. Hence we have to define the size of word.

For an 8-bit word
11 (base 10 ) = 0000 1011
-11 (base 10) = 1111 0101

For the original question, we have to define the size of the multiplier, multiplicand and result registers. If the multiplier and multiplicand are both 8 bits long, one may expect the result to be 16 bits long but it would not be unusual for it to be only 8-bits.

So we are back to unsigned integer multiply.

(BTW I will not be able to respond for awhile)
 

Thread Starter

aceminer

Joined Aug 26, 2011
21
The correct answer is -128. How many times would you have to increment 1000 0000 before it reaches zero?
hmmm i do not really get it as of so far. What i did was to invert the bits and add 1 to it. Well, let me try again to see how did you get -128.
 
Top