Altera_Forum
Honored Contributor
15 years agoIssue with lpm_divider
Hi,
I am currently working on a block which calculates a configuration word to be sent to an external PLL chip based on a frequency that is sent from a higher application. I am doing it in the schematic editor of Quartus using the megafunctions to implement the various subrtractions, divsions and multplications nessecery. When I simulate my circuit (attached) in modelsim, they output I obtain is incorrect. After debugging the circuit I have traced the issue to the output of the final stage (the output of central_freq_div_2). The inputs to these blocks are the expected values, but the division result is not as expected. The numerator of the divider is 2 32 bit words (as I could not use a 64 bit constant) which has a value of x5A00000000000000, the denominator is a 40 bit value, 250,000,000 (xEE6B280) in my example. If I do this division in decimal, the answear comes out fine, but using the calculator in windows and doing the division in hexadecimal, the answear comes out incorrect (x60A302F9D), which curiously is also the result I see in modelsim. I´m sure this issue has a simple explanation, but I´m a little lost. Is this an issue with modelsim, the lpm_divider megafunction or something else? Is there an issue when working with 64 bits (like in the windows calculator)? Can anyone see another way of getting around this issue? I would be very grateful for any ideas. Many thanks