I'm using signed fixed-point numbers in my code. In order to make it easier to verify the values, I would like to see the real numbers they represent in the waveform. For example, lets say:
// 1bit signal, 4bits integer, 4bits fraction
wire [8:0] my_number1 = 9'b1_1111_1000; // -0.5
wire [8:0] my_number2 = 9'b0_0000_1000; // 0.5
I would like to see -0.5 and 0.5 for my_number1 and my_number2 respectively. When I used Cadence tools, I could click in the signal waveform and choose to 'create expression' and simply create a new signal:
(my_number1*(2.0**-4))
ModelSim Altera Starter Edition does not have this option on its GUI, so I thought I could maybe create a real signal in my testbench, related to the fixed-point, and then track this number.
I tried to create a real signal in my testbench:
real my_number1_real = (my_number1*(2.0**-4));
but then all I can see is -0. I've tried also $bitstoreal but then I would have to transform it to a 64bit number and consider the exponent and so on (see wikipedia), so its definitely not an easy way to do that.
Any idea how can I do that?