Electronic – Half Precision Floating Point in Systemverilog

system-verilogverilog

I have a 16 bit vector defined as:

logic [15:0] x;

In my simulation I want to assign x a half precision floating point number.
For example: 7.42

Is there a simple way to do it ?

Best Answer

you can do binary and decimal arithmetic's, but fixpoint or even floating point, you need to program all yourself, or search for a existing free implementation.

When it is only about a testbench, most commercial simulators allow to integrate with C or SystemC. Here you can do all the floating point stuff you want (e.g. I used to check my verilog algorithms like CRC with a C/C++ implementation)

Edit: if you have access, you might try a high level systhesis tool. I once tried Xilinx HLS with some complex integer Algorithm and was impressed by the result. Maybe they also can do floating Point stuff. Never tried that myself...

Another idea: on github or opencores you will find verilog floating point implementations (or complete FPU's)