Altera_Forum
Honored Contributor
15 years agoDividing two N-bit signed binary (with fractional bits) in Quartus
In my design, I am required to divide a signed 16-bit binary, say A, with another signed 16-bit binary, say d. Both inputs have decimal and fractional bits.
The denominator d is actually a positive number and always less than or equal to 1; so it's basically fractional majority of the times. Now since division uses up a lot of resources, I am thinking of simply multiplying 1/d by A. For this, I was looking at using the lpm_mult megafunction, with input datab as a constant. Unfortunately, the megafunction only takes in integers as constants. The output A/d should be also be a 16-bit signed binary (will have both decimal and fractional bits with sign). Can you please suggest me other implementation possibilities, to either divide by d or multiply by 1/d? Appreciate your guidance and help.