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?
Regards
Didn't find your answer? Ask the community — no account required.
R
Rob Gaddi
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
N
Nico Coesel
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...
nico@nctdevpuntnl (punt=.)
--------------------------------------------------------------
T
Tim Wescott
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).
www.wescottdesign.com
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.