summaryrefslogtreecommitdiffstats
path: root/src/opt
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-11-16 23:27:21 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2014-11-16 23:27:21 -0800
commit5a10c8ad01b62a6760e4cf8720800acb1fab8554 (patch)
tree8ecd829e6329e0b3faa94438a52b9f3530d83d13 /src/opt
parentd9ffe9c3ad918bffadc833be0542a50c758d85d5 (diff)
downloadabc-5a10c8ad01b62a6760e4cf8720800acb1fab8554.tar.gz
abc-5a10c8ad01b62a6760e4cf8720800acb1fab8554.tar.bz2
abc-5a10c8ad01b62a6760e4cf8720800acb1fab8554.zip
Integrating mfs2 package to work with boxes.
Diffstat (limited to 'src/opt')
-rw-r--r--src/opt/sfm/sfm.h2
-rw-r--r--src/opt/sfm/sfmNtk.c3
-rw-r--r--src/opt/sfm/sfmWin.c36
3 files changed, 31 insertions, 10 deletions
diff --git a/src/opt/sfm/sfm.h b/src/opt/sfm/sfm.h
index c8a30030..1d97cd8b 100644
--- a/src/opt/sfm/sfm.h
+++ b/src/opt/sfm/sfm.h
@@ -77,7 +77,7 @@ extern word * Sfm_NodeReadTruth( Sfm_Ntk_t * p, int i );
extern int Sfm_NodeReadFixed( Sfm_Ntk_t * p, int i );
extern int Sfm_NodeReadUsed( Sfm_Ntk_t * p, int i );
/*=== sfmWin.c ==========================================================*/
-extern Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p );
+extern Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft );
ABC_NAMESPACE_HEADER_END
diff --git a/src/opt/sfm/sfmNtk.c b/src/opt/sfm/sfmNtk.c
index fd04e432..1ded0ede 100644
--- a/src/opt/sfm/sfmNtk.c
+++ b/src/opt/sfm/sfmNtk.c
@@ -54,7 +54,8 @@ void Sfm_CheckConsistency( Vec_Wec_t * vFanins, int nPis, int nPos, Vec_Str_t *
assert( Vec_IntSize(vArray) == 0 && Vec_StrEntry(vFixed, i) == (char)0 );
// nodes are in a topo order; POs cannot be fanins
Vec_IntForEachEntry( vArray, Fanin, k )
- assert( Fanin < i && Fanin + nPos < Vec_WecSize(vFanins) );
+// assert( Fanin < i && Fanin + nPos < Vec_WecSize(vFanins) );
+ assert( Fanin + nPos < Vec_WecSize(vFanins) );
// POs have one fanout
if ( i + nPos >= Vec_WecSize(vFanins) )
assert( Vec_IntSize(vArray) == 1 && Vec_StrEntry(vFixed, i) == (char)0 );
diff --git a/src/opt/sfm/sfmWin.c b/src/opt/sfm/sfmWin.c
index 9f91c936..6eab478e 100644
--- a/src/opt/sfm/sfmWin.c
+++ b/src/opt/sfm/sfmWin.c
@@ -125,33 +125,53 @@ static inline int Sfm_ObjIsTravIdCurrent2( Sfm_Ntk_t * p, int Id ) { return
Synopsis [Collects used internal nodes in a topological order.]
- Description []
+ Description [Additionally considers objects in groups as a single object
+ and collects them in a topological order together as single entity.]
SideEffects []
SeeAlso []
***********************************************************************/
-void Sfm_NtkDfs_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes )
+void Sfm_NtkDfs_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft )
{
int i, iFanin;
if ( Sfm_ObjIsPi(p, iNode) )
return;
if ( Sfm_ObjIsTravIdCurrent(p, iNode) )
return;
- Sfm_ObjSetTravIdCurrent(p, iNode);
- Sfm_ObjForEachFanin( p, iNode, iFanin, i )
- Sfm_NtkDfs_rec( p, iFanin, vNodes );
- Vec_IntPush( vNodes, iNode );
+ if ( Vec_IntEntry(vGroupMap, iNode) >= 0 )
+ {
+ int k, iGroup = Abc_Lit2Var( Vec_IntEntry(vGroupMap, iNode) );
+ Vec_Int_t * vGroup = Vec_WecEntry( vGroups, iGroup );
+ Vec_IntForEachEntry( vGroup, iNode, i )
+ assert( Sfm_ObjIsNode(p, iNode) );
+ Vec_IntForEachEntry( vGroup, iNode, i )
+ Sfm_ObjSetTravIdCurrent( p, iNode );
+ Vec_IntForEachEntry( vGroup, iNode, i )
+ Sfm_ObjForEachFanin( p, iNode, iFanin, k )
+ Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
+ Vec_IntForEachEntry( vGroup, iNode, i )
+ Vec_IntPush( vNodes, iNode );
+ Vec_IntPush( vBoxesLeft, iGroup );
+ }
+ else
+ {
+ Sfm_ObjSetTravIdCurrent(p, iNode);
+ Sfm_ObjForEachFanin( p, iNode, iFanin, i )
+ Sfm_NtkDfs_rec( p, iFanin, vNodes, vGroups, vGroupMap, vBoxesLeft );
+ Vec_IntPush( vNodes, iNode );
+ }
}
-Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p )
+Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft )
{
Vec_Int_t * vNodes;
int i;
+ Vec_IntClear( vBoxesLeft );
vNodes = Vec_IntAlloc( p->nObjs );
Sfm_NtkIncrementTravId( p );
Sfm_NtkForEachPo( p, i )
- Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes );
+ Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
return vNodes;
}