oagTimerPeepHole.h

Go to the documentation of this file.
00001 /************************************************************
00002 * 
00003 * File: oagTimerPeepHole.h
00004 * Author: Santiago Mok (smok@ee.ucla.edu)
00005 * Created: 01-24-2010
00006 * Last Modified: Thu 23 Sep 2010 11:34:38 AM PDT
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   /*private: 
00045     CellType *root;
00046     CellVector fanouts;
00047     double totalLeakagePower;
00048     double sizeability;
00049     int fanoutLevel;
00050     */
00051   public:
00052     //PeepHole();
00053     PeepHole(oaDesign *d,Timer* t, int lvl);
00054     ~PeepHole();
00055 
00056     /*CellType getRoot();
00057     CellVector getFanouts();
00058     double getLeakagePower();
00059     double getSizeability();
00060   private:
00061     void setLeakagePower();
00062     bool isFeasible();
00063     bool create(CellType *r, int lvl);
00064     */
00065     bool isPowerImprove();
00066     void reverseAllSizing();
00067     bool bestConfigExist();
00068     double minNetLeakage;
00069     void saveBestConfig();
00070     void reloadBestSizing();
00071     
00072     /* Set the current PeepHole object with 
00073      * the given root node (and fanout nodes)
00074      * and set the evaluation fanout timing
00075      * @return - 0: no error
00076      *           1: not a valid peephole 
00077      *        (reason: root already mark as fanout, viceversa, etc);
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     //Debug
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 };//class
00137 /*---------------------------------------------------------*/
00138 }//namespace
00139 #endif

Generated on Thu Aug 25 14:24:05 2011 by  doxygen 1.3.9.1