src/map/mapper/mapper.c File Reference

#include "abc.h"
#include "mainInt.h"
#include "mio.h"
#include "mapperInt.h"
Include dependency graph for mapper.c:

Go to the source code of this file.

Functions

static int Map_CommandReadLibrary (Abc_Frame_t *pAbc, int argc, char **argv)
void Map_Init (Abc_Frame_t *pAbc)
void Map_End ()

Function Documentation

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

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

FileName [mapper.c]

PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]

Synopsis [Command file for the mapper package.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - June 1, 2004.]

Revision [

Id
mapper.c,v 1.7 2005/01/23 06:59:42 alanmi Exp

] DECLARATIONS ///

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file mapper.c.

00080 {
00081     FILE * pFile;
00082     FILE * pOut, * pErr;
00083     Map_SuperLib_t * pLib;
00084     Abc_Ntk_t * pNet;
00085     char * FileName, * ExcludeFile;
00086     int fVerbose;
00087     int fAlgorithm;
00088     int c;
00089 
00090     pNet = Abc_FrameReadNtk(pAbc);
00091     pOut = Abc_FrameReadOut(pAbc);
00092     pErr = Abc_FrameReadErr(pAbc);
00093 
00094     // set the defaults
00095     fVerbose = 1;
00096     fAlgorithm = 1;
00097     ExcludeFile = 0;
00098     Extra_UtilGetoptReset();
00099     while ( (c = Extra_UtilGetopt(argc, argv, "eovh")) != EOF ) 
00100     {
00101         switch (c) 
00102         {
00103             case 'e':
00104                 ExcludeFile = argv[globalUtilOptind];
00105                 if ( ExcludeFile == 0 )
00106                     goto usage;
00107                 globalUtilOptind++;
00108                 break;
00109             case 'o':
00110                 fAlgorithm ^= 1;
00111                 break;
00112             case 'v':
00113                 fVerbose ^= 1;
00114                 break;
00115             case 'h':
00116                 goto usage;
00117                 break;
00118             default:
00119                 goto usage;
00120         }
00121     }
00122 
00123 
00124     if ( argc != globalUtilOptind + 1 )
00125     {
00126         goto usage;
00127     }
00128 
00129     // get the input file name
00130     FileName = argv[globalUtilOptind];
00131     if ( (pFile = Io_FileOpen( FileName, "open_path", "r", 0 )) == NULL )
00132 //    if ( (pFile = fopen( FileName, "r" )) == NULL )
00133     {
00134         fprintf( pErr, "Cannot open input file \"%s\". ", FileName );
00135         if ( FileName = Extra_FileGetSimilarName( FileName, ".genlib", ".lib", ".gen", ".g", NULL ) )
00136             fprintf( pErr, "Did you mean \"%s\"?", FileName );
00137         fprintf( pErr, "\n" );
00138         return 1;
00139     }
00140     fclose( pFile );
00141 
00142     // set the new network
00143     pLib = Map_SuperLibCreate( FileName, ExcludeFile, fAlgorithm, fVerbose );
00144     if ( pLib == NULL )
00145     {
00146         fprintf( pErr, "Reading supergate library has failed.\n" );
00147         goto usage;
00148     }
00149     // replace the current library
00150 //    Map_SuperLibFree( s_pSuperLib );
00151 //    s_pSuperLib = pLib;
00152     Map_SuperLibFree( Abc_FrameReadLibSuper() );
00153     Abc_FrameSetLibSuper( pLib );
00154     // replace the current genlib library
00155 //    if ( s_pLib ) Mio_LibraryDelete( s_pLib );
00156 //    s_pLib = s_pSuperLib->pGenlib;
00157     Mio_LibraryDelete( Abc_FrameReadLibGen() );
00158     Abc_FrameSetLibGen( pLib->pGenlib );
00159     return 0;
00160 
00161 usage:
00162     fprintf( pErr, "\nusage: read_super [-ovh]\n");
00163     fprintf( pErr, "\t         read the supergate library from the file\n" );  
00164     fprintf( pErr, "\t-e file : file contains list of genlib gates to exclude\n" );
00165     fprintf( pErr, "\t-o      : toggles the use of old file format [default = %s]\n", (fAlgorithm? "new" : "old") );
00166     fprintf( pErr, "\t-v      : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
00167     fprintf( pErr, "\t-h      : print the command usage\n");
00168     return 1;       /* error exit */
00169 }

void Map_End (  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file mapper.c.

00062 {
00063 //    Map_SuperLibFree( s_pSuperLib );
00064      Map_SuperLibFree( Abc_FrameReadLibSuper() );
00065 }

void Map_Init ( Abc_Frame_t pAbc  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file mapper.c.

00046 {
00047     Cmd_CommandAdd( pAbc, "SC mapping", "read_super",  Map_CommandReadLibrary, 0 ); 
00048 }


Generated on Tue Jan 5 12:19:04 2010 for abc70930 by  doxygen 1.6.1