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;
00047            double currWS;
00048            double currWL;
00049            double currWLnoWts;
00050            double currAR=0;
00051 
00052            BoolParam help1 ("h", argc, argv);
00053            BoolParam help2 ("help", argc, argv);
00054            NoParams  noParams(argc,argv);  
00055            DoubleParam reqdWS_("reqdWS", 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 can plot, save existing floorplans\n"
00061                    <<"Options \n"
00062                    <<"FPEvalTest1.exe\n"
00063                    <<"-f baseFileName\n"
00064                    <<"-takePl   (construct SP from existing floorplan)\n"
00065                    <<"-plot     (plot floorplan)\n"
00066                    <<"-save     (save in bookshelf floorplan format)\n"
00067                    <<"-savePl   (save only .pl file)\n"
00068                    <<"-saveCapoPl (save .pl in Capo bookshelf format)\n"
00069                    <<"-saveCapo (save design in Capo bookshelf format)\n"
00070                    <<"-reqdAR <double>(reqd aspect ratio for the capo layout)\n"
00071                    <<"-reqdWS <double>(reqd whitespace for the capo layout)\n";
00072                exit (0);
00073              }  
00074         
00075            DB* db = new DB(params->inFileName);
00076            double blocksArea = db->getNodesArea();
00077            
00078            if(params->takePl)
00079              {
00080                Annealer annealer(params, db);
00081                annealer.takeSPfromDB();
00082                annealer.eval();
00083                annealer.evalSlacks();
00084              }
00085 
00086            currXSize = db->getXSize();
00087            currYSize = db->getYSize();
00088            currArea = db->evalArea();
00089            currWS = 100*(currArea - blocksArea)/blocksArea;
00090            currWL = db->evalHPWL();
00091            currWLnoWts = db->evalHPWL(false);
00092 
00093            if(params->plot)
00094             {
00095               currAR = currXSize/currYSize;
00096               bool plotSlacks = !params->plotNoSlacks;
00097               bool plotNets = !params->plotNoNets;
00098               bool plotNames = !params->plotNoNames;
00099               db->plot("out.plt", currArea, currWS, currAR, 0, 
00100                         currWL, plotSlacks, plotNets, plotNames);
00101             }
00102             
00103            if(params->savePl)
00104              db->getNodes()->savePl(params->outPlFile);
00105                               
00106            if(params->saveCapoPl)
00107              db->getNodes()->saveCapoPl(params->capoPlFile);
00108 
00109            double reqdWS;
00110            if(reqdWS_.found())
00111              reqdWS = reqdWS_;
00112            else
00113              reqdWS = 30;
00114            if(params->saveCapo)
00115              db->saveCapo(params->capoBaseFile, params->reqdAR, reqdWS);
00116 
00117            if(params->save)
00118              db->save(params->baseFile);
00119 
00120            cout<<"Final Area: "<<currArea<<" WhiteSpace "<<currWS<<"%"
00121                <<" currAR "<<currAR<<" HPWL "<<currWL<<" Unweighted HPWL "
00122                <<currWLnoWts<<endl;
00123            cout<<"blocksArea: "<<blocksArea<<endl; 
00124         return 0;
00125 }