Forum Discussion
Hi,
For functionality in this post community.intel.com/t5/Intel-Quartus-Prime-Software/LPM-DIVIDE-behaves-differently-between-simulation-and/m-p/1672473#M85726, i think should be no problem check below:
For a numerator of −5 and a denominator of 3, using the LPM (Library of Parameterized Modules) IP division method where the remainder is always positive, we follow these rules:
Quotient Calculation: Perform integer division (truncate towards zero):
−5÷3=−1(integer division)
Remainder Calculation:
remainder=numerator−(quotient×denominator)
remainder=−5−(−1×3)=−5+3=−2
However, since LPM IP requires a positive remainder, we adjust by adding 3 to remainder and reducing quotient by 1:
new quotient=−1−1=−2
new remainder=−2+3=1
Final Result:
LPM_HINT => "LPM_REMAINDERPOSITIVE=TRUE":
quotient=-2
remander=1
LPM_HINT => "LPM_REMAINDERPOSITIVE=FALSE":
quotient=-1
remander=-2
The simulation and signal tap result for LPM_HINT => "LPM_REMAINDERPOSITIVE=TRUE" and LPM_HINT => "LPM_REMAINDERPOSITIVE=FALSE" are correct.
Only the result for LPM_HINT => "UNUSED" is incorrect, please don't use LPM_HINT => "UNUSED" (Incorrect Usage)
And for the numerator and denominator width you can use from 1 to 64 if check this document https://www.intel.com/content/www/us/en/docs/programmable/683490/20-3/parameters-72926.html. Sorry I was mislead by the dropnow menu.
Thanks,
Regards,
Sheng