createCRLEntry
Create code replacement table entry from conceptual and implementation argument string specifications
Description
returns a code replacement table entry. The entry maps a conceptual representation
of a function or operator to an implementation representation. The
tableEntry
= createCRLEntry(crTable
,conceptualSpecification
,implementationSpecification
)conceptualSpecification
argument is a character vector or
string scalar that defines the name and conceptual arguments, familiar to the code
generator, for the function or operator to replace. The
implementationSpecification
argument is a character vector
or string scalar that defines the name and C/C++ implementation arguments for the
replacement function.
This function does not support:
C++ implementations
Data alignment
Operator replacement with net slope arguments
Entry parameter specifications (for example, priority, algorithm, building information)
Semaphore and mutex function replacements
In the syntax specifications, place a space before and after an operator symbol.
For example, use double u1 + double u2
instead of double
u1+double u2
. Also, asterisk (*), tilde (~), and semicolon (;) have
the following meaning.
Symbol | Meaning |
---|---|
* |
|
~ | Based on the position of the symbol, slopes or bias must be the same across data types. |
; | Separates dimension ranges. For example, [1 10; 1
100] specifies a vector with length from 10
through 100. |
The following table shows syntax for the conceptual and implementation specifications based on:
Whether you are creating an entry for a function or operator.
The type or characterization of the code replacement.
Type of Replacement | Conceptual Syntax | Implementation Syntax |
---|---|---|
Function Code Replacement Syntax | ||
Typical | double y1 = sin(double u1) | double y1 = mySin(double u1) |
Derive implementation argument data types from conceptual specification | double y1 = sin(double u1) | y1 = mySin(u1) |
Derive implementation arguments and data types from conceptual specification | double y1 = sin(double u1) | mySin |
Change data type | single y1 = sin(single u1) | double y1 = mySin(double u1) |
Reorder arguments | double y1 = atan2(double u1, double
u2) | y1 = myAtan(u2, u1) |
Specify column vector arguments | double y1 = sin(double u1[10]) | double y1 = mySin(double* u1) |
Specify column vector arguments and dimension range | double y1[1 100; 1 100] = sin(double u1[1 100; 1
100]) | mySin(double* u1, double* y1) |
Remap return value as output argument | double y1 = sin(double u1) | mySin(double u1, double* y1) |
Specify fixed-point data types | fixdt(1,16,3) y1 = sin(fixdt(1,16,3)
u1) | int16 y1 = mySin(int16 u1) |
Specify fixed-point data types and set
CheckSlope to false ,
CheckBias to true , and
Bias to 0 | fixdt(1,16,*) y1 = sin(fixdt(1,16,*)
u1) | int16 y1 = mySin(int16 u1) |
Specify fixed-point data types and set
SlopesMustBeTheSame to
true , CheckSlope to
false , CheckBias to
true , and Bias to
0 | fixdt(1,16,~) y1 = sin(fixdt(1,16,~)
u1) | int16 y1 = mySin(int16 u1) |
Specify fixed-point data types and set
SlopesMustBeTheSame to
true ,
BiasMustBeTheSame to
true , CheckSlope to
false , and CheckBias
to false | fixdt(1,16,~,~) y1 = sin(fixdt(1,16,~,~)
u1) | int16 y1 = mySin(int16 u1) |
Specify multiple output arguments | [double y1 double y2] = foo(double u1, double
u2) | double y1 = myFoo(double u1, double u2, double*
y2) |
Operator Code Replacement Syntax | ||
Typical | int16 y1 = int16 u1 + int16 u2 | int16 y1 = myAdd(int16 u1, int16
u2) |
Specify fixed-point data types | fixdt(1,16,3) y1 = fixdt(1,16,3) u1 + fixdt(1,16,3)
u2 | int16 y1 = myAdd(int16 u1, int16
u2) |
Specify fixed-point data types and set
CheckSlope to false ,
CheckBias to true , and
Bias to 0 | fixdt(1,16,*) y1 = fixdt(1,16,*) u1 + fixdt(1,16,*)
u2 | int16 y1 = myAdd(int16 u1, int16
u2) |
Specify fixed-point data types, wildcard, slopes must be the same, and zero bias | fixdt(1,16,~,0) y1 = fixdt(1,16,~,0) u1 +
fixdt(1,16,~,0) u2 | int16 y1 = myAdd(int16 u1, int16
u2) |
Typecast | int16 y1 = int8 u1 | int16 y1 = myCast(int8 u1) |
Shift | int16 y1 = int16 u1 << int16
u2 int16 y1 = int16 u1
>> int16 u2 int16
y1 = int16 u1 .>> int16 u2 | int16 y1 = myShiftLeft(int16 u1, int16
u2) int16 y1 =
myShiftRightArithmetic(int16 u1, int16
u2) int16 y1 =
myShiftRightLogical(int16 u1, int16
u2) |
Specify relational operator | bool y1 = int16 u1 < int16 u2 | bool y1 = myLessThan(int6 u1, int16
u2) |
Specify multiplication and division | int32 y1 = int32 u1 * in32 u2 / in32
u3 | int32 y1 = myMultDiv(int32 u1, int32 u2, int32
u3) |
Specify matrix multiplication | double y1[10][10] = double u1[10][10] * double
u2[10][10] | myMult(double* u1, double* u2, double*
y1) |
Specify element-wise matrix multiplication | double y1[10][10] = double u1[10][10] .* double
u2[10][10] | myMult(double* u1, double* u2, double*
y1) |
Specify matrix multiplication with transpose of an input argument | double y1[10][10] = double u1[10][10]' * double
u2[10][10] | myMult(double* u1, double* u2, double*
y1) |
Specify matrix multiplication with Hermitian of an input argument | cdouble y1[10][10] = cdouble u1[10][10]' * cdouble
u2[10][10] cdouble
y1[10][10] = cdouble u1[10][10] * cdouble
u2[10][10]' | myMult(cdouble* u1, cdouble* u2, cdouble*
y1) |
Specify left matrix division | double y1[10][10] = double u1[10][10] \ double
u2[10][10] | myLeftDiv(double* u1, double* u2, double*
y1) |
Specify right matrix division | double y1[10][10] = double u1[10][10] / double
u2[10][10] | myRightDiv(double* u1, double* u2, double*
y1) |
Examples
Input Arguments
Output Arguments
Version History
Introduced in R2015a