abc/src/sat/bmc/bmcBmc2.c
/**Function*************************************************************

  Synopsis    [Performs ternary simulation for one design.]

  Description [The returned array contains the result of ternary 
  simulation for all the frames where the output could be proved 0.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Performs ternary simulation for one design.]

Description [The returned array contains the result of ternary
simulation for all the frames where the output could be proved 0.]




Function Synopsis [ Performs ternary simulation for one design . ] Description [ The returned array contains the result of ternary simulation for all the frames where the output could be proved 0 . ]
Vec_Ptr_t * Abs_ManTernarySimulate( Aig_Man_t * p, int nFramesMax, int fVerbose )
{
    Vec_Ptr_t * vSimInfo;
    Aig_Obj_t * pObj;
    int i, f, nFramesLimit, nFrameWords;
    abctime clk = Abc_Clock();
    assert( Aig_ManRegNum(p) > 0 );
    nFramesLimit = 1 + (200000000 * 4)/Aig_ManObjNum(p);
    nFramesLimit = Abc_MinInt( nFramesLimit, nFramesMax );
    nFrameWords  = Abc_BitWordNum( 2 * Aig_ManObjNum(p) );
    vSimInfo = Vec_PtrAlloc( nFramesLimit );
    for ( f = 0; f < nFramesLimit; f++ )
    {
        Vec_PtrPush( vSimInfo, ABC_CALLOC(unsigned, nFrameWords) );
        if ( f == 0 ) 
        {
            Saig_ManForEachLo( p, pObj, i )
                Abs_ManSimInfoSet( vSimInfo, pObj, 0, ABS_ZER );
        }
        Abs_ManSimInfoSet( vSimInfo, Aig_ManConst1(p), f, ABS_ONE );
        Saig_ManForEachPi( p, pObj, i )
            Abs_ManSimInfoSet( vSimInfo, pObj, f, ABS_UND );
        Saig_ManForEachPo( p, pObj, i )
            Abs_ManExtendOneEval_rec( vSimInfo, p, pObj, f );
        Saig_ManForEachPo( p, pObj, i )
            if ( Abs_ManSimInfoGet(vSimInfo, pObj, f) != ABS_ZER )
            {
                if ( fVerbose )
                {
                    printf( "Ternary sim found non-zero output in frame %d.  Used %5.2f MB.  ", 
                        f, 0.25 * (f+1) * Aig_ManObjNum(p) / (1<<20) );
                    ABC_PRT( "Time", Abc_Clock() - clk );
                }
                return vSimInfo;
            }
    }
    if ( fVerbose )
    {
        printf( "Ternary sim proved all outputs in the first %d frames.  Used %5.2f MB.  ", 
            nFramesLimit, 0.25 * nFramesLimit * Aig_ManObjNum(p) / (1<<20) );
        ABC_PRT( "Time", Abc_Clock() - clk );
    }
    return vSimInfo;
}
Vec_Ptr_t * Abs_ManTernarySimulate ( Aig_Man_t * p , int nFramesMax , int fVerbose ) { Vec_Ptr_t * vSimInfo ; Aig_Obj_t * pObj ; int i , f , nFramesLimit , nFrameWords ; abctime clk = Abc_Clock ( ) ; assert ( Aig_ManRegNum ( p ) > 0 ) ; nFramesLimit = 1 + ( 200000000 * 4 ) / Aig_ManObjNum ( p ) ; nFramesLimit = Abc_MinInt ( nFramesLimit , nFramesMax ) ; nFrameWords = Abc_BitWordNum ( 2 * Aig_ManObjNum ( p ) ) ; vSimInfo = Vec_PtrAlloc ( nFramesLimit ) ; for ( f = 0 ; f < nFramesLimit ; f ++ ) { Vec_PtrPush ( vSimInfo , ABC_CALLOC ( unsigned , nFrameWords ) ) ; if ( f == 0 ) { Saig_ManForEachLo ( p , pObj , i ) Abs_ManSimInfoSet ( vSimInfo , pObj , 0 , ABS_ZER ) ; } Abs_ManSimInfoSet ( vSimInfo , Aig_ManConst1 ( p ) , f , ABS_ONE ) ; Saig_ManForEachPi ( p , pObj , i ) Abs_ManSimInfoSet ( vSimInfo , pObj , f , ABS_UND ) ; Saig_ManForEachPo ( p , pObj , i ) Abs_ManExtendOneEval_rec ( vSimInfo , p , pObj , f ) ; Saig_ManForEachPo ( p , pObj , i ) if ( Abs_ManSimInfoGet ( vSimInfo , pObj , f ) != ABS_ZER ) { if ( fVerbose ) { printf ( " " , f , 0.25 * ( f + 1 ) * Aig_ManObjNum ( p ) / ( 1 << 20 ) ) ; ABC_PRT ( " " , Abc_Clock ( ) - clk ) ; } return vSimInfo ; } } if ( fVerbose ) { printf ( " " , nFramesLimit , 0.25 * nFramesLimit * Aig_ManObjNum ( p ) / ( 1 << 20 ) ) ; ABC_PRT ( " " , Abc_Clock ( ) - clk ) ; } return vSimInfo ; }
Function
Synopsis    [Performs ternary simulation for one design.]
Function Synopsis [ Performs ternary simulation for one design . ]
// the maximum number of frames will be determined to use at most 200Mb of RAM // allocate simulation info // check if simulation has derived at least one fail or unknown