src/map/mio/mio.c File Reference

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

Go to the source code of this file.

Functions

static int Mio_CommandReadLibrary (Abc_Frame_t *pAbc, int argc, char **argv)
static int Mio_CommandPrintLibrary (Abc_Frame_t *pAbc, int argc, char **argv)
void Mio_Init (Abc_Frame_t *pAbc)
void Mio_End ()

Variables

static char * pMcncGenlib [25]

Function Documentation

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

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

Synopsis [Command procedure to read LUT libraries.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file mio.c.

00220 {
00221     FILE * pOut, * pErr;
00222     Abc_Ntk_t * pNet;
00223     int fVerbose;
00224     int c;
00225 
00226     pNet = Abc_FrameReadNtk(pAbc);
00227     pOut = Abc_FrameReadOut(pAbc);
00228     pErr = Abc_FrameReadErr(pAbc);
00229 
00230     // set the defaults
00231     fVerbose = 1;
00232     Extra_UtilGetoptReset();
00233     while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF ) 
00234     {
00235         switch (c) 
00236         {
00237             case 'v':
00238                 fVerbose ^= 1;
00239                 break;
00240             case 'h':
00241                 goto usage;
00242                 break;
00243             default:
00244                 goto usage;
00245         }
00246     }
00247 
00248 
00249     if ( argc != globalUtilOptind )
00250     {
00251         goto usage;
00252     }
00253 
00254     // set the new network
00255     Mio_WriteLibrary( stdout, Abc_FrameReadLibGen(), 0 );
00256     return 0;
00257 
00258 usage:
00259     fprintf( pErr, "\nusage: print_library [-vh]\n");
00260     fprintf( pErr, "\t          print the current genlib library\n" );  
00261     fprintf( pErr, "\t-v      : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
00262     fprintf( pErr, "\t-h      : print the command usage\n");
00263     return 1;       /* error exit */
00264 }

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

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

FileName [mio.c]

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

Synopsis [File reading/writing for technology mapping.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 18, 2003.]

Revision [

Id
mio.c,v 1.4 2004/08/05 18:34:51 satrajit Exp

] DECLARATIONS ///

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file mio.c.

00127 {
00128     FILE * pFile;
00129     FILE * pOut, * pErr;
00130     Mio_Library_t * pLib;
00131     Abc_Ntk_t * pNet;
00132     char * FileName;
00133     int fVerbose;
00134     int c;
00135 
00136     pNet = Abc_FrameReadNtk(pAbc);
00137     pOut = Abc_FrameReadOut(pAbc);
00138     pErr = Abc_FrameReadErr(pAbc);
00139 
00140     // set the defaults
00141     fVerbose = 1;
00142     Extra_UtilGetoptReset();
00143     while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF ) 
00144     {
00145         switch (c) 
00146         {
00147             case 'v':
00148                 fVerbose ^= 1;
00149                 break;
00150             case 'h':
00151                 goto usage;
00152                 break;
00153             default:
00154                 goto usage;
00155         }
00156     }
00157 
00158 
00159     if ( argc != globalUtilOptind + 1 )
00160     {
00161         goto usage;
00162     }
00163 
00164     // get the input file name
00165     FileName = argv[globalUtilOptind];
00166     if ( (pFile = Io_FileOpen( FileName, "open_path", "r", 0 )) == NULL )
00167     {
00168         fprintf( pErr, "Cannot open input file \"%s\". ", FileName );
00169         if ( (FileName = Extra_FileGetSimilarName( FileName, ".genlib", ".lib", ".gen", ".g", NULL )) )
00170             fprintf( pErr, "Did you mean \"%s\"?", FileName );
00171         fprintf( pErr, "\n" );
00172         return 1;
00173     }
00174     fclose( pFile );
00175 
00176     // set the new network
00177     pLib = Mio_LibraryRead( pAbc, FileName, 0, fVerbose );  
00178     if ( pLib == NULL )
00179     {
00180         fprintf( pErr, "Reading GENLIB library has failed.\n" );
00181         return 1;
00182     }
00183     // free the current superlib because it depends on the old Mio library
00184     if ( Abc_FrameReadLibSuper() )
00185     {
00186         extern void Map_SuperLibFree( Map_SuperLib_t * p );
00187 //        Map_SuperLibFree( s_pSuperLib );
00188 //        s_pSuperLib = NULL;
00189         Map_SuperLibFree( Abc_FrameReadLibSuper() );
00190         Abc_FrameSetLibSuper( NULL );
00191     }
00192 
00193     // replace the current library
00194 //    Mio_LibraryDelete( s_pLib );
00195 //    s_pLib = pLib;
00196     Mio_LibraryDelete( Abc_FrameReadLibGen() );
00197     Abc_FrameSetLibGen( pLib );
00198     return 0;
00199 
00200 usage:
00201     fprintf( pErr, "usage: read_library [-vh]\n");
00202     fprintf( pErr, "\t         read the library from a genlib file\n" );  
00203     fprintf( pErr, "\t-h     : enable verbose output\n");
00204     return 1;       /* error exit */
00205 }

void Mio_End (  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file mio.c.

00109 {
00110 //    Mio_LibraryDelete( s_pLib );
00111     Mio_LibraryDelete( Abc_FrameReadLibGen() );
00112 }

void Mio_Init ( Abc_Frame_t pAbc  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file mio.c.

00073 {
00074     char * pFileTemp = "mcnc_temp.genlib";
00075     Mio_Library_t * pLibGen;
00076     FILE * pFile;
00077     int i;
00078 
00079     // write genlib into file
00080     pFile = fopen( pFileTemp, "w" );
00081     for ( i = 0; pMcncGenlib[i]; i++ )
00082         fputs( pMcncGenlib[i], pFile );
00083     fclose( pFile );
00084     // read genlib from file
00085     pLibGen = Mio_LibraryRead( pAbc, pFileTemp, NULL, 0 );
00086     Abc_FrameSetLibGen( pLibGen );
00087 #ifdef WIN32
00088         _unlink( pFileTemp );
00089 #else
00090         unlink( pFileTemp );
00091 #endif
00092 
00093     Cmd_CommandAdd( pAbc, "SC mapping", "read_library",   Mio_CommandReadLibrary,  0 ); 
00094     Cmd_CommandAdd( pAbc, "SC mapping", "print_library",  Mio_CommandPrintLibrary, 0 ); 
00095 }


Variable Documentation

char* pMcncGenlib[25] [static]
Initial value:
 {
    "GATE inv1    1   O=!a;             PIN * INV     1 999 0.9 0.0 0.9 0.0\n",
    "GATE inv2    2   O=!a;             PIN * INV     2 999 1.0 0.0 1.0 0.0\n",
    "GATE inv3    3   O=!a;             PIN * INV     3 999 1.1 0.0 1.1 0.0\n",
    "GATE inv4    4   O=!a;             PIN * INV     4 999 1.2 0.0 1.2 0.0\n",
    "GATE nand2   2   O=!(a*b);         PIN * INV     1 999 1.0 0.0 1.0 0.0\n",
    "GATE nand3   3   O=!(a*b*c);       PIN * INV     1 999 1.1 0.0 1.1 0.0\n",
    "GATE nand4   4   O=!(a*b*c*d);     PIN * INV     1 999 1.4 0.0 1.4 0.0\n",
    "GATE nor2    2   O=!(a+b);         PIN * INV     1 999 1.4 0.0 1.4 0.0\n",
    "GATE nor3    3   O=!(a+b+c);       PIN * INV     1 999 2.4 0.0 2.4 0.0\n",
    "GATE nor4    4   O=!(a+b+c+d);     PIN * INV     1 999 3.8 0.0 3.8 0.0\n",
    "GATE xora    5   O=a*!b+!a*b;      PIN * UNKNOWN 2 999 1.9 0.0 1.9 0.0\n",
    "GATE xorb    5   O=!(a*b+!a*!b);   PIN * UNKNOWN 2 999 1.9 0.0 1.9 0.0\n",
    "GATE xnora   5   O=a*b+!a*!b;      PIN * UNKNOWN 2 999 2.1 0.0 2.1 0.0\n",
    "GATE xnorb   5   O=!(!a*b+a*!b);   PIN * UNKNOWN 2 999 2.1 0.0 2.1 0.0\n",
    "GATE aoi21   3   O=!(a*b+c);       PIN * INV     1 999 1.6 0.0 1.6 0.0\n",
    "GATE aoi22   4   O=!(a*b+c*d);     PIN * INV     1 999 2.0 0.0 2.0 0.0\n",
    "GATE oai21   3   O=!((a+b)*c);     PIN * INV     1 999 1.6 0.0 1.6 0.0\n",
    "GATE oai22   4   O=!((a+b)*(c+d)); PIN * INV     1 999 2.0 0.0 2.0 0.0\n",
    "GATE buf     1   O=a;              PIN * NONINV  1 999 1.0 0.0 1.0 0.0\n",
    "GATE zero    0   O=CONST0;\n",
    "GATE one     0   O=CONST1;\n"
}

Definition at line 33 of file mio.c.


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