ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaFx.c File Reference
#include "gia.h"
#include "bool/kit/kit.h"
#include "misc/vec/vecWec.h"
#include "bool/dec/dec.h"
#include "opt/dau/dau.h"
#include "misc/util/utilTruth.h"
Include dependency graph for giaFx.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Gia_ManGraphToAig (Gia_Man_t *p, Dec_Graph_t *pGraph)
 DECLARATIONS ///.
 
int Gia_ManSopToAig (Gia_Man_t *p, char *pSop, Vec_Int_t *vLeaves)
 
int Gia_ManFactorGraph (Gia_Man_t *p, Dec_Graph_t *pFForm, Vec_Int_t *vLeaves)
 
int Gia_ManFactorNode (Gia_Man_t *p, char *pSop, Vec_Int_t *vLeaves)
 
Vec_Wrd_tGia_ManComputeTruths (Gia_Man_t *p, int nCutSize, int nLutNum, int fReverse)
 
int Gia_ManAssignNumbers (Gia_Man_t *p)
 
Vec_Wec_tGia_ManFxRetrieve (Gia_Man_t *p, Vec_Str_t **pvCompl, int fReverse)
 
void Gia_ManFxTopoOrder_rec (Vec_Wec_t *vCubes, Vec_Int_t *vFirst, Vec_Int_t *vCount, Vec_Int_t *vVisit, Vec_Int_t *vOrder, int iObj)
 
Vec_Int_tGia_ManFxTopoOrder (Vec_Wec_t *vCubes, int nInputs, int nStart, Vec_Int_t **pvFirst, Vec_Int_t **pvCount)
 
Gia_Man_tGia_ManFxInsert (Gia_Man_t *p, Vec_Wec_t *vCubes, Vec_Str_t *vCompls)
 
Gia_Man_tGia_ManPerformFx (Gia_Man_t *p, int nNewNodesMax, int LitCountMax, int fReverse, int fVerbose, int fVeryVerbose)
 

Function Documentation

◆ Gia_ManAssignNumbers()

int Gia_ManAssignNumbers ( Gia_Man_t * p)

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

Synopsis [Extracts information about the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file giaFx.c.

187{
188 Gia_Obj_t * pObj;
189 int i, Counter = 0;
191 Gia_ManForEachCi( p, pObj, i )
192 pObj->Value = Counter++;
193 Gia_ManForEachLut( p, i )
194 Gia_ManObj(p, i)->Value = Counter++;
195 return Counter;
196}
Cube * p
Definition exorList.c:222
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManComputeTruths()

Vec_Wrd_t * Gia_ManComputeTruths ( Gia_Man_t * p,
int nCutSize,
int nLutNum,
int fReverse )

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

Synopsis [Computing truth tables for the mapped network.]

Description []

SideEffects []

SeeAlso []

Definition at line 139 of file giaFx.c.

140{
141 Vec_Wrd_t * vTruths;
142 Vec_Int_t vLeaves;
143 word * pTruth;
144 int i, k, nWords;
145 nWords = Abc_Truth6WordNum( nCutSize );
146 vTruths = Vec_WrdAlloc( nWords * nLutNum );
147 Gia_ObjComputeTruthTableStart( p, nCutSize );
148 Gia_ManForEachLut( p, i )
149 {
150 // collect and sort fanins
151 vLeaves.nCap = vLeaves.nSize = Gia_ObjLutSize( p, i );
152 vLeaves.pArray = Gia_ObjLutFanins( p, i );
153 if( !Vec_IntCheckUniqueSmall(&vLeaves) )
154 {
155 Vec_IntUniqify(&vLeaves);
156 Vec_IntWriteEntry(p->vMapping, Vec_IntEntry(p->vMapping, i), vLeaves.nSize);
157 for ( k = 0; k < vLeaves.nSize; k++ )
158 Vec_IntWriteEntry(p->vMapping, Vec_IntEntry(p->vMapping, i) + 1 + k, vLeaves.pArray[k]);
159 }
160 assert( Vec_IntCheckUniqueSmall(&vLeaves) );
161 Vec_IntSelectSort( Vec_IntArray(&vLeaves), Vec_IntSize(&vLeaves) );
162 if ( !fReverse )
163 Vec_IntReverseOrder( &vLeaves );
164 // compute truth table
165 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, i), &vLeaves );
166 for ( k = 0; k < nWords; k++ )
167 Vec_WrdPush( vTruths, pTruth[k] );
168// Kit_DsdPrintFromTruth( (unsigned *)pTruth, 6 ); printf( "\n" );
169 }
171 assert( Vec_WrdCap(vTruths) == 16 || Vec_WrdSize(vTruths) == Vec_WrdCap(vTruths) );
172 return vTruths;
173}
int nWords
Definition abcNpn.c:127
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition giaTruth.c:628
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition giaTruth.c:552
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition giaTruth.c:568
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFactorGraph()

