From 8d623e09f231946a5c454f4178743240e392bb06 Mon Sep 17 00:00:00 2001
From: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Date: Mon, 24 Feb 2025 16:22:31 +0100
Subject: [PATCH] Rework IO times example

---
 .../auto_scheduling_with_custom_io_times.py   | 40 ++++---------------
 1 file changed, 7 insertions(+), 33 deletions(-)

diff --git a/examples/auto_scheduling_with_custom_io_times.py b/examples/auto_scheduling_with_custom_io_times.py
index c981f467..b99f5b04 100644
--- a/examples/auto_scheduling_with_custom_io_times.py
+++ b/examples/auto_scheduling_with_custom_io_times.py
@@ -11,7 +11,8 @@ from b_asic.schedule import Schedule
 from b_asic.scheduler import ASAPScheduler
 from b_asic.sfg_generators import radix_2_dif_fft
 
-sfg = radix_2_dif_fft(points=8)
+points = 8
+sfg = radix_2_dif_fft(points=points)
 
 # %%
 # The SFG is
@@ -19,8 +20,8 @@ sfg
 
 # %%
 # Set latencies and execution times.
-sfg.set_latency_of_type(Butterfly.type_name(), 3)
-sfg.set_latency_of_type(ConstantMultiplication.type_name(), 2)
+sfg.set_latency_of_type(Butterfly.type_name(), 1)
+sfg.set_latency_of_type(ConstantMultiplication.type_name(), 3)
 sfg.set_execution_time_of_type(Butterfly.type_name(), 1)
 sfg.set_execution_time_of_type(ConstantMultiplication.type_name(), 1)
 
@@ -32,26 +33,8 @@ schedule.show()
 # %%
 # Generate a non-cyclic Schedule from HybridScheduler with custom IO times.
 resources = {Butterfly.type_name(): 1, ConstantMultiplication.type_name(): 1}
-input_times = {
-    "in0": 0,
-    "in1": 1,
-    "in2": 2,
-    "in3": 3,
-    "in4": 4,
-    "in5": 5,
-    "in6": 6,
-    "in7": 7,
-}
-output_delta_times = {
-    "out0": -2,
-    "out1": -1,
-    "out2": 0,
-    "out3": 1,
-    "out4": 2,
-    "out5": 3,
-    "out6": 4,
-    "out7": 5,
-}
+input_times = {f"in{i}": i for i in range(points)}
+output_delta_times = {f"out{i}": i - 2 for i in range(points)}
 schedule = Schedule(
     sfg,
     scheduler=HybridScheduler(
@@ -64,16 +47,7 @@ schedule.show()
 
 # %%
 # Generate a new Schedule with cyclic scheduling enabled
-output_delta_times = {
-    "out0": 0,
-    "out1": 1,
-    "out2": 2,
-    "out3": 3,
-    "out4": 4,
-    "out5": 5,
-    "out6": 6,
-    "out7": 7,
-}
+output_delta_times = {f"out{i}": i for i in range(points)}
 schedule = Schedule(
     sfg,
     scheduler=HybridScheduler(
-- 
GitLab