Code Replacement Tool
Create, modify, and validate content of code replacement libraries
Description
The Code Replacement Tool is a graphical interface that you can use to create and manage custom code replacement libraries. You can create, import, manipulate, and validate the code replacement tables in a library. The tool also generates the customization file to register a code replacement library with the code generator. If you specify a table name when you open the tool, the tool displays only the contents of that table.
More
The tool display consists of three panes that show table and table entry information:
Left pane lists code replacement tables.
Middle pane lists available tables or, if you select a table in the left pane, the table entries that are in that table.
Right pane lists table or table entry details. If you select a table, the right pane shows table properties: the table name, which you can modify, the table version, and the total number of entries in the table. If select a table entry, the right pane shows mapping and build information for that entry.
Open the Code Replacement Tool
At the command prompt, type crtool
.
Examples
Open an Existing Table in the Tool
This example shows how to open a code replacement table,
my_lookup_replacement_table
, in the Code Replacement
Tool. This table is used in Generate Code by Using Lookup Table Code Replacement Library.
crtool('my_lookup_replacement_table')
Related Examples
Parameters
Name
— Name of table entry (read-only)
character vector
Conceptual name of the function or operation being replaced. Can name a math operation, function, BLAS operation, CBLAS operation, net slope fixed-point operation, semaphore or mutex entry, or customization entry.
Implementation
— Name of replacement function
character vector
Name of the implementation (replacement) function.
NumIn
— Number of input arguments (read-only)
scalar integer
Number of input arguments.
Inn
Type
— Data type of conceptual input argument
character vector
n
TypeData type of a conceptual input argument.
Outn
Type
— Data type of conceptual output argument
character vector
n
TypeData type of a conceptual output argument.
Priority
— Entry match priority
100 (default) | integer, ranging from 0 to 100
The entry match priority, relative to other entries of the same name and to the conceptual argument list within the selected code replacement library. The priority can range from 0 to 100, with 0 being the highest priority. The default is 100. If the library provides two implementations for a function or operator, the implementation with the higher priority shadows the one with the lower priority.
Function/Operation
— Name of table entry
character vector
Conceptual name of the function or operation being replaced. Can name a math operation, function, BLAS operation, CBLAS operation, net slope fixed-point operation, semaphore or mutex entry, or customization entry.
Algorithm
— Computation or approximation algorithm
unspecified (default) | options vary depending on function or operation
Computation or approximation algorithm configured for a function or operation being replaced. For example, you can configure:
The Reciprocal Sqrt block to use the
Newton-Raphson
computation method.The Trigonometric Function block, with Function set to
sin
,cos
,sincos
, oratan2
, to use the approximation methodCORDIC
orLookup
.An addition or subtraction operation, to use the cast-before-operation or cast-after-operation algorithm.
Conceptual arguments
— Conceptual argument names
yn | un
Names of input and output arguments of function or operation being
replaced. Conceptual arguments observe naming conventions
(y1
, u1
, u2
,
...) and data types familiar to the code generator.
Data type (conceptual)
— Conceptual argument data type
double (default) | single | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | boolean | void | logical | fixdt(1,16) | fixdt(1,16,0) | fixdt(1,16,2^0,0)
Data type of a selected input or output argument of the function or operation being replaced. Conceptual arguments observe data types familiar to the code generator.
Complex (conceptual)
— Conceptual argument complexity
cleared (default) | selected
Whether the selected input or output argument of the function or operation being replaced is real or complex.
Argument type
— Conceptual argument type
scalar (default) | matrix
Whether the selected input or output argument of the function or operation
being replaced is a scalar value or a matrix. If you select
Matrix
, parameters for specifying range
dimensions, and for replacement of MATLAB code, array layout appear.
Lower range
— Lower range of matrix dimensions
[2 2] (default)
Vector that specifies the lower range of the matrix dimensions.
Upper range
— Upper range of matrix dimensions
[2 2] (default)
Vector that specifies the upper range of the matrix dimensions.
Array layout supported by entry
— Layout for array storage
Column-major (default) | Row-major | Column-and-Row
Order in which array elements are stored in memory. Row-major layout can improve performance for certain algorithms and ease integration with external code or data that uses the row-major layout.
Make conceptual and implementation argument types the same
— Data type consistency
selected (default) | cleared
Whether you want the data types for your implementation arguments to be
the same as the conceptual argument types. For example, most ANSI-C
functions operate on and return double
data. Clear the
check box if want to map the conceptual representation of a function or
operation to an implementation representation that specifies an argument and
return value. For example, clear the check box to map the conceptual
representation of the function sin
to an implementation
representation that specifies an argument and return value of type
single
(single
sin
(single
)).
Name
— Name of replacement function
character vector
Name of the replacement function.
C++ namespace
— Namespace of replacement function
character vector
Namespace of the replacement function.
Function returns void
— Function returns void
selected (default) | cleared
Whether your implementation function returns void
.
Function arguments
— Replacement argument names
yn | un
Names of input and output arguments of your replacement function.
Data type (replacement)
— Replacement argument data type
double (default) | single | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | boolean | void | integer | size_t | long | ulong | long long | ulong long | char
Data type of a selected input or output argument of your replacement function.
I/O type
— Replacement argument I/O type
OUTPUT | INPUT
Whether a selected argument of your replacement function is an input or output argument.
Const
— Const replacement argument
cleared (default) | selected
Whether to apply the const
type qualifier to a selected
argument of your replacement function.
Pointer
— Pointer replacement argument
cleared (default) | selected
Whether a selected argument of your replacement function is a pointer.
Complex (replacement)
— Replacement argument complexity
cleared (default) | selected
Whether the selected input or output argument of the replacement function is real or complex.
Integer saturation mode
— Saturation mode
unspecified Saturation (default) | wrap on overflow | saturate on overflow
Saturation mode supported by the replacement function.
Rounding modes
— Rounding modes
unspecified rounding (default) | floor | ceil | zero | nearest | MATLAB® nearest | simplest | conv
Rounding modes supported by the replacement function.
Allow expressions as inputs
— Expressions as inputs
selected (default) | cleared
Whether your replacement function accepts expression inputs. If you select the parameter, the code generator integrates an expression input into the generated code rather than inserting a temporary variable in place of the expression input.
Function modifies internal or global state
— State modification
cleared (default) | selected
Whether your replacement function modifies variables representing internal or global state.
Implementation header file
— Header file for replacement function
character vector
Header file for the replacement function (for example,
my_rep_func.h
).
Implementation source file
— Source file for replacement function
character vector
Source file for the replacement function (for example,
my_rep_func.c
).
Additional header files/include paths
— Names and paths of additional header files
character vector
Names and paths of additional header files to include for the replacement
function (for example, support_files.h
and
matlab\customization\mylib\include
).
Additional source files/ paths
— Names and paths of additional source files
character vector
Names and paths of additional source files to include for the replacement
function (for example, support_files.c
and
matlab\customization\mylib\src
).
Additional object files/ paths
— Names and paths of link object files
character vector
Names and paths of link object files to use for the replacement function
(for example, support_files.o
and
matlab\customization\mylib\bin
).
Additional link flags
— Link flags to use
character vector
Link flags to use for the replacement function (for example, -MD
-Gy
).
Additional compile flags
— Compile flags to use
character vector
Compile flags to use for the replacement function (for example,
-Zi -Wall
).
Copy files to build directory
— Copy files to build folder
cleared (default) | selected
Whether the code generator copies files from external folders to the build folder before starting the build process.
Programmatic Use
crtool(table)
crtool(table)
opens the Code Replacement Tool and displays
the contents of table
, where table
is a
character vector that names a MATLAB file that defines code replacement tables. The file must be in the
current folder or on the MATLAB path.
Version History
Introduced in R2014b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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érica Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)