Well I have a matrix that its elements are between 0 and 1 (e.g 0.976) and I want to use it as my design as inputs (my design inputs are 32 bit and fixed point). so i need to convert the matrix values to their binary representation and then use them in the rest of design. So how can i do it? is there any vhdl function that read these decimal numbers and released the binary one?
Regards
Mostafa
The answer will depend on just how you 'have' these numbers and whether or not they change. I'm assuming that your numbers are constants. Since you're using fixed point then the conversion is something like this...
x_fixed_point <= to_sfixed(x_real, 1, -31); -- Fixed point signed representation, allows for 1.0
x_fixed_point <= to_ufixed(x_real, 0, -31); -- Fixed point unsigned representation, allows for 1.0...no sign bit required
x_fixed_point <= to_sfixed(x_real, 0, -31); -- Fixed point signed representation, does not allow for 1.0
x_fixed_point <= to_ufixed(x_real, -1, -31); -- Fixed point unsigned representation, does not allow for 1.0...no sign bit required
If my assumption is not correct and the numbers you need to convert are not constants then you're not clearly explaining how you're getting these signals in the first place since a signal would not be 0...0.976.
Kevin Jennings