abc/src/opt/sim/simSeq.c
/**Function*************************************************************

  Synopsis    [Simulates sequential circuit.]

  Description [Takes sequential circuit (pNtk). Simulates the given number
  (nFrames) of the circuit with the given number of machine words (nWords)
  of random simulation data, starting from the initial state. If the initial
  state of some latches is a don't-care, uses random input for that latch.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Simulates sequential circuit.]

Description [Takes sequential circuit (pNtk). Simulates the given number
(nFrames) of the circuit with the given number of machine words (nWords)
of random simulation data, starting from the initial state. If the initial
state of some latches is a don't-care, uses random input for that latch.]




Function Synopsis [ Simulates sequential circuit . ] Description [ Takes sequential circuit ( pNtk ) . Simulates the given number ( nFrames ) of the circuit with the given number of machine words ( nWords ) of random simulation data starting from the initial state . If the initial state of some latches is a don ' t - care uses random input for that latch . ]
Vec_Ptr_t * Sim_SimulateSeqRandom( Abc_Ntk_t * pNtk, int nFrames, int nWords )
{
    Vec_Ptr_t * vInfo;
    Abc_Obj_t * pNode;
    int i;
    assert( Abc_NtkIsStrash(pNtk) );
    vInfo = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), nWords * nFrames, 0 );
    pNode = Abc_AigConst1(pNtk);
    Sim_UtilSetConst( Sim_SimInfoGet(vInfo,pNode), nWords * nFrames, 1 );
    Abc_NtkForEachPi( pNtk, pNode, i )
        Sim_UtilSetRandom( Sim_SimInfoGet(vInfo,pNode), nWords * nFrames );
    Abc_NtkForEachLatch( pNtk, pNode, i )
        if ( Abc_LatchIsInit0(pNode) )
            Sim_UtilSetConst( Sim_SimInfoGet(vInfo,pNode), nWords, 0 );
        else if ( Abc_LatchIsInit1(pNode) )
            Sim_UtilSetConst( Sim_SimInfoGet(vInfo,pNode), nWords, 1 );
        else 
            Sim_UtilSetRandom( Sim_SimInfoGet(vInfo,pNode), nWords );
    for ( i = 0; i < nFrames; i++ )
        Sim_SimulateSeqFrame( vInfo, pNtk, i, nWords, (int)(i < nFrames-1) );
    return vInfo;
}
Vec_Ptr_t * Sim_SimulateSeqRandom ( Abc_Ntk_t * pNtk , int nFrames , int nWords ) { Vec_Ptr_t * vInfo ; Abc_Obj_t * pNode ; int i ; assert ( Abc_NtkIsStrash ( pNtk ) ) ; vInfo = Sim_UtilInfoAlloc ( Abc_NtkObjNumMax ( pNtk ) , nWords * nFrames , 0 ) ; pNode = Abc_AigConst1 ( pNtk ) ; Sim_UtilSetConst ( Sim_SimInfoGet ( vInfo , pNode ) , nWords * nFrames , 1 ) ; Abc_NtkForEachPi ( pNtk , pNode , i ) Sim_UtilSetRandom ( Sim_SimInfoGet ( vInfo , pNode ) , nWords * nFrames ) ; Abc_NtkForEachLatch ( pNtk , pNode , i ) if ( Abc_LatchIsInit0 ( pNode ) ) Sim_UtilSetConst ( Sim_SimInfoGet ( vInfo , pNode ) , nWords , 0 ) ; else if ( Abc_LatchIsInit1 ( pNode ) ) Sim_UtilSetConst ( Sim_SimInfoGet ( vInfo , pNode ) , nWords , 1 ) ; else Sim_UtilSetRandom ( Sim_SimInfoGet ( vInfo , pNode ) , nWords ) ; for ( i = 0 ; i < nFrames ; i ++ ) Sim_SimulateSeqFrame ( vInfo , pNtk , i , nWords , ( int ) ( i < nFrames - 1 ) ) ; return vInfo ; }
Function
Synopsis    [Simulates sequential circuit.]
Function Synopsis [ Simulates sequential circuit . ]
// set the constant data // set the random PI data // set the initial state data // simulate the nodes for the given number of timeframes