#include <Nets.h>
Collaboration diagram for parquetfp::Nets:

Public Member Functions | |
| Nets (char *baseName) | |
| Nets () | |
| void | clean (void) |
| void | parseNets (char *fnameNets) |
| void | parseWts (char *fnameWts) |
| void | updateNodeInfo (Nodes &nodes) |
| itNet | netsBegin (void) |
| itNet | netsEnd (void) |
| Net & | getNet (unsigned index) |
| void | putNewNet (Net &net) |
| int | getNumPins (void) |
| unsigned | getNumNets (void) |
| void | initName2IdxMap (void) |
| void | putName2IdxEntry (const char *netName, int idx) |
| int | getIdxFrmName (const char *netName) |
Private Attributes | |
| vector< Net > | _nets |
| hash_map< const char *, int, hash< const char * >, eqstr > | _name2IdxMap |
|
|
Definition at line 54 of file Nets.cxx. References initName2IdxMap(), parseNets(), and parseWts().
00055 {
00056 char basefile[1024];
00057 strcpy(basefile,baseName);
00058 char fname[1024];
00059 strcpy(fname,basefile);
00060 strcat(fname,".nets");
00061 parseNets(fname);
00062 initName2IdxMap();
00063 strcpy(fname,basefile);
00064 strcat(fname,".wts");
00065 parseWts(fname);
00066 }
|
Here is the call graph for this function:

|
|
Definition at line 73 of file Nets.h.
00074 {}
|
|
|
Definition at line 76 of file Nets.h. References _nets. Referenced by parquetfp::DB::clean().
00077 { _nets.clear(); }
|
|
|
Definition at line 348 of file Nets.cxx. References _name2IdxMap. Referenced by parseWts().
00349 {
00350 return _name2IdxMap[netName];
00351 }
|
|
|
Definition at line 91 of file Nets.h. References _nets. Referenced by parquetfp::Node::calcAllPinsAtCenter(), parquetfp::Node::changeOrient(), parquetfp::DB::DB(), parquetfp::ClusterDB::getClosestNode(), parquetfp::AnalytSolve::getDesignOptLoc(), parquetfp::DB::getOptimalRangeStart(), parquetfp::AnalytSolve::getOptLoc(), parseWts(), and parquetfp::Node::syncOrient().
00092 { return _nets[index]; }
|
|
|
Definition at line 99 of file Nets.h. References _nets. Referenced by parquetfp::ClusterDB::clusterMulti(), parquetfp::DB::DB(), parquetfp::AnalytSolve::getDesignOptLoc(), parquetfp::SolveMulti::go(), and parquetfp::DB::saveNets().
00100 { return _nets.size(); }
|
|
|
Definition at line 332 of file Nets.cxx. References parquetfp::itNet, netsBegin(), and netsEnd(). Referenced by parquetfp::ClusterDB::clusterMulti(), parquetfp::SolveMulti::go(), parseNets(), parquetfp::DB::saveCapoNets(), and parquetfp::DB::saveNets().
|
Here is the call graph for this function:

|
|
Definition at line 353 of file Nets.cxx. References parquetfp::itNet, netsBegin(), netsEnd(), and putName2IdxEntry(). Referenced by Nets().
00354 {
00355 unsigned netCtr=0;
00356 for(itNet net=netsBegin(); net != netsEnd(); ++net)
00357 {
00358 putName2IdxEntry(net->getName(), netCtr);
00359 ++netCtr;
00360 }
00361 }
|
Here is the call graph for this function:

