1 /* Copyright (c) 2012 Massachusetts Institute of Technology
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 #ifndef __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
23 #define __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
27 #include "util/CommonType.h"
28 #include "model/timing_graph/ElectricalTimingNode.h"
34 class ElectricalDriver
;
36 class ElectricalTimingTree
39 // The visited number for the next timing run. This needs to be
40 // global because several timing trees may be created to evaluate
41 // a single timing path, causing problems
45 // Construct timing tree that watches over model_
46 ElectricalTimingTree(const String
& instance_name_
, ElectricalModel
* model_
);
47 ~ElectricalTimingTree();
51 const String
& getInstanceName() const;
53 // A wrapper for extractCritPathDelay
54 // Update the tree num before do extract critical path delay recursively
55 double performCritPathExtract(ElectricalTimingNode
* node_
);
56 // Calculate the delay of the marked critical path from a starting node
57 double calculateCritPathDelay(ElectricalTimingNode
* node_
) const;
58 // Calculate the transition at a node
59 double calculateNodeTransition(ElectricalTimingNode
* node_
) const;
60 // Returns the optimal node to optimize timing (by sizing up) in the critical
61 // path to reduce critical path delay
62 ElectricalTimingNode
* findNodeForTimingOpt(ElectricalTimingNode
* node_
) const;
63 // Perform incremental timing optimization to guarantee that all timing paths from a
64 // starting node meets a required delay
65 // Return false if the timing optimization fails to meet the required delay
66 bool performTimingOpt(ElectricalTimingNode
* node_
, double required_delay_
);
69 ElectricalModel
* getModel();
72 // Disable the use of copy constructor
73 ElectricalTimingTree(const ElectricalTimingTree
& graph_
);
75 // Recursively calculate delay from a starting node, finding and marking the
76 // critical path along the way and returns the delay of the critical path
77 double extractCritPathDelay(ElectricalTimingNode
* node_
);
80 // Set the sequence number of the timing tree
81 static void setTreeNum(int tree_num_
);
82 static int getTreeNum();
85 // Name of the timing tree
86 const String m_instance_name_
;
87 // A pointer to the model that contains this node
88 ElectricalModel
* m_model_
;
90 }; // class ElectricalTimingTree
93 #endif // __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__