00001
00002
00003
00004
00005
00006
00007
00008
00009 #if !defined(oagTimerPeepHole_P)
00010 #define oagTimerPeepHole_P
00011
00012 #include <vector>
00013 #include <map>
00014 #include <algorithm>
00015 #include <iostream>
00016
00017 #include "oaDesignDB.h"
00018 #include "oagTimerSensitivity.h"
00019 #include "oagTimerUtil.h"
00020 #include "oagTimerModel.h"
00021 #include "oagTimerTimer.h"
00022 #include "oagTimerCellData.h"
00023 #include "oagTimerDesignTool.h"
00024
00025 namespace oagTimer{
00026
00027 using namespace oa;
00028 using namespace std;
00029
00030 typedef map<oaModInst*,double> BoundingMap;
00031 typedef map<oaOccInstTerm*,double> InstTermMap;
00032
00033 struct swapData{
00034 oaModInst* inst;
00035 float currentLeakageSum;
00036 float prospectiveLeakageSum;
00037 };
00038
00039 typedef vector<swapData> swapVector;
00040 typedef vector<CellType> CellVector;
00041
00042 class PeepHole {
00044
00045
00046
00047
00048
00049
00050
00051 public:
00052
00053 PeepHole(oaDesign *d,Timer* t, int lvl);
00054 ~PeepHole();
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 bool isPowerImprove();
00066 void reverseAllSizing();
00067 bool bestConfigExist();
00068 double minNetLeakage;
00069 void saveBestConfig();
00070 void reloadBestSizing();
00071
00072
00073
00074
00075
00076
00077
00078
00079 int set(oaModInst* i);
00080 int set(oaModInst* i, instVector f);
00081
00088 void setFeasibleFanout(CellData *cell, float prevLeakage);
00089
00096 bool commitFeasibleCandidates(float prevRootLeakage);
00097
00098 oaModInst* getRoot();
00099 instVector getFanouts();
00100 float getLeakage();
00101
00102 void update();
00103
00104 void print();
00105 private:
00106 void initCellData();
00107
00108 void clear();
00109
00110 void printList(oaString s,vector<oaString> list);
00111 private:
00112 oaDesign *design;
00113 Timer* timing;
00114
00116 oaModInst* root;
00118 instVector fanouts;
00120 double leakage_sum;
00121 float subNetLeakage;
00122 float feasibleNetLeakage;
00123
00125 swapVector feasibleSwaps;
00126
00128 map<oaModInst*,oaString> existingLibMasterMap;
00129 map<oaModInst*,oaString> minLeakageConfig;
00130
00132 bool empty;
00133 bool valid;
00134 int foLvl;
00135 vector<oaModInst*> currModInsts;
00136 };
00137
00138 }
00139 #endif