src/base/io/ioWriteGml.c File Reference

#include "io.h"
Include dependency graph for ioWriteGml.c:

Go to the source code of this file.

Functions

void Io_WriteGml (Abc_Ntk_t *pNtk, char *pFileName)

Function Documentation

void Io_WriteGml ( Abc_Ntk_t pNtk,
char *  pFileName 
)

CFile****************************************************************

FileName [ioWriteGml.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Procedures to write the graph structure of AIG in GML.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
ioWriteGml.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Writes the graph structure of AIG in GML.]

Description [Useful for graph visualization using tools such as yEd: http://www.yworks.com/]

SideEffects []

SeeAlso []

Definition at line 43 of file ioWriteGml.c.

00044 {
00045     FILE * pFile;
00046     Abc_Obj_t * pObj, * pFanin;
00047     int i, k;
00048 
00049     assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk)  );
00050 
00051     // start the output stream
00052     pFile = fopen( pFileName, "w" );
00053     if ( pFile == NULL )
00054     {
00055         fprintf( stdout, "Io_WriteGml(): Cannot open the output file \"%s\".\n", pFileName );
00056         return;
00057     }
00058     fprintf( pFile, "# GML for \"%s\" written by ABC on %s\n", pNtk->pName, Extra_TimeStamp() );
00059         fprintf( pFile, "graph [\n" );
00060 
00061     // output the POs
00062     fprintf( pFile, "\n" );
00063     Abc_NtkForEachPo( pNtk, pObj, i )
00064     {
00065         fprintf( pFile, "    node [ id %5d label \"%s\"\n", pObj->Id, Abc_ObjName(pObj) );
00066         fprintf( pFile, "        graphics [ type \"triangle\" fill \"#00FFFF\" ]\n" );   // blue
00067         fprintf( pFile, "    ]\n" );
00068     }
00069     // output the PIs
00070     fprintf( pFile, "\n" );
00071     Abc_NtkForEachPi( pNtk, pObj, i )
00072     {
00073         fprintf( pFile, "    node [ id %5d label \"%s\"\n", pObj->Id, Abc_ObjName(pObj) );
00074         fprintf( pFile, "        graphics [ type \"triangle\" fill \"#00FF00\" ]\n" );   // green
00075         fprintf( pFile, "    ]\n" );
00076     }
00077     // output the latches
00078     fprintf( pFile, "\n" );
00079     Abc_NtkForEachLatch( pNtk, pObj, i )
00080     {
00081         fprintf( pFile, "    node [ id %5d label \"%s\"\n", pObj->Id, Abc_ObjName(pObj) );
00082         fprintf( pFile, "        graphics [ type \"rectangle\" fill \"#FF0000\" ]\n" );   // red
00083         fprintf( pFile, "    ]\n" );
00084     }
00085     // output the nodes
00086     fprintf( pFile, "\n" );
00087     Abc_NtkForEachNode( pNtk, pObj, i )
00088     {
00089         fprintf( pFile, "    node [ id %5d label \"%s\"\n", pObj->Id, Abc_ObjName(pObj) );
00090         fprintf( pFile, "        graphics [ type \"ellipse\" fill \"#CCCCFF\" ]\n" );     // grey
00091         fprintf( pFile, "    ]\n" );
00092     }
00093 
00094     // output the edges
00095     fprintf( pFile, "\n" );
00096     Abc_NtkForEachObj( pNtk, pObj, i )
00097     {
00098         Abc_ObjForEachFanin( pObj, pFanin, k )
00099         {
00100             fprintf( pFile, "    edge [ source %5d   target %5d\n", pObj->Id, pFanin->Id );
00101             fprintf( pFile, "        graphics [ type \"line\" arrow \"first\" ]\n" );
00102             fprintf( pFile, "    ]\n" );
00103         }
00104     }
00105 
00106         fprintf( pFile, "]\n" );
00107         fprintf( pFile, "\n" );
00108         fclose( pFile );
00109 }


Generated on Tue Jan 5 12:18:48 2010 for abc70930 by  doxygen 1.6.1