diff --git a/src/CGRANode.cpp b/src/CGRANode.cpp index 1efa327..9fe9675 100644 --- a/src/CGRANode.cpp +++ b/src/CGRANode.cpp @@ -377,13 +377,15 @@ bool CGRANode::canOccupy(DFGNode* t_opt, int t_cycle, int t_II) { } bool CGRANode::isOccupied(int t_cycle, int t_II) { - for (int cycle=t_cycle; cycle p: *(m_dfgNodesWithOccupyStatus[cycle])) { - // If DVFS is supported, the entire tile is occupied before the current multi-cycle operation - // completes. Otherwise, the next operation can start before the current one completes. - if (p.second == START_PIPE_OCCUPY or p.second == SINGLE_OCCUPY or m_supportDVFS) { - return true; - } + // Optimization: setDFGNode() has already materialized the DFG node mapping + // across all cycles with II interval (populating cycle, cycle+II, etc.). + // Therefore, checking the specific canonical cycle here is sufficient + // and equivalent to checking the entire loop. + for (pair p: *(m_dfgNodesWithOccupyStatus[t_II + (t_cycle % t_II)])){ + // If DVFS is supported, the entire tile is occupied before the current multi-cycle operation + // completes. Otherwise, the next operation can start before the current one completes. + if (p.second == START_PIPE_OCCUPY or p.second == SINGLE_OCCUPY or m_supportDVFS) { + return true; } } return false;