ElectricalTimingTree.h revision 10447:a465576671d4
1#ifndef __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
2#define __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
3
4#include <vector>
5
6#include "util/CommonType.h"
7#include "model/timing_graph/ElectricalTimingNode.h"
8
9namespace DSENT
10{
11    using std::vector;
12
13    class ElectricalDriver;
14
15    class ElectricalTimingTree
16    {
17        public:
18            // The visited number for the next timing run. This needs to be
19            // global because several timing trees may be created to evaluate
20            // a single timing path, causing problems
21            static int msTreeNum;
22
23        public:
24            // Construct timing tree that watches over model_
25            ElectricalTimingTree(const String& instance_name_, ElectricalModel* model_);
26            ~ElectricalTimingTree();
27
28        public:
29            // Get tree name
30            const String& getInstanceName() const;
31
32            // A wrapper for extractCritPathDelay
33            // Update the tree num before do extract critical path delay recursively
34            double performCritPathExtract(ElectricalTimingNode* node_);
35            // Calculate the delay of the marked critical path from a starting node
36            double calculateCritPathDelay(ElectricalTimingNode* node_) const;
37            // Calculate the transition at a node
38            double calculateNodeTransition(ElectricalTimingNode* node_) const;
39            // Returns the optimal node to optimize timing (by sizing up) in the critical
40            // path to reduce critical path delay
41            ElectricalTimingNode* findNodeForTimingOpt(ElectricalTimingNode* node_) const;
42            // Perform incremental timing optimization to guarantee that all timing paths from a
43            // starting node meets a required delay
44            // Return false if the timing optimization fails to meet the required delay
45            bool performTimingOpt(ElectricalTimingNode* node_, double required_delay_);
46
47            // Return the model
48            ElectricalModel* getModel();
49
50        private:
51            // Disable the use of copy constructor
52            ElectricalTimingTree(const ElectricalTimingTree& graph_);
53
54            // Recursively calculate delay from a starting node, finding and marking the
55            // critical path along the way and returns the delay of the critical path
56            double extractCritPathDelay(ElectricalTimingNode* node_);
57
58        public:
59            // Set the sequence number of the timing tree
60            static void setTreeNum(int tree_num_);
61            static int getTreeNum();
62
63        private:
64            // Name of the timing tree
65            const String m_instance_name_;
66            // A pointer to the model that contains this node
67            ElectricalModel* m_model_;
68
69    }; // class ElectricalTimingTree
70} // namespace DSENT
71
72#endif // __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
73
74