oagTimerCellData.h

Go to the documentation of this file.
00001 /************************************************************
00002 * 
00003 * File: oagTimerCellData.h
00004 * Author: Santiago Mok (smok@ee.ucla.edu)
00005 * Created: 05-18-2010
00006 * Last Modified: Mon 04 Apr 2011 12:03:00 PM PDT
00007 *
00008 ************************************************************/
00009 #if !defined(oagTimerCellData_P)
00010 #define oagTimerCellData_P
00011 
00012 #include <list>
00013 
00014 #include "oaDesignDB.h"
00015 #include "oagTimerCellMaster.h"
00016 #include "oagTimerUtil.h"
00017 #include "oagTimerLibParserInt.h"
00018 //#include "lpSA.h"
00019 #include <map>
00020 
00021 namespace oagTimer{
00022 /*---------------------------------------------------------*/
00023 typedef enum {
00024     CURRENT_SIZE, //Set signal to no change
00025     DOWN_SIZE,  //Signal to reduce cell strength
00026     UP_SIZE,   //Signal to increase cell strength
00027     ALL_SIZE,  //Signal to try all cell strengths
00028     NULL_SIZE
00029 } sizingSignal;
00030 /*---------------------------------------------------------*/
00031 typedef list<oaString> Lib_list;
00032 /*---------------------------------------------------------*/
00033 using namespace std;
00034 using namespace oa;
00035 /*---------------------------------------------------------*/
00036 struct netData{ 
00037     oaModNet *net;
00038     double discount;
00039     double forward_weight;
00040     double backward_weight;
00041     double weight;
00042 };
00043 
00044 class CellData{
00045     friend class DuetSensitivity;
00046     friend class DesignTool;
00047     friend class Opt;
00048     friend class PeepHole;
00049     friend class Timer;
00050     friend class lpSA;
00051     friend class sensInfo;
00052     friend class Util;
00053     friend class kickMove;
00054     friend class LR;
00055     friend class DP;
00056     friend class OptMinDelay;
00057     friend class SubTimer;
00058 
00059   public:
00060     CellData(){
00061         _signal = NULL_SIZE;
00062         dnCount = upCount = 0;
00063         index = 0;
00064         valid = false;
00065         isMark = false;
00066         revTopFlag = false;
00067         fanoutSensitivity = -1.0; //(< 0) to indicate a value has not been set yet
00068         unsetNode();
00069     }
00070     ~CellData(){}
00071 
00073     oaOccInst *occInst;
00075     oaModInst *inst;
00077     oaString instName;
00079     CellMaster *master;
00080   private:
00082     sizingSignal _signal;
00084     Lib_list::iterator lib_this_ptr;
00088     Lib_list::iterator lib_seek_ptr;
00092     Lib_list::iterator lib_temp_ptr;
00094     Lib_list cell_sizes;
00096     bool valid;
00097 
00099     bool isRoot;
00101     bool isFanout;
00103     bool isMark;
00107     double fanoutSensitivity;
00108 
00110     int dnCount;
00112     int upCount;
00113 
00115     int index;
00116 
00118     bool revTopFlag;
00119 
00121     bool isMultiFanin;
00122 
00123 
00125     map<oaModInstTerm*,int> inputTerms;
00126     map<oaModInstTerm*,int> outputTerms;
00127 
00129     map<oaModInstTerm*,netData> inputTermsNetMap;
00130     //map<oaModInstTerm*,netData> outputTermsNetMap;
00131 /*---------------------------------------------------------*/
00133   public:
00135     void initSizing(sizingSignal s);
00139     void clearSizingSignals(){ 
00140         _signal == NULL_SIZE; 
00141         lib_seek_ptr = cell_sizes.end();
00142     }
00146     void swap(oaString cellName);
00150     void reverseSwap();
00154     void commitSwap();
00155     void commitSwap(oaModInst* new_inst);
00156     //Unset flag to indicate that this gate is not anymore in size change
00157     void unsetSwapFlag();
00159     void resetLibListPtr();
00160 
00162     vector<oaString> getAllSizes();
00164     vector<oaString> getOtherSizes();
00166     vector<oaString> getGreaterThanCurrentSize();
00168     vector<oaString> getLessThanCurrentSize();
00170     oaString getMinSize(); 
00172     oaString getMaxSize(); 
00174     int getDownSizeCount();
00176     int getUpSizeCount();
00180     int getNumOfSizes();
00182     oaString getNextSize();
00184     bool hasMoreSize(); 
00186     bool hasMoreDownSize(); 
00187     bool hasMoreUpSize(); 
00189     bool isMaxSize();
00191     bool isMinSize();
00192 
00194     void mark(oaModInstTerm* i);
00196     bool isAllInputMark();
00197 
00199     void setForwardWeight(oaModInstTerm* iTerm, double val,double d);
00201     void setBackwardWeight(double val);
00202 
00204     double getNetWeightSum();
00206     double getBackwardWeight(oaModInstTerm* iTerm);
00207 
00209     bool isRootNode();
00211     void setRootNode();
00213     bool isFanoutNode();
00215     void setFanoutNode();
00216     
00225     bool validFanoutSensitivity(double sensitivity, double delta);
00226 
00232     void setFanoutSensitivity(double sensitivity);
00233 
00235     void printTimingData(oaDesign* top, Timer* t);
00236 
00237   private:
00239     void addOtherSizes(); 
00240 
00241     void updateLibSeekPtr();
00242 
00244     static bool increasing_strengths(oaString a, oaString b){
00245         oaString a_base, b_base;
00246         double a_size, b_size;
00247         Util::parseLibCellName(a, a_base, a_size);
00248         Util::parseLibCellName(b, b_base, b_size);
00249         if(a_size < b_size) return true;
00250         else return false;
00251     }
00255     bool isDiffThanCurrSize();
00256 
00258     void unsetNode();
00259 /*---------------------------------------------------------*/
00261   private:
00262     static oaVoidPointerAppDef<oaModInst> *_instAppDef;
00263 
00265     static void initAppDefs();
00266     
00274     static CellData *create(oaOccInst *oci);
00275 
00281     static CellData *get(oaModInst *inst);
00282 /*---------------------------------------------------------*/
00283 };//class
00284 
00285 typedef CellData CellType;
00286 }//namespace
00287 #endif

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