setTflCOperationEntryParameters - Set specified parameters for operator entry in TFL table

Syntax

void setTflCOperationEntryParameters(hEntry, varargin)

Arguments

hEntry

Handle to a TFL table entry previously returned by hEntry = RTW.TflCOperationEntry.

varargin

Parameter/value pairs for the operator entry. See varargin Parameters.

varargin Parameters

The following operator entry parameters can be specified to the setTflCOperationEntryParameters function using parameter/value argument pairs. For example,

setTflCOperationEntryParameters(..., 'Key', 'RTW_OP_ADD', ...);
Key

String specifying the operator to be replaced, among the operators supported for replacement:

The default is 'RTW_OP_ADD'.

GenCallback

String specifying '' or 'RTW.copyFileToBuildDir'. The default is ''. If you specify 'RTW.copyFileToBuildDir', and if this operator entry is matched and used, the function RTW.copyFileToBuildDir will be called after code generation to copy additional header, source, or object files that you have specified for this operator entry to the build directory. For more information, see Specifying Build Information for Function Replacements in the Real-Time Workshop Embedded Coder documentation.

Priority

Positive integer specifying the operator entry's search priority, 0-100, relative to other entries of the same operator name and conceptual argument list within this table. Highest priority is 0, and lowest priority is 100. The default is 100. If the table provides two implementations for an operator, the implementation with the higher priority will shadow the one with the lower priority.

RoundingMode

String specifying the rounding mode supported by the implementation function: 'RTW_ROUND_FLOOR', 'RTW_ROUND_CEILING', 'RTW_ROUND_ZERO', 'RTW_ROUND_NEAREST', 'RTW_ROUND_NEAREST_ML', 'RTW_ROUND_SIMPLEST', 'RTW_ROUND_CONV', or 'RTW_ROUND_UNSPECIFIED'. The default is 'RTW_ROUND_UNSPECIFIED'.

SaturationMode

String specifying the saturation mode supported by the implementation function: 'RTW_SATURATE_ON_OVERFLOW', 'RTW_WRAP_ON_OVERFLOW', or 'RTW_SATURATE_UNSPECIFIED'. The default is 'RTW_SATURATE_UNSPECIFIED'.

SlopesMustBeTheSame

Boolean flag that, when set to true, indicates that TFL replacement request processing must check that the slopes on all arguments (input and output) are equal. The default is false.

This parameter and MustHaveZeroNetBias can be used for fixed-point addition and subtraction replacement. Set both parameters to true to disregard specific slope and bias values and map relative slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator rather than hEntry = RTW.TflCOperationEntry.

MustHaveZeroNetBias

Boolean flag that, when set to true, indicates that TFL replacement request processing must check that the net bias on all arguments is zero. The default is false.

This parameter and SlopesMustBeTheSame can be used for fixed-point addition and subtraction replacement. Set both parameters to true to disregard specific slope and bias values and map relative slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator rather than hEntry = RTW.TflCOperationEntry.

RelativeScalingFactorF

Floating-point value specifying the slope adjustment factor (F) part of the relative scaling factor, F2E, for relative scaling TFL entries. The default is 1.0.

This parameter and RelativeScalingFactorE can be used for fixed-point multiplication and division replacement. Specify both parameters to map a range of slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator rather than hEntry = RTW.TflCOperationEntry.

RelativeScalingFactorE

Floating-point value specifying the fixed exponent (E) part of the relative scaling factor, F2E, for relative scaling TFL entries. For example, -3.0. The default is 0.

This parameter and RelativeScalingFactorF can be used for fixed-point multiplication and division replacement. Specify both parameters to map a range of slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator rather than hEntry = RTW.TflCOperationEntry.

isRSF

Boolean value specifying that the operator entry is a relative scaling factor (RSF) entry. Specify true if the values of RelativeScalingFactorF and RelativeScalingFactorE equal their defaults, 1.0 and 0, but the entry nonetheless should be interpreted by the code generation process as an RSF entry.

NetSlopeAdjustmentFactor

Floating-point value specifying the slope adjustment factor (F) part of the net slope, F2E, for net slope TFL entries. The default is 1.0.

This parameter and NetSlopeFixedExponent can be used for fixed-point multiplication and division replacement. Specify both parameters to map a range of slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator_NetSlope rather than hEntry = RTW.TflCOperationEntry.

NetSlopeFixedExponent

