[Fixed Point Converter] 1000 bit fraction length at 2^x if x is loaded from .mat file?
Mostrar comentarios más antiguos
I got a problem with code like this in the fixed-point converter:
dut_tb.m
dut(8);
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?
Respuesta aceptada
Más respuestas (1)
zhang zheng
el 13 de Abr. de 2020
0 votos
i also sometimes find fixedpoint-tool is not easy to understand. i often first convert m-code from float point to fixed point, and then convert them to hdl code or c code.
Categorías
Más información sobre Fixed-Point Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!