フィルターのクリア

Function is not defined for values of class embedded.fi when using HDL coder

42 ビュー (過去 30 日間)
Sam
Sam 2013 年 4 月 2 日
回答済み: Bharath Venkataraman 2024 年 1 月 5 日
Hi,
When I am experimenting in converting matlab code into vhdl with hdl coder, I am getting the error such as Function 'log' is not defined for values of class 'embedded.fi' or Function 'exp' is not defined for values of class 'embedded.fi'.
The specific block of code comes from the block:
f_0 = fi( 0, 0, 1, 0, fm ); % 133.33333;
f_sp = fi( 200*fi( 1/3, 0, 14, 15 ), 0, 14, 7, fm ); % 66.66667;
brkfrq = fi( 1000, 0, 11, 0, fm );
brkpt = fi( fi_div( (brkfrq - f_0), f_sp ), 0, 14, 10, fm );
logstep = fi( 1.0711703, 0, 14, 13, fm );
linpts = (f<brkfrq);
z = fi( fi( 0, 0, 1, 0 )*f, 0, 6, 0, fm );
z( linpts ) = fi( fi_div( (f( linpts ) - f_0), f_sp ), 0, 6, 0, fm );
% error with line below.
z( ~(linpts~=0) ) = fi( brkpt + (log( fi_div( f( ~(linpts~=0) ), brkfrq ) )) ./ log( logstep ), 0, 6, 0, fm );
The original matlab code is from audspec.m of rastamat. I have tried converting fixed point to double before calling log(), but then another error pops up.
Thanks,

採用された回答

Tim McBrayer
Tim McBrayer 2013 年 4 月 2 日
As the error message states, there is no fixed-point version of the 'log' or 'exp' commands in MATLAB HDL Coder. The complete list of functions that have fixed point versions and are supported for HDL code generation is at http://www.mathworks.com/help/hdlcoder/ug/fixed-point-run-time-library-support.html.
  2 件のコメント
Sam
Sam 2013 年 4 月 2 日
Thanks for point this out. I think I was looking for that page, but couldn't find it.
Shubham Kapoor
Shubham Kapoor 2015 年 4 月 21 日
Is there any workaround around using expn function?

サインインしてコメントする。

その他の回答 (2 件)

Dhananjay Kumar
Dhananjay Kumar 2020 年 9 月 17 日
Here is the link to check function supported for code generation using fixed point arithmetic

Bharath Venkataraman
Bharath Venkataraman 2024 年 1 月 5 日
HDL Coder allows you to replace an unsupported function with an equivalent Lookup table. Here is an example on how to do that for exp.

カテゴリ

Help Center および File ExchangeHDL Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by