expanding multipliers, problem

Hello all,

I am attempting to expand the 18x18 multipliers as provided in the xilinx Spartan 3 series. I followed the proposed implemention of expanding the multipliers as described in the xapp467.pdf app note (figure 5). However, I arrived at an impasse: When the operand is splitted up in 2 or more partial operands of 18 bits, the sign-extension of the operand does not carry over -I'll expalin: E.g Lets say we want to multiply (-1)in18bitsx(1)in 22bits.The 22 bit operand is splitted in 2 4-bit(lsb) and 18-bit(msb) operands. Thus, when we multiply the lsb part: 3FFFFh(=-1)x1h=3FFFFFh(=-1), we obtain a non-nil answer. However, when we multiply the msb part:

3FFFFh(=-1)x00000h=000000000h, we obtain a nil answer. When the 2 partial products are added and the bits properly weighed as to constructed the final product, the msb bit(sign bit) will be 0. Consequently, resulting in a positive product when a negative one was expected (-1 was expected, FFFFFFFFFFh.)

I feel I must be doing something wrong.. Please advise

-Roger

Reply to
Roger Bourne
Loading thread data ...

Ooops, I forgot to sign-extend the lsb partial product before the summing of the partial products. I hope that take care of the problem..

-Roger

Reply to
Roger Bourne

Are you performing the LSbit multiply as unsigned? Figure 5 of that app note shows the LSbits of the 22-bit A vector coming in unsigned while B is applied as defined.

A=M+L (L>0, M==A>>n) A*B = M*B + L*B

If B is negative, the L*B result is negative and the sign extension has to be included in the post-multiply adder.

Reply to
John_H

The lower parts of the inputs have to be treated as unsigned, and you need to form partial products of all the peices:

A = AH*2^n + AL B = BH*2^m + BL

A*B = AH*BH*2^(m+n) + AH*BL*2^n + AL*BH*2^m + AL*BL

AL and BL are unsigned, AH and BH are signed if A and B are signed.

In your case, I guess you have only one of the operands split so: A*B = AH*B*2^n + AL*B, AL is unsigned, AH and B are signed.

Your example has AH=0, AL=1, n=4, B=-1 A*B = 0 + -1 = -1. Keep in mind your partial products require sign extension to the full width of the full product in order to add them together.

Reply to
Ray Andraka

Sign extending the lower partial products fixed the problem. Now, the products obtained make sense.

Thanks

Reply to
Roger Bourne

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.