DECLARATIONS ///.
Date [Ver. 1.0. Started - August 22, 2014.]
] FUNCTION DEFINITIONS /// Function*************************************************************
47{
48 FILE * pFile;
50 int LevelMax, Prev, Level, i;
51
52 if ( vBold ? (Vec_IntSize(vBold) > 2000) : (Wlc_NtkObjNum(
p) > 2000) )
53 {
54 fprintf( stdout, "Cannot visualize WLC with more than %d nodes.\n", 2000 );
55 return;
56 }
57 if ( (pFile = fopen( pFileName, "w" )) == NULL )
58 {
59 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", pFileName );
60 return;
61 }
62
63
64 if ( vBold )
67
68
70 if ( vBold )
72
73
74
75
76
77
78 fprintf( pFile, "# %s\n", "WLC structure generated by ABC" );
79 fprintf( pFile, "\n" );
80 fprintf( pFile, "digraph WLC {\n" );
81 fprintf( pFile, "size = \"7.5,10\";\n" );
82
83
84 fprintf( pFile, "center = true;\n" );
85
86
87
88 fprintf( pFile, "edge [dir = back];\n" );
89 fprintf( pFile, "\n" );
90
91
92 fprintf( pFile, "{\n" );
93 fprintf( pFile, " node [shape = plaintext];\n" );
94 fprintf( pFile, " edge [style = invis];\n" );
95 fprintf( pFile, " LevelTitle1 [label=\"\"];\n" );
96 fprintf( pFile, " LevelTitle2 [label=\"\"];\n" );
97
98 for ( Level = LevelMax; Level >= 0; Level-- )
99 {
100
101 fprintf( pFile, " Level%d", Level );
102 fprintf( pFile, " [label = " );
103
104 fprintf( pFile, "\"" );
105 fprintf( pFile, "\"" );
106 fprintf( pFile, "];\n" );
107 }
108
109
110 fprintf( pFile, " LevelTitle1 -> LevelTitle2 ->" );
111 for ( Level = LevelMax; Level >= 0; Level-- )
112 {
113
114 fprintf( pFile, " Level%d", Level );
115
116 if ( Level != 0 )
117 fprintf( pFile, " ->" );
118 else
119 fprintf( pFile, ";" );
120 }
121 fprintf( pFile, "\n" );
122 fprintf( pFile, "}" );
123 fprintf( pFile, "\n" );
124 fprintf( pFile, "\n" );
125
126
127 fprintf( pFile, "{\n" );
128 fprintf( pFile, " rank = same;\n" );
129 fprintf( pFile, " LevelTitle1;\n" );
130 fprintf( pFile, " title1 [shape=plaintext,\n" );
131 fprintf( pFile, " fontsize=20,\n" );
132 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
133 fprintf( pFile, " label=\"" );
134 fprintf( pFile, "%s", "WLC structure generated by ABC" );
135 fprintf( pFile, "\\n" );
137
138 fprintf( pFile, "\"\n" );
139 fprintf( pFile, " ];\n" );
140 fprintf( pFile, "}" );
141 fprintf( pFile, "\n" );
142 fprintf( pFile, "\n" );
143
144
145 fprintf( pFile, "{\n" );
146 fprintf( pFile, " rank = same;\n" );
147 fprintf( pFile, " LevelTitle2;\n" );
148 fprintf( pFile, " title2 [shape=plaintext,\n" );
149 fprintf( pFile, " fontsize=18,\n" );
150 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
151 fprintf( pFile, " label=\"" );
152 fprintf( pFile,
"The word-level network contains %d nodes and spans %d levels.", Wlc_NtkObjNum(
p)-Wlc_NtkCiNum(
p), LevelMax-1 );
153 fprintf( pFile, "\\n" );
154 fprintf( pFile, "\"\n" );
155 fprintf( pFile, " ];\n" );
156 fprintf( pFile, "}" );
157 fprintf( pFile, "\n" );
158 fprintf( pFile, "\n" );
159
160
161 fprintf( pFile, "{\n" );
162 fprintf( pFile, " rank = same;\n" );
163
164 fprintf( pFile, " Level%d;\n", LevelMax );
165
167 {
168 if ( vBold && !pNode->
Mark )
169 continue;
170 pNode = Wlc_ObjCo2PoFo(
p, i);
171 fprintf( pFile,
" NodePo%d [label = \"%s%s %d\"", Wlc_ObjId(
p, pNode),
Wlc_ObjName(
p, Wlc_ObjId(
p, pNode)), Wlc_ObjIsPo(pNode)?
"":
"_in", Wlc_ObjRange(pNode) );
172 fprintf( pFile,
", shape = %s", i < Wlc_NtkPoNum(
p) ?
"invtriangle" :
"box" );
173 fprintf( pFile, ", color = coral, fillcolor = coral" );
174 fprintf( pFile, "];\n" );
175 }
176 fprintf( pFile, "}" );
177 fprintf( pFile, "\n" );
178 fprintf( pFile, "\n" );
179
180
181 for ( Level = LevelMax - 1; Level > 0; Level-- )
182 {
183 fprintf( pFile, "{\n" );
184 fprintf( pFile, " rank = same;\n" );
185
186 fprintf( pFile, " Level%d;\n", Level );
188 {
189 if ( (
int)Wlc_ObjLevel(
p, pNode) != Level )
190 continue;
191 if ( vBold && !pNode->
Mark )
192 continue;
193
195 {
196
197 fprintf( pFile, " Node%d [label = \"%d:%d\'h", i, i, Wlc_ObjRange(pNode) );
198 if ( Wlc_ObjRange(pNode) > 64 )
199 {
200 Abc_TtPrintHexArrayRev( pFile, (
word *)Wlc_ObjConstValue(pNode), 16 );
201 fprintf( pFile, "..." );
202 }
203 else
204 Abc_TtPrintHexArrayRev( pFile, (
word *)Wlc_ObjConstValue(pNode), (Wlc_ObjRange(pNode) + 3) / 4 );
205 fprintf( pFile, "\"" );
206 }
208 fprintf( pFile, " Node%d [label = \"%d: %d\"", i, i, Wlc_ObjRange(pNode) );
210 fprintf( pFile,
" Node%d [label = \"%d:%s\"", i, i,
Wlc_ObjTypeName(pNode) );
211 else
212 fprintf( pFile,
" Node%d [label = \"%d:%s %d\"", i, i,
Wlc_ObjTypeName(pNode), Wlc_ObjRange(pNode) );
213
215 fprintf( pFile, ", shape = doublecircle" );
217 fprintf( pFile, ", shape = diamond" );
219 fprintf( pFile, ", shape = box" );
221 fprintf( pFile, ", shape = triangle" );
223 fprintf( pFile, ", shape = trapezium" );
224 else
225 fprintf( pFile, ", shape = ellipse" );
226
228 fprintf( pFile, ", style = filled" );
229 fprintf( pFile, "];\n" );
230 }
231 fprintf( pFile, "}" );
232 fprintf( pFile, "\n" );
233 fprintf( pFile, "\n" );
234 }
235
236
237 fprintf( pFile, "{\n" );
238 fprintf( pFile, " rank = same;\n" );
239
240 fprintf( pFile, " Level%d;\n", 0 );
241
243 {
244 if ( !Wlc_ObjIsCi(pNode) && Wlc_ObjFaninNum(pNode) > 0 )
245 continue;
246 if ( vBold && !pNode->
Mark )
247 continue;
249 {
250
251 fprintf( pFile, " Node%d [label = \"%d:%d\'h", i, i, Wlc_ObjRange(pNode) );
252 if ( Wlc_ObjRange(pNode) > 64 )
253 {
254 Abc_TtPrintHexArrayRev( pFile, (
word *)Wlc_ObjConstValue(pNode), 16 );
255 fprintf( pFile, "..." );
256 }
257 else
258 Abc_TtPrintHexArrayRev( pFile, (
word *)Wlc_ObjConstValue(pNode), (Wlc_ObjRange(pNode) + 3) / 4 );
259 fprintf( pFile, "\"" );
260 }
261 else
262 {
263 fprintf( pFile,
" Node%d [label = \"%d:%s %d\"", Wlc_ObjId(
p, pNode), Wlc_ObjId(
p, pNode),
Wlc_ObjName(
p, Wlc_ObjId(
p, pNode)), Wlc_ObjRange(pNode) );
264 fprintf( pFile,
", shape = %s", (Vec_IntSize(&
p->vFfs2) > 0 || Wlc_ObjCiId(pNode) < Wlc_NtkPiNum(
p)) ?
"triangle" :
"box" );
265 fprintf( pFile, ", color = coral, fillcolor = coral" );
266 }
267 fprintf( pFile, "];\n" );
268 }
269 fprintf( pFile, "}" );
270 fprintf( pFile, "\n" );
271 fprintf( pFile, "\n" );
272
273
274 fprintf( pFile, "title1 -> title2 [style = invis];\n" );
276 {
277 if ( vBold && !pNode->
Mark )
278 continue;
279 pNode = Wlc_ObjCo2PoFo(
p, i );
280 fprintf( pFile,
"title2 -> NodePo%d [style = invis];\n", Wlc_ObjId(
p, pNode) );
281 }
282
283 Prev = -1;
285 {
286 pNode = Wlc_ObjCo2PoFo(
p, i );
287 if ( vBold && !pNode->
Mark )
288 continue;
289 if ( Prev >= 0 )
290 fprintf( pFile,
"NodePo%d -> NodePo%d [style = invis];\n", Prev, Wlc_ObjId(
p, pNode) );
291 Prev = Wlc_ObjId(
p, pNode);
292 }
293
294 Prev = -1;
296 {
297 if ( vBold && !pNode->
Mark )
298 continue;
299 if ( Prev >= 0 )
300 fprintf( pFile,
"Node%d -> Node%d [style = invis];\n", Prev, Wlc_ObjId(
p, pNode) );
301 Prev = Wlc_ObjId(
p, pNode);
302 }
303
304
306 {
307 if ( vBold && !pNode->
Mark )
308 continue;
309 fprintf( pFile,
"NodePo%d", Wlc_ObjId(
p, Wlc_ObjCo2PoFo(
p, i)) );
310 fprintf( pFile, " -> " );
311 fprintf( pFile,
"Node%d", Wlc_ObjId(
p, pNode) );
312 fprintf( pFile, " [" );
313 fprintf( pFile,
"style = %s", pNode->
Signed?
"dotted" :
"solid" );
314 fprintf( pFile, "]" );
315 fprintf( pFile, ";\n" );
316 }
318 {
319 int k, iFanin;
320 if ( Wlc_ObjIsCi(pNode) )
321 continue;
322 if ( vBold && !pNode->
Mark )
323 continue;
324
326 {
327 fprintf( pFile, "Node%d", i );
328 fprintf( pFile, " -> " );
329 fprintf( pFile, "Node%d", iFanin );
330 fprintf( pFile, " [" );
331 fprintf( pFile,
"style = %s", Wlc_NtkObj(
p, iFanin)->Signed?
"dotted" :
"solid" );
333 fprintf( pFile, ", style = %s", "bold" );
334 fprintf( pFile, "]" );
335 fprintf( pFile, ";\n" );
336 }
337 }
338 fprintf( pFile, "}" );
339 fprintf( pFile, "\n" );
340 fprintf( pFile, "\n" );
341 fclose( pFile );
342
343
344 if ( vBold )
346}
unsigned __int64 word
DECLARATIONS ///.
#define Wlc_NtkForEachCi(p, pCi, i)
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
char * Wlc_ObjTypeName(Wlc_Obj_t *p)
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
int Wlc_NtkCreateLevels(Wlc_Ntk_t *p)
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
int Wlc_NtkRemapLevels(Wlc_Ntk_t *p, Vec_Int_t *vObjs, int nLevels)
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
#define Wlc_NtkForEachCo(p, pCo, i)