|
|
Definition at line 85 of file Nets.h. References _nets, and parquetfp::itNet. Referenced by parquetfp::ClusterDB::addNetsToNewDB(), parquetfp::DB::evalHPWL(), getNumPins(), initName2IdxMap(), parquetfp::DB::plot(), parquetfp::DB::saveCapoNets(), parquetfp::DB::saveNets(), parquetfp::DB::saveWts(), and parquetfp::Nodes::updatePinsInfo().
00086 { return _nets.begin(); }
|
|
|
Definition at line 88 of file Nets.h. References _nets, and parquetfp::itNet. Referenced by parquetfp::ClusterDB::addNetsToNewDB(), parquetfp::DB::evalHPWL(), getNumPins(), initName2IdxMap(), parquetfp::DB::plot(), parquetfp::DB::saveCapoNets(), parquetfp::DB::saveNets(), parquetfp::DB::saveWts(), and parquetfp::Nodes::updatePinsInfo().
00089 { return _nets.end(); }
|
|
|
Definition at line 68 of file Nets.cxx. References _nets, parquetfp::Net::addNode(), parquetfp::Net::clean(), eatblank(), eathash(), parquetfp::Net::getName(), getNumPins(), parquetfp::Net::putIndex(), parquetfp::Net::putName(), and skiptoeol(). Referenced by Nets().
00069 {
00070 char block_name[1024];
00071 ifstream nets(fnameNets);
00072 char tempWord1[1024];
00073 char netName[1024];
00074 double poffsetX;
00075 double poffsetY;
00076 int netIndex = 0;
00077 int numNets = 0;
00078 int numPins;
00079 unsigned netDegree=0;
00080 unsigned netCtr=0;
00081 Net tempEdge;
00082
00083 if(!nets)
00084 {
00085 cout<<"ERROR: .nets file could not be opened successfully"<<endl;
00086 return;
00087 }
00088 skiptoeol(nets);
00089 while(!nets.eof())
00090 {
00091 nets>>tempWord1;
00092 if(!(strcmp(tempWord1,"NumNets")))
00093 break;
00094 }
00095 nets>>tempWord1;
00096 nets>>numNets;
00097 while(!nets.eof())
00098 {
00099 nets>>tempWord1;
00100 if(!(strcmp(tempWord1,"NumPins")))
00101 break;
00102 }
00103 nets>>tempWord1;
00104 nets>>numPins;
00105
00106 if(numNets > 0)
00107 {
00108 while(!nets.eof())
00109 {
00110 nets>>tempWord1;
00111 if(!(strcmp(tempWord1,"NetDegree")))
00112 break;
00113 }
00114 nets>>tempWord1;
00115 nets>>netDegree;
00116
00117 eatblank(nets);
00118 if(nets.peek() == '\n' || nets.peek() == '\r')
00119 {
00120 sprintf(netName,"N%d",netIndex);
00121 }
00122 else //netName present
00123 {
00124 nets>>netName;
00125 }
00126 skiptoeol(nets);
00127 tempEdge.putName(netName);
00128 }
00129
00130 eatblank(nets);
00131 if(nets.peek() == EOF)
00132 nets.get();
00133
00134 while(!nets.eof())
00135 {
00136 eatblank(nets);
00137 if(nets.eof())
00138 break;
00139 if(nets.peek()=='#')
00140 eathash(nets);
00141 else
00142 {
00143 eatblank(nets);
00144 if(nets.peek() == '\n' || nets.peek() == '\r' || nets.peek() == EOF)
00145 {
00146 nets.get();
00147 continue;
00148 }
00149
00150 nets>>block_name;
00151 nets>>tempWord1;
00152
00153 if(!strcmp(tempWord1,"B") || !strcmp(tempWord1,"O") ||
00154 !strcmp(tempWord1,"I"))
00155 {
00156 eatblank(nets);
00157
00158 if(nets.peek()=='\n' || nets.peek()=='\r' || nets.eof())
00159 {
00160 nets.get();
00161 //put terminal info in vector
00162 pin tempPin(block_name,true,0,0,netIndex);
00163 tempEdge.addNode(tempPin);
00164 //cout<<block_name<<"\t"<<tempWord1<<"\t"<<endl;
00165 ++netCtr;
00166 continue;
00167 }
00168 else
00169 {
00170 nets>>tempWord1;
00171 if(!strcmp(tempWord1,":"))
00172 {
00173 eatblank(nets);
00174 }
00175 else
00176 cout << "error in parsing"<<endl;
00177
00178 if(nets.peek()!='%')
00179 {cout<<"expecting %"<<endl;}
00180 else
00181 {
00182 nets.get();
00183 nets>>poffsetX;
00184 eatblank(nets);
00185 nets.get();
00186 nets>>poffsetY;
00187 nets.get();
00188 //convert from %
00189 poffsetX /= 100;
00190 poffsetY /= 100;
00191 //put block info here
00192 pin tempPin(block_name,false,poffsetX,poffsetY,netIndex);
00193 tempEdge.addNode(tempPin);
00194 //cout<<block_name<<"\t"<<tempWord1<<"\t"<<poffsetX<<"\t"<<poffsetY<<endl;
00195 ++netCtr;
00196 }
00197 }
00198 }
00199
00200 else if(!strcmp(block_name,"NetDegree"))//new net starts
00201 {
00202 tempEdge.putIndex(netIndex);
00203 _nets.push_back(tempEdge);
00204
00205 if(netCtr != netDegree)
00206 {
00207 cout<<"ERROR in parsing .nets file. For net "<<tempEdge.getName()<<" netDegree do not match with no: of pins. "<<netCtr<<" vs "<<netDegree<<"\n"<<endl;
00208 }
00209 netCtr = 0;
00210 tempEdge.clean();
00211 netIndex++;
00212
00213 nets>>netDegree;
00214 eatblank(nets);
00215 if(nets.peek() == '\n' || nets.peek() == '\r')
00216 {
00217 sprintf(netName,"N%d",netIndex);
00218 }
00219 else //netName present
00220 {
00221 nets>>netName;
00222 }
00223 skiptoeol(nets);
00224 tempEdge.putName(netName);
00225 }
00226 }
00227 }
00228 nets.close();
00229
00230 if(numNets > 0)
00231 {
00232 //put the last net info inside
00233 tempEdge.putIndex(netIndex);
00234 _nets.push_back(tempEdge);
00235 ++netIndex;
00236 }
00237
00238 if(netIndex != numNets)
00239 cout<<"Error in parsing .nets file. Number of nets do not tally "<<netIndex<<" vs "<<numNets<<endl;
00240
00241
00242 int actNumPins = getNumPins();
00243 if(numPins != actNumPins)
00244 {
00245 cout<<"Error in parsing .nets file. Number of pins do not tally "<<actNumPins<<" vs "<<numPins<<endl;
00246 }
00247 }
|
Here is the call graph for this function:

