#include <mixedpackingfromdb.h>
Inheritance diagram for MixedBlockInfoTypeFromDB:


Public Member Functions | |
| MixedBlockInfoTypeFromDB (const DB &db) | |
| virtual | ~MixedBlockInfoTypeFromDB () |
| void | setBlockDimensions (int index, double newWidth, double newHeight, int theta) |
Public Attributes | |
| const HardBlockInfoType & | currDimensions |
| const vector< BlockARInfo > & | blockARinfo |
Static Public Attributes | |
| const int | ORIENT_NUM = HardBlockInfoType::ORIENT_NUM |
Protected Member Functions | |
| void | ParseBlocks (ifstream &input) |
| void | set_blockARinfo_AR (int index, double minAR, double maxAR) |
Protected Attributes | |
| HardBlockInfoType | _currDimensions |
| vector< BlockARInfo > | _blockARinfo |
|
|
Definition at line 49 of file mixedpackingfromdb.cxx. References MixedBlockInfoType::_blockARinfo, MixedBlockInfoType::_currDimensions, HardBlockInfoType::in_block_names, basepacking_h::Dimension::INFTY, MixedBlockInfoType::ORIENT_NUM, MixedBlockInfoType::set_blockARinfo_AR(), HardBlockInfoType::set_dimensions(), and MixedBlockInfoType::setBlockDimensions().
00050 : MixedBlockInfoType(db.getNumNodes()) 00051 { 00052 // extract information from DB 00053 vector<double> widths(db.getNodeWidths()); 00054 vector<double> heights(db.getNodeHeights()); 00055 00056 Nodes& nodes = *(const_cast<DB&>(db).getNodes()); 00057 int blocknum = db.getNumNodes(); 00058 for (int i = 0; i < blocknum; i++) 00059 { 00060 Node& currBlk = nodes.getNode(i); 00061 int theta = (currBlk.getOrient()); 00062 setBlockDimensions(i, widths[i], heights[i], theta); 00063 _currDimensions.in_block_names[i] = currBlk.getName(); 00064 00065 #ifdef PARQUET_DEBUG_HAYWARD_DISPLAY_MIXEDPACKINGFROMDB 00066 printf("[%d]: theta: %d, width: %lf, height %lf\n", 00067 i, theta, widths[i], heights[i]); 00068 #endif 00069 00070 double currMaxAR = currBlk.getmaxAR(); 00071 double currMinAR = currBlk.getminAR(); 00072 double currArea = currBlk.getArea(); 00073 00074 _blockARinfo[i].area = currArea; 00075 set_blockARinfo_AR(i, currMinAR, currMaxAR); 00076 _blockARinfo[i].isSoft = (currMaxAR > currMinAR); 00077 00078 #ifdef PARQUET_DEBUG_HAYWARD_DISPLAY_MIXEDPACKINGFROMDB 00079 printf("[%d]: theta: %d, maxAR: %lf, minAR: %lf, area: %lf\n", 00080 i, theta, currMaxAR, currMinAR, currArea); 00081 #endif 00082 } 00083 00084 static const double INFTY = basepacking_h::Dimension::INFTY; 00085 _currDimensions.set_dimensions(blocknum, 0, INFTY); 00086 _currDimensions.in_block_names[blocknum] = "LEFT"; 00087 _blockARinfo[blocknum].area = 0; 00088 _blockARinfo[blocknum].minAR.resize(ORIENT_NUM, 0); 00089 _blockARinfo[blocknum].maxAR.resize(ORIENT_NUM, 0); 00090 _blockARinfo[blocknum].isSoft = false; 00091 00092 _currDimensions.set_dimensions(blocknum+1, INFTY, 0); 00093 _currDimensions.in_block_names[blocknum+1] = "BOTTOM"; 00094 _blockARinfo[blocknum+1].area = 0; 00095 _blockARinfo[blocknum+1].minAR.resize(ORIENT_NUM, INFTY); 00096 _blockARinfo[blocknum+1].maxAR.resize(ORIENT_NUM, INFTY); 00097 _blockARinfo[blocknum+1].isSoft = false; 00098 } |
Here is the call graph for this function:

|
|
Definition at line 51 of file mixedpackingfromdb.h.
00051 {}
|
|
|
Definition at line 72 of file mixedpacking.cxx. References MixedBlockInfoType::_blockARinfo, MixedBlockInfoType::_currDimensions, HardBlockInfoType::block_names, eatblank(), eathash(), HardBlockInfoType::in_block_names, HardBlockInfoType::in_blocks, parquetfp::needCaseChar(), MixedBlockInfoType::ORIENT_NUM, MixedBlockInfoType::set_blockARinfo_AR(), and HardBlockInfoType::set_dimensions(). Referenced by MixedBlockInfoType::MixedBlockInfoType().
00073 {
00074 char block_name[1024];
00075 char block_type[1024];
00076 char tempWord1[1024];
00077
00078 vector<Point> vertices;
00079 int numVertices;
00080 bool success;
00081 double width, height;
00082
00083 double area,minAr,maxAr;
00084 int numSoftBl=0;
00085 int numHardBl=0;
00086 int numBl = numSoftBl + numHardBl;
00087 int numTerm=0;
00088
00089 int indexBlock=0;
00090 int indexTerm=0;
00091
00092 if(!input)
00093 {
00094 cout<<"ERROR: .blocks file could not be opened successfully"<<endl;
00095 exit(0);
00096 }
00097
00098 while(!input.eof())
00099 {
00100 input>>tempWord1;
00101 if(!(strcmp(tempWord1,"NumSoftRectangularBlocks")))
00102 break;
00103 }
00104 input>>tempWord1;
00105 input>>numSoftBl;
00106
00107 while(!input.eof())
00108 {
00109 input>>tempWord1;
00110 if(!(strcmp(tempWord1,"NumHardRectilinearBlocks")))
00111 break;
00112 }
00113 input>>tempWord1;
00114 input>>numHardBl;
00115
00116 while(!input.eof())
00117 {
00118 input>>tempWord1;
00119 if(!(strcmp(tempWord1,"NumTerminals")))
00120 break;
00121 }
00122 input>>tempWord1;
00123 input>>numTerm;
00124
00125 numBl = numHardBl + numSoftBl;
00126 _currDimensions.in_blocks.resize(numBl+2);
00127 _currDimensions.in_block_names.resize(numBl+2);
00128 _blockARinfo.resize(numHardBl+numSoftBl+2);
00129 while(!input.eof())
00130 {
00131 block_type[0] = '\0';
00132 eatblank(input);
00133 if(input.eof())
00134 break;
00135 if(input.peek()=='#')
00136 eathash(input);
00137 else
00138 {
00139 eatblank(input);
00140 if(input.peek() == '\n' || input.peek() == '\r')
00141 {
00142 input.get();
00143 continue;
00144 }
00145
00146 input >> block_name;
00147 input >> block_type ;
00148
00149 if(!strcmp(block_type,"softrectangular"))
00150 {
00151 input >> area;
00152 input >> minAr;
00153 input >> maxAr;
00154
00155 width = sqrt(area);
00156 height = sqrt(area);
00157
00158 // printf("[%d]: area: %.2lf minAR: %.2lf maxAR: %.2lf width: %.2lf height: %.2lf\n",
00159 // indexBlock, area, minAr, maxAr, width, height);
00160 _currDimensions.set_dimensions(indexBlock, width, height);
00161 if (indexBlock >= int(_currDimensions.block_names.size()))
00162 {
00163 cout << "ERROR: too many hard block specified." << endl;
00164 exit(1);
00165 }
00166 _currDimensions.in_block_names[indexBlock] = block_name;
00167
00168 _blockARinfo[indexBlock].area = area;
00169 set_blockARinfo_AR(indexBlock, min(minAr, maxAr), max(minAr, maxAr));
00170 _blockARinfo[indexBlock].isSoft = true;
00171
00172 ++indexBlock;
00173 //cout<<block_name<<" "<<area<<endl;
00174 }
00175 else if(!strcmp(block_type,"hardrectilinear"))
00176 {
00177 input >> numVertices; //maybe need voltage here
00178 input >> numVertices;
00179 Point tempPoint;
00180 success = 1;
00181 if(numVertices > 4)
00182 cout<<"ERROR in parsing .blocks file. rectilinear blocks can be only rectangles for now\n";
00183 for(int i=0; i<numVertices; ++i)
00184 {
00185 success &= needCaseChar(input, '('); input.get();
00186 input >> tempPoint.x;
00187 success &= needCaseChar(input, ','); input.get();
00188 input >> tempPoint.y;
00189 success &= needCaseChar(input, ')'); input.get();
00190 vertices.push_back(tempPoint);
00191 }
00192 if(!success)
00193 cout<<"ERROR in parsing .blocks file while processing hardrectilinear blocks"<<endl;
00194
00195 width = vertices[2].x - vertices[0].x;
00196 height = vertices[2].y - vertices[0].y;
00197 area = width*height;
00198 minAr = width/height;
00199 maxAr = minAr;
00200
00201 _currDimensions.set_dimensions(indexBlock, width, height);
00202 if (indexBlock >= int(_currDimensions.block_names.size()))
00203 {
00204 cout << "ERROR: too many hard block specified." << endl;
00205 exit(1);
00206 }
00207 _currDimensions.in_block_names[indexBlock] = block_name;
00208
00209 _blockARinfo[indexBlock].area = area;
00210 set_blockARinfo_AR(indexBlock, min(minAr, maxAr), max(minAr, maxAr));
00211 _blockARinfo[indexBlock].isSoft = false;
00212
00213 ++indexBlock;
00214 vertices.clear();
00215 //cout<<block_name<<" "<<area<<endl;
00216 }
00217 else if(!strcmp(block_type,"terminal"))
00218 {
00219 ++indexTerm;
00220 //cout<<indexTerm<<" "<<block_name<<endl;
00221 }
00222 /*
00223 else
00224 cout<<"ERROR in parsing .blocks file"<<endl;
00225 */
00226 }
00227 }
00228 input.close();
00229
00230 if(numSoftBl+numHardBl != indexBlock)
00231 cout << "ERROR in parsing .blocks file. No: of blocks do not tally "
00232 << (indexBlock+indexTerm) << " vs " << (numSoftBl+numHardBl+numTerm)
00233 << endl;
00234
00235 _currDimensions.set_dimensions(numBl, 0, Dimension::INFTY);
00236 _currDimensions.in_block_names[numBl] = "LEFT";
00237 _blockARinfo[numBl].area = 0;
00238 _blockARinfo[numBl].minAR.resize(ORIENT_NUM, 0);
00239 _blockARinfo[numBl].maxAR.resize(ORIENT_NUM, 0);
00240 _blockARinfo[numBl].isSoft = false;
00241
00242 _currDimensions.set_dimensions(numBl+1, Dimension::INFTY, 0);
00243 _currDimensions.in_block_names[numBl+1] = "BOTTOM";
00244 _blockARinfo[numBl+1].area = 0;
00245 _blockARinfo[numBl+1].minAR.resize(ORIENT_NUM, Dimension::INFTY);
00246 _blockARinfo[numBl+1].maxAR.resize(ORIENT_NUM, Dimension::INFTY);
00247 _blockARinfo[numBl+1].isSoft = false;
00248 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 97 of file mixedpacking.h. References MixedBlockInfoType::_blockARinfo, and MixedBlockInfoType::ORIENT_NUM. Referenced by MixedBlockInfoTypeFromDB(), and MixedBlockInfoType::ParseBlocks().
00100 {
00101 _blockARinfo[index].minAR.resize(ORIENT_NUM);
00102 _blockARinfo[index].maxAR.resize(ORIENT_NUM);
00103 for (int i = 0; i < ORIENT_NUM; i++)
00104 {
00105 _blockARinfo[index].minAR[i] = ((i%2 == 0)?
00106 minAR : (1.0 / maxAR));
00107 _blockARinfo[index].maxAR[i] = ((i%2 == 0)?
00108 maxAR : (1.0 / minAR));
00109 }
00110 }
|
|
||||||||||||||||||||
|
Definition at line 87 of file mixedpacking.h. References MixedBlockInfoType::_currDimensions, and HardBlockInfoType::set_dimensions(). Referenced by BTreeAreaWireAnnealer::anneal(), MixedBlockInfoTypeFromDB(), and BTreeAreaWireAnnealer::packSoftBlocks().
00091 {
00092 double realWidth = (theta % 2 == 0)? newWidth : newHeight;
00093 double realHeight = (theta % 2 == 0)? newHeight : newWidth;
00094 _currDimensions.set_dimensions(index, realWidth, realHeight);
00095 }
|
Here is the call graph for this function:

|
|
Definition at line 69 of file mixedpacking.h. Referenced by MixedBlockInfoType::MixedBlockInfoType(), MixedBlockInfoTypeFromDB(), MixedBlockInfoType::ParseBlocks(), and MixedBlockInfoType::set_blockARinfo_AR(). |
|
|
Definition at line 68 of file mixedpacking.h. Referenced by MixedBlockInfoType::MixedBlockInfoType(), MixedBlockInfoTypeFromDB(), MixedBlockInfoType::ParseBlocks(), and MixedBlockInfoType::setBlockDimensions(). |
|
|
Definition at line 61 of file mixedpacking.h. Referenced by BTreeAreaWireAnnealer::getSoftBlIndex(), BTreeAreaWireAnnealer::getSoftBlNewDimensions(), MixedBlockInfoType::MixedBlockInfoType(), and OutputMixedBlockInfoType(). |
|
|
|
Definition at line 47 of file mixedpacking.cxx. Referenced by BTreeAreaWireAnnealer::constructor_core(), MixedBlockInfoTypeFromDB(), OutputMixedBlockInfoType(), MixedBlockInfoType::ParseBlocks(), and MixedBlockInfoType::set_blockARinfo_AR(). |
1.3.2