From d1cde303a460672b1228cfc26cbe93daaeab1348 Mon Sep 17 00:00:00 2001
From: Simon Bjurek <simbj106@student.liu.se>
Date: Thu, 30 Jan 2025 14:14:56 +0100
Subject: [PATCH] solved previous bug, now possible to schedule for different
 execution times, next step will be to write automatic tests

---
 b_asic/scheduler.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/b_asic/scheduler.py b/b_asic/scheduler.py
index b17b4842..cc4086d9 100644
--- a/b_asic/scheduler.py
+++ b/b_asic/scheduler.py
@@ -1,3 +1,4 @@
+import sys
 from abc import ABC, abstractmethod
 from collections import defaultdict
 from typing import TYPE_CHECKING, Optional, cast
@@ -181,8 +182,6 @@ class EarliestDeadlineScheduler(Scheduler):
             Schedule to apply the scheduling algorithm on.
         """
 
-        # TODO: Solve bug where operation (ADD) is scheduled before proceeding (MUL) -> pipelining
-
         ALAPScheduler().apply_scheduling(schedule)
 
         # move all inputs ASAP to ensure correct operation
@@ -211,7 +210,6 @@ class EarliestDeadlineScheduler(Scheduler):
 
                 # update available operators
                 for operation, ready_time in used_resources_ready_times.items():
-                    print(ready_time, current_time)
                     if ready_time == current_time:
                         remaining_resources[operation.type_name()] += 1
                 # remaining_resources = self._max_resources.copy()
@@ -255,6 +253,9 @@ class EarliestDeadlineScheduler(Scheduler):
                         source_end_times[op_id],
                         schedule.start_times[source_op.graph_id] + source_op.latency,
                     )
+                    # ensure that the source is already scheduled
+                    if source_op.graph_id in remaining_ops:
+                        source_end_times[op_id] = sys.maxsize
 
             # check resource constraints
             if operation.type_name() in remaining_resources:
-- 
GitLab