# FPGA Central

## World's 1st FPGA Portal

 FPGA Groups > FPGA expanding multipliers, problem

 FPGA comp.arch.fpga newsgroup (usenet)

04-26-2006, 04:25 PM
 Roger Bourne Guest Posts: n/a
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..
-Roger

04-26-2006, 04:46 PM
 Roger Bourne Guest Posts: n/a
Re: expanding multipliers, problem

Roger Bourne wrote:
> 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..
> -Roger

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

04-26-2006, 05:08 PM
 John_H Guest Posts: n/a
Re: expanding multipliers, problem

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.

"Roger Bourne" <[email protected]> wrote in message
news:[email protected] oups.com...
> 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..
> -Roger
>

04-26-2006, 10:12 PM
 Ray Andraka Guest Posts: n/a
Re: expanding multipliers, problem

Roger Bourne wrote:
> 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..
> -Roger
>

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.

04-27-2006, 01:19 PM
 Roger Bourne Guest Posts: n/a
Re: expanding multipliers, problem

Ray Andraka wrote:
> Roger Bourne wrote:
> > 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..
> > -Roger
> >

>
>
> 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.

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

Thanks

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post cristian FPGA 11 11-29-2004 06:41 PM Kelvin FPGA 6 07-05-2004 07:24 AM OP FPGA 2 03-05-2004 12:34 AM

All times are GMT +1. The time now is 08:58 AM.