Forum Discussion
Altera_Forum
Honored Contributor
11 years agoDividing numbers by constants without dividers?
Hi! I would like to divide a number by a set of constants (3, 5 or 7) and I have read in an old post that using a divider might be a waste of resources. I have also read that for simple divisio...
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- For low numbers of bits, you can also do it using a lookup table. 14bit is starting to get a bit large for this approach, but it could be done in 1 or 2 clock cycles using four M20K's as ROM. Your 14bit number is the address (14b=2^14=16k), and the 1 bit output from each of the four memories forms the result. If you need to do two different divisions, you can use the memory in dual-port mode and be able to do two simultaneous divisions with the same memory. --- Quote End --- yes. This is a general theme for any result. Any equation can be precomputed in software, stored then addressed. In some cases part of the result is stored to reduce memory supported by some computation (partial lookup)