Issue in HDL Coder
4 次查看(过去 30 天)
显示 更早的评论
I get the following errors (shown in snapshots at the end of the post) when trying to do fixed point conversion. I'm not sure where to go from here.
I did some testing and it appears that the code that was generated doesn't even work on it's own:
>> confirming_behav
Error using movmean
Invalid data type. First input must be numeric or logical.
Error in confirming_behav>WaveletFilteredSection4 (line 54)
mean = movmean(abs((w)), fi(15, 0, 4, 0, fm));
Error in confirming_behav (line 12)
w2 = WaveletFilteredSection4(coeffs,sig);
>> confirming_behav
I think the issue is in the fixed point function but I don't know a lot about that function. I will be reading up on the documentation to see what could be done but I'd like to know how to fix this in the base HDL coder settings.
0 个评论
回答(2 个)
Kiran Kintali
2023-3-28
Can you share the design, testbench and project files?
Feel free to reach out to MathWorks tech support or DM me with the reproduction steps.
Kiran Kintali
2023-3-28
编辑:Kiran Kintali
2023-3-28
t = 1:10;
x = [4 8 6 -1 -2 -3 -1 3 4 5];
yc = movmean(x,5);
plot(t,x,t,yc);
The movemean function does not support fixed-point inputs and hence the error input should be .
>> movmean(fi(x), 5)
Error using movmean
Invalid data type. First input must be numeric or logical.
I would consider writing a local function that replaces movemean with equivalent MATLAB code before float to fixed conversion.
In addition you have too much IO coming into the design:
Both inputs to the design 'coeffs' and 'sig' and output 'w' are "double(8192 x 1)" and eventually when converted to fixed point wordlength of 'N'; You would need 3xNx8192 pins which would violate the IO threshold on the hardware.
You might want to consider a streaming version of this algorithm if you are targeting HDL code generation.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!