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.
The tool display consists of three panes that show table and table entry information:
Left pane lists code replacement tables or libraries.
Middle pane displays the available content of the table or library you select in the left pane. For example, if you select a table in the left pane, the table entries will be listed in the middle pane.
Right pane displays information about the item selected in the left or middle pane. 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 you 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
to. To view an existing code
replacement table, specify that table as the argument to crtool
. For
example, call crtool("my_code_replacement_table.m")
.
Examples
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
Entry Summary Information (Center Pane)
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.
Name of the implementation (replacement) function.
Number of input arguments.
Data type of a conceptual input argument.
Number of output arguments.
Data type of a conceptual output argument.
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.
Entry Mapping Information (Right Pane)
Conceptual name of the function or operation being replaced. The name can be a math operation, function, BLAS operation, CBLAS operation, net slope fixed-point operation, semaphore or mutex entry, or customization entry.
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.
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 of a selected input or output argument of the function or operation being replaced. Conceptual arguments observe data types familiar to the code generator.
Whether the selected input or output argument of the function or operation being replaced is real or complex.
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.
Vector that specifies the lower range of the matrix dimensions.
Vector that specifies the upper range of the matrix dimensions.
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.
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 of the replacement function.
Namespace of the replacement function.
Whether your implementation function returns void
.
Names of input and output arguments of your replacement function.
Data type of a selected input or output argument of your replacement function.
Whether a selected argument of your replacement function is an input or output argument.
Whether to apply the const
type qualifier to a selected
argument of your replacement function.
Whether a selected argument of your replacement function is a pointer.
Whether the selected input or output argument of the replacement function is real or complex.
Saturation mode supported by the replacement function.
Rounding modes supported by the replacement function.
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.
Whether your replacement function modifies variables representing internal or global state.
Entry Build Information (Right Pane)
Header file for the replacement function (for example,
my_rep_func.h
).
Source file for the replacement function (for example,
my_rep_func.c
).
Names and paths of additional header files to include for the replacement
function (for example, support_files.h
and
matlab\customization\mylib\include
).
Names and paths of additional source files to include for the replacement
function (for example, support_files.c
and
matlab\customization\mylib\src
).
Names and paths of link object files to use for the replacement function
(for example, support_files.o
and
matlab\customization\mylib\bin
).
Link flags to use for the replacement function (for example, -MD
-Gy
).
Compile flags to use for the replacement function (for example,
-Zi -Wall
).
Whether the code generator copies files from external folders to the build folder before starting the build process.
Programmatic Use
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: United States.
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)