# HDL Coder giving Conformance error due to fi division

2 views (last 30 days)
Varuna De Silva on 25 Jun 2014
Answered: Kiran Kintali on 22 Jun 2021
Hi,
I am trying to convert a matlab code to HDL using the HDL coder.
In my matlab file the following lines
NP_b = bitand(bitshift(uint16(16384), -6), 3);
full_bits = 2;
np_b=1/full_bits^(NP_b+1);
are converted to fixed point equivalent of
fm = fimath('RoundingMethod', 'Nearest', 'OverflowAction', 'Wrap', 'ProductMode', 'SpecifyPrecision', 'SumMode', 'FullPrecision', 'ProductWordLength', 32, 'ProductFractionLength', 30);
np_b = fi(fi_div(fi(1, 0, 1, 0, fm), full_bits^(NP_b + 1)), 0, 1, 0, fm);
function c = fi_div(a,b)
coder.inline( 'always' );
if isfi( a ) && isfi( b )
a1 = fi( a, 'RoundMode', 'fix' );
b1 = fi( b, 'RoundMode', 'fix' );
c1 = divide( divideType( a1, b1 ), a1, b1 );
c = fi( c1, numerictype( c1 ), fimath( a ) );
else
c = a/b;
end
end
At the HDL code generation step there is an error that is thrown, which says "Found an unsupported unbounded loop structure. This loop may be user written or automatically generated due to the use of specific vector expressions or functions."
Could any of you kindly help me with this error please?
##### 2 CommentsShowHide 1 older comment
Walter Roberson on 1 Mar 2016
That seems a rather round-about way of writing
np_b = 1/2;
??

Kiran Kintali on 22 Jun 2021
Without dut.m and testbench.m files and a MATLAB HDL Coder project it woudl be difficult to do further analysis.
running the following code through fixed-point conversion does not product any error

### Community Treasure Hunt

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

Start Hunting!

Translated by