I got a problem with code like this in the fixed-point converter:
dut_tb.m
dut.m
function out = dut(in)
S = coder.load('constants.mat');
out = in+2^S.exponent;
end
storeConstants.m
function [] = storeConstants()
exponent = 8;
save('constants.mat');
end
convert.m
exArgs = {8};
fc = coder.config('fixpt');
fc.TestBenchName = 'dut_tb';
codegen -float2fixed fc -args exArgs dut
Reproduction steps:
run storeConstants and then convert.
The fixed-point converter automatically uses a fraction length of 1000 for the power of two operation.
As this is just a simple bitshift in hardware, I cannot see the purpose of this high precision. How can
I disable this huge fraction length?