[USRP-users] division in E100 FPGA
josh at ettus.com
Fri Feb 24 18:26:50 EST 2012
On 02/24/2012 03:06 PM, Dekst wrote:
> Hi, All,
> I'm doing some calculations in E100 FPGA.
> I need to multiply the input with some decimal factors but in e100 all data are integers.
> So 1) I enlarge decimal factors to integers (decimal factors x 10000);
> 2) multiply two integers: input data X (decimal factors X 10000);
> 3) divide the results by 10000.
> When I complie, I got an error. It said
> that if i want to use '/' (division operator) directly in verilog code,
> the divisor must be 2^n. Is there any division module in usrp e100 that handles any kind of divisor?
Fixed point math in the FPGA? Arbitrary division is not practical.
Use a multiplier to perform arbitrary multiplication. For division, only
divide by powers of two - AKA by truncation of lower bits.
Suppose you wanted to divide by 1000. So truncate the lower 10 bits,
then adjust the multiplication scalar to adjust for the error of 1024/1000.
More information about the USRP-users