int Gia_ManFactorGraph ( Gia_Man_t * p,
Dec_Graph_t * pFForm,
Vec_Int_t * vLeaves )

Definition at line 99 of file giaFx.c.

100{
101 Dec_Node_t * pFFNode;
102 int i, Lit;
103 // assign fanins
104 Dec_GraphForEachLeaf( pFForm, pFFNode, i )
105 {
106 assert( Vec_IntEntry(vLeaves, i) >= 0 );
107 pFFNode->iFunc = Vec_IntEntry(vLeaves, i);
108 }
109 // perform strashing
110 Lit = Gia_ManGraphToAig( p, pFForm );
111 return Lit;
112}
struct Dec_Node_t_ Dec_Node_t
Definition dec.h:49
#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
ITERATORS ///.
Definition dec.h:98
ABC_NAMESPACE_IMPL_START int Gia_ManGraphToAig(Gia_Man_t *p, Dec_Graph_t *pGraph)
DECLARATIONS ///.
Definition giaFx.c:50
int iFunc
Definition dec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFactorNode()

int Gia_ManFactorNode ( Gia_Man_t * p,
char * pSop,
Vec_Int_t * vLeaves )

Definition at line 113 of file giaFx.c.

114{
115 if ( Kit_PlaGetVarNum(pSop) == 0 )
116 return Abc_LitNotCond( 1, Kit_PlaIsConst0(pSop) );
117 assert( Kit_PlaGetVarNum(pSop) == Vec_IntSize(vLeaves) );
118 if ( Kit_PlaGetVarNum(pSop) > 2 && Kit_PlaGetCubeNum(pSop) > 1 )
119 {
120 Dec_Graph_t * pFForm = Dec_Factor( pSop );
121 int Lit = Gia_ManFactorGraph( p, pFForm, vLeaves );
122 Dec_GraphFree( pFForm );
123 return Lit;
124 }
125 return Gia_ManSopToAig( p, pSop, vLeaves );
126}
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition decFactor.c:58
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
int Gia_ManSopToAig(Gia_Man_t *p, char *pSop, Vec_Int_t *vLeaves)
Definition giaFx.c:70
int Gia_ManFactorGraph(Gia_Man_t *p, Dec_Graph_t *pFForm, Vec_Int_t *vLeaves)
Definition giaFx.c:99
int Kit_PlaGetVarNum(char *pSop)
Definition kitPla.c:118
int Kit_PlaGetCubeNum(char *pSop)
Definition kitPla.c:138
int Kit_PlaIsConst0(char *pSop)
DECLARATIONS ///.
Definition kitPla.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFxInsert()

Gia_Man_t * Gia_ManFxInsert ( Gia_Man_t * p,
Vec_Wec_t * vCubes,
Vec_Str_t * vCompls )

Definition at line 323 of file giaFx.c.

