Why does HDL code generation give errors when variable-sized variables are used?
Afficher commentaires plus anciens
I am trying to generate HDL code for my Simulink model containing a MATLAB function block. My MATLAB function block initializes a persistent variable. The size of the persistent variable is defined using a tunable parameter. When I generate HDL code for my model, I get the following error:
The persistent variable 'variableName' generated for MATLAB Function Block
'modelName/MATLAB Function' has a variable size and is not supported by HDL code generation.
HDL code generation failed for 'MATLAB Function' (#24).
A similar error is observed when I generate HDL code for my MATLAB code containing variable-sized variables:
Variable "variableName" has a variable size and is not supported by HDL code generation.
Below is sample code that can reproduce the HDL code generation issue :
function y = foo(sizeOfRAM, rdAddr)
persistent pRAM;
if isempty(pRAM)
pRAM = zeros(1, sizeOfRAM);
end
y = pRAM(rdAddr);
end
I use the following command to generate the HDL code:
>> codegen -config:hdl -args {uint8(0), uint8(0)} foo
Why can't I generate HDL code for variable-sized variables?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Speed and Area Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!