Skip to content
Snippets Groups Projects
Commit dd5a1c74 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Fix issue with cyclic schedule. Closes #100

parent 1cab407f
No related branches found
No related tags found
No related merge requests found
Pipeline #72477 passed
......@@ -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."""
......
......@@ -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)
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment