From dd5a1c7403fd8bb8efe33ef1181081215c01e354 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson <oscar.gustafsson@gmail.com> Date: Fri, 1 Jul 2022 17:21:05 +0200 Subject: [PATCH] Fix issue with cyclic schedule. Closes #100 --- b_asic/schedule.py | 17 ++++++++--------- examples/thirdorderblwdf.py | 2 +- examples/threepointwinograddft.py | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/b_asic/schedule.py b/b_asic/schedule.py index 333e85f0..4d267a1e 100644 --- a/b_asic/schedule.py +++ b/b_asic/schedule.py @@ -15,7 +15,7 @@ import io from b_asic.signal_flow_graph import SFG from b_asic.graph_component import GraphID from b_asic.special_operations import Delay, Output - +from b_asic import OutputPort, Signal class Schedule: """Schedule of an SFG with scheduled Operations.""" @@ -43,14 +43,13 @@ class Schedule: max_end_time = self._get_max_end_time() - if not self._cyclic: - if schedule_time is None: - self._schedule_time = max_end_time - elif schedule_time < max_end_time: - raise ValueError( - "Too short schedule time for non-cyclic Schedule entered.") - else: - self._schedule_time = schedule_time + if schedule_time is None: + self._schedule_time = max_end_time + elif schedule_time < max_end_time: + raise ValueError( + f"Too short schedule time. Minimum is {max_end_time}.") + else: + self._schedule_time = schedule_time def start_time_of_operation(self, op_id: GraphID) -> int: """Get the start time of the operation with the specified by the op_id.""" diff --git a/examples/thirdorderblwdf.py b/examples/thirdorderblwdf.py index e3bd53cf..65dd4b4d 100644 --- a/examples/thirdorderblwdf.py +++ b/examples/thirdorderblwdf.py @@ -35,4 +35,4 @@ import numpy as np import matplotlib.pyplot as plt plt.plot(w, 20*np.log10(np.abs(h)/2)) -schedule = Schedule(sfg, cyclic=False) +schedule = Schedule(sfg, cyclic=True) diff --git a/examples/threepointwinograddft.py b/examples/threepointwinograddft.py index 18675f57..ea34231b 100644 --- a/examples/threepointwinograddft.py +++ b/examples/threepointwinograddft.py @@ -38,4 +38,4 @@ sfg.set_execution_time_of_type(ConstantMultiplication.type_name(), 1) sfg.set_execution_time_of_type(Addition.type_name(), 1) sfg.set_execution_time_of_type(Subtraction.type_name(), 1) -schedule = Schedule(sfg, cyclic=False) +schedule = Schedule(sfg, cyclic=True) -- GitLab