Altera_Forum
Honored Contributor
16 years agofixed point in verilog
hi. I understand that the fixed point in verilog is represented by signed [4:-2] where -2(2 bit for post binary point) is for tracking purpose. Pls correct me if i am wrong.
However, i have no idea on how to use in verilog for any arithmetic operation. e.g. module fixed_point_addition (dataA, dataB, result_add, result_mult); input signed [3:-1] dataA; input signed [3:-1] dataB; output signed [4:-2] result, result_mult; assign result_add = dataA + dataB; assign result_mult = dataA* dataB; endmodule In waveform editor, i cant set the value like 3.5. How to do this? i set the input(dataA=0.5 and dataB=0.5) and output in fraction when performing simulation, the result(result_mult= 0.125). May i know the reason? Can i have some simple source code in verilog(can perform 3.25 * -6.125) and how to perform the simulation? Thanks