couldn't work out the right way to do calibration so ended up with a hack on both the verilog and training side :/
sending +5V => 20,000 ( that's from the COUNT_PER_VOLT = 4000 )
...
just realised that +/-5V => +/- 20_000
could be mapped to +/-5V => +/- 5_000 with >>> 2;
and then back with << 2 ?
this works. and 5000 is close to 4096...
so can we need to rescale on the way in?
i.e. we want 5V = 16_384 ( since 16384 >> 2 = 4096 )
so we want to 0.8192
currently 16384 is 4.096V
so we want to divide everything in the data by
in fact, even simpler....
if we map everything by >>> 2 coming in ( and by << 2 on way out )
then we have 5V = 5000 = 0x1388 = 1.220703125
the data is based on 8V=1.0, so 5V = 0.625
so we just need to multiply all the data by 1.220703125/(5/8)=1.953125
during training....
means the max the net will take, or output, is +/- 1.22 but this should be fine and is well with FP4.12