8.1.8.4. Canceling Script Branches
You can cancel a suspended script branch by interrupting it using the interrupt-script-branch command. Each branch has an ID associated that can be found using list-script-branches, and that is returned by the script-branch command.
The following capture shows an example of the use of these commands. In this example, a branch is created that waits for 10 CPU steps and the output of this command, which corresponds to the branch ID, is stored in the $id variable. The ID identified is 4. Use the list-script-branches command to verify this. From this command, you can see the condition for which the branch is waiting to continue its execution. Then, advance in the simulation 5 steps, which is not enough to achieve the condition required. At this point, interrupt the branch using the interrupt-script-branch with the ID as an argument. You receive a message indicating that the branch was interrupted. Call the list-script-branches command again to confirm that the branch is no longer in the list.
#Intel Simics simulator CLI
simics> $id = (script-branch "sample script branch" {
....... echo "Script branch started..."
....... system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0].bp-wait-for-step 10
....... echo "Script branch finished"
....... })
Script branch started...
simics> echo $id
4
simics> list-script-branches
------------------------------------------------------------------
ID Wait Condition Description Wait data
------------------------------------------------------------------
4 wait-for-step "sample script branch" system...agilex_hps.core[0]
waiting for step
187281544151
------------------------------------------------------------------
simics> run 5 steps
simics> interrupt-script-branch $id
wait-for-step interrupted
Script branch 4 interrupted.
simics> list-script-branches
---------------------------------------------
ID Wait Condition Description Wait data
---------------------------------------------
---------------------------------------------