diff --git a/b_asic/schedule.py b/b_asic/schedule.py index 37e211da33181f16e0a5e8c7f2f6be89acebec55..b88e7aefc1c3ccd4b8314cf85afe8c44996e3450 100644 --- a/b_asic/schedule.py +++ b/b_asic/schedule.py @@ -1089,10 +1089,17 @@ class Schedule: move_y_location set_y_location """ - for i, graph_id in enumerate( - sorted(self._start_times, key=self._start_times.get) - ): + + def sort_key(graph_id): + op = self._sfg.find_by_id(graph_id) + return ( + self._start_times[op.graph_id], + -self._sfg.find_by_id(graph_id).latency, + ) + + for i, graph_id in enumerate(sorted(self._start_times, key=sort_key)): self.set_y_location(graph_id, i) + for graph_id in self._start_times: op = cast(Operation, self._sfg.find_by_id(graph_id)) # Position Outputs and Sinks adjacent to the operation generating them