76 int LevelMin, LevelMax, fHasCos, Level, i, k, fHasBdds, fCompl, Prev;
81 if ( vNodes->nSize < 1 )
83 printf(
"The set has no nodes. DOT file is not written.\n" );
87 if ( vNodes->nSize > Limit )
89 printf(
"The set has more than %d nodes. DOT file is not written.\n", Limit );
94 if ( (pFile = fopen( pFileName,
"w" )) == NULL )
96 fprintf( stdout,
"Cannot open the intermediate file \"%s\".\n", pFileName );
105 printf(
"Io_WriteDotNtk(): Converting to SOPs has failed.\n" );
122 assert( LevelMax == LevelMin );
139 if ( LevelMin > (
int)pNode->
Level )
140 LevelMin = pNode->
Level;
141 if ( LevelMax < (
int)pNode->
Level )
142 LevelMax = pNode->
Level;
152 pNode->
Level = LevelMax;
157 fprintf( pFile,
"# %s\n",
"Network structure generated by ABC" );
158 fprintf( pFile,
"\n" );
159 fprintf( pFile,
"digraph network {\n" );
160 fprintf( pFile,
"size = \"7.5,10\";\n" );
166 fprintf( pFile,
"center = true;\n" );
170 fprintf( pFile,
"edge [dir = back];\n" );
171 fprintf( pFile,
"\n" );
174 fprintf( pFile,
"{\n" );
175 fprintf( pFile,
" node [shape = plaintext];\n" );
176 fprintf( pFile,
" edge [style = invis];\n" );
177 fprintf( pFile,
" LevelTitle1 [label=\"\"];\n" );
178 fprintf( pFile,
" LevelTitle2 [label=\"\"];\n" );
180 for ( Level = LevelMax; Level >= LevelMin; Level-- )
183 fprintf( pFile,
" Level%d", Level );
184 fprintf( pFile,
" [label = " );
186 fprintf( pFile,
"\"" );
187 fprintf( pFile,
"\"" );
188 fprintf( pFile,
"];\n" );
192 fprintf( pFile,
" LevelTitle1 -> LevelTitle2 ->" );
193 for ( Level = LevelMax; Level >= LevelMin; Level-- )
196 fprintf( pFile,
" Level%d", Level );
198 if ( Level != LevelMin )
199 fprintf( pFile,
" ->" );
201 fprintf( pFile,
";" );
203 fprintf( pFile,
"\n" );
204 fprintf( pFile,
"}" );
205 fprintf( pFile,
"\n" );
206 fprintf( pFile,
"\n" );
209 fprintf( pFile,
"{\n" );
210 fprintf( pFile,
" rank = same;\n" );
211 fprintf( pFile,
" LevelTitle1;\n" );
212 fprintf( pFile,
" title1 [shape=plaintext,\n" );
213 fprintf( pFile,
" fontsize=20,\n" );
214 fprintf( pFile,
" fontname = \"Times-Roman\",\n" );
215 fprintf( pFile,
" label=\"" );
216 fprintf( pFile,
"%s",
"Network structure visualized by ABC" );
217 fprintf( pFile,
"\\n" );
218 fprintf( pFile,
"Benchmark \\\"%s\\\". ", pNtk->
pName );
220 fprintf( pFile,
"\"\n" );
221 fprintf( pFile,
" ];\n" );
222 fprintf( pFile,
"}" );
223 fprintf( pFile,
"\n" );
224 fprintf( pFile,
"\n" );
227 fprintf( pFile,
"{\n" );
228 fprintf( pFile,
" rank = same;\n" );
229 fprintf( pFile,
" LevelTitle2;\n" );
230 fprintf( pFile,
" title2 [shape=plaintext,\n" );
231 fprintf( pFile,
" fontsize=18,\n" );
232 fprintf( pFile,
" fontname = \"Times-Roman\",\n" );
233 fprintf( pFile,
" label=\"" );
237 fprintf( pFile,
"The set contains %d logic nodes and spans %d levels.",
Abc_NtkCountLogicNodes(vNodes), LevelMax - LevelMin + 1 );
238 fprintf( pFile,
"\\n" );
239 fprintf( pFile,
"\"\n" );
240 fprintf( pFile,
" ];\n" );
241 fprintf( pFile,
"}" );
242 fprintf( pFile,
"\n" );
243 fprintf( pFile,
"\n" );
248 fprintf( pFile,
"{\n" );
249 fprintf( pFile,
" rank = same;\n" );
251 fprintf( pFile,
" Level%d;\n", LevelMax );
257 fprintf( pFile,
" Node%d [label = \"%s%s\"",
261 fprintf( pFile,
", shape = %s", (
Abc_ObjIsBi(pNode)?
"box":
"invtriangle") );
263 fprintf( pFile,
", style = filled" );
264 fprintf( pFile,
", color = coral, fillcolor = coral" );
265 fprintf( pFile,
"];\n" );
267 fprintf( pFile,
"}" );
268 fprintf( pFile,
"\n" );
269 fprintf( pFile,
"\n" );
273 for ( Level = LevelMax - fHasCos; Level >= LevelMin && Level > 0; Level-- )
275 fprintf( pFile,
"{\n" );
276 fprintf( pFile,
" rank = same;\n" );
278 fprintf( pFile,
" Level%d;\n", Level );
281 if ( (
int)pNode->
Level != Level )
307 fprintf( pFile,
" Node%d [label = \"%d\\n%s\"", pNode->
Id, pNode->
Id, pSopString );
312 fprintf( pFile,
", shape = ellipse" );
314 fprintf( pFile,
", style = filled" );
315 fprintf( pFile,
"];\n" );
317 fprintf( pFile,
"}" );
318 fprintf( pFile,
"\n" );
319 fprintf( pFile,
"\n" );
325 fprintf( pFile,
"{\n" );
326 fprintf( pFile,
" rank = same;\n" );
328 fprintf( pFile,
" Level%d;\n", LevelMin );
338 fprintf( pFile,
", shape = ellipse" );
340 fprintf( pFile,
", style = filled" );
341 fprintf( pFile,
", color = coral, fillcolor = coral" );
342 fprintf( pFile,
"];\n" );
346 fprintf( pFile,
" Node%d [label = \"%s\"",
349 fprintf( pFile,
", shape = %s", (
Abc_ObjIsBo(pNode)?
"box":
"triangle") );
351 fprintf( pFile,
", style = filled" );
352 fprintf( pFile,
", color = coral, fillcolor = coral" );
353 fprintf( pFile,
"];\n" );
355 fprintf( pFile,
"}" );
356 fprintf( pFile,
"\n" );
357 fprintf( pFile,
"\n" );
361 fprintf( pFile,
"title1 -> title2 [style = invis];\n" );
364 if ( (
int)pNode->
Level != LevelMax )
366 fprintf( pFile,
"title2 -> Node%d [style = invis];\n", pNode->
Id );
372 if ( (
int)pNode->
Level != LevelMax )
377 fprintf( pFile,
"Node%d -> Node%d [style = invis];\n", Prev, pNode->
Id );
394 fprintf( pFile,
"Node%d", pNode->
Id );
395 fprintf( pFile,
" -> " );
396 fprintf( pFile,
"Node%d", pFanin->
Id );
397 fprintf( pFile,
" [style = %s", fCompl?
"dotted" :
"bold" );
399 fprintf( pFile,
"]" );
400 fprintf( pFile,
";\n" );
404 fprintf( pFile,
"}" );
405 fprintf( pFile,
"\n" );
406 fprintf( pFile,
"\n" );
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 );
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" );
805 static char Buffer[1000];
808 for ( pGet = pSop; *pGet; pGet++ )
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
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 Vec_Ptr_t * Abc_NtkCollectObjects(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
#define ABC_NAMESPACE_IMPL_END
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
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)
void Io_WriteDotNtk(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes, Vec_Ptr_t *vNodesShow, char *pFileName, int fGateNames, int fUseReverse)
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
void Io_WriteDotSeq(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes, Vec_Ptr_t *vNodesShow, char *pFileName, int fGateNames, int fUseReverse)
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
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)
void Io_WriteDot(Abc_Ntk_t *pNtk, char *FileName)
FUNCTION DEFINITIONS ///.
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
static void Vec_PtrFree(Vec_Ptr_t *p)