summaryrefslogtreecommitdiffstats
path: root/src/opt
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-09-30 22:41:55 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2013-09-30 22:41:55 -0700
commit1fb7ef8153eb42bc8b614f109571c9e47138b956 (patch)
tree4dbed89f936a808c2b73343289f9716a33e5ab6a /src/opt
parent4f72aff1d164b1ebb190ac5e1e7a5c01d8d1e720 (diff)
downloadabc-1fb7ef8153eb42bc8b614f109571c9e47138b956.tar.gz
abc-1fb7ef8153eb42bc8b614f109571c9e47138b956.tar.bz2
abc-1fb7ef8153eb42bc8b614f109571c9e47138b956.zip
Converting mapped AIG into strashed AIG.
Diffstat (limited to 'src/opt')
-rw-r--r--src/opt/dau/dau.h3
-rw-r--r--src/opt/dau/dauGia.c63
2 files changed, 64 insertions, 2 deletions
diff --git a/src/opt/dau/dau.h b/src/opt/dau/dau.h
index f91d2831..a928fecf 100644
--- a/src/opt/dau/dau.h
+++ b/src/opt/dau/dau.h
@@ -88,7 +88,8 @@ extern void Dau_DsdTruthCompose_rec( word * pFunc, word pFanins[DAU_MAX
extern int Dau_DsdCheck1Step( word * pTruth, int nVarsInit );
/*=== dauGia.c ==========================================================*/
-extern int Dsm_ManDeriveGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover );
+extern int Dsm_ManTruthToGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover );
+extern void * Dsm_ManDeriveGia( void * p );
/*=== dauMerge.c ==========================================================*/
extern void Dau_DsdRemoveBraces( char * pDsd, int * pMatches );
diff --git a/src/opt/dau/dauGia.c b/src/opt/dau/dauGia.c
index 7e7d9094..a714f622 100644
--- a/src/opt/dau/dauGia.c
+++ b/src/opt/dau/dauGia.c
@@ -207,7 +207,7 @@ int Dau_DsdToGia( Gia_Man_t * pGia, char * p, int * pLits, Vec_Int_t * vCover )
SeeAlso []
***********************************************************************/
-int Dsm_ManDeriveGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover )
+int Dsm_ManTruthToGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover )
{
Gia_Man_t * pGia = (Gia_Man_t *)p;
char pDsd[1000];
@@ -239,6 +239,67 @@ void Dsm_ManReportStats()
m_Calls = m_NonDsd = m_Non1Step = 0;
}
+/**Function*************************************************************
+
+ Synopsis [Performs structural hashing on the LUT functions.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void * Dsm_ManDeriveGia( void * pGia )
+{
+ Gia_Man_t * p = (Gia_Man_t *)pGia;
+ Gia_Man_t * pNew, * pTemp;
+ Vec_Int_t * vCover, * vLeaves;
+ Gia_Obj_t * pObj;
+ int k, i, iLut, iVar;
+ word * pTruth;
+ assert( Gia_ManHasMapping(p) );
+ // create new manager
+ pNew = Gia_ManStart( Gia_ManObjNum(p) );
+ pNew->pName = Abc_UtilStrsav( p->pName );
+ pNew->pSpec = Abc_UtilStrsav( p->pSpec );
+ // map primary inputs
+ Gia_ManFillValue(p);
+ Gia_ManConst0(p)->Value = 0;
+ Gia_ManForEachCi( p, pObj, i )
+ pObj->Value = Gia_ManAppendCi(pNew);
+ // iterate through nodes used in the mapping
+ vLeaves = Vec_IntAlloc( 16 );
+ vCover = Vec_IntAlloc( 1 << 16 );
+ Gia_ManHashStart( pNew );
+ Gia_ObjComputeTruthTableStart( p, Gia_ManLutSizeMax(p) );
+ Gia_ManForEachLut( p, iLut )
+ {
+ // collect leaves
+ Vec_IntClear( vLeaves );
+ Gia_LutForEachFanin( p, iLut, iVar, k )
+ Vec_IntPush( vLeaves, iVar );
+ pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, iLut), vLeaves );
+ // collect incoming literals
+ Vec_IntClear( vLeaves );
+ Gia_LutForEachFanin( p, iLut, iVar, k )
+ Vec_IntPush( vLeaves, Gia_ManObj(p, iVar)->Value );
+ Gia_ManObj(p, iLut)->Value = Dsm_ManTruthToGia( pNew, pTruth, vLeaves, vCover );
+ }
+ Gia_ObjComputeTruthTableStop( p );
+ Gia_ManForEachCo( p, pObj, i )
+ pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
+ Gia_ManHashStop( pNew );
+ Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
+ Vec_IntFree( vLeaves );
+ Vec_IntFree( vCover );
+ // perform cleanup
+ pNew = Gia_ManCleanup( pTemp = pNew );
+ Gia_ManStop( pTemp );
+ return pNew;
+}
+
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///