00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
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();
00089 virtual void takePlfromDB();
00090 void takeSPfromDB();
00091
00092 void eval();
00093
00094 void evalSlacks();
00095 void evalCompact(bool whichDir);
00096
00097
00098
00099
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();
00130 double getYSize();
00131
00132 int packSoftBlocks(unsigned numIter);
00133 void updatePlacement();
00134 };
00135
00136
00137 struct sort_slacks
00138 {
00139 bool operator()(Point pt1, Point pt2)
00140 {
00141 return (pt1.x < pt2.x);
00142 }
00143 };
00144 }
00145
00146 #endif