00001 /************************************************************************** 00002 *** 00003 *** Copyright (c) 1995-2000 Regents of the University of California, 00004 *** Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov 00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan, 00006 *** Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov 00007 *** 00008 *** Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu 00009 *** Original Affiliation: UCLA, Computer Science Department, 00010 *** Los Angeles, CA 90095-1596 USA 00011 *** 00012 *** Permission is hereby granted, free of charge, to any person obtaining 00013 *** a copy of this software and associated documentation files (the 00014 *** "Software"), to deal in the Software without restriction, including 00015 *** without limitation 00016 *** the rights to use, copy, modify, merge, publish, distribute, sublicense, 00017 *** and/or sell copies of the Software, and to permit persons to whom the 00018 *** Software is furnished to do so, subject to the following conditions: 00019 *** 00020 *** The above copyright notice and this permission notice shall be included 00021 *** in all copies or substantial portions of the Software. 00022 *** 00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00030 *** 00031 *** 00032 ***************************************************************************/ 00033 00034 00035 00036 00037 00038 00039 #ifndef NETS_H 00040 #define NETS_H 00041 00042 #include <vector> 00043 #include <algorithm> 00044 #include <math.h> 00045 #include <stdlib.h> 00046 #include <stdio.h> 00047 #include <ABKCommon/sgi_hash_map.h> 00048 00049 #include "Net.h" 00050 00051 namespace parquetfp 00052 { 00053 00054 class Nodes; 00055 typedef std::vector<Net>::iterator itNet; 00056 00057 struct eqstr 00058 { 00059 bool operator()(const char* s1, const char* s2) const 00060 { 00061 return strcmp(s1, s2) == 0; 00062 } 00063 }; 00064 00065 class Nets 00066 { 00067 private: 00068 vector<Net> _nets; 00069 hash_map<const char*, int, hash<const char*>, eqstr> _name2IdxMap; 00070 00071 public: 00072 Nets(char* baseName); 00073 Nets() 00074 {} 00075 00076 void clean(void) 00077 { _nets.clear(); } 00078 00079 void parseNets(char* fnameNets); 00080 00081 void parseWts(char* fnameWts); 00082 00083 void updateNodeInfo(Nodes& nodes); 00084 00085 itNet netsBegin(void) 00086 { return _nets.begin(); } 00087 00088 itNet netsEnd(void) 00089 { return _nets.end(); } 00090 00091 Net& getNet(unsigned index) 00092 { return _nets[index]; } 00093 00094 void putNewNet(Net& net) 00095 { _nets.push_back(net); } 00096 00097 int getNumPins(void); 00098 00099 unsigned getNumNets(void) 00100 { return _nets.size(); } 00101 00102 void initName2IdxMap(void); 00103 void putName2IdxEntry(const char* netName, int idx); 00104 int getIdxFrmName(const char* netName); 00105 }; 00106 } 00107 00108 //using namespace parquetfp; 00109 00110 #endif
1.3.2