ElectricalTimingNode.cc revision 10447:a465576671d4
1 2#include "model/timing_graph/ElectricalTimingNode.h" 3#include "model/timing_graph/ElectricalLoad.h" 4 5namespace DSENT 6{ 7 // Set the optical node initial visited num 8 const int ElectricalTimingNode::TIMING_NODE_INIT_VISITED_NUM = 0; 9 10 ElectricalTimingNode::ElectricalTimingNode(const String& instance_name_, ElectricalModel* model_) 11 : m_instance_name_(instance_name_), m_model_(model_), m_false_path_(false), m_crit_path_(-1), 12 m_visited_num_(ElectricalTimingNode::TIMING_NODE_INIT_VISITED_NUM), m_delay_left_(0.0) 13 { 14 m_upstream_nodes_ = new vector<ElectricalTimingNode*>(); 15 m_downstream_nodes_ = new vector<ElectricalTimingNode*>(); 16 } 17 18 ElectricalTimingNode::~ElectricalTimingNode() 19 { 20 delete m_upstream_nodes_; 21 delete m_downstream_nodes_; 22 } 23 24 double ElectricalTimingNode::getMaxUpstreamRes() const 25 { 26 double max_res = 0.0; 27 28 for(unsigned int i = 0; i < m_upstream_nodes_->size(); ++i) 29 { 30 double res = m_upstream_nodes_->at(i)->getMaxUpstreamRes(); 31 if(max_res < res) 32 { 33 max_res = res; 34 } 35 } 36 return max_res; 37 } 38 39 double ElectricalTimingNode::getTotalDownstreamCap() const 40 { 41 double cap_sum = 0; 42 43 for(unsigned int i = 0; i < m_downstream_nodes_->size(); ++i) 44 { 45 cap_sum += m_downstream_nodes_->at(i)->getTotalDownstreamCap(); 46 } 47 48 return cap_sum; 49 } 50 51 vector<ElectricalTimingNode*>* ElectricalTimingNode::getUpstreamNodes() const 52 { 53 return m_upstream_nodes_; 54 } 55 56 vector<ElectricalTimingNode*>* ElectricalTimingNode::getDownstreamNodes() const 57 { 58 return m_downstream_nodes_; 59 } 60 61 const String& ElectricalTimingNode::getInstanceName() const 62 { 63 return m_instance_name_; 64 } 65 66 ElectricalModel* ElectricalTimingNode::getModel() 67 { 68 return m_model_; 69 } 70 71 bool ElectricalTimingNode::isDriver() const 72 { 73 return false; 74 } 75 76 bool ElectricalTimingNode::isNet() const 77 { 78 return false; 79 } 80 81 bool ElectricalTimingNode::isLoad() const 82 { 83 return false; 84 } 85 86 87 const ElectricalModel* ElectricalTimingNode::getModel() const 88 { 89 return (const ElectricalModel*) m_model_; 90 } 91 92 void ElectricalTimingNode::addDownstreamNode(ElectricalTimingNode* node_) 93 { 94 m_downstream_nodes_->push_back(node_); 95 node_->m_upstream_nodes_->push_back(this); 96 return; 97 } 98 99 void ElectricalTimingNode::setFalsePath(bool false_path_) 100 { 101 m_false_path_ = false_path_; 102 return; 103 } 104 105 bool ElectricalTimingNode::getFalsePath() const 106 { 107 return m_false_path_; 108 } 109 110 111 //------------------------------------------------------------------------- 112 // Functions for delay optimization 113 //------------------------------------------------------------------------- 114 // By default, electrical timing nodes cannot be sized up/down 115 bool ElectricalTimingNode::hasMaxDrivingStrength() const 116 { 117 return true; 118 } 119 120 bool ElectricalTimingNode::hasMinDrivingStrength() const 121 { 122 return true; 123 } 124 125 void ElectricalTimingNode::increaseDrivingStrength() 126 { 127 return; 128 } 129 130 void ElectricalTimingNode::decreaseDrivingStrength() 131 { 132 return; 133 } 134 //------------------------------------------------------------------------- 135 136 //------------------------------------------------------------------------- 137 // Node variables for critical path delay calculations 138 //------------------------------------------------------------------------- 139 void ElectricalTimingNode::setCritPath(int crit_path_) 140 { 141 m_crit_path_ = crit_path_; 142 return; 143 } 144 145 int ElectricalTimingNode::getCritPath() const 146 { 147 return m_crit_path_; 148 } 149 150 void ElectricalTimingNode::setVisitedNum(int visited_num_) 151 { 152 m_visited_num_ = visited_num_; 153 return; 154 } 155 156 int ElectricalTimingNode::getVisitedNum() const 157 { 158 return m_visited_num_; 159 } 160 161 void ElectricalTimingNode::setDelayLeft(double delay_left_) 162 { 163 m_delay_left_ = delay_left_; 164 } 165 166 double ElectricalTimingNode::getDelayLeft() const 167 { 168 return m_delay_left_; 169 } 170 //------------------------------------------------------------------------- 171 172} // namespace DSENT 173 174 175