POW2(A) is not supported when A is a FI object.
3 次查看(过去 30 天)
显示 更早的评论
Hi Team,
I am getting the below error while doing HDL - coder conversion from MATLAB to c.
seems like both a and b in b = pow2(a,K) are fi.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/745904/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/745909/image.jpeg)
POW2(A) is not supported when A is a FI object.
Could anyone help in this. Thanks
Athira KM
回答(2 个)
Kiran Kintali
2021-9-23
Please share your design.m and testbench.m and MATLAB to HDL project file.
Thanks
Kiran Kintali
2021-9-25
You are using Variable dimensions and the coding style is not suitable for HDL Code generation or FPGA/ASIC synthesis.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/749004/image.jpeg)
Few other observations:
There are some comms internal toolbox functions such as "comm.internal.utilities.de2biBase2RightMSB" used in the floating point code targeted for the fixed-point conversion workflow. These functions do not support fixed-point types as inputs.
% Optimized bi2de taken from comms.internal.utilities
function dec = bi2deOptimized(bin)
dec = comm.internal.utilities.bi2deRightMSB(bin, 2);
end
% Optimized de2bi for scalar inputs taken from comms.internal.utilities
function bin = de2biOptimized(dec, n)
bin = comm.internal.utilities.de2biBase2RightMSB(dec, n);
end
You may needs to cast the inputs to double at the minimum to get through float2fixed conversion but you would be stuck in HDL code generaiton eventually; consider providing HDL friendly replacement functions with sutiable fixed-point equivalents.
You also need to manually make TimeStamp variable to 2 bits wordlength; bitshift does not support shifting 1 bit for some reason. Needs more investigation.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/749009/image.jpeg)
Please update the code to remove variable dimensions and share the attachment.
Thanks
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 FPGA, ASIC, and SoC Development 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!