Skip to content
Snippets Groups Projects

Better schedule, including plotting

Merged Oscar Gustafsson requested to merge plotschedule into master
2 files
+ 91
3
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 22
2
@@ -4,7 +4,7 @@ Contains the schema class for scheduling operations in an SFG.
"""
from collections import defaultdict
from typing import Dict, List, Optional
from typing import Dict, List, Optional, Tuple
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import numpy as np
@@ -14,7 +14,6 @@ import io
from b_asic.signal_flow_graph import SFG
from b_asic.graph_component import GraphID
from b_asic.operation import Operation
from b_asic.special_operations import Delay, Output
@@ -97,6 +96,10 @@ class Schema:
slack = min(slack, usage_time - available_time)
return slack
def slacks(self, op_id: GraphID) -> Tuple(int, int):
assert op_id in self._start_times, "No operation with the specified op_id in this schema."
return (self.backward_slack(op_id), self.forward_slack(op_id))
def print_slacks(self) -> None:
raise NotImplementedError
@@ -108,6 +111,22 @@ class Schema:
def schedule_time(self) -> int:
return self._schedule_time
def increase_time_resolution(self, factor: int) -> None:
raise NotImplementedError
def decrease_time_resolution(self, factor: int) -> None:
raise NotImplementedError
def move_operation(self, op_id: GraphID, time: int) -> None:
assert op_id in self._start_times, "No operation with the specified op_id in this schema."
if time < 0:
if -time > self.backward_slack(op_id):
raise ValueError
else:
if time > self.forward_slack(op_id):
raise ValueError
self._start_times[op_id] += time
def _remove_delays(self) -> None:
delay_list = self._sfg.find_by_type_name(Delay.type_name())
while delay_list:
@@ -270,6 +289,7 @@ class Schema:
plt.show()
def _repr_svg_(self):
plt.figure()
self._plot_schedule()
f = io.StringIO()
plt.savefig(f, format='svg')
Loading