ElectricalTimingTree.h (10447:a465576671d4) ElectricalTimingTree.h (10448:bc1a3b7ab5ef)
1/* Copyright (c) 2012 Massachusetts Institute of Technology
2 *
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:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
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
19 * THE SOFTWARE.
20 */
21
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
22#ifndef __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
23#define __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
24
25#include <vector>
26
27#include "util/CommonType.h"
28#include "model/timing_graph/ElectricalTimingNode.h"
29
30namespace DSENT
31{
32 using std::vector;
33
34 class ElectricalDriver;
35
36 class ElectricalTimingTree
37 {
38 public:
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
42 static int msTreeNum;
43
44 public:
45 // Construct timing tree that watches over model_
46 ElectricalTimingTree(const String& instance_name_, ElectricalModel* model_);
47 ~ElectricalTimingTree();
48
49 public:
50 // Get tree name
51 const String& getInstanceName() const;
52
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_);
67
68 // Return the model
69 ElectricalModel* getModel();
70
71 private:
72 // Disable the use of copy constructor
73 ElectricalTimingTree(const ElectricalTimingTree& graph_);
74
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_);
78
79 public:
80 // Set the sequence number of the timing tree
81 static void setTreeNum(int tree_num_);
82 static int getTreeNum();
83
84 private:
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_;
89
90 }; // class ElectricalTimingTree
91} // namespace DSENT
92
93#endif // __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__
94