.. _program_listing_file_src_sta_HSPartitionFlow.h: Program Listing for File HSPartitionFlow.h ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/sta/HSPartitionFlow.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include #include "../partition/defs.h" #include "../partition/parallel_hashmap/phmap.h" #include "HSStaBase.h" #include "HSTimingSlackRange.h" using phmap::flat_hash_map; namespace HSFullTiming { // lihaoyuan add struct edge_info { int from_node; int to_node; int net; // // 大图转小图功能过渡期变量:板间顶层新增port名称 // string bottom_port; // string from_port; // string to_port; }; class HSTimingLocalData; class HSTimingEdge; class HSCutOnlyFlow; class HSCutNetFlow; // The HSPartitionNet struct represents a net within a partitioned timing graph. // It stores information about the partitions connected by the net and the // corresponding edge IDs. struct HSPartitionNet { // A vector of partition IDs that this net connects. // The first element is typically considered the driver partition. vector m_parts; // first is driver node // A vector of edge IDs associated with the connections between partitions in // m_parts. The size of m_edgeIds should be m_parts.size() - 1. vector m_edgeIds; // m_parts.size() - 1 should equal m_edgeIds.size() }; // The HSPartitionFlow class manages the overall static timing analysis flow // for a partitioned design. It inherits from HSStaBase to leverage common STA // functionalities and orchestrates the analysis across different partitions // using HSTimingLocalData. class HSPartitionFlow : public HSStaBase { public: // Default constructor. HSPartitionFlow(); // Virtual destructor. Ensures proper cleanup of allocated HSPartitionNet and // HSTimingLocalData objects. virtual ~HSPartitionFlow(); // Cleans up data related to partitions, including nets and local timing data. void cleanPartition(); void cleanOurPartition(); void deleteOurLocalData(int index); // Parses the input files or data that describe the partitioned design and // its timing characteristics. // @param dInputs A string representing the path to input data or the data // itself. // @return An integer status code (typically 0 for success). int parseInput(const string &dInputs); // Overrides the pure virtual function from HSStaBase. // Builds the local timing data for each partition. // @return An integer status code. virtual int buildLocalData(); string trim(const string &str); // daiyt: 建立LocalData HSTimingLocalData *buildLocalData(const vector &partInfo); // daiyt: 拷贝LocalData HSTimingLocalData *cloneOurLocalData(int index); // 前K条路径融合 void mergeEdgePaths(vector &mergePaths, const string &folder, int k, float mergeRatio); // Prints a report of timing paths for edges to the specified output // directory. // @param dOutDir The directory where the report files will be written. // @param printNum The number of paths to print per edge or a similar // controlling parameter. // @return An integer status code. int printEdgePathReport(const std::string &timing_aware_dOutDir, const string &dOutDir, int printNum); // print output dir int expandPaths(const string &time, vector &pathDataAll); // daiyt: 获取EdgePaths void getEdgePaths(vector &edgePaths) const; // lihaoyuan:获取割边上的时序路径 int getEdgePathReport(const vector &edgeIds, vector &path); // get or set data functions // Gets the number of hyper-nodes (which could represent partitions or major // blocks) in the design. // @return The number of hyper-nodes. int getHyperNodeNum() const; // daiyt: 传入一个timingpath返回一个对应的json对象 json getTimingPaths(vector pathDataAll) const; static bool initSlackRange(int slack_range) { return HSFullTiming::initSlackRange(slack_range); } static bool setSlackRange(int slack_range) { return HSFullTiming::setSlackRange(slack_range); } // daiyt: 获取slack range int getSlackRange() { return HSFullTiming::getSlackRange(); } // lihaoyuan:获取普通边的映射关系 int setEdgeInfos(); // peichunyan added start int setPin2Edge(); // int setInsPaths(); bool hasLocalDatas() const { return !m_localDatas.empty(); }; vector get_m_outerEdgeAll() const { return m_outerEdgeAll; }; vector get_m_netAll() const { return m_netAll; }; const vector &getNetAll() const { return m_netAll; } const vector &getEdge2NetId() const { return m_edge2NetId; } vector get_m_clkAll() const { return m_clkAll; } const vector> &get_edgeInfos() const { return edgeInfos; } const flat_hash_map, int> &get_pin2Edge() const { return pin2Edge; } void setEdgePortNames(int edgeId, const string &fromPort, const string &toPort); vector get_m_localDatas() const { return m_localDatas; } vector get_m_ourLocalDatas() const { return m_ourLocalDatas; } vector> get_ins_paths() const { return ins_paths; } flat_hash_map get_m_insPin_net() const { return m_insPin_net; } HSTimingLocalData *getOurLocalData(int index) const { if (index < 0 || index >= m_ourLocalDatas.size()) { return nullptr; } return m_ourLocalDatas[index]; } HSTimingLocalData *addOneLocalData(); int paramCal(flat_hash_map>> &net_insPin_set, flat_hash_map, pinSlack> &pin_minslack, const bool &has_mul_clock_domains, const shared_ptr &clockAttr, const float &maximum_clock_period); void storeClockAttr(shared_ptr &clockAttr, bool &has_mul_clock_domains); // peichunyan added end void printTopkMinSlack(HSTimingLocalData *oneLocal, int k); void getTopkCutPaths(vector &cutPaths, HSTimingLocalData *oneLocal, int k); void dumpTopkCutPaths(HSTimingLocalData *oneLocal, int k, const std::string &filepath); private: friend class HSCutOnlyFlow; friend class HSCutNetFlow; void buildEdge2NetId(); // The number of hyper-nodes (partitions) in the design. int m_hyperNodeNum = 0; // A vector storing pointers to all HSPartitionNet objects, representing the // connectivity between partitions. vector m_netAll; // edgeId -> netId 映射,可被所有 localData 共享。 vector m_edge2NetId; // A vector storing pointers to HSTimingLocalData objects, one for each // partition, managing the timing information local to that partition. vector m_localDatas; vector m_ourLocalDatas; // added by peicy vector> edgeInfos; flat_hash_map, int> pin2Edge; vector> ins_paths; flat_hash_map m_insPin_net; }; } // namespace HSFullTiming