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 23#include "model/timing_graph/ElectricalNet.h" 24#include "model/timing_graph/ElectricalLoad.h" 25 26namespace DSENT 27{ 28 //------------------------------------------------------------------------- 29 // Electrical Net 30 //------------------------------------------------------------------------- 31 32 ElectricalNet::ElectricalNet(const String& instance_name_, ElectricalModel* model_) 33 : ElectricalTimingNode(instance_name_, model_), m_distributed_res_(0), m_distributed_cap_(0) 34 { 35 36 } 37 38 ElectricalNet::~ElectricalNet() 39 { 40 41 } 42 43 double ElectricalNet::calculateDelay() const 44 { 45 // Remember that this is a pi model, delay is distributed cap * distributed_res / 2 + 46 // distributed res * (other downstream caps) 47 return 0.693 * (getTotalDownstreamCap() - m_distributed_cap_ / 2) * m_distributed_res_; 48 } 49 50 double ElectricalNet::calculateTransition() const 51 { 52 return 1.386 * getMaxUpstreamRes() * (m_distributed_cap_ * 0.2 + ElectricalTimingNode::getTotalDownstreamCap()); 53 } 54 55 double ElectricalNet::getMaxUpstreamRes() const 56 { 57 return m_distributed_res_ + ElectricalTimingNode::getMaxUpstreamRes(); 58 } 59 60 double ElectricalNet::getTotalDownstreamCap() const 61 { 62 return m_distributed_cap_ + ElectricalTimingNode::getTotalDownstreamCap(); 63 } 64 65 void ElectricalNet::setDistributedCap(double distributed_cap_) 66 { 67 m_distributed_cap_ = distributed_cap_; 68 return; 69 } 70 71 void ElectricalNet::setDistributedRes(double distributed_res_) 72 { 73 m_distributed_res_ = distributed_res_; 74 return; 75 } 76 77 double ElectricalNet::getDistributedCap() const 78 { 79 return m_distributed_cap_; 80 } 81 82 double ElectricalNet::getDistributedRes() const 83 { 84 return m_distributed_res_; 85 } 86 87 bool ElectricalNet::isNet() const 88 { 89 return true; 90 } 91 92} // namespace DSENT 93 94 95