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

Go to the source code of this file.

Classes

struct  Abc_ManCut_t_
 DECLARATIONS ///. More...
 

Functions

Vec_Ptr_tAbc_NodeFindCut (Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
 
void Abc_NodeConeCollect (Abc_Obj_t **ppRoots, int nRoots, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVisited, int fIncludeFanins)
 
Abc_ManCut_tAbc_NtkManCutStart (int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
 
void Abc_NtkManCutStop (Abc_ManCut_t *p)
 
Vec_Ptr_tAbc_NtkManCutReadCutLarge (Abc_ManCut_t *p)
 
Vec_Ptr_tAbc_NtkManCutReadCutSmall (Abc_ManCut_t *p)
 
Vec_Ptr_tAbc_NtkManCutReadVisited (Abc_ManCut_t *p)
 
Vec_Ptr_tAbc_NodeCollectTfoCands (Abc_ManCut_t *p, Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, int LevelMax)
 

Function Documentation

◆ Abc_NodeCollectTfoCands()

Vec_Ptr_t * Abc_NodeCollectTfoCands ( Abc_ManCut_t * p,
Abc_Obj_t * pRoot,
Vec_Ptr_t * vLeaves,
int LevelMax )

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

Synopsis [Collects the TFO of the cut in the topological order.]

Description [TFO of the cut is defined as a set of nodes, for which the cut is a cut, that is, every path from the collected nodes to the CIs goes through a node in the cut. The nodes are collected if their level does not exceed the given number (LevelMax). The nodes are returned in the topological order. If the root node is given, its MFFC is marked, so that the collected nodes do not contain any nodes in the MFFC.]

SideEffects []

SeeAlso []

Definition at line 699 of file abcReconv.c.

700{
701 Abc_Ntk_t * pNtk = pRoot->pNtk;
702 Vec_Ptr_t * vVec;
703 Abc_Obj_t * pNode, * pFanout;
704 int i, k, v, LevelMin;
705 assert( Abc_NtkIsStrash(pNtk) );
706
707 // assuming that the structure is clean
708 Vec_VecForEachLevel( p->vLevels, vVec, i )
709 assert( vVec->nSize == 0 );
710
711 // put fanins into the structure while labeling them
712 Abc_NtkIncrementTravId( pNtk );
713 LevelMin = -1;
714 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pNode, i )
715 {
716 if ( pNode->Level > (unsigned)LevelMax )
717 continue;
718 Abc_NodeSetTravIdCurrent( pNode );
719 Vec_VecPush( p->vLevels, pNode->Level, pNode );
720 if ( LevelMin < (int)pNode->Level )
721 LevelMin = pNode->Level;
722 }
723 assert( LevelMin >= 0 );
724
725 // mark MFFC
726 if ( pRoot )
727 Abc_NodeMffcLabelAig( pRoot );
728
729 // go through the levels up
730 Vec_PtrClear( p->vNodesTfo );
731 Vec_VecForEachEntryStart( Abc_Obj_t *, p->vLevels, pNode, i, k, LevelMin )
732 {
733 if ( i > LevelMax )
734 break;
735 // if the node is not marked, it is not a fanin
736 if ( !Abc_NodeIsTravIdCurrent(pNode) )
737 {
738 // check if it belongs to the TFO
739 if ( !Abc_NodeIsTravIdCurrent(Abc_ObjFanin0(pNode)) ||
740 !Abc_NodeIsTravIdCurrent(Abc_ObjFanin1(pNode)) )
741 continue;
742 // save the node in the TFO and label it
743 Vec_PtrPush( p->vNodesTfo, pNode );
744 Abc_NodeSetTravIdCurrent( pNode );
745 }
746 // go through the fanouts and add them to the structure if they meet the conditions
747 Abc_ObjForEachFanout( pNode, pFanout, v )
748 {
749 // skip if fanout is a CO or its level exceeds
750 if ( Abc_ObjIsCo(pFanout) || pFanout->Level > (unsigned)LevelMax )
751 continue;
752 // skip if it is already added or if it is in MFFC
753 if ( Abc_NodeIsTravIdCurrent(pFanout) )
754 continue;
755 // add it to the structure but do not mark it (until tested later)
756 Vec_VecPushUnique( p->vLevels, pFanout->Level, pFanout );
757 }
758 }
759
760 // clear the levelized structure
761 Vec_VecForEachLevelStart( p->vLevels, vVec, i, LevelMin )
762 {
763 if ( i > LevelMax )
764 break;
765 Vec_PtrClear( vVec );
766 }
767 return p->vNodesTfo;
768}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL int Abc_NodeMffcLabelAig(Abc_Obj_t *pNode)
Definition abcRefs.c:100
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
Cube * p
Definition exorList.c:222
Abc_Ntk_t * pNtk
Definition abc.h:130
unsigned Level
Definition abc.h:142
#define assert(ex)
Definition util_old.h:213
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
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition vecVec.h:92
#define Vec_VecForEachLevelStart(vGlob, vVec, i, LevelStart)
Definition vecVec.h:57
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecVec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeConeCollect()

void Abc_NodeConeCollect ( Abc_Obj_t ** ppRoots,
int nRoots,
Vec_Ptr_t * vLeaves,
Vec_Ptr_t * vVisited,
int fIncludeFanins )

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

Synopsis [Get the nodes contained in the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file abcReconv.c.

445{
446 Abc_Obj_t * pTemp;
447 int i;
448 // mark the fanins of the cone
449 Abc_NodesMark( vLeaves );
450 // collect the nodes in the DFS order
451 Vec_PtrClear( vVisited );
452 // add the fanins
453 if ( fIncludeFanins )
454 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pTemp, i )
455 Vec_PtrPush( vVisited, pTemp );
456 // add other nodes
457 for ( i = 0; i < nRoots; i++ )
458 Abc_NodeConeMarkCollect_rec( ppRoots[i], vVisited );
459 // unmark both sets
460 Abc_NodesUnmark( vLeaves );
461 Abc_NodesUnmark( vVisited );
462}
Here is the caller graph for this function:

◆ Abc_NodeFindCut()

Vec_Ptr_t * Abc_NodeFindCut ( Abc_ManCut_t * p,
Abc_Obj_t * pRoot,
int fContain )

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

Synopsis [Finds a fanin-limited, reconvergence-driven cut for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 256 of file abcReconv.c.

257{
258 Abc_Obj_t * pNode;
259 int i;
260
261 assert( !Abc_ObjIsComplement(pRoot) );
262 assert( Abc_ObjIsNode(pRoot) );
263
264 // start the visited nodes and mark them
265 Vec_PtrClear( p->vVisited );
266 Vec_PtrPush( p->vVisited, pRoot );
267 Vec_PtrPush( p->vVisited, Abc_ObjFanin0(pRoot) );
268 Vec_PtrPush( p->vVisited, Abc_ObjFanin1(pRoot) );
269 pRoot->fMarkB = 1;
270 Abc_ObjFanin0(pRoot)->fMarkB = 1;
271 Abc_ObjFanin1(pRoot)->fMarkB = 1;
272
273 // start the cut
274 Vec_PtrClear( p->vNodeLeaves );
275 Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin0(pRoot) );
276 Vec_PtrPush( p->vNodeLeaves, Abc_ObjFanin1(pRoot) );
277
278 // compute the cut
279 while ( Abc_NodeBuildCutLevelOne_int( p->vVisited, p->vNodeLeaves, p->nNodeSizeMax, p->nNodeFanStop ) );
280 assert( Vec_PtrSize(p->vNodeLeaves) <= p->nNodeSizeMax );
281
282 // return if containing cut is not requested
283 if ( !fContain )
284 {
285 // unmark both fMarkA and fMarkB in tbe TFI
286 Abc_NodesUnmarkB( p->vVisited );
287 return p->vNodeLeaves;
288 }
289
290//printf( "\n\n\n" );
291 // compute the containing cut
292 assert( p->nNodeSizeMax < p->nConeSizeMax );
293 // copy the current boundary
294 Vec_PtrClear( p->vConeLeaves );
295 Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodeLeaves, pNode, i )
296 Vec_PtrPush( p->vConeLeaves, pNode );
297 // compute the containing cut
298 while ( Abc_NodeBuildCutLevelOne_int( p->vVisited, p->vConeLeaves, p->nConeSizeMax, p->nConeFanStop ) );
299 assert( Vec_PtrSize(p->vConeLeaves) <= p->nConeSizeMax );
300 // unmark TFI using fMarkA and fMarkB
301 Abc_NodesUnmarkB( p->vVisited );
302 return p->vNodeLeaves;
303}
unsigned fMarkB
Definition abc.h:135
Here is the caller graph for this function:

