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

  Synopsis    [Cycles the circuit to create a new initial state.]

  Description [Simulates the circuit with random (or ternary) input 
  for the given number of timeframes to get a better initial state.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Cycles the circuit to create a new initial state.]

Description [Simulates the circuit with random (or ternary) input
for the given number of timeframes to get a better initial state.]




Function Synopsis [ Cycles the circuit to create a new initial state . ] Description [ Simulates the circuit with random ( or ternary ) input for the given number of timeframes to get a better initial state . ]
void Abc_NtkCycleInitState( Abc_Ntk_t * pNtk, int nFrames, int fUseXval, int fVerbose )
{ 
    Abc_Obj_t * pObj;
    int i, f;
    assert( Abc_NtkIsStrash(pNtk) );
    Gia_ManRandom( 1 );
    Abc_ObjSetXsim( Abc_AigConst1(pNtk), XVS1 );
    Abc_NtkForEachLatch( pNtk, pObj, i )
        Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_LatchInit(pObj) );
    for ( f = 0; f < nFrames; f++ )
    {
        Abc_NtkForEachPi( pNtk, pObj, i )
            Abc_ObjSetXsim( pObj, fUseXval? ABC_INIT_DC : Abc_XsimRand2() );
        Abc_AigForEachAnd( pNtk, pObj, i )
            Abc_ObjSetXsim( pObj, Abc_XsimAnd(Abc_ObjGetXsimFanin0(pObj), Abc_ObjGetXsimFanin1(pObj)) );
        Abc_NtkForEachCo( pNtk, pObj, i )
            Abc_ObjSetXsim( pObj, Abc_ObjGetXsimFanin0(pObj) );
        Abc_NtkForEachLatch( pNtk, pObj, i )
            Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_ObjGetXsim(Abc_ObjFanin0(pObj)) );
    }
    Abc_NtkForEachLatch( pNtk, pObj, i )
    {
        pObj->pData = (void *)(ABC_PTRINT_T)Abc_ObjGetXsim(Abc_ObjFanout0(pObj));
    }
}
void Abc_NtkCycleInitState ( Abc_Ntk_t * pNtk , int nFrames , int fUseXval , int fVerbose ) { Abc_Obj_t * pObj ; int i , f ; assert ( Abc_NtkIsStrash ( pNtk ) ) ; Gia_ManRandom ( 1 ) ; Abc_ObjSetXsim ( Abc_AigConst1 ( pNtk ) , XVS1 ) ; Abc_NtkForEachLatch ( pNtk , pObj , i ) Abc_ObjSetXsim ( Abc_ObjFanout0 ( pObj ) , Abc_LatchInit ( pObj ) ) ; for ( f = 0 ; f < nFrames ; f ++ ) { Abc_NtkForEachPi ( pNtk , pObj , i ) Abc_ObjSetXsim ( pObj , fUseXval ? ABC_INIT_DC : Abc_XsimRand2 ( ) ) ; Abc_AigForEachAnd ( pNtk , pObj , i ) Abc_ObjSetXsim ( pObj , Abc_XsimAnd ( Abc_ObjGetXsimFanin0 ( pObj ) , Abc_ObjGetXsimFanin1 ( pObj ) ) ) ; Abc_NtkForEachCo ( pNtk , pObj , i ) Abc_ObjSetXsim ( pObj , Abc_ObjGetXsimFanin0 ( pObj ) ) ; Abc_NtkForEachLatch ( pNtk , pObj , i ) Abc_ObjSetXsim ( Abc_ObjFanout0 ( pObj ) , Abc_ObjGetXsim ( Abc_ObjFanin0 ( pObj ) ) ) ; } Abc_NtkForEachLatch ( pNtk , pObj , i ) { pObj -> pData = ( void * ) ( ABC_PTRINT_T ) Abc_ObjGetXsim ( Abc_ObjFanout0 ( pObj ) ) ; } }
Function
Synopsis    [Cycles the circuit to create a new initial state.]
Function Synopsis [ Cycles the circuit to create a new initial state . ]
//    srand( 0x12341234 ); // initialize the values // simulate for the given number of timeframes //            Abc_ObjSetXsim( pObj, ABC_INIT_ONE ); // set the final values //        printf( "%d", Abc_LatchIsInit1(pObj) ); //    printf( "\n" );