324{
325 Gia_Man_t * pNew, * pTemp;
326 Gia_Obj_t * pObj; Vec_Str_t * vSop;
327 Vec_Int_t * vOrder, * vFirst, * vCount, * vFanins, * vCover;
328 Vec_Int_t * vCopies, * vCube, * vMap;
329 int k, c, v, Lit, Var, iItem;
330// abctime clk = Abc_Clock();
331 // prepare the cubes
332 vOrder = Gia_ManFxTopoOrder( vCubes, Gia_ManCiNum(p), Vec_StrSize(vCompls), &vFirst, &vCount );
333 if ( vOrder == NULL )
334 return Gia_ManDup( p );
335 assert( Vec_IntSize(vOrder) > Vec_StrSize(vCompls) );
336 // create new manager
337 pNew = Gia_ManStart( Gia_ManObjNum(p) );
338 pNew->pName = Abc_UtilStrsav( p->pName );
339 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
340 pNew->vLevels = Vec_IntStart( 6*Gia_ManObjNum(p)/5 + 100 );
341 Gia_ManHashStart( pNew );
342 // create primary inputs
343 vMap = Vec_IntStartFull( Vec_IntSize(vOrder) );
344 vCopies = Vec_IntAlloc( Vec_IntSize(vOrder) );
345 Gia_ManForEachCi( p, pObj, k )
346 Vec_IntPush( vCopies, Gia_ManAppendCi(pNew) );
347 Vec_IntFillExtra( vCopies, Vec_IntSize(vOrder), -1 );
348 // add AIG nodes in the topological order
349 vSop = Vec_StrAlloc( 1000 );
350 vCover = Vec_IntAlloc( 1 << 16 );
351 vFanins = Vec_IntAlloc( 100 );
352 Vec_IntForEachEntryStart( vOrder, iItem, k, Gia_ManCiNum(p) )
353 {
354 int iFirst = Vec_IntEntry( vFirst, iItem );
355 int nCubes = Vec_IntEntry( vCount, iItem );
356 // collect fanins
357 Vec_IntClear( vFanins );
358 for ( c = 0; c < nCubes; c++ )
359 {
360 vCube = Vec_WecEntry( vCubes, iFirst + c );
361 Vec_IntForEachEntryStart( vCube, Lit, v, 1 )
362 if ( Vec_IntEntry(vMap, Abc_Lit2Var(Lit)) == -1 )
363 {
364 Vec_IntWriteEntry( vMap, Abc_Lit2Var(Lit), Vec_IntSize(vFanins) );
365 Vec_IntPush( vFanins, Abc_Lit2Var(Lit) );
366 }
367 }
368 if ( Vec_IntSize(vFanins) > 6 )
369 {
370 // create SOP
371 Vec_StrClear( vSop );
372 for ( c = 0; c < nCubes; c++ )
373 {
374 for ( v = 0; v < Vec_IntSize(vFanins); v++ )
375 Vec_StrPush( vSop, '-' );
376 vCube = Vec_WecEntry( vCubes, iFirst + c );
377 Vec_IntForEachEntryStart( vCube, Lit, v, 1 )
378 {
379 Lit = Abc_Lit2LitV( Vec_IntArray(vMap), Lit );
380 assert( Lit >= 0 && Abc_Lit2Var(Lit) < Vec_IntSize(vFanins) );
381 Vec_StrWriteEntry( vSop, Vec_StrSize(vSop) - Vec_IntSize(vFanins) + Abc_Lit2Var(Lit), (char)(Abc_LitIsCompl(Lit)? '0' : '1') );
382 }
383 Vec_StrPush( vSop, ' ' );
384 Vec_StrPush( vSop, '1' );
385 Vec_StrPush( vSop, '\n' );
386 }
387 Vec_StrPush( vSop, '\0' );
388 // collect fanins
389 Vec_IntForEachEntry( vFanins, Var, v )
390 {
391 Vec_IntWriteEntry( vMap, Var, -1 );
392 Vec_IntWriteEntry( vFanins, v, Vec_IntEntry(vCopies, Var) );
393 }
394 // derive new AIG
395 Lit = Gia_ManFactorNode( pNew, Vec_StrArray(vSop), vFanins );
396 }
397 else
398 {
399 word uTruth = 0, uCube;
400 for ( c = 0; c < nCubes; c++ )
401 {
402 uCube = ~(word)0;
403 vCube = Vec_WecEntry( vCubes, iFirst + c );
404 Vec_IntForEachEntryStart( vCube, Lit, v, 1 )
405 {
406 Lit = Abc_Lit2LitV( Vec_IntArray(vMap), Lit );
407 assert( Lit >= 0 && Abc_Lit2Var(Lit) < Vec_IntSize(vFanins) );
408 uCube &= Abc_LitIsCompl(Lit) ? ~s_Truths6[Abc_Lit2Var(Lit)] : s_Truths6[Abc_Lit2Var(Lit)];
409 }
410 uTruth |= uCube;
411 }
412 // complement constant
413 if ( uTruth == 0 )
414 uTruth = ~uTruth;
415 // collect fanins
416 Vec_IntForEachEntry( vFanins, Var, v )
417 {
418 Vec_IntWriteEntry( vMap, Var, -1 );
419 Vec_IntWriteEntry( vFanins, v, Vec_IntEntry(vCopies, Var) );
420 }
421 // create truth table
422 Lit = Dsm_ManTruthToGia( pNew, &uTruth, vFanins, vCover );
423 }
424 // complement if the original SOP was complemented
425 Lit = Abc_LitNotCond( Lit, (iItem < Vec_StrSize(vCompls)) && (Vec_StrEntry(vCompls, iItem) > 0) );
426 // remeber this literal
427 assert( Vec_IntEntry(vCopies, iItem) == -1 );
428 Vec_IntWriteEntry( vCopies, iItem, Lit );
429 }
430 Gia_ManHashStop( pNew );
431 // create primary outputs
432 Gia_ManForEachCo( p, pObj, k )
433 {
434 Lit = Gia_ObjFaninId0p(p, pObj) ? Vec_IntEntry(vCopies, Gia_ObjFanin0(pObj)->Value) : 0;
435 Gia_ManAppendCo( pNew, Abc_LitNotCond( Lit, Gia_ObjFaninC0(pObj) ) );
436 }
437 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
438 // cleanup
439 Vec_IntFree( vOrder );
440 Vec_IntFree( vFirst );
441 Vec_IntFree( vCount );
442 Vec_IntFree( vFanins );
443 Vec_IntFree( vCopies );
444 Vec_IntFree( vMap );
445 Vec_StrFree( vSop );
446 Vec_IntFree( vCover );
447 // remove dangling nodes
448 pNew = Gia_ManCleanup( pTemp = pNew );
449 Gia_ManStop( pTemp );
450// Abc_PrintTime( 1, "Setdn time", Abc_Clock() - clk );
451 return pNew;
452}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
int Dsm_ManTruthToGia(void *p, word *pTruth, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
Definition dauGia.c:441
int Var
Definition exorList.c:228
Vec_Int_t * Gia_ManFxTopoOrder(Vec_Wec_t *vCubes, int nInputs, int nStart, Vec_Int_t **pvFirst, Vec_Int_t **pvCount)
Definition giaFx.c:283
int Gia_ManFactorNode(Gia_Man_t *p, char *pSop, Vec_Int_t *vLeaves)
Definition giaFx.c:113
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
if(last==0)
Definition sparse_int.h:34
Vec_Int_t * vLevels
Definition gia.h:120
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFxRetrieve()

Vec_Wec_t * Gia_ManFxRetrieve ( Gia_Man_t * p,
Vec_Str_t ** pvCompl,
int fReverse )

Definition at line 197 of file giaFx.c.

198{
199 Vec_Wec_t * vCubes;
200 Vec_Wrd_t * vTruths;
201 Vec_Int_t * vCube, * vCover;
202 int nItems, nCutSize, nWords;
203 int i, c, v, Lit, Cube, Counter = 0;
204// abctime clk = Abc_Clock();
205 nItems = Gia_ManAssignNumbers( p );
206 // compute truth tables
207 nCutSize = Gia_ManLutSizeMax( p );
208 nWords = Abc_Truth6WordNum( nCutSize );
209 vTruths = Gia_ManComputeTruths( p, nCutSize, nItems - Gia_ManCiNum(p), fReverse );
210 vCover = Vec_IntAlloc( 1 << 16 );
211 // collect cubes
212 vCubes = Vec_WecAlloc( 1000 );
213 *pvCompl = Vec_StrStart( nItems );
214 Gia_ManForEachLut( p, i )
215 {
216 Gia_Obj_t * pObj = Gia_ManObj( p, i );
217 int nVars = Gia_ObjLutSize( p, i );
218 int * pVars = Gia_ObjLutFanins( p, i );
219 word * pTruth = Vec_WrdEntryP( vTruths, Counter++ * nWords );
220 Abc_TtFlipVar5( pTruth, nVars );
221 int Status = Kit_TruthIsop( (unsigned *)pTruth, nVars, vCover, 1 );
222 Abc_TtFlipVar5( pTruth, nVars );
223 if ( Vec_IntSize(vCover) == 0 || (Vec_IntSize(vCover) == 1 && Vec_IntEntry(vCover,0) == 0) )
224 {
225 Vec_StrWriteEntry( *pvCompl, pObj->Value, (char)(Vec_IntSize(vCover) == 0) );
226 vCube = Vec_WecPushLevel( vCubes );
227 Vec_IntPush( vCube, pObj->Value );
228 continue;
229 }
230 Vec_StrWriteEntry( *pvCompl, pObj->Value, (char)Status );
231 Vec_IntForEachEntry( vCover, Cube, c )
232 {
233 vCube = Vec_WecPushLevel( vCubes );
234 Vec_IntPush( vCube, pObj->Value );
235 for ( v = 0; v < nVars; v++ )
236 {
237 Lit = 3 & (Cube >> (v << 1));
238 if ( Lit == 1 )
239 Vec_IntPush( vCube, Abc_Var2Lit(Gia_ManObj(p, pVars[v])->Value, 1) );
240 else if ( Lit == 2 )
241 Vec_IntPush( vCube, Abc_Var2Lit(Gia_ManObj(p, pVars[v])->Value, 0) );
242 else if ( Lit != 0 )
243 assert( 0 );
244 }
245 Vec_IntSelectSort( Vec_IntArray(vCube) + 1, Vec_IntSize(vCube) - 1 );
246 }
247 }
248 assert( Counter * nWords == Vec_WrdSize(vTruths) );
249 Vec_WrdFree( vTruths );
250 Vec_IntFree( vCover );
251// Abc_PrintTime( 1, "Setup time", Abc_Clock() - clk );
252 return vCubes;
253}
struct cube Cube
int Gia_ManAssignNumbers(Gia_Man_t *p)
Definition giaFx.c:186
Vec_Wrd_t * Gia_ManComputeTruths(Gia_Man_t *p, int nCutSize, int nLutNum, int fReverse)
Definition giaFx.c:139
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition giaIf.c:127
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
Definition kitIsop.c:134
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFxTopoOrder()

Vec_Int_t * Gia_ManFxTopoOrder ( Vec_Wec_t * vCubes,
int nInputs,
int nStart,
Vec_Int_t ** pvFirst,
Vec_Int_t ** pvCount )

Definition at line 283 of file giaFx.c.

284{
285 Vec_Int_t * vOrder, * vFirst, * vCount, * vVisit, * vCube;
286 int i, iFanin, nNodeMax = -1;
287 // find the largest index
288 Vec_WecForEachLevel( vCubes, vCube, i )
289 nNodeMax = Abc_MaxInt( nNodeMax, Vec_IntEntry(vCube, 0) );
290 nNodeMax++;
291 // quit if there is no new nodes
292 if ( nNodeMax == nStart )
293 {
294 //printf( "The network is unchanged by fast extract.\n" );
295 return NULL;
296 }
297 // find first cube and how many cubes
298 vFirst = Vec_IntStart( nNodeMax );
299 vCount = Vec_IntStart( nNodeMax );
300 Vec_WecForEachLevel( vCubes, vCube, i )
301 {
302 iFanin = Vec_IntEntry( vCube, 0 );
303 assert( iFanin >= nInputs );
304 if ( Vec_IntEntry(vCount, iFanin) == 0 )
305 Vec_IntWriteEntry( vFirst, iFanin, i );
306 Vec_IntAddToEntry( vCount, iFanin, 1 );
307 }
308 // put all of them in a topo order
309 vOrder = Vec_IntStart( nInputs );
310 vVisit = Vec_IntStart( nNodeMax );
311 for ( i = 0; i < nInputs; i++ )
312 Vec_IntWriteEntry( vVisit, i, 1 );
313 for ( i = nInputs; i < nNodeMax; i++ )
314 if ( !Vec_IntEntry( vVisit, i ) )
315 Gia_ManFxTopoOrder_rec( vCubes, vFirst, vCount, vVisit, vOrder, i );
316 assert( Vec_IntSize(vOrder) == nNodeMax );
317 Vec_IntFree( vVisit );
318 // return topological order of new nodes
319 *pvFirst = vFirst;
320 *pvCount = vCount;
321 return vOrder;
322}
void Gia_ManFxTopoOrder_rec(Vec_Wec_t *vCubes, Vec_Int_t *vFirst, Vec_Int_t *vCount, Vec_Int_t *vVisit, Vec_Int_t *vOrder, int iObj)
Definition giaFx.c:266
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFxTopoOrder_rec()

void Gia_ManFxTopoOrder_rec ( Vec_Wec_t * vCubes,
Vec_Int_t * vFirst,
Vec_Int_t * vCount,
Vec_Int_t * vVisit,
Vec_Int_t * vOrder,
int iObj )

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

Synopsis [Generates GIA after factoring the resulting SOPs.]

Description []

SideEffects []

SeeAlso []

Definition at line 266 of file giaFx.c.

267{
268 int c, v, Lit;
269 int iFirst = Vec_IntEntry( vFirst, iObj );
270 int nCubes = Vec_IntEntry( vCount, iObj );
271 assert( !Vec_IntEntry( vVisit, iObj ) );
272 Vec_IntWriteEntry( vVisit, iObj, 1 );
273 for ( c = 0; c < nCubes; c++ )
274 {
275 Vec_Int_t * vCube = Vec_WecEntry( vCubes, iFirst + c );
276 assert( Vec_IntEntry(vCube, 0) == iObj );
277 Vec_IntForEachEntryStart( vCube, Lit, v, 1 )
278 if ( !Vec_IntEntry( vVisit, Abc_Lit2Var(Lit) ) )
279 Gia_ManFxTopoOrder_rec( vCubes, vFirst, vCount, vVisit, vOrder, Abc_Lit2Var(Lit) );
280 }
281 Vec_IntPush( vOrder, iObj );
282}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManGraphToAig()

ABC_NAMESPACE_IMPL_START int Gia_ManGraphToAig ( Gia_Man_t * p,
Dec_Graph_t * pGraph )

DECLARATIONS ///.

CFile****************************************************************

FileName [giaFx.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Interface to fast_extract package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
giaFx.c,v 1.00 2013/09/29 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Create GIA for SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file giaFx.c.

51{
52 Dec_Node_t * pNode = NULL; // Suppress "might be used uninitialized"
53 int i, iAnd0, iAnd1;
54 // check for constant function
55 if ( Dec_GraphIsConst(pGraph) )
56 return Abc_LitNotCond( 1, Dec_GraphIsComplement(pGraph) );
57 // check for a literal
58 if ( Dec_GraphIsVar(pGraph) )
59 return Abc_LitNotCond( Dec_GraphVar(pGraph)->iFunc, Dec_GraphIsComplement(pGraph) );
60 // build the AIG nodes corresponding to the AND gates of the graph
61 Dec_GraphForEachNode( pGraph, pNode, i )
62 {
63 iAnd0 = Abc_LitNotCond( Dec_GraphNode(pGraph, pNode->eEdge0.Node)->iFunc, pNode->eEdge0.fCompl );
64 iAnd1 = Abc_LitNotCond( Dec_GraphNode(pGraph, pNode->eEdge1.Node)->iFunc, pNode->eEdge1.fCompl );
65 pNode->iFunc = Gia_ManHashAnd( p, iAnd0, iAnd1 );
66 }
67 // complement the result if necessary
68 return Abc_LitNotCond( pNode->iFunc, Dec_GraphIsComplement(pGraph) );
69}
#define Dec_GraphForEachNode(pGraph, pAnd, i)
Definition dec.h:101
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
Dec_Edge_t eEdge1
Definition dec.h:53
Dec_Edge_t eEdge0
Definition dec.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManPerformFx()

Gia_Man_t * Gia_ManPerformFx ( Gia_Man_t * p,
int nNewNodesMax,
int LitCountMax,
int fReverse,
int fVerbose,
int fVeryVerbose )

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

Synopsis [Performs classical fast_extract on logic functions.]

Description []

SideEffects [Sorts the fanins of each cut in the increasing order.]

SeeAlso []

Definition at line 465 of file giaFx.c.

466{
467 extern int Fx_FastExtract( Vec_Wec_t * vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose );
468 Gia_Man_t * pNew = NULL;
469 Vec_Wec_t * vCubes;
470 Vec_Str_t * vCompl;
471 if ( Gia_ManAndNum(p) == 0 )
472 {
473 pNew = Gia_ManDup(p);
474 Gia_ManTransferTiming( pNew, p );
475 return pNew;
476 }
477// abctime clk;
478 assert( Gia_ManHasMapping(p) );
479 // collect information
480 vCubes = Gia_ManFxRetrieve( p, &vCompl, fReverse );
481 // call the fast extract procedure
482// clk = Abc_Clock();
483 Fx_FastExtract( vCubes, Vec_StrSize(vCompl), nNewNodesMax, LitCountMax, 0, fVerbose, fVeryVerbose );
484// Abc_PrintTime( 1, "Fx runtime", Abc_Clock() - clk );
485 // insert information
486 pNew = Gia_ManFxInsert( p, vCubes, vCompl );
487 Gia_ManTransferTiming( pNew, p );
488 // cleanup
489 Vec_WecFree( vCubes );
490 Vec_StrFree( vCompl );
491 return pNew;
492}
int Fx_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nNewNodesMax, int LitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose)
Definition abcFx.c:1166
Gia_Man_t * Gia_ManFxInsert(Gia_Man_t *p, Vec_Wec_t *vCubes, Vec_Str_t *vCompls)
Definition giaFx.c:323
Vec_Wec_t * Gia_ManFxRetrieve(Gia_Man_t *p, Vec_Str_t **pvCompl, int fReverse)
Definition giaFx.c:197
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSopToAig()

int Gia_ManSopToAig ( Gia_Man_t * p,
char * pSop,
Vec_Int_t * vLeaves )

Definition at line 70 of file giaFx.c.

71{
72 int i, iAnd, iSum, Value, nFanins;
73 char * pCube;
74 // get the number of variables
75 nFanins = Kit_PlaGetVarNum(pSop);
76 // go through the cubes of the node's SOP
77 iSum = 0;
78 Kit_PlaForEachCube( pSop, nFanins, pCube )
79 {
80 // create the AND of literals
81 iAnd = 1;
82 Kit_PlaCubeForEachVar( pCube, Value, i )
83 {
84 assert( Vec_IntEntry(vLeaves, i) >= 0 );
85 if ( Value == '1' )
86 iAnd = Gia_ManHashAnd( p, iAnd, Vec_IntEntry(vLeaves, i) );
87 else if ( Value == '0' )
88 iAnd = Gia_ManHashAnd( p, iAnd, Abc_LitNot(Vec_IntEntry(vLeaves, i)) );
89 else assert( Value == '-' );
90 }
91 // add to the sum of cubes
92 iSum = Gia_ManHashOr( p, iSum, iAnd );
93 }
94 // decide whether to complement the result
95 if ( Kit_PlaIsComplement(pSop) )
96 iSum = Abc_LitNot(iSum);
97 return iSum;
98}
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:621
#define Kit_PlaForEachCube(pSop, nFanins, pCube)
Definition kit.h:165
int Kit_PlaIsComplement(char *pSop)
Definition kitPla.c:160
#define Kit_PlaCubeForEachVar(pCube, Value, i)
Definition kit.h:167
Here is the call graph for this function:
Here is the caller graph for this function: