ElectricalTimingNode.h (10447:a465576671d4) ElectricalTimingNode.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_NODE_H__
2#define __DSENT_MODEL_ELECTRICAL_TIMING_NODE_H__
3
4#include "util/CommonType.h"
5
6namespace DSENT
7{
8 class ElectricalModel;
9
10 class ElectricalTimingNode
11 {
12 public:
13 // The starting visited number flag of all timing nodes
14 static const int TIMING_NODE_INIT_VISITED_NUM;
15
16 public:
17 ElectricalTimingNode(const String& instance_name_, ElectricalModel* model_);
18 virtual ~ElectricalTimingNode();
19
20 public:
21
22 // Calculate the delay this node contributes
23 virtual double calculateDelay() const = 0;
24 // Calculate the transition at this node
25 virtual double calculateTransition() const = 0;
26 // get maximum of upstream drive resistance
27 virtual double getMaxUpstreamRes() const;
28 // get total amount of downstream load capacitance
29 virtual double getTotalDownstreamCap() const;
30 // Return instance name
31 const String& getInstanceName() const;
32 // get upstream timing nodes
33 vector<ElectricalTimingNode*>* getUpstreamNodes() const;
34 // get downstream timing nodes
35 vector<ElectricalTimingNode*>* getDownstreamNodes() const;
36 // Connect a downstream timing node
37 void addDownstreamNode(ElectricalTimingNode* node_);
38 // Return the node's parent model
39 ElectricalModel* getModel();
40 const ElectricalModel* getModel() const;
41 // Set/get false path marker
42 void setFalsePath(bool false_path_);
43 bool getFalsePath() const;
44
45 virtual bool isDriver() const;
46 virtual bool isNet() const;
47 virtual bool isLoad() const;
48
49
50 //-----------------------------------------------------------------
51 // Functions for delay optimization
52 //-----------------------------------------------------------------
53 // Return true if the instance has minimum driving strength
54 virtual bool hasMinDrivingStrength() const;
55 // Return true if the instance has maximum driving strength
56 virtual bool hasMaxDrivingStrength() const;
57 // Increase driving strength index by 1
58 virtual void increaseDrivingStrength();
59 // Decrease driving strength index by 1
60 virtual void decreaseDrivingStrength();
61 //-----------------------------------------------------------------
62
63 //-----------------------------------------------------------------
64 // Node variables for critical path delay calculations
65 //-----------------------------------------------------------------
66 // Critical path marker
67 void setCritPath(int crit_path_);
68 int getCritPath() const;
69 // Visited parity marker
70 void setVisitedNum(int visited_parity_);
71 int getVisitedNum() const;
72 // Delay left in this path
73 void setDelayLeft(double delay_left_);
74 double getDelayLeft() const;
75 //-----------------------------------------------------------------
76
77
78 private:
79 // Disable copy constructor
80 ElectricalTimingNode(const ElectricalTimingNode& node_);
81
82 private:
83 // Name of this instance
84 String m_instance_name_;
85 // A pointer to the model that contains this node
86 ElectricalModel* m_model_;
87 // Upstream electrical nets
88 vector<ElectricalTimingNode*>* m_upstream_nodes_;
89 // Downstream electrical nets
90 vector<ElectricalTimingNode*>* m_downstream_nodes_;
91 // False path marker
92 bool m_false_path_;
93 // Critical path index (to next downstream node)
94 int m_crit_path_;
95 // Odd / even path visited (so that you don't have to clear it)
96 int m_visited_num_;
97 // The amount of delay left to the end of the timing path
98 double m_delay_left_;
99 };
100
101} // namespace DSENT
102
103#endif // __DSENT_MODEL_ELECTRICAL_TIMING_NODE_H__
104
22#ifndef __DSENT_MODEL_ELECTRICAL_TIMING_NODE_H__
23#define __DSENT_MODEL_ELECTRICAL_TIMING_NODE_H__
24
25#include "util/CommonType.h"
26
27namespace DSENT
28{
29 class ElectricalModel;
30
31 class ElectricalTimingNode
32 {
33 public:
34 // The starting visited number flag of all timing nodes
35 static const int TIMING_NODE_INIT_VISITED_NUM;
36
37 public:
38 ElectricalTimingNode(const String& instance_name_, ElectricalModel* model_);
39 virtual ~ElectricalTimingNode();
40
41 public:
42
43 // Calculate the delay this node contributes
44 virtual double calculateDelay() const = 0;
45 // Calculate the transition at this node
46 virtual double calculateTransition() const = 0;
47 // get maximum of upstream drive resistance
48 virtual double getMaxUpstreamRes() const;
49 // get total amount of downstream load capacitance
50 virtual double getTotalDownstreamCap() const;
51 // Return instance name
52 const String& getInstanceName() const;
53 // get upstream timing nodes
54 vector<ElectricalTimingNode*>* getUpstreamNodes() const;
55 // get downstream timing nodes
56 vector<ElectricalTimingNode*>* getDownstreamNodes() const;
57 // Connect a downstream timing node
58 void addDownstreamNode(ElectricalTimingNode* node_);
59 // Return the node's parent model
60 ElectricalModel* getModel();
61 const ElectricalModel* getModel() const;
62 // Set/get false path marker
63 void setFalsePath(bool false_path_);
64 bool getFalsePath() const;
65
66 virtual bool isDriver() const;
67 virtual bool isNet() const;
68 virtual bool isLoad() const;
69
70
71 //-----------------------------------------------------------------
72 // Functions for delay optimization
73 //-----------------------------------------------------------------
74 // Return true if the instance has minimum driving strength
75 virtual bool hasMinDrivingStrength() const;
76 // Return true if the instance has maximum driving strength
77 virtual bool hasMaxDrivingStrength() const;
78 // Increase driving strength index by 1
79 virtual void increaseDrivingStrength();
80 // Decrease driving strength index by 1
81 virtual void decreaseDrivingStrength();
82 //-----------------------------------------------------------------
83
84 //-----------------------------------------------------------------
85 // Node variables for critical path delay calculations
86 //-----------------------------------------------------------------
87 // Critical path marker
88 void setCritPath(int crit_path_);
89 int getCritPath() const;
90 // Visited parity marker
91 void setVisitedNum(int visited_parity_);
92 int getVisitedNum() const;
93 // Delay left in this path
94 void setDelayLeft(double delay_left_);
95 double getDelayLeft() const;
96 //-----------------------------------------------------------------
97
98
99 private:
100 // Disable copy constructor
101 ElectricalTimingNode(const ElectricalTimingNode& node_);
102
103 private:
104 // Name of this instance
105 String m_instance_name_;
106 // A pointer to the model that contains this node
107 ElectricalModel* m_model_;
108 // Upstream electrical nets
109 vector<ElectricalTimingNode*>* m_upstream_nodes_;
110 // Downstream electrical nets
111 vector<ElectricalTimingNode*>* m_downstream_nodes_;
112 // False path marker
113 bool m_false_path_;
114 // Critical path index (to next downstream node)
115 int m_crit_path_;
116 // Odd / even path visited (so that you don't have to clear it)
117 int m_visited_num_;
118 // The amount of delay left to the end of the timing path
119 double m_delay_left_;
120 };
121
122} // namespace DSENT
123
124#endif // __DSENT_MODEL_ELECTRICAL_TIMING_NODE_H__
125