Target Language Compiler | ![]() ![]() |
Getting Started
Debugging Your TLC Code notes that the bug in gain.tlc
does not appear unless you use inline parameters. This happens because the faulty function, FcnEliminateUnnecessaryParams(), is designed to eliminate multiplication by unity, and thus requires parameters to be expressed as constants. When the simple_log
model is built without inline parameters, the outputs are correct because that function is not called.
When you notice inconsistent behavior such as this, it can help to inquire into how the TLC behaved under various conditions. A good way to uncover such information is to turn on the TLC coverage analyzer when generating code. This brief exercise shows how to do this and how it can help find problems in TLC code.
Under the TLC debugging
category of the Real-Time Workshop tab is a check box, Start TLC coverage when generating code. Selecting it results in a listing that documents how many times each line in your TLC source file was touched during code generation. The listing, name.log
(where name
is the filename of the TLC file being analyzed), is placed in your build directory.
Note
In fact, a log file for every .tlc file invoked or included is generated in the build directory. Here we are only interested in the one called gain.log .
|
![]() | Using TLC Code Coverage to Aid Debugging | Open the Model and Generate Code | ![]() |