Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Functions Supported for Code Acceleration or C Code Generation

In addition to function-specific limitations listed in the table, the following general limitations apply to the use of Fixed-Point Designer™ functions in generated code or with fiaccel:

  • fipref and quantizer objects are not supported.

  • Word lengths greater than 128 bits are not supported.

  • You cannot change the fimath or numerictype of a given fi variable after that variable has been created.

  • The boolean value of the DataTypeMode and DataType properties are not supported.

  • For all SumMode property settings other than FullPrecision, the CastBeforeSum property must be set to true.

  • You can use parallel for (parfor) loops in code compiled with fiaccel, but those loops are treated like regular for loops.

  • When you compile code containing fi objects with nontrivial slope and bias scaling, you may see different results in generated code than you achieve by running the same code in MATLAB®.

  • The general limitations of C/C++ code generated from MATLAB apply. For more information, see MATLAB Language Features Supported for C/C++ Code Generation.

FunctionRemarks/Limitations

abs

N/A

accumneg

N/A

accumpos

N/A

add

  • Code generation in MATLAB does not support the syntax F.add(a,b). You must use the syntax add(F,a,b).

all

N/A

any

N/A

atan2

N/A

bitand

Not supported for slope-bias scaled fi objects.

bitandreduce

N/A

bitcmp

N/A

bitconcat

N/A

bitget

N/A

bitor

Not supported for slope-bias scaled fi objects.

bitorreduce

N/A

bitreplicate

N/A

bitrol

N/A

bitror

N/A

bitset

N/A

bitshift

N/A

bitsliceget

N/A

bitsll

Generated code may not handle out of range shifting.

bitsra

Generated code may not handle out of range shifting.

bitsrl

Generated code may not handle out of range shifting.

bitxor

Not supported for slope-bias scaled fi objects.

bitxorreduce

N/A

ceil

N/A

complex

N/A

conj

N/A

conv

  • Variable-sized inputs are only supported when the SumMode property of the governing fimath is set to Specify precision or Keep LSB.

  • For variable-sized signals, you may see different results between generated code and MATLAB.

    • In the generated code, the output for variable-sized signals is computed using the SumMode property of the governing fimath.

    • In MATLAB, the output for variable-sized signals is computed using the SumMode property of the governing fimath when both inputs are nonscalar. However, if either input is a scalar, MATLAB computes the output using the ProductMode of the governing fimath.

convergent

N/A

cordicabs

Variable-size signals are not supported.

cordicangle

Variable-size signals are not supported.

cordicatan2

Variable-size signals are not supported.

cordiccart2pol

Variable-size signals are not supported.

cordiccexp

Variable-size signals are not supported.

cordiccos

Variable-size signals are not supported.

cordicpol2cart

Variable-size signals are not supported.

cordicrotate

Variable-size signals are not supported.

cordicsin

Variable-size signals are not supported.

cordicsincos

Variable-size signals are not supported.

cos

N/A

ctranspose

N/A

diag

If supplied, the index, k, must be a real and scalar integer value that is not a fi object.

divide

  • Any non-fi input must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.

  • Complex and imaginary divisors are not supported.

  • Code generation in MATLAB does not support the syntax T.divide(a,b).

double

N/A

end

N/A

eps

  • Supported for scalar fixed-point signals only.

  • Supported for scalar, vector, and matrix, fi single and fi double signals.

eq

Not supported for fixed-point signals with different biases.

fi

  • The default constructor syntax without any input arguments is not supported.

  • If the numerictype is not fully specified, the input to fi must be a constant, a fi, a single, or a built-in integer value. If the input is a built-in double value, it must be a constant. This limitation allows fi to autoscale its fraction length based on the known data type of the input.

  • All properties related to data type must be constant for code generation.

  • numerictype object information must be available for nonfixed-point Simulink® inputs.

filter

  • Variable-sized inputs are only supported when the SumMode property of the governing fimath is set to Specify precision or Keep LSB.

fimath

  • Fixed-point signals coming in to a MATLAB Function block from Simulink are assigned a fimath object. You define this object in the MATLAB Function block dialog in the Model Explorer.

  • Use to create fimath objects in the generated code.

  • If the ProductMode property of the fimath object is set to anything other than FullPrecision, the ProductWordLength and ProductFractionLength properties must be constant.

  • If the SumMode property of the fimath object is set to anything other than FullPrecision, the SumWordLength and SumFractionLength properties must be constant.

fix

N/A

fixed.Quantizer

N/A

floor

N/A

ge

Not supported for fixed-point signals with different biases.

get

The syntax structure = get(o) is not supported.

getlsb

N/A

getmsb

N/A

gt

Not supported for fixed-point signals with different biases.

hdlram

N/A

horzcat

N/A

imag

N/A

int8int16int32,  int64

N/A

iscolumn

N/A

isempty

N/A

isequal

N/A

isfi

N/A

isfimath

N/A

isfimathlocal

N/A

isfinite

N/A

isinf

N/A

isnan

N/A

isnumeric

N/A

isnumerictype

N/A

isreal

N/A

isrow

N/A

isscalar

N/A

issigned

N/A

isvector

N/A

le

Not supported for fixed-point signals with different biases.

length

N/A

logical

N/A

lowerbound

N/A

lsb

  • Supported for scalar fixed-point signals only.

  • Supported for scalar, vector, and matrix, fi single and double signals.

lt

Not supported for fixed-point signals with different biases.

max

N/A

mean

N/A

median

N/A

min

N/A

minus

Any non-fi input must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.

mpower

  • When the exponent k is a variable and the input is a scalar, the ProductMode property of the governing fimath must be SpecifyPrecision.

  • When the exponent k is a variable and the input is not scalar, the SumMode property of the governing fimath must be SpecifyPrecision.

  • Variable-sized inputs are only supported when the SumMode property of the governing fimath is set to SpecifyPrecision or Keep LSB.

  • For variable-sized signals, you may see different results between the generated code and MATLAB.

    • In the generated code, the output for variable-sized signals is computed using the SumMode property of the governing fimath.

    • In MATLAB, the output for variable-sized signals is computed using the SumMode property of the governing fimath when the first input, a, is nonscalar. However, when a is a scalar, MATLAB computes the output using the ProductMode of the governing fimath.

mpy

  • Code generation in MATLAB does not support the syntax F.mpy(a,b). You must use the syntax mpy(F,a,b).

  • When you provide complex inputs to the mpy function inside of a MATLAB Function block, you must declare the input as complex before running the simulation. To do so, go to the Ports and data manager and set the Complexity parameter for all known complex inputs to On.

mrdivide

N/A

mtimes

  • Any non-fi input must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.

  • Variable-sized inputs are only supported when the SumMode property of the governing fimath is set to SpecifyPrecision or KeepLSB.

  • For variable-sized signals, you may see different results between the generated code and MATLAB.

    • In the generated code, the output for variable-sized signals is computed using the SumMode property of the governing fimath.

    • In MATLAB, the output for variable-sized signals is computed using the SumMode property of the governing fimath when both inputs are nonscalar. However, if either input is a scalar, MATLAB computes the output using the ProductMode of the governing fimath.

ndims

N/A

ne

Not supported for fixed-point signals with different biases.

nearest

N/A

numberofelements

numberofelements will be removed in a future release. Use numel instead.

numel

N/A

numerictype

  • Fixed-point signals coming in to a MATLAB Function block from Simulink are assigned a numerictype object that is populated with the signal's data type and scaling information.

  • Returns the data type when the input is a nonfixed-point signal.

  • Use to create numerictype objects in generated code.

  • All numerictype object properties related to the data type must be constant.

permute

N/A

plus

Any non-fi inputs must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.

pow2

N/A

power

When the exponent k is a variable, the ProductMode property of the governing fimath must be SpecifyPrecision.

qr

N/A

quantize

N/A

range

N/A

rdivide

N/A

real

N/A

realmax

N/A

realmin

N/A

reinterpretcast

N/A

removefimath

N/A

repmat

N/A

rescale

N/A

reshape

N/A

round

N/A

setfimath

N/A

sfi

  • All properties related to data type must be constant for code generation.

sign

N/A

sin

N/A

single

N/A

size

N/A

sort

N/A

sqrt

  • Complex and [Slope Bias] inputs error out.

  • Negative inputs yield a 0 result.

storedInteger

N/A

storedIntegerToDouble

N/A

sub

  • Code generation in MATLAB does not support the syntax F.sub(a,b). You must use the syntax sub(F,a,b).

subsasgn

N/A

subsref

N/A

sum

Variable-sized inputs are only supported when the SumMode property of the governing fimath is set to Specify precision or Keep LSB.

times

  • Any non-fi input must be constant; that is, its value must be known at compile time so that it can be cast to a fi object.

  • When you provide complex inputs to the times function inside of a MATLAB Function block, you must declare the input as complex before running the simulation. To do so, go to the Ports and data manager and set the Complexity parameter for all known complex inputs to On.

transpose

N/A

tril

If supplied, the index, k, must be a real and scalar integer value that is not a fi object.

triu

If supplied, the index, k, must be a real and scalar integer value that is not a fi object.

ufi

  • All properties related to data type must be constant for code generation.

uint8uint16uint32,  uint64

N/A

uminus

N/A

uplus

N/A

upperbound

N/A

vertcat

N/A

Was this topic helpful?