abc/src/bdd/reo/reoShuffle.c
/**Function*************************************************************

  Synopsis    [Reorders the DD using REO and CUDD.]

  Description [This function can be used to test the performance of the reordering package.]

  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Reorders the DD using REO and CUDD.]

Description [This function can be used to test the performance of the reordering package.]




Function Synopsis [ Reorders the DD using REO and CUDD . ] Description [ This function can be used to test the performance of the reordering package . ]
void Extra_ShuffleTest( reo_man * pReo, DdManager * dd, DdNode * Func )
{
    DdNode * Temp, * bRemap;
    int nSuppSize, OffSet, Num, i;
    abctime clk;
    int pOrder[1000], pOrderInv[1000];
    assert( dd->size < 1000 );
    srand( 0x12341234 );
    nSuppSize = Cudd_SupportSize( dd, Func );
    if ( nSuppSize < 2 )
        return;
    for ( i = 0; i < nSuppSize; i++ )
        pOrder[i] = i;
    for ( i = 0; i < 120; i++ )
    {
        OffSet = rand() % (nSuppSize - 1);
        Num = pOrder[OffSet];
        pOrder[OffSet] = pOrder[OffSet+1];
        pOrder[OffSet+1] = Num;
    }
    for ( i = 0; i < nSuppSize; i++ )
        pOrderInv[pOrder[i]] = i;
    bRemap = Extra_bddRemapUp( dd, Func );  Cudd_Ref( bRemap );
clk = Abc_Clock();
    Temp  = reoShuffle( pReo, dd, bRemap, pOrder, pOrderInv );  Cudd_Ref( Temp );
    {
        DdNode * bFuncPerm;
clk = Abc_Clock();
        bFuncPerm = Cudd_bddPermute( dd, bRemap, pOrderInv );  Cudd_Ref( bFuncPerm );
        if ( bFuncPerm != Temp )
        {
            printf( "REO: Internal verification has failed!\n" );
            fflush( stdout );
        }
        Cudd_RecursiveDeref( dd, bFuncPerm );
    }
    Cudd_RecursiveDeref( dd, Temp );
    Cudd_RecursiveDeref( dd, bRemap );
}
void Extra_ShuffleTest ( reo_man * pReo , DdManager * dd , DdNode * Func ) { DdNode * Temp , * bRemap ; int nSuppSize , OffSet , Num , i ; abctime clk ; int pOrder [ 1000 ] , pOrderInv [ 1000 ] ; assert ( dd -> size < 1000 ) ; srand ( 0x12341234 ) ; nSuppSize = Cudd_SupportSize ( dd , Func ) ; if ( nSuppSize < 2 ) return ; for ( i = 0 ; i < nSuppSize ; i ++ ) pOrder [ i ] = i ; for ( i = 0 ; i < 120 ; i ++ ) { OffSet = rand ( ) % ( nSuppSize - 1 ) ; Num = pOrder [ OffSet ] ; pOrder [ OffSet ] = pOrder [ OffSet + 1 ] ; pOrder [ OffSet + 1 ] = Num ; } for ( i = 0 ; i < nSuppSize ; i ++ ) pOrderInv [ pOrder [ i ] ] = i ; bRemap = Extra_bddRemapUp ( dd , Func ) ; Cudd_Ref ( bRemap ) ; clk = Abc_Clock ( ) ; Temp = reoShuffle ( pReo , dd , bRemap , pOrder , pOrderInv ) ; Cudd_Ref ( Temp ) ; { DdNode * bFuncPerm ; clk = Abc_Clock ( ) ; bFuncPerm = Cudd_bddPermute ( dd , bRemap , pOrderInv ) ; Cudd_Ref ( bFuncPerm ) ; if ( bFuncPerm != Temp ) { printf ( " \n " ) ; fflush ( stdout ) ; } Cudd_RecursiveDeref ( dd , bFuncPerm ) ; } Cudd_RecursiveDeref ( dd , Temp ) ; Cudd_RecursiveDeref ( dd , bRemap ) ; }
Function
Synopsis    [Reorders the DD using REO and CUDD.]
Function Synopsis [ Reorders the DD using REO and CUDD . ]
//    extern int runtime1, runtime2; /*
    printf( "Permutation: " );
    for ( i = 0; i < nSuppSize; i++ )
        printf( "%d ", pOrder[i] );
    printf( "\n" );
    printf( "Inverse permutation: " );
    for ( i = 0; i < nSuppSize; i++ )
        printf( "%d ", pOrderInv[i] );
    printf( "\n" );
*/ // create permutation //    Extra_ReorderSetVerification( pReo, 1 ); //runtime1 += Abc_Clock() - clk; //printf( "Initial = %d. Final = %d.\n", Cudd_DagSize(bRemap), Cudd_DagSize(Temp)  ); //runtime2 += Abc_Clock() - clk;