#include "btree.h"
#include "netlist.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
Include dependency graph for debug.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | OutputHardBlockInfoType (ostream &outs, const HardBlockInfoType &blockinfo) |
void | OutputBTree (ostream &outs, const BTree &bt) |
void | OutputBTree (ostream &outs, const vector< BTree::BTreeNode > &tree) |
void | OutputPacking (ostream &outs, const OrientedPacking &pk) |
void | OutputMixedBlockInfoType (ostream &outs, const MixedBlockInfoType &blockinfo) |
void | OutputDouble (ostream &outs, double d) |
void | OutputIndex (ostream &outs, int i) |
void | DebugBits2Tree (int argc, char *argv[]) |
void | DebugEvaluate (int argc, char *argv[]) |
void | DebugSwap (int argc, char *argv[]) |
void | DebugMove (int argc, char *argv[]) |
void | DebugParseBlocks (int argc, char *argv[]) |
void | DebugParseNets (int argc, char *argv[]) |
void | DebugHPWL (int argc, char *argv[]) |
void | DebugCopy (int argc, char *argv[]) |
void | DebugCompact (int argc, char *argv[]) |
void | DebugAnneal (int argc, char *argv[]) |
void | DebugWireAnneal (int argc, char *argv[]) |
void | DebugSSTreeToBTree (int argc, char *argv[]) |
void | DebugParquetBTree (int argc, char *argv[]) |
void | DebugBTreeSlack (int argc, char *argv[]) |
void | DebugMixedPacking (int argc, char *argv[]) |
void | DebugSoftPacking (int argc, char *argv[]) |
void | DebugPltoSP (int argc, char *argv[]) |
void | DebugPltoBTree (int argc, char *argv[]) |
void | DebugPlSPtoBTree (int argc, char *argv[]) |
void | DebugShiftBlock (int argc, char *argv[]) |
void | DebugShiftLegalizer (int argc, char *argv[]) |
void | DebugMixedBlockInfoTypeFromDB (int argc, char *argv[]) |
void | DebugBTreeAnnealerFromDB (int argc, char *argv[]) |
Variables | |
const int | FIELD_WIDTH = 10 |
|
|
|
|
|
Definition at line 131 of file debug.cxx. References BTreeAreaWireAnnealer::currSolution(), BoolParam::found(), NoParams::found(), Timer::getUserTime(), BTreeAreaWireAnnealer::go(), BTree::save_bbb(), Timer::start(), Timer::stop(), BTree::totalHeight(), and BTree::totalWidth().
00132 { 00133 BoolParam help1 ("h", argc, argv); 00134 BoolParam help2 ("help", argc, argv); 00135 NoParams noParams(argc,argv); // this acts as a flag 00136 Command_Line* params = new Command_Line(argc, (const char **)argv); 00137 params->printAnnealerParams(); 00138 00139 if (noParams.found() || help1.found() || help2.found()) 00140 { 00141 params->printHelp(argc, const_cast<const char**>(argv)); 00142 exit (0); 00143 } 00144 00145 Timer T; 00146 T.stop(); 00147 double totalTime=0; 00148 double successTime = 0; 00149 double successAvgWL = 0; 00150 double successAvgArea = 0; 00151 00152 double minArea=1e100; 00153 double minWS=1e100; 00154 double minWL=1e100; 00155 double aveArea=0; 00156 double aveWS=0; 00157 double aveWL=0; 00158 double currArea; 00159 double lastArea; 00160 double currWS; 00161 double currWL; 00162 double currXSize; 00163 double currYSize; 00164 double successAR=0; 00165 00166 for (int i=0; i<params->iterations; i++) 00167 { 00168 DB* db = new DB(params->inFileName); 00169 double blocksArea = db->getNodesArea(); 00170 double reqdArea = (1+(params->maxWS/100))*blocksArea; 00171 double reqdWidth = sqrt(reqdArea*params->reqdAR); 00172 double reqdHeight = reqdWidth/params->reqdAR; 00173 bool gotBetterSol = false; 00174 00175 string blocksfilename(params->inFileName); 00176 blocksfilename += ".blocks"; 00177 MixedBlockInfoType blockinfo(blocksfilename, "blocks"); 00178 00179 T.start(0.0); 00180 BTreeAreaWireAnnealer *annealer_ptr = NULL; 00181 00182 if (!strcmp(argv[argc-1], "--db")) 00183 annealer_ptr = new BTreeAreaWireAnnealer(params, db); 00184 else 00185 annealer_ptr = new BTreeAreaWireAnnealer(blockinfo, params, db); 00186 BTreeAreaWireAnnealer& annealer = *annealer_ptr; 00187 00188 annealer.go(); 00189 annealer.currSolution().save_bbb("dummy_out"); 00190 T.stop(); 00191 00192 totalTime += T.getUserTime(); 00193 currXSize = annealer.currSolution().totalWidth(); // db->getXSize(); 00194 currYSize = annealer.currSolution().totalHeight(); // db->getYSize(); 00195 currArea = currXSize*currYSize; 00196 currWS = 100*(currArea - blocksArea)/blocksArea; // currArea; 00197 currWL = db->evalHPWL(); 00198 aveArea += currArea; 00199 aveWS += currWS; 00200 aveWL += currWL; 00201 if(minArea > currArea) 00202 { 00203 minArea = currArea; 00204 gotBetterSol = true; 00205 } 00206 if(minWS > currWS) 00207 minWS = currWS; 00208 if(minWL > currWL) 00209 minWL = currWL; 00210 00211 if(params->reqdAR != -9999 && ((currArea<=reqdArea && 00212 currXSize<=reqdWidth && currYSize<=reqdHeight) || db->successAR)) 00213 { 00214 ++successAR; 00215 successTime += T.getUserTime(); 00216 successAvgWL += currWL; 00217 successAvgArea += currArea; 00218 } 00219 //plot and save the best solution 00220 00221 if(gotBetterSol) 00222 { 00223 if(params->plot) 00224 { 00225 double currAR = currXSize/currYSize; 00226 bool plotSlacks = !params->plotNoSlacks; 00227 bool plotNets = !params->plotNoNets; 00228 bool plotNames = !params->plotNoNames; 00229 db->plot("out.plt", currArea, currWS, currAR, T.getUserTime(), 00230 currWL, plotSlacks, plotNets, plotNames); 00231 } 00232 if(params->savePl) 00233 db->getNodes()->savePl(params->outPlFile); 00234 00235 if(params->saveCapoPl) 00236 db->getNodes()->saveCapoPl(params->capoPlFile); 00237 00238 if(params->saveCapo) 00239 db->saveCapo(params->capoBaseFile, params->reqdAR); 00240 00241 if(params->save) 00242 db->save(params->baseFile); 00243 00244 //if(db->successAR) 00245 //db->saveBestCopyPl("best.pl"); 00246 } 00247 cout<<endl; 00248 delete annealer_ptr; 00249 } 00250 aveArea /= params->iterations; 00251 aveWS /= params->iterations; 00252 aveWL /= params->iterations; 00253 totalTime /= params->iterations; 00254 successTime /= successAR; 00255 successAvgWL /= successAR; 00256 successAvgArea /= successAR; 00257 successAR /= params->iterations; 00258 00259 cout<<endl<<"Average Area: "<<aveArea<<" Minimum Area: "<<minArea<<endl 00260 <<"Average HPWL: "<<aveWL<<" Minimum HPWL: "<<minWL<<endl 00261 <<"Average WhiteSpace: "<<aveWS<<"%"<<" Minimum WhiteSpace: " 00262 <<minWS<<"%"<<endl 00263 <<"Average Time: "<<totalTime<<endl; 00264 if(params->reqdAR != -9999) 00265 { 00266 cout<<endl<<"Success Rate of satisfying fixed outline: " 00267 <<100*successAR<<" %"<<endl; 00268 cout<<"Average Time for successfull AR runs: "<<successTime<<endl; 00269 cout<<"Average Area for successfull AR runs: "<<successAvgArea<<endl; 00270 cout<<"Average WL for successfull AR runs: "<<successAvgWL<<endl; 00271 } 00272 } |
Here is the call graph for this function:
|
|
|
|
|
|
|
|
|
|
|
Definition at line 274 of file debug.cxx. References OutputMixedBlockInfoType().
00275 { 00276 ifstream infile; 00277 string blocksfilename(argv[1]); 00278 blocksfilename += ".blocks"; 00279 infile.open(blocksfilename.c_str()); 00280 if (!infile.good()) 00281 { 00282 cout << "ERROR: Cannot open file: " << blocksfilename << endl; 00283 exit(1); 00284 } 00285 00286 MixedBlockInfoType blockinfoOne(blocksfilename, "blocks"); 00287 00288 DB db(argv[1]); 00289 MixedBlockInfoTypeFromDB blockinfoTwo(db); 00290 00291 ofstream outfile1("dummy_file"); 00292 ofstream outfile2("dummy_db"); 00293 00294 outfile1.setf(ios::fixed); 00295 outfile1.precision(1); 00296 OutputMixedBlockInfoType(outfile1, blockinfoOne); 00297 00298 outfile2.setf(ios::fixed); 00299 outfile2.precision(1); 00300 OutputMixedBlockInfoType(outfile2, blockinfoTwo); 00301 } |
Here is the call graph for this function:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2024 of file debug.cxx. References FIELD_WIDTH, and OutputIndex().
02026 { 02027 int btree_size = btree.size(); 02028 outs << "btree_size: " << btree_size << endl; 02029 outs << "index: "; 02030 for (int i = 0; i < btree_size; i++) 02031 outs << setw(FIELD_WIDTH) << i; 02032 outs << endl; 02033 02034 outs << "tree.par: "; 02035 for (int i = 0; i < btree_size; i++) 02036 OutputIndex(outs, btree[i].parent); 02037 outs << endl; 02038 02039 outs << "tree.left: "; 02040 for (int i = 0; i < btree_size; i++) 02041 OutputIndex(outs, btree[i].left); 02042 outs << endl; 02043 02044 outs << "tree.right: "; 02045 for (int i = 0; i < btree_size; i++) 02046 OutputIndex(outs, btree[i].right); 02047 outs << endl; 02048 02049 outs << "tree.bkind: "; 02050 for (int i = 0; i < btree_size; i++) 02051 OutputIndex(outs, btree[i].block_index); 02052 outs << endl; 02053 02054 outs << "tree.orien: "; 02055 for (int i = 0; i < btree_size; i++) 02056 OutputIndex(outs, btree[i].orient); 02057 outs << endl; 02058 02059 outs << endl; 02060 02061 } |
Here is the call graph for this function:
|
Definition at line 2063 of file debug.cxx. References BTree::blockArea(), BTree::contour, FIELD_WIDTH, BTree::height(), BTree::NUM_BLOCKS, OutputDouble(), OutputIndex(), BTree::totalArea(), BTree::totalHeight(), BTree::totalWidth(), BTree::tree, BTree::UNDEFINED, BTree::width(), BTree::xloc(), and BTree::yloc().
02065 { 02066 outs << "NUM_BLOCKS: " << bt.NUM_BLOCKS << endl << endl; 02067 outs << "index: "; 02068 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02069 OutputIndex(cout, i); 02070 outs << endl; 02071 02072 outs << "tree.par: "; 02073 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02074 OutputIndex(cout, bt.tree[i].parent); 02075 outs << endl; 02076 02077 outs << "tree.left: "; 02078 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02079 OutputIndex(cout, bt.tree[i].left); 02080 outs << endl; 02081 02082 outs << "tree.right: "; 02083 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02084 OutputIndex(cout, bt.tree[i].right); 02085 outs << endl; 02086 02087 outs << "tree.bkind: "; 02088 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02089 OutputIndex(cout, bt.tree[i].block_index); 02090 outs << endl; 02091 02092 outs << "tree.orien: "; 02093 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02094 OutputIndex(cout, bt.tree[i].orient); 02095 outs << endl; 02096 02097 outs << endl; 02098 02099 outs << "cont.next: "; 02100 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02101 OutputIndex(cout, bt.contour[i].next); 02102 outs << endl; 02103 02104 outs << "cont.prev: "; 02105 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02106 OutputIndex(cout, bt.contour[i].prev); 02107 outs << endl; 02108 02109 outs << "cont.begin: "; 02110 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02111 OutputDouble(outs, bt.contour[i].begin); 02112 outs << endl; 02113 02114 outs << "cont.end: "; 02115 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02116 OutputDouble(outs, bt.contour[i].end); 02117 outs << endl;// while (cin.good()) 02118 02119 outs << "cont.CTL: "; 02120 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02121 OutputDouble(outs, bt.contour[i].CTL); 02122 outs << endl; 02123 02124 outs << endl; 02125 02126 outs << "xloc: "; 02127 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02128 OutputDouble(outs, bt.xloc(i)); 02129 outs << endl; 02130 02131 outs << "yloc: "; 02132 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02133 OutputDouble(outs, bt.yloc(i)); 02134 outs << endl; 02135 02136 outs << "width: "; 02137 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02138 OutputDouble(outs, bt.width(i)); 02139 outs << endl; 02140 02141 outs << "height: "; 02142 for (int i = 0; i < bt.NUM_BLOCKS+2; i++) 02143 OutputDouble(outs, bt.height(i)); 02144 outs << endl; 02145 02146 outs << endl; 02147 02148 outs << "blockArea: " << bt.blockArea() << endl; 02149 outs << "totalArea: " << bt.totalArea() << endl; 02150 outs << "totalWidth: " << bt.totalWidth() << endl; 02151 outs << "totalHeight: " << bt.totalHeight() << endl; 02152 02153 outs << endl; 02154 outs << "-----contour (L to R)-----" << endl; 02155 02156 outs << "index: "; 02157 int cPtr = bt.NUM_BLOCKS; 02158 while (cPtr != BTree::UNDEFINED) 02159 { 02160 outs << setw(FIELD_WIDTH) << cPtr; 02161 cPtr = bt.contour[cPtr].next; 02162 } 02163 outs << endl; 02164 02165 outs << "begin: "; 02166 cPtr = bt.NUM_BLOCKS; 02167 while (cPtr != BTree::UNDEFINED) 02168 { 02169 OutputDouble(cout, bt.contour[cPtr].begin); 02170 cPtr = bt.contour[cPtr].next; 02171 } 02172 outs << endl; 02173 02174 outs << "end: "; 02175 cPtr = bt.NUM_BLOCKS; 02176 while (cPtr != BTree::UNDEFINED) 02177 { 02178 OutputDouble(cout, bt.contour[cPtr].end); 02179 cPtr = bt.contour[cPtr].next; 02180 } 02181 outs << endl; 02182 02183 outs << "CTL: "; 02184 cPtr = bt.NUM_BLOCKS; 02185 while (cPtr != BTree::UNDEFINED) 02186 { 02187 OutputDouble(cout, bt.contour[cPtr].CTL); 02188 cPtr = bt.contour[cPtr].next; 02189 } 02190 outs << endl; 02191 } |
Here is the call graph for this function:
|
Definition at line 2223 of file debug.cxx. References FIELD_WIDTH. Referenced by OutputBTree(), and OutputMixedBlockInfoType().
02224 { 02225 outs.setf(ios::fixed); 02226 outs.precision(1); 02227 if (d >= Dimension::INFTY) 02228 outs << setw(FIELD_WIDTH) << "infty"; 02229 02230 else if (d == Dimension::UNDEFINED) 02231 outs << setw(FIELD_WIDTH) << "-"; 02232 else 02233 outs << setw(FIELD_WIDTH) << d; 02234 } |
|
Definition at line 1996 of file debug.cxx. References HardBlockInfoType::blocknum(), FIELD_WIDTH, and HardBlockInfoType::ORIENT_NUM. Referenced by OutputMixedBlockInfoType().
01998 { 01999 outs << "index: "; 02000 for (int i = 0; i < blockinfo.blocknum()+2; i++) 02001 outs << setw(FIELD_WIDTH) << i; 02002 outs << endl << endl; 02003 02004 for (int j = 0; j < HardBlockInfoType::ORIENT_NUM; j++) 02005 { 02006 outs << "width[" << j << "]: "; 02007 for (int i = 0; i < blockinfo.blocknum()+2; i++) 02008 if (blockinfo[i].width[j] >= Dimension::INFTY) 02009 outs << " infty"; 02010 else 02011 outs << setw(FIELD_WIDTH) << blockinfo[i].width[j]; 02012 outs << endl; 02013 02014 outs << "height[" << j << "]: "; 02015 for (int i = 0; i < blockinfo.blocknum()+2; i++) 02016 if (blockinfo[i].height[j] >= Dimension::INFTY) 02017 outs << " infty"; 02018 else 02019 outs << setw(FIELD_WIDTH) << blockinfo[i].height[j]; 02020 outs << endl << endl; 02021 } 02022 } |
Here is the call graph for this function:
|
Definition at line 2236 of file debug.cxx. References FIELD_WIDTH. Referenced by OutputBTree(), and OutputMixedBlockInfoType().
02237 { 02238 if (i == Dimension::UNDEFINED) 02239 outs << setw(FIELD_WIDTH) << "-"; 02240 else 02241 outs << setw(FIELD_WIDTH) << i; 02242 } |
|
Definition at line 2244 of file debug.cxx. References HardBlockInfoType::block_names, MixedBlockInfoType::blockARinfo, MixedBlockInfoType::currDimensions, FIELD_WIDTH, MixedBlockInfoType::ORIENT_NUM, OutputDouble(), OutputHardBlockInfoType(), and OutputIndex(). Referenced by DebugMixedBlockInfoTypeFromDB().
02246 { 02247 int vec_size = blockinfo.blockARinfo.size(); 02248 02249 outs << "_currDimensions: " << endl; 02250 outs << "name: "; 02251 for (int i = 0; i < vec_size; i++) 02252 { 02253 char name[100]; 02254 sprintf(name, "\"%s\"", 02255 blockinfo.currDimensions.block_names[i].c_str()); 02256 outs << setw(FIELD_WIDTH) << name; 02257 } 02258 outs << endl; 02259 OutputHardBlockInfoType(outs, blockinfo.currDimensions); 02260 outs << endl; 02261 02262 outs << "_blockARinfo: " << endl; 02263 outs.setf(ios::fixed); 02264 outs.precision(2); 02265 outs << "index: "; 02266 for (int i = 0; i < vec_size; i++) 02267 OutputIndex(outs, i); 02268 outs << endl; 02269 for (int j = 0; j < MixedBlockInfoType::ORIENT_NUM; j++) 02270 { 02271 outs << "minAR[" << j << "]: "; 02272 for (int i = 0; i < vec_size; i++) 02273 OutputDouble(outs, blockinfo.blockARinfo[i].minAR[j]); 02274 outs << endl; 02275 outs << "maxAR[" << j << "]: "; 02276 for (int i = 0; i < vec_size; i++) 02277 OutputDouble(outs, blockinfo.blockARinfo[i].maxAR[j]); 02278 outs << endl << endl; 02279 } 02280 outs << "area: "; 02281 for (int i = 0; i < vec_size; i++) 02282 OutputDouble(outs, blockinfo.blockARinfo[i].area); 02283 outs << endl; 02284 02285 outs << "isSoft: "; 02286 for (int i = 0; i < vec_size; i++) 02287 outs << setw(FIELD_WIDTH) 02288 << ((blockinfo.blockARinfo[i].isSoft)? "SOFT" : "HARD"); 02289 outs << endl; 02290 } |
Here is the call graph for this function:
|
Definition at line 2193 of file debug.cxx. References BasePacking::height, OrientedPacking::orient, BasePacking::width, BasePacking::xloc, and BasePacking::yloc.
02195 { 02196 int blocknum = pk.xloc.size(); 02197 outs << setw(9) << "xloc: "; 02198 for (int i = 0; i < blocknum; i++) 02199 outs << setw(5) << pk.xloc[i]; 02200 outs << endl; 02201 02202 outs << setw(9) << "yloc: "; 02203 for (int i = 0; i < blocknum; i++) 02204 outs << setw(5) << pk.yloc[i]; 02205 outs << endl; 02206 02207 outs << setw(9) << "width: "; 02208 for (int i = 0; i < blocknum ; i++) 02209 outs << setw(5) << pk.width[i]; 02210 outs << endl; 02211 02212 outs << setw(9) << "height: "; 02213 for (int i = 0; i < blocknum; i++) 02214 outs << setw(5) << pk.height[i]; 02215 outs << endl; 02216 02217 outs << setw(9) << "orient: "; 02218 for (int i = 0; i < blocknum; i++) 02219 outs << setw(5) << pk.orient[i]; 02220 outs << endl; 02221 } |
|
Definition at line 47 of file debug.h. Referenced by OutputBTree(), OutputDouble(), OutputHardBlockInfoType(), OutputIndex(), and OutputMixedBlockInfoType(). |