src/base/io/io.c File Reference

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

Go to the source code of this file.

Functions

static int IoCommandRead (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadAiger (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadBaf (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadBlif (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadBlifMv (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadBench (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadDsd (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadEdif (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadEqn (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadInit (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadPla (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadTruth (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadVerilog (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadVer (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandReadVerLib (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWrite (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteHie (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteAiger (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteBaf (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteBlif (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteBlifMv (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteBench (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteCellNet (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteCnf (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteCounter (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteDot (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteEqn (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteGml (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteList (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWritePla (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteVerilog (Abc_Frame_t *pAbc, int argc, char **argv)
static int IoCommandWriteVerLib (Abc_Frame_t *pAbc, int argc, char **argv)
void Io_Init (Abc_Frame_t *pAbc)
void Io_End ()

Variables

int glo_fMapped

Function Documentation

void Io_End (  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file io.c.

00128 {
00129 }

void Io_Init ( Abc_Frame_t pAbc  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file io.c.

00080 {
00081     Cmd_CommandAdd( pAbc, "I/O", "read",          IoCommandRead,         1 );
00082     Cmd_CommandAdd( pAbc, "I/O", "read_aiger",    IoCommandReadAiger,    1 );
00083     Cmd_CommandAdd( pAbc, "I/O", "read_baf",      IoCommandReadBaf,      1 );
00084     Cmd_CommandAdd( pAbc, "I/O", "read_blif",     IoCommandReadBlif,     1 );
00085     Cmd_CommandAdd( pAbc, "I/O", "read_blif_mv",  IoCommandReadBlifMv,   1 );
00086     Cmd_CommandAdd( pAbc, "I/O", "read_bench",    IoCommandReadBench,    1 );
00087     Cmd_CommandAdd( pAbc, "I/O", "read_dsd",      IoCommandReadDsd,      1 );
00088 //    Cmd_CommandAdd( pAbc, "I/O", "read_edif",     IoCommandReadEdif,     1 );
00089     Cmd_CommandAdd( pAbc, "I/O", "read_eqn",      IoCommandReadEqn,      1 );
00090     Cmd_CommandAdd( pAbc, "I/O", "read_init",     IoCommandReadInit,     1 );
00091     Cmd_CommandAdd( pAbc, "I/O", "read_pla",      IoCommandReadPla,      1 );
00092     Cmd_CommandAdd( pAbc, "I/O", "read_truth",    IoCommandReadTruth,    1 );
00093     Cmd_CommandAdd( pAbc, "I/O", "read_verilog",  IoCommandReadVerilog,  1 );
00094 //    Cmd_CommandAdd( pAbc, "I/O", "read_ver",      IoCommandReadVer,      1 );
00095 //    Cmd_CommandAdd( pAbc, "I/O", "read_verlib",   IoCommandReadVerLib,   0 );
00096 
00097     Cmd_CommandAdd( pAbc, "I/O", "write",         IoCommandWrite,        0 );
00098     Cmd_CommandAdd( pAbc, "I/O", "write_hie",     IoCommandWriteHie,     0 );
00099     Cmd_CommandAdd( pAbc, "I/O", "write_aiger",   IoCommandWriteAiger,   0 );
00100     Cmd_CommandAdd( pAbc, "I/O", "write_baf",     IoCommandWriteBaf,     0 );
00101     Cmd_CommandAdd( pAbc, "I/O", "write_blif",    IoCommandWriteBlif,    0 );
00102     Cmd_CommandAdd( pAbc, "I/O", "write_blif_mv", IoCommandWriteBlifMv,  0 );
00103     Cmd_CommandAdd( pAbc, "I/O", "write_bench",   IoCommandWriteBench,   0 );
00104     Cmd_CommandAdd( pAbc, "I/O", "write_cellnet", IoCommandWriteCellNet, 0 );
00105     Cmd_CommandAdd( pAbc, "I/O", "write_counter", IoCommandWriteCounter, 0 );
00106     Cmd_CommandAdd( pAbc, "I/O", "write_cnf",     IoCommandWriteCnf,     0 );
00107     Cmd_CommandAdd( pAbc, "I/O", "write_dot",     IoCommandWriteDot,     0 );
00108     Cmd_CommandAdd( pAbc, "I/O", "write_eqn",     IoCommandWriteEqn,     0 );
00109     Cmd_CommandAdd( pAbc, "I/O", "write_gml",     IoCommandWriteGml,     0 );
00110 //    Cmd_CommandAdd( pAbc, "I/O", "write_list",    IoCommandWriteList,    0 );
00111     Cmd_CommandAdd( pAbc, "I/O", "write_pla",     IoCommandWritePla,     0 );
00112     Cmd_CommandAdd( pAbc, "I/O", "write_verilog", IoCommandWriteVerilog, 0 );
00113 //    Cmd_CommandAdd( pAbc, "I/O", "write_verlib",  IoCommandWriteVerLib,  0 );
00114 }

int IoCommandRead ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

FileName [io.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Command processing package.]

Synopsis [Command file.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file io.c.

00143 {
00144     Abc_Ntk_t * pNtk;
00145     char * pFileName;
00146     int fCheck;
00147     int c;
00148 
00149     fCheck = 1;
00150     glo_fMapped = 0;
00151     Extra_UtilGetoptReset();
00152     while ( ( c = Extra_UtilGetopt( argc, argv, "mch" ) ) != EOF )
00153     {
00154         switch ( c )
00155         {
00156             case 'm':
00157                 glo_fMapped ^= 1;
00158                 break;
00159             case 'c':
00160                 fCheck ^= 1;
00161                 break;
00162             case 'h':
00163                 goto usage;
00164             default:
00165                 goto usage;
00166         }
00167     }
00168     if ( argc != globalUtilOptind + 1 )
00169         goto usage;
00170     // get the input file name
00171     pFileName = argv[globalUtilOptind];
00172     // read the file using the corresponding file reader
00173     pNtk = Io_Read( pFileName, Io_ReadFileType(pFileName), fCheck );
00174     if ( pNtk == NULL )
00175         return 1;
00176     // replace the current network
00177     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00178     return 0;
00179 
00180 usage:
00181     fprintf( pAbc->Err, "usage: read [-mch] <file>\n" );
00182     fprintf( pAbc->Err, "\t         replaces the current network by the network read from <file>\n" );
00183     fprintf( pAbc->Err, "\t         by calling the parser that matches the extension of <file>\n" );
00184     fprintf( pAbc->Err, "\t         (to read a hierarchical design, use \"read_hie\")\n" );
00185     fprintf( pAbc->Err, "\t-m     : toggle reading mapped Verilog [default = %s]\n", glo_fMapped? "yes":"no" );
00186     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00187     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00188     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00189     return 1;
00190 }

int IoCommandReadAiger ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file io.c.

00204 {
00205     Abc_Ntk_t * pNtk;
00206     char * pFileName;
00207     int fCheck;
00208     int c;
00209 
00210     fCheck = 1;
00211     Extra_UtilGetoptReset();
00212     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00213     {
00214         switch ( c )
00215         {
00216             case 'c':
00217                 fCheck ^= 1;
00218                 break;
00219             case 'h':
00220                 goto usage;
00221             default:
00222                 goto usage;
00223         }
00224     }
00225     if ( argc != globalUtilOptind + 1 )
00226         goto usage;
00227     // get the input file name
00228     pFileName = argv[globalUtilOptind];
00229     // read the file using the corresponding file reader
00230     pNtk = Io_Read( pFileName, IO_FILE_AIGER, fCheck );
00231     if ( pNtk == NULL )
00232         return 1;
00233     // replace the current network
00234     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00235     return 0;
00236 
00237 usage:
00238     fprintf( pAbc->Err, "usage: read_aiger [-ch] <file>\n" );
00239     fprintf( pAbc->Err, "\t         read the network in the AIGER format (http://fmv.jku.at/aiger)\n" );
00240     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00241     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00242     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00243     return 1;
00244 }

int IoCommandReadBaf ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file io.c.

00258 {
00259     Abc_Ntk_t * pNtk;
00260     char * pFileName;
00261     int fCheck;
00262     int c;
00263 
00264     fCheck = 1;
00265     Extra_UtilGetoptReset();
00266     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00267     {
00268         switch ( c )
00269         {
00270             case 'c':
00271                 fCheck ^= 1;
00272                 break;
00273             case 'h':
00274                 goto usage;
00275             default:
00276                 goto usage;
00277         }
00278     }
00279     if ( argc != globalUtilOptind + 1 )
00280         goto usage;
00281     // get the input file name
00282     pFileName = argv[globalUtilOptind];
00283     // read the file using the corresponding file reader
00284     pNtk = Io_Read( pFileName, IO_FILE_BAF, fCheck );
00285     if ( pNtk == NULL )
00286         return 1;
00287     // replace the current network
00288     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00289     return 0;
00290 
00291 usage:
00292     fprintf( pAbc->Err, "usage: read_baf [-ch] <file>\n" );
00293     fprintf( pAbc->Err, "\t         read the network in Binary Aig Format (BAF)\n" );
00294     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00295     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00296     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00297     return 1;
00298 }

int IoCommandReadBench ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 436 of file io.c.

00437 {
00438     Abc_Ntk_t * pNtk;
00439     char * pFileName;
00440     int fCheck;
00441     int c;
00442 
00443     fCheck = 1;
00444     Extra_UtilGetoptReset();
00445     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00446     {
00447         switch ( c )
00448         {
00449             case 'c':
00450                 fCheck ^= 1;
00451                 break;
00452             case 'h':
00453                 goto usage;
00454             default:
00455                 goto usage;
00456         }
00457     }
00458     if ( argc != globalUtilOptind + 1 )
00459         goto usage;
00460     // get the input file name
00461     pFileName = argv[globalUtilOptind];
00462     // read the file using the corresponding file reader
00463     pNtk = Io_Read( pFileName, IO_FILE_BENCH, fCheck );
00464     if ( pNtk == NULL )
00465         return 1;
00466     // replace the current network
00467     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00468     return 0;
00469 
00470 usage:
00471     fprintf( pAbc->Err, "usage: read_bench [-ch] <file>\n" );
00472     fprintf( pAbc->Err, "\t         read the network in BENCH format\n" );
00473     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00474     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00475     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00476     return 1;
00477 }

int IoCommandReadBlif ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file io.c.

00312 {
00313     Abc_Ntk_t * pNtk;
00314     char * pFileName;
00315     int fReadAsAig;
00316     int fCheck;
00317     int c;
00318     extern Abc_Ntk_t * Io_ReadBlifAsAig( char * pFileName, int fCheck );
00319 
00320     fCheck = 1;
00321     fReadAsAig = 0;
00322     Extra_UtilGetoptReset();
00323     while ( ( c = Extra_UtilGetopt( argc, argv, "ach" ) ) != EOF )
00324     {
00325         switch ( c )
00326         {
00327             case 'a':
00328                 fReadAsAig ^= 1;
00329                 break;
00330             case 'c':
00331                 fCheck ^= 1;
00332                 break;
00333             case 'h':
00334                 goto usage;
00335             default:
00336                 goto usage;
00337         }
00338     }
00339     if ( argc != globalUtilOptind + 1 )
00340         goto usage;
00341     // get the input file name
00342     pFileName = argv[globalUtilOptind];
00343     // read the file using the corresponding file reader
00344     if ( fReadAsAig )
00345         pNtk = Io_ReadBlifAsAig( pFileName, fCheck );
00346     else
00347 //        pNtk = Io_Read( pFileName, IO_FILE_BLIF, fCheck );
00348     {
00349         Abc_Ntk_t * pTemp;
00350         pNtk = Io_ReadBlif( pFileName, fCheck );
00351         pNtk = Abc_NtkToLogic( pTemp = pNtk );
00352         Abc_NtkDelete( pTemp );
00353     }
00354 
00355     if ( pNtk == NULL )
00356         return 1;
00357     // replace the current network
00358     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00359     return 0;
00360 
00361 usage:
00362     fprintf( pAbc->Err, "usage: read_blif [-ach] <file>\n" );
00363     fprintf( pAbc->Err, "\t         read the network in binary BLIF format\n" );
00364     fprintf( pAbc->Err, "\t-a     : toggle creating AIG while reading the file [default = %s]\n", fReadAsAig? "yes":"no" );
00365     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00366     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00367     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00368     return 1;
00369 }

int IoCommandReadBlifMv ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file io.c.

00383 {
00384     Abc_Ntk_t * pNtk;
00385     char * pFileName;
00386     int fCheck;
00387     int c;
00388 
00389     fCheck = 1;
00390     Extra_UtilGetoptReset();
00391     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00392     {
00393         switch ( c )
00394         {
00395             case 'c':
00396                 fCheck ^= 1;
00397                 break;
00398             case 'h':
00399                 goto usage;
00400             default:
00401                 goto usage;
00402         }
00403     }
00404     if ( argc != globalUtilOptind + 1 )
00405         goto usage;
00406     // get the input file name
00407     pFileName = argv[globalUtilOptind];
00408     // read the file using the corresponding file reader
00409     pNtk = Io_Read( pFileName, IO_FILE_BLIFMV, fCheck );
00410     if ( pNtk == NULL )
00411         return 1;
00412     // replace the current network
00413     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00414     return 0;
00415 
00416 usage:
00417     fprintf( pAbc->Err, "usage: read_blif_mv [-ch] <file>\n" );
00418     fprintf( pAbc->Err, "\t         read the network in BLIF-MV format\n" );
00419     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00420     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00421     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00422     return 1;
00423 }

int IoCommandReadDsd ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file io.c.

00491 {
00492     Abc_Ntk_t * pNtk;
00493     char * pString;
00494     int fCheck;
00495     int c;
00496     extern Abc_Ntk_t * Io_ReadDsd( char * pFormula );
00497 
00498     fCheck = 1;
00499     Extra_UtilGetoptReset();
00500     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00501     {
00502         switch ( c )
00503         {
00504             case 'c':
00505                 fCheck ^= 1;
00506                 break;
00507             case 'h':
00508                 goto usage;
00509             default:
00510                 goto usage;
00511         }
00512     }
00513     if ( argc != globalUtilOptind + 1 )
00514         goto usage;
00515     // get the input file name
00516     pString = argv[globalUtilOptind];
00517     // read the file using the corresponding file reader
00518     pNtk = Io_ReadDsd( pString );
00519     if ( pNtk == NULL )
00520         return 1;
00521     // replace the current network
00522     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00523     return 0;
00524 
00525 usage:
00526     fprintf( pAbc->Err, "usage: read_dsd [-h] <formula>\n" );
00527     fprintf( pAbc->Err, "\t          parses a formula representing DSD of a function\n" );
00528     fprintf( pAbc->Err, "\t-h      : prints the command summary\n" );
00529     fprintf( pAbc->Err, "\tformula : the formula representing disjoint-support decomposition (DSD)\n" );
00530     fprintf( pAbc->Err, "\t          Example of a formula: !(a*(b+CA(!d,e*f,c))*79B3(g,h,i,k))\n" );
00531     fprintf( pAbc->Err, "\t          where \'!\' is an INV, \'*\' is an AND, \'+\' is an XOR, \n" );
00532     fprintf( pAbc->Err, "\t          CA and 79B3 are hexadecimal representations of truth tables\n" );
00533     fprintf( pAbc->Err, "\t          (in this case CA=11001010 is truth table of MUX(Data0,Data1,Ctrl))\n" );
00534     fprintf( pAbc->Err, "\t          The lower chars (a,b,c,etc) are reserved for elementary variables.\n" );
00535     fprintf( pAbc->Err, "\t          The upper chars (A,B,C,etc) are reserved for hexadecimal digits.\n" );
00536     fprintf( pAbc->Err, "\t          No spaces are allowed in formulas. In parantheses, LSB goes first.\n" );
00537     return 1;
00538 }

int IoCommandReadEdif ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 551 of file io.c.

00552 {
00553     Abc_Ntk_t * pNtk;
00554     char * pFileName;
00555     int fCheck;
00556     int c;
00557 
00558     fCheck = 1;
00559     Extra_UtilGetoptReset();
00560     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00561     {
00562         switch ( c )
00563         {
00564             case 'c':
00565                 fCheck ^= 1;
00566                 break;
00567             case 'h':
00568                 goto usage;
00569             default:
00570                 goto usage;
00571         }
00572     }
00573     if ( argc != globalUtilOptind + 1 )
00574         goto usage;
00575     // get the input file name
00576     pFileName = argv[globalUtilOptind];
00577     // read the file using the corresponding file reader
00578     pNtk = Io_Read( pFileName, IO_FILE_EDIF, fCheck );
00579     if ( pNtk == NULL )
00580         return 1;
00581     // replace the current network
00582     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00583     return 0;
00584 
00585 usage:
00586     fprintf( pAbc->Err, "usage: read_edif [-ch] <file>\n" );
00587     fprintf( pAbc->Err, "\t         read the network in EDIF (works only for ISCAS benchmarks)\n" );
00588     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00589     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00590     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00591     return 1;
00592 }

int IoCommandReadEqn ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 605 of file io.c.

00606 {
00607     Abc_Ntk_t * pNtk;
00608     char * pFileName;
00609     int fCheck;
00610     int c;
00611 
00612     fCheck = 1;
00613     Extra_UtilGetoptReset();
00614     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00615     {
00616         switch ( c )
00617         {
00618             case 'c':
00619                 fCheck ^= 1;
00620                 break;
00621             case 'h':
00622                 goto usage;
00623             default:
00624                 goto usage;
00625         }
00626     }
00627     if ( argc != globalUtilOptind + 1 )
00628         goto usage;
00629     // get the input file name
00630     pFileName = argv[globalUtilOptind];
00631     // read the file using the corresponding file reader
00632     pNtk = Io_Read( pFileName, IO_FILE_EQN, fCheck );
00633     if ( pNtk == NULL )
00634         return 1;
00635     // replace the current network
00636     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00637     return 0;
00638 
00639 usage:
00640     fprintf( pAbc->Err, "usage: read_eqn [-ch] <file>\n" );
00641     fprintf( pAbc->Err, "\t         read the network in equation format\n" );
00642     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00643     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00644     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00645     return 1;
00646 }

int IoCommandReadInit ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 659 of file io.c.

00660 {
00661     FILE * pOut, * pErr;
00662     Abc_Ntk_t * pNtk;
00663     char * pFileName;
00664     int c;
00665     extern void Io_ReadBenchInit( Abc_Ntk_t * pNtk, char * pFileName );
00666 
00667     pNtk = Abc_FrameReadNtk(pAbc);
00668     pOut = Abc_FrameReadOut(pAbc);
00669     pErr = Abc_FrameReadErr(pAbc);
00670 
00671     Extra_UtilGetoptReset();
00672     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
00673     {
00674         switch ( c )
00675         {
00676             case 'h':
00677                 goto usage;
00678             default:
00679                 goto usage;
00680         }
00681     }
00682     if ( argc != globalUtilOptind + 1 )
00683         goto usage;
00684 
00685     if ( pNtk == NULL )
00686     {
00687         fprintf( pErr, "Empty network.\n" );
00688         return 1;
00689     }
00690     // get the input file name
00691     pFileName = argv[globalUtilOptind];
00692     // read the file using the corresponding file reader
00693     pNtk = Abc_NtkDup( pNtk );
00694     Io_ReadBenchInit( pNtk, pFileName );
00695     // replace the current network
00696     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00697     return 0;
00698 
00699 usage:
00700     fprintf( pAbc->Err, "usage: read_init [-h] <file>\n" );
00701     fprintf( pAbc->Err, "\t         reads initial state of the network in BENCH format\n" );
00702     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00703     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00704     return 1;
00705 }

int IoCommandReadPla ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 718 of file io.c.

00719 {
00720     Abc_Ntk_t * pNtk;
00721     char * pFileName;
00722     int fCheck;
00723     int c;
00724 
00725     fCheck = 1;
00726     Extra_UtilGetoptReset();
00727     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00728     {
00729         switch ( c )
00730         {
00731             case 'c':
00732                 fCheck ^= 1;
00733                 break;
00734             case 'h':
00735                 goto usage;
00736             default:
00737                 goto usage;
00738         }
00739     }
00740     if ( argc != globalUtilOptind + 1 )
00741         goto usage;
00742     // get the input file name
00743     pFileName = argv[globalUtilOptind];
00744     // read the file using the corresponding file reader
00745     pNtk = Io_Read( pFileName, IO_FILE_PLA, fCheck );
00746     if ( pNtk == NULL )
00747         return 1;
00748     // replace the current network
00749     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00750     return 0;
00751 
00752 usage:
00753     fprintf( pAbc->Err, "usage: read_pla [-ch] <file>\n" );
00754     fprintf( pAbc->Err, "\t         read the network in PLA\n" );
00755     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00756     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00757     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00758     return 1;
00759 }

int IoCommandReadTruth ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file io.c.

00773 {
00774     Abc_Ntk_t * pNtk;
00775     char * pSopCover;
00776     int fHex;
00777     int c;
00778 
00779     fHex = 1;
00780     Extra_UtilGetoptReset();
00781     while ( ( c = Extra_UtilGetopt( argc, argv, "xh" ) ) != EOF )
00782     {
00783         switch ( c )
00784         {
00785             case 'x':
00786                 fHex ^= 1;
00787                 break;
00788             case 'h':
00789                 goto usage;
00790             default:
00791                 goto usage;
00792         }
00793     }
00794 
00795     if ( argc != globalUtilOptind + 1 )
00796     {
00797         goto usage;
00798     }
00799 
00800     // convert truth table to SOP
00801     if ( fHex )
00802         pSopCover = Abc_SopFromTruthHex(argv[globalUtilOptind]);
00803     else
00804         pSopCover = Abc_SopFromTruthBin(argv[globalUtilOptind]);
00805     if ( pSopCover == NULL )
00806     {
00807         fprintf( pAbc->Err, "Reading truth table has failed.\n" );
00808         return 1;
00809     }
00810 
00811     pNtk = Abc_NtkCreateWithNode( pSopCover );
00812     free( pSopCover );
00813     if ( pNtk == NULL )
00814     {
00815         fprintf( pAbc->Err, "Deriving the network has failed.\n" );
00816         return 1;
00817     }
00818     // replace the current network
00819     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00820     return 0;
00821 
00822 usage:
00823     fprintf( pAbc->Err, "usage: read_truth [-xh] <truth>\n" );
00824     fprintf( pAbc->Err, "\t         creates network with node having given truth table\n" );
00825     fprintf( pAbc->Err, "\t-x     : toggles between bin and hex representation [default = %s]\n", fHex? "hex":"bin" );
00826     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00827     fprintf( pAbc->Err, "\ttruth  : truth table with most signficant bit first (e.g. 1000 for AND(a,b))\n" );
00828     return 1;
00829 }

int IoCommandReadVer ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 901 of file io.c.

00902 {
00903     Abc_Ntk_t * pNtk, * pNtkNew;
00904     Abc_Lib_t * pDesign;
00905     char * pFileName;
00906     FILE * pFile;
00907     int fCheck;
00908     int c;
00909     extern Abc_Ntk_t * Abc_LibDeriveAig( Abc_Ntk_t * pNtk, Abc_Lib_t * pLib );
00910     extern Abc_Lib_t * Ver_ParseFile( char * pFileName, Abc_Lib_t * pGateLib, int fCheck, int fUseMemMan );
00911 
00912     printf( "Stand-alone structural Verilog reader is available as command \"read_verilog\".\n" );
00913     return 0;
00914 
00915     fCheck = 1;
00916     Extra_UtilGetoptReset();
00917     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
00918     {
00919         switch ( c )
00920         {
00921             case 'c':
00922                 fCheck ^= 1;
00923                 break;
00924             case 'h':
00925                 goto usage;
00926             default:
00927                 goto usage;
00928         }
00929     }
00930 
00931     if ( argc != globalUtilOptind + 1 )
00932     {
00933         goto usage;
00934     }
00935 
00936     // get the input file name
00937     pFileName = argv[globalUtilOptind];
00938     if ( (pFile = fopen( pFileName, "r" )) == NULL )
00939     {
00940         fprintf( pAbc->Err, "Cannot open input file \"%s\". ", pFileName );
00941         if ( pFileName = Extra_FileGetSimilarName( pFileName, ".blif", ".bench", ".pla", ".baf", ".aig" ) )
00942             fprintf( pAbc->Err, "Did you mean \"%s\"?", pFileName );
00943         fprintf( pAbc->Err, "\n" );
00944         return 1;
00945     }
00946     fclose( pFile );
00947 
00948     // set the new network
00949     pDesign = Ver_ParseFile( pFileName, Abc_FrameReadLibVer(), fCheck, 1 );
00950     if ( pDesign == NULL )
00951     {
00952         fprintf( pAbc->Err, "Reading network from the verilog file has failed.\n" );
00953         return 1;
00954     }
00955 
00956     // derive root design
00957     pNtk = Abc_LibDeriveRoot( pDesign );
00958     Abc_LibFree( pDesign, NULL );
00959     if ( pNtk == NULL )
00960     {
00961         fprintf( pAbc->Err, "Deriving root module has failed.\n" );
00962         return 1;
00963     }
00964 
00965     // derive the AIG network from this design
00966     pNtkNew = Abc_LibDeriveAig( pNtk, Abc_FrameReadLibVer() );
00967     Abc_NtkDelete( pNtk );
00968     if ( pNtkNew == NULL )
00969     {
00970         fprintf( pAbc->Err, "Converting root module to AIG has failed.\n" );
00971         return 1;
00972     }
00973     // replace the current network
00974     Abc_FrameReplaceCurrentNetwork( pAbc, pNtkNew );
00975     return 0;
00976 
00977 usage:
00978     fprintf( pAbc->Err, "usage: read_ver [-ch] <file>\n" );
00979     fprintf( pAbc->Err, "\t         read a network in structural verilog (using current library)\n" );
00980     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00981     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00982     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00983     return 1;
00984 }

int IoCommandReadVerilog ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 842 of file io.c.

00843 {
00844     Abc_Ntk_t * pNtk;
00845     char * pFileName;
00846     int fCheck;
00847     int c;
00848 
00849     fCheck = 1;
00850     glo_fMapped = 0;
00851     Extra_UtilGetoptReset();
00852     while ( ( c = Extra_UtilGetopt( argc, argv, "mch" ) ) != EOF )
00853     {
00854         switch ( c )
00855         {
00856             case 'm':
00857                 glo_fMapped ^= 1;
00858                 break;
00859             case 'c':
00860                 fCheck ^= 1;
00861                 break;
00862             case 'h':
00863                 goto usage;
00864             default:
00865                 goto usage;
00866         }
00867     }
00868     if ( argc != globalUtilOptind + 1 )
00869         goto usage;
00870     // get the input file name
00871     pFileName = argv[globalUtilOptind];
00872     // read the file using the corresponding file reader
00873     pNtk = Io_Read( pFileName, IO_FILE_VERILOG, fCheck );
00874     if ( pNtk == NULL )
00875         return 1;
00876     // replace the current network
00877     Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
00878     return 0;
00879 
00880 usage:
00881     fprintf( pAbc->Err, "usage: read_verilog [-mch] <file>\n" );
00882     fprintf( pAbc->Err, "\t         read the network in Verilog (IWLS 2002/2005 subset)\n" );
00883     fprintf( pAbc->Err, "\t-m     : toggle reading mapped Verilog [default = %s]\n", glo_fMapped? "yes":"no" );
00884     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
00885     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
00886     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
00887     return 1;
00888 }

int IoCommandReadVerLib ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 997 of file io.c.

00998 {
00999     Abc_Lib_t * pLibrary;
01000     char * pFileName;
01001     FILE * pFile;
01002     int fCheck;
01003     int c;
01004     extern Abc_Lib_t * Ver_ParseFile( char * pFileName, Abc_Lib_t * pGateLib, int fCheck, int fUseMemMan );
01005 
01006     fCheck = 1;
01007     Extra_UtilGetoptReset();
01008     while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF )
01009     {
01010         switch ( c )
01011         {
01012             case 'c':
01013                 fCheck ^= 1;
01014                 break;
01015             case 'h':
01016                 goto usage;
01017             default:
01018                 goto usage;
01019         }
01020     }
01021 
01022     if ( argc != globalUtilOptind + 1 )
01023     {
01024         goto usage;
01025     }
01026 
01027     // get the input file name
01028     pFileName = argv[globalUtilOptind];
01029     if ( (pFile = fopen( pFileName, "r" )) == NULL )
01030     {
01031         fprintf( pAbc->Err, "Cannot open input file \"%s\". ", pFileName );
01032         if ( pFileName = Extra_FileGetSimilarName( pFileName, ".blif", ".bench", ".pla", ".baf", ".aig" ) )
01033             fprintf( pAbc->Err, "Did you mean \"%s\"?", pFileName );
01034         fprintf( pAbc->Err, "\n" );
01035         return 1;
01036     }
01037     fclose( pFile );
01038 
01039     // set the new network
01040     pLibrary = Ver_ParseFile( pFileName, NULL, fCheck, 0 );
01041     if ( pLibrary == NULL )
01042     {
01043         fprintf( pAbc->Err, "Reading library from the verilog file has failed.\n" );
01044         return 1;
01045     }
01046     printf( "The library contains %d gates.\n", st_count(pLibrary->tModules) );
01047     // free old library
01048     if ( Abc_FrameReadLibVer() )
01049         Abc_LibFree( Abc_FrameReadLibVer(), NULL );
01050     // read new library
01051     Abc_FrameSetLibVer( pLibrary );
01052     return 0;
01053 
01054 usage:
01055     fprintf( pAbc->Err, "usage: read_verlib [-ch] <file>\n" );
01056     fprintf( pAbc->Err, "\t         read a gate library in structural verilog\n" );
01057     fprintf( pAbc->Err, "\t-c     : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
01058     fprintf( pAbc->Err, "\t-h     : prints the command summary\n" );
01059     fprintf( pAbc->Err, "\tfile   : the name of a file to read\n" );
01060     return 1;
01061 }

int IoCommandWrite ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1075 of file io.c.

01076 {
01077     char * pFileName;
01078     int c;
01079 
01080     Extra_UtilGetoptReset();
01081     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01082     {
01083         switch ( c )
01084         {
01085             case 'h':
01086                 goto usage;
01087             default:
01088                 goto usage;
01089         }
01090     }
01091     if ( argc != globalUtilOptind + 1 )
01092         goto usage;
01093     // get the output file name
01094     pFileName = argv[globalUtilOptind];
01095     // call the corresponding file writer
01096     Io_Write( pAbc->pNtkCur, pFileName, Io_ReadFileType(pFileName) );
01097     return 0;
01098 
01099 usage:
01100     fprintf( pAbc->Err, "usage: write [-h] <file>\n" );
01101     fprintf( pAbc->Err, "\t         writes the current network into <file> by calling\n" );
01102     fprintf( pAbc->Err, "\t         the writer that matches the extension of <file>\n" );
01103     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01104     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01105     return 1;
01106 }

int IoCommandWriteAiger ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1171 of file io.c.

01172 {
01173     char * pFileName;
01174     int fWriteSymbols;
01175     int c;
01176 
01177     fWriteSymbols = 1;
01178     Extra_UtilGetoptReset();
01179     while ( ( c = Extra_UtilGetopt( argc, argv, "sh" ) ) != EOF )
01180     {
01181         switch ( c )
01182         {
01183             case 's':
01184                 fWriteSymbols ^= 1;
01185                 break;
01186             case 'h':
01187                 goto usage;
01188             default:
01189                 goto usage;
01190         }
01191     }
01192     if ( argc != globalUtilOptind + 1 )
01193         goto usage;
01194     // get the output file name
01195     pFileName = argv[globalUtilOptind];
01196     // call the corresponding file writer
01197     if ( fWriteSymbols )
01198         Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_AIGER );
01199     else
01200     {
01201         if ( !Abc_NtkIsStrash(pAbc->pNtkCur) )
01202         {
01203             fprintf( stdout, "Writing this format is only possible for structurally hashed AIGs.\n" );
01204             return 1;
01205         }
01206         Io_WriteAiger( pAbc->pNtkCur, pFileName, 0 );
01207     }
01208     return 0;
01209 
01210 usage:
01211     fprintf( pAbc->Err, "usage: write_aiger [-sh] <file>\n" );
01212     fprintf( pAbc->Err, "\t         write the network in the AIGER format (http://fmv.jku.at/aiger)\n" );
01213     fprintf( pAbc->Err, "\t-s     : toggle saving I/O names [default = %s]\n", fWriteSymbols? "yes" : "no" );
01214     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01215     fprintf( pAbc->Err, "\tfile   : the name of the file to write (extension .aig)\n" );
01216     return 1;
01217 }

int IoCommandWriteBaf ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1230 of file io.c.

01231 {
01232     char * pFileName;
01233     int c;
01234 
01235     Extra_UtilGetoptReset();
01236     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01237     {
01238         switch ( c )
01239         {
01240             case 'h':
01241                 goto usage;
01242             default:
01243                 goto usage;
01244         }
01245     }
01246     if ( argc != globalUtilOptind + 1 )
01247         goto usage;
01248     // get the output file name
01249     pFileName = argv[globalUtilOptind];
01250     // call the corresponding file writer
01251     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_BAF );
01252     return 0;
01253 
01254 usage:
01255     fprintf( pAbc->Err, "usage: write_baf [-h] <file>\n" );
01256     fprintf( pAbc->Err, "\t         write the network into a BLIF file\n" );
01257     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01258     fprintf( pAbc->Err, "\tfile   : the name of the file to write (extension .baf)\n" );
01259     return 1;
01260 }

int IoCommandWriteBench ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1359 of file io.c.

01360 {
01361     char * pFileName;
01362     int fUseLuts;
01363     int c;
01364 
01365     fUseLuts = 1;
01366     Extra_UtilGetoptReset();
01367     while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF )
01368     {
01369         switch ( c )
01370         {
01371             case 'l':
01372                 fUseLuts ^= 1;
01373                 break;
01374             case 'h':
01375                 goto usage;
01376             default:
01377                 goto usage;
01378         }
01379     }
01380     if ( argc != globalUtilOptind + 1 )
01381         goto usage;
01382     // get the output file name
01383     pFileName = argv[globalUtilOptind];
01384     // call the corresponding file writer
01385     if ( !fUseLuts )
01386         Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_BENCH );
01387     else
01388     {
01389         Abc_Ntk_t * pNtkTemp;
01390         pNtkTemp = Abc_NtkToNetlist( pAbc->pNtkCur );
01391         Abc_NtkToAig( pNtkTemp );
01392         Io_WriteBenchLut( pNtkTemp, pFileName );
01393         Abc_NtkDelete( pNtkTemp );
01394     }
01395     return 0;
01396 
01397 usage:
01398     fprintf( pAbc->Err, "usage: write_bench [-lh] <file>\n" );
01399     fprintf( pAbc->Err, "\t         write the network in BENCH format\n" );
01400     fprintf( pAbc->Err, "\t-l     : toggle using LUTs in the output [default = %s]\n", fUseLuts? "yes" : "no" );
01401     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01402     fprintf( pAbc->Err, "\tfile   : the name of the file to write (extension .bench)\n" );
01403     return 1;
01404 }

int IoCommandWriteBlif ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1273 of file io.c.

01274 {
01275     char * pFileName;
01276     int c;
01277 
01278     Extra_UtilGetoptReset();
01279     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01280     {
01281         switch ( c )
01282         {
01283             case 'h':
01284                 goto usage;
01285             default:
01286                 goto usage;
01287         }
01288     }
01289     if ( argc != globalUtilOptind + 1 )
01290         goto usage;
01291     // get the output file name
01292     pFileName = argv[globalUtilOptind];
01293     // call the corresponding file writer
01294     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_BLIF );
01295     return 0;
01296 
01297 usage:
01298     fprintf( pAbc->Err, "usage: write_blif [-h] <file>\n" );
01299     fprintf( pAbc->Err, "\t         write the network into a BLIF file\n" );
01300     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01301     fprintf( pAbc->Err, "\tfile   : the name of the file to write (extension .blif)\n" );
01302     return 1;
01303 }

int IoCommandWriteBlifMv ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1316 of file io.c.

01317 {
01318     char * pFileName;
01319     int c;
01320 
01321     Extra_UtilGetoptReset();
01322     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01323     {
01324         switch ( c )
01325         {
01326             case 'h':
01327                 goto usage;
01328             default:
01329                 goto usage;
01330         }
01331     }
01332     if ( argc != globalUtilOptind + 1 )
01333         goto usage;
01334     // get the output file name
01335     pFileName = argv[globalUtilOptind];
01336     // call the corresponding file writer
01337     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_BLIFMV );
01338     return 0;
01339 
01340 usage:
01341     fprintf( pAbc->Err, "usage: write_blif_mv [-h] <file>\n" );
01342     fprintf( pAbc->Err, "\t         write the network into a BLIF-MV file\n" );
01343     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01344     fprintf( pAbc->Err, "\tfile   : the name of the file to write (extension .mv)\n" );
01345     return 1;
01346 }

int IoCommandWriteCellNet ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1417 of file io.c.

01418 {
01419     Abc_Ntk_t * pNtk;
01420     char * pFileName;
01421     int c;
01422     extern void Io_WriteCellNet( Abc_Ntk_t * pNtk, char * pFileName );
01423 
01424     Extra_UtilGetoptReset();
01425     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01426     {
01427         switch ( c )
01428         {
01429             case 'h':
01430                 goto usage;
01431             default:
01432                 goto usage;
01433         }
01434     }
01435     if ( argc != globalUtilOptind + 1 )
01436         goto usage;
01437     pNtk = pAbc->pNtkCur;
01438     if ( pNtk == NULL )
01439     {
01440         fprintf( pAbc->Out, "Empty network.\n" );
01441         return 0;
01442     }
01443     // get the output file name
01444     pFileName = argv[globalUtilOptind];
01445     // call the corresponding file writer
01446     if ( !Abc_NtkIsLogic(pNtk) )
01447     {
01448         fprintf( pAbc->Out, "The network should be a logic network (if it an AIG, use command \"logic\")\n" );
01449         return 0;
01450     }
01451     Io_WriteCellNet( pNtk, pFileName );
01452     return 0;
01453 
01454 usage:
01455     fprintf( pAbc->Err, "usage: write_cellnet [-h] <file>\n" );
01456     fprintf( pAbc->Err, "\t         write the network is the cellnet format\n" );
01457     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01458     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01459     return 1;
01460 }

int IoCommandWriteCnf ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1473 of file io.c.

01474 {
01475     char * pFileName;
01476     int c;
01477     int fAllPrimes;
01478     int fNewAlgo;
01479     extern Abc_Ntk_t * Abc_NtkDarToCnf( Abc_Ntk_t * pNtk, char * pFileName );
01480 
01481     fNewAlgo = 1;
01482     fAllPrimes = 0;
01483     Extra_UtilGetoptReset();
01484     while ( ( c = Extra_UtilGetopt( argc, argv, "nph" ) ) != EOF )
01485     {
01486         switch ( c )
01487         {
01488             case 'n':
01489                 fNewAlgo ^= 1;
01490                 break;
01491             case 'p':
01492                 fAllPrimes ^= 1;
01493                 break;
01494             case 'h':
01495                 goto usage;
01496             default:
01497                 goto usage;
01498         }
01499     }
01500     if ( argc != globalUtilOptind + 1 )
01501         goto usage;
01502     // get the output file name
01503     pFileName = argv[globalUtilOptind];
01504     // check if the feature will be used
01505     if ( Abc_NtkIsStrash(pAbc->pNtkCur) && fAllPrimes )
01506     {
01507         fAllPrimes = 0;
01508         printf( "Warning: Selected option to write all primes has no effect when deriving CNF from AIG.\n" );
01509     }
01510     // call the corresponding file writer
01511     if ( fNewAlgo )
01512         Abc_NtkDarToCnf( pAbc->pNtkCur, pFileName );
01513     else if ( fAllPrimes )
01514         Io_WriteCnf( pAbc->pNtkCur, pFileName, 1 );
01515     else
01516         Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_CNF );
01517     return 0;
01518 
01519 usage:
01520     fprintf( pAbc->Err, "usage: write_cnf [-nph] <file>\n" );
01521     fprintf( pAbc->Err, "\t         write the miter cone into a CNF file\n" );
01522     fprintf( pAbc->Err, "\t-n     : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes" : "no" );
01523     fprintf( pAbc->Err, "\t-p     : toggle using all primes to enhance implicativity [default = %s]\n", fAllPrimes? "yes" : "no" );
01524     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01525     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01526     return 1;
01527 }

int IoCommandWriteCounter ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1583 of file io.c.

01584 {
01585     Abc_Ntk_t * pNtk;
01586     char * pFileName;
01587     int c;
01588     int fNames;
01589 
01590     fNames = 0;
01591     Extra_UtilGetoptReset();
01592     while ( ( c = Extra_UtilGetopt( argc, argv, "nh" ) ) != EOF )
01593     {
01594         switch ( c )
01595         {
01596             case 'n':
01597                 fNames ^= 1;
01598                 break;
01599             case 'h':
01600                 goto usage;
01601             default:
01602                 goto usage;
01603         }
01604     }
01605 
01606     pNtk = pAbc->pNtkCur;
01607     if ( pNtk == NULL )
01608     {
01609         fprintf( pAbc->Out, "Empty network.\n" );
01610         return 0;
01611     }
01612 
01613     if ( argc != globalUtilOptind + 1 )
01614     {
01615         goto usage;
01616     }
01617     // get the input file name
01618     pFileName = argv[globalUtilOptind];
01619 
01620     if ( pNtk->pModel == NULL )
01621     {
01622         fprintf( pAbc->Out, "Counter-example is not available.\n" );
01623         return 0;
01624     }
01625 
01626     // write the counter-example into the file
01627     {
01628         Abc_Obj_t * pObj;
01629         FILE * pFile = fopen( pFileName, "w" );
01630         int i;
01631         if ( pFile == NULL )
01632         {
01633             fprintf( stdout, "IoCommandWriteCounter(): Cannot open the output file \"%s\".\n", pFileName );
01634             return 1;
01635         }
01636         if ( fNames )
01637         {
01638             Abc_NtkForEachPi( pNtk, pObj, i )
01639                 fprintf( pFile, "%s=%c ", Abc_ObjName(pObj), '0'+(pNtk->pModel[i]==1) );
01640         }
01641         else
01642         {
01643             Abc_NtkForEachPi( pNtk, pObj, i )
01644                 fprintf( pFile, "%c", '0'+(pNtk->pModel[i]==1) );
01645         }
01646         fprintf( pFile, "\n" );
01647         fclose( pFile );
01648     }
01649 
01650     return 0;
01651 
01652 usage:
01653     fprintf( pAbc->Err, "usage: write_counter [-nh] <file>\n" );
01654     fprintf( pAbc->Err, "\t         writes the counter-example derived by \"prove\" or \"sat\"\n" );
01655     fprintf( pAbc->Err, "\t         the file contains values for each PI in the natural order\n" );
01656     fprintf( pAbc->Err, "\t-n     : write input names into the file [default = %s]\n", fNames? "yes": "no" );
01657     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01658     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01659     return 1;
01660 }

int IoCommandWriteDot ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1540 of file io.c.

01541 {
01542     char * pFileName;
01543     int c;
01544 
01545     Extra_UtilGetoptReset();
01546     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01547     {
01548         switch ( c )
01549         {
01550             case 'h':
01551                 goto usage;
01552             default:
01553                 goto usage;
01554         }
01555     }
01556     if ( argc != globalUtilOptind + 1 )
01557         goto usage;
01558     // get the output file name
01559     pFileName = argv[globalUtilOptind];
01560     // call the corresponding file writer
01561     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_DOT );
01562     return 0;
01563 
01564 usage:
01565     fprintf( pAbc->Err, "usage: write_dot [-h] <file>\n" );
01566     fprintf( pAbc->Err, "\t         write the current network into a DOT file\n" );
01567     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01568     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01569     return 1;
01570 }

int IoCommandWriteEqn ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1674 of file io.c.

01675 {
01676     char * pFileName;
01677     int c;
01678 
01679     Extra_UtilGetoptReset();
01680     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01681     {
01682         switch ( c )
01683         {
01684             case 'h':
01685                 goto usage;
01686             default:
01687                 goto usage;
01688         }
01689     }
01690     if ( argc != globalUtilOptind + 1 )
01691         goto usage;
01692     // get the output file name
01693     pFileName = argv[globalUtilOptind];
01694     // call the corresponding file writer
01695     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_EQN );
01696     return 0;
01697 
01698 usage:
01699     fprintf( pAbc->Err, "usage: write_eqn [-h] <file>\n" );
01700     fprintf( pAbc->Err, "\t         write the current network in the equation format\n" );
01701     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01702     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01703     return 1;
01704 }

int IoCommandWriteGml ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1717 of file io.c.

01718 {
01719     char * pFileName;
01720     int c;
01721 
01722     Extra_UtilGetoptReset();
01723     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01724     {
01725         switch ( c )
01726         {
01727             case 'h':
01728                 goto usage;
01729             default:
01730                 goto usage;
01731         }
01732     }
01733     if ( argc != globalUtilOptind + 1 )
01734         goto usage;
01735     // get the output file name
01736     pFileName = argv[globalUtilOptind];
01737     // call the corresponding file writer
01738     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_GML );
01739     return 0;
01740 
01741 usage:
01742     fprintf( pAbc->Err, "usage: write_gml [-h] <file>\n" );
01743     fprintf( pAbc->Err, "\t         write network using graph representation formal GML\n" );
01744     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01745     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01746     return 1;
01747 }

int IoCommandWriteHie ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1119 of file io.c.

01120 {
01121     char * pBaseName, * pFileName;
01122     int c;
01123 
01124     glo_fMapped = 0;
01125     Extra_UtilGetoptReset();
01126     while ( ( c = Extra_UtilGetopt( argc, argv, "mh" ) ) != EOF )
01127     {
01128         switch ( c )
01129         {
01130             case 'm':
01131                 glo_fMapped ^= 1;
01132                 break;
01133             case 'h':
01134                 goto usage;
01135             default:
01136                 goto usage;
01137         }
01138     }
01139     if ( argc != globalUtilOptind + 2 )
01140         goto usage;
01141     // get the output file name
01142     pBaseName = argv[globalUtilOptind];
01143     pFileName = argv[globalUtilOptind+1];
01144     // call the corresponding file writer
01145 //    Io_Write( pAbc->pNtkCur, pFileName, Io_ReadFileType(pFileName) );
01146     Io_WriteHie( pAbc->pNtkCur, pBaseName, pFileName );
01147     return 0;
01148 
01149 usage:
01150     fprintf( pAbc->Err, "usage: write_hie [-h] <orig> <file>\n" );
01151     fprintf( pAbc->Err, "\t         writes the current network into <file> by calling\n" );
01152     fprintf( pAbc->Err, "\t         the hierarchical writer that matches the extension of <file>\n" );
01153     fprintf( pAbc->Err, "\t-m     : toggle reading mapped Verilog for <orig> [default = %s]\n", glo_fMapped? "yes":"no" );
01154     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01155     fprintf( pAbc->Err, "\torig   : the name of the original file with the hierarchical design\n" );
01156     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01157     return 1;
01158 }

int IoCommandWriteList ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1760 of file io.c.

01761 {
01762     char * pFileName;
01763     int fUseHost;
01764     int c;
01765 
01766     printf( "This command currently does not work.\n" );
01767     return 0;
01768 
01769     fUseHost = 1;
01770     Extra_UtilGetoptReset();
01771     while ( ( c = Extra_UtilGetopt( argc, argv, "nh" ) ) != EOF )
01772     {
01773         switch ( c )
01774         {
01775             case 'n':
01776                 fUseHost ^= 1;
01777                 break;
01778             case 'h':
01779                 goto usage;
01780             default:
01781                 goto usage;
01782         }
01783     }
01784     if ( argc != globalUtilOptind + 1 )
01785         goto usage;
01786     if ( pAbc->pNtkCur == NULL )
01787     {
01788         fprintf( pAbc->Out, "Empty network.\n" );
01789         return 0;
01790     }
01791 /*
01792     if ( !Abc_NtkIsSeq(pAbc->pNtkCur) )
01793     {
01794         fprintf( stdout, "IoCommandWriteList(): Can write adjacency list for sequential AIGs only.\n" );
01795         return 0;
01796     }
01797 */
01798     // get the input file name
01799     pFileName = argv[globalUtilOptind];
01800     // write the file
01801     Io_WriteList( pAbc->pNtkCur, pFileName, fUseHost );
01802     return 0;
01803 
01804 usage:
01805     fprintf( pAbc->Err, "usage: write_list [-nh] <file>\n" );
01806     fprintf( pAbc->Err, "\t         write network using graph representation formal GML\n" );
01807     fprintf( pAbc->Err, "\t-n     : toggle writing host node [default = %s]\n", fUseHost? "yes":"no" );
01808     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01809     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01810     return 1;
01811 }

int IoCommandWritePla ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1824 of file io.c.

01825 {
01826     char * pFileName;
01827     int c;
01828 
01829     Extra_UtilGetoptReset();
01830     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01831     {
01832         switch ( c )
01833         {
01834             case 'h':
01835                 goto usage;
01836             default:
01837                 goto usage;
01838         }
01839     }
01840     if ( argc != globalUtilOptind + 1 )
01841         goto usage;
01842     // get the output file name
01843     pFileName = argv[globalUtilOptind];
01844     // call the corresponding file writer
01845     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_PLA );
01846     return 0;
01847 
01848 usage:
01849     fprintf( pAbc->Err, "usage: write_pla [-h] <file>\n" );
01850     fprintf( pAbc->Err, "\t         write the collapsed network into a PLA file\n" );
01851     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01852     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01853     return 1;
01854 }

int IoCommandWriteVerilog ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1867 of file io.c.

01868 {
01869     char * pFileName;
01870     int c;
01871 
01872     Extra_UtilGetoptReset();
01873     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01874     {
01875         switch ( c )
01876         {
01877             case 'h':
01878                 goto usage;
01879             default:
01880                 goto usage;
01881         }
01882     }
01883     if ( argc != globalUtilOptind + 1 )
01884         goto usage;
01885     // get the output file name
01886     pFileName = argv[globalUtilOptind];
01887     // call the corresponding file writer
01888     Io_Write( pAbc->pNtkCur, pFileName, IO_FILE_VERILOG );
01889     return 0;
01890 
01891 usage:
01892     fprintf( pAbc->Err, "usage: write_verilog [-h] <file>\n" );
01893     fprintf( pAbc->Err, "\t         write the current network in Verilog format\n" );
01894     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01895     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01896     return 1;
01897 }

int IoCommandWriteVerLib ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1910 of file io.c.

01911 {
01912     Abc_Lib_t * pLibrary;
01913     char * pFileName;
01914     int c;
01915     extern void Io_WriteVerilogLibrary( Abc_Lib_t * pLibrary, char * pFileName );
01916 
01917     Extra_UtilGetoptReset();
01918     while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
01919     {
01920         switch ( c )
01921         {
01922             case 'h':
01923                 goto usage;
01924             default:
01925                 goto usage;
01926         }
01927     }
01928     if ( argc != globalUtilOptind + 1 )
01929         goto usage;
01930     // get the input file name
01931     pFileName = argv[globalUtilOptind];
01932     // derive the netlist
01933     pLibrary = Abc_FrameReadLibVer();
01934     if ( pLibrary == NULL )
01935     {
01936         fprintf( pAbc->Out, "Verilog library is not specified.\n" );
01937         return 0;
01938     }
01939 //    Io_WriteVerilogLibrary( pLibrary, pFileName );
01940     return 0;
01941 
01942 usage:
01943     fprintf( pAbc->Err, "usage: write_verlib [-h] <file>\n" );
01944     fprintf( pAbc->Err, "\t         write the current verilog library\n" );
01945     fprintf( pAbc->Err, "\t-h     : print the help massage\n" );
01946     fprintf( pAbc->Err, "\tfile   : the name of the file to write\n" );
01947     return 1;
01948 }


Variable Documentation

Definition at line 76 of file verCore.c.


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