Floating-point value specifying the fixed exponent (E) part of the net slope, F2E, for net slope TFL entries. For example, -3.0. The default is 0.

This parameter and NetSlopeAdjustmentFactor can be used for fixed-point multiplication and division replacement. Specify both parameters to map a range of slope and bias values to a replacement function.

To use this parameter, you must instantiate your table entry using hEntry = RTW.TflCOperationEntryGenerator_NetSlope rather than hEntry = RTW.TflCOperationEntry.

ImplementationName

String specifying the name of the implementation function, for example, 's8_add_s8_s8'. The default is ''.

ImplementationHeaderFile

String specifying the name of the header file that declares the implementation function, for example, 's8_add_s8_s8.h'. The default is ''.

ImplementationHeaderPath

String specifying the full path to the implementation header file. The default is ''.

ImplementationSourceFile

String specifying the name of the implementation source file, for example, 's8_add_s8_s8.c'. The default is ''.

ImplementationSourcePath

String specifying the full path to the implementation source file. The default is ''.

SideEffects

Boolean value used to flag the code generator that the implementation function described by this entry should not be optimized away. This parameter applies to implementation functions that return void but should not be optimized away, such as an implementation function that accesses global memory values. For those implementation functions only, you must include this parameter and specify the value true. The default is false.

Description

The setTflCOperationEntryParameters function sets specified parameters for an operator entry in a TFL table.

Example

In the following example, the setTflCOperationEntryParameters function is used to set parameters for a TFL operator entry for uint8 addition.

op_entry = RTW.TflCOperationEntry;
op_entry.setTflCOperationEntryParameters( ...
                   'Key',                      'RTW_OP_ADD', ...
                   'Priority',                 90, ...
                   'SaturationMode',           'RTW_SATURATE_UNSPECIFIED', ...
                   'RoundingMode',             'RTW_ROUND_UNSPECIFIED', ...
                   'ImplementationName',       'u8_add_u8_u8', ...
                   'ImplementationHeaderFile', 'u8_add_u8_u8.h', ...
                   'ImplementationSourceFile', 'u8_add_u8_u8.c' );

In the following example, the setTflCOperationEntryParameters function is used to set parameters for a TFL operator entry for fixed-point int16 division. The table entry specifies a relative scaling between the operator inputs and output in order to map a range of slope and bias values to a replacement function.

op_entry = RTW.TflCOperationEntryGenerator;
op_entry.setTflCOperationEntryParameters( ...
                   'Key',                      'RTW_OP_DIV', ...
                   'Priority',                 90, ...
                   'SaturationMode',           'RTW_WRAP_ON_OVERFLOW', ...
                   'RoundingMode',             'RTW_ROUND_CEILING', ...
                   'RelativeScalingFactorF',   1.0, ...
                   'RelativeScalingFactorE',   -3.0, ...
                   'ImplementationName',       's16_div_s16_s16_rsf0p125', ...
                   'ImplementationHeaderFile', 's16_div_s16_s16_rsf0p125.h', ...
                   'ImplementationSourceFile', 's16_div_s16_s16_rsf0p125.c' );

In the following example, the setTflCOperationEntryParameters function is used to set parameters for a TFL operator entry for fixed-point uint16 addition. The table entry specifies equal slope and zero net bias across operator inputs and output in order to map relative slope and bias values (rather than a specific slope and bias combination) to a replacement function.

op_entry = RTW.TflCOperationEntryGenerator;
op_entry.setTflCOperationEntryParameters( ...
                   'Key',                     'RTW_OP_ADD', ...
                   'Priority',                 90, ...
                   'SaturationMode',           'RTW_WRAP_ON_OVERFLOW', ...
                   'RoundingMode',             'RTW_ROUND_UNSPECIFIED', ...
                   'SlopesMustBeTheSame',      true, ...
                   'MustHaveZeroNetBias',      true, ...
                   'ImplementationName',       'u16_add_SameSlopeZeroBias', ...
                   'ImplementationHeaderFile', 'u16_add_SameSlopeZeroBias.h', ...
                   'ImplementationSourceFile', 'u16_add_SameSlopeZeroBias.c' );

See Also

Example: Mapping Operators to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation

Mapping Fixed-Point Operators to Target-Specific Implementations in the Real-Time Workshop Embedded Coder documentation

Creating Function Replacement Tables in the Real-Time Workshop Embedded Coder documentation

Target Function Libraries in the Real-Time Workshop Embedded Coder documentation

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS