aboutsummaryrefslogtreecommitdiff
path: root/chapters/control_flow.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'chapters/control_flow.adoc')
-rw-r--r--chapters/control_flow.adoc42
1 files changed, 3 insertions, 39 deletions
diff --git a/chapters/control_flow.adoc b/chapters/control_flow.adoc
index 9de9c72..2da2424 100644
--- a/chapters/control_flow.adoc
+++ b/chapters/control_flow.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2021 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
@@ -19,20 +19,7 @@ include::{generated}/operators/COND_IF.adoc[]
[source,c++]
----
-ERROR_IF(tosa_nesting_depth >= MAX_NESTING);
-ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(then_graph));
-ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(else_graph));
-ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(then_graph));
-ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(else_graph));
-ERROR_IF(tensor_size(shape) != 1);
-
-tosa_nesting_depth++;
-if (condition[0]) {
- tosa_execute_graph(then_graph, input_list, output_list);
-} else {
- tosa_execute_graph(else_graph, input_list, output_list);
-}
-tosa_nesting_depth--;
+include::{pseudocode}/operators/COND_IF.tosac[lines=10..-1]
----
==== WHILE_LOOP
@@ -43,28 +30,5 @@ include::{generated}/operators/WHILE_LOOP.adoc[]
[source,c++]
----
-ERROR_IF(tosa_nesting_depth >= MAX_NESTING);
-ERROR_IF(tensor_list_shape(input_list) != tosa_list_shape(output_list));
-ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(cond_graph));
-ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(body_graph));
-ERROR_IF(tensor_list_shape(input_list) != tosa_output_shape(body_graph));
-// Condition graph output must be a single element tensor with a single bool value
-ERROR_IF(tensor_size(tosa_output_shape(cond_graph)) != 1);
-ERROR_IF(tosa_output_type(cond_graph) != bool_t);
-
-// The iteration number 'i' is included to give unique names to variables
-// in each iteration of the loop and is not required by implementations
-int32_t i=0; // iteration number
-tensor_list_t list[]; // array of tensor lists indexed by iteration
-bool_t *condition[]; // array of condition tensors indexed by iteration
-list[i] = input_list; // copy input data as list[0]
-tosa_nesting_depth++;
-tosa_execute_graph(cond_graph, list[i], [ condition[i] ]); // initial condition
-while (condition[i][0]) {
- tosa_execute_graph(body_graph, list[i], list[i+1]);
- i = i+1;
- tosa_execute_graph(cond_graph, list[i], [ condition[i] ]);
-}
-tosa_nesting_depth--;
-output_list = list[i];
+include::{pseudocode}/operators/WHILE_LOOP.tosac[lines=10..-1]
----