Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- thanks all; hi kaz n is not a vector value to check lsb to it and i use mod function because n is integer . if i understand wrong could you plz illustrate it for me. but n*n & n*n-1 implies what? it will be square n and since dis is also 8 bits width then division will mostly be zero plus remainder. why division will mostly be zero plus remainder. could you plz illustrate it too. --- Quote End --- You can declare (n) as unsigned(7 downto 0) n range is 0~255 so n*n range is 0~65535, while (dis) range is 0~255 so if you divide dis/(n*n) you get (0~255)/(0~65536) and so it is mostly < 1 i.e. zero division result + remainder apart from the small range case when dis > (n*n)