ElectricalTimingTree.h revision 10448
110448Snilay@cs.wisc.edu/* Copyright (c) 2012 Massachusetts Institute of Technology 210448Snilay@cs.wisc.edu * 310448Snilay@cs.wisc.edu * Permission is hereby granted, free of charge, to any person obtaining a copy 410448Snilay@cs.wisc.edu * of this software and associated documentation files (the "Software"), to deal 510448Snilay@cs.wisc.edu * in the Software without restriction, including without limitation the rights 610448Snilay@cs.wisc.edu * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 710448Snilay@cs.wisc.edu * copies of the Software, and to permit persons to whom the Software is 810448Snilay@cs.wisc.edu * furnished to do so, subject to the following conditions: 910448Snilay@cs.wisc.edu * 1010448Snilay@cs.wisc.edu * The above copyright notice and this permission notice shall be included in 1110448Snilay@cs.wisc.edu * all copies or substantial portions of the Software. 1210448Snilay@cs.wisc.edu * 1310448Snilay@cs.wisc.edu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1410448Snilay@cs.wisc.edu * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1510448Snilay@cs.wisc.edu * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1610448Snilay@cs.wisc.edu * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1710448Snilay@cs.wisc.edu * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1810448Snilay@cs.wisc.edu * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 1910448Snilay@cs.wisc.edu * THE SOFTWARE. 2010448Snilay@cs.wisc.edu */ 2110448Snilay@cs.wisc.edu 2210447Snilay@cs.wisc.edu#ifndef __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__ 2310447Snilay@cs.wisc.edu#define __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__ 2410447Snilay@cs.wisc.edu 2510447Snilay@cs.wisc.edu#include <vector> 2610447Snilay@cs.wisc.edu 2710447Snilay@cs.wisc.edu#include "util/CommonType.h" 2810447Snilay@cs.wisc.edu#include "model/timing_graph/ElectricalTimingNode.h" 2910447Snilay@cs.wisc.edu 3010447Snilay@cs.wisc.edunamespace DSENT 3110447Snilay@cs.wisc.edu{ 3210447Snilay@cs.wisc.edu using std::vector; 3310447Snilay@cs.wisc.edu 3410447Snilay@cs.wisc.edu class ElectricalDriver; 3510447Snilay@cs.wisc.edu 3610447Snilay@cs.wisc.edu class ElectricalTimingTree 3710447Snilay@cs.wisc.edu { 3810447Snilay@cs.wisc.edu public: 3910447Snilay@cs.wisc.edu // The visited number for the next timing run. This needs to be 4010447Snilay@cs.wisc.edu // global because several timing trees may be created to evaluate 4110447Snilay@cs.wisc.edu // a single timing path, causing problems 4210447Snilay@cs.wisc.edu static int msTreeNum; 4310447Snilay@cs.wisc.edu 4410447Snilay@cs.wisc.edu public: 4510447Snilay@cs.wisc.edu // Construct timing tree that watches over model_ 4610447Snilay@cs.wisc.edu ElectricalTimingTree(const String& instance_name_, ElectricalModel* model_); 4710447Snilay@cs.wisc.edu ~ElectricalTimingTree(); 4810447Snilay@cs.wisc.edu 4910447Snilay@cs.wisc.edu public: 5010447Snilay@cs.wisc.edu // Get tree name 5110447Snilay@cs.wisc.edu const String& getInstanceName() const; 5210447Snilay@cs.wisc.edu 5310447Snilay@cs.wisc.edu // A wrapper for extractCritPathDelay 5410447Snilay@cs.wisc.edu // Update the tree num before do extract critical path delay recursively 5510447Snilay@cs.wisc.edu double performCritPathExtract(ElectricalTimingNode* node_); 5610447Snilay@cs.wisc.edu // Calculate the delay of the marked critical path from a starting node 5710447Snilay@cs.wisc.edu double calculateCritPathDelay(ElectricalTimingNode* node_) const; 5810447Snilay@cs.wisc.edu // Calculate the transition at a node 5910447Snilay@cs.wisc.edu double calculateNodeTransition(ElectricalTimingNode* node_) const; 6010447Snilay@cs.wisc.edu // Returns the optimal node to optimize timing (by sizing up) in the critical 6110447Snilay@cs.wisc.edu // path to reduce critical path delay 6210447Snilay@cs.wisc.edu ElectricalTimingNode* findNodeForTimingOpt(ElectricalTimingNode* node_) const; 6310447Snilay@cs.wisc.edu // Perform incremental timing optimization to guarantee that all timing paths from a 6410447Snilay@cs.wisc.edu // starting node meets a required delay 6510447Snilay@cs.wisc.edu // Return false if the timing optimization fails to meet the required delay 6610447Snilay@cs.wisc.edu bool performTimingOpt(ElectricalTimingNode* node_, double required_delay_); 6710447Snilay@cs.wisc.edu 6810447Snilay@cs.wisc.edu // Return the model 6910447Snilay@cs.wisc.edu ElectricalModel* getModel(); 7010447Snilay@cs.wisc.edu 7110447Snilay@cs.wisc.edu private: 7210447Snilay@cs.wisc.edu // Disable the use of copy constructor 7310447Snilay@cs.wisc.edu ElectricalTimingTree(const ElectricalTimingTree& graph_); 7410447Snilay@cs.wisc.edu 7510447Snilay@cs.wisc.edu // Recursively calculate delay from a starting node, finding and marking the 7610447Snilay@cs.wisc.edu // critical path along the way and returns the delay of the critical path 7710447Snilay@cs.wisc.edu double extractCritPathDelay(ElectricalTimingNode* node_); 7810447Snilay@cs.wisc.edu 7910447Snilay@cs.wisc.edu public: 8010447Snilay@cs.wisc.edu // Set the sequence number of the timing tree 8110447Snilay@cs.wisc.edu static void setTreeNum(int tree_num_); 8210447Snilay@cs.wisc.edu static int getTreeNum(); 8310447Snilay@cs.wisc.edu 8410447Snilay@cs.wisc.edu private: 8510447Snilay@cs.wisc.edu // Name of the timing tree 8610447Snilay@cs.wisc.edu const String m_instance_name_; 8710447Snilay@cs.wisc.edu // A pointer to the model that contains this node 8810447Snilay@cs.wisc.edu ElectricalModel* m_model_; 8910447Snilay@cs.wisc.edu 9010447Snilay@cs.wisc.edu }; // class ElectricalTimingTree 9110447Snilay@cs.wisc.edu} // namespace DSENT 9210447Snilay@cs.wisc.edu 9310447Snilay@cs.wisc.edu#endif // __DSENT_MODEL_ELECTRICAL_TIMING_TREE_H__ 9410447Snilay@cs.wisc.edu 95