◆ Abc_NtkManCutReadCutLarge()

Vec_Ptr_t * Abc_NtkManCutReadCutLarge ( Abc_ManCut_t * p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 644 of file abcReconv.c.

645{
646 return p->vConeLeaves;
647}
Here is the caller graph for this function:

◆ Abc_NtkManCutReadCutSmall()

Vec_Ptr_t * Abc_NtkManCutReadCutSmall ( Abc_ManCut_t * p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 660 of file abcReconv.c.

661{
662 return p->vNodeLeaves;
663}
Here is the caller graph for this function:

◆ Abc_NtkManCutReadVisited()

Vec_Ptr_t * Abc_NtkManCutReadVisited ( Abc_ManCut_t * p)

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

Synopsis [Returns the leaves of the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 676 of file abcReconv.c.

677{
678 return p->vVisited;
679}
Here is the caller graph for this function:

◆ Abc_NtkManCutStart()

Abc_ManCut_t * Abc_NtkManCutStart ( int nNodeSizeMax,
int nConeSizeMax,
int nNodeFanStop,
int nConeFanStop )

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

Synopsis [Starts the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 595 of file abcReconv.c.

596{
597 Abc_ManCut_t * p;
598 p = ABC_ALLOC( Abc_ManCut_t, 1 );
599 memset( p, 0, sizeof(Abc_ManCut_t) );
600 p->vNodeLeaves = Vec_PtrAlloc( 100 );
601 p->vConeLeaves = Vec_PtrAlloc( 100 );
602 p->vVisited = Vec_PtrAlloc( 100 );
603 p->vLevels = Vec_VecAlloc( 100 );
604 p->vNodesTfo = Vec_PtrAlloc( 100 );
605 p->nNodeSizeMax = nNodeSizeMax;
606 p->nConeSizeMax = nConeSizeMax;
607 p->nNodeFanStop = nNodeFanStop;
608 p->nConeFanStop = nConeFanStop;
609 return p;
610}
struct Abc_ManCut_t_ Abc_ManCut_t
Definition abc.h:119
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkManCutStop()

void Abc_NtkManCutStop ( Abc_ManCut_t * p)

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

Synopsis [Stops the resynthesis manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 623 of file abcReconv.c.

624{
625 Vec_PtrFree( p->vNodeLeaves );
626 Vec_PtrFree( p->vConeLeaves );
627 Vec_PtrFree( p->vVisited );
628 Vec_VecFree( p->vLevels );
629 Vec_PtrFree( p->vNodesTfo );
630 ABC_FREE( p );
631}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function: