.. _program_listing_file_src_sta_HSStaBase.h: Program Listing for File HSStaBase.h ==================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/sta/HSStaBase.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include #include #include #include #include #include #include using std::forward_list; using std::list; using std::make_pair; using std::map; using std::pair; using std::set; using std::vector; #include "HSGraphClock.h" #include "HSOuterEdge.h" namespace HSFullTiming { // The HSStaBase class is a base class for static timing analysis. // It provides common data structures and methods for performing STA. class HSStaBase { public: // Default constructor. HSStaBase(); // Virtual destructor to ensure proper cleanup of derived classes. virtual ~HSStaBase(); // Cleans up the base data structures. virtual void cleanBase(); // Builds information about the next objects in the timing graph. // @return An integer status code. int buildNextObjInfo(); // count paths int pathCount(); // Pure virtual function to build local data for derived classes. // @return An integer status code. virtual int buildLocalData() = 0; // get or set data functions // Sets the cut delay, which is an additional delay for outer edges. // @param cutDelay The cut delay value. static void setCutDelay(float cutDelay); // Gets all outer edges in the timing graph. // @return A constant reference to a vector of HSOuterEdge pointers. const vector &getOuterEdge() const; // Gets the next data for all outer edges. // Each element in the vector corresponds to an outer edge, and the // forward_list contains pairs of (object ID, delay) for the next objects. // @return A constant reference to a vector of forward_lists. const vector>> &getNextData() const; // Gets the previous data for all outer edges. // Each element in the vector corresponds to an outer edge, and the // forward_list contains pairs of (object ID, delay) for the previous objects. // @return A constant reference to a vector of forward_lists. const vector>> &getPreData() const; // Gets the next data for a specific outer edge ID. // @param id The ID of the outer edge. // @return A constant reference to a forward_list of (object ID, delay) pairs. const forward_list> &getNextData(int id) const; // Gets the previous data for a specific outer edge ID. // @param id The ID of the outer edge. // @return A constant reference to a forward_list of (object ID, delay) pairs. const forward_list> &getPreData(int id) const; // Gets the mapping from clocks to next data. // The map stores HSGraphClock pointers as keys and forward_lists of (object // ID, delay) pairs as values, representing the next objects driven by each // clock. // @return A constant reference to the map. const map>> &getClk2NextData() const; // Gets the mapping from clocks to previous data. // The map stores HSGraphClock pointers as keys and forward_lists of (object // ID, delay) pairs as values, representing the previous objects related to // each clock. // @return A constant reference to the map. const map>> &getClk2PreData() const; // Gets node2edgeIds const vector> &getNode2EdgeIds() const; // Gets the cut delay value. // @return The cut delay value. float getCutDelay() const; // Gets the maximum level in the timing graph. // @return The maximum level. int getMaxLevel() const; // The timingpath struct represents a path in the timing graph. struct timingpath { // A forward_list of edge IDs that make up the timing path. forward_list m_edgeIdList; // Adds an edge ID to the end of the m_edgeIdList. // @param id The ID of the edge to add. void emplace_backEdgeId(int id); // pop the edgeId of the end of the edgeIdList void pop_backEdgeId(); // The ID of the clock associated with this timing path. int m_clkId = -1; // The slack of the timing path. Initialized to the maximum float value. float m_slack = FLT_MAX; // The number of hops (edges) in the timing path. int m_hop = 0; // Comparison operator for sorting timing paths. // @param another The other timingpath to compare against. // @return True if this timingpath is less than the other, false otherwise. bool operator<(const timingpath &another) const; // Checks if this timingpath is the same as another. // @param another The other timingpath to compare against. // @return True if the timing paths are the same, false otherwise. bool isSame(const timingpath &another); // Static boolean flag used for sorting paths during merging. static bool m_bSortForMerge; // Static pointer to the HSStaBase object, used for accessing context within // timingpath methods. static HSStaBase *m_staFlow; // ------------------------------------------------------------------------- // Added by peicy on 20250718, used for sorting ins_paths. // Note: pathId is different before and after sorting/merging. int pathId = 0; // add slackPre, slackPost, edgeId float slackPre = 0; float slackPost = 0; int edgeId = 0; }; protected: // The maximum level in the timing graph. int m_maxLevel = 0; // A vector containing all outer edges in the timing graph. vector m_outerEdgeAll; // A vector where each element is a forward_list representing the next objects // connected to an outer edge. The pair contains (object ID, delay). vector>> m_outerEdge2next; // A vector where each element is a forward_list representing the previous // objects connected to an outer edge. The pair contains (object ID, delay). vector>> m_outerEdge2pre; // A map that stores the relationship between clocks and their next objects. // The key is a pointer to an HSGraphClock object, and the value is a // forward_list of (object ID, delay) pairs. map>> m_clk2next; // A map that stores the relationship between clocks and their previous // objects. The key is a pointer to an HSGraphClock object, and the value is a // forward_list of (object ID, delay) pairs. map>> m_clk2pre; // A vector containing all clocks in the timing graph. vector m_clkAll; // Static member representing an additional delay for outer edges. static float m_cutDelay; // addition delay of outerEdge // 存储每个节点连接的edgeId vector> m_node2edgeIds; }; } // namespace HSFullTiming