src/base/io/ioWriteList.c File Reference

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

Go to the source code of this file.

Functions

static void Io_WriteListEdge (FILE *pFile, Abc_Obj_t *pObj)
static void Io_WriteListHost (FILE *pFile, Abc_Ntk_t *pNtk)
void Io_WriteList (Abc_Ntk_t *pNtk, char *pFileName, int fUseHost)
void Io_WriteCellNet (Abc_Ntk_t *pNtk, char *pFileName)

Function Documentation

void Io_WriteCellNet ( Abc_Ntk_t pNtk,
char *  pFileName 
)

Function*************************************************************

Synopsis [Writes the adjacency list for a sequential AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file ioWriteList.c.

00219 {
00220     FILE * pFile;
00221     Abc_Obj_t * pObj, * pFanout;
00222     int i, k;
00223 
00224     assert( Abc_NtkIsLogic(pNtk)  );
00225 
00226     // start the output stream
00227     pFile = fopen( pFileName, "w" );
00228     if ( pFile == NULL )
00229     {
00230         fprintf( stdout, "Io_WriteCellNet(): Cannot open the output file \"%s\".\n", pFileName );
00231         return;
00232     }
00233 
00234     fprintf( pFile, "# CellNet file for network \"%s\" written by ABC on %s\n", pNtk->pName, Extra_TimeStamp() );
00235 
00236     // the only tricky part with writing is handling latches:
00237     // each latch comes with (a) single-input latch-input node, (b) latch proper, (c) single-input latch-output node
00238     // we arbitrarily decide to use the interger ID of the latch-input node to represent the latch in the file
00239     // (this ID is used for both the cell and the net driven by that cell)
00240 
00241     // write the PIs
00242     Abc_NtkForEachPi( pNtk, pObj, i )
00243         fprintf( pFile, "cell %d is 0\n", pObj->Id );
00244     // write the POs
00245     Abc_NtkForEachPo( pNtk, pObj, i )
00246         fprintf( pFile, "cell %d is 1\n", pObj->Id );
00247     // write the latches (use the ID of latch input)
00248     Abc_NtkForEachLatch( pNtk, pObj, i )
00249         fprintf( pFile, "cell %d is 2\n", Abc_ObjFanin0(pObj)->Id );
00250     // write the logic nodes
00251     Abc_NtkForEachNode( pNtk, pObj, i )
00252         fprintf( pFile, "cell %d is %d\n", pObj->Id, 3+Abc_ObjFaninNum(pObj) );
00253 
00254     // write the nets driven by PIs
00255     Abc_NtkForEachPi( pNtk, pObj, i )
00256     {
00257         fprintf( pFile, "net %d  %d 0", pObj->Id, pObj->Id );
00258         Abc_ObjForEachFanout( pObj, pFanout, k )
00259             fprintf( pFile, "  %d %d", pFanout->Id, 1 + Abc_ObjFanoutFaninNum(pFanout, pObj) );
00260             fprintf( pFile, "\n" );
00261     }
00262     // write the nets driven by latches
00263     Abc_NtkForEachLatch( pNtk, pObj, i )
00264     {
00265         fprintf( pFile, "net %d  %d 0", Abc_ObjFanin0(pObj)->Id, Abc_ObjFanin0(pObj)->Id );
00266         pObj = Abc_ObjFanout0(pObj);
00267         Abc_ObjForEachFanout( pObj, pFanout, k )
00268             fprintf( pFile, "  %d %d", pFanout->Id, 1 + Abc_ObjFanoutFaninNum(pFanout, pObj) );
00269             fprintf( pFile, "\n" );
00270     }
00271     // write the nets driven by nodes
00272     Abc_NtkForEachNode( pNtk, pObj, i )
00273     {
00274         fprintf( pFile, "net %d  %d 0", pObj->Id, pObj->Id );
00275         Abc_ObjForEachFanout( pObj, pFanout, k )
00276             fprintf( pFile, "  %d %d", pFanout->Id, 1 + Abc_ObjFanoutFaninNum(pFanout, pObj) );
00277             fprintf( pFile, "\n" );
00278     }
00279 
00280         fprintf( pFile, "\n" );
00281         fclose( pFile );
00282 }

void Io_WriteList ( Abc_Ntk_t pNtk,
char *  pFileName,
int  fUseHost 
)

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Writes the adjacency list for a sequential AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file ioWriteList.c.

00100 {
00101     FILE * pFile;
00102     Abc_Obj_t * pObj;
00103     int i;
00104 
00105 //    assert( Abc_NtkIsSeq(pNtk)  );
00106 
00107     // start the output stream
00108     pFile = fopen( pFileName, "w" );
00109     if ( pFile == NULL )
00110     {
00111         fprintf( stdout, "Io_WriteList(): Cannot open the output file \"%s\".\n", pFileName );
00112         return;
00113     }
00114 
00115     fprintf( pFile, "# Adjacency list for sequential AIG \"%s\"\n", pNtk->pName );
00116     fprintf( pFile, "# written by ABC on %s\n", Extra_TimeStamp() );
00117 
00118     // write the constant node
00119     if ( Abc_ObjFanoutNum( Abc_AigConst1(pNtk) ) > 0 )
00120         Io_WriteListEdge( pFile, Abc_AigConst1(pNtk) );
00121 
00122     // write the PI edges
00123     Abc_NtkForEachPi( pNtk, pObj, i )
00124         Io_WriteListEdge( pFile, pObj );
00125 
00126     // write the internal nodes
00127     Abc_AigForEachAnd( pNtk, pObj, i )
00128         Io_WriteListEdge( pFile, pObj );
00129 
00130     // write the host node
00131     if ( fUseHost )
00132         Io_WriteListHost( pFile, pNtk );
00133     else
00134         Abc_NtkForEachPo( pNtk, pObj, i )
00135             Io_WriteListEdge( pFile, pObj );
00136 
00137         fprintf( pFile, "\n" );
00138         fclose( pFile );
00139 }

void Io_WriteListEdge ( FILE *  pFile,
Abc_Obj_t pObj 
) [static]

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

FileName [ioWriteList.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

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

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

Function*************************************************************

Synopsis [Writes the adjacency list for one edge in a sequential AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file ioWriteList.c.

00153 {
00154     Abc_Obj_t * pFanout;
00155     int i;
00156     fprintf( pFile, "%-10s >    ", Abc_ObjName(pObj) );
00157     Abc_ObjForEachFanout( pObj, pFanout, i )
00158     {
00159         fprintf( pFile, " %s", Abc_ObjName(pFanout) );
00160         fprintf( pFile, " ([%s_to_", Abc_ObjName(pObj) );
00161 //        fprintf( pFile, "%s] = %d)", Abc_ObjName(pFanout), Seq_ObjFanoutL(pObj, pFanout) );
00162         fprintf( pFile, "%s] = %d)", Abc_ObjName(pFanout), 0 );
00163         if ( i != Abc_ObjFanoutNum(pObj) - 1 )
00164             fprintf( pFile, "," );
00165     }
00166     fprintf( pFile, "." );
00167     fprintf( pFile, "\n" );
00168 }

void Io_WriteListHost ( FILE *  pFile,
Abc_Ntk_t pNtk 
) [static]

Function*************************************************************

Synopsis [Writes the adjacency list for one edge in a sequential AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file ioWriteList.c.

00182 {
00183     Abc_Obj_t * pObj;
00184     int i;
00185 
00186     Abc_NtkForEachPo( pNtk, pObj, i )
00187     {
00188         fprintf( pFile, "%-10s >    ", Abc_ObjName(pObj) );
00189         fprintf( pFile, " %s ([%s_to_%s] = %d)", "HOST", Abc_ObjName(pObj), "HOST", 0 );
00190         fprintf( pFile, "." );
00191         fprintf( pFile, "\n" );
00192     }
00193 
00194     fprintf( pFile, "%-10s >    ", "HOST" );
00195     Abc_NtkForEachPi( pNtk, pObj, i )
00196     {
00197         fprintf( pFile, " %s", Abc_ObjName(pObj) );
00198         fprintf( pFile, " ([%s_to_%s] = %d)", "HOST", Abc_ObjName(pObj), 0 );
00199         if ( i != Abc_NtkPiNum(pNtk) - 1 )
00200             fprintf( pFile, "," );
00201     }
00202     fprintf( pFile, "." );
00203     fprintf( pFile, "\n" );
00204 }


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