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 #include "FPcommon.h"
00036 #include "Annealer.h"
00037 #include "CommandLine.h"
00038 #include "ABKCommon/paramproc.h"
00039 #include "ABKCommon/infolines.h"
00040 using namespace parquetfp;
00041
00042 int main(int argc, const char *argv[])
00043 {
00044 double currXSize;
00045 double currYSize;
00046 double currArea = -1e100;
00047 double lastArea;
00048 double currWS;
00049 double currWL;
00050 double currWLnoWts;
00051 double currAR=0;
00052
00053 BoolParam help1 ("h", argc, argv);
00054 BoolParam help2 ("help", argc, argv);
00055 NoParams noParams(argc,argv);
00056 Command_Line* params = new Command_Line(argc, argv);
00057 params->printAnnealerParams();
00058 if (noParams.found() || help1.found() || help2.found())
00059 {
00060 cerr<<"This test case test different functionalities\n"
00061 <<"Options \n"
00062 <<"FPEvalTest2.exe\n"
00063 <<"-f baseFileName\n"
00064 <<"-takePl (construct SP from existing floorplan)\n"
00065 <<"-initCompact (compact the initial solution)\n"
00066 <<"-soft (soft blocks in design. pack.)\n"
00067 <<"-plot (plot floorplan)\n"
00068 <<"-save (save in bookshelf floorplan format)\n"
00069 <<"-savePl (save only .pl file)\n"
00070 <<"-saveCapoPl (save .pl in Capo bookshelf format)\n"
00071 <<"-saveCapo (save design in Capo bookshelf format)\n";
00072 exit (0);
00073 }
00074
00075 DB* db = new DB(params->inFileName);
00076 double blocksArea = db->getNodesArea();
00077
00078 Annealer annealer(params, db);
00079 if(params->takePl)
00080 {
00081
00082 annealer.takeSPfromDB();
00083 }
00084
00085 Timer T;
00086 T.stop();
00087 double totalTime=0;
00088 T.start(0.0);
00089 for(unsigned iter=0; iter<10; ++iter)
00090 annealer.eval();
00091 T.stop();
00092 totalTime += T.getUserTime();
00093
00094 currArea = annealer.getXSize()*annealer.getYSize();
00095 annealer.evalSlacks();
00096
00097 if(params->initCompact)
00098 {
00099 bool whichDir = 0;
00100 annealer.evalCompact(whichDir);
00101 do
00102 {
00103 whichDir = !whichDir;
00104 lastArea = currArea;
00105 annealer.takeSPfromDB();
00106 annealer.evalCompact(whichDir);
00107 currArea = annealer.getXSize()*annealer.getYSize();
00108 cout<<currArea<<"\t"<<lastArea<<endl;
00109 }
00110 while(int(currArea) < int(lastArea));
00111 }
00112
00113 if(params->softBlocks)
00114 {
00115 annealer.packSoftBlocks(100);
00116 annealer.updatePlacement();
00117 }
00118
00119 currXSize = annealer.getXSize();
00120 currYSize = annealer.getYSize();
00121 currArea = currXSize*currYSize;
00122 currWS = 100*(currArea - blocksArea)/blocksArea;
00123 currWL = db->evalHPWL();
00124 currWLnoWts = db->evalHPWL(false);
00125 currAR = currXSize/currYSize;
00126
00127 if(params->plot)
00128 {
00129 currAR = currXSize/currYSize;
00130 bool plotSlacks = !params->plotNoSlacks;
00131 bool plotNets = !params->plotNoNets;
00132 bool plotNames = !params->plotNoNames;
00133 db->plot("out.plt", currArea, currWS, currAR, 0,
00134 currWL, plotSlacks, plotNets, plotNames);
00135 }
00136
00137 if(params->save)
00138 db->save(params->baseFile);
00139
00140 if(params->savePl)
00141 db->getNodes()->savePl(params->outPlFile);
00142
00143 if(params->saveCapoPl)
00144 db->getNodes()->saveCapoPl(params->capoPlFile);
00145
00146 if(params->saveCapo)
00147 db->saveCapo(params->capoBaseFile, params->reqdAR);
00148
00149 cout<<"Final Area: "<<currArea<<" WhiteSpace "<<currWS<<"%"
00150 <<" currAR "<<currAR<<" HPWL "<<currWL<<" Unweighted HPWL "
00151 <<currWLnoWts<<endl;
00152 cout<<"Time Taken "<<totalTime<<endl;
00153
00154 return 0;
00155 }