Commit fa5f05e3 by Alan Mishchenko

Deriving AIG after cell mapping.

parent 3f31a858
......@@ -1425,6 +1425,22 @@ int Gia_ManFromIfLogicFindLut( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * p
SeeAlso []
***********************************************************************/
int Gia_ManFromIfLogicFindCell( If_Man_t * pIfMan, Gia_Man_t * pNew, If_Cut_t * pCutBest, sat_solver * pSat, Vec_Int_t * vPiVars, Vec_Int_t * vPoVars, void * pNtkCell, Vec_Int_t * vLeaves, Vec_Int_t * vLits, Vec_Int_t * vCover, Vec_Int_t * vMapping, Vec_Int_t * vMapping2, Vec_Int_t * vPacking )
{
return 0;
}
/**Function*************************************************************
Synopsis [Converts IF into GIA manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
{
Gia_Man_t * pNew;
......@@ -1432,7 +1448,9 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
If_Obj_t * pIfObj, * pIfLeaf;
Vec_Int_t * vMapping, * vMapping2, * vPacking = NULL;
Vec_Int_t * vLeaves, * vLeaves2, * vCover, * vLits;
Vec_Int_t * vPiVars = NULL, * vPoVars = NULL;
sat_solver * pSat = NULL;
void * pNtkCell = NULL;
int i, k, Entry;
assert( !pIfMan->pPars->fDeriveLuts || pIfMan->pPars->fTruth );
// if ( pIfMan->pPars->fEnableCheck07 )
......@@ -1478,6 +1496,13 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
pIfObj->iCopy = Gia_ManFromIfLogicCreateLut( pNew, If_CutTruthW(pIfMan, pCutBest), vLeaves, vCover, vMapping, vMapping2 );
pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
}
else if ( pIfMan->pPars->fUseDsd && pIfMan->pPars->fUseDsdTune && pIfMan->pPars->fDeriveLuts )
{
if ( pSat == NULL )
pSat = (sat_solver *)If_ManSatBuildFromCell( NULL, &vPiVars, &vPoVars, (void **)&pNtkCell );
pIfObj->iCopy = Gia_ManFromIfLogicFindCell( pIfMan, pNew, pCutBest, pSat, vPiVars, vPoVars, pNtkCell, vLeaves, vLits, vCover, vMapping, vMapping2, vPacking );
pIfObj->iCopy = Abc_LitNotCond( pIfObj->iCopy, pCutBest->fCompl );
}
else if ( (pIfMan->pPars->fDeriveLuts && pIfMan->pPars->fTruth) || pIfMan->pPars->fUseDsd || pIfMan->pPars->fUseTtPerm )
{
word * pTruth = If_CutTruthW(pIfMan, pCutBest);
......@@ -1520,6 +1545,10 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
Vec_IntFree( vCover );
Vec_IntFree( vLeaves );
Vec_IntFree( vLeaves2 );
Vec_IntFreeP( &vPiVars );
Vec_IntFreeP( &vPoVars );
if ( pNtkCell )
ABC_FREE( pNtkCell );
if ( pSat != NULL )
sat_solver_delete(pSat);
// printf( "Mapping array size: IfMan = %d. Gia = %d. Increase = %.2f\n",
......
......@@ -1319,6 +1319,32 @@ int CmfFindNumber( char * pName )
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void CnfDupFileUnzip( char * pOldName )
{
extern char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize );
char pNewName[1000];
FILE * pFile;
int nFileSize;
char * pBuffer = Io_MvLoadFileBz2( pOldName, &nFileSize );
assert( strlen(pOldName) < 1000 );
sprintf( pNewName, "%s.v", pOldName );
pFile = fopen( pNewName, "wb" );
fwrite( pBuffer, nFileSize, 1, pFile );
fclose( pFile );
ABC_FREE( pBuffer );
}
/**Function*************************************************************
Synopsis [Command to print the contents of the current directory (Windows).]
Description []
......@@ -1446,8 +1472,9 @@ int CmdCommandRenameFiles( Abc_Frame_t * pAbc, int argc, char **argv )
{
pOldName = (char *)Vec_PtrEntry( vNames, pOrder[i] );
sprintf( pNewName, "%s%0*d.%s", pNameNew ? pNameNew : "", nDigits, nBase+Vec_IntEntry(vNums, pOrder[i]), pNameExt );
printf( "%s -> %s\n", pOldName, pNewName );
rename( pOldName, pNewName );
printf( "%s -> %s\n", pOldName, pNewName );
// CnfDupFileUnzip( pOldName );
}
// cleanup
Vec_PtrFreeFree( vNames );
......
......@@ -548,7 +548,7 @@ typedef struct buflist {
struct buflist * next;
} buflist;
static char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize )
char * Io_MvLoadFileBz2( char * pFileName, int * pnFileSize )
{
FILE * pFile;
int nFileSize = 0;
......
......@@ -623,6 +623,8 @@ extern void If_ManComputeRequired( If_Man_t * p );
extern void If_CutRotatePins( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
extern int If_CutComputeTruthPerm( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int fCompl0, int fCompl1 );
/*=== ifTune.c ===========================================================*/
extern void * If_ManSatBuildFromCell( char * pStr, Vec_Int_t ** pvPiVars, Vec_Int_t ** pvPoVars, void ** ppNtk );
/*=== ifUtil.c ============================================================*/
extern void If_ManCleanNodeCopy( If_Man_t * p );
extern void If_ManCleanCutData( If_Man_t * p );
......
......@@ -621,6 +621,15 @@ sat_solver * Ifn_ManSatBuild( Ifn_Ntk_t * p, Vec_Int_t ** pvPiVars, Vec_Int_t **
Gia_ManStop( p2 );
return pSat;
}
void * If_ManSatBuildFromCell( char * pStr, Vec_Int_t ** pvPiVars, Vec_Int_t ** pvPoVars, void ** ppNtk )
{
Ifn_Ntk_t * p = Ifn_NtkParse( pStr );
*ppNtk = p;
if ( p == NULL )
return NULL;
// Ifn_NtkPrint( p );
return Ifn_ManSatBuild( p, pvPiVars, pvPoVars );
}
/**Function*************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment