mfsInt.h 7.99 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**CFile****************************************************************

  FileName    [mfsInt.h]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [The good old minimization with complete don't-cares.]

  Synopsis    [Internal declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - June 20, 2005.]

  Revision    [$Id: mfsInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]

***********************************************************************/
 
21 22
#ifndef ABC__opt__mfs__mfsInt_h
#define ABC__opt__mfs__mfsInt_h
Alan Mishchenko committed
23

24

Alan Mishchenko committed
25 26 27 28
////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

29
#include "base/abc/abc.h"
Alan Mishchenko committed
30
#include "mfs.h"
31 32 33 34 35 36
#include "aig/aig/aig.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satSolver.h"
#include "sat/bsat/satStore.h"
#include "bool/bdc/bdc.h"
#include "aig/gia/gia.h"
Alan Mishchenko committed
37 38 39 40 41

////////////////////////////////////////////////////////////////////////
///                         PARAMETERS                               ///
////////////////////////////////////////////////////////////////////////

42 43 44 45


ABC_NAMESPACE_HEADER_START

Alan Mishchenko committed
46

Alan Mishchenko committed
47
#define MFS_FANIN_MAX   12
Alan Mishchenko committed
48 49 50 51 52 53 54 55

typedef struct Mfs_Man_t_ Mfs_Man_t;
struct Mfs_Man_t_
{
    // input data
    Mfs_Par_t *         pPars;
    Abc_Ntk_t *         pNtk;
    Aig_Man_t *         pCare;
Alan Mishchenko committed
56
    Vec_Ptr_t *         vSuppsInv;
Alan Mishchenko committed
57
    int                 nFaninMax;
Alan Mishchenko committed
58 59 60 61
    // intermeditate data for the node
    Vec_Ptr_t *         vRoots;    // the roots of the window
    Vec_Ptr_t *         vSupp;     // the support of the window
    Vec_Ptr_t *         vNodes;    // the internal nodes of the window
Alan Mishchenko committed
62 63
    Vec_Ptr_t *         vDivs;     // the divisors of the node
    Vec_Int_t *         vDivLits;  // the SAT literals of divisor nodes
64 65
    Vec_Int_t *         vProjVarsCnf; // the projection variables
    Vec_Int_t *         vProjVarsSat; // the projection variables
Alan Mishchenko committed
66 67 68 69 70 71
    // intermediate simulation data
    Vec_Ptr_t *         vDivCexes; // the counter-example for dividors
    int                 nDivWords; // the number of words
    int                 nCexes;    // the numbe rof current counter-examples
    int                 nSatCalls; 
    int                 nSatCexes;
72
/*
Alan Mishchenko committed
73 74
    // intermediate AIG data
    Gia_Man_t *         pGia;      // replica of the AIG in the new package
Alan Mishchenko committed
75
//    Gia_Obj_t **        pSat2Gia;  // mapping of PO SAT var into internal GIA nodes
Alan Mishchenko committed
76 77 78
    Tas_Man_t *         pTas;      // the SAT solver
    Vec_Int_t *         vCex;      // the counter-example
    Vec_Ptr_t *         vGiaLits;  // literals given as assumptions
79
*/
Alan Mishchenko committed
80 81 82 83 84
    // used for bidecomposition
    Vec_Int_t *         vTruth;
    Bdc_Man_t *         pManDec;
    int                 nNodesDec;
    int                 nNodesGained;
Alan Mishchenko committed
85
    int                 nNodesGainedLevel;
Alan Mishchenko committed
86 87 88 89
    // solving data
    Aig_Man_t *         pAigWin;   // window AIG with constraints
    Cnf_Dat_t *         pCnf;      // the CNF for the window
    sat_solver *        pSat;      // the SAT solver used 
Alan Mishchenko committed
90 91 92
    Int_Man_t *         pMan;      // interpolation manager;
    Vec_Int_t *         vMem;      // memory for intermediate SOPs
    Vec_Vec_t *         vLevels;   // levelized structure for updating
93
    Vec_Ptr_t *         vMfsFanins;   // the new set of fanins
Alan Mishchenko committed
94 95
    int                 nTotConfLim; // total conflict limit
    int                 nTotConfLevel; // total conflicts on this level
Alan Mishchenko committed
96 97
    // switching activity
    Vec_Int_t *         vProbs; 
Alan Mishchenko committed
98 99 100 101 102 103 104
    // the result of solving
    int                 nFanins;   // the number of fanins
    int                 nWords;    // the number of words
    int                 nCares;    // the number of care minterms
    unsigned            uCare[(MFS_FANIN_MAX<=5)?1:1<<(MFS_FANIN_MAX-5)];  // the computed care-set
    // performance statistics
    int                 nNodesTried;
Alan Mishchenko committed
105
    int                 nNodesResub;
Alan Mishchenko committed
106 107
    int                 nMintsCare;
    int                 nMintsTotal;
Alan Mishchenko committed
108
    int                 nNodesBad;
Alan Mishchenko committed
109
    int                 nTotalDivs;
Alan Mishchenko committed
110
    int                 nTimeOuts;
Alan Mishchenko committed
111
    int                 nTimeOutsLevel;
Alan Mishchenko committed
112
    int                 nDcMints;
Alan Mishchenko committed
113
    double              dTotalRatios;
Alan Mishchenko committed
114 115 116 117 118
    // node/edge stats
    int                 nTotalNodesBeg;
    int                 nTotalNodesEnd;
    int                 nTotalEdgesBeg;
    int                 nTotalEdgesEnd;
Alan Mishchenko committed
119 120
    float               TotalSwitchingBeg;
    float               TotalSwitchingEnd;
Alan Mishchenko committed
121
    // statistics
122 123 124 125 126 127 128 129
    clock_t             timeWin;
    clock_t             timeDiv;
    clock_t             timeAig;
    clock_t             timeGia;
    clock_t             timeCnf;
    clock_t             timeSat;
    clock_t             timeInt;
    clock_t             timeTotal;
Alan Mishchenko committed
130 131
};

Alan Mishchenko committed
132 133
static inline float Abc_MfsObjProb( Mfs_Man_t * p, Abc_Obj_t * pObj ) { return (p->vProbs && pObj->Id < Vec_IntSize(p->vProbs))? Abc_Int2Float(Vec_IntEntry(p->vProbs,pObj->Id)) : 0.0; }

Alan Mishchenko committed
134 135 136 137 138 139 140 141 142 143 144 145
////////////////////////////////////////////////////////////////////////
///                         BASIC TYPES                              ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                      MACRO DEFINITIONS                           ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                    FUNCTION DECLARATIONS                         ///
////////////////////////////////////////////////////////////////////////

Alan Mishchenko committed
146 147 148
/*=== mfsDiv.c ==========================================================*/
extern Vec_Ptr_t *      Abc_MfsComputeDivisors( Mfs_Man_t * p, Abc_Obj_t * pNode, int nLevDivMax );
/*=== mfsInter.c ==========================================================*/
Alan Mishchenko committed
149
extern sat_solver *     Abc_MfsCreateSolverResub( Mfs_Man_t * p, int * pCands, int nCands, int fInvert );
Alan Mishchenko committed
150
extern Hop_Obj_t *      Abc_NtkMfsInterplate( Mfs_Man_t * p, int * pCands, int nCands );
Alan Mishchenko committed
151
extern int              Abc_NtkMfsInterplateEval( Mfs_Man_t * p, int * pCands, int nCands );
Alan Mishchenko committed
152
/*=== mfsMan.c ==========================================================*/
Alan Mishchenko committed
153
extern Mfs_Man_t *      Mfs_ManAlloc( Mfs_Par_t * pPars );
Alan Mishchenko committed
154 155
extern void             Mfs_ManStop( Mfs_Man_t * p );
extern void             Mfs_ManClean( Mfs_Man_t * p );
Alan Mishchenko committed
156
/*=== mfsResub.c ==========================================================*/
Alan Mishchenko committed
157 158
extern void             Abc_NtkMfsPrintResubStats( Mfs_Man_t * p );
extern int              Abc_NtkMfsEdgeSwapEval( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
159
extern int              Abc_NtkMfsEdgePower( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
160 161
extern int              Abc_NtkMfsResubNode( Mfs_Man_t * p, Abc_Obj_t * pNode );
extern int              Abc_NtkMfsResubNode2( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
162
/*=== mfsSat.c ==========================================================*/
Alan Mishchenko committed
163
extern int              Abc_NtkMfsSolveSat( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
164
extern int              Abc_NtkAddOneHotness( Mfs_Man_t * p );
Alan Mishchenko committed
165 166
/*=== mfsStrash.c ==========================================================*/
extern Aig_Man_t *      Abc_NtkConstructAig( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
167
extern double           Abc_NtkConstraintRatio( Mfs_Man_t * p, Abc_Obj_t * pNode );
Alan Mishchenko committed
168 169 170
/*=== mfsWin.c ==========================================================*/
extern Vec_Ptr_t *      Abc_MfsComputeRoots( Abc_Obj_t * pNode, int nWinTfoMax, int nFanoutLimit );

Alan Mishchenko committed
171 172 173 174
/*=== mfsGia.c ==========================================================*/
extern void             Abc_NtkMfsConstructGia( Mfs_Man_t * p );
extern void             Abc_NtkMfsDeconstructGia( Mfs_Man_t * p );
extern int              Abc_NtkMfsTryResubOnceGia( Mfs_Man_t * p, int * pCands, int nCands );
Alan Mishchenko committed
175

176 177 178 179 180


ABC_NAMESPACE_HEADER_END


Alan Mishchenko committed
181 182 183 184 185 186 187

#endif

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