439 int LevelMin, LevelMax, fHasCos, Level, i, k, fHasBdds, fCompl, Prev;
444 if ( vNodes->nSize < 1 )
446 printf(
"The set has no nodes. DOT file is not written.\n" );
450 if ( vNodes->nSize > Limit )
452 printf(
"The set has more than %d nodes. DOT file is not written.\n", Limit );
457 if ( (pFile = fopen( pFileName,
"w" )) == NULL )
459 fprintf( stdout,
"Cannot open the intermediate file \"%s\".\n", pFileName );
468 printf(
"Io_WriteDotNtk(): Converting to SOPs has failed.\n" );
485 assert( LevelMax == LevelMin );
488 pNode->Level = LevelMax - pNode->Level + 1;
502 if ( LevelMin > (
int)pNode->Level )
503 LevelMin = pNode->Level;
504 if ( LevelMax < (
int)pNode->Level )
505 LevelMax = pNode->Level;
515 pNode->Level = LevelMax;
520 fprintf( pFile,
"# %s\n",
"Network structure generated by ABC" );
521 fprintf( pFile,
"\n" );
522 fprintf( pFile,
"digraph network {\n" );
523 fprintf( pFile,
"size = \"7.5,10\";\n" );
529 fprintf( pFile,
"center = true;\n" );
533 fprintf( pFile,
"edge [dir = back];\n" );
534 fprintf( pFile,
"\n" );
537 fprintf( pFile,
"{\n" );
538 fprintf( pFile,
" node [shape = plaintext];\n" );
539 fprintf( pFile,
" edge [style = invis];\n" );
540 fprintf( pFile,
" LevelTitle1 [label=\"\"];\n" );
541 fprintf( pFile,
" LevelTitle2 [label=\"\"];\n" );
543 for ( Level = LevelMax; Level >= LevelMin; Level-- )
546 fprintf( pFile,
" Level%d", Level );
547 fprintf( pFile,
" [label = " );
549 fprintf( pFile,
"\"" );
550 fprintf( pFile,
"\"" );
551 fprintf( pFile,
"];\n" );
555 fprintf( pFile,
" LevelTitle1 -> LevelTitle2 ->" );
556 for ( Level = LevelMax; Level >= LevelMin; Level-- )
559 fprintf( pFile,
" Level%d", Level );
561 if ( Level != LevelMin )
562 fprintf( pFile,
" ->" );
564 fprintf( pFile,
";" );
566 fprintf( pFile,
"\n" );
567 fprintf( pFile,
"}" );
568 fprintf( pFile,
"\n" );
569 fprintf( pFile,
"\n" );
572 fprintf( pFile,
"{\n" );
573 fprintf( pFile,
" rank = same;\n" );
574 fprintf( pFile,
" LevelTitle1;\n" );
575 fprintf( pFile,
" title1 [shape=plaintext,\n" );
576 fprintf( pFile,
" fontsize=20,\n" );
577 fprintf( pFile,
" fontname = \"Times-Roman\",\n" );
578 fprintf( pFile,
" label=\"" );
579 fprintf( pFile,
"%s",
"Network structure visualized by ABC" );
580 fprintf( pFile,
"\\n" );
581 fprintf( pFile,
"Benchmark \\\"%s\\\". ", pNtk->pName );
583 fprintf( pFile,
"\"\n" );
584 fprintf( pFile,
" ];\n" );
585 fprintf( pFile,
"}" );
586 fprintf( pFile,
"\n" );
587 fprintf( pFile,
"\n" );
590 fprintf( pFile,
"{\n" );
591 fprintf( pFile,
" rank = same;\n" );
592 fprintf( pFile,
" LevelTitle2;\n" );
593 fprintf( pFile,
" title2 [shape=plaintext,\n" );
594 fprintf( pFile,
" fontsize=18,\n" );
595 fprintf( pFile,
" fontname = \"Times-Roman\",\n" );
596 fprintf( pFile,
" label=\"" );
600 fprintf( pFile,
"The set contains %d logic nodes and spans %d levels.",
Abc_NtkCountLogicNodes(vNodes), LevelMax - LevelMin + 1 );
601 fprintf( pFile,
"\\n" );
602 fprintf( pFile,
"\"\n" );
603 fprintf( pFile,
" ];\n" );
604 fprintf( pFile,
"}" );
605 fprintf( pFile,
"\n" );
606 fprintf( pFile,
"\n" );
611 fprintf( pFile,
"{\n" );
612 fprintf( pFile,
" rank = same;\n" );
614 fprintf( pFile,
" Level%d;\n", LevelMax );
620 fprintf( pFile,
" Node%d [label = \"%s\"", pNode->Id,
Abc_ObjName(pNode) );
621 fprintf( pFile,
", shape = %s",
"invtriangle" );
623 fprintf( pFile,
", style = filled" );
624 fprintf( pFile,
", color = coral, fillcolor = coral" );
625 fprintf( pFile,
"];\n" );
627 fprintf( pFile,
"}" );
628 fprintf( pFile,
"\n" );
629 fprintf( pFile,
"\n" );
633 for ( Level = LevelMax - fHasCos; Level >= LevelMin && Level > 0; Level-- )
635 fprintf( pFile,
"{\n" );
636 fprintf( pFile,
" rank = same;\n" );
638 fprintf( pFile,
" Level%d;\n", Level );
641 if ( (
int)pNode->Level != Level )
652 fprintf( pFile,
" Node%d [label = \"%d\\n%s\"", pNode->Id, pNode->Id, pSopString );
654 fprintf( pFile,
", shape = ellipse" );
656 fprintf( pFile,
", style = filled" );
657 fprintf( pFile,
"];\n" );
659 fprintf( pFile,
"}" );
660 fprintf( pFile,
"\n" );
661 fprintf( pFile,
"\n" );
667 fprintf( pFile,
"{\n" );
668 fprintf( pFile,
" rank = same;\n" );
670 fprintf( pFile,
" Level%d;\n", LevelMin );
674 if ( pNode->Level > 0 )
681 fprintf( pFile,
" Node%d [label = \"Const1\"", pNode->Id );
682 fprintf( pFile,
", shape = ellipse" );
684 fprintf( pFile,
", style = filled" );
685 fprintf( pFile,
", color = coral, fillcolor = coral" );
686 fprintf( pFile,
"];\n" );
690 fprintf( pFile,
" Node%d [label = \"%s\"", pNode->Id,
Abc_ObjName(pNode) );
691 fprintf( pFile,
", shape = %s",
"triangle" );
693 fprintf( pFile,
", style = filled" );
694 fprintf( pFile,
", color = coral, fillcolor = coral" );
695 fprintf( pFile,
"];\n" );
697 fprintf( pFile,
"}" );
698 fprintf( pFile,
"\n" );
699 fprintf( pFile,
"\n" );
707 fprintf( pFile,
"Node%d [label = \"%s\"", pNode->Id,
Abc_ObjName(pNode) );
708 fprintf( pFile,
", shape = box" );
710 fprintf( pFile,
", style = filled" );
711 fprintf( pFile,
", color = coral, fillcolor = coral" );
712 fprintf( pFile,
"];\n" );
716 fprintf( pFile,
"\n" );
719 fprintf( pFile,
"title1 -> title2 [style = invis];\n" );
722 if ( (
int)pNode->Level != LevelMax )
726 fprintf( pFile,
"title2 -> Node%d [style = invis];\n", pNode->Id );
732 if ( (
int)pNode->Level != LevelMax )
737 fprintf( pFile,
"Node%d -> Node%d [style = invis];\n", Prev, pNode->Id );
764 fprintf( pFile,
"Node%d", pNode->Id );
765 fprintf( pFile,
" -> " );
766 fprintf( pFile,
"Node%d", pFanin->
Id );
767 fprintf( pFile,
" [style = %s", fCompl?
"dotted" :
"bold" );
769 fprintf( pFile,
"]" );
770 fprintf( pFile,
";\n" );
774 fprintf( pFile,
"}" );
775 fprintf( pFile,
"\n" );
776 fprintf( pFile,
"\n" );
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
static int Vec_PtrSize(Vec_Ptr_t *p)
ABC_DLL int Abc_NtkLevelReverse(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
static ABC_NAMESPACE_IMPL_START char * Abc_NtkPrintSop(char *pSop)
DECLARATIONS ///.
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
static int Abc_ObjFaninC(Abc_Obj_t *pObj, int i)
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
static int Abc_NtkCountLogicNodes(Vec_Ptr_t *vNodes)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Abc_NtkObjNum(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
char * Mio_GateReadName(Mio_Gate_t *pGate)
char * Mio_GateReadSop(Mio_Gate_t *pGate)