2
\$\begingroup\$

I am trying to multiply signed numbers on a Nexys A7-100T FPGA development board with VHDL.

See Reference manual webpage link for the FPGA board hardware information.

Also see this link (begins page 78) for Vivado's Vivado design synthesis guide user VGDL guide which shows how to use the hardware multiplier logic.

I know this will work for unsigned numbers but can this be used for signed numbers with some additional logic / code?

I also have looked at the complex multiplier within this document however I am totally unfamiliar with the concept behind it?

How do people use the multiplier hardware to multiply signed numbers?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It is same as unsigned multiplication. Declare the signal as signed and use * . Complex multiplication in that UG shows how to use the pre-adder, acc and other stuff in the DSP. if you don't code for those, it will just do the multiplication. \$\endgroup\$
    – maximus
    Dec 31, 2020 at 11:39

2 Answers 2

4
\$\begingroup\$

The Vivado synthesiser is smart. You have to declare the operands as signed. If the operands are unsigned, explicitly type cast all of them to signed and then simply multiply using *. It should infer a signed DSP multiplier on synthesis.

If it's not inferring automatically (can be due to multiple reasons), then you may have to use USE_DSP attribute to force the synthesiser to map the multiplication logic to DSP slice.

Page 61, Vivado Synthesis Guide

\$\endgroup\$
3
\$\begingroup\$

I'm not sure if it's (even close to) the best way, but when I needed to do this, I checked the signs of the two numbers, ran that through an XOR, and stashed it in a flop. Then I took the absolute values of both operands, multiplied those, and then if my saved bit from the XOR was set, negated the result.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.