31 unsigned int hash = 0;
33 for(p = 0; p<
strlen(str); p++)
35 return hash % hash_max;
82 const char *DELIMITERS =
" \n\t:";
87 FILE *netsFile = fopen(filename,
"r");
89 printf(
"ERROR: Could not open .nets file\n");
94 while (fgets(buf, 1024, netsFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
97 while (fgets(buf, 1024, netsFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
98 tok =
strtok(buf, DELIMITERS);
99 tok =
strtok(NULL, DELIMITERS);
101 printf(
"READ-20 : number of nets = %d\n",
numNets);
105 while (fgets(buf, 1024, netsFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
108 while(fgets(buf, 1024, netsFile)) {
109 if (buf[0] ==
'\n' || buf[0] ==
'#')
continue;
111 concreteNets[id].
m_id = id;
114 tok =
strtok(buf, DELIMITERS);
115 if (!!
strcmp(tok,
"NetDegree")) {
117 printf(
"ERROR: Incorrect format in .nets file\n");
121 tok =
strtok(NULL, DELIMITERS);
123 if (concreteNets[
id].m_numTerms < 0 ||
124 concreteNets[
id].m_numTerms > 100000) {
125 printf(
"ERROR: Bad net degree\n");
129 concreteNets[
id].m_numTerms);
133 while(t < concreteNets[
id].m_numTerms &&
134 fgets(buf, 1024, netsFile)) {
135 if (buf[0] ==
'\n' || buf[0] ==
'#')
continue;
138 tok =
strtok(buf, DELIMITERS);
141 printf(
"ERROR: Could not find cell %s in .nodes file\n", tok);
144 concreteNets[id].
m_terms[t] = cell;
160 const char *DELIMITERS =
" \n\t:";
163 FILE *nodesFile = fopen(filename,
"r");
165 printf(
"ERROR: Could not open .nodes file\n");
170 while (fgets(buf, 1024, nodesFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
173 while (fgets(buf, 1024, nodesFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
174 tok =
strtok(buf, DELIMITERS);
175 tok =
strtok(NULL, DELIMITERS);
177 printf(
"READ-10 : number of cells = %d\n",
numCells);
183 while (fgets(buf, 1024, nodesFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
186 while(fgets(buf, 1024, nodesFile)) {
187 if (buf[0] ==
'\n' || buf[0] ==
'#')
continue;
189 tok =
strtok(buf, DELIMITERS);
190 concreteCells[id].
m_id = id;;
193 concreteCells[id].
m_parent = &(abstractCells[id]);
195 strcpy(concreteCells[
id].m_label, tok);
198 &(concreteCells[
id]));
201 tok =
strtok(NULL, DELIMITERS);
203 tok =
strtok(NULL, DELIMITERS);
205 tok =
strtok(NULL, DELIMITERS);
207 abstractCells[id].
m_pad = tok && !
strcmp(tok,
"terminal");
227 const char *DELIMITERS =
" \n\t:";
230 FILE *plFile = fopen(filename,
"r");
231 FILE *netsFile = fopen(filename,
"r");
233 printf(
"ERROR: Could not open .pl file\n");
237 printf(
"ERROR: Could not open .nets file\n");
242 while (fgets(buf, 1024, plFile) && (buf[0] ==
'\n' || buf[0] ==
'#'));
245 while(fgets(buf, 1024, plFile)) {
246 if (buf[0] ==
'\n' || buf[0] ==
'#')
continue;
248 tok =
strtok(buf, DELIMITERS);
253 printf(
"ERROR: Could not find cell %s in .nodes file\n",tok);
258 tok =
strtok(NULL, DELIMITERS);
260 tok =
strtok(NULL, DELIMITERS);
265 (tok =
strtok(NULL, DELIMITERS)) &&
275 FILE *plFile = fopen(filename,
"w");
277 printf(
"ERROR: Could not open .pl file\n");
281 fprintf(plFile,
"UCLA pl 1.0\n");
283 fprintf(plFile,
"%s %f %f : N %s\n",
284 concreteCells[c].m_label,
285 concreteCells[c].m_x,
286 concreteCells[c].m_y,
287 (concreteCells[c].m_fixed ?
"\\FIXED" :
""));
295 int n, t, t2, count = 0;
302 if (net->
m_terms[t] == cell) count++;
309 if (old[t] != cell) net->
m_terms[t2++] = old[t];
316 int main(
int argc,
char **argv) {
319 printf(
"Usage: %s [nodes] [nets] [pl]\n", argv[0]);
void readBookshelfNodes(char *filename)
ConcreteNet ** g_place_concreteNets
void globalPlace()
Performs analytic placement using a GORDIAN-like algorithm.
struct hash_element * next
ConcreteNet * concreteNets
ConcreteCell * hash_find(struct hash_element **hash, int hash_max, const char *str)
void addConcreteNet(ConcreteNet *net)
Adds a net to the placement database.
struct hash_element ** hash_cellname
AbstractCell * abstractCells
void readBookshelfNets(char *filename)
ABC_NAMESPACE_IMPL_START struct hash_element hash_element
void addConcreteCell(ConcreteCell *cell)
int hash_string(int hash_max, const char *str)
void delNetConnections(ConcreteCell *cell)
ConcreteCell * concreteCells
#define ABC_NAMESPACE_IMPL_END
void globalIncremental()
Performs analytic placement using a GORDIAN-like algorithm.
static uint32_t hash(uint32_t x)
void globalPreplace(float utilization)
Place pad ring, leaving a core area to meet a desired utilization.
int main(int argc, char **argv)
#define ABC_NAMESPACE_IMPL_START
void readBookshelfPlacement(char *filename)
ABC_NAMESPACE_IMPL_START int g_place_numCells
void hash_add(struct hash_element **hash, int hash_max, ConcreteCell *cell)
void writeBookshelfPlacement(char *filename)