Forum Discussion
Altera_Forum
Honored Contributor
14 years agoNot that I have any clue why you are doing this but this might be easier:
1) 10/3 --> 3 and remainder 1 (use lpm_div) 2) 1(remainder from# 1)/3-->0.333333 (using altfp_convert followed by altfp_div) 3) 0.333333 * 10 (using altfp_mul) 4) 3.333333 convert to 3 to get the remainder with one decimal place (using altfp_convert to bring it back to a whole number) So step 1 gets you the digits to the left of the decimal place and steps 2-4 get you the first digit after the decimal place. That said this is a lot of hardware that I would normally just have a CPU calculate for me using software libraries.