HDL coder fails generating wavelet denoise function

2 views (last 30 days)
Massimiliano Buonamico
Massimiliano Buonamico on 11 Oct 2021
Answered: Kiran Kintali on 23 Nov 2021
Hi all,
I'm trying to create an HDL model to process data coming from an audio channel using the DSP builder and the HDL coder.
The aim is to implement the HDL subsystem and then integrate into an HDL import module into the main design.
This is the subsystem for which I want to generate the HDL.
This is the wavsystem. The reason why I had to make it fixed on the output is that the serializer block accepts only data of fixed size.
classdef wavsystem < matlab.System
% wavsystem
% implements wdenoise algorithm on a fixed size array of 1024 elements
methods(Access = protected)
function y = stepImpl(~,u)
y = wdenoise(u,10,'Wavelet','coif4','DenoisingMethod','SURE',...
'ThresholdRule','Soft','NoiseEstimate','LevelIndependent');
y = y(:);
y = y(1:1024);
end
function sizein = getInputSizeImpl(~)
sizein = [1024,1];
end
end
end
I'm able to run the simulation but when I try to generate the HDL code using the workflow advisor I get this error.
Compilation errors when generating code for: \MATLAB System Error during MATLAB code compilation: Error Path: C:\Program Files\MATLAB\R2021a\toolbox\wavelet\wavelet\wdenoise.m Error Location: (@Row: --> 412 @Column: --> 9) The coder.varsize() built-in function can only be used when support for dynamic matrices is turned on.
If I try to make it variable size the serializer complains and I'm not even able to run the simulation.
Any idea on how to proceed?
Should I make a copy of that file and try to remove the call to coder.varsize()?
Any advice would be more than appreciated.

Answers (1)

Kiran Kintali
Kiran Kintali on 23 Nov 2021
Support for C/C++ code generation exists for wdenoise.
I have reported the HDL Code Generation request for this function to development team.

Community Treasure Hunt

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

Start Hunting!