Commit 73ba1458 by Alan Mishchenko

Producing AIG after structural mapping.

parent cb845d44
...@@ -193,7 +193,7 @@ Vec_Wec_t * Gia_ManFxRetrieve( Gia_Man_t * p, Vec_Str_t ** pvCompl, int fReverse ...@@ -193,7 +193,7 @@ Vec_Wec_t * Gia_ManFxRetrieve( Gia_Man_t * p, Vec_Str_t ** pvCompl, int fReverse
// compute truth tables // compute truth tables
nCutSize = Gia_ManLutSizeMax( p ); nCutSize = Gia_ManLutSizeMax( p );
nWords = Abc_Truth6WordNum( nCutSize ); nWords = Abc_Truth6WordNum( nCutSize );
vTruths = Gia_ManComputeTruths( p, Abc_MaxInt(6, nCutSize), nItems - Gia_ManCiNum(p), fReverse ); vTruths = Gia_ManComputeTruths( p, nCutSize, nItems - Gia_ManCiNum(p), fReverse );
vCover = Vec_IntAlloc( 1 << 16 ); vCover = Vec_IntAlloc( 1 << 16 );
// collect cubes // collect cubes
vCubes = Vec_WecAlloc( 1000 ); vCubes = Vec_WecAlloc( 1000 );
......
...@@ -1446,8 +1446,7 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) ...@@ -1446,8 +1446,7 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
Vec_Int_t * vCover = Vec_IntAlloc( 1 << 16 ); Vec_Int_t * vCover = Vec_IntAlloc( 1 << 16 );
Vec_Int_t * vLeaves = Vec_IntAlloc( 16 ); Vec_Int_t * vLeaves = Vec_IntAlloc( 16 );
int i, k, iLit, Class, * pCut; int i, k, iLit, Class, * pCut;
word uTruth; word * pTruth, uTruth = 0;
assert( p->pPars->fCutMin );
// create new manager // create new manager
pNew = Gia_ManStart( Gia_ManObjNum(p->pGia) ); pNew = Gia_ManStart( Gia_ManObjNum(p->pGia) );
pNew->pName = Abc_UtilStrsav( p->pGia->pName ); pNew->pName = Abc_UtilStrsav( p->pGia->pName );
...@@ -1457,6 +1456,8 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) ...@@ -1457,6 +1456,8 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
Gia_ManForEachCi( p->pGia, pObj, i ) Gia_ManForEachCi( p->pGia, pObj, i )
Vec_IntWriteEntry( vCopies, Gia_ObjId(p->pGia, pObj), Gia_ManAppendCi(pNew) ); Vec_IntWriteEntry( vCopies, Gia_ObjId(p->pGia, pObj), Gia_ManAppendCi(pNew) );
// iterate through nodes used in the mapping // iterate through nodes used in the mapping
if ( !p->pPars->fCutMin )
Gia_ObjComputeTruthTableStart( p->pGia, p->pPars->nLutSize );
Gia_ManHashStart( pNew ); Gia_ManHashStart( pNew );
Gia_ManForEachAnd( p->pGia, pObj, i ) Gia_ManForEachAnd( p->pGia, pObj, i )
{ {
...@@ -1464,6 +1465,9 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) ...@@ -1464,6 +1465,9 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
continue; continue;
pCut = Jf_ObjCutBest( p, i ); pCut = Jf_ObjCutBest( p, i );
// printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut); // printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut);
// get the truth table
if ( p->pPars->fCutMin )
{
Class = Jf_CutFuncClass( pCut ); Class = Jf_CutFuncClass( pCut );
uTruth = p->pPars->fFuncDsd ? Sdm_ManReadDsdTruth(p->pDsd, Class) : *Vec_MemReadEntry(p->vTtMem, Class); uTruth = p->pPars->fFuncDsd ? Sdm_ManReadDsdTruth(p->pDsd, Class) : *Vec_MemReadEntry(p->vTtMem, Class);
assert( p->pDsd == NULL || Sdm_ManReadDsdVarNum(p->pDsd, Class) == Jf_CutSize(pCut) ); assert( p->pDsd == NULL || Sdm_ManReadDsdVarNum(p->pDsd, Class) == Jf_CutSize(pCut) );
...@@ -1481,13 +1485,22 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) ...@@ -1481,13 +1485,22 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
Vec_IntWriteEntry( vCopies, i, iLit ); Vec_IntWriteEntry( vCopies, i, iLit );
continue; continue;
} }
// collect leaves pTruth = &uTruth;
}
else
{
Vec_IntClear( vLeaves );
Jf_CutForEachLit( pCut, iLit, k )
Vec_IntPush( vLeaves, Abc_Lit2Var(iLit) );
pTruth = Gia_ObjComputeTruthTableCut( p->pGia, pObj, vLeaves );
}
// collect incoming literals
Vec_IntClear( vLeaves ); Vec_IntClear( vLeaves );
Jf_CutForEachLit( pCut, iLit, k ) Jf_CutForEachLit( pCut, iLit, k )
Vec_IntPush( vLeaves, Abc_Lit2LitL(Vec_IntArray(vCopies), iLit) ); Vec_IntPush( vLeaves, Abc_Lit2LitL(Vec_IntArray(vCopies), iLit) );
// create GIA // create GIA
iLit = Dsm_ManDeriveGia( pNew, uTruth, vLeaves, vCover ); iLit = Dsm_ManDeriveGia( pNew, pTruth, vLeaves, vCover );
iLit = Abc_LitNotCond( iLit, Jf_CutFuncCompl(pCut) ); iLit = Abc_LitNotCond( iLit, (p->pPars->fCutMin && Jf_CutFuncCompl(pCut)) );
Vec_IntWriteEntry( vCopies, i, iLit ); Vec_IntWriteEntry( vCopies, i, iLit );
} }
Gia_ManForEachCo( p->pGia, pObj, i ) Gia_ManForEachCo( p->pGia, pObj, i )
...@@ -1495,6 +1508,8 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p ) ...@@ -1495,6 +1508,8 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(p->pGia, pObj) ); iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(p->pGia, pObj) );
Gia_ManAppendCo( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) ); Gia_ManAppendCo( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
} }
if ( !p->pPars->fCutMin )
Gia_ObjComputeTruthTableStop( p->pGia );
Vec_IntFree( vCopies ); Vec_IntFree( vCopies );
Vec_IntFree( vLeaves ); Vec_IntFree( vLeaves );
Vec_IntFree( vCover ); Vec_IntFree( vCover );
......
...@@ -185,7 +185,7 @@ word * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj ) ...@@ -185,7 +185,7 @@ word * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
p->nTtWords = Abc_Truth6WordNum( p->nTtVars ); p->nTtWords = Abc_Truth6WordNum( p->nTtVars );
p->vTtNums = Vec_IntStart( Gia_ManObjNum(p) + 1000 ); p->vTtNums = Vec_IntStart( Gia_ManObjNum(p) + 1000 );
p->vTtNodes = Vec_IntAlloc( 256 ); p->vTtNodes = Vec_IntAlloc( 256 );
p->vTtInputs = Vec_PtrAllocTruthTables( p->nTtVars ); p->vTtInputs = Vec_PtrAllocTruthTables( Abc_MaxInt(6, p->nTtVars) );
p->vTtMemory = Vec_WrdStart( p->nTtWords * 256 ); p->vTtMemory = Vec_WrdStart( p->nTtWords * 256 );
} }
else else
...@@ -285,7 +285,7 @@ void Gia_ObjComputeTruthTableStart( Gia_Man_t * p, int nVarsMax ) ...@@ -285,7 +285,7 @@ void Gia_ObjComputeTruthTableStart( Gia_Man_t * p, int nVarsMax )
p->nTtVars = nVarsMax; p->nTtVars = nVarsMax;
p->nTtWords = Abc_Truth6WordNum( p->nTtVars ); p->nTtWords = Abc_Truth6WordNum( p->nTtVars );
p->vTtNodes = Vec_IntAlloc( 256 ); p->vTtNodes = Vec_IntAlloc( 256 );
p->vTtInputs = Vec_PtrAllocTruthTables( p->nTtVars ); p->vTtInputs = Vec_PtrAllocTruthTables( Abc_MaxInt(6, p->nTtVars) );
p->vTtMemory = Vec_WrdStart( p->nTtWords * 64 ); p->vTtMemory = Vec_WrdStart( p->nTtWords * 64 );
p->vTtNums = Vec_IntAlloc( Gia_ManObjNum(p) + 1000 ); p->vTtNums = Vec_IntAlloc( Gia_ManObjNum(p) + 1000 );
Vec_IntFill( p->vTtNums, Vec_IntCap(p->vTtNums), -ABC_INFINITY ); Vec_IntFill( p->vTtNums, Vec_IntCap(p->vTtNums), -ABC_INFINITY );
......
...@@ -88,7 +88,7 @@ extern void Dau_DsdTruthCompose_rec( word * pFunc, word pFanins[DAU_MAX ...@@ -88,7 +88,7 @@ extern void Dau_DsdTruthCompose_rec( word * pFunc, word pFanins[DAU_MAX
extern int Dau_DsdCheck1Step( word * pTruth, int nVarsInit ); extern int Dau_DsdCheck1Step( word * pTruth, int nVarsInit );
/*=== dauGia.c ==========================================================*/ /*=== dauGia.c ==========================================================*/
extern int Dsm_ManDeriveGia( void * p, word uTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover ); extern int Dsm_ManDeriveGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover );
/*=== dauMerge.c ==========================================================*/ /*=== dauMerge.c ==========================================================*/
extern void Dau_DsdRemoveBraces( char * pDsd, int * pMatches ); extern void Dau_DsdRemoveBraces( char * pDsd, int * pMatches );
......
...@@ -210,14 +210,14 @@ int Dau_DsdToGia( Gia_Man_t * pGia, char * p, int * pLits, Vec_Int_t * vCover ) ...@@ -210,14 +210,14 @@ int Dau_DsdToGia( Gia_Man_t * pGia, char * p, int * pLits, Vec_Int_t * vCover )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Dsm_ManDeriveGia( void * p, word uTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover ) int Dsm_ManDeriveGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover )
{ {
Gia_Man_t * pGia = (Gia_Man_t *)p; Gia_Man_t * pGia = (Gia_Man_t *)p;
char pDsd[1000]; char pDsd[1000];
int nSizeNonDec; int nSizeNonDec;
m_Calls++; m_Calls++;
// static int Counter = 0; Counter++; // static int Counter = 0; Counter++;
nSizeNonDec = Dau_DsdDecompose( &uTruth, Vec_IntSize(vLeaves), 0, 1, pDsd ); nSizeNonDec = Dau_DsdDecompose( pTruth, Vec_IntSize(vLeaves), 0, 1, pDsd );
if ( nSizeNonDec ) if ( nSizeNonDec )
m_NonDsd++; m_NonDsd++;
// printf( "%s\n", pDsd ); // printf( "%s\n", pDsd );
......
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