hdl coder work flow adviser block compability error
3 views (last 30 days)
Show older comments
Dear all,
I have a model so as to control a pmsm. when I run the hdl workflow adviser to generate VHDL code, an error which is not clear for me has been occured on the step "check block compability". The error message and related blocks are given as follows;
Simulink BlockWarnings/Errors
Error: Slope and bias scaling 'sfix32_S1p953125en7' is not supported for HDL code generation. Slope must be equal to a power of 2, and bias should always be 0.
I need help about solution of the error.
Thannks in advance.
Regards
Fahri
0 Comments
Answers (4)
Kiran Kintali
on 25 Jan 2021
Edited: Kiran Kintali
on 25 Jan 2021
Running hdlsetup command on the model targeted for FPGA always helps in terms of data type selection.
web(fullfile(docroot, 'hdlcoder/ref/hdlsetup.html'))
web(fullfile(docroot, 'hdlcoder/ug/check-for-safe-model-parameters.html'))
One of the things this command does is setting ProdHWDeviceType Device vendor to ASIC/FPGA and this greatly helps in coming up with optimal full-precision types for HDL Code generation.
0 Comments
Kiran Kintali
on 18 Aug 2020
HDLCoder only supports binary-point scaling. The product currently does not support slope/bias scaling.
You need to choose fixed-point types with a sign bit, fixed wordlength and fraction length.
For ex: A signal with type fixdt(1, 32, 16) as shown on the signal like sfix32_En16 has the following range.
>> a = fi(pi, 1, 32, 16)
a =
3.1416
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 32
FractionLength: 16
>> range(a)
ans =
1.0e+04 *
-3.2768 3.2768
DataTypeMode: Fixed-point: binary point scaling
Signedness: Signed
WordLength: 32
FractionLength: 16
0 Comments
Angel de Castro Martín
on 25 Jan 2021
Hi. Similar problem here. This thread gave me the hint for solving it. I don't know why, the I (integrator) and D (derivative) try to use "strange" data types if let to choose by default (Inherit: inherit via internal rule). In my case, in which I was trying just a PI, I got to compile correctly setting only the "Additional data type" of "Integrator output". The rest can use inherit, but not this one. I also set the type of the input, but not of the global output. I attach a screenshot. I hope this helps future users.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/499548/image.png)
0 Comments
See Also
Categories
Find more on FPGA, ASIC, and SoC Development in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!