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_TECH_TECH_MODEL_H__
2310447Snilay@cs.wisc.edu#define __DSENT_TECH_TECH_MODEL_H__
2410447Snilay@cs.wisc.edu
2510447Snilay@cs.wisc.edu#include <vector>
2610447Snilay@cs.wisc.edu#include <set>
2710447Snilay@cs.wisc.edu
2810447Snilay@cs.wisc.edu#include "libutil/Config.h"
2910447Snilay@cs.wisc.edu#include "libutil/String.h"
3010447Snilay@cs.wisc.edu
3110447Snilay@cs.wisc.edunamespace DSENT
3210447Snilay@cs.wisc.edu{
3310447Snilay@cs.wisc.edu    class StdCellLib;
3410447Snilay@cs.wisc.edu
3510447Snilay@cs.wisc.edu    using std::set;
3610447Snilay@cs.wisc.edu    using std::vector;
3710447Snilay@cs.wisc.edu    using LibUtil::String;
3810447Snilay@cs.wisc.edu
3910448Snilay@cs.wisc.edu    class TechModel
4010447Snilay@cs.wisc.edu    {
4110447Snilay@cs.wisc.edu        public:
4210447Snilay@cs.wisc.edu            typedef std::set<String>::const_iterator ConstWireLayerIterator;
4310447Snilay@cs.wisc.edu
4410447Snilay@cs.wisc.edu        public:
4510447Snilay@cs.wisc.edu            TechModel();
4610447Snilay@cs.wisc.edu            virtual ~TechModel();
4710447Snilay@cs.wisc.edu
4810447Snilay@cs.wisc.edu        public:
4910448Snilay@cs.wisc.edu            // Get the value_ corresponding to the key_
5010448Snilay@cs.wisc.edu            const String& get(const String& key_) const;
5110448Snilay@cs.wisc.edu
5210447Snilay@cs.wisc.edu            // Set the pointer to a standard cell library
5310447Snilay@cs.wisc.edu            void setStdCellLib(const StdCellLib* std_cell_lib_);
5410447Snilay@cs.wisc.edu            // Get the pointer to the standard cell library
5510447Snilay@cs.wisc.edu            const StdCellLib* getStdCellLib() const;
5610447Snilay@cs.wisc.edu
5710447Snilay@cs.wisc.edu            // Return a cloned copy of this instance
5810447Snilay@cs.wisc.edu            virtual TechModel* clone() const;
5910447Snilay@cs.wisc.edu            // Override readFile function to include multiple technology files
6010447Snilay@cs.wisc.edu            virtual void readFile(const String& filename_);
6110447Snilay@cs.wisc.edu
6210447Snilay@cs.wisc.edu            // Transistor
6310447Snilay@cs.wisc.edu            // Returns the leakage current of NMOS transistors, given the transistor stakcing, transistor widths, and input combination
6410447Snilay@cs.wisc.edu            double calculateNmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const;
6510447Snilay@cs.wisc.edu            double calculateNmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const;
6610447Snilay@cs.wisc.edu            // Returns the leakage current of PMOS transistors, given the transistor stakcing, transistor widths, and input combination
6710447Snilay@cs.wisc.edu            double calculatePmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const;
6810447Snilay@cs.wisc.edu            double calculatePmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const;
6910447Snilay@cs.wisc.edu            // Returns the leakage current, given the transistor stakcing, transistor widths, input combination,
7010447Snilay@cs.wisc.edu            // and technology information (vdd, subthreshold swing, subthreshold dibl swing)
7110447Snilay@cs.wisc.edu            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;
7210447Snilay@cs.wisc.edu
7310447Snilay@cs.wisc.edu            // Wire
7410447Snilay@cs.wisc.edu            // Check if the wire layer exist
7510447Snilay@cs.wisc.edu            bool isWireLayerExist(const String& layer_name_) const;
7610447Snilay@cs.wisc.edu            const std::set<String>* getAvailableWireLayers() const;
7710447Snilay@cs.wisc.edu            // Return wire capacitance for given wire layer, wire width, wire spacing, and wire length
7810447Snilay@cs.wisc.edu            double calculateWireCapacitance(const String& layer_name_, double width_, double spacing_, double length_) const;
7910447Snilay@cs.wisc.edu            // Return wire resistance for given wire layer, wire width, and wire length
8010447Snilay@cs.wisc.edu            double calculateWireResistance(const String& layer_name_, double width_, double length_) const;
8110447Snilay@cs.wisc.edu
8210447Snilay@cs.wisc.edu        private:
8310447Snilay@cs.wisc.edu            // Private copy constructor. Use clone to perform copy operation
8410447Snilay@cs.wisc.edu            TechModel(const TechModel& tech_model_);
8510447Snilay@cs.wisc.edu
8610447Snilay@cs.wisc.edu        private:
8710447Snilay@cs.wisc.edu            // A pointer to a standard cell library
8810447Snilay@cs.wisc.edu            const StdCellLib* m_std_cell_lib_;
8910447Snilay@cs.wisc.edu            // A set of available wire layers
9010447Snilay@cs.wisc.edu            std::set<String>* m_available_wire_layers_;
9110448Snilay@cs.wisc.edu            // A map of model's parameters
9210448Snilay@cs.wisc.edu            std::map<String, String> params;
9310447Snilay@cs.wisc.edu    }; // class TechModel
9410447Snilay@cs.wisc.edu} // namespace DSENT
9510447Snilay@cs.wisc.edu
9610447Snilay@cs.wisc.edu#endif // __DSENT_TECH_TECH_MODEL_H__
97