我被困在使用MATLAB的hdlcode生成hdl代码的过程中。
function a00 = pre_test(srcX,srcY)
for y = 1:255
for x = 1:255
a00 = (1/y) *x + srcX + srcY ;
end
end
end
运行以下代码时,出现以下错误消息。
HDL Code Generation Check Report for 'pre_test_fixpt'
Generated on 2018-08-09 21:12:56
HDL Conformance check complete with 2 errors, 0 warnings, and 0 messages.
Function Location Level Description
pre_test_fixpt:0 Error A cast between fixpt and floating point type is not supported, at Function 'eml_fi_checkforntype' (#15.947.965), line 26, column 25 Function 'fi_impl' (#9.10494.10558), line 274, column 15 Function 'fi_impl' (#9.2380.2450), line 79, column 15 Function 'pre_test_fixpt' (#1.684.711), line 15, column 22.
pre_test_fixpt:0 Error MATLAB HDL Coder failed in the code generation phase. See HDL Coder conformance report.
和pre_test_fixpt.m是下面的
function a00 = pre_test_fixpt(srcX,srcY)
fm = get_fimath();
for y = 1:255
for x = 1:255
a00 = fi(fi((1/y) *x, 0, 30, 22, fm) + srcX + srcY, 0, 30, 21, fm) ;
end
end
end
function fm = get_fimath()
fm = fimath('RoundingMethod', 'Floor',...
'OverflowAction', 'Wrap',...
'ProductMode','FullPrecision',...
'MaxProductWordLength', 128,...
'SumMode','FullPrecision',...
'MaxSumWordLength', 128);
end
我应该怎么做才能解决此问题?