Re: define a filter kernel (with floating-point numbers) in
First you have to select a number range and bitwidth for the coefficients. Assuming it would be -1...+1 and 16 bit, you convert the parameter constant to signed integer by multplying it with 2**15. E.g. for -0.0144 you get -472. All filter multiplications are performed as integer multiply then. The coefficient LSB actually represents 1/(2**15).
which all of them are integer image is a matrix of integer range 255 downto 0,filter is integer array range 2**16-1 downto -(2**16),sum is integer range 2**24-1 downto -(2**24)
but i have problem in range of sum because overflow is happen
i don know how i should define the range of sum?!!!
the integer type can store any value from -2**31 up to 2**31-1
for your own sanilty, you may want to stop using integers and use the new fixed point libraries from IEEE. Then you dont need to keep track of any numerator/fraction in any number, its all taken care of. You could do something like this:
signal filter : sfixed(2 downto -8 ); --covers the range -8 to +(8- 2^-8 ) in steps of 2^-8 (0.00390625)