summaryrefslogtreecommitdiffstats
path: root/src/aig/fra/fraSec.c
blob: 8b9258cbdea962e005cb7ed288595be001b1c08a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**CFile****************************************************************

  FileName    [fraSec.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [New FRAIG package.]

  Synopsis    [Performs SEC based on seq sweeping.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - June 30, 2007.]

  Revision    [$Id: fraSec.c,v 1.00 2007/06/30 00:00:00 alanmi Exp $]

***********************************************************************/

#include "fra.h"

////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Fra_FraigSec( Aig_Man_t * p, int nFramesFix, int fVerbose, int fVeryVerbose )
{
    Aig_Man_t * pNew;
    int nFrames, RetValue, nIter, clk, clkTotal = clock();
    int fLatchCorr = 0;
    if ( nFramesFix )
    {
        nFrames = nFramesFix;
        // perform seq sweeping for one frame number
        pNew = Fra_FraigInduction( p, 0, nFrames, 0, 0, 0, fLatchCorr, fVeryVerbose, &nIter );
    }
    else
    {
        // perform seq sweeping while increasing the number of frames
        for ( nFrames = 1; ; nFrames++ )
        {
clk = clock();
            pNew = Fra_FraigInduction( p, 0, nFrames, 0, 0, 0, fLatchCorr, fVeryVerbose, &nIter );
            RetValue = Fra_FraigMiterStatus( pNew );
            if ( fVerbose )
            {
                printf( "FRAMES %3d : Iters = %3d. ", nFrames, nIter );
                if ( RetValue == 1 )
                    printf( "UNSAT     " );
                else
                    printf( "UNDECIDED " );
PRT( "Time", clock() - clk );
            }
            if ( RetValue != -1 )
                break;
            Aig_ManStop( pNew );
        }
    }

    // get the miter status
    RetValue = Fra_FraigMiterStatus( pNew );
    Aig_ManStop( pNew );

    // report the miter
    if ( RetValue == 1 )
        printf( "Networks are equivalent after seq sweeping with K=%d frames (%d iters). ", nFrames, nIter );
    else if ( RetValue == 0 )
        printf( "Networks are NOT EQUIVALENT. " );
    else
        printf( "Networks are UNDECIDED after seq sweeping with K=%d frames (%d iters). ", nFrames, nIter );
PRT( "Time", clock() - clkTotal );
    return RetValue;
}


////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////