TechModel.h (10447:a465576671d4) TechModel.h (10448:bc1a3b7ab5ef)
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
1#ifndef __DSENT_TECH_TECH_MODEL_H__
2#define __DSENT_TECH_TECH_MODEL_H__
3
4#include <vector>
5#include <set>
6
7#include "libutil/Config.h"
8#include "libutil/String.h"
9
10namespace DSENT
11{
12 class StdCellLib;
13
14 using std::set;
15 using std::vector;
16 using LibUtil::String;
17
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
18 class TechModel : public LibUtil::Config
39 class TechModel
19 {
20 public:
21 typedef std::set<String>::const_iterator ConstWireLayerIterator;
22
23 public:
24 TechModel();
25 virtual ~TechModel();
26
27 public:
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
28 // Set the pointer to a standard cell library
29 void setStdCellLib(const StdCellLib* std_cell_lib_);
30 // Get the pointer to the standard cell library
31 const StdCellLib* getStdCellLib() const;
32
33 // Return a cloned copy of this instance
34 virtual TechModel* clone() const;
35 // Override readFile function to include multiple technology files
36 virtual void readFile(const String& filename_);
37
38 // Transistor
39 // Returns the leakage current of NMOS transistors, given the transistor stakcing, transistor widths, and input combination
40 double calculateNmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const;
41 double calculateNmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const;
42 // Returns the leakage current of PMOS transistors, given the transistor stakcing, transistor widths, and input combination
43 double calculatePmosLeakageCurrent(unsigned int num_stacks_, double uni_stacked_mos_width_, unsigned int input_vector_) const;
44 double calculatePmosLeakageCurrent(unsigned int num_stacks_, const vector<double>& stacked_mos_widths_, unsigned int input_vector_) const;
45 // Returns the leakage current, given the transistor stakcing, transistor widths, input combination,
46 // and technology information (vdd, subthreshold swing, subthreshold dibl swing)
47 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;
48
49 // Wire
50 // Check if the wire layer exist
51 bool isWireLayerExist(const String& layer_name_) const;
52 const std::set<String>* getAvailableWireLayers() const;
53 // Return wire capacitance for given wire layer, wire width, wire spacing, and wire length
54 double calculateWireCapacitance(const String& layer_name_, double width_, double spacing_, double length_) const;
55 // Return wire resistance for given wire layer, wire width, and wire length
56 double calculateWireResistance(const String& layer_name_, double width_, double length_) const;
57
58 private:
59 // Private copy constructor. Use clone to perform copy operation
60 TechModel(const TechModel& tech_model_);
61
62 private:
63 // A pointer to a standard cell library
64 const StdCellLib* m_std_cell_lib_;
65 // A set of available wire layers
66 std::set<String>* m_available_wire_layers_;
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;
67 }; // class TechModel
68} // namespace DSENT
69
70#endif // __DSENT_TECH_TECH_MODEL_H__
93 }; // class TechModel
94} // namespace DSENT
95
96#endif // __DSENT_TECH_TECH_MODEL_H__
71