ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fxuUpdate.c File Reference
#include "fxuInt.h"
Include dependency graph for fxuUpdate.c:

Go to the source code of this file.

Functions

void Fxu_Update (Fxu_Matrix *p, Fxu_Single *pSingle, Fxu_Double *pDouble)
 FUNCTION DEFINITIONS ///.
 
void Fxu_UpdateSingle (Fxu_Matrix *p)
 
void Fxu_UpdateDouble (Fxu_Matrix *p)
 

Function Documentation

◆ Fxu_Update()

void Fxu_Update ( Fxu_Matrix * p,
Fxu_Single * pSingle,
Fxu_Double * pDouble )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Updates the matrix after selecting two divisors.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file fxuUpdate.c.

58{
59 Fxu_Cube * pCube, * pCubeNew;
60 Fxu_Var * pVarC, * pVarD;
61 Fxu_Var * pVar1, * pVar2;
62
63 // consider trivial cases
64 if ( pSingle == NULL )
65 {
66 assert( pDouble->Weight == Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble ) );
68 return;
69 }
70 if ( pDouble == NULL )
71 {
72 assert( pSingle->Weight == Fxu_HeapSingleReadMaxWeight( p->pHeapSingle ) );
74 return;
75 }
76
77 // get the variables of the single
78 pVar1 = pSingle->pVar1;
79 pVar2 = pSingle->pVar2;
80
81 // remove the best double from the heap
82 Fxu_HeapDoubleDelete( p->pHeapDouble, pDouble );
83 // remove the best divisor from the table
84 Fxu_ListTableDelDivisor( p, pDouble );
85
86 // create two new columns (vars)
87 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
88 // create one new row (cube)
89 pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
90 pCubeNew->pFirst = pCubeNew;
91 // set the first cube of the positive var
92 pVarD->pFirst = pCubeNew;
93
94 // start collecting the affected vars and cubes
97 // add the vars
98 Fxu_MatrixRingVarsAdd( p, pVar1 );
99 Fxu_MatrixRingVarsAdd( p, pVar2 );
100 // remove the literals and collect the affected cubes
101 // remove the divisors associated with this cube
102 // add to the affected cube the literal corresponding to the new column
103 Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
104 // replace each two cubes of the pair by one new cube
105 // the new cube contains the base and the new literal
106 Fxu_UpdateDoublePairs( p, pDouble, pVarC );
107 // stop collecting the affected vars and cubes
110
111 // add the literals to the new cube
112 assert( pVar1->iVar < pVar2->iVar );
113 assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
114 Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
115 Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
116
117 // create new doubles; we cannot add them in the same loop
118 // because we first have to create *all* new cubes for each node
120 Fxu_UpdateAddNewDoubles( p, pCube );
121 // update the singles after removing some literals
122 Fxu_UpdateCleanOldSingles( p );
123
124 // undo the temporary rings with cubes and vars
127 // we should undo the rings before creating new singles
128
129 // create new singles
130 Fxu_UpdateAddNewSingles( p, pVarC );
131 Fxu_UpdateAddNewSingles( p, pVarD );
132
133 // recycle the divisor
134 MEM_FREE_FXU( p, Fxu_Double, 1, pDouble );
135 p->nDivs3++;
136}
Cube * p
Definition exorList.c:222
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
Definition fxuHeapD.c:319
void Fxu_HeapDoubleDelete(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition fxuHeapD.c:250
int Fxu_HeapSingleReadMaxWeight(Fxu_HeapSingle *p)
Definition fxuHeapS.c:321
void Fxu_ListTableDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition fxuList.c:254
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition fxuSingle.c:241
struct FxuVar Fxu_Var
Definition fxuInt.h:67
#define Fxu_MatrixRingVarsStart( Matrix)
Definition fxuInt.h:386
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
Definition fxuInt.h:397
#define Fxu_MatrixRingVarsAdd( Matrix, Var)
Definition fxuInt.h:395
void Fxu_MatrixAddLiteral(Fxu_Matrix *p, Fxu_Cube *pCube, Fxu_Var *pVar)
Definition fxuMatrix.c:205
struct FxuCube Fxu_Cube
Definition fxuInt.h:66
struct FxuDouble Fxu_Double
Definition fxuInt.h:72
#define Fxu_MatrixRingCubesStop( Matrix)
Definition fxuInt.h:388
#define Fxu_MatrixRingCubesStart(Matrix)
Definition fxuInt.h:385
Fxu_Cube * Fxu_MatrixAddCube(Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
Definition fxuMatrix.c:183
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition fxuInt.h:431
#define Fxu_MatrixRingVarsStop( Matrix)
Definition fxuInt.h:389
void Fxu_UpdateDouble(Fxu_Matrix *p)
Definition fxuUpdate.c:219
void Fxu_UpdateSingle(Fxu_Matrix *p)
Definition fxuUpdate.c:149
void Fxu_MatrixRingCubesUnmark(Fxu_Matrix *p)
Definition fxu.c:185
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition fxu.c:206
Fxu_Cube * pFirst
Definition fxuInt.h:204
int Weight
Definition fxuInt.h:258
int Weight
Definition fxuInt.h:271
Fxu_Var * pVar2
Definition fxuInt.h:273
Fxu_Var * pVar1
Definition fxuInt.h:272
int iVar
Definition fxuInt.h:215
Fxu_Cube * pFirst
Definition fxuInt.h:217
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fxu_UpdateDouble()

void Fxu_UpdateDouble ( Fxu_Matrix * p)

Function*************************************************************

Synopsis [Updates the matrix after accepting a double cube divisor.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file fxuUpdate.c.

220{
221 Fxu_Double * pDiv;
222 Fxu_Cube * pCube, * pCubeNew1, * pCubeNew2;
223 Fxu_Var * pVarC, * pVarD;
224
225 // remove the best divisor from the heap
226 pDiv = Fxu_HeapDoubleGetMax( p->pHeapDouble );
227 // remove the best divisor from the table
228 Fxu_ListTableDelDivisor( p, pDiv );
229
230 // create two new columns (vars)
231 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 2 );
232 // create two new rows (cubes)
233 pCubeNew1 = Fxu_MatrixAddCube( p, pVarD, 0 );
234 pCubeNew1->pFirst = pCubeNew1;
235 pCubeNew2 = Fxu_MatrixAddCube( p, pVarD, 1 );
236 pCubeNew2->pFirst = pCubeNew1;
237 // set the first cube
238 pVarD->pFirst = pCubeNew1;
239
240 // add the literals to the new cubes
241 Fxu_UpdateMatrixDoubleCreateCubes( p, pCubeNew1, pCubeNew2, pDiv );
242
243 // start collecting the affected cubes and vars
246 // replace each two cubes of the pair by one new cube
247 // the new cube contains the base and the new literal
248 Fxu_UpdateDoublePairs( p, pDiv, pVarD );
249 // stop collecting the affected cubes and vars
252
253 // create new doubles; we cannot add them in the same loop
254 // because we first have to create *all* new cubes for each node
256 Fxu_UpdateAddNewDoubles( p, pCube );
257 // update the singles after removing some literals
258 Fxu_UpdateCleanOldSingles( p );
259
260 // undo the temporary rings with cubes and vars
263 // we should undo the rings before creating new singles
264
265 // create new singles
266 Fxu_UpdateAddNewSingles( p, pVarC );
267 Fxu_UpdateAddNewSingles( p, pVarD );
268
269 // recycle the divisor
270 MEM_FREE_FXU( p, Fxu_Double, 1, pDiv );
271 p->nDivs2++;
272}
Fxu_Double * Fxu_HeapDoubleGetMax(Fxu_HeapDouble *p)
Definition fxuHeapD.c:291
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fxu_UpdateSingle()

void Fxu_UpdateSingle ( Fxu_Matrix * p)

Function*************************************************************

Synopsis [Updates after accepting single cube divisor.]

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file fxuUpdate.c.

150{
151 Fxu_Single * pSingle;
152 Fxu_Cube * pCube, * pCubeNew;
153 Fxu_Var * pVarC, * pVarD;
154 Fxu_Var * pVar1, * pVar2;
155
156 // read the best divisor from the heap
157 pSingle = Fxu_HeapSingleReadMax( p->pHeapSingle );
158 // get the variables of this single-cube divisor
159 pVar1 = pSingle->pVar1;
160 pVar2 = pSingle->pVar2;
161
162 // create two new columns (vars)
163 Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
164 // create one new row (cube)
165 pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
166 pCubeNew->pFirst = pCubeNew;
167 // set the first cube
168 pVarD->pFirst = pCubeNew;
169
170 // start collecting the affected vars and cubes
173 // add the vars
174 Fxu_MatrixRingVarsAdd( p, pVar1 );
175 Fxu_MatrixRingVarsAdd( p, pVar2 );
176 // remove the literals and collect the affected cubes
177 // remove the divisors associated with this cube
178 // add to the affected cube the literal corresponding to the new column
179 Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
180 // stop collecting the affected vars and cubes
183
184 // add the literals to the new cube
185 assert( pVar1->iVar < pVar2->iVar );
186 assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
187 Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
188 Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
189
190 // create new doubles; we cannot add them in the same loop
191 // because we first have to create *all* new cubes for each node
193 Fxu_UpdateAddNewDoubles( p, pCube );
194 // update the singles after removing some literals
195 Fxu_UpdateCleanOldSingles( p );
196 // we should undo the rings before creating new singles
197
198 // unmark the cubes
201
202 // create new singles
203 Fxu_UpdateAddNewSingles( p, pVarC );
204 Fxu_UpdateAddNewSingles( p, pVarD );
205 p->nDivs1++;
206}
Fxu_Single * Fxu_HeapSingleReadMax(Fxu_HeapSingle *p)
Definition fxuHeapS.c:275
struct FxuSingle Fxu_Single
Definition fxuInt.h:73
Here is the call graph for this function:
Here is the caller graph for this function: