1 /* Copyright (c) 2012 Massachusetts Institute of Technology
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:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
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
23 #include "model/timing_graph/ElectricalTimingNode.h"
24 #include "model/timing_graph/ElectricalLoad.h"
28 // Set the optical node initial visited num
29 const int ElectricalTimingNode::TIMING_NODE_INIT_VISITED_NUM
= 0;
31 ElectricalTimingNode::ElectricalTimingNode(const String
& instance_name_
, ElectricalModel
* model_
)
32 : m_instance_name_(instance_name_
), m_model_(model_
), m_false_path_(false), m_crit_path_(-1),
33 m_visited_num_(ElectricalTimingNode::TIMING_NODE_INIT_VISITED_NUM
), m_delay_left_(0.0)
35 m_upstream_nodes_
= new vector
<ElectricalTimingNode
*>();
36 m_downstream_nodes_
= new vector
<ElectricalTimingNode
*>();
39 ElectricalTimingNode::~ElectricalTimingNode()
41 delete m_upstream_nodes_
;
42 delete m_downstream_nodes_
;
45 double ElectricalTimingNode::getMaxUpstreamRes() const
49 for(unsigned int i
= 0; i
< m_upstream_nodes_
->size(); ++i
)
51 double res
= m_upstream_nodes_
->at(i
)->getMaxUpstreamRes();
60 double ElectricalTimingNode::getTotalDownstreamCap() const
64 for(unsigned int i
= 0; i
< m_downstream_nodes_
->size(); ++i
)
66 cap_sum
+= m_downstream_nodes_
->at(i
)->getTotalDownstreamCap();
72 vector
<ElectricalTimingNode
*>* ElectricalTimingNode::getUpstreamNodes() const
74 return m_upstream_nodes_
;
77 vector
<ElectricalTimingNode
*>* ElectricalTimingNode::getDownstreamNodes() const
79 return m_downstream_nodes_
;
82 const String
& ElectricalTimingNode::getInstanceName() const
84 return m_instance_name_
;
87 ElectricalModel
* ElectricalTimingNode::getModel()
92 bool ElectricalTimingNode::isDriver() const
97 bool ElectricalTimingNode::isNet() const
102 bool ElectricalTimingNode::isLoad() const
108 const ElectricalModel
* ElectricalTimingNode::getModel() const
110 return (const ElectricalModel
*) m_model_
;
113 void ElectricalTimingNode::addDownstreamNode(ElectricalTimingNode
* node_
)
115 m_downstream_nodes_
->push_back(node_
);
116 node_
->m_upstream_nodes_
->push_back(this);
120 void ElectricalTimingNode::setFalsePath(bool false_path_
)
122 m_false_path_
= false_path_
;
126 bool ElectricalTimingNode::getFalsePath() const
128 return m_false_path_
;
132 //-------------------------------------------------------------------------
133 // Functions for delay optimization
134 //-------------------------------------------------------------------------
135 // By default, electrical timing nodes cannot be sized up/down
136 bool ElectricalTimingNode::hasMaxDrivingStrength() const
141 bool ElectricalTimingNode::hasMinDrivingStrength() const
146 void ElectricalTimingNode::increaseDrivingStrength()
151 void ElectricalTimingNode::decreaseDrivingStrength()
155 //-------------------------------------------------------------------------
157 //-------------------------------------------------------------------------
158 // Node variables for critical path delay calculations
159 //-------------------------------------------------------------------------
160 void ElectricalTimingNode::setCritPath(int crit_path_
)
162 m_crit_path_
= crit_path_
;
166 int ElectricalTimingNode::getCritPath() const
171 void ElectricalTimingNode::setVisitedNum(int visited_num_
)
173 m_visited_num_
= visited_num_
;
177 int ElectricalTimingNode::getVisitedNum() const
179 return m_visited_num_
;
182 void ElectricalTimingNode::setDelayLeft(double delay_left_
)
184 m_delay_left_
= delay_left_
;
187 double ElectricalTimingNode::getDelayLeft() const
189 return m_delay_left_
;
191 //-------------------------------------------------------------------------