@@ -133,37 +133,52 @@ static inline int Sfm_ObjIsTravIdCurrent2( Sfm_Ntk_t * p, int Id ) { return
133133 SeeAlso []
134134
135135***********************************************************************/
136- 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 )
136+ static 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 , Vec_Int_t * vPiBoxes );
137+ static void Sfm_NtkDfsVisitGroup ( Sfm_Ntk_t * p , int iGroup , Vec_Int_t * vNodes , Vec_Wec_t * vGroups , Vec_Int_t * vGroupMap , Vec_Int_t * vBoxesLeft , Vec_Int_t * vPiBoxes )
137138{
138- int i , iFanin ;
139- if ( Sfm_ObjIsPi (p , iNode ) )
140- return ;
139+ int i , iFanin , k , Obj ;
140+ Vec_Int_t * vGroup = Vec_WecEntry ( vGroups , iGroup );
141+ Vec_IntForEachEntry ( vGroup , Obj , i )
142+ assert ( Sfm_ObjIsNode (p , Obj ) );
143+ Vec_IntForEachEntry ( vGroup , Obj , i )
144+ Sfm_ObjSetTravIdCurrent ( p , Obj );
145+ Vec_IntForEachEntry ( vGroup , Obj , i )
146+ Sfm_ObjForEachFanin ( p , Obj , iFanin , k )
147+ Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
148+ Vec_IntForEachEntry ( vGroup , Obj , i )
149+ Vec_IntPush ( vNodes , Obj );
150+ Vec_IntPush ( vBoxesLeft , iGroup );
151+ }
152+ static 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 , Vec_Int_t * vPiBoxes )
153+ {
154+ int i , iFanin , iGroup ;
141155 if ( Sfm_ObjIsTravIdCurrent (p , iNode ) )
142156 return ;
143- if ( Vec_IntEntry (vGroupMap , iNode ) >= 0 )
157+ iGroup = Vec_IntEntry (vGroupMap , iNode );
158+ if ( iGroup >= 0 )
144159 {
145- int k , iGroup = Abc_Lit2Var ( Vec_IntEntry (vGroupMap , iNode ) );
146- Vec_Int_t * vGroup = Vec_WecEntry ( vGroups , iGroup );
147- Vec_IntForEachEntry ( vGroup , iNode , i )
148- assert ( Sfm_ObjIsNode (p , iNode ) );
149- Vec_IntForEachEntry ( vGroup , iNode , i )
150- Sfm_ObjSetTravIdCurrent ( p , iNode );
151- Vec_IntForEachEntry ( vGroup , iNode , i )
152- Sfm_ObjForEachFanin ( p , iNode , iFanin , k )
153- Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft );
154- Vec_IntForEachEntry ( vGroup , iNode , i )
155- Vec_IntPush ( vNodes , iNode );
156- Vec_IntPush ( vBoxesLeft , iGroup );
160+ Sfm_NtkDfsVisitGroup ( p , Abc_Lit2Var (iGroup ), vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
161+ return ;
157162 }
158- else
163+ if ( Sfm_ObjIsPi ( p , iNode ) )
159164 {
160- Sfm_ObjSetTravIdCurrent (p , iNode );
161- Sfm_ObjForEachFanin ( p , iNode , iFanin , i )
162- Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft );
163- Vec_IntPush ( vNodes , iNode );
165+ if ( vPiBoxes && iNode < Vec_IntSize (vPiBoxes ) )
166+ {
167+ int iBox = Vec_IntEntry ( vPiBoxes , iNode );
168+ if ( iBox >= 0 )
169+ {
170+ Sfm_ObjSetTravIdCurrent ( p , iNode );
171+ Sfm_NtkDfsVisitGroup ( p , iBox , vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
172+ }
173+ }
174+ return ;
164175 }
176+ Sfm_ObjSetTravIdCurrent (p , iNode );
177+ Sfm_ObjForEachFanin ( p , iNode , iFanin , i )
178+ Sfm_NtkDfs_rec ( p , iFanin , vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
179+ Vec_IntPush ( vNodes , iNode );
165180}
166- Vec_Int_t * Sfm_NtkDfs ( Sfm_Ntk_t * p , Vec_Wec_t * vGroups , Vec_Int_t * vGroupMap , Vec_Int_t * vBoxesLeft , int fAllBoxes )
181+ Vec_Int_t * Sfm_NtkDfs ( Sfm_Ntk_t * p , Vec_Wec_t * vGroups , Vec_Int_t * vGroupMap , Vec_Int_t * vBoxesLeft , int fAllBoxes , Vec_Int_t * vPiBoxes )
167182{
168183 Vec_Int_t * vNodes ;
169184 int i ;
@@ -174,10 +189,10 @@ Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMa
174189 {
175190 Vec_Int_t * vGroup ;
176191 Vec_WecForEachLevel ( vGroups , vGroup , i )
177- Sfm_NtkDfs_rec ( p , Vec_IntEntry (vGroup , 0 ), vNodes , vGroups , vGroupMap , vBoxesLeft );
192+ Sfm_NtkDfs_rec ( p , Vec_IntEntry (vGroup , 0 ), vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
178193 }
179194 Sfm_NtkForEachPo ( p , i )
180- Sfm_NtkDfs_rec ( p , Sfm_ObjFanin (p , i , 0 ), vNodes , vGroups , vGroupMap , vBoxesLeft );
195+ Sfm_NtkDfs_rec ( p , Sfm_ObjFanin (p , i , 0 ), vNodes , vGroups , vGroupMap , vBoxesLeft , vPiBoxes );
181196 return vNodes ;
182197}
183198
@@ -478,4 +493,3 @@ void Sfm_NtkWindowTest( Sfm_Ntk_t * p, int iNode )
478493
479494
480495ABC_NAMESPACE_IMPL_END
481-
0 commit comments