|
|
Definition at line 250 of file Nets.cxx. References _name2IdxMap, eatblank(), eathash(), getIdxFrmName(), getNet(), parquetfp::Net::putWeight(), and skiptoeol(). Referenced by Nets().
00251 {
00252 ifstream wts(fnameWts);
00253 // char tempWord1[1024];
00254 char netName[1024];
00255 double netWeight=1;
00256
00257 if(!wts)
00258 {
00259 cout<<"WARNING: .wts file could not be opened successfully"<<endl;
00260 return;
00261 }
00262
00263 skiptoeol(wts);
00264
00265 while(!wts.eof())
00266 {
00267 eatblank(wts);
00268 if(wts.eof())
00269 break;
00270 if(wts.peek()=='#')
00271 eathash(wts);
00272 else
00273 {
00274 eatblank(wts);
00275 if(wts.peek() == '\n' || wts.peek() == '\r' || wts.peek() == EOF)
00276 {
00277 wts.get();
00278 continue;
00279 }
00280 wts>>netName;
00281 wts>>netWeight;
00282 if(_name2IdxMap.find(netName) != _name2IdxMap.end())
00283 {
00284 unsigned idx = getIdxFrmName(netName);
00285 Net& net = getNet(idx);
00286 net.putWeight(netWeight);
00287 }
00288 else
00289 {
00290 cout<<"ERROR in parsing .wts file. Net "<<netName<<" has weight, but is not defined in .nets file"<<endl;
00291 }
00292
00293 }
00294 }
00295 wts.close();
00296 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 343 of file Nets.cxx. References _name2IdxMap. Referenced by initName2IdxMap().
00344 {
00345 _name2IdxMap[netName] = idx;
00346 }
|
|
|
Definition at line 94 of file Nets.h. References _nets. Referenced by parquetfp::ClusterDB::addNetsToNewDB(), and parquetfp::DB::DB().
00095 { _nets.push_back(net); }
|
|
|
Definition at line 298 of file Nets.cxx. References _nets, parquetfp::itNet, parquetfp::itNode, parquetfp::itPin, parquetfp::Nodes::nodesBegin(), parquetfp::Nodes::nodesEnd(), parquetfp::Nodes::terminalsBegin(), and parquetfp::Nodes::terminalsEnd(). Referenced by parquetfp::DB::DB().
00299 {
00300 itNet net;
00301 itPin pin;
00302 itNode node;
00303
00304 map<const char*, int, ltstr> index;
00305 map<const char*, bool, ltstr> type;
00306
00307 for(node = nodes.nodesBegin(); node != nodes.nodesEnd(); node++)
00308 {
00309 index[node->getName()] = node->getIndex();
00310 type[node->getName()] = 0;
00311 }
00312 for(node = nodes.terminalsBegin(); node != nodes.terminalsEnd(); node++)
00313 {
00314 index[node->getName()] = node->getIndex();
00315 type[node->getName()] = 1;
00316 }
00317
00318 for(net = _nets.begin(); net != _nets.end(); net++)
00319 {
00320 for(pin = net->pinsBegin(); pin != net->pinsEnd(); pin++)
00321 {
00322 int thisIndex = index[pin->getName()];
00323 bool thisType = type[pin->getName()];
00324 pin->putNodeIndex(thisIndex);
00325 pin->putType(thisType);
00326
00327 // cout<<"ERROR: Node "<<pin->getName()<<" not found in updateNodeInfo"<<endl;
00328 }
00329 }
00330 }
|
Here is the call graph for this function:

|
|
Definition at line 69 of file Nets.h. Referenced by getIdxFrmName(), parseWts(), and putName2IdxEntry(). |
|
|
Definition at line 68 of file Nets.h. Referenced by clean(), getNet(), getNumNets(), netsBegin(), netsEnd(), parseNets(), putNewNet(), and updateNodeInfo(). |
1.3.2