ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
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// --------------------------------------------------------------------
26void 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,
54 g_place_concreteCells[c]->m_parent->m_height,
55 (g_place_concreteCells[c]->m_parent->m_pad ? " terminal" : ""));
56 }
57
58 fclose(nodesFile);
59}
60
61
62// --------------------------------------------------------------------
63// writeBookshelfPl()
64//
65// --------------------------------------------------------------------
66void 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,
82 (g_place_concreteCells[c]->m_fixed ? "\\FIXED" : ""));
83 }
84
85 fclose(plFile);
86
87}
88
89
90// --------------------------------------------------------------------
91// writeBookshelf()
92//
93// --------------------------------------------------------------------
94void writeBookshelf(const char *filename) {
95 writeBookshelfNodes("out.nodes");
96 writeBookshelfPl("out.pl");
97}
99
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
char * filename
Definition globals.c:40
ConcreteCell ** g_place_concreteCells
Definition place_base.c:33
ABC_NAMESPACE_IMPL_START int g_place_numCells
Definition place_base.c:26
void writeBookshelfPl(const char *filename)
Definition place_io.c:66
ABC_NAMESPACE_IMPL_START void writeBookshelfNodes(const char *filename)
Definition place_io.c:26
void writeBookshelf(const char *filename)
Definition place_io.c:94
VOID_HACK exit()