Commit dd51c299 by Alan Mishchenko

Experiments with don't-cares.

parent 72c23923
...@@ -218,7 +218,7 @@ void Gia_ShowPath( Gia_Man_t * p, char * pFileName ) ...@@ -218,7 +218,7 @@ void Gia_ShowPath( Gia_Man_t * p, char * pFileName )
{ {
if ( (int)Gia_ObjLevel(p, pNode) != Level || !Vec_BitEntry(vPath, i) ) if ( (int)Gia_ObjLevel(p, pNode) != Level || !Vec_BitEntry(vPath, i) )
continue; continue;
fprintf( pFile, " Node%d [label = \"%d:%d\"", i, i, Gia_ObjIsAnd(pNode)? Gia_ObjLutSize(p, i) : 0 ); fprintf( pFile, " Node%d [label = \"%d:%d\"", i, Vec_IntSize(p->vIdsOrig)?Vec_IntEntry(p->vIdsOrig,i):i, Gia_ObjIsAnd(pNode)?Gia_ObjLutSize(p, i):0 );
fprintf( pFile, ", shape = ellipse" ); fprintf( pFile, ", shape = ellipse" );
if ( pNode->fMark0 ) if ( pNode->fMark0 )
fprintf( pFile, ", style = filled" ); fprintf( pFile, ", style = filled" );
......
...@@ -1028,11 +1028,15 @@ Gia_Man_t * Abc_NtkAigToGia( Abc_Ntk_t * p, int fGiaSimple ) ...@@ -1028,11 +1028,15 @@ Gia_Man_t * Abc_NtkAigToGia( Abc_Ntk_t * p, int fGiaSimple )
} }
pNode->iTemp = Abc_LitNotCond( pHopObj->iData, Hop_IsComplement( (Hop_Obj_t *)pNode->pData ) ); pNode->iTemp = Abc_LitNotCond( pHopObj->iData, Hop_IsComplement( (Hop_Obj_t *)pNode->pData ) );
} }
Vec_PtrFree( vNodes );
// create primary outputs // create primary outputs
Abc_NtkForEachCo( p, pNode, i ) Abc_NtkForEachCo( p, pNode, i )
Gia_ManAppendCo( pNew, Abc_ObjFanin0(pNode)->iTemp ); Gia_ManAppendCo( pNew, Abc_ObjFanin0(pNode)->iTemp );
Gia_ManSetRegNum( pNew, Abc_NtkLatchNum(p) ); Gia_ManSetRegNum( pNew, Abc_NtkLatchNum(p) );
// copy original IDs
pNew->vIdsOrig = Vec_IntStart( Gia_ManObjNum(pNew) );
Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
Vec_IntWriteEntry( pNew->vIdsOrig, Abc_Lit2Var(pNode->iTemp), Abc_ObjId(pNode) );
Vec_PtrFree( vNodes );
// finish mapping // finish mapping
assert( Gia_ManObjNum(pNew) <= nObjs ); assert( Gia_ManObjNum(pNew) <= nObjs );
assert( pNew->vMapping == NULL ); assert( pNew->vMapping == NULL );
......
...@@ -92,6 +92,7 @@ struct Acb_Ntk_t_ ...@@ -92,6 +92,7 @@ struct Acb_Ntk_t_
Vec_Wec_t vFanouts; // fanouts Vec_Wec_t vFanouts; // fanouts
Vec_Wec_t vCnfs; // CNF Vec_Wec_t vCnfs; // CNF
Vec_Str_t vCnf; // CNF Vec_Str_t vCnf; // CNF
Vec_Int_t vSuppOld; // previous support
// other // other
Vec_Que_t * vQue; // temporary Vec_Que_t * vQue; // temporary
Vec_Int_t vCover; // temporary Vec_Int_t vCover; // temporary
...@@ -574,6 +575,7 @@ static inline void Acb_NtkFree( Acb_Ntk_t * p ) ...@@ -574,6 +575,7 @@ static inline void Acb_NtkFree( Acb_Ntk_t * p )
Vec_WecErase( &p->vFanouts ); Vec_WecErase( &p->vFanouts );
Vec_WecErase( &p->vCnfs ); Vec_WecErase( &p->vCnfs );
Vec_StrErase( &p->vCnf ); Vec_StrErase( &p->vCnf );
Vec_IntErase( &p->vSuppOld );
// other // other
Vec_QueFreeP( &p->vQue ); Vec_QueFreeP( &p->vQue );
Vec_IntErase( &p->vCover ); Vec_IntErase( &p->vCover );
...@@ -972,6 +974,7 @@ extern int Acb_NtkComputeLevelD( Acb_Ntk_t * p, Vec_Int_t * vTfo ); ...@@ -972,6 +974,7 @@ extern int Acb_NtkComputeLevelD( Acb_Ntk_t * p, Vec_Int_t * vTfo );
extern void Acb_NtkUpdateLevelD( Acb_Ntk_t * p, int iObj ); extern void Acb_NtkUpdateLevelD( Acb_Ntk_t * p, int iObj );
extern void Acb_NtkUpdateTiming( Acb_Ntk_t * p, int iObj ); extern void Acb_NtkUpdateTiming( Acb_Ntk_t * p, int iObj );
extern void Acb_NtkPrintNode( Acb_Ntk_t * p, int iObj );
extern int Acb_NtkCreateNode( Acb_Ntk_t * p, word uTruth, Vec_Int_t * vSupp ); extern int Acb_NtkCreateNode( Acb_Ntk_t * p, word uTruth, Vec_Int_t * vSupp );
extern void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp ); extern void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp );
......
...@@ -433,14 +433,6 @@ void Acb_NtkPrintVec( Acb_Ntk_t * p, Vec_Int_t * vVec, char * pName ) ...@@ -433,14 +433,6 @@ void Acb_NtkPrintVec( Acb_Ntk_t * p, Vec_Int_t * vVec, char * pName )
printf( "%d ", vVec->pArray[i] ); printf( "%d ", vVec->pArray[i] );
printf( "\n" ); printf( "\n" );
} }
void Acb_NtkPrintNode( Acb_Ntk_t * p, int Node )
{
int k, iFanin, * pFanins;
printf( "Node %d : ", Node );
Acb_ObjForEachFaninFast( p, Node, pFanins, iFanin, k )
printf( "%d ", iFanin );
printf( "\n" );
}
void Acb_NtkPrintVec2( Acb_Ntk_t * p, Vec_Int_t * vVec, char * pName ) void Acb_NtkPrintVec2( Acb_Ntk_t * p, Vec_Int_t * vVec, char * pName )
{ {
int i; int i;
...@@ -486,7 +478,8 @@ Vec_Int_t * Acb_NtkDivisors( Acb_Ntk_t * p, int Pivot, int nTfiLevMin, int fDela ...@@ -486,7 +478,8 @@ Vec_Int_t * Acb_NtkDivisors( Acb_Ntk_t * p, int Pivot, int nTfiLevMin, int fDela
int k, iFanin, * pFanins; int k, iFanin, * pFanins;
Vec_Int_t * vDivs = Vec_IntAlloc( 100 ); Vec_Int_t * vDivs = Vec_IntAlloc( 100 );
Acb_NtkIncTravId( p ); Acb_NtkIncTravId( p );
if ( fDelay ) // delay-oriented // if ( fDelay ) // delay-oriented
if ( 0 ) // delay-oriented
{ {
// start from critical fanins // start from critical fanins
assert( Acb_ObjLevelD( p, Pivot ) > 1 ); assert( Acb_ObjLevelD( p, Pivot ) > 1 );
...@@ -805,7 +798,7 @@ Vec_Int_t * Acb_NtkWindow( Acb_Ntk_t * p, int Pivot, int nTfiLevs, int nTfoLevs, ...@@ -805,7 +798,7 @@ Vec_Int_t * Acb_NtkWindow( Acb_Ntk_t * p, int Pivot, int nTfiLevs, int nTfoLevs,
// mark limited TFO of the divisors // mark limited TFO of the divisors
vMarked = Acb_ObjMarkTfo( p, vDivs, Pivot, nTfoLevMax, nFanMax ); vMarked = Acb_ObjMarkTfo( p, vDivs, Pivot, nTfoLevMax, nFanMax );
// collect TFO and roots // collect TFO and roots
Acb_ObjDeriveTfo( p, Pivot, nTfoLevMax, nFanMax, &vTfo, &vRoots, fDelay ); Acb_ObjDeriveTfo( p, Pivot, nTfoLevMax, nFanMax, &vTfo, &vRoots, 0 );//fDelay );
if ( fVerbose ) Acb_NtkPrintVec( p, vTfo, "vTfo" ); if ( fVerbose ) Acb_NtkPrintVec( p, vTfo, "vTfo" );
if ( fVerbose ) Acb_NtkPrintVec( p, vRoots, "vRoots" ); if ( fVerbose ) Acb_NtkPrintVec( p, vRoots, "vRoots" );
// collect side inputs of the TFO // collect side inputs of the TFO
...@@ -1599,8 +1592,8 @@ void Acb_NtkOpt( Acb_Ntk_t * pNtk, Acb_Par_t * pPars ) ...@@ -1599,8 +1592,8 @@ void Acb_NtkOpt( Acb_Ntk_t * pNtk, Acb_Par_t * pPars )
if ( iObj < nNodes && !Vec_BitEntry(vVisited, iObj) && Acb_NtkObjMffcEstimate(pNtk, iObj) >= n ) if ( iObj < nNodes && !Vec_BitEntry(vVisited, iObj) && Acb_NtkObjMffcEstimate(pNtk, iObj) >= n )
{ {
pMan->nNodes++; pMan->nNodes++;
//if ( iObj != 7 ) if ( iObj != 103 )
// continue; continue;
//Acb_NtkOptNode( pMan, iObj ); //Acb_NtkOptNode( pMan, iObj );
while ( (RetValue = Acb_NtkOptNode(pMan, iObj)) && Acb_ObjFaninNum(pNtk, iObj) ); while ( (RetValue = Acb_NtkOptNode(pMan, iObj)) && Acb_ObjFaninNum(pNtk, iObj) );
Vec_BitWriteEntry( vVisited, iObj, 1 ); Vec_BitWriteEntry( vVisited, iObj, 1 );
...@@ -1609,14 +1602,16 @@ void Acb_NtkOpt( Acb_Ntk_t * pNtk, Acb_Par_t * pPars ) ...@@ -1609,14 +1602,16 @@ void Acb_NtkOpt( Acb_Ntk_t * pNtk, Acb_Par_t * pPars )
} }
else else
{ {
int Value;
Acb_NtkUpdateTiming( pNtk, -1 ); // compute delay information Acb_NtkUpdateTiming( pNtk, -1 ); // compute delay information
while ( Vec_QueTopPriority(pNtk->vQue) > 0 ) while ( (Value = (int)Vec_QueTopPriority(pNtk->vQue)) > 0 )
{ {
int iObj = Vec_QuePop(pNtk->vQue); int iObj = Vec_QuePop(pNtk->vQue);
if ( !Acb_ObjType(pNtk, iObj) ) if ( !Acb_ObjType(pNtk, iObj) )
continue; continue;
//if ( iObj != 28 ) if ( iObj != 103 )
// continue; continue;
//printf( "Trying node %4d (%4d) ", iObj, Value );
Acb_NtkOptNode( pMan, iObj ); Acb_NtkOptNode( pMan, iObj );
} }
} }
......
...@@ -55,11 +55,15 @@ void Acb_ObjCollectTfi_rec( Acb_Ntk_t * p, int iObj, int fTerm ) ...@@ -55,11 +55,15 @@ void Acb_ObjCollectTfi_rec( Acb_Ntk_t * p, int iObj, int fTerm )
} }
Vec_Int_t * Acb_ObjCollectTfi( Acb_Ntk_t * p, int iObj, int fTerm ) Vec_Int_t * Acb_ObjCollectTfi( Acb_Ntk_t * p, int iObj, int fTerm )
{ {
int i; int i, Node;
Vec_IntClear( &p->vArray0 ); Vec_IntClear( &p->vArray0 );
Acb_NtkIncTravId( p ); Acb_NtkIncTravId( p );
if ( iObj > 0 ) if ( iObj > 0 )
{
Vec_IntForEachEntry( &p->vSuppOld, Node, i )
Acb_ObjCollectTfi_rec( p, Node, fTerm );
Acb_ObjCollectTfi_rec( p, iObj, fTerm ); Acb_ObjCollectTfi_rec( p, iObj, fTerm );
}
else else
Acb_NtkForEachCo( p, iObj, i ) Acb_NtkForEachCo( p, iObj, i )
Acb_ObjCollectTfi_rec( p, iObj, fTerm ); Acb_ObjCollectTfi_rec( p, iObj, fTerm );
...@@ -267,10 +271,12 @@ void Acb_NtkPrintPaths( Acb_Ntk_t * p ) ...@@ -267,10 +271,12 @@ void Acb_NtkPrintPaths( Acb_Ntk_t * p )
int iObj; int iObj;
Acb_NtkForEachObj( p, iObj ) Acb_NtkForEachObj( p, iObj )
{ {
printf( "Obj = %5d : ", iObj ); printf( "Obj = %5d : ", iObj );
printf( "PathD = %5d ", Acb_ObjPathD(p, iObj) ); printf( "LevelD = %5d ", Acb_ObjLevelD(p, iObj) );
printf( "PathR = %5d ", Acb_ObjPathR(p, iObj) ); printf( "LevelR = %5d ", Acb_ObjLevelR(p, iObj) );
printf( "Paths = %5d ", Acb_ObjPathD(p, iObj) + Acb_ObjPathR(p, iObj) ); printf( "PathD = %5d ", Acb_ObjPathD(p, iObj) );
printf( "PathR = %5d ", Acb_ObjPathR(p, iObj) );
printf( "Paths = %5d ", Acb_ObjPathD(p, iObj) * Acb_ObjPathR(p, iObj) );
printf( "\n" ); printf( "\n" );
} }
} }
...@@ -323,7 +329,7 @@ void Acb_ObjUpdatePriority( Acb_Ntk_t * p, int iObj ) ...@@ -323,7 +329,7 @@ void Acb_ObjUpdatePriority( Acb_Ntk_t * p, int iObj )
p->vQue = Vec_QueAlloc( 1000 ); p->vQue = Vec_QueAlloc( 1000 );
Vec_QueSetPriority( p->vQue, Vec_FltArrayP(&p->vCounts) ); Vec_QueSetPriority( p->vQue, Vec_FltArrayP(&p->vCounts) );
} }
nPaths = Acb_ObjPathD(p, iObj) + Acb_ObjPathR(p, iObj); nPaths = Acb_ObjPathD(p, iObj) * Acb_ObjPathR(p, iObj);
Acb_ObjSetCounts( p, iObj, (float)nPaths ); Acb_ObjSetCounts( p, iObj, (float)nPaths );
if ( Vec_QueIsMember( p->vQue, iObj ) ) if ( Vec_QueIsMember( p->vQue, iObj ) )
{ {
...@@ -394,6 +400,14 @@ void Acb_NtkUpdateTiming( Acb_Ntk_t * p, int iObj ) ...@@ -394,6 +400,14 @@ void Acb_NtkUpdateTiming( Acb_Ntk_t * p, int iObj )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Acb_NtkPrintNode( Acb_Ntk_t * p, int iObj )
{
int k, iFanin, * pFanins;
printf( "Node %5d : ", iObj );
Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k )
printf( "%d ", iFanin );
printf( "LevelD = %d. LevelR = %d.\n", Acb_ObjLevelD(p, iObj), Acb_ObjLevelR(p, iObj) );
}
int Acb_NtkCreateNode( Acb_Ntk_t * p, word uTruth, Vec_Int_t * vSupp ) int Acb_NtkCreateNode( Acb_Ntk_t * p, word uTruth, Vec_Int_t * vSupp )
{ {
int Pivot = Acb_ObjAlloc( p, ABC_OPER_LUT, Vec_IntSize(vSupp), 0 ); int Pivot = Acb_ObjAlloc( p, ABC_OPER_LUT, Vec_IntSize(vSupp), 0 );
...@@ -432,14 +446,28 @@ void Acb_NtkResetNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp ...@@ -432,14 +446,28 @@ void Acb_NtkResetNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp
Acb_NtkResetNode( p, iFanin, 0, NULL ); Acb_NtkResetNode( p, iFanin, 0, NULL );
Vec_IntFree( vFanins ); Vec_IntFree( vFanins );
} }
void Acb_NtkSaveSupport( Acb_Ntk_t * p, int iObj )
{
int k, iFanin, * pFanins;
Vec_IntClear( &p->vSuppOld );
Acb_ObjForEachFaninFast( p, iObj, pFanins, iFanin, k )
Vec_IntPush( &p->vSuppOld, iFanin );
}
void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp ) void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp )
{ {
int Level = Acb_ObjLevelD(p, Pivot);
Acb_NtkSaveSupport( p, Pivot );
//Acb_NtkPrintNode( p, Pivot );
Acb_NtkResetNode( p, Pivot, uTruth, vSupp ); Acb_NtkResetNode( p, Pivot, uTruth, vSupp );
Acb_ObjComputeLevelD( p, Pivot ); Acb_ObjComputeLevelD( p, Pivot );
//assert( Level > Acb_ObjLevelD(p, Pivot) );
//Acb_NtkPrintNode( p, Pivot );
if ( p->vQue == NULL ) if ( p->vQue == NULL )
Acb_NtkUpdateLevelD( p, Pivot ); Acb_NtkUpdateLevelD( p, Pivot );
else else
Acb_NtkUpdateTiming( p, Pivot ); // Acb_NtkUpdateTiming( p, Pivot );
Acb_NtkUpdateTiming( p, -1 );
Vec_IntClear( &p->vSuppOld );
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
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