Issue in HDL Coder

12 vues (au cours des 30 derniers jours)
John Brooks
John Brooks le 28 Mar 2023
Modifié(e) : Kiran Kintali le 28 Mar 2023
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.

Réponses (2)

Kiran Kintali
Kiran Kintali le 28 Mar 2023
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.
  1 commentaire
John Brooks
John Brooks le 28 Mar 2023
Just sent you a message.

Connectez-vous pour commenter.


Kiran Kintali
Kiran Kintali le 28 Mar 2023
Modifié(e) : Kiran Kintali le 28 Mar 2023
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by