Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- hi kaz , sorry for late.i were very ill anyway,y are right really the result of division will be always between 0~1. will be some thing like 0.234....etc.so its floating numbers, but i want to know from you how to avoid the floating numbers and the same time know the correct answer because you know that floating numbers in implementation is a big problem. the counter will gave me the result of the data inputs number its only one value (the last value from a stream signal) and the dis is the accumullation of the dis values its only one value and i want to check if the result of the counter is even or odd value then divide the accumulator result on the n*n or (n*n)-1 . i kknow its easy task ,but i new in vhdl and want your help .many thanks --- Quote End --- you can use lpm divider(not the floating point one). alternatively if your n*n (& n*n-1) tolerates rounding to some power of 2 (2^k) then you can divide by discarding (k) LSBs but in this case you need to pre multiply (dis) value first by some large scale factor e.g. 2^10(add 10 leading zeros to dis value) then discard (k) lsbs. You will then know that your (dis) value is pre-scaled (thus you know where is the fractional point).