Using the Graphic Editors : Working with Charts and Diagrams : Statecharts : “Only Once” Test Benches

“Only Once” Test Benches

Two types of test benches are available in statecharts:

The Every Step Testbenches run the task Testbench. This task executes every step. The Only Once Testbenches run the task TestBench_run_once. The TestBench_run_once task executes only once on startup. In the OSI’s (mainloop_sc and mainloop_sc_ext), the call to the generated function:

TestBench_run_once is (by default) put in the file user_code.c (<profile>.c), after the call to the call to TASKINIT().
The call to the function TestBench_run_once is wrapped with the preprocessor flag TB_ONLY_ONCE.
The preprocessor flag is generated in the file cmp_flg.h if there are such Only Once testbenches.

Name: “When used as Testbench, run”

Possible Values: “Every Step” - runs under the Task TestBench, which runs every step, used as the default value.

“Only Once” - runs under the Task “TestBench_run_once,” which runs only once on system startup.

The Design-Attributes are available for update from the OSI’s:

MAINLOOP_SC
MAINLOOP_SC_EXT
DEFAULT