oagTimerDesignTool.h

Go to the documentation of this file.
00001 /************************************************************
00002 * 
00003 * File: oagTimerDesignTool.h
00004 * Author: Santiago Mok (smok@ee.ucla.edu)
00005 * Created: 07-08-2010
00006 * Last Modified: Wed 02 Mar 2011 07:20:39 PM PST
00007 *
00008 ************************************************************/
00009 #if !defined(oagTimerDesignTool_P)
00010 #define oagTimerDesignTool_P
00011 
00012 #include "oaDesignDB.h"
00013 #include "oagTimerCellData.h"
00014 #include "oagTimerModel.h"
00015 #include "oagTimerUtil.h"
00016 #include "oagTimerLibParserInt.h"
00017 
00018 #include <vector>
00019 #include <algorithm>
00020 #include <math.h>
00021 
00022 namespace oagTimer{
00023 /*---------------------------------------------------------*/
00024 using namespace oa;
00025 using namespace std;
00026 /*---------------------------------------------------------*/
00027 /* Structure contain:
00028  * 1) Cell instance
00029  * 2) Min of all input slack of current inst
00030  */
00031 struct instTimingData{ 
00032     oaModInst* inst;
00033     DelayType out_Slack;
00034     DelayType out_Slew;
00035     int downSizeable;
00036     double fanoutWeight;
00037 };
00038 struct sensitivityData{
00039     oaOccInst* inst;
00040     oaString otherLibCellSize;
00041     double sensitivity;
00042 };
00043 /*---------------------------------------------------------*/
00044 static bool incr_slack_sort (instTimingData a, instTimingData b){
00045     if(a.out_Slack < b.out_Slack)
00046         return true;
00047     else
00048         return false;
00049 }
00050 /*---------------------------------------------------------*/
00051 static bool decr_slack_sort (instTimingData a, instTimingData b){
00052     if(a.out_Slack > b.out_Slack)
00053         return true;
00054     else
00055         return false;
00056 }
00057 /*---------------------------------------------------------*/
00058 static bool incr_slew_sort (instTimingData a, instTimingData b){
00059     if(a.out_Slew < b.out_Slew)
00060         return true;
00061     else
00062         return false;
00063 }
00064 /*---------------------------------------------------------*/
00065 static bool decr_slew_sort (instTimingData a, instTimingData b){
00066     if(a.out_Slew > b.out_Slew)
00067         return true;
00068     else
00069         return false;
00070 }
00071 /*---------------------------------------------------------*/
00072 static bool incr_fanoutWeight_sort (instTimingData a, instTimingData b){
00073     if(a.fanoutWeight < b.fanoutWeight)
00074         return true;
00075     else
00076         return false;
00077 }
00078 /*---------------------------------------------------------*/
00079 static bool decr_fanoutWeight_sort (instTimingData a, instTimingData b){
00080     if(a.fanoutWeight > b.fanoutWeight)
00081         return true;
00082     else
00083         return false;
00084 }
00085 /*---------------------------------------------------------*/
00086 static bool decr_netWeight_sort (netData a, netData b){
00087     if(a.weight > b.weight)
00088         return true;
00089     else
00090         return false;
00091 }
00092 /*---------------------------------------------------------*/
00093 class DesignTool{
00094   public: 
00095     /* Order the mod instance in the 
00096      * design reverse topologically
00097      * @param oaDesign*
00098      * @param Timer*
00099      * @return vector<oaModInst*>
00100      */
00101     static vector<oaModInst*> getReverseTopological(oaDesign* design, Timer *timer);   
00102     /* Order the mod instance in the 
00103      * design topologically
00104      * @param oaDesign*
00105      * @param Timer*
00106      * @return vector<oaModInst*>
00107      */
00108     static vector<oaModInst*> getTopological(oaDesign* design, Timer *timer);   
00109     static void buildTopologicalDesign(vector<oaModInst*> &insts, vector<oaModNet*> nets);
00110 
00111     static vector<instTimingData> getIncreasingSlack(oaDesign *design,Timer *timer);
00112     static vector<instTimingData> getDecreasingSlack(oaDesign *design,Timer *timer);
00113     static vector<instTimingData> getDecreasingSlew(oaDesign *design,Timer *timer);
00114     static vector<instTimingData> getDecreasingFanoutWeight(oaDesign *design, Timer *timer, int level);
00115     static vector<instTimingData> getDecreasingFanoutSlack(oaDesign *design, Timer *timer, int level);
00116 
00117     static vector<instTimingData> getDecreasingFanoutGain(oaDesign *design, Timer *timer, int level);
00119     static void getNetWeight(oaDesign *design,Timer *timer);
00120     static void traverseForwardTopologically(vector<oaOccInst*> &insts,vector<oaOccNet*> nets,
00121             Timer* timer);
00122     static void traverseBackwardTopologically(vector<oaOccInst*> &insts, Timer* timer);
00123     static double computeWeight(oaOccInstTerm* iTerm, Timer* t);
00124     static double getPrevTermWeightSum(oaOccInstTerm* iTerm);
00125 
00126     static vector<oaModTerm*> getAllModPI(oaDesign* design);
00127     static vector<oaOccTerm*> getAllOccPI(oaDesign* design);
00128     static vector<oaModTerm*> getAllModPO(oaDesign* design);
00129     static vector<oaOccTerm*> getAllOccPO(oaDesign* design);
00130 
00131     static vector<oaModNet*> getInputNets(oaModInst *inst);
00132     static vector<oaOccNet*> getInputNets(oaOccInst *inst);
00133     static oaModNet* getOutputNet(oaModInst *inst);
00134     static oaOccNet* getOutputNet(oaOccInst *inst);
00135 
00136     static void getFanins(oaModInst* head, vector<oaModInst*> &insts, int lvl);
00137     static void getFanouts(oaModInst* head, vector<oaModInst*> &insts, int lvl);
00138     static double getFanoutWeight(instTimingData &data, oaModInst* inst,int level);
00139     static double getFanoutSlack(oaDesign *top, Timer *timer, oaModInst* inst, int level);
00140     static double getFanoutGain(oaDesign *top, Timer *timer, oaModInst* inst, double upDelta, int level);
00141     static int getMaxDepth(oaDesign *design);
00142     static void getDepth(oaModInst* inst,int curr, int &max);
00143     static bool isPO(oaModNet* net);
00144     static oaOccInst* getOccInst(oaDesign* design, oaModInst *inst);
00145     static oaOccInstTerm* getOccInstTerm(oaDesign *design, oaModInstTerm *instT);
00146     static vector<oaOccInstTerm*> getOccInInstTerm(oaOccInst *inst);
00147     static oaOccInstTerm* getOccOutInstTerm(oaOccInst *inst);
00148     static DelayType getMinSlack(oaDesign* design, Timer* timer, oaModInst* inst);
00149     static DelayType getMaxSlew(oaDesign* design, Timer* timer, oaModInst* inst);
00150 
00154     static oaModule* getCellTopMod(oaString name);
00155     static int getGateCount(oaDesign *des);
00156     static void checkFLAGS(oaDesign *d);
00157     static std::string getBlockName(oaOccObject *oPtr);
00158   private:
00159     static void initDesign(oaDesign *design);
00160     static bool allInPinValid(oaOccNet *net);
00161     static void printSensitivityList(vector<sensitivityData> vec);
00162 };
00163 }
00164 #endif

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