diff --git a/b_asic/schedule.py b/b_asic/schedule.py index b2b43931c973a63a089d33eb0ecadec513746a2f..e531676d5b506a765ecb7b459c4d9627bb177f63 100644 --- a/b_asic/schedule.py +++ b/b_asic/schedule.py @@ -262,8 +262,20 @@ class Schedule: raise ValueError(f"No operation with graph_id {graph_id} in schedule") return self.backward_slack(graph_id), self.forward_slack(graph_id) - def print_slacks(self) -> None: - """Print the slack times for all operations in the schedule.""" + def print_slacks(self, order: int = 0) -> None: + """ + Print the slack times for all operations in the schedule. + + Parameters + ---------- + order : int, default: 0 + Sorting order. + + * 0: alphabetical on Graph ID + * 1: backward slack + * 2: forward slack + + """ res = [ ( op.graph_id, @@ -280,7 +292,7 @@ class Schedule: ) for r in res ] - + res.sort(key=lambda tup: tup[order]) print("Graph ID | Backward | Forward") print("---------|----------|---------") for r in res: