abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cut.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cut.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [K-feasible cut computation package.]
8 
9  Synopsis [External declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: .h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__opt__cut__cut_h
22 #define ABC__opt__cut__cut_h
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 ////////////////////////////////////////////////////////////////////////
30 /// PARAMETERS ///
31 ////////////////////////////////////////////////////////////////////////
32 
33 
34 
36 
37 
38 #define CUT_SIZE_MIN 3 // the min K of the K-feasible cut computation
39 #define CUT_SIZE_MAX 12 // the max K of the K-feasible cut computation
40 
41 #define CUT_SHIFT 8 // the number of bits for storing latch number in the cut leaves
42 #define CUT_MASK 0xFF // the mask to get the stored latch number
43 
44 ////////////////////////////////////////////////////////////////////////
45 /// BASIC TYPES ///
46 ////////////////////////////////////////////////////////////////////////
47 
48 typedef struct Cut_ManStruct_t_ Cut_Man_t;
50 typedef struct Cut_CutStruct_t_ Cut_Cut_t;
52 
54 {
55  int nVarsMax; // the max cut size ("k" of the k-feasible cuts)
56  int nKeepMax; // the max number of cuts kept at a node
57  int nIdsMax; // the max number of IDs of cut objects
58  int nBitShift; // the number of bits used for the latch counter of an edge
59  int nCutSet; // the number of nodes in the cut set
60  int fTruth; // compute truth tables
61  int fFilter; // filter dominated cuts
62  int fSeq; // compute sequential cuts
63  int fDrop; // drop cuts on the fly
64  int fDag; // compute only DAG cuts
65  int fTree; // compute only tree cuts
66  int fGlobal; // compute only global cuts
67  int fLocal; // compute only local cuts
68  int fRecord; // record the cut computation flow
69  int fRecordAig; // record the cut functions
70  int fFancy; // perform fancy computations
71  int fMap; // computes delay of FPGA mapping with cuts
72  int fAdjust; // removed useless fanouts of XORs/MUXes
73  int fNpnSave; // enables dumping 6-input truth tables
74  int fVerbose; // the verbosiness flag
75 };
76 
78 {
79  unsigned Num0 : 11; // temporary number
80  unsigned Num1 : 11; // temporary number
81  unsigned fSimul : 1; // the value of cut's output at 000.. pattern
82  unsigned fCompl : 1; // the cut is complemented
83  unsigned nVarsMax : 4; // the max number of vars [4-6]
84  unsigned nLeaves : 4; // the number of leaves [4-6]
85  unsigned uSign; // the signature
86  unsigned uCanon0; // the canonical form
87  unsigned uCanon1; // the canonical form
88  Cut_Cut_t * pNext; // the next cut in the list
89  int pLeaves[0]; // the array of leaves
90 };
91 
92 static inline int Cut_CutReadLeaveNum( Cut_Cut_t * p ) { return p->nLeaves; }
93 static inline int * Cut_CutReadLeaves( Cut_Cut_t * p ) { return p->pLeaves; }
94 static inline unsigned * Cut_CutReadTruth( Cut_Cut_t * p ) { return (unsigned *)(p->pLeaves + p->nVarsMax); }
95 static inline void Cut_CutWriteTruth( Cut_Cut_t * p, unsigned * puTruth ) {
96  int i;
97  for ( i = (p->nVarsMax <= 5) ? 0 : ((1 << (p->nVarsMax - 5)) - 1); i >= 0; i-- )
98  p->pLeaves[p->nVarsMax + i] = (int)puTruth[i];
99 }
100 
101 ////////////////////////////////////////////////////////////////////////
102 /// MACRO DEFINITIONS ///
103 ////////////////////////////////////////////////////////////////////////
104 
105 ////////////////////////////////////////////////////////////////////////
106 /// FUNCTION DECLARATIONS ///
107 ////////////////////////////////////////////////////////////////////////
108 
109 /*=== cutApi.c ==========================================================*/
110 extern Cut_Cut_t * Cut_NodeReadCutsNew( Cut_Man_t * p, int Node );
111 extern Cut_Cut_t * Cut_NodeReadCutsOld( Cut_Man_t * p, int Node );
112 extern Cut_Cut_t * Cut_NodeReadCutsTemp( Cut_Man_t * p, int Node );
113 extern void Cut_NodeWriteCutsNew( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
114 extern void Cut_NodeWriteCutsOld( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
115 extern void Cut_NodeWriteCutsTemp( Cut_Man_t * p, int Node, Cut_Cut_t * pList );
116 extern void Cut_NodeSetTriv( Cut_Man_t * p, int Node );
117 extern void Cut_NodeTryDroppingCuts( Cut_Man_t * p, int Node );
118 extern void Cut_NodeFreeCuts( Cut_Man_t * p, int Node );
119 /*=== cutCut.c ==========================================================*/
120 extern void Cut_CutPrint( Cut_Cut_t * pCut, int fSeq );
121 extern void Cut_CutPrintList( Cut_Cut_t * pList, int fSeq );
122 extern int Cut_CutCountList( Cut_Cut_t * pList );
123 /*=== cutMan.c ==========================================================*/
124 extern Cut_Man_t * Cut_ManStart( Cut_Params_t * pParams );
125 extern void Cut_ManStop( Cut_Man_t * p );
126 extern void Cut_ManPrintStats( Cut_Man_t * p );
127 extern void Cut_ManPrintStatsToFile( Cut_Man_t * p, char * pFileName, abctime TimeTotal );
128 extern void Cut_ManSetFanoutCounts( Cut_Man_t * p, Vec_Int_t * vFanCounts );
129 extern void Cut_ManSetNodeAttrs( Cut_Man_t * p, Vec_Int_t * vFanCounts );
130 extern int Cut_ManReadVarsMax( Cut_Man_t * p );
133 extern void Cut_ManIncrementDagNodes( Cut_Man_t * p );
134 /*=== cutNode.c ==========================================================*/
135 extern Cut_Cut_t * Cut_NodeComputeCuts( Cut_Man_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode );
136 extern Cut_Cut_t * Cut_NodeUnionCuts( Cut_Man_t * p, Vec_Int_t * vNodes );
137 extern Cut_Cut_t * Cut_NodeUnionCutsSeq( Cut_Man_t * p, Vec_Int_t * vNodes, int CutSetNum, int fFirst );
138 extern int Cut_ManMappingArea_rec( Cut_Man_t * p, int Node );
139 /*=== cutSeq.c ==========================================================*/
140 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 );
141 extern void Cut_NodeNewMergeWithOld( Cut_Man_t * p, int Node );
142 extern int Cut_NodeTempTransferToNew( Cut_Man_t * p, int Node, int CutSetNum );
143 extern void Cut_NodeOldTransferToNew( Cut_Man_t * p, int Node );
144 /*=== cutOracle.c ==========================================================*/
145 extern Cut_Oracle_t * Cut_OracleStart( Cut_Man_t * pMan );
146 extern void Cut_OracleStop( Cut_Oracle_t * p );
147 extern void Cut_OracleSetFanoutCounts( Cut_Oracle_t * p, Vec_Int_t * vFanCounts );
148 extern int Cut_OracleReadDrop( Cut_Oracle_t * p );
149 extern void Cut_OracleNodeSetTriv( Cut_Oracle_t * p, int Node );
150 extern Cut_Cut_t * Cut_OracleComputeCuts( Cut_Oracle_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1 );
151 extern void Cut_OracleTryDroppingCuts( Cut_Oracle_t * p, int Node );
152 /*=== cutTruth.c ==========================================================*/
153 extern void Cut_TruthNCanonicize( Cut_Cut_t * pCut );
154 /*=== cutPre22.c ==========================================================*/
155 extern void Cut_CellPrecompute();
156 extern void Cut_CellLoad();
157 extern int Cut_CellIsRunning();
158 extern void Cut_CellDumpToFile();
159 extern int Cut_CellTruthLookup( unsigned * pTruth, int nVars );
160 
161 
162 
164 
165 
166 
167 #endif
168 
169 ////////////////////////////////////////////////////////////////////////
170 /// END OF FILE ///
171 ////////////////////////////////////////////////////////////////////////
172 
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
static int * Cut_CutReadLeaves(Cut_Cut_t *p)
Definition: cut.h:93
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Cut_TruthNCanonicize(Cut_Cut_t *pCut)
Definition: cutTruth.c:85
Cut_Cut_t * Cut_OracleComputeCuts(Cut_Oracle_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1)
Definition: cutOracle.c:320
void Cut_CellLoad()
FUNCTION DEFINITIONS ///.
Definition: cutPre22.c:169
void Cut_ManSetNodeAttrs(Cut_Man_t *p, Vec_Int_t *vFanCounts)
Definition: cutMan.c:245
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
static void Cut_CutWriteTruth(Cut_Cut_t *p, unsigned *puTruth)
Definition: cut.h:95
Cut_Cut_t * pNext
Definition: cut.h:88
unsigned uCanon1
Definition: cut.h:87
unsigned fSimul
Definition: cut.h:81
Cut_Oracle_t * Cut_OracleStart(Cut_Man_t *pMan)
FUNCTION DEFINITIONS ///.
Definition: cutOracle.c:73
int Cut_OracleReadDrop(Cut_Oracle_t *p)
Definition: cutOracle.c:176
int Cut_CutCountList(Cut_Cut_t *pList)
Definition: cutCut.c:166
void Cut_OracleStop(Cut_Oracle_t *p)
Definition: cutOracle.c:127
void Cut_NodeSetTriv(Cut_Man_t *p, int Node)
Definition: cutApi.c:145
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
void Cut_ManSetFanoutCounts(Cut_Man_t *p, Vec_Int_t *vFanCounts)
Definition: cutMan.c:229
int Cut_ManMappingArea_rec(Cut_Man_t *p, int Node)
Definition: cutNode.c:544
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
void Cut_OracleTryDroppingCuts(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:407
void Cut_ManIncrementDagNodes(Cut_Man_t *p)
Definition: cutMan.c:309
int fRecordAig
Definition: cut.h:69
static int Cut_CutReadLeaveNum(Cut_Cut_t *p)
Definition: cut.h:92
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
unsigned Num0
Definition: cut.h:79
Cut_Cut_t * Cut_NodeUnionCuts(Cut_Man_t *p, Vec_Int_t *vNodes)
Definition: cutNode.c:678
int Cut_NodeTempTransferToNew(Cut_Man_t *p, int Node, int CutSetNum)
Definition: cutSeq.c:197
unsigned uSign
Definition: cut.h:85
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
void Cut_ManPrintStats(Cut_Man_t *p)
Definition: cutMan.c:155
void Cut_ManStop(Cut_Man_t *p)
Definition: cutMan.c:124
void Cut_NodeOldTransferToNew(Cut_Man_t *p, int Node)
Definition: cutSeq.c:217
void Cut_NodeTryDroppingCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:162
Cut_Man_t * Cut_ManStart(Cut_Params_t *pParams)
FUNCTION DEFINITIONS ///.
Definition: cutMan.c:47
unsigned uCanon0
Definition: cut.h:86
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)
Definition: cutSeq.c:72
void Cut_CellDumpToFile()
Definition: cutPre22.c:835
int Cut_CellIsRunning()
Definition: cutPre22.c:819
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
void Cut_CutPrint(Cut_Cut_t *pCut, int fSeq)
Definition: cutCut.c:276
void Cut_CutPrintList(Cut_Cut_t *pList, int fSeq)
Definition: cutCut.c:308
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
void Cut_OracleNodeSetTriv(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:192
Cut_Cut_t * Cut_NodeComputeCuts(Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode)
Definition: cutNode.c:369
void Cut_CellPrecompute()
Definition: cutPre22.c:233
void Cut_OracleSetFanoutCounts(Cut_Oracle_t *p, Vec_Int_t *vFanCounts)
Definition: cutOracle.c:160
void Cut_ManPrintStatsToFile(Cut_Man_t *p, char *pFileName, abctime TimeTotal)
Definition: cutMan.c:204
unsigned fCompl
Definition: cut.h:82
void Cut_NodeNewMergeWithOld(Cut_Man_t *p, int Node)
Definition: cutSeq.c:165
unsigned Num1
Definition: cut.h:80
Cut_Cut_t * Cut_NodeUnionCutsSeq(Cut_Man_t *p, Vec_Int_t *vNodes, int CutSetNum, int fFirst)
Definition: cutNode.c:795
DECLARATIONS ///.
Definition: cutOracle.c:30
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
Cut_Params_t * Cut_ManReadParams(Cut_Man_t *p)
Definition: cutMan.c:277
unsigned nVarsMax
Definition: cut.h:83
int Cut_CellTruthLookup(unsigned *pTruth, int nVars)
Definition: cutPre22.c:940
Vec_Int_t * Cut_ManReadNodeAttrs(Cut_Man_t *p)
Definition: cutMan.c:293
int Cut_ManReadVarsMax(Cut_Man_t *p)
Definition: cutMan.c:261