vhdl - How to send a floating point number to FPGA from HPS? -
i using altera de0 nano soc fpga. want know how send floating point number fpga hps.
let float ex_hps = 6000.9282;
sent via avalon memory mapping interface. if avalon_write_data address
has 32 bits data length (which can set qsys), in fpga side number stored in 32-bit std_logic_vector
right?
does std_logic_vector
contains float number fixed point type (13 downto -14
) original value? or how put number fixed point number ex_fpga(13 downto -14)
in fpga side in vhdl?
this have looked yourself.
you need map float integer in c first, using knowledge system.
#include <math.h> unsigned int preparefortransmission(float inputvalue) { if (inputvalue < 0) return 0; /* underflow error: clip */ if (inputvalue >= powf(2.0f, 14)) return (unsigned int)pow(2.0, 28) - 1; /* overflow error: clip */ return (unsigned int)(inputvalue * pow(2.0, 14) + 0.5); /* +0.5 round */ }
then in vhdl can port unsigned std_logic_vector(27 downto 0)
ufixed(13 downto -14)
. (hopefully) know how that.
Comments
Post a Comment