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

Go to the source code of this file.

Classes

struct  Abc_Aig_t_
 DECLARATIONS ///. More...
 

Macros

#define Abc_AigBinForEachEntry(pBin, pEnt)
 
#define Abc_AigBinForEachEntrySafe(pBin, pEnt, pEnt2)
 

Functions

Abc_Aig_tAbc_AigAlloc (Abc_Ntk_t *pNtkAig)
 FUNCTION DEFINITIONS ///.
 
void Abc_AigFree (Abc_Aig_t *pMan)
 
int Abc_AigCleanup (Abc_Aig_t *pMan)
 
int Abc_AigCheck (Abc_Aig_t *pMan)
 
int Abc_AigLevel (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_AigAndLookup (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
Abc_Obj_tAbc_AigXorLookup (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1, int *pType)
 
Abc_Obj_tAbc_AigMuxLookup (Abc_Aig_t *pMan, Abc_Obj_t *pC, Abc_Obj_t *pT, Abc_Obj_t *pE, int *pType)
 
void Abc_AigRehash (Abc_Aig_t *pMan)
 
Abc_Obj_tAbc_AigConst1 (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_AigAnd (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
Abc_Obj_tAbc_AigOr (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
Abc_Obj_tAbc_AigXor (Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
 
Abc_Obj_tAbc_AigMux (Abc_Aig_t *pMan, Abc_Obj_t *pC, Abc_Obj_t *p1, Abc_Obj_t *p0)
 
Abc_Obj_tAbc_AigMiter_rec (Abc_Aig_t *pMan, Abc_Obj_t **ppObjs, int nObjs)
 
Abc_Obj_tAbc_AigMiter (Abc_Aig_t *pMan, Vec_Ptr_t *vPairs, int fImplic)
 
Abc_Obj_tAbc_AigMiter2 (Abc_Aig_t *pMan, Vec_Ptr_t *vPairs)
 
int Abc_AigReplace (Abc_Aig_t *pMan, Abc_Obj_t *pOld, Abc_Obj_t *pNew, int fUpdateLevel)
 
void Abc_AigDeleteNode (Abc_Aig_t *pMan, Abc_Obj_t *pNode)
 
int Abc_AigNodeHasComplFanoutEdge (Abc_Obj_t *pNode)
 
int Abc_AigNodeHasComplFanoutEdgeTrav (Abc_Obj_t *pNode)
 
void Abc_AigPrintNode (Abc_Obj_t *pNode)
 
int Abc_AigNodeIsAcyclic (Abc_Obj_t *pNode, Abc_Obj_t *pRoot)
 
void Abc_AigCheckFaninOrder (Abc_Aig_t *pMan)
 
void Abc_AigSetNodePhases (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tAbc_AigUpdateStart (Abc_Aig_t *pMan, Vec_Ptr_t **pvUpdatedNets)
 
void Abc_AigUpdateStop (Abc_Aig_t *pMan)
 
void Abc_AigUpdateReset (Abc_Aig_t *pMan)
 
int Abc_AigCountNext (Abc_Aig_t *pMan)
 
void Abc_NtkHelloWorld (Abc_Ntk_t *pNtk)
 END OF FILE ///.
 

Macro Definition Documentation

◆ Abc_AigBinForEachEntry

#define Abc_AigBinForEachEntry ( pBin,
pEnt )
Value:
for ( pEnt = pBin; \
pEnt; \
pEnt = pEnt->pNext )

Definition at line 74 of file abcAig.c.

74#define Abc_AigBinForEachEntry( pBin, pEnt ) \
75 for ( pEnt = pBin; \
76 pEnt; \
77 pEnt = pEnt->pNext )

◆ Abc_AigBinForEachEntrySafe

#define Abc_AigBinForEachEntrySafe ( pBin,
pEnt,
pEnt2 )
Value:
for ( pEnt = pBin, \
pEnt2 = pEnt? pEnt->pNext: NULL; \
pEnt; \
pEnt = pEnt2, \
pEnt2 = pEnt? pEnt->pNext: NULL )

Definition at line 78 of file abcAig.c.

78#define Abc_AigBinForEachEntrySafe( pBin, pEnt, pEnt2 ) \
79 for ( pEnt = pBin, \
80 pEnt2 = pEnt? pEnt->pNext: NULL; \
81 pEnt; \
82 pEnt = pEnt2, \
83 pEnt2 = pEnt? pEnt->pNext: NULL )

Function Documentation

◆ Abc_AigAlloc()

Abc_Aig_t * Abc_AigAlloc ( Abc_Ntk_t * pNtkAig)

FUNCTION DEFINITIONS ///.

FUNCTION DECLARATIONS ///.

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

Synopsis [Allocates the local AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file abcAig.c.

129{
130 Abc_Aig_t * pMan;
131 // start the manager
132 pMan = ABC_ALLOC( Abc_Aig_t, 1 );
133 memset( pMan, 0, sizeof(Abc_Aig_t) );
134 // allocate the table
135 pMan->nBins = Abc_PrimeCudd( 10000 );
136 pMan->pBins = ABC_ALLOC( Abc_Obj_t *, pMan->nBins );
137 memset( pMan->pBins, 0, sizeof(Abc_Obj_t *) * pMan->nBins );
138 pMan->vNodes = Vec_PtrAlloc( 100 );
139 pMan->vLevels = Vec_VecAlloc( 100 );
140 pMan->vLevelsR = Vec_VecAlloc( 100 );
141 pMan->vStackReplaceOld = Vec_PtrAlloc( 100 );
142 pMan->vStackReplaceNew = Vec_PtrAlloc( 100 );
143 // create the constant node
144 assert( pNtkAig->vObjs->nSize == 0 );
145 pMan->pConst1 = Abc_NtkCreateObj( pNtkAig, ABC_OBJ_NODE );
146 pMan->pConst1->Type = ABC_OBJ_CONST1;
147 pMan->pConst1->fPhase = 1;
148 pNtkAig->nObjCounts[ABC_OBJ_NODE]--;
149 // save the current network
150 pMan->pNtkAig = pNtkAig;
151 return pMan;
152}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
@ ABC_OBJ_NODE
Definition abc.h:94
@ ABC_OBJ_CONST1
Definition abc.h:88
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
ABC_DLL Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition abcObj.c:109
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Vec_Vec_t * vLevels
Definition abcAig.c:62
Abc_Ntk_t * pNtkAig
Definition abcAig.c:54
Vec_Ptr_t * vStackReplaceOld
Definition abcAig.c:60
int nBins
Definition abcAig.c:57
Vec_Vec_t * vLevelsR
Definition abcAig.c:63
Vec_Ptr_t * vNodes
Definition abcAig.c:59
Abc_Obj_t ** pBins
Definition abcAig.c:56
Abc_Obj_t * pConst1
Definition abcAig.c:55
Vec_Ptr_t * vStackReplaceNew
Definition abcAig.c:61
int nObjCounts[ABC_OBJ_NUMBER]
Definition abc.h:171
Vec_Ptr_t * vObjs
Definition abc.h:162
unsigned Type
Definition abc.h:133
unsigned fPhase
Definition abc.h:137
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigAnd()

Abc_Obj_t * Abc_AigAnd ( Abc_Aig_t * pMan,
Abc_Obj_t * p0,
Abc_Obj_t * p1 )

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 700 of file abcAig.c.

701{
702 Abc_Obj_t * pAnd;
703 if ( (pAnd = Abc_AigAndLookup( pMan, p0, p1 )) )
704 return pAnd;
705 return Abc_AigAndCreate( pMan, p0, p1 );
706}
Abc_Obj_t * Abc_AigAndLookup(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:403
Here is the call graph for this function:

◆ Abc_AigAndLookup()

Abc_Obj_t * Abc_AigAndLookup ( Abc_Aig_t * pMan,
Abc_Obj_t * p0,
Abc_Obj_t * p1 )

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 403 of file abcAig.c.

404{
405 Abc_Obj_t * pAnd, * pConst1;
406 unsigned Key;
407 assert( Abc_ObjRegular(p0)->pNtk->pManFunc == pMan );
408 assert( Abc_ObjRegular(p1)->pNtk->pManFunc == pMan );
409 // check for trivial cases
410 pConst1 = Abc_AigConst1(pMan->pNtkAig);
411 if ( p0 == p1 )
412 return p0;
413 if ( p0 == Abc_ObjNot(p1) )
414 return Abc_ObjNot(pConst1);
415 if ( Abc_ObjRegular(p0) == pConst1 )
416 {
417 if ( p0 == pConst1 )
418 return p1;
419 return Abc_ObjNot(pConst1);
420 }
421 if ( Abc_ObjRegular(p1) == pConst1 )
422 {
423 if ( p1 == pConst1 )
424 return p0;
425 return Abc_ObjNot(pConst1);
426 }
427/*
428 {
429 int nFans0 = Abc_ObjFanoutNum( Abc_ObjRegular(p0) );
430 int nFans1 = Abc_ObjFanoutNum( Abc_ObjRegular(p1) );
431 if ( nFans0 == 0 || nFans1 == 0 )
432 pMan->nStrash0++;
433 else if ( nFans0 == 1 || nFans1 == 1 )
434 pMan->nStrash1++;
435 else if ( nFans0 <= 100 && nFans1 <= 100 )
436 pMan->nStrash5++;
437 else
438 pMan->nStrash2++;
439 }
440*/
441 {
442 int nFans0 = Abc_ObjFanoutNum( Abc_ObjRegular(p0) );
443 int nFans1 = Abc_ObjFanoutNum( Abc_ObjRegular(p1) );
444 if ( nFans0 == 0 || nFans1 == 0 )
445 return NULL;
446 }
447
448 // order the arguments
449 if ( Abc_ObjRegular(p0)->Id > Abc_ObjRegular(p1)->Id )
450 pAnd = p0, p0 = p1, p1 = pAnd;
451 // get the hash key for these two nodes
452 Key = Abc_HashKey2( p0, p1, pMan->nBins );
453 // find the matching node in the table
454 Abc_AigBinForEachEntry( pMan->pBins[Key], pAnd )
455 if ( p0 == Abc_ObjChild0(pAnd) && p1 == Abc_ObjChild1(pAnd) )
456 {
457// assert( Abc_ObjFanoutNum(Abc_ObjRegular(p0)) && Abc_ObjFanoutNum(p1) );
458 return pAnd;
459 }
460 return NULL;
461}
Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
#define Abc_AigBinForEachEntry(pBin, pEnt)
Definition abcAig.c:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigCheck()

int Abc_AigCheck ( Abc_Aig_t * pMan)

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

Synopsis [Makes sure that every node in the table is in the network and vice versa.]

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file abcAig.c.

227{
228 Abc_Obj_t * pObj, * pAnd;
229 int i, nFanins, Counter;
230 Abc_NtkForEachNode( pMan->pNtkAig, pObj, i )
231 {
232 nFanins = Abc_ObjFaninNum(pObj);
233 if ( nFanins == 0 )
234 {
235 if ( !Abc_AigNodeIsConst(pObj) )
236 {
237 printf( "Abc_AigCheck: The AIG has non-standard constant nodes.\n" );
238 return 0;
239 }
240 continue;
241 }
242 if ( nFanins == 1 )
243 {
244 printf( "Abc_AigCheck: The AIG has single input nodes.\n" );
245 return 0;
246 }
247 if ( nFanins > 2 )
248 {
249 printf( "Abc_AigCheck: The AIG has non-standard nodes.\n" );
250 return 0;
251 }
252 if ( pObj->Level != 1 + (unsigned)Abc_MaxInt( Abc_ObjFanin0(pObj)->Level, Abc_ObjFanin1(pObj)->Level ) )
253 printf( "Abc_AigCheck: Node \"%s\" has level that does not agree with the fanin levels.\n", Abc_ObjName(pObj) );
254 pAnd = Abc_AigAndLookup( pMan, Abc_ObjChild0(pObj), Abc_ObjChild1(pObj) );
255 if ( pAnd != pObj )
256 printf( "Abc_AigCheck: Node \"%s\" is not in the structural hashing table.\n", Abc_ObjName(pObj) );
257 }
258 // count the number of nodes in the table
259 Counter = 0;
260 for ( i = 0; i < pMan->nBins; i++ )
261 Abc_AigBinForEachEntry( pMan->pBins[i], pAnd )
262 Counter++;
263 if ( Counter != Abc_NtkNodeNum(pMan->pNtkAig) )
264 {
265 printf( "Abc_AigCheck: The number of nodes in the structural hashing table is wrong.\n" );
266 return 0;
267 }
268 // if the node is a choice node, nodes in its class should not have fanouts
269 Abc_NtkForEachNode( pMan->pNtkAig, pObj, i )
270 if ( Abc_AigNodeIsChoice(pObj) )
271 for ( pAnd = (Abc_Obj_t *)pObj->pData; pAnd; pAnd = (Abc_Obj_t *)pAnd->pData )
272 if ( Abc_ObjFanoutNum(pAnd) > 0 )
273 {
274 printf( "Abc_AigCheck: Representative %s", Abc_ObjName(pAnd) );
275 printf( " of choice node %s has %d fanouts.\n", Abc_ObjName(pObj), Abc_ObjFanoutNum(pAnd) );
276 return 0;
277 }
278 return 1;
279}
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
void * pData
Definition abc.h:145
unsigned Level
Definition abc.h:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigCheckFaninOrder()

void Abc_AigCheckFaninOrder ( Abc_Aig_t * pMan)

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

Synopsis [Resizes the hash table of AIG nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1379 of file abcAig.c.

1380{
1381 Abc_Obj_t * pEnt;
1382 int i;
1383 for ( i = 0; i < pMan->nBins; i++ )
1384 Abc_AigBinForEachEntry( pMan->pBins[i], pEnt )
1385 {
1386 if ( Abc_ObjRegular(Abc_ObjChild0(pEnt))->Id > Abc_ObjRegular(Abc_ObjChild1(pEnt))->Id )
1387 {
1388// int i0 = Abc_ObjRegular(Abc_ObjChild0(pEnt))->Id;
1389// int i1 = Abc_ObjRegular(Abc_ObjChild1(pEnt))->Id;
1390 printf( "Node %d has incorrect ordering of fanins.\n", pEnt->Id );
1391 }
1392 }
1393}
int Id
Definition abc.h:132

◆ Abc_AigCleanup()

int Abc_AigCleanup ( Abc_Aig_t * pMan)

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcAig.c.

195{
196 Vec_Ptr_t * vDangles;
197 Abc_Obj_t * pAnd;
198 int i, nNodesOld;
199// printf( "Strash0 = %d. Strash1 = %d. Strash100 = %d. StrashM = %d.\n",
200// pMan->nStrash0, pMan->nStrash1, pMan->nStrash5, pMan->nStrash2 );
201 nNodesOld = pMan->nEntries;
202 // collect the AND nodes that do not fanout
203 vDangles = Vec_PtrAlloc( 100 );
204 for ( i = 0; i < pMan->nBins; i++ )
205 Abc_AigBinForEachEntry( pMan->pBins[i], pAnd )
206 if ( Abc_ObjFanoutNum(pAnd) == 0 )
207 Vec_PtrPush( vDangles, pAnd );
208 // process the dangling nodes and their MFFCs
209 Vec_PtrForEachEntry( Abc_Obj_t *, vDangles, pAnd, i )
210 Abc_AigDeleteNode( pMan, pAnd );
211 Vec_PtrFree( vDangles );
212 return nNodesOld - pMan->nEntries;
213}
void Abc_AigDeleteNode(Abc_Aig_t *pMan, Abc_Obj_t *pNode)
Definition abcAig.c:989
int nEntries
Definition abcAig.c:58
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigConst1()

Abc_Obj_t * Abc_AigConst1 ( Abc_Ntk_t * pNtk)

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 683 of file abcAig.c.

684{
685 assert( Abc_NtkIsStrash(pNtk) );
686 return ((Abc_Aig_t *)pNtk->pManFunc)->pConst1;
687}
void * pManFunc
Definition abc.h:191

◆ Abc_AigCountNext()

int Abc_AigCountNext ( Abc_Aig_t * pMan)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1495 of file abcAig.c.

1496{
1497 Abc_Obj_t * pAnd;
1498 int i, Counter = 0, CounterTotal = 0;
1499 // count how many nodes have pNext set
1500 for ( i = 0; i < pMan->nBins; i++ )
1501 Abc_AigBinForEachEntry( pMan->pBins[i], pAnd )
1502 {
1503 Counter += (pAnd->pNext != NULL);
1504 CounterTotal++;
1505 }
1506 printf( "Counter = %d. Nodes = %d. Ave = %6.2f\n", Counter, CounterTotal, 1.0 * CounterTotal/pMan->nBins );
1507 return Counter;
1508}
Abc_Obj_t * pNext
Definition abc.h:131

◆ Abc_AigDeleteNode()

void Abc_AigDeleteNode ( Abc_Aig_t * pMan,
Abc_Obj_t * pNode )

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

Synopsis [Performs internal deletion step.]

Description []

SideEffects []

SeeAlso []

Definition at line 989 of file abcAig.c.

990{
991 Abc_Obj_t * pNode0, * pNode1, * pTemp;
992 int i, k;
993
994 // make sure the node is regular and dangling
995 assert( !Abc_ObjIsComplement(pNode) );
996 assert( Abc_ObjIsNode(pNode) );
997 assert( Abc_ObjFaninNum(pNode) == 2 );
998 assert( Abc_ObjFanoutNum(pNode) == 0 );
999
1000 // when deleting an old node that is scheduled for replacement, remove it from the replacement queue
1001 Vec_PtrForEachEntry( Abc_Obj_t *, pMan->vStackReplaceOld, pTemp, i )
1002 if ( pNode == pTemp )
1003 {
1004 // remove the entry from the replacement array
1005 for ( k = i; k < pMan->vStackReplaceOld->nSize - 1; k++ )
1006 {
1007 pMan->vStackReplaceOld->pArray[k] = pMan->vStackReplaceOld->pArray[k+1];
1008 pMan->vStackReplaceNew->pArray[k] = pMan->vStackReplaceNew->pArray[k+1];
1009 }
1010 pMan->vStackReplaceOld->nSize--;
1011 pMan->vStackReplaceNew->nSize--;
1012 }
1013
1014 // when deleting a new node that should replace another node, do not delete
1015 Vec_PtrForEachEntry( Abc_Obj_t *, pMan->vStackReplaceNew, pTemp, i )
1016 if ( pNode == Abc_ObjRegular(pTemp) )
1017 return;
1018
1019 // remember the node's fanins
1020 pNode0 = Abc_ObjFanin0( pNode );
1021 pNode1 = Abc_ObjFanin1( pNode );
1022
1023 // add the node to the list of updated nodes
1024 if ( pMan->vUpdatedNets )
1025 {
1026 Vec_PtrPushUnique( pMan->vUpdatedNets, pNode0 );
1027 Vec_PtrPushUnique( pMan->vUpdatedNets, pNode1 );
1028 }
1029
1030 // remove the node from the table
1031 Abc_AigAndDelete( pMan, pNode );
1032 // if the node is in the level structure, remove it
1033 if ( pNode->fMarkA )
1034 Abc_AigRemoveFromLevelStructure( pMan->vLevels, pNode );
1035 if ( pNode->fMarkB )
1036 Abc_AigRemoveFromLevelStructureR( pMan->vLevelsR, pNode );
1037 // remove the node from the network
1038 Abc_NtkDeleteObj( pNode );
1039
1040 // call recursively for the fanins
1041 if ( Abc_ObjIsNode(pNode0) && pNode0->vFanouts.nSize == 0 )
1042 Abc_AigDeleteNode( pMan, pNode0 );
1043 if ( Abc_ObjIsNode(pNode1) && pNode1->vFanouts.nSize == 0 )
1044 Abc_AigDeleteNode( pMan, pNode1 );
1045}
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
Vec_Ptr_t * vUpdatedNets
Definition abcAig.c:65
unsigned fMarkB
Definition abc.h:135
Vec_Int_t vFanouts
Definition abc.h:144
unsigned fMarkA
Definition abc.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigFree()

void Abc_AigFree ( Abc_Aig_t * pMan)

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

Synopsis [Deallocates the local AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file abcAig.c.

166{
167 assert( Vec_PtrSize( pMan->vStackReplaceOld ) == 0 );
168 assert( Vec_PtrSize( pMan->vStackReplaceNew ) == 0 );
169 // free the table
170 if ( pMan->vAddedCells )
171 Vec_PtrFree( pMan->vAddedCells );
172 if ( pMan->vUpdatedNets )
173 Vec_PtrFree( pMan->vUpdatedNets );
174 Vec_VecFree( pMan->vLevels );
175 Vec_VecFree( pMan->vLevelsR );
176 Vec_PtrFree( pMan->vStackReplaceOld );
177 Vec_PtrFree( pMan->vStackReplaceNew );
178 Vec_PtrFree( pMan->vNodes );
179 ABC_FREE( pMan->pBins );
180 ABC_FREE( pMan );
181}
#define ABC_FREE(obj)
Definition abc_global.h:267
Vec_Ptr_t * vAddedCells
Definition abcAig.c:64
Here is the caller graph for this function:

◆ Abc_AigLevel()

int Abc_AigLevel ( Abc_Ntk_t * pNtk)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 292 of file abcAig.c.

293{
294 Abc_Obj_t * pNode;
295 int i, LevelsMax;
296 assert( Abc_NtkIsStrash(pNtk) );
297 if ( pNtk->nBarBufs )
298 return Abc_NtkLevel( pNtk );
299 // perform the traversal
300 LevelsMax = 0;
301 Abc_NtkForEachCo( pNtk, pNode, i )
302 if ( LevelsMax < (int)Abc_ObjFanin0(pNode)->Level )
303 LevelsMax = (int)Abc_ObjFanin0(pNode)->Level;
304 return LevelsMax;
305}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
int nBarBufs
Definition abc.h:174
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigMiter()

Abc_Obj_t * Abc_AigMiter ( Abc_Aig_t * pMan,
Vec_Ptr_t * vPairs,
int fImplic )

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 789 of file abcAig.c.

790{
791 int i;
792 if ( vPairs->nSize == 0 )
793 return Abc_ObjNot( Abc_AigConst1(pMan->pNtkAig) );
794 assert( vPairs->nSize % 2 == 0 );
795 // go through the cubes of the node's SOP
796 if ( fImplic )
797 {
798 for ( i = 0; i < vPairs->nSize; i += 2 )
799 vPairs->pArray[i/2] = Abc_AigAnd( pMan, (Abc_Obj_t *)vPairs->pArray[i], Abc_ObjNot((Abc_Obj_t *)vPairs->pArray[i+1]) );
800 }
801 else
802 {
803 for ( i = 0; i < vPairs->nSize; i += 2 )
804 vPairs->pArray[i/2] = Abc_AigXor( pMan, (Abc_Obj_t *)vPairs->pArray[i], (Abc_Obj_t *)vPairs->pArray[i+1] );
805 }
806 vPairs->nSize = vPairs->nSize/2;
807 return Abc_AigMiter_rec( pMan, (Abc_Obj_t **)vPairs->pArray, vPairs->nSize );
808}
Abc_Obj_t * Abc_AigMiter_rec(Abc_Aig_t *pMan, Abc_Obj_t **ppObjs, int nObjs)
Definition abcAig.c:768
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:735
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigMiter2()

Abc_Obj_t * Abc_AigMiter2 ( Abc_Aig_t * pMan,
Vec_Ptr_t * vPairs )

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 821 of file abcAig.c.

822{
823 Abc_Obj_t * pMiter, * pXor;
824 int i;
825 assert( vPairs->nSize % 2 == 0 );
826 // go through the cubes of the node's SOP
827 pMiter = Abc_ObjNot( Abc_AigConst1(pMan->pNtkAig) );
828 for ( i = 0; i < vPairs->nSize; i += 2 )
829 {
830 pXor = Abc_AigXor( pMan, (Abc_Obj_t *)vPairs->pArray[i], (Abc_Obj_t *)vPairs->pArray[i+1] );
831 pMiter = Abc_AigOr( pMan, pMiter, pXor );
832 }
833 return pMiter;
834}
Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:719
Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:735
Here is the call graph for this function:

◆ Abc_AigMiter_rec()

Abc_Obj_t * Abc_AigMiter_rec ( Abc_Aig_t * pMan,
Abc_Obj_t ** ppObjs,
int nObjs )

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 768 of file abcAig.c.

769{
770 Abc_Obj_t * pObj1, * pObj2;
771 if ( nObjs == 1 )
772 return ppObjs[0];
773 pObj1 = Abc_AigMiter_rec( pMan, ppObjs, nObjs/2 );
774 pObj2 = Abc_AigMiter_rec( pMan, ppObjs + nObjs/2, nObjs - nObjs/2 );
775 return Abc_AigOr( pMan, pObj1, pObj2 );
776}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigMux()

Abc_Obj_t * Abc_AigMux ( Abc_Aig_t * pMan,
Abc_Obj_t * pC,
Abc_Obj_t * p1,
Abc_Obj_t * p0 )

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

Synopsis [Implements Boolean XOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file abcAig.c.

753{
754 return Abc_AigOr( pMan, Abc_AigAnd(pMan, pC, p1), Abc_AigAnd(pMan, Abc_ObjNot(pC), p0) );
755}
Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigMuxLookup()

Abc_Obj_t * Abc_AigMuxLookup ( Abc_Aig_t * pMan,
Abc_Obj_t * pC,
Abc_Obj_t * pT,
Abc_Obj_t * pE,
int * pType )

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

Synopsis [Returns the gate implementing EXOR of the two arguments if it exists.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 508 of file abcAig.c.

509{
510 Abc_Obj_t * pNode1, * pNode2, * pNode;
511 // set the flag to zero
512 if ( pType ) *pType = 0;
513 // check the case of MUX(c,t,e) = OR(ct', c'e')'
514 if ( (pNode1 = Abc_AigAndLookup(pMan, pC, Abc_ObjNot(pT))) &&
515 (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(pC), Abc_ObjNot(pE))) )
516 {
517 pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
518 if ( pNode && pType ) *pType = 1;
519 return pNode;
520 }
521 // check the case of MUX(c,t,e) = OR(ct, c'e)
522 if ( (pNode1 = Abc_AigAndLookup(pMan, pC, pT)) &&
523 (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(pC), pE)) )
524 {
525 pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
526 return pNode? Abc_ObjNot(pNode) : NULL;
527 }
528 return NULL;
529}
Here is the call graph for this function:

◆ Abc_AigNodeHasComplFanoutEdge()

int Abc_AigNodeHasComplFanoutEdge ( Abc_Obj_t * pNode)

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

Synopsis [Returns 1 if the node has at least one complemented fanout.]

Description [A fanout is complemented if the fanout's fanin edge pointing to the given node is complemented.]

SideEffects []

SeeAlso []

Definition at line 1241 of file abcAig.c.

1242{
1243 Abc_Obj_t * pFanout;
1244 int i, iFanin;
1245 Abc_ObjForEachFanout( pNode, pFanout, i )
1246 {
1247 iFanin = Vec_IntFind( &pFanout->vFanins, pNode->Id );
1248 assert( iFanin >= 0 );
1249 if ( Abc_ObjFaninC( pFanout, iFanin ) )
1250 return 1;
1251 }
1252 return 0;
1253}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
Vec_Int_t vFanins
Definition abc.h:143

◆ Abc_AigNodeHasComplFanoutEdgeTrav()

int Abc_AigNodeHasComplFanoutEdgeTrav ( Abc_Obj_t * pNode)

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

Synopsis [Returns 1 if the node has at least one complemented fanout.]

Description [A fanout is complemented if the fanout's fanin edge pointing to the given node is complemented. Only the fanouts with current TravId are counted.]

SideEffects []

SeeAlso []

Definition at line 1268 of file abcAig.c.

1269{
1270 Abc_Obj_t * pFanout;
1271 int i, iFanin;
1272 Abc_ObjForEachFanout( pNode, pFanout, i )
1273 {
1274 if ( !Abc_NodeIsTravIdCurrent(pFanout) )
1275 continue;
1276 iFanin = Vec_IntFind( &pFanout->vFanins, pNode->Id );
1277 assert( iFanin >= 0 );
1278 if ( Abc_ObjFaninC( pFanout, iFanin ) )
1279 return 1;
1280 }
1281 return 0;
1282}
Here is the caller graph for this function:

◆ Abc_AigNodeIsAcyclic()

int Abc_AigNodeIsAcyclic ( Abc_Obj_t * pNode,
Abc_Obj_t * pRoot )

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

Synopsis [Check if the node has a combination loop of depth 1 or 2.]

Description []

SideEffects []

SeeAlso []

Definition at line 1330 of file abcAig.c.

1331{
1332 Abc_Obj_t * pFanin0, * pFanin1;
1333 Abc_Obj_t * pChild00, * pChild01;
1334 Abc_Obj_t * pChild10, * pChild11;
1335 if ( !Abc_AigNodeIsAnd(pNode) )
1336 return 1;
1337 pFanin0 = Abc_ObjFanin0(pNode);
1338 pFanin1 = Abc_ObjFanin1(pNode);
1339 if ( pRoot == pFanin0 || pRoot == pFanin1 )
1340 return 0;
1341 if ( Abc_ObjIsCi(pFanin0) )
1342 {
1343 pChild00 = NULL;
1344 pChild01 = NULL;
1345 }
1346 else
1347 {
1348 pChild00 = Abc_ObjFanin0(pFanin0);
1349 pChild01 = Abc_ObjFanin1(pFanin0);
1350 if ( pRoot == pChild00 || pRoot == pChild01 )
1351 return 0;
1352 }
1353 if ( Abc_ObjIsCi(pFanin1) )
1354 {
1355 pChild10 = NULL;
1356 pChild11 = NULL;
1357 }
1358 else
1359 {
1360 pChild10 = Abc_ObjFanin0(pFanin1);
1361 pChild11 = Abc_ObjFanin1(pFanin1);
1362 if ( pRoot == pChild10 || pRoot == pChild11 )
1363 return 0;
1364 }
1365 return 1;
1366}

◆ Abc_AigOr()

Abc_Obj_t * Abc_AigOr ( Abc_Aig_t * pMan,
Abc_Obj_t * p0,
Abc_Obj_t * p1 )

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

Synopsis [Implements Boolean OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 719 of file abcAig.c.

720{
721 return Abc_ObjNot( Abc_AigAnd( pMan, Abc_ObjNot(p0), Abc_ObjNot(p1) ) );
722}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigPrintNode()

void Abc_AigPrintNode ( Abc_Obj_t * pNode)

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

Synopsis [Prints the AIG node for debugging purposes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1296 of file abcAig.c.

1297{
1298 Abc_Obj_t * pNodeR = Abc_ObjRegular(pNode);
1299 if ( Abc_ObjIsCi(pNodeR) )
1300 {
1301 printf( "CI %4s%s.\n", Abc_ObjName(pNodeR), Abc_ObjIsComplement(pNode)? "\'" : "" );
1302 return;
1303 }
1304 if ( Abc_AigNodeIsConst(pNodeR) )
1305 {
1306 printf( "Constant 1 %s.\n", Abc_ObjIsComplement(pNode)? "(complemented)" : "" );
1307 return;
1308 }
1309 // print the node's function
1310 printf( "%7s%s", Abc_ObjName(pNodeR), Abc_ObjIsComplement(pNode)? "\'" : "" );
1311 printf( " = " );
1312 printf( "%7s%s", Abc_ObjName(Abc_ObjFanin0(pNodeR)), Abc_ObjFaninC0(pNodeR)? "\'" : "" );
1313 printf( " * " );
1314 printf( "%7s%s", Abc_ObjName(Abc_ObjFanin1(pNodeR)), Abc_ObjFaninC1(pNodeR)? "\'" : "" );
1315 printf( "\n" );
1316}
Here is the call graph for this function:

◆ Abc_AigRehash()

void Abc_AigRehash ( Abc_Aig_t * pMan)

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

Synopsis [Resizes the hash table of AIG nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 628 of file abcAig.c.

629{
630 Abc_Obj_t ** pBinsNew;
631 Abc_Obj_t * pEnt, * pEnt2;
632 int * pArray;
633 unsigned Key;
634 int Counter, Temp, i;
635
636 // allocate a new array
637 pBinsNew = ABC_ALLOC( Abc_Obj_t *, pMan->nBins );
638 memset( pBinsNew, 0, sizeof(Abc_Obj_t *) * pMan->nBins );
639 // rehash the entries from the old table
640 Counter = 0;
641 for ( i = 0; i < pMan->nBins; i++ )
642 Abc_AigBinForEachEntrySafe( pMan->pBins[i], pEnt, pEnt2 )
643 {
644 // swap the fanins if needed
645 pArray = pEnt->vFanins.pArray;
646 if ( pArray[0] > pArray[1] )
647 {
648 Temp = pArray[0];
649 pArray[0] = pArray[1];
650 pArray[1] = Temp;
651 Temp = pEnt->fCompl0;
652 pEnt->fCompl0 = pEnt->fCompl1;
653 pEnt->fCompl1 = Temp;
654 }
655 // rehash the node
656 Key = Abc_HashKey2( Abc_ObjChild0(pEnt), Abc_ObjChild1(pEnt), pMan->nBins );
657 pEnt->pNext = pBinsNew[Key];
658 pBinsNew[Key] = pEnt;
659 Counter++;
660 }
661 assert( Counter == pMan->nEntries );
662 // replace the table and the parameters
663 ABC_FREE( pMan->pBins );
664 pMan->pBins = pBinsNew;
665}
#define Abc_AigBinForEachEntrySafe(pBin, pEnt, pEnt2)
Definition abcAig.c:78
unsigned fCompl1
Definition abc.h:141
unsigned fCompl0
Definition abc.h:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigReplace()

int Abc_AigReplace ( Abc_Aig_t * pMan,
Abc_Obj_t * pOld,
Abc_Obj_t * pNew,
int fUpdateLevel )

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

Synopsis [Replaces one AIG node by the other.]

Description []

SideEffects []

SeeAlso []

Definition at line 850 of file abcAig.c.

851{
852 assert( Vec_PtrSize(pMan->vStackReplaceOld) == 0 );
853 assert( Vec_PtrSize(pMan->vStackReplaceNew) == 0 );
854 Vec_PtrPush( pMan->vStackReplaceOld, pOld );
855 Vec_PtrPush( pMan->vStackReplaceNew, pNew );
856 assert( !Abc_ObjIsComplement(pOld) );
857 // process the replacements
858 while ( Vec_PtrSize(pMan->vStackReplaceOld) )
859 {
860 pOld = (Abc_Obj_t *)Vec_PtrPop( pMan->vStackReplaceOld );
861 pNew = (Abc_Obj_t *)Vec_PtrPop( pMan->vStackReplaceNew );
862 if ( Abc_ObjFanoutNum(pOld) == 0 )
863 //return 0;
864 continue;
865 Abc_AigReplace_int( pMan, pOld, pNew, fUpdateLevel );
866 }
867 if ( fUpdateLevel )
868 {
869 Abc_AigUpdateLevel_int( pMan );
870 if ( pMan->pNtkAig->vLevelsR )
871 Abc_AigUpdateLevelR_int( pMan );
872 }
873 return 1;
874}
Vec_Int_t * vLevelsR
Definition abc.h:196
Here is the caller graph for this function:

◆ Abc_AigSetNodePhases()

void Abc_AigSetNodePhases ( Abc_Ntk_t * pNtk)

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

Synopsis [Sets the correct phase of the nodes.]

Description [The AIG nodes should be in the DFS order.]

SideEffects []

SeeAlso []

Definition at line 1406 of file abcAig.c.

1407{
1408 Abc_Obj_t * pObj;
1409 int i;
1410 assert( Abc_NtkIsDfsOrdered(pNtk) );
1411 Abc_AigConst1(pNtk)->fPhase = 1;
1412 Abc_NtkForEachPi( pNtk, pObj, i )
1413 pObj->fPhase = 0;
1414 Abc_NtkForEachLatchOutput( pNtk, pObj, i )
1415 pObj->fPhase = Abc_LatchIsInit1(pObj);
1416 Abc_AigForEachAnd( pNtk, pObj, i )
1417 pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj)) & (Abc_ObjFanin1(pObj)->fPhase ^ Abc_ObjFaninC1(pObj));
1418 Abc_NtkForEachPo( pNtk, pObj, i )
1419 pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj));
1420 Abc_NtkForEachLatchInput( pNtk, pObj, i )
1421 pObj->fPhase = (Abc_ObjFanin0(pObj)->fPhase ^ Abc_ObjFaninC0(pObj));
1422}
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition abcDfs.c:698
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition abc.h:488
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition abc.h:506
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition abc.h:503
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
Here is the call graph for this function:

◆ Abc_AigUpdateReset()

void Abc_AigUpdateReset ( Abc_Aig_t * pMan)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1477 of file abcAig.c.

1478{
1479 assert( pMan->vAddedCells != NULL );
1480 Vec_PtrClear( pMan->vAddedCells );
1481 Vec_PtrClear( pMan->vUpdatedNets );
1482}
Here is the caller graph for this function:

◆ Abc_AigUpdateStart()

Vec_Ptr_t * Abc_AigUpdateStart ( Abc_Aig_t * pMan,
Vec_Ptr_t ** pvUpdatedNets )

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1437 of file abcAig.c.

1438{
1439 assert( pMan->vAddedCells == NULL );
1440 pMan->vAddedCells = Vec_PtrAlloc( 1000 );
1441 pMan->vUpdatedNets = Vec_PtrAlloc( 1000 );
1442 *pvUpdatedNets = pMan->vUpdatedNets;
1443 return pMan->vAddedCells;
1444}

◆ Abc_AigUpdateStop()

void Abc_AigUpdateStop ( Abc_Aig_t * pMan)

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

Synopsis [Start the update list.]

Description []

SideEffects []

SeeAlso []

Definition at line 1457 of file abcAig.c.

1458{
1459 assert( pMan->vAddedCells != NULL );
1460 Vec_PtrFree( pMan->vAddedCells );
1461 Vec_PtrFree( pMan->vUpdatedNets );
1462 pMan->vAddedCells = NULL;
1463 pMan->vUpdatedNets = NULL;
1464}

◆ Abc_AigXor()

Abc_Obj_t * Abc_AigXor ( Abc_Aig_t * pMan,
Abc_Obj_t * p0,
Abc_Obj_t * p1 )

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

Synopsis [Implements Boolean XOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 735 of file abcAig.c.

736{
737 return Abc_AigOr( pMan, Abc_AigAnd(pMan, p0, Abc_ObjNot(p1)),
738 Abc_AigAnd(pMan, p1, Abc_ObjNot(p0)) );
739}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_AigXorLookup()

Abc_Obj_t * Abc_AigXorLookup ( Abc_Aig_t * pMan,
Abc_Obj_t * p0,
Abc_Obj_t * p1,
int * pType )

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

Synopsis [Returns the gate implementing EXOR of the two arguments if it exists.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 474 of file abcAig.c.

475{
476 Abc_Obj_t * pNode1, * pNode2, * pNode;
477 // set the flag to zero
478 if ( pType ) *pType = 0;
479 // check the case of XOR(a,b) = OR(ab, a'b')'
480 if ( (pNode1 = Abc_AigAndLookup(pMan, Abc_ObjNot(p0), Abc_ObjNot(p1))) &&
481 (pNode2 = Abc_AigAndLookup(pMan, p0, p1)) )
482 {
483 pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
484 if ( pNode && pType ) *pType = 1;
485 return pNode;
486 }
487 // check the case of XOR(a,b) = OR(a'b, ab')
488 if ( (pNode1 = Abc_AigAndLookup(pMan, p0, Abc_ObjNot(p1))) &&
489 (pNode2 = Abc_AigAndLookup(pMan, Abc_ObjNot(p0), p1)) )
490 {
491 pNode = Abc_AigAndLookup( pMan, Abc_ObjNot(pNode1), Abc_ObjNot(pNode2) );
492 return pNode? Abc_ObjNot(pNode) : NULL;
493 }
494 return NULL;
495}
Here is the call graph for this function:

◆ Abc_NtkHelloWorld()

void Abc_NtkHelloWorld ( Abc_Ntk_t * pNtk)

END OF FILE ///.

Definition at line 1515 of file abcAig.c.

1516{
1517 printf( "Hello, World!\n" );
1518}