ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cutSeq.c
Go to the documentation of this file.
1
20
21#include "cutInt.h"
22
24
25
29
33
45static inline void Cut_NodeShiftCutLeaves( Cut_Cut_t * pList, int nLat )
46{
47 Cut_Cut_t * pTemp;
48 int i;
49 // shift the cuts by as many latches
50 Cut_ListForEachCut( pList, pTemp )
51 {
52 pTemp->uSign = 0;
53 for ( i = 0; i < (int)pTemp->nLeaves; i++ )
54 {
55 pTemp->pLeaves[i] += nLat;
56 pTemp->uSign |= Cut_NodeSign( pTemp->pLeaves[i] );
57 }
58 }
59}
60
72void Cut_NodeComputeCutsSeq( Cut_Man_t * p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int nLat0, int nLat1, int fTriv, int CutSetNum )
73{
74 Cut_List_t Super, * pSuper = &Super;
75 Cut_Cut_t * pListNew;
76 abctime clk;
77
78 // get the number of cuts at the node
79 p->nNodeCuts = Cut_CutCountList( Cut_NodeReadCutsOld(p, Node) );
80 if ( p->nNodeCuts >= p->pParams->nKeepMax )
81 return;
82
83 // count only the first visit
84 if ( p->nNodeCuts == 0 )
85 p->nNodes++;
86
87 // store the fanin lists
88 p->pStore0[0] = Cut_NodeReadCutsOld( p, Node0 );
89 p->pStore0[1] = Cut_NodeReadCutsNew( p, Node0 );
90 p->pStore1[0] = Cut_NodeReadCutsOld( p, Node1 );
91 p->pStore1[1] = Cut_NodeReadCutsNew( p, Node1 );
92
93 // duplicate the cut lists if fanin nodes are non-standard
94 if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
95 {
96 p->pStore0[0] = Cut_CutDupList( p, p->pStore0[0] );
97 p->pStore0[1] = Cut_CutDupList( p, p->pStore0[1] );
98 p->pStore1[0] = Cut_CutDupList( p, p->pStore1[0] );
99 p->pStore1[1] = Cut_CutDupList( p, p->pStore1[1] );
100 }
101
102 // shift the cuts by as many latches and recompute signatures
103 if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], nLat0 );
104 if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], nLat0 );
105 if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], nLat1 );
106 if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], nLat1 );
107
108 // store the original lists for comparison
109 p->pCompareOld = Cut_NodeReadCutsOld( p, Node );
110 p->pCompareNew = Cut_NodeReadCutsNew( p, Node );
111
112 // merge the old and the new
113clk = Abc_Clock();
114 Cut_ListStart( pSuper );
115 Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[0], p->pStore1[1], 0, 0 );
116 Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[0], 0, 0 );
117 Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[1], fTriv, 0 );
118 pListNew = Cut_ListFinish( pSuper );
119p->timeMerge += Abc_Clock() - clk;
120
121 // shift the cuts by as many latches and recompute signatures
122 if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
123 {
124 Cut_CutRecycleList( p, p->pStore0[0] );
125 Cut_CutRecycleList( p, p->pStore0[1] );
126 Cut_CutRecycleList( p, p->pStore1[0] );
127 Cut_CutRecycleList( p, p->pStore1[1] );
128 }
129 else
130 {
131 if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], -nLat0 );
132 if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], -nLat0 );
133 if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], -nLat1 );
134 if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], -nLat1 );
135 }
136
137 // set the lists at the node
138 if ( CutSetNum >= 0 )
139 {
140 assert( Cut_NodeReadCutsTemp(p, CutSetNum) == NULL );
141 Cut_NodeWriteCutsTemp( p, CutSetNum, pListNew );
142 }
143 else
144 {
145 assert( Cut_NodeReadCutsNew(p, Node) == NULL );
146 Cut_NodeWriteCutsNew( p, Node, pListNew );
147 }
148
149 // mark the node if we exceeded the number of cuts
150 if ( p->nNodeCuts >= p->pParams->nKeepMax )
151 p->nCutsLimit++;
152}
153
166{
167 Cut_Cut_t * pListOld, * pListNew, * pList;
168 // get the new cuts
169 pListNew = Cut_NodeReadCutsNew( p, Node );
170 if ( pListNew == NULL )
171 return;
172 Cut_NodeWriteCutsNew( p, Node, NULL );
173 // get the old cuts
174 pListOld = Cut_NodeReadCutsOld( p, Node );
175 if ( pListOld == NULL )
176 {
177 Cut_NodeWriteCutsOld( p, Node, pListNew );
178 return;
179 }
180 // merge the lists
181 pList = Cut_CutMergeLists( pListOld, pListNew );
182 Cut_NodeWriteCutsOld( p, Node, pList );
183}
184
185
197int Cut_NodeTempTransferToNew( Cut_Man_t * p, int Node, int CutSetNum )
198{
199 Cut_Cut_t * pList;
200 pList = Cut_NodeReadCutsTemp( p, CutSetNum );
201 Cut_NodeWriteCutsTemp( p, CutSetNum, NULL );
202 Cut_NodeWriteCutsNew( p, Node, pList );
203 return pList != NULL;
204}
205
218{
219 Cut_Cut_t * pList;
220 pList = Cut_NodeReadCutsOld( p, Node );
221 Cut_NodeWriteCutsOld( p, Node, NULL );
222 Cut_NodeWriteCutsNew( p, Node, pList );
223// Cut_CutListVerify( pList );
224}
225
229
230
232
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Cut_CutRecycleList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition cutCut.c:148
Cut_Cut_t * Cut_CutDupList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition cutCut.c:120
Cut_Cut_t * Cut_CutMergeLists(Cut_Cut_t *pList1, Cut_Cut_t *pList2)
Definition cutCut.c:185
#define Cut_ListForEachCut(pList, pCut)
Definition cutInt.h:104
void Cut_NodeDoComputeCuts(Cut_Man_t *p, Cut_List_t *pSuper, int Node, int fCompl0, int fCompl1, Cut_Cut_t *pList0, Cut_Cut_t *pList1, int fTriv, int TreeCode)
Definition cutNode.c:572
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition cutList.h:40
int Cut_NodeTempTransferToNew(Cut_Man_t *p, int Node, int CutSetNum)
Definition cutSeq.c:197
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_NodeNewMergeWithOld(Cut_Man_t *p, int Node)
Definition cutSeq.c:165
void Cut_NodeOldTransferToNew(Cut_Man_t *p, int Node)
Definition cutSeq.c:217
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition cutApi.c:63
int Cut_CutCountList(Cut_Cut_t *pList)
Definition cutCut.c:166
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition cutApi.c:129
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition cutApi.c:113
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition cutApi.c:97
struct Cut_ManStruct_t_ Cut_Man_t
BASIC TYPES ///.
Definition cut.h:48
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition cutApi.c:45
struct Cut_CutStruct_t_ Cut_Cut_t
Definition cut.h:50
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition cutApi.c:80
Cube * p
Definition exorList.c:222
int pLeaves[0]
Definition cut.h:89
unsigned uSign
Definition cut.h:85
unsigned nLeaves
Definition cut.h:84
#define assert(ex)
Definition util_old.h:213