Supported MATLAB Data Types, Operators, and Control Flow Statements
When you generate HDL and HLS code from your MATLAB^{®} algorithm, use the data types, operators, and control flow statements that HDL Coder™ supports.
Supported Data Types
HDL Coder does not support cell arrays and Inf
data types.
This table shows the supported subset of MATLAB data types.
Types  Supported Data Types  Restrictions 

Integer 
 In Simulink^{®}, MATLAB Function block ports must use
numeric types sfix64 or ufix64
for 64bit data. 
Real 
 HDL code generated with

Character  char  – 
Logical 
 – 
Fixed point 
 Fixedpoint numbers with slope (not equal to 1.0) and bias (not equal to 0.0) are not supported. Maximum word size for fixedpoint numbers is 128 bits. 
Vectors 
 The maximum number of vector elements allowed is 2^32. Before a variable is subscripted, it must be fully defined. 
Matrices 
 Matrices are supported in the body of the design algorithm and as inputs to the toplevel design function. Matrices are not supported with the following HDL workflows:

Structures  struct  Arrays of structures are not supported. For the IP Core Generation workflow, structures are supported in the body of the design algorithm, but are not supported as inputs to the toplevel design function. Structures are not supported as inputs and outputs at the toplevel DUT ports for HLS code generation. 
Enumerations  enumeration  If your target language is Verilog^{®}, all enumeration member names must be unique within the design. Enumerations at the toplevel DUT ports are not supported with the following workflows or verification methods:
Enumerations are not supported as inputs and outputs at the toplevel DUT ports for HLS code generation. 
Global variables are not supported for HDL and HLS code generation.
Supported Operators
Note
HDL and HLS code generated for large vector and matrix inputs to arithmetic operations can result in inefficient code. The code for these operators is not automatically pipelined.
Arithmetic Operators
Operation  Operator Syntax  Equivalent Function  Restrictions 

Binary addition  A+B  plus(A,B)  Neither A nor B can be data
type logical . 
Matrix multiplication  A*B  mtimes(A,B)  HDL code generated for matrix arithmetic operations is not pipelined, and can result in inefficient code. 
Arraywise multiplication  A.*B  times(A,B)
 Neither A nor B can be data
type logical . 
Matrix power  A^B
 mpower(A,B) 
HDL code generated for matrix arithmetic operations is not pipelined, and can result in inefficient code. 
Arraywise power  A.^B  power(A,B)  A and B must be scalar, and
B must be an integer. 
Complex transpose  A'
 ctranspose(A)  – 
Matrix transpose  A.'
 transpose(A)  
Matrix concat  [A B]  None  – 
Matrix index  A(r c)  None  Before you use a variable, you must fully define it. 
Logical Operators
Operation  Operator Syntax  M Function Equivalent  Notes 

Logical And  A&B  and(A,B)  – 
Logical Or  AB  or(A,B)  – 
Logical Xor  A xor B  xor(A,B)  – 
Logical And (short circuiting)  A&&B  N/A  Use short circuiting logical operators within conditionals. 
Logical Or (short circuiting)  AB  N/A  Use short circuiting logical operators within conditionals. 
Element complement  ~A  not(A)  – 
Relational Operators
Relation  Operator Syntax  Equivalent Function 

Less than  A<B  lt(A,B) 
Less than or equal to  A<=B  le(A,B) 
Greater than or equal to  A>=B  ge(A,B) 
Greater than  A>B  gt(A,B) 
Equal  A==B  eq(A,B) 
Not equal  A~=B  ne(A,B) 
Control Flow Statements
HDL Coder supports the following control flow statements and constructs with restrictions.
Control Flow Statement  Restrictions 

 Do not use Do not use the
HDL Coder does not support nonscalar expressions in the
conditions of 
if  Do not use the HDL Coder does not support nonscalar expressions in the
conditions of 
switch  The conditional expression in a
If multiple 
The following control flow statements are not supported:
while
break
continue
return
parfor
Avoid using the following vector functions, as they may generate loops containing
break
statements:
isequal
bitrevorder