src/aig/aig/aigWin.c File Reference

#include "aig.h"
Include dependency graph for aigWin.c:

Go to the source code of this file.

Functions

static int Aig_NodeGetLeafCostOne (Aig_Obj_t *pNode, int nFanoutLimit)
int Aig_ManFindCut_int (Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited, int nSizeLimit, int nFanoutLimit)
void Aig_ManFindCut (Aig_Obj_t *pRoot, Vec_Ptr_t *vFront, Vec_Ptr_t *vVisited, int nSizeLimit, int nFanoutLimit)

Function Documentation

void Aig_ManFindCut ( Aig_Obj_t pRoot,
Vec_Ptr_t vFront,
Vec_Ptr_t vVisited,
int  nSizeLimit,
int  nFanoutLimit 
)

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

Synopsis [Computes one sequential cut of the given size.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file aigWin.c.

00143 {
00144     Aig_Obj_t * pNode;
00145     int i;
00146 
00147     assert( !Aig_IsComplement(pRoot) );
00148     assert( Aig_ObjIsNode(pRoot) );
00149     assert( Aig_ObjChild0(pRoot) );
00150     assert( Aig_ObjChild1(pRoot) );
00151 
00152     // start the cut 
00153     Vec_PtrClear( vFront );
00154     Vec_PtrPush( vFront, Aig_ObjFanin0(pRoot) );
00155     Vec_PtrPush( vFront, Aig_ObjFanin1(pRoot) );
00156 
00157     // start the visited nodes
00158     Vec_PtrClear( vVisited );
00159     Vec_PtrPush( vVisited, pRoot );
00160     Vec_PtrPush( vVisited, Aig_ObjFanin0(pRoot) );
00161     Vec_PtrPush( vVisited, Aig_ObjFanin1(pRoot) );
00162 
00163     // mark these nodes
00164     assert( !pRoot->fMarkA );
00165     assert( !Aig_ObjFanin0(pRoot)->fMarkA );
00166     assert( !Aig_ObjFanin1(pRoot)->fMarkA );
00167     pRoot->fMarkA = 1;
00168     Aig_ObjFanin0(pRoot)->fMarkA = 1;
00169     Aig_ObjFanin1(pRoot)->fMarkA = 1;
00170 
00171     // compute the cut
00172     while ( Aig_ManFindCut_int( vFront, vVisited, nSizeLimit, nFanoutLimit ) );
00173     assert( Vec_PtrSize(vFront) <= nSizeLimit );
00174 
00175     // clean the visit markings
00176     Vec_PtrForEachEntry( vVisited, pNode, i )
00177         pNode->fMarkA = 0;
00178 }

int Aig_ManFindCut_int ( Vec_Ptr_t vFront,
Vec_Ptr_t vVisited,
int  nSizeLimit,
int  nFanoutLimit 
)

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

Synopsis [Builds reconvergence-driven cut by changing one leaf at a time.]

Description [This procedure looks at the current leaves and tries to change one leaf at a time in such a way that the cut grows as little as possible. In evaluating the fanins, this procedure looks only at their immediate predecessors (this is why it is called a one-level construction procedure).]

SideEffects []

SeeAlso []

Definition at line 77 of file aigWin.c.

00078 {
00079     Aig_Obj_t * pNode, * pFaninBest, * pNext;
00080     int CostBest, CostCur, i;
00081     // find the best fanin
00082     CostBest   = 100;
00083     pFaninBest = NULL;
00084 //printf( "Evaluating fanins of the cut:\n" );
00085     Vec_PtrForEachEntry( vFront, pNode, i )
00086     {
00087         CostCur = Aig_NodeGetLeafCostOne( pNode, nFanoutLimit );
00088 //printf( "    Fanin %s has cost %d.\n", Aig_ObjName(pNode), CostCur );
00089         if ( CostBest > CostCur ||
00090             (CostBest == CostCur && pNode->Level > pFaninBest->Level) )
00091         {
00092             CostBest   = CostCur;
00093             pFaninBest = pNode;
00094         }
00095         if ( CostBest == 0 )
00096             break;
00097     }
00098     if ( pFaninBest == NULL )
00099         return 0;
00100     assert( CostBest < 3 );
00101     if ( Vec_PtrSize(vFront) - 1 + CostBest > nSizeLimit )
00102         return 0;
00103     assert( Aig_ObjIsNode(pFaninBest) );
00104     // remove the node from the array
00105     Vec_PtrRemove( vFront, pFaninBest );
00106 //printf( "Removing fanin %s.\n", Aig_ObjName(pFaninBest) );
00107 
00108     // add the left child to the fanins
00109     pNext = Aig_ObjFanin0(pFaninBest);
00110     if ( !pNext->fMarkA )
00111     {
00112 //printf( "Adding fanin %s.\n", Aig_ObjName(pNext) );
00113         pNext->fMarkA = 1;
00114         Vec_PtrPush( vFront, pNext );
00115         Vec_PtrPush( vVisited, pNext );
00116     }
00117     // add the right child to the fanins
00118     pNext = Aig_ObjFanin1(pFaninBest);
00119     if ( !pNext->fMarkA )
00120     {
00121 //printf( "Adding fanin %s.\n", Aig_ObjName(pNext) );
00122         pNext->fMarkA = 1;
00123         Vec_PtrPush( vFront, pNext );
00124         Vec_PtrPush( vVisited, pNext );
00125     }
00126     assert( Vec_PtrSize(vFront) <= nSizeLimit );
00127     // keep doing this
00128     return 1;
00129 }

static int Aig_NodeGetLeafCostOne ( Aig_Obj_t pNode,
int  nFanoutLimit 
) [inline, static]

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

FileName [aigWin.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG package.]

Synopsis [Window computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id
aigWin.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Evaluate the cost of removing the node from the set of leaves.]

Description [Returns the number of new leaves that will be brought in. Returns large number if the node cannot be removed from the set of leaves.]

SideEffects []

SeeAlso []

Definition at line 43 of file aigWin.c.

00044 {
00045     int Cost;
00046     // make sure the node is in the construction zone
00047     assert( pNode->fMarkA );  
00048     // cannot expand over the PI node
00049     if ( Aig_ObjIsPi(pNode) )
00050         return 999;
00051     // get the cost of the cone
00052     Cost = (!Aig_ObjFanin0(pNode)->fMarkA) + (!Aig_ObjFanin1(pNode)->fMarkA);
00053     // always accept if the number of leaves does not increase
00054     if ( Cost < 2 )
00055         return Cost;
00056     // skip nodes with many fanouts
00057     if ( (int)pNode->nRefs > nFanoutLimit )
00058         return 999;
00059     // return the number of nodes that will be on the leaves if this node is removed
00060     return Cost;
00061 }


Generated on Tue Jan 5 12:18:13 2010 for abc70930 by  doxygen 1.6.1