summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-04-08 14:35:29 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2017-04-08 14:35:29 -0700
commitdd51c2993458d4c76442bbb5bf1ca00b5d207c35 (patch)
tree1875acdd9a8826fb2f2a12318b8aaa3e5bb21d8d
parent72c23923da38d9e06b4a57816704fe1c0d37a2c4 (diff)
downloadabc-dd51c2993458d4c76442bbb5bf1ca00b5d207c35.tar.gz
abc-dd51c2993458d4c76442bbb5bf1ca00b5d207c35.tar.bz2
abc-dd51c2993458d4c76442bbb5bf1ca00b5d207c35.zip
Experiments with don't-cares.
-rw-r--r--src/aig/gia/giaShow.c2
-rw-r--r--src/base/abc/abcFunc.c6
-rw-r--r--src/base/acb/acb.h3
-rw-r--r--src/base/acb/acbMfs.c25
-rw-r--r--src/base/acb/acbUtil.c42
5 files changed, 54 insertions, 24 deletions
diff --git a/src/aig/gia/giaShow.c b/src/aig/gia/giaShow.c
index 3ca31d55..ead794eb 100644
--- a/src/aig/gia/giaShow.c
+++ b/src/aig/gia/giaShow.c
@@ -218,7 +218,7 @@ void Gia_ShowPath( Gia_Man_t * p, char * pFileName )
{
if ( (int)Gia_ObjLevel(p, pNode) != Level || !Vec_BitEntry(vPath, i) )
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" );
if ( pNode->fMark0 )
fprintf( pFile, ", style = filled" );
diff --git a/src/base/abc/abcFunc.c b/src/base/abc/abcFunc.c
index 5d0261d7..f115231f 100644
--- a/src/base/abc/abcFunc.c
+++ b/src/base/abc/abcFunc.c
@@ -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 ) );
}
- Vec_PtrFree( vNodes );
// create primary outputs
Abc_NtkForEachCo( p, pNode, i )
Gia_ManAppendCo( pNew, Abc_ObjFanin0(pNode)->iTemp );
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
assert( Gia_ManObjNum(pNew) <= nObjs );
assert( pNew->vMapping == NULL );
diff --git a/src/base/acb/acb.h b/src/base/acb/acb.h
index 17962dc8..7c228acb 100644
--- a/src/base/acb/acb.h
+++ b/src/base/acb/acb.h
@@ -92,6 +92,7 @@ struct Acb_Ntk_t_
Vec_Wec_t vFanouts; // fanouts
Vec_Wec_t vCnfs; // CNF
Vec_Str_t vCnf; // CNF
+ Vec_Int_t vSuppOld; // previous support
// other
Vec_Que_t * vQue; // temporary
Vec_Int_t vCover; // temporary
@@ -574,6 +575,7 @@ static inline void Acb_NtkFree( Acb_Ntk_t * p )
Vec_WecErase( &p->vFanouts );
Vec_WecErase( &p->vCnfs );
Vec_StrErase( &p->vCnf );
+ Vec_IntErase( &p->vSuppOld );
// other
Vec_QueFreeP( &p->vQue );
Vec_IntErase( &p->vCover );
@@ -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_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 void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp );
diff --git a/src/base/acb/acbMfs.c b/src/base/acb/acbMfs.c
index a17a179a..d8c6fb16 100644
--- a/src/base/acb/acbMfs.c
+++ b/src/base/acb/acbMfs.c
@@ -433,14 +433,6 @@ void Acb_NtkPrintVec( Acb_Ntk_t * p, Vec_Int_t * vVec, char * pName )
printf( "%d ", vVec->pArray[i] );
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 )
{
int i;
@@ -486,7 +478,8 @@ Vec_Int_t * Acb_NtkDivisors( Acb_Ntk_t * p, int Pivot, int nTfiLevMin, int fDela
int k, iFanin, * pFanins;
Vec_Int_t * vDivs = Vec_IntAlloc( 100 );
Acb_NtkIncTravId( p );
- if ( fDelay ) // delay-oriented
+// if ( fDelay ) // delay-oriented
+ if ( 0 ) // delay-oriented
{
// start from critical fanins
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,
// mark limited TFO of the divisors
vMarked = Acb_ObjMarkTfo( p, vDivs, Pivot, nTfoLevMax, nFanMax );
// 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, vRoots, "vRoots" );
// collect side inputs of the TFO
@@ -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 )
{
pMan->nNodes++;
- //if ( iObj != 7 )
- // continue;
+ if ( iObj != 103 )
+ continue;
//Acb_NtkOptNode( pMan, iObj );
while ( (RetValue = Acb_NtkOptNode(pMan, iObj)) && Acb_ObjFaninNum(pNtk, iObj) );
Vec_BitWriteEntry( vVisited, iObj, 1 );
@@ -1609,14 +1602,16 @@ void Acb_NtkOpt( Acb_Ntk_t * pNtk, Acb_Par_t * pPars )
}
else
{
+ int Value;
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);
if ( !Acb_ObjType(pNtk, iObj) )
continue;
- //if ( iObj != 28 )
- // continue;
+ if ( iObj != 103 )
+ continue;
+ //printf( "Trying node %4d (%4d) ", iObj, Value );
Acb_NtkOptNode( pMan, iObj );
}
}
diff --git a/src/base/acb/acbUtil.c b/src/base/acb/acbUtil.c
index 4b839ec2..1c47bf65 100644
--- a/src/base/acb/acbUtil.c
+++ b/src/base/acb/acbUtil.c
@@ -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 )
{
- int i;
+ int i, Node;
Vec_IntClear( &p->vArray0 );
Acb_NtkIncTravId( p );
if ( iObj > 0 )
+ {
+ Vec_IntForEachEntry( &p->vSuppOld, Node, i )
+ Acb_ObjCollectTfi_rec( p, Node, fTerm );
Acb_ObjCollectTfi_rec( p, iObj, fTerm );
+ }
else
Acb_NtkForEachCo( p, iObj, i )
Acb_ObjCollectTfi_rec( p, iObj, fTerm );
@@ -267,10 +271,12 @@ void Acb_NtkPrintPaths( Acb_Ntk_t * p )
int iObj;
Acb_NtkForEachObj( p, iObj )
{
- printf( "Obj = %5d : ", 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( "Obj = %5d : ", iObj );
+ printf( "LevelD = %5d ", Acb_ObjLevelD(p, iObj) );
+ printf( "LevelR = %5d ", Acb_ObjLevelR(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" );
}
}
@@ -323,7 +329,7 @@ void Acb_ObjUpdatePriority( Acb_Ntk_t * p, int iObj )
p->vQue = Vec_QueAlloc( 1000 );
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 );
if ( Vec_QueIsMember( p->vQue, iObj ) )
{
@@ -394,6 +400,14 @@ void Acb_NtkUpdateTiming( Acb_Ntk_t * p, int iObj )
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 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
Acb_NtkResetNode( p, iFanin, 0, NULL );
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 )
{
+ int Level = Acb_ObjLevelD(p, Pivot);
+ Acb_NtkSaveSupport( p, Pivot );
+ //Acb_NtkPrintNode( p, Pivot );
Acb_NtkResetNode( p, Pivot, uTruth, vSupp );
Acb_ObjComputeLevelD( p, Pivot );
+ //assert( Level > Acb_ObjLevelD(p, Pivot) );
+ //Acb_NtkPrintNode( p, Pivot );
if ( p->vQue == NULL )
Acb_NtkUpdateLevelD( p, Pivot );
else
- Acb_NtkUpdateTiming( p, Pivot );
+// Acb_NtkUpdateTiming( p, Pivot );
+ Acb_NtkUpdateTiming( p, -1 );
+ Vec_IntClear( &p->vSuppOld );
}
////////////////////////////////////////////////////////////////////////