00001
00021 #ifndef __CUT_H__
00022 #define __CUT_H__
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00031
00035
00036 #define CUT_SIZE_MIN 3 // the min K of the K-feasible cut computation
00037 #define CUT_SIZE_MAX 12 // the max K of the K-feasible cut computation
00038
00039 #define CUT_SHIFT 8 // the number of bits for storing latch number in the cut leaves
00040 #define CUT_MASK 0xFF // the mask to get the stored latch number
00041
00045
00046 typedef struct Cut_ManStruct_t_ Cut_Man_t;
00047 typedef struct Cut_OracleStruct_t_ Cut_Oracle_t;
00048 typedef struct Cut_CutStruct_t_ Cut_Cut_t;
00049 typedef struct Cut_ParamsStruct_t_ Cut_Params_t;
00050
00051 struct Cut_ParamsStruct_t_
00052 {
00053 int nVarsMax;
00054 int nKeepMax;
00055 int nIdsMax;
00056 int nBitShift;
00057 int nCutSet;
00058 int fTruth;
00059 int fFilter;
00060 int fSeq;
00061 int fDrop;
00062 int fDag;
00063 int fTree;
00064 int fGlobal;
00065 int fLocal;
00066 int fRecord;
00067 int fFancy;
00068 int fMap;
00069 int fVerbose;
00070 };
00071
00072 struct Cut_CutStruct_t_
00073 {
00074 unsigned Num0 : 11;
00075 unsigned Num1 : 11;
00076 unsigned fSimul : 1;
00077 unsigned fCompl : 1;
00078 unsigned nVarsMax : 4;
00079 unsigned nLeaves : 4;
00080 unsigned uSign;
00081 unsigned uCanon0;
00082 unsigned uCanon1;
00083 Cut_Cut_t * pNext;
00084 int pLeaves[0];
00085 };
00086
00087 static inline int Cut_CutReadLeaveNum( Cut_Cut_t * p ) { return p->nLeaves; }
00088 static inline int * Cut_CutReadLeaves( Cut_Cut_t * p ) { return p->pLeaves; }
00089 static inline unsigned * Cut_CutReadTruth( Cut_Cut_t * p ) { return (unsigned *)(p->pLeaves + p->nVarsMax); }
00090 static inline void Cut_CutWriteTruth( Cut_Cut_t * p, unsigned * puTruth ) {
00091 int i;
00092 for ( i = (p->nVarsMax <= 5) ? 0 : ((1 << (p->nVarsMax - 5)) - 1); i >= 0; i-- )
00093 p->pLeaves[p->nVarsMax + i] = (int)puTruth[i];
00094 }
00095
00099
00103
00104
00105 extern Cut_Cut_t * Cut_NodeReadCutsNew( Cut_Man_t * p, int Node );
00106 extern Cut_Cut_t * Cut_NodeReadCutsOld( Cut_Man_t * p, int Node );
00107 extern Cut_Cut_t * Cut_NodeReadCutsTemp( Cut_Man_t * p, int Node );
00108 extern void Cut_NodeWriteCutsNew( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
00109 extern void Cut_NodeWriteCutsOld( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
00110 extern void Cut_NodeWriteCutsTemp( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
00111 extern void Cut_NodeSetTriv( Cut_Man_t * p, int Node );
00112 extern void Cut_NodeTryDroppingCuts( Cut_Man_t * p, int Node );
00113 extern void Cut_NodeFreeCuts( Cut_Man_t * p, int Node );
00114
00115 extern void Cut_CutPrint( Cut_Cut_t * pCut, int fSeq );
00116 extern void Cut_CutPrintList( Cut_Cut_t * pList, int fSeq );
00117 extern int Cut_CutCountList( Cut_Cut_t * pList );
00118
00119 extern Cut_Man_t * Cut_ManStart( Cut_Params_t * pParams );
00120 extern void Cut_ManStop( Cut_Man_t * p );
00121 extern void Cut_ManPrintStats( Cut_Man_t * p );
00122 extern void Cut_ManPrintStatsToFile( Cut_Man_t * p, char * pFileName, int TimeTotal );
00123 extern void Cut_ManSetFanoutCounts( Cut_Man_t * p, Vec_Int_t * vFanCounts );
00124 extern void Cut_ManSetNodeAttrs( Cut_Man_t * p, Vec_Int_t * vFanCounts );
00125 extern int Cut_ManReadVarsMax( Cut_Man_t * p );
00126 extern Cut_Params_t * Cut_ManReadParams( Cut_Man_t * p );
00127 extern Vec_Int_t * Cut_ManReadNodeAttrs( Cut_Man_t * p );
00128 extern void Cut_ManIncrementDagNodes( Cut_Man_t * p );
00129
00130 extern Cut_Cut_t * Cut_NodeComputeCuts( Cut_Man_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode );
00131 extern Cut_Cut_t * Cut_NodeUnionCuts( Cut_Man_t * p, Vec_Int_t * vNodes );
00132 extern Cut_Cut_t * Cut_NodeUnionCutsSeq( Cut_Man_t * p, Vec_Int_t * vNodes, int CutSetNum, int fFirst );
00133 extern int Cut_ManMappingArea_rec( Cut_Man_t * p, int Node );
00134
00135 extern void Cut_NodeComputeCutsSeq( Cut_Man_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int nLat0, int nLat1, int fTriv, int CutSetNum );
00136 extern void Cut_NodeNewMergeWithOld( Cut_Man_t * p, int Node );
00137 extern int Cut_NodeTempTransferToNew( Cut_Man_t * p, int Node, int CutSetNum );
00138 extern void Cut_NodeOldTransferToNew( Cut_Man_t * p, int Node );
00139
00140 extern Cut_Oracle_t * Cut_OracleStart( Cut_Man_t * pMan );
00141 extern void Cut_OracleStop( Cut_Oracle_t * p );
00142 extern void Cut_OracleSetFanoutCounts( Cut_Oracle_t * p, Vec_Int_t * vFanCounts );
00143 extern int Cut_OracleReadDrop( Cut_Oracle_t * p );
00144 extern void Cut_OracleNodeSetTriv( Cut_Oracle_t * p, int Node );
00145 extern Cut_Cut_t * Cut_OracleComputeCuts( Cut_Oracle_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1 );
00146 extern void Cut_OracleTryDroppingCuts( Cut_Oracle_t * p, int Node );
00147
00148 extern void Cut_TruthNCanonicize( Cut_Cut_t * pCut );
00149
00150 extern void Cut_CellPrecompute();
00151 extern void Cut_CellLoad();
00152 extern int Cut_CellIsRunning();
00153 extern void Cut_CellDumpToFile();
00154 extern int Cut_CellTruthLookup( unsigned * pTruth, int nVars );
00155
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159
00160 #endif
00161
00165