createAndAddConceptualArg

Create conceptual argument from specified properties and add to conceptual arguments for TFL table entry

Syntax

void createAndAddConceptualArg(hEntry, argType, varargin)

Arguments

hEntry

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

argType

String specifying the argument type to create: 'RTW.TflArgNumeric' for numeric.

varargin

Parameter/value pairs for the conceptual argument. See varargin Parameters.

varargin Parameters

The following argument properties can be specified to the createAndAddConceptualArg function using parameter/value argument pairs. For example,

createAndAddConceptualArg(..., 'DataTypeMode', 'double', ...);
Name

String specifying the argument name, for example, 'y1' or 'u1'.

IOType

String specifying the I/O type of the argument: 'RTW_IO_INPUT' for input or 'RTW_IO_OUTPUT' for output. The default is 'RTW_IO_INPUT'.

IsSigned

Boolean value that, when set to true, indicates that the argument is signed. The default is true.

WordLength

Integer specifying the word length, in bits, of the argument. The default is 16.

CheckSlope

Boolean flag that, when set to true for a fixed-point argument, causes TFL replacement request processing to check that the slope value of the argument exactly matches the call-site slope value. The default is true.

Specify true if you are matching a specific [slope bias] scaling combination or a specific binary-point-only scaling combination on fixed-point operator inputs and output. Specify false if you are matching relative scaling or relative slope and bias values across fixed-point operator inputs and output.

CheckBias

Boolean flag that, when set to true for a fixed-point argument, causes TFL replacement request processing to check that the bias value of the argument exactly matches the call-site bias value. The default is true.

Specify true if you are matching a specific [slope bias] scaling combination or a specific binary-point-only scaling combination on fixed-point operator inputs and output. Specify false if you are matching relative scaling or relative slope and bias values across fixed-point operator inputs and output.

DataTypeMode

String specifying the data type mode of the argument: 'boolean', 'double', 'single', 'Fixed-point: binary point scaling', or 'Fixed-point: slope and bias scaling'. The default is 'Fixed-point: binary point scaling'.

DataType

String specifying the data type of the argument: 'boolean', 'double', 'single', or 'Fixed'. The default is 'Fixed'.

Scaling

String specifying the data type scaling of the argument: 'BinaryPoint' for binary-point scaling or 'SlopeBias' for slope and bias scaling. The default is 'BinaryPoint'.

Slope

Floating-point value specifying the slope of the argument, for example, 15.0. The default is 1.

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either this parameter or a combination of the SlopeAdjustmentFactor and FixedExponent parameters

SlopeAdjustmentFactor

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

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either the Slope parameter or a combination of this parameter and the FixedExponent parameter.

FixedExponent

Integer value specifying the fixed exponent (E) part of the slope, F2E, of the argument. The default is -15.

If you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output, specify either the Slope parameter or a combination of this parameter and the SlopeAdjustmentFactor parameter.

Bias

Floating-point value specifying the bias of the argument, for example, 2.0. The default is 0.0.

Specify this parameter if you are matching a specific [slope bias] scaling combination on fixed-point operator inputs and output.

FractionLength

Integer value specifying the fraction length for the argument, for example, 3. The default is 15.

Specify this parameter if you are matching a specific binary-point-only scaling combination on fixed-point operator inputs and output.

Description

The createAndAddConceptualArg function creates a conceptual argument from specified properties and adds the argument to the conceptual arguments for a TFL table entry.

Examples

In the following example, thecreateAndAddConceptualArg function is used to specify conceptual output and input arguments for a TFL operator entry.

op_entry = RTW.TflCOperationEntry;
.
.
.
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric', ...
                          'Name',       'y1', ...
                          'IOType',     'RTW_IO_OUTPUT', ...
                          'IsSigned',   true, ...
                          'WordLength', 32, ...
                          'FractionLength', 0);
                                  
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric',...
                          'Name',       'u1', ...
                          'IOType',     'RTW_IO_INPUT',...
                          'IsSigned',   true,...
                          'WordLength', 32, ...
                          'FractionLength', 0 );
                               
createAndAddConceptualArg(op_entry, 'RTW.TflArgNumeric',...
                          'Name',       'u2', ...
                          'IOType',     'RTW_IO_INPUT',...
                          'IsSigned',   true,...
                          'WordLength', 32, ...
                          'FractionLength', 0 );

The following examples show some common type specifications using createAndAddConceptualArg.

% uint8:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                          'Name',           'u1', ... 
                          'IOType',         'RTW_IO_INPUT', ...
                          'IsSigned',       false, ...
                          'WordLength',     8, ...
                          'FractionLength', 0 );

% single:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                          'Name',         'u1', ... 
                          'IOType',       'RTW_IO_INPUT', ...
                          'DataTypeMode', 'single' );

% double:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                          'Name',         'y1', ... 
                          'IOType',       'RTW_IO_OUTPUT', ...
                          'DataTypeMode', 'double' );

% boolean:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                          'Name',         'u1', ... 
                          'IOType',       'RTW_IO_INPUT', ...
                          'DataTypeMode', 'boolean' );

% Fixed-point using binary-point-only scaling:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                   'Name',           'y1', ... 
                   'IOType',         'RTW_IO_OUTPUT', ...
                   'CheckSlope',     true, ...
                   'CheckBias',      true, ...
                   'DataTypeMode',   'Fixed-point: binary point scaling', ...
                   'IsSigned',       true, ...
                   'WordLength',     32, ...
                   'FractionLength', 28);

% Fixed-point using [slope bias] scaling:
createAndAddConceptualArg(hEntry, 'RTW.TflArgNumeric', ...
                   'Name',           'y1', ... 
                   'IOType',         'RTW_IO_OUTPUT', ...
                   'CheckSlope',     true, ...
                   'CheckBias',      true, ...
                   'DataTypeMode',   'Fixed-point: slope and bias scaling', ...
                   'IsSigned',       true, ...
                   'WordLength',     16, ...
                   'Slope',          15, ...
                   'Bias',           2);

For examples of fixed-point arguments that use relative scaling or relative slope/bias values, see Example: Creating Fixed-Point Operator Entries for Relative Scaling (Multiplication and Division) and Example: Creating Fixed-Point Operator Entries for Equal Slope and Zero Net Bias (Addition and Subtraction) in the Real-Time Workshop® Embedded Coder™ documentation.

See Also

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