setTflCOperationEntryParameters
Set specified parameters for operator entry in code replacement table
描述
例子
Set Parameters for Addition Operator Entry
此示例显示了如何使用setTflCOperationEntryParameters
function to set parameters for a code replacement operator entry foruint8
addition that matches a cast-after-sum algorithm.
op_entry=环球套票。TflCOperationEntry; op_entry.setTflCOperationEntryParameters(。。。'Key','rtw_op_add',。。。'EntryInfoAlgorithm','rtw_cast_after_op',。。。'优先', 90,。。。'SaturationMode','rtw_saturate_unspecified',。。。“圆形模式”, {'rtw_round_unspecified'},,。。。'ImplementationName','U8_ADD_U8_U8',。。。'ImplementationHeaderFile','u8_add_u8_u8.h',。。。“实施程序”,'u8_add_u8_u8.c');
定点分区操作员的设置参数
此示例显示了如何使用setTflCOperationEntryParameters
function to set parameters for a code replacement operator entry for fixed-pointINT16
division. The table entry specifies a net scaling between the operator inputs and output to map a range of slope and bias values to a replacement operation.
op_entry = rtw.tflcoperationEntrygenerator_netslope;op_entry.settflcoperationEntryParameters(。。。'Key','RTW_OP_DIV',。。。'优先', 90,。。。'SaturationMode','RTW_WRAP_ON_OVERFLOW',。。。“圆形模式”, {'RTW_ROUND_CEILING'},,。。。'NetSlopeAdjustmentFactor', 1.0,。。。“ netfixedepponent”,0.0,。。。'ImplementationName','s16_div_s16_s16',。。。'ImplementationHeaderFile','s16_div_s16_s16.h',。。。“实施程序”,'s16_div_s16_s16.c');
Set Parameters for Fixed-Point Addition Operator Entry
此示例显示了如何使用setTflCOperationEntryParameters
function to set parameters for a code replacement operator entry for fixed-pointUINT16
addition that matches a cast-after-sum algorithm. The parameters 'SlopesMustBeTheSame' and 'MustHaveZeroNetBias' must be set totrue
to specify equal slope and zero net bias across operator inputs and output. This maps relative slope and bias values (rather than a specific slope and bias combination) to a replacement operation.
op_entry= rtw.tflcoperationentrygergenerator;op_entry.settflcoperationEntryParameters(。。。'Key','rtw_op_add',。。。'EntryInfoAlgorithm','rtw_cast_after_op',。。。'优先', 90,。。。'SaturationMode','RTW_WRAP_ON_OVERFLOW',。。。“圆形模式”, {'rtw_round_unspecified'},,。。。'SlopesMustBeTheSame', 真的,。。。“ musthavezeronetbias”, 真的,。。。'ImplementationName','u16_add_sameslopezerobias',。。。'ImplementationHeaderFile','u16_add_sameslopezerobias.h',。。。“实施程序”,'u16_add_SameSlopeZeroBias.c');
Input Arguments
hEntry
—Handle to a code replacement table entry
handle
ThehEntry
is a handle to a code replacement table entry previously returned by one of the class instantiations in the table.
Class Instantiation | 金宝app |
---|---|
|
Supports operator replacement. |
|
为定点加法和减法提供参数 |
|
Provides net slope parameters for fixed-point multiplication and division that are not available in |
|
Supports replacement of nonscalar operators with MathWorks BLAS functions. |
|
金宝app支持用ANSI替换非施法运营商®/ISO®c Blas功能。 |
(在哪里 |
金宝app使用自定义代码替换表条目支持操作员替换。 |
如果要指定SlopesMustBeTheSame
ormusthavezeronetbias
对于您的操作员条目,请使用
rather thanhEntry
=环球套票。TflCOperationEntryGenerator
。If you want to usehEntry
=环球套票。TflCOperationEntryNetSlopeAdjustmentFactor
andNetFixedExponent
, instantiate your table entry by using
。hEntry
=环球套票。TflCOperationEntryGenerator_NetSlope
例子:op_entry
varargin
—Name-value pairs of arguments for operation entry
name-value pairs
例子:'Key','RTW_OP_ADD'
Name-Value Pair Arguments
Specify optional comma-separated pairs ofName,Value
参数。Name
is the argument name andValue
is the corresponding value.Name
must appear inside quotes. You can specify several name and value pair arguments in any order asNAME1,Value1,...,Namen,Valuen
。
'Key','RTW_OP_ADD'
'AcceptExprInput'
—Specifies whether implementation operation accepts expression inputs
true
|false
TheAcceptExprInput
value flags the code generator that the implementation function described by this entry accepts expression inputs. The default value istrue
ifsmand类型
equalsFCN_IMPL_FUNCT
andfalse
ifsmand类型
equalsFCN_IMPL_MACRO
。
If the value istrue
, expression inputs are integrated into the generated code in a form similar to this form:
rtY.Out1 = myAdd(rtU.In1, rtU.In2 * rtU.In3);
If the value isfalse
, a temporary variable is generated for the expression input:
real_T temp; temp = rtU.In2 * rtU.In3; rtY.Out1 = myAdd(rtU.In1, temp);
例子:'AcceptExprInput',true
'AdditionalHeaderFiles'
—Specifies additional header files for table entry
{}
(默认)|array of character vectors|string array
TheAdditionalHeaderFiles
value specifies additional header files for a code replacement table entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是将MATLAB中定义为字符向量或字符串标量的变量®workspace or as a MATLAB function in the search path that returns a character vector.
例子:'AdditionalHeaderFiles',{}
'AdditionalIncludePaths'
—Specifies additional include paths for table entry
{}
(默认)|array of character vectors|string array
TheAdditionalIncludePaths
value specifies the full path of additional include paths for a code replacement entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'AdditionalIncludePaths',{}
'AdditionalLinkObjs'
—指定表条目的其他链接对象
{}
(默认)|array of character vectors|string array
TheAdditionalLinkObjs
value specifies additional link objects for a code replacement table entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'AddaflAllInkObjs',{}
'AdditionalLinkObjsPaths'
—Specifies additional link object paths for table entry
{}
(默认)|array of character vectors|string array
TheAdditionalLinkObjsPaths
value specifies the full path of additional link object paths for a code replacement entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'AdditionalLinkObjsPaths',{}
“ Adusalsourcefiles”
—为表条目指定其他源文件
{}
(默认)|array of character vectors|string array
TheAdditionalSourceFiles
value specifies additional source files for a code replacement table entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:“ AffealSourceFiles”,{}
“ AdusalSourcePath”
—Specifies additional source paths for table entry
{}
(默认)|array of character vectors|string array
TheAdusalsSourcePath
value specifies the full path of additional source paths for a code replacement entry. The character vectors or string array can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:“ AdusalSourcePath”,{}
'AdditionalCompileFlags'
—为表条目指定其他编译器标志
{}
(默认)|array of character vectors|string array
TheAdditionalCompileFlags
value specifies additional flags required to compile the source files defined for a code replacement table entry.
例子:'AdditionalCompileFlags',{}
“添加allinkflags”
—Specifies additional linker flags for table entry
{}
(默认)|array of character vectors|string array
TheAdditionalLinkFlags
value specifies additional flags required to link the compiled files for a code replacement table entry.
例子:“添加allinkflags”,{}
'AllowShapeAgnosticMatch'
—根据元素总数而不是特定的矩阵形状启用矩阵匹配
false
(默认)|true
The允许ShapeGnosticMatch
value enables code replacement match based on total number of elements rather than specific matrix shape for matrices that are contiguously allocated in memory. For more information, seeAllow Shape Agnostic Match。
例子:“允许ShapeGnosticMatch”,false
'arraylayout'
—Specifies layout of array storage for table entry
'COLUMN_MAJOR'
(默认)|'ROW_MAJOR'
|'COLUMN_AND_ROW'
Thearraylayout
value specifies the order of array elements in memory supported by the replacement implementation. By default, the replacement implementation supports column-major data layout. ForROW-MAJOR
, the replacement implementation supports row-major data layout. ForCOLUMN_AND_ROW
,替换实现支持列 - 塔和行数据布局。金宝app
例子:'arraylayout','ROW_MAJOR'
'EntryInfoAlgorithm'
—指定数学算法以匹配表条目
'rtw_cast_before_op'
(默认)|'rtw_cast_after_op'
TheEntryInfoAlgorithm
值指定了指定的数学函数的算法,必须匹配操作员替换的算法。代码更换库支持基于数学操作算法的替换金宝appRTW_OP_ADD
andRTW_OP_MINUS
。Valid arguments for the supported operations are listed in the table. The arguments have the same meaning for both operations.
争论 | 意义 |
---|---|
|
Before performing the operation, type cast input values to the output data type. If the output type cannot exactly represent the input values, losses can occur as a result of the cast to the output type. Additional loss can occur when the result of the operation is cast to the final output type. |
|
Compute the ideal result of the operation of inputs. Then, type cast the result to the output data type. Loss occurs during the type cast. This algorithm behaves similarly to the C language except when the signedness of the operands does not match. For example, when you add a signed long operation to an unsigned long operand, standard C language rules convert the signed long operand to an unsigned long operand. The result is a value that is not ideal. |
例子:'entryinfoalgorithm','rtw_cast_after_op'
'gencallback'
—Specifies callback that follows code generation
''
(默认)|'RTW.copyFileToBuildDir'
TheGenCallback
specifies a callback that follows code generation. If you specify'RTW.copyFileToBuildDir'
, and if this operation entry is matched and used, the code generator calls functionRTW.copyFileToBuildDir
after code generation. This callback function copies additional header, source, or object files that you have specified for this entry to the build folder.
例子:'gencallback','RTW.copyFileToBuildDir'
'ImplementationHeaderFile'
—Specifies name of header file that declares implementation operation
''
(默认)|角色向量|string scalar
The实施Headerfile
value specifies the name of the header file that declares the implementation function. The character vector or string scalar can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:“实现headerfile”,'s32_mul.h'
'ImplementationHeaderPath'
—Specifies path to implementation header file
''
(默认)|角色向量|string scalar
TheImplementationHeaderPath
value specifies the full path to the implementation header file. The character vector or string scalar can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'ImplementationHeaderPath', fullfile('$MATLAB_ROOT', 'crl')
'ImplementationName'
—指定实现功能的名称
''
(默认)|角色向量|string scalar
TheImplementationName
value specifies the name of the implementation function, which can match or differ from theKey
name.
例子:'ImplementationName','s32_mul_s32_s32_sat'
“实施程序”
—指定实现源文件的名称
''
(默认)|角色向量|string scalar
TheImplementationSourceFile
value specifies the name of the implementation source file. The character vector or string scalar can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'enasemationsourcefile','s32_mul.c'
'ImplementationSourcePath'
—Specifies path to implementation source file
''
(默认)|角色向量|string scalar
TheImplementationSourcePath
value specifies the full path to the implementation source file. The character vector or string scalar can include tokens. For example, in the token$ mytoken $
,mytoken
是MATLAB工作区中的字符向量或字符串标量定义的变量,或在返回字符向量的搜索路径中的MATLAB函数。
例子:'ImplementationSourcePath', fullfile('$MATLAB_ROOT', 'crl')
'
—Specifies whether the table entry is for an implementation function or macro
'FCN_IMPL_FUNCT'
(默认)|'FCN_IMPL_MACRO'
Thesmand类型
value specifies the type of table entry. UseFCN_IMPL_FUNCT
用于功能或FCN_IMPL_MACRO
for macro.
例子:','FCN_IMPL_FUNCT'
'Key'
—Specifies key for operator to replace
角色向量|string scalar
TheKey
value specifies the key for the operator to replace. The key must match an operator key listed inCode You Can Replace from MATLAB CodeorCode You Can Replace From Simulink Models。
例子:'Key','RTW_OP_ADD'
“ musthavezeronetbias”
—Specifies net bias requirement for conceptual arguments of Add/Minus entries
false
(默认)|true
Themusthavezeronetbias
值指定是否替换匹配要求es that the net bias for conceptual arguments of Add/Minus entries is zero. For the Add/Minus of fixed-point operator inputs and output this parameter must be set totrue
。通过使用
rather thanhEntry
=环球套票。TflCOperationEntryGenerator
。hEntry
=环球套票。TflCOperationEntry
用于mul/div/muldiv/shift/cast条目:
代码生成器忽略了此参数的值。
MUL/DIV/MULDIV/SHIFT/CAST条目的概念参数的偏差必须为零,以进行替换匹配。
例子:“ musthavezeronetbias”,true
“ netfixedepponent”
—Specifies fixed exponent part of net slope for fixed-point conceptual arguments of Mul/Div/MulDiv/Shift/Cast entries
0
(默认)|数字标量
TheNetSlopeAdjustmentFactor
value specifies the fixed exponent (E) part of the net slope (F2E, for example, -3.0) for fixed-point conceptual arguments required for a replacement match to occur for Mul/Div/MulDiv/Shift/Cast entries. Instantiate an entry by using
rather thanhEntry
=环球套票。TflCOperationEntryGenerator_NetSlope
。hEntry
=环球套票。TflCOperationEntry
用于添加/减去条目:
代码生成器忽略了此参数的值。
The slope adjustment factor part of the net slope of the conceptual arguments for Add/Minus entries must be zero for a replacement match to occur.
例子:“ netfixedepponent”, -3.0
'NetSlopeAdjustmentFactor'
—Specifies slope adjustment part of net slope requirement for fixed-point conceptual arguments of Mul/Div/MulDiv/Shift/Cast entries
1
(默认)|数字标量
TheNetSlopeAdjustmentFactor
value specifies the slope adjustment part of the net slope (F2E, for example, 1.0) for fixed-point conceptual arguments required for a replacement match to occur for Mul/Div/MulDiv/Shift/Cast entries. Instantiate an entry by using
rather thanhEntry
=环球套票。TflCOperationEntryGenerator_NetSlope
。hEntry
=环球套票。TflCOperationEntry
用于添加/减去条目:
代码生成器忽略了此参数的值。
The slope adjustment factor part of the net slope of the conceptual arguments for Add/Minus entries must be zero for a replacement match to occur.
例子:“ NetSlopeadJustmentFactor”,1.5
'优先'
—指定操作员条目的搜索优先级
100
(默认)|integer value 0..100
The优先
value specifies the search priority of the operation entry, relative to other entries of the same operation name and conceptual argument list within this table. Highest priority is 0, and lowest priority is 100. If the table provides two implementations for an operation, the implementation with the higher priority shadows the one with the lower priority.
例子:'优先',100
“圆形模式”
—Specifies rounding modes supported by implementation function
'rtw_round_unspecified'
(默认)|'RTW_ROUND_FLOOR'
|'RTW_ROUND_CEILING'
|'rtw_round_zero'
|'RTW_ROUND_NEAREST'
|'RTW_ROUND_NEAREST_ML'
|'rtw_round_conv'
|'RTW_ROUND_SIMPLEST'
|array of character vectors|string array
TheRoundingModes
值指定实现功能支持的一个或多个圆形模式。金宝app
例子:'roundingmodes',{'rtw_round_unspecified'}
'SaturationMode'
—指定由实现功能支持的饱和模式金宝app
'rtw_saturate_unspecified'
(默认)|'RTW_SATURATE_ON_OVERFLOW'
|'RTW_WRAP_ON_OVERFLOW'
|角色向量|string scalar
The饱和模式
value specifies the saturation mode supported by the implementation function.
例子:'饱和模式','rtw_saturate_unspecified'
'副作用'
—指定是否尝试优化实现功能
false
(默认)|true
The副作用
value flags the code generator not to optimize away the implementation function described by this entry. This parameter applies to implementation functions that returnvoid
but are not to be optimized away, such as amemcpy
implementation or an implementation function that accesses global memory values. For those implementation functions only, you must include this parameter and specify the valuetrue
。
例子:'副作用',false
'SlopesMustBeTheSame'
—Specifies slope requirement for conceptual arguments of Mul/Div/MulDiv/Shift/Cast entries
false
(默认)|true
TheSlopesMustBeTheSame
值指定是否替换匹配要求es that the slope is the same for conceptual arguments of Mul/Div/MulDiv/Shift/Cast entries. Instantiate the entry by using
rather thanhEntry
=环球套票。TflCOperationEntryGenerator
。hEntry
=环球套票。TflCOperationEntry
用于添加/减去条目:
代码生成器忽略了此参数的值。
此参数必须设置为
true
。When set totrue
, the slopes of the conceptual arguments are equal for a replacement match to occur.
例子:'SlopesMustBeTheSame',true
'StoreFcnReturnInLocalVar'
—Specifies whether to store the implementation function regardless expression folding settings
false
(默认)|true
TheStoreFcnReturnInLocalVar
value flags the code generator that the return value of the implementation function described by this entry must be stored in a local variable regardless of other expression folding settings. If the value isfalse
, other expression folding settings determine whether the return value is folded. Storing function returns in a local variable can increase the clarity of generated code. This example shows code generated with expression folding:
void sw_step(void){if(ssub(sadd(sw_u.in1,sw_u.in2),sw_u.in3),sw_u.in3)<= smul(ssub(sw_u.in4,sw_u.in5),sw_u.in6,sw_u.in6)){sw_y.out1 = sw_y.out1 =sw_u.in7;} else {sw_y.out1 = sw_u.in8;}}}
WithStoreFcnReturnInLocalVar
set totrue
, the generated code is potentially easier to understand and debug:
void sw_step(void){real32_t rtb_switch;real32_t hoistedexpr;...... rtb_switch = sadd(sw_u.in1,sw_u.in2);rtb_switch = ssub(rtb_switch,sw_u.in3);HOISTEDEXPR = ssub(sw_u.in4,sw_u.in5);HOISTEDEXPR = SMUL(HOISTEDEXPR,SW_U.IN6);if(rtb_switch <= hoistedexpr){sw_y.out1 = sw_u.in7;} else {sw_y.out1 = sw_u.in8;}}}
例子:'StoreFcnReturnInLocalVar',false
See Also
addAdditionalHeaderFile
|addAdditionalIncludePath
|Addadditionallinkobj
|AddadditionallinkobjPath
|addAdditionalSourceFile
|addAdditionalSourcepath
matlab命令
You clicked a link that corresponds to this MATLAB command:
通过在MATLAB命令窗口中输入该命令。Web浏览器不支持MATLAB命令。金宝app
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- AméricaLatina(Español)
- Canada(英语)
- United States(英语)
Europe
- 比利时(英语)
- 丹麦(英语)
- Deutschland(Deutsch)
- España(Español)
- Finland(英语)
- France(Français)
- Ireland(英语)
- Italia(Italiano)
- Luxembourg(英语)
- Netherlands(英语)
- Norway(英语)
- Österreich(Deutsch)
- Portugal(英语)
- Sweden(英语)
- Switzerland
- 英国(英语)