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_TECH_TECH_MODEL_H__ 23#define __DSENT_TECH_TECH_MODEL_H__ 24 25#include <vector> 26#include <set> 27 28#include "libutil/Config.h" 29#include "libutil/String.h" 30 31namespace DSENT 32{ 33 class StdCellLib; 34 35 using std::set; 36 using std::vector; 37 using LibUtil::String; 38 39 class TechModel 40 { 41 public: 42 typedef std::set<String>::const_iterator ConstWireLayerIterator; 43 44 public: 45 TechModel(); 46 virtual ~TechModel(); 47 48 public: 49 // Get the value_ corresponding to the key_ 50 const String& get(const String& key_) const; 51 52 // Set the pointer to a standard cell library 53 void setStdCellLib(const StdCellLib* std_cell_lib_); 54 // Get the pointer to the standard cell library 55 const StdCellLib* getStdCellLib() const; 56 57 // Return a cloned copy of this instance 58 virtual TechModel* clone() const; 59 // Override readFile function to include multiple technology files 60 virtual void readFile(const String& filename_); 61 62 // Transistor 63 // Returns the leakage current of NMOS transistors, given the transistor stakcing, transistor widths, and input combination 64 double calculateNmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const; 65 double calculateNmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const; 66 // Returns the leakage current of PMOS transistors, given the transistor stakcing, transistor widths, and input combination 67 double calculatePmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const; 68 double calculatePmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const; 69 // Returns the leakage current, given the transistor stakcing, transistor widths, input combination, 70 // and technology information (vdd, subthreshold swing, subthreshold dibl swing) 71 double calculateLeakageCurrentFactor(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_, double vdd_, double subthreshold_swing_, double dibl_swing_) const; 72 73 // Wire 74 // Check if the wire layer exist 75 bool isWireLayerExist(const String& layer_name_) const; 76 const std::set<String>* getAvailableWireLayers() const; 77 // Return wire capacitance for given wire layer, wire width, wire spacing, and wire length 78 double calculateWireCapacitance(const String& layer_name_, double width_, double spacing_, double length_) const; 79 // Return wire resistance for given wire layer, wire width, and wire length 80 double calculateWireResistance(const String& layer_name_, double width_, double length_) const; 81 82 private: 83 // Private copy constructor. Use clone to perform copy operation 84 TechModel(const TechModel& tech_model_); 85 86 private: 87 // A pointer to a standard cell library 88 const StdCellLib* m_std_cell_lib_; 89 // A set of available wire layers 90 std::set<String>* m_available_wire_layers_; 91 // A map of model's parameters 92 std::map<String, String> params; 93 }; // class TechModel 94} // namespace DSENT 95 96#endif // __DSENT_TECH_TECH_MODEL_H__ 97