00001
00021 #include "io.h"
00022 #include "main.h"
00023 #include "mio.h"
00024
00028
00029 static char * Abc_NtkPrintSop( char * pSop );
00030 static int Abc_NtkCountLogicNodes( Vec_Ptr_t * vNodes );
00031
00035
00048 void Io_WriteDot( Abc_Ntk_t * pNtk, char * FileName )
00049 {
00050 Vec_Ptr_t * vNodes;
00051 vNodes = Abc_NtkCollectObjects( pNtk );
00052 Io_WriteDotNtk( pNtk, vNodes, NULL, FileName, 0, 0 );
00053 Vec_PtrFree( vNodes );
00054 }
00055
00068 void Io_WriteDotNtk( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes, Vec_Ptr_t * vNodesShow, char * pFileName, int fGateNames, int fUseReverse )
00069 {
00070 FILE * pFile;
00071 Abc_Obj_t * pNode, * pFanin;
00072 char * pSopString;
00073 int LevelMin, LevelMax, fHasCos, Level, i, k, fHasBdds, fCompl;
00074 int Limit = 300;
00075
00076 assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk) );
00077
00078 if ( vNodes->nSize < 1 )
00079 {
00080 printf( "The set has no nodes. DOT file is not written.\n" );
00081 return;
00082 }
00083
00084 if ( vNodes->nSize > Limit )
00085 {
00086 printf( "The set has more than %d nodes. DOT file is not written.\n", Limit );
00087 return;
00088 }
00089
00090
00091 if ( (pFile = fopen( pFileName, "w" )) == NULL )
00092 {
00093 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", pFileName );
00094 return;
00095 }
00096
00097
00098 if ( fHasBdds = Abc_NtkIsBddLogic(pNtk) )
00099 {
00100 if ( !Abc_NtkBddToSop(pNtk, 0) )
00101 {
00102 printf( "Io_WriteDotNtk(): Converting to SOPs has failed.\n" );
00103 return;
00104 }
00105 }
00106
00107
00108 Vec_PtrForEachEntry( vNodes, pNode, i )
00109 pNode->fMarkC = 1;
00110 if ( vNodesShow )
00111 Vec_PtrForEachEntry( vNodesShow, pNode, i )
00112 pNode->fMarkB = 1;
00113
00114
00115 LevelMax = Abc_NtkLevel( pNtk );
00116 if ( fUseReverse )
00117 {
00118 LevelMin = Abc_NtkLevelReverse( pNtk );
00119 assert( LevelMax == LevelMin );
00120 Vec_PtrForEachEntry( vNodes, pNode, i )
00121 if ( Abc_ObjIsNode(pNode) )
00122 pNode->Level = LevelMax - pNode->Level + 1;
00123 }
00124
00125
00126 LevelMin = 10000;
00127 LevelMax = -1;
00128 fHasCos = 0;
00129 Vec_PtrForEachEntry( vNodes, pNode, i )
00130 {
00131 if ( Abc_ObjIsCo(pNode) )
00132 {
00133 fHasCos = 1;
00134 continue;
00135 }
00136 if ( LevelMin > (int)pNode->Level )
00137 LevelMin = pNode->Level;
00138 if ( LevelMax < (int)pNode->Level )
00139 LevelMax = pNode->Level;
00140 }
00141
00142
00143 if ( fHasCos )
00144 {
00145 LevelMax++;
00146 Vec_PtrForEachEntry( vNodes, pNode, i )
00147 {
00148 if ( Abc_ObjIsCo(pNode) )
00149 pNode->Level = LevelMax;
00150 }
00151 }
00152
00153
00154 fprintf( pFile, "# %s\n", "Network structure generated by ABC" );
00155 fprintf( pFile, "\n" );
00156 fprintf( pFile, "digraph network {\n" );
00157 fprintf( pFile, "size = \"7.5,10\";\n" );
00158
00159
00160
00161
00162
00163 fprintf( pFile, "center = true;\n" );
00164
00165
00166
00167 fprintf( pFile, "edge [dir = back];\n" );
00168 fprintf( pFile, "\n" );
00169
00170
00171 fprintf( pFile, "{\n" );
00172 fprintf( pFile, " node [shape = plaintext];\n" );
00173 fprintf( pFile, " edge [style = invis];\n" );
00174 fprintf( pFile, " LevelTitle1 [label=\"\"];\n" );
00175 fprintf( pFile, " LevelTitle2 [label=\"\"];\n" );
00176
00177 for ( Level = LevelMax; Level >= LevelMin; Level-- )
00178 {
00179
00180 fprintf( pFile, " Level%d", Level );
00181 fprintf( pFile, " [label = " );
00182
00183 fprintf( pFile, "\"" );
00184 fprintf( pFile, "\"" );
00185 fprintf( pFile, "];\n" );
00186 }
00187
00188
00189 fprintf( pFile, " LevelTitle1 -> LevelTitle2 ->" );
00190 for ( Level = LevelMax; Level >= LevelMin; Level-- )
00191 {
00192
00193 fprintf( pFile, " Level%d", Level );
00194
00195 if ( Level != LevelMin )
00196 fprintf( pFile, " ->" );
00197 else
00198 fprintf( pFile, ";" );
00199 }
00200 fprintf( pFile, "\n" );
00201 fprintf( pFile, "}" );
00202 fprintf( pFile, "\n" );
00203 fprintf( pFile, "\n" );
00204
00205
00206 fprintf( pFile, "{\n" );
00207 fprintf( pFile, " rank = same;\n" );
00208 fprintf( pFile, " LevelTitle1;\n" );
00209 fprintf( pFile, " title1 [shape=plaintext,\n" );
00210 fprintf( pFile, " fontsize=20,\n" );
00211 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
00212 fprintf( pFile, " label=\"" );
00213 fprintf( pFile, "%s", "Network structure visualized by ABC" );
00214 fprintf( pFile, "\\n" );
00215 fprintf( pFile, "Benchmark \\\"%s\\\". ", pNtk->pName );
00216 fprintf( pFile, "Time was %s. ", Extra_TimeStamp() );
00217 fprintf( pFile, "\"\n" );
00218 fprintf( pFile, " ];\n" );
00219 fprintf( pFile, "}" );
00220 fprintf( pFile, "\n" );
00221 fprintf( pFile, "\n" );
00222
00223
00224 fprintf( pFile, "{\n" );
00225 fprintf( pFile, " rank = same;\n" );
00226 fprintf( pFile, " LevelTitle2;\n" );
00227 fprintf( pFile, " title2 [shape=plaintext,\n" );
00228 fprintf( pFile, " fontsize=18,\n" );
00229 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
00230 fprintf( pFile, " label=\"" );
00231 if ( Abc_NtkObjNum(pNtk) == Vec_PtrSize(vNodes) )
00232 fprintf( pFile, "The network contains %d logic nodes and %d latches.", Abc_NtkNodeNum(pNtk), Abc_NtkLatchNum(pNtk) );
00233 else
00234 fprintf( pFile, "The set contains %d logic nodes and spans %d levels.", Abc_NtkCountLogicNodes(vNodes), LevelMax - LevelMin + 1 );
00235 fprintf( pFile, "\\n" );
00236 fprintf( pFile, "\"\n" );
00237 fprintf( pFile, " ];\n" );
00238 fprintf( pFile, "}" );
00239 fprintf( pFile, "\n" );
00240 fprintf( pFile, "\n" );
00241
00242
00243 if ( fHasCos )
00244 {
00245 fprintf( pFile, "{\n" );
00246 fprintf( pFile, " rank = same;\n" );
00247
00248 fprintf( pFile, " Level%d;\n", LevelMax );
00249
00250 Vec_PtrForEachEntry( vNodes, pNode, i )
00251 {
00252 if ( !Abc_ObjIsCo(pNode) )
00253 continue;
00254 fprintf( pFile, " Node%d [label = \"%s%s\"",
00255 pNode->Id,
00256 (Abc_ObjIsBi(pNode)? Abc_ObjName(Abc_ObjFanout0(pNode)):Abc_ObjName(pNode)),
00257 (Abc_ObjIsBi(pNode)? "_in":"") );
00258 fprintf( pFile, ", shape = %s", (Abc_ObjIsBi(pNode)? "box":"invtriangle") );
00259 if ( pNode->fMarkB )
00260 fprintf( pFile, ", style = filled" );
00261 fprintf( pFile, ", color = coral, fillcolor = coral" );
00262 fprintf( pFile, "];\n" );
00263 }
00264 fprintf( pFile, "}" );
00265 fprintf( pFile, "\n" );
00266 fprintf( pFile, "\n" );
00267 }
00268
00269
00270 for ( Level = LevelMax - fHasCos; Level >= LevelMin && Level > 0; Level-- )
00271 {
00272 fprintf( pFile, "{\n" );
00273 fprintf( pFile, " rank = same;\n" );
00274
00275 fprintf( pFile, " Level%d;\n", Level );
00276 Vec_PtrForEachEntry( vNodes, pNode, i )
00277 {
00278 if ( (int)pNode->Level != Level )
00279 continue;
00280 if ( Abc_ObjFaninNum(pNode) == 0 )
00281 continue;
00282
00283 if ( Abc_NtkIsStrash(pNtk) )
00284 pSopString = "";
00285 else if ( Abc_NtkHasMapping(pNtk) && fGateNames )
00286 pSopString = Mio_GateReadName(pNode->pData);
00287 else if ( Abc_NtkHasMapping(pNtk) )
00288 pSopString = Abc_NtkPrintSop(Mio_GateReadSop(pNode->pData));
00289 else
00290 pSopString = Abc_NtkPrintSop(pNode->pData);
00291 fprintf( pFile, " Node%d [label = \"%d\\n%s\"", pNode->Id, pNode->Id, pSopString );
00292
00293 fprintf( pFile, ", shape = ellipse" );
00294 if ( pNode->fMarkB )
00295 fprintf( pFile, ", style = filled" );
00296 fprintf( pFile, "];\n" );
00297 }
00298 fprintf( pFile, "}" );
00299 fprintf( pFile, "\n" );
00300 fprintf( pFile, "\n" );
00301 }
00302
00303
00304 if ( LevelMin == 0 )
00305 {
00306 fprintf( pFile, "{\n" );
00307 fprintf( pFile, " rank = same;\n" );
00308
00309 fprintf( pFile, " Level%d;\n", LevelMin );
00310
00311 Vec_PtrForEachEntry( vNodes, pNode, i )
00312 {
00313 if ( !Abc_ObjIsCi(pNode) )
00314 {
00315
00316 if ( Abc_ObjFaninNum(pNode) == 0 && Abc_ObjFanoutNum(pNode) > 0 )
00317 {
00318 fprintf( pFile, " Node%d [label = \"Const%d\"", pNode->Id, Abc_NtkIsStrash(pNode->pNtk) || Abc_NodeIsConst1(pNode) );
00319 fprintf( pFile, ", shape = ellipse" );
00320 if ( pNode->fMarkB )
00321 fprintf( pFile, ", style = filled" );
00322 fprintf( pFile, ", color = coral, fillcolor = coral" );
00323 fprintf( pFile, "];\n" );
00324 }
00325 continue;
00326 }
00327 fprintf( pFile, " Node%d [label = \"%s\"",
00328 pNode->Id,
00329 (Abc_ObjIsBo(pNode)? Abc_ObjName(Abc_ObjFanin0(pNode)):Abc_ObjName(pNode)) );
00330 fprintf( pFile, ", shape = %s", (Abc_ObjIsBo(pNode)? "box":"triangle") );
00331 if ( pNode->fMarkB )
00332 fprintf( pFile, ", style = filled" );
00333 fprintf( pFile, ", color = coral, fillcolor = coral" );
00334 fprintf( pFile, "];\n" );
00335 }
00336 fprintf( pFile, "}" );
00337 fprintf( pFile, "\n" );
00338 fprintf( pFile, "\n" );
00339 }
00340
00341
00342 fprintf( pFile, "title1 -> title2 [style = invis];\n" );
00343 Vec_PtrForEachEntry( vNodes, pNode, i )
00344 {
00345 if ( (int)pNode->Level != LevelMax )
00346 continue;
00347 fprintf( pFile, "title2 -> Node%d [style = invis];\n", pNode->Id );
00348 }
00349
00350
00351 Vec_PtrForEachEntry( vNodes, pNode, i )
00352 {
00353 if ( Abc_ObjIsLatch(pNode) )
00354 continue;
00355 Abc_ObjForEachFanin( pNode, pFanin, k )
00356 {
00357 if ( Abc_ObjIsLatch(pFanin) )
00358 continue;
00359 fCompl = 0;
00360 if ( Abc_NtkIsStrash(pNtk) )
00361 fCompl = Abc_ObjFaninC(pNode, k);
00362
00363 fprintf( pFile, "Node%d", pNode->Id );
00364 fprintf( pFile, " -> " );
00365 fprintf( pFile, "Node%d", pFanin->Id );
00366 fprintf( pFile, " [style = %s", fCompl? "dotted" : "bold" );
00367
00368 fprintf( pFile, "]" );
00369 fprintf( pFile, ";\n" );
00370 }
00371 }
00372
00373 fprintf( pFile, "}" );
00374 fprintf( pFile, "\n" );
00375 fprintf( pFile, "\n" );
00376 fclose( pFile );
00377
00378
00379 Vec_PtrForEachEntry( vNodes, pNode, i )
00380 pNode->fMarkC = 0;
00381 if ( vNodesShow )
00382 Vec_PtrForEachEntry( vNodesShow, pNode, i )
00383 pNode->fMarkB = 0;
00384
00385
00386 if ( fHasBdds )
00387 Abc_NtkSopToBdd(pNtk);
00388 }
00389
00390
00403 void Io_WriteDotSeq( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes, Vec_Ptr_t * vNodesShow, char * pFileName, int fGateNames, int fUseReverse )
00404 {
00405 FILE * pFile;
00406 Abc_Obj_t * pNode, * pFanin;
00407 char * pSopString;
00408 int LevelMin, LevelMax, fHasCos, Level, i, k, fHasBdds, fCompl;
00409 int Limit = 300;
00410
00411 assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk) );
00412
00413 if ( vNodes->nSize < 1 )
00414 {
00415 printf( "The set has no nodes. DOT file is not written.\n" );
00416 return;
00417 }
00418
00419 if ( vNodes->nSize > Limit )
00420 {
00421 printf( "The set has more than %d nodes. DOT file is not written.\n", Limit );
00422 return;
00423 }
00424
00425
00426 if ( (pFile = fopen( pFileName, "w" )) == NULL )
00427 {
00428 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", pFileName );
00429 return;
00430 }
00431
00432
00433 if ( fHasBdds = Abc_NtkIsBddLogic(pNtk) )
00434 {
00435 if ( !Abc_NtkBddToSop(pNtk, 0) )
00436 {
00437 printf( "Io_WriteDotNtk(): Converting to SOPs has failed.\n" );
00438 return;
00439 }
00440 }
00441
00442
00443 Vec_PtrForEachEntry( vNodes, pNode, i )
00444 pNode->fMarkC = 1;
00445 if ( vNodesShow )
00446 Vec_PtrForEachEntry( vNodesShow, pNode, i )
00447 pNode->fMarkB = 1;
00448
00449
00450 LevelMax = Abc_NtkLevel( pNtk );
00451 if ( fUseReverse )
00452 {
00453 LevelMin = Abc_NtkLevelReverse( pNtk );
00454 assert( LevelMax == LevelMin );
00455 Vec_PtrForEachEntry( vNodes, pNode, i )
00456 if ( Abc_ObjIsNode(pNode) )
00457 pNode->Level = LevelMax - pNode->Level + 1;
00458 }
00459
00460
00461 LevelMin = 10000;
00462 LevelMax = -1;
00463 fHasCos = 0;
00464 Vec_PtrForEachEntry( vNodes, pNode, i )
00465 {
00466 if ( Abc_ObjIsCo(pNode) )
00467 {
00468 fHasCos = 1;
00469 continue;
00470 }
00471 if ( LevelMin > (int)pNode->Level )
00472 LevelMin = pNode->Level;
00473 if ( LevelMax < (int)pNode->Level )
00474 LevelMax = pNode->Level;
00475 }
00476
00477
00478 if ( fHasCos )
00479 {
00480 LevelMax++;
00481 Vec_PtrForEachEntry( vNodes, pNode, i )
00482 {
00483 if ( Abc_ObjIsCo(pNode) )
00484 pNode->Level = LevelMax;
00485 }
00486 }
00487
00488
00489 fprintf( pFile, "# %s\n", "Network structure generated by ABC" );
00490 fprintf( pFile, "\n" );
00491 fprintf( pFile, "digraph network {\n" );
00492 fprintf( pFile, "size = \"7.5,10\";\n" );
00493
00494
00495
00496
00497
00498 fprintf( pFile, "center = true;\n" );
00499
00500
00501
00502 fprintf( pFile, "edge [dir = back];\n" );
00503 fprintf( pFile, "\n" );
00504
00505
00506 fprintf( pFile, "{\n" );
00507 fprintf( pFile, " node [shape = plaintext];\n" );
00508 fprintf( pFile, " edge [style = invis];\n" );
00509 fprintf( pFile, " LevelTitle1 [label=\"\"];\n" );
00510 fprintf( pFile, " LevelTitle2 [label=\"\"];\n" );
00511
00512 for ( Level = LevelMax; Level >= LevelMin; Level-- )
00513 {
00514
00515 fprintf( pFile, " Level%d", Level );
00516 fprintf( pFile, " [label = " );
00517
00518 fprintf( pFile, "\"" );
00519 fprintf( pFile, "\"" );
00520 fprintf( pFile, "];\n" );
00521 }
00522
00523
00524 fprintf( pFile, " LevelTitle1 -> LevelTitle2 ->" );
00525 for ( Level = LevelMax; Level >= LevelMin; Level-- )
00526 {
00527
00528 fprintf( pFile, " Level%d", Level );
00529
00530 if ( Level != LevelMin )
00531 fprintf( pFile, " ->" );
00532 else
00533 fprintf( pFile, ";" );
00534 }
00535 fprintf( pFile, "\n" );
00536 fprintf( pFile, "}" );
00537 fprintf( pFile, "\n" );
00538 fprintf( pFile, "\n" );
00539
00540
00541 fprintf( pFile, "{\n" );
00542 fprintf( pFile, " rank = same;\n" );
00543 fprintf( pFile, " LevelTitle1;\n" );
00544 fprintf( pFile, " title1 [shape=plaintext,\n" );
00545 fprintf( pFile, " fontsize=20,\n" );
00546 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
00547 fprintf( pFile, " label=\"" );
00548 fprintf( pFile, "%s", "Network structure visualized by ABC" );
00549 fprintf( pFile, "\\n" );
00550 fprintf( pFile, "Benchmark \\\"%s\\\". ", pNtk->pName );
00551 fprintf( pFile, "Time was %s. ", Extra_TimeStamp() );
00552 fprintf( pFile, "\"\n" );
00553 fprintf( pFile, " ];\n" );
00554 fprintf( pFile, "}" );
00555 fprintf( pFile, "\n" );
00556 fprintf( pFile, "\n" );
00557
00558
00559 fprintf( pFile, "{\n" );
00560 fprintf( pFile, " rank = same;\n" );
00561 fprintf( pFile, " LevelTitle2;\n" );
00562 fprintf( pFile, " title2 [shape=plaintext,\n" );
00563 fprintf( pFile, " fontsize=18,\n" );
00564 fprintf( pFile, " fontname = \"Times-Roman\",\n" );
00565 fprintf( pFile, " label=\"" );
00566 if ( Abc_NtkObjNum(pNtk) == Vec_PtrSize(vNodes) )
00567 fprintf( pFile, "The network contains %d logic nodes and %d latches.", Abc_NtkNodeNum(pNtk), Abc_NtkLatchNum(pNtk) );
00568 else
00569 fprintf( pFile, "The set contains %d logic nodes and spans %d levels.", Abc_NtkCountLogicNodes(vNodes), LevelMax - LevelMin + 1 );
00570 fprintf( pFile, "\\n" );
00571 fprintf( pFile, "\"\n" );
00572 fprintf( pFile, " ];\n" );
00573 fprintf( pFile, "}" );
00574 fprintf( pFile, "\n" );
00575 fprintf( pFile, "\n" );
00576
00577
00578 if ( fHasCos )
00579 {
00580 fprintf( pFile, "{\n" );
00581 fprintf( pFile, " rank = same;\n" );
00582
00583 fprintf( pFile, " Level%d;\n", LevelMax );
00584
00585 Vec_PtrForEachEntry( vNodes, pNode, i )
00586 {
00587 if ( !Abc_ObjIsPo(pNode) )
00588 continue;
00589 fprintf( pFile, " Node%d [label = \"%s\"", pNode->Id, Abc_ObjName(pNode) );
00590 fprintf( pFile, ", shape = %s", "invtriangle" );
00591 if ( pNode->fMarkB )
00592 fprintf( pFile, ", style = filled" );
00593 fprintf( pFile, ", color = coral, fillcolor = coral" );
00594 fprintf( pFile, "];\n" );
00595 }
00596 fprintf( pFile, "}" );
00597 fprintf( pFile, "\n" );
00598 fprintf( pFile, "\n" );
00599 }
00600
00601
00602 for ( Level = LevelMax - fHasCos; Level >= LevelMin && Level > 0; Level-- )
00603 {
00604 fprintf( pFile, "{\n" );
00605 fprintf( pFile, " rank = same;\n" );
00606
00607 fprintf( pFile, " Level%d;\n", Level );
00608 Abc_NtkForEachNode( pNtk, pNode, i )
00609 {
00610 if ( (int)pNode->Level != Level )
00611 continue;
00612
00613 if ( Abc_NtkIsStrash(pNtk) )
00614 pSopString = "";
00615 else if ( Abc_NtkHasMapping(pNtk) && fGateNames )
00616 pSopString = Mio_GateReadName(pNode->pData);
00617 else if ( Abc_NtkHasMapping(pNtk) )
00618 pSopString = Abc_NtkPrintSop(Mio_GateReadSop(pNode->pData));
00619 else
00620 pSopString = Abc_NtkPrintSop(pNode->pData);
00621 fprintf( pFile, " Node%d [label = \"%d\\n%s\"", pNode->Id, pNode->Id, pSopString );
00622
00623 fprintf( pFile, ", shape = ellipse" );
00624 if ( pNode->fMarkB )
00625 fprintf( pFile, ", style = filled" );
00626 fprintf( pFile, "];\n" );
00627 }
00628 fprintf( pFile, "}" );
00629 fprintf( pFile, "\n" );
00630 fprintf( pFile, "\n" );
00631 }
00632
00633
00634 if ( LevelMin == 0 )
00635 {
00636 fprintf( pFile, "{\n" );
00637 fprintf( pFile, " rank = same;\n" );
00638
00639 fprintf( pFile, " Level%d;\n", LevelMin );
00640
00641 Vec_PtrForEachEntry( vNodes, pNode, i )
00642 {
00643 if ( pNode->Level > 0 )
00644 continue;
00645 if ( !Abc_ObjIsPi(pNode) )
00646 {
00647
00648 if ( Abc_ObjFaninNum(pNode) == 0 && Abc_ObjFanoutNum(pNode) > 0 )
00649 {
00650 fprintf( pFile, " Node%d [label = \"Const1\"", pNode->Id );
00651 fprintf( pFile, ", shape = ellipse" );
00652 if ( pNode->fMarkB )
00653 fprintf( pFile, ", style = filled" );
00654 fprintf( pFile, ", color = coral, fillcolor = coral" );
00655 fprintf( pFile, "];\n" );
00656 }
00657 continue;
00658 }
00659 fprintf( pFile, " Node%d [label = \"%s\"", pNode->Id, Abc_ObjName(pNode) );
00660 fprintf( pFile, ", shape = %s", "triangle" );
00661 if ( pNode->fMarkB )
00662 fprintf( pFile, ", style = filled" );
00663 fprintf( pFile, ", color = coral, fillcolor = coral" );
00664 fprintf( pFile, "];\n" );
00665 }
00666 fprintf( pFile, "}" );
00667 fprintf( pFile, "\n" );
00668 fprintf( pFile, "\n" );
00669 }
00670
00671
00672 Vec_PtrForEachEntry( vNodes, pNode, i )
00673 {
00674 if ( !Abc_ObjIsLatch(pNode) )
00675 continue;
00676 fprintf( pFile, "Node%d [label = \"%s\"", pNode->Id, Abc_ObjName(pNode) );
00677 fprintf( pFile, ", shape = box" );
00678 if ( pNode->fMarkB )
00679 fprintf( pFile, ", style = filled" );
00680 fprintf( pFile, ", color = coral, fillcolor = coral" );
00681 fprintf( pFile, "];\n" );
00682 }
00683
00684
00685 fprintf( pFile, "\n" );
00686
00687
00688 fprintf( pFile, "title1 -> title2 [style = invis];\n" );
00689 Vec_PtrForEachEntry( vNodes, pNode, i )
00690 {
00691 if ( (int)pNode->Level != LevelMax )
00692 continue;
00693 if ( !Abc_ObjIsPo(pNode) )
00694 continue;
00695 fprintf( pFile, "title2 -> Node%d [style = invis];\n", pNode->Id );
00696 }
00697
00698
00699 Vec_PtrForEachEntry( vNodes, pNode, i )
00700 {
00701 if ( Abc_ObjIsBi(pNode) || Abc_ObjIsBo(pNode) )
00702 continue;
00703 Abc_ObjForEachFanin( pNode, pFanin, k )
00704 {
00705 fCompl = 0;
00706 if ( Abc_NtkIsStrash(pNtk) )
00707 {
00708 if ( Abc_ObjIsBi(pFanin) )
00709 fCompl = Abc_ObjFaninC(pFanin, k);
00710 else
00711 fCompl = Abc_ObjFaninC(pNode, k);
00712 }
00713 if ( Abc_ObjIsBi(pFanin) || Abc_ObjIsBo(pFanin) )
00714 pFanin = Abc_ObjFanin0(pFanin);
00715 if ( Abc_ObjIsBi(pFanin) || Abc_ObjIsBo(pFanin) )
00716 pFanin = Abc_ObjFanin0(pFanin);
00717 if ( !pFanin->fMarkC )
00718 continue;
00719
00720
00721 fprintf( pFile, "Node%d", pNode->Id );
00722 fprintf( pFile, " -> " );
00723 fprintf( pFile, "Node%d", pFanin->Id );
00724 fprintf( pFile, " [style = %s", fCompl? "dotted" : "bold" );
00725
00726 fprintf( pFile, "]" );
00727 fprintf( pFile, ";\n" );
00728 }
00729 }
00730
00731 fprintf( pFile, "}" );
00732 fprintf( pFile, "\n" );
00733 fprintf( pFile, "\n" );
00734 fclose( pFile );
00735
00736
00737 Vec_PtrForEachEntry( vNodes, pNode, i )
00738 pNode->fMarkC = 0;
00739 if ( vNodesShow )
00740 Vec_PtrForEachEntry( vNodesShow, pNode, i )
00741 pNode->fMarkB = 0;
00742
00743
00744 if ( fHasBdds )
00745 Abc_NtkSopToBdd(pNtk);
00746 }
00747
00748
00760 char * Abc_NtkPrintSop( char * pSop )
00761 {
00762 static char Buffer[1000];
00763 char * pGet, * pSet;
00764 pSet = Buffer;
00765 for ( pGet = pSop; *pGet; pGet++ )
00766 {
00767 if ( *pGet == '\n' )
00768 {
00769 *pSet++ = '\\';
00770 *pSet++ = 'n';
00771 }
00772 else
00773 *pSet++ = *pGet;
00774 }
00775 *(pSet-2) = 0;
00776 return Buffer;
00777 }
00778
00790 int Abc_NtkCountLogicNodes( Vec_Ptr_t * vNodes )
00791 {
00792 Abc_Obj_t * pObj;
00793 int i, Counter = 0;
00794 Vec_PtrForEachEntry( vNodes, pObj, i )
00795 {
00796 if ( !Abc_ObjIsNode(pObj) )
00797 continue;
00798 if ( Abc_ObjFaninNum(pObj) == 0 && Abc_ObjFanoutNum(pObj) == 0 )
00799 continue;
00800 Counter ++;
00801 }
00802 return Counter;
00803 }
00804
00808
00809