# Binary multiplication

Discussion in 'Homework Help' started by aceminer, Aug 26, 2011.

1. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
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.

2. ### Georacer Moderator

Nov 25, 2009
5,154
1,281
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.

3. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,989
1,848
-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

Code ( (Unknown Language)):
1.       110101
2.       x 0110
3.   ----------
4.       000000
5.      110101
6.     110101
7.  + 000000
8.   ----------
9.    100111110

4. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
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.

5. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
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

6. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
Perform the following 2,s complement binary multiplications.​
110101​
x 0110

that would be the question.

7. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
That is vague. You still have to define your word length.

Last edited: Aug 27, 2011
8. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0

thats all the question gave. i merely copied and pasted.

9. ### Agonche Member

Aug 26, 2011
30
0
$
(110101)_{2}=(53)_{10}
(0110)_{2}=(6)_{10}

53x6=318$

$(100111110)_{2}=(318)_{10}$

10. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
But if its in 2 complement, isnt the MSB signify it as a negative number, hence the result would be a negative one?

11. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
110101 = -11
-11 x 6 = -66

12. ### Cristopher Tingcang New Member

Jul 31, 2011
18
0
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!!
=)

13. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
why is 110101 = -11 not = -21

14. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
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: Aug 27, 2011
15. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
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
therefore = 01011 = 11

16. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
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: Aug 28, 2011
17. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
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.

18. ### MrChips Moderator

Oct 2, 2009
19,132
6,148
The correct answer is -128. How many times would you have to increment 1000 0000 before it reaches zero?

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)

19. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
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.

20. ### aceminer Thread Starter New Member

Aug 26, 2011
21
0
Hey thanks!. I think i am finally getting it.