ElectricalTimingNode.h revision 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 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 126