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
35 ABC_NAMESPACE_HEADER_START
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;
49 typedef struct Cut_OracleStruct_t_ Cut_Oracle_t;
50 typedef struct Cut_CutStruct_t_ Cut_Cut_t;
51 typedef struct Cut_ParamsStruct_t_ Cut_Params_t;
52
53 struct Cut_ParamsStruct_t_
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
77 struct Cut_CutStruct_t_
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
Cut_CutReadLeaveNum(Cut_Cut_t * p)92 static inline int Cut_CutReadLeaveNum( Cut_Cut_t * p ) { return p->nLeaves; }
Cut_CutReadLeaves(Cut_Cut_t * p)93 static inline int * Cut_CutReadLeaves( Cut_Cut_t * p ) { return p->pLeaves; }
Cut_CutReadTruth(Cut_Cut_t * p)94 static inline unsigned * Cut_CutReadTruth( Cut_Cut_t * p ) { return (unsigned *)(p->pLeaves + p->nVarsMax); }
Cut_CutWriteTruth(Cut_Cut_t * p,unsigned * puTruth)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 );
131 extern Cut_Params_t * Cut_ManReadParams( Cut_Man_t * p );
132 extern Vec_Int_t * Cut_ManReadNodeAttrs( 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
163 ABC_NAMESPACE_HEADER_END
164
165
166
167 #endif
168
169 ////////////////////////////////////////////////////////////////////////
170 /// END OF FILE ///
171 ////////////////////////////////////////////////////////////////////////
172
173