/**Function************************************************************* Synopsis [Procedures to read/write GIA to/from MiniAIG file.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Gia_ManReadMiniAig( char * pFileName ) { Mini_Aig_t * p = Mini_AigLoad( pFileName ); Gia_Man_t * pGia = Gia_ManFromMiniAig( p ); ABC_FREE( pGia->pName ); pGia->pName = Extra_FileNameGeneric( pFileName ); Mini_AigStop( p ); return pGia; }
/**Function************************************************************* Synopsis [Working with models.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Wlc_Ntk_t * Wlc_NtkAlloc( char * pName, int nObjsAlloc ) { Wlc_Ntk_t * p; p = ABC_CALLOC( Wlc_Ntk_t, 1 ); p->pName = pName ? Extra_FileNameGeneric( pName ) : NULL; Vec_IntGrow( &p->vPis, 111 ); Vec_IntGrow( &p->vPos, 111 ); Vec_IntGrow( &p->vCis, 111 ); Vec_IntGrow( &p->vCos, 111 ); Vec_IntGrow( &p->vFfs, 111 ); p->pMemFanin = Mem_FlexStart(); p->nObjsAlloc = nObjsAlloc; p->pObjs = ABC_CALLOC( Wlc_Obj_t, p->nObjsAlloc ); p->iObj = 1; return p; }
/**Function************************************************************* Synopsis [Derives the library from the genlib library.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib ) { Abc_Frame_t * pAbc = Abc_FrameGetGlobalFrame(); char * pNameGeneric; char * FileNameGenlib; char * FileNameSuper; char * CommandSuper; char * CommandRead; FILE * pFile; if ( pLib == NULL ) return 0; FileNameGenlib = ABC_ALLOC( char, 10000 ); FileNameSuper = ABC_ALLOC( char, 10000 ); CommandSuper = ABC_ALLOC( char, 10000 ); CommandRead = ABC_ALLOC( char, 10000 ); // write the current library into the file sprintf( FileNameGenlib, "%s_temp", Mio_LibraryReadName(pLib) ); pFile = fopen( FileNameGenlib, "w" ); Mio_WriteLibrary( pFile, pLib, 0 ); fclose( pFile ); // get the file name with the library pNameGeneric = Extra_FileNameGeneric( Mio_LibraryReadName(pLib) ); sprintf( FileNameSuper, "%s.super", pNameGeneric ); ABC_FREE( pNameGeneric ); sprintf( CommandSuper, "super -L 1 -I 5 -D 10000000 -A 10000000 -T 100 %s", FileNameGenlib ); if ( Cmd_CommandExecute( pAbc, CommandSuper ) ) { ABC_FREE( FileNameGenlib ); ABC_FREE( FileNameSuper ); ABC_FREE( CommandSuper ); ABC_FREE( CommandRead ); fprintf( stdout, "Cannot execute command \"%s\".\n", CommandSuper ); return 0; } //#ifdef WIN32 // _unlink( FileNameGenlib ); //#else // unlink( FileNameGenlib ); //#endif printf( "A simple supergate library is derived from gate library \"%s\".\n", Mio_LibraryReadName(pLib) ); fflush( stdout ); sprintf( CommandRead, "read_super %s", FileNameSuper ); if ( Cmd_CommandExecute( pAbc, CommandRead ) ) { //#ifdef WIN32 // _unlink( FileNameSuper ); //#else // unlink( FileNameSuper ); //#endif fprintf( stdout, "Cannot execute command \"%s\".\n", CommandRead ); ABC_FREE( FileNameGenlib ); ABC_FREE( FileNameSuper ); ABC_FREE( CommandSuper ); ABC_FREE( CommandRead ); return 0; } //#ifdef WIN32 // _unlink( FileNameSuper ); //#else // unlink( FileNameSuper ); //#endif ABC_FREE( FileNameGenlib ); ABC_FREE( FileNameSuper ); ABC_FREE( CommandSuper ); ABC_FREE( CommandRead ); return 1; }
/**Function************************************************************* Synopsis [Shows the given DOT file.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_ShowFile( char * FileNameDot ) { FILE * pFile; char * FileGeneric; char FileNamePs[200]; char CommandDot[1000]; char * pDotName; char * pDotNameWin = "dot.exe"; char * pDotNameUnix = "dot"; char * pGsNameWin = "gsview32.exe"; char * pGsNameUnix = "gv"; int RetValue; // get DOT names from the resource file if ( Abc_FrameReadFlag("dotwin") ) pDotNameWin = Abc_FrameReadFlag("dotwin"); if ( Abc_FrameReadFlag("dotunix") ) pDotNameUnix = Abc_FrameReadFlag("dotunix"); #ifdef WIN32 pDotName = pDotNameWin; #else pDotName = pDotNameUnix; #endif // check if the input DOT file is okay if ( (pFile = fopen( FileNameDot, "r" )) == NULL ) { fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot ); return; } fclose( pFile ); // create the PostScript file name FileGeneric = Extra_FileNameGeneric( FileNameDot ); sprintf( FileNamePs, "%s.ps", FileGeneric ); free( FileGeneric ); // generate the PostScript file using DOT sprintf( CommandDot, "%s -Tps -o %s %s", pDotName, FileNamePs, FileNameDot ); RetValue = system( CommandDot ); if ( RetValue == -1 ) { fprintf( stdout, "Command \"%s\" did not succeed.\n", CommandDot ); return; } // check that the input PostScript file is okay if ( (pFile = fopen( FileNamePs, "r" )) == NULL ) { fprintf( stdout, "Cannot open intermediate file \"%s\".\n", FileNamePs ); return; } fclose( pFile ); // get GSVIEW names from the resource file if ( Abc_FrameReadFlag("gsviewwin") ) pGsNameWin = Abc_FrameReadFlag("gsviewwin"); if ( Abc_FrameReadFlag("gsviewunix") ) pGsNameUnix = Abc_FrameReadFlag("gsviewunix"); // spawn the viewer #ifdef WIN32 _unlink( FileNameDot ); if ( _spawnl( _P_NOWAIT, pGsNameWin, pGsNameWin, FileNamePs, NULL ) == -1 ) if ( _spawnl( _P_NOWAIT, "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe", "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe", FileNamePs, NULL ) == -1 ) { fprintf( stdout, "Cannot find \"%s\".\n", pGsNameWin ); return; } #else { char CommandPs[1000]; unlink( FileNameDot ); sprintf( CommandPs, "%s %s &", pGsNameUnix, FileNamePs ); if ( system( CommandPs ) == -1 ) { fprintf( stdout, "Cannot execute \"%s\".\n", CommandPs ); return; } } #endif }