abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
place_io.c
Go to the documentation of this file.
1 /*===================================================================*/
2 //
3 // place_io.c
4 //
5 // Aaron P. Hurst, 2003-2007
6 // ahurst@eecs.berkeley.edu
7 //
8 /*===================================================================*/
9 
10 #include <stdlib.h>
11 #include <limits.h>
12 #include <assert.h>
13 #include <string.h>
14 #include <stdio.h>
15 
16 #include "place_base.h"
17 
19 
20 
21 
22 // --------------------------------------------------------------------
23 // writeBookshelfNodes()
24 //
25 // --------------------------------------------------------------------
26 void writeBookshelfNodes(const char *filename) {
27 
28  int c = 0;
29  int numNodes, numTerms;
30 
31  FILE *nodesFile = fopen(filename, "w");
32  if (!nodesFile) {
33  printf("ERROR: Could not open .nodes file\n");
34  exit(1);
35  }
36 
37  numNodes = numTerms = 0;
38  for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
39  numNodes++;
40  if (g_place_concreteCells[c]->m_parent->m_pad)
41  numTerms++;
42  }
43 
44 
45 
46  fprintf(nodesFile, "UCLA nodes 1.0\n");
47  fprintf(nodesFile, "NumNodes : %d\n", numNodes);
48  fprintf(nodesFile, "NumTerminals : %d\n", numTerms);
49 
50  for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
51  fprintf(nodesFile, "CELL%d %f %f %s\n",
52  g_place_concreteCells[c]->m_id,
53  g_place_concreteCells[c]->m_parent->m_width,
55  (g_place_concreteCells[c]->m_parent->m_pad ? " terminal" : ""));
56  }
57 
58  fclose(nodesFile);
59 }
60 
61 
62 // --------------------------------------------------------------------
63 // writeBookshelfPl()
64 //
65 // --------------------------------------------------------------------
66 void writeBookshelfPl(const char *filename) {
67 
68  int c = 0;
69 
70  FILE *plFile = fopen(filename, "w");
71  if (!plFile) {
72  printf("ERROR: Could not open .pl file\n");
73  exit(1);
74  }
75 
76  fprintf(plFile, "UCLA pl 1.0\n");
77  for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
78  fprintf(plFile, "CELL%d %f %f : N %s\n",
79  g_place_concreteCells[c]->m_id,
80  g_place_concreteCells[c]->m_x,
81  g_place_concreteCells[c]->m_y,
82  (g_place_concreteCells[c]->m_fixed ? "\\FIXED" : ""));
83  }
84 
85  fclose(plFile);
86 
87 }
88 
89 
90 // --------------------------------------------------------------------
91 // writeBookshelf()
92 //
93 // --------------------------------------------------------------------
94 void writeBookshelf(const char *filename) {
95  writeBookshelfNodes("out.nodes");
96  writeBookshelfPl("out.pl");
97 }
99 
char * filename
Definition: globals.c:40
VOID_HACK exit()
AbstractCell * m_parent
Definition: place_base.h:57
void writeBookshelfPl(const char *filename)
Definition: place_io.c:66
void writeBookshelf(const char *filename)
Definition: place_io.c:94
ConcreteCell ** g_place_concreteCells
Definition: place_base.c:33
float m_height
Definition: place_base.h:45
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
ABC_NAMESPACE_IMPL_START int g_place_numCells
Definition: place_base.c:26
ABC_NAMESPACE_IMPL_START void writeBookshelfNodes(const char *filename)
Definition: place_io.c:26