# How to simplify the multiplication with a binary sequence

Status
Not open for further replies.

#### rogeret

##### Member level 4
Hello,
A's format is 9bits signed 2's complementary code.
B is a binary sequence consisting of only 1 and -1 except 0 and its format is 2bits signed 2's complementary code.
How to simplify the multiplication: A*B? any specific algorithm?

thanks!

#### vickyuet

##### Member level 2
For both signed number Multiplication ,You need to consider few things

1-Sign extend results of partial products
2-For sign bit multiplication (if its 1 ) take 2's complement of multiplicand.
3-Ignore the carry out from MSB to get the accurate result...

10 (-2)
x 10 (-2)
----------
0000
010x Take 2's complement of multiplicand (110 = 001+1 = 010) and append
-----------
0100 ignore the MSB to get correct answer i.e 4 = 100

#### rogeret

##### Member level 4
Thanks, but this is just how to implement a general multiplication. Any method to simplify the multiplication with only 1 and -1?

#### vickyuet

##### Member level 2
Fine .....you can extend the concept .......for multiplicand 1 and -1 only ....Detect from input streamif its 1 copy the multiplicand as it is....If its -1 take 2's complement of multiplicand ,Shift the partial product.....sign extend and Add partial product ....Try it for small numbers and check the result....

#### rogeret

##### Member level 4
thanks!
a cute method to detect the input stream may be just to detect the sign bit of the 1,-1 stream but the whole 2bits.

Status
Not open for further replies.