Skip to content
Snippets Groups Projects

Qt6 fixes and scheduler class started

Merged Oscar Gustafsson requested to merge add-list-scheduler into master
2 unresolved threads
2 files
+ 9
8
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 8
8
@@ -7,7 +7,7 @@ Contains the schedule class for scheduling operations in an SFG.
@@ -7,7 +7,7 @@ Contains the schedule class for scheduling operations in an SFG.
import io
import io
import sys
import sys
from collections import defaultdict
from collections import defaultdict
from typing import Dict, List, Literal, Optional, Sequence, Tuple, cast
from typing import Dict, List, Optional, Sequence, Tuple, cast
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import numpy as np
import numpy as np
@@ -33,10 +33,10 @@ from b_asic.operation import Operation
@@ -33,10 +33,10 @@ from b_asic.operation import Operation
from b_asic.port import InputPort, OutputPort
from b_asic.port import InputPort, OutputPort
from b_asic.process import MemoryVariable, OperatorProcess
from b_asic.process import MemoryVariable, OperatorProcess
from b_asic.resources import ProcessCollection
from b_asic.resources import ProcessCollection
 
from b_asic.scheduling_algorithm import SchedAlg
from b_asic.signal_flow_graph import SFG
from b_asic.signal_flow_graph import SFG
from b_asic.special_operations import Delay, Input, Output
from b_asic.special_operations import Delay, Input, Output
from b_asic.types import TypeName
from b_asic.types import TypeName
from b_asic.scheduling_algorithm import SchedAlg
# Need RGB from 0 to 1
# Need RGB from 0 to 1
_EXECUTION_TIME_COLOR: Tuple[float, ...] = tuple(
_EXECUTION_TIME_COLOR: Tuple[float, ...] = tuple(
@@ -1229,10 +1229,10 @@ class Schedule:
@@ -1229,10 +1229,10 @@ class Schedule:
_repr_html_ = _repr_svg_
_repr_html_ = _repr_svg_
class Scheduler():
class Scheduler:
def __init__(self, schedule: Schedule) -> None:
def __init__(self, schedule: Schedule) -> None:
self.schedule = schedule
self.schedule = schedule
def schedule_asap(self) -> None:
def schedule_asap(self) -> None:
"""Schedule the operations using as-soon-as-possible scheduling."""
"""Schedule the operations using as-soon-as-possible scheduling."""
sched = self.schedule
sched = self.schedule
@@ -1303,7 +1303,7 @@ class Scheduler():
@@ -1303,7 +1303,7 @@ class Scheduler():
op_start_time = max(op_start_time, op_start_time_from_in)
op_start_time = max(op_start_time, op_start_time_from_in)
sched._start_times[operation.graph_id] = op_start_time
sched._start_times[operation.graph_id] = op_start_time
# handle output and remove delays
# handle output and remove delays
for output in sched._sfg.find_by_type_name(Output.type_name()):
for output in sched._sfg.find_by_type_name(Output.type_name()):
output = cast(Output, output)
output = cast(Output, output)
@@ -1337,7 +1337,7 @@ class Scheduler():
@@ -1337,7 +1337,7 @@ class Scheduler():
for output in sched.sfg.find_by_type_name(Output.type_name()):
for output in sched.sfg.find_by_type_name(Output.type_name()):
output = cast(Output, output)
output = cast(Output, output)
sched.move_operation_alap(output.graph_id)
sched.move_operation_alap(output.graph_id)
# move all operations ALAP
# move all operations ALAP
for step in reversed(sched.sfg.get_precedence_list()):
for step in reversed(sched.sfg.get_precedence_list()):
for outport in step:
for outport in step:
@@ -1366,10 +1366,10 @@ class Scheduler():
@@ -1366,10 +1366,10 @@ class Scheduler():
# operation = outport.operation
# operation = outport.operation
# if operation.graph_id not in sched._start_times:
# if operation.graph_id not in sched._start_times:
# sched._start_times[operation.graph_id] = 0
# sched._start_times[operation.graph_id] = 0
# # handle the remaining sets
# # handle the remaining sets
# for outports in prec_list[2:]:
# for outports in prec_list[2:]:
# for outport in outports:
# for outport in outports:
# operation = outport.operation
# operation = outport.operation
# if operation.graph_id not in sched._start_times:
# if operation.graph_id not in sched._start_times:
# pass
# pass
\ No newline at end of file
Loading