ElectricalTimingNode.h revision 10447:a465576671d4
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
105