필터 지우기
필터 지우기

Why do i get an error in the Fixed Point Conversion Step?

조회 수: 7 (최근 30일)
Pablo Medina
Pablo Medina 2016년 7월 13일
댓글: Pablo Medina 2016년 7월 14일
Error: The function 'HDLIFFT128' contains persistent variables 'ifft128' and has specialization 'HDLIFFT128_s1' associated with it. Function specializations containing persistent variables are not supported for fixed-point conversion. Consider rewriting your algorithm such that it does not use persistent variables within functions that require specialization.
I am trying to generate HDL Code from this main function.
function [out1,out2] = main(x,y,z)
%call subfunction 1
out1 = sub1(x);
%call subfunction 2
out2 = sub2(y,z);
end
Sub-function 2 code:
function [yOut,validOut] = HDLIFFT128(yIn,validIn)
%HDLIFFT128
% Processes one sample of data using the dsp.HDLIFFT System object(TM)
% yIn is a fixed-point scalar or column vector.
% validIn is a logical scalar.
% You can generate HDL code from this function.
persistent ifft128;
if isempty(ifft128)
ifft128 = dsp.HDLIFFT('FFTLength',128);
end
[yOut,validOut] = step(ifft128,yIn,validIn);
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 7월 13일
I would suggest breaking it up into two pieces, one of which constructs the ifft128 object, and the other of which expects that object to be always input.
  댓글 수: 3
Walter Roberson
Walter Roberson 2016년 7월 13일
function ifft128 = init_HDLIFFT128
ifft128 = dsp.HDLIFFT('FFTLength',128);
function [yOut,validOut] = HDLIFFT128(yIn, validIn, ifft128)
[yOut,validOut] = step(ifft128,yIn,validIn);
The init function would be outside of any loop, and you would route its output to be an input of HDLIFFT128 that might be in a loop.
Pablo Medina
Pablo Medina 2016년 7월 14일
Thanks that solved the fixed point generation error.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bharath Venkataraman
Bharath Venkataraman 2016년 7월 13일
Pablo, splitting the function into a main function and calling the IFFT function from it resulted in HDL code generation. Here are the functions split up. Please replace the testbench and design files as needed.

카테고리

Help CenterFile Exchange에서 Code Generation Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by