Skip to content
Snippets Groups Projects
Commit 8a72f086 authored by Simon Bjurek's avatar Simon Bjurek
Browse files

added exception when attempting cyclic scheduling of recursive algorithm with ListScheduler

parent a29fbf1a
Branches
No related tags found
1 merge request!501Added custom IO times for ASAP and ALAP etc
This commit is part of merge request !501. Comments created here will be created in the context of that merge request.
...@@ -280,6 +280,12 @@ class ListScheduler(Scheduler): ...@@ -280,6 +280,12 @@ class ListScheduler(Scheduler):
self._logger.debug("--- Scheduler initializing ---") self._logger.debug("--- Scheduler initializing ---")
self._initialize_scheduler(schedule) self._initialize_scheduler(schedule)
if self._sfg.loops and self._schedule.cyclic:
raise ValueError(
"ListScheduler does not support cyclic scheduling of "
"recursive algorithms. Use RecursiveListScheduler instead."
)
if self._input_times: if self._input_times:
self._place_inputs_on_given_times() self._place_inputs_on_given_times()
......
...@@ -1872,8 +1872,6 @@ class SFG(AbstractOperation): ...@@ -1872,8 +1872,6 @@ class SFG(AbstractOperation):
""" """
Return the recursive loops found in the SFG. Return the recursive loops found in the SFG.
If -1, the SFG does not have any loops.
Returns Returns
------- -------
A list of the recursive loops. A list of the recursive loops.
......
...@@ -1789,6 +1789,38 @@ class TestListScheduler: ...@@ -1789,6 +1789,38 @@ class TestListScheduler:
), ),
) )
def test_cyclic_and_recursive_loops(self):
N = 3
Wc = 0.2
b, a = signal.butter(N, Wc, btype="lowpass", output="ba")
sfg = direct_form_1_iir(b, a)
sfg.set_latency_of_type_name(ConstantMultiplication.type_name(), 2)
sfg.set_execution_time_of_type_name(ConstantMultiplication.type_name(), 1)
sfg.set_latency_of_type_name(Addition.type_name(), 3)
sfg.set_execution_time_of_type_name(Addition.type_name(), 1)
resources = {
Addition.type_name(): 1,
ConstantMultiplication.type_name(): 1,
Input.type_name(): 1,
Output.type_name(): 1,
}
with pytest.raises(
ValueError,
match="ListScheduler does not support cyclic scheduling of recursive algorithms. Use RecursiveListScheduler instead.",
):
Schedule(
sfg,
scheduler=ListScheduler(
sort_order=((1, True), (3, False), (4, False)),
max_resources=resources,
),
cyclic=True,
schedule_time=sfg.iteration_period_bound(),
)
class TestRecursiveListScheduler: class TestRecursiveListScheduler:
def test_empty_sfg(self, sfg_empty): def test_empty_sfg(self, sfg_empty):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment