aboutsummaryrefslogtreecommitdiff
path: root/chapters/control_flow.adoc
blob: 2da2424137330bd261dcd9c5496fdf4a5f42689b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
// (C) COPYRIGHT 2020-2024 ARM Limited
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorised
// copies and copies may only be made to the extent permitted
// by a licensing agreement from ARM Limited.

=== Control Flow Operators

TOSA implements two control flow operators, for conditional branching and loop based control. Both have attributes that are TOSA sub-graphs.

==== COND_IF

Evaluates a Boolean condition and then takes one of two distinct execution paths. This implements the semantic if-then-else structure.

include::{generated}/operators/COND_IF.adoc[]

[source,c++]
----
include::{pseudocode}/operators/COND_IF.tosac[lines=10..-1]
----

==== WHILE_LOOP

Generates and evaluates a Bool condition and either executes a loop body or exits the loop. This action is performed repeatedly after updating and re-evaluating the Boolean condition every iteration. This implements the semantic foreach or while iterative loop structure.

include::{generated}/operators/WHILE_LOOP.adoc[]

[source,c++]
----
include::{pseudocode}/operators/WHILE_LOOP.tosac[lines=10..-1]
----