Hi all

I want to calculate a simple formula, including multiply and division operands. I use Verilog language to program FPGA.

Can I use the sign of Multiplication (*) and Division (/)? Or I have to write the code of a Multiplication algorithm like Booth?


Reply to
Loading thread data ...

That depends on whether you expect the math to be done in the hardware or at compile time. If it's the latter, you can do whatever you'd like. If the former, then it'll depend. Most FPGA families have multiplers and the tools are smart enough to use those multipliers to perform a multiply when you specify one.

Divides (by other than a power of 2) are a pain, and always require serial algorithms to do them. You'd be well served trying to replace that divide with a reciprocal multiply if possible.

Rob Gaddi, Highland Technology
Email address is currently out of order
Reply to
Rob Gaddi

That depend on the synthesis tools. I guess with most modern tools you can use the * and / sign. How it gets mapped to the hardware depends on the target. You really should consult the manual of the synthesis tool on how this is handled.

Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
 Click to see the full signature
Reply to
Nico Coesel

If you can stand the repetition: it depends on your tools, and what you're trying to do.

If you're multiplying integers then most tools will see a '*' and map it to a hardware multiplier (or synthesize one). I wouldn't trust a synthesizer to know how to do a fixed-point multiply that wasn't integer, although I would give it a whirl and see what happened. Divide is so resource hungry that there are a tremendous number of system-level decisions to be made in implementing it: I would be astonished at a synthesizer that would see a '/' and automagically map it to some sort of a divide.

You need to read up on the algorithms in question to see why divide is so different from multiply, and to get an idea of what you might have to do to make it work. (Although I expect that most FPGA manufacturers and/or tool chain vendors will have some sort of divide primitive wizard that you can at least use for the bit-slice portion, even if you have to wrap it with your own sequencing logic).

Reply to
Tim Wescott

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.