HDLcoder ignores coder.const

1 回表示 (過去 30 日間)
Anze Slosar
Anze Slosar 2022 年 9 月 13 日
回答済み: Kiran Kintali 2022 年 9 月 25 日
I'm tryint to compile some code into HDL. There are weights used in digital filter which I want to precompute at the compile time.
The way I did this is
persistent c buf tout pfb_weights;
if isempty(c)
...
pfb_weights = coder.const(get_pfb_weights(settings_Nfft,settings_Ntaps));
end
The reason I think it is not working is that the coding report says:
  • It lists sin function under Toolbox Function Usage: Supported List. Sin function is only used in get_pfb_weights function
  • It lists coder/matlabcoder under Toolbox Function Usage: Unsupported List
  • If I attempt fixedpoint conversion it complains that function "double" inside get_pfb_weights is not suitable for fixed point conversion and wouldn't proceed.
How do we fix this?

採用された回答

David Fink
David Fink 2022 年 9 月 14 日
By making the call to get_pfb_weights opaque to code generation (so fixed-point conversion won't try to process it), you can call it extrinsically (in MATLAB), at compile-time, via coder.const and coder.extrinsic.
See the coder.extrinsic documentation for a coder.const example.

その他の回答 (1 件)

Kiran Kintali
Kiran Kintali 2022 年 9 月 25 日
You can find examples of HDL Coder friendly designs with coder.load and coder.const in the attachment.

カテゴリ

Help Center および File ExchangeFixed-Point Designer についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by