abc/src/base/abci/abcStrash.c
/**Function*************************************************************

  Synopsis    [Reapplies structural hashing to the AIG.]

  Description [Because of the structural hashing, this procedure should not 
  change the number of nodes. It is useful to detect the bugs in the original AIG.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Reapplies structural hashing to the AIG.]

Description [Because of the structural hashing, this procedure should not
change the number of nodes. It is useful to detect the bugs in the original AIG.]




Function Synopsis [ Reapplies structural hashing to the AIG . ] Description [ Because of the structural hashing this procedure should not change the number of nodes . It is useful to detect the bugs in the original AIG . ]
Abc_Ntk_t * Abc_NtkRestrashRandom( Abc_Ntk_t * pNtk )
{
    Abc_Ntk_t * pNtkAig;
    Abc_Obj_t * pObj;
    int i;
    assert( Abc_NtkIsStrash(pNtk) );
    if ( Abc_NtkGetChoiceNum( pNtk ) )
        printf( "Warning: The choice nodes in the original AIG are removed by strashing.\n" );
    pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
    Abc_NtkIncrementTravId( pNtk );
    Abc_NtkForEachCo( pNtk, pObj, i )
        Abc_NtkRestrashRandom_rec( pNtkAig, Abc_ObjFanin0(pObj) );
    Abc_NtkFinalize( pNtk, pNtkAig );
    if ( pNtk->pExdc )
        pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
    if ( !Abc_NtkCheck( pNtkAig ) )
    {
        printf( "Abc_NtkStrash: The network check has failed.\n" );
        Abc_NtkDelete( pNtkAig );
        return NULL;
    }
    return pNtkAig;
}
Abc_Ntk_t * Abc_NtkRestrashRandom ( Abc_Ntk_t * pNtk ) { Abc_Ntk_t * pNtkAig ; Abc_Obj_t * pObj ; int i ; assert ( Abc_NtkIsStrash ( pNtk ) ) ; if ( Abc_NtkGetChoiceNum ( pNtk ) ) printf ( " \n " ) ; pNtkAig = Abc_NtkStartFrom ( pNtk , ABC_NTK_STRASH , ABC_FUNC_AIG ) ; Abc_NtkIncrementTravId ( pNtk ) ; Abc_NtkForEachCo ( pNtk , pObj , i ) Abc_NtkRestrashRandom_rec ( pNtkAig , Abc_ObjFanin0 ( pObj ) ) ; Abc_NtkFinalize ( pNtk , pNtkAig ) ; if ( pNtk -> pExdc ) pNtkAig -> pExdc = Abc_NtkDup ( pNtk -> pExdc ) ; if ( ! Abc_NtkCheck ( pNtkAig ) ) { printf ( " \n " ) ; Abc_NtkDelete ( pNtkAig ) ; return NULL ; } return pNtkAig ; }
Function
Synopsis    [Reapplies structural hashing to the AIG.]
Function Synopsis [ Reapplies structural hashing to the AIG . ]
// print warning about choice nodes // start the new network (constants and CIs of the old network will point to the their counterparts in the new network) // restrash the nodes (assuming a topological order of the old network) // finalize the network // duplicate EXDC  // make sure everything is okay