Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

Annealer.h

Go to the documentation of this file.
00001 /**************************************************************************
00002 ***    
00003 *** Copyright (c) 1995-2000 Regents of the University of California,
00004 ***               Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan,
00006 ***               Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov
00007 ***
00008 ***  Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
00009 ***  Original Affiliation:   UCLA, Computer Science Department,
00010 ***                          Los Angeles, CA 90095-1596 USA
00011 ***
00012 ***  Permission is hereby granted, free of charge, to any person obtaining 
00013 ***  a copy of this software and associated documentation files (the
00014 ***  "Software"), to deal in the Software without restriction, including
00015 ***  without limitation 
00016 ***  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00017 ***  and/or sell copies of the Software, and to permit persons to whom the 
00018 ***  Software is furnished to do so, subject to the following conditions:
00019 ***
00020 ***  The above copyright notice and this permission notice shall be included
00021 ***  in all copies or substantial portions of the Software.
00022 ***
00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00030 ***
00031 ***
00032 ***************************************************************************/
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 // 040607 hhchan added dummy base class "BaseAnnealer"
00043 //               void go() -> virtual bool go() [.h and .cxx]
00044 
00045 #ifndef ANNEALER_H
00046 #define ANNEALER_H
00047 
00048 #include "FPcommon.h"
00049 #include "DB.h"
00050 #include "SeqPair.h"
00051 #include "SPeval.h"
00052 #include "AnalytSolve.h"
00053 #include "baseannealer.h"
00054 #include "VoltageIsland.h"
00055 
00056 #include <fstream>
00057 #include <vector>
00058 #include <algorithm>
00059 #include <cmath>
00060 #include <cstdlib>
00061 using namespace std;
00062 
00063 namespace parquetfp
00064 {
00065    class Command_Line;
00066    class Annealer : public BaseAnnealer
00067    {
00068    protected:
00069       SeqPair *const _sp;
00070       SPeval *const _spEval;
00071   
00072       vector<Point> sortedXSlacks;
00073       vector<Point> sortedYSlacks;
00074 
00075       Annealer()
00076          : BaseAnnealer(), _sp(NULL), _spEval(NULL) {}
00077 
00078    public:
00079       Annealer(const Command_Line *const params, DB *const db);
00080 
00081       virtual ~Annealer();
00082       void parseConfig();
00083 
00084       virtual bool go();
00085       void anneal();
00086       virtual bool packOneBlock() { return true; }
00087 
00088       virtual void compactSoln();  // compacts current (init/final) soln
00089       virtual void takePlfromDB(); // takeSPformDB() + eval()
00090       void takeSPfromDB();         // converts the present pl to a seq-pair
00091   
00092       void eval();       // just evaluate the current SP and set up required
00093                          // data structures and values
00094       void evalSlacks(); // evaluate slacks
00095       void evalCompact(bool whichDir); // just evaluate the current SP with
00096                                        // compaction and set up required data
00097                                        // structures and values
00098 
00099       //SetOfVoltages makeIslands(vector<unsigned>& tempX, vector<unsigned>& tempY);
00100           void makeIslands(SetOfVoltages* islandSet,vector<unsigned>& tempX, vector<unsigned>& tempY);
00101 
00102       int makeMove(vector<unsigned>& tempX,
00103                    vector<unsigned>& tempY);
00104       int makeMoveSlacks(vector<unsigned>& tempX,
00105                          vector<unsigned>& tempY);
00106       int makeMoveSlacksOrient(vector<unsigned>& A, vector<unsigned>& B,
00107                                unsigned& index,               
00108                                parquetfp::ORIENT& oldOrient,  
00109                                parquetfp::ORIENT& newOrient); 
00110       int makeMoveOrient(unsigned& index,
00111                          parquetfp::ORIENT& oldOrient,
00112                          parquetfp::ORIENT& newOrient);
00113       int makeARMove(vector<unsigned>& A, vector<unsigned>& B,
00114                      double currAR);
00115       int makeSoftBlMove(const vector<unsigned>& A, const vector<unsigned>& B,
00116                          unsigned &index,
00117                          double &newWidth, double &newHeight);
00118       int makeIndexSoftBlMove(const vector<unsigned>& A, const vector<unsigned>& B,
00119                               unsigned index,
00120                               double &newWidth, double &newHeight);
00121 
00122       int makeHPWLMove(vector<unsigned>& tempX, vector<unsigned>& tempY);
00123       int makeARWLMove(vector<unsigned>& tempX, vector<unsigned>& tempY, 
00124                        double currAR);
00125 
00126       void sortSlacks(vector<Point>& sortedXSlacks,
00127                       vector<Point>& sortedYSlacks);
00128 
00129       double getXSize(); // requires that spEvaluations be done earlier
00130       double getYSize(); // requires that spEvaluations be done earlier
00131 
00132       int packSoftBlocks(unsigned numIter); // need to update DB after this
00133       void updatePlacement(); // update the placement of DB with spEval info
00134    };
00135 
00136    // used for std::sort function to sort slacks
00137    struct sort_slacks
00138    {
00139       bool operator()(Point pt1, Point pt2)
00140          {
00141             return (pt1.x < pt2.x);
00142          }
00143    };
00144 } // using namespace parquetfp;
00145 
00146 #endif 

Generated on Mon Apr 25 01:09:23 2005 for Parquete by doxygen 1.3.2