#include "abc.h"
#include "resInt.h"
Go to the source code of this file.
Functions | |
static void | Res_WinMarkTfi (Res_Win_t *p) |
void | Res_WinDivisors (Res_Win_t *p, int nLevDivMax) |
void | Res_WinMarkTfi_rec (Res_Win_t *p, Abc_Obj_t *pObj) |
void | Res_WinSweepLeafTfo_rec (Abc_Obj_t *pObj, int nLevelLimit) |
int | Res_NodeDeref_rec (Abc_Obj_t *pNode) |
int | Res_NodeRef_rec (Abc_Obj_t *pNode) |
int | Res_WinVisitMffc (Abc_Obj_t *pNode) |
int Res_NodeDeref_rec | ( | Abc_Obj_t * | pNode | ) |
Function*************************************************************
Synopsis [Dereferences the node's MFFC.]
Description []
SideEffects []
SeeAlso []
Definition at line 217 of file resDivs.c.
00218 { 00219 Abc_Obj_t * pFanin; 00220 int i, Counter = 1; 00221 if ( Abc_ObjIsCi(pNode) ) 00222 return 0; 00223 Abc_NodeSetTravIdCurrent( pNode ); 00224 Abc_ObjForEachFanin( pNode, pFanin, i ) 00225 { 00226 assert( pFanin->vFanouts.nSize > 0 ); 00227 if ( --pFanin->vFanouts.nSize == 0 ) 00228 Counter += Res_NodeDeref_rec( pFanin ); 00229 } 00230 return Counter; 00231 }
int Res_NodeRef_rec | ( | Abc_Obj_t * | pNode | ) |
Function*************************************************************
Synopsis [References the node's MFFC.]
Description []
SideEffects []
SeeAlso []
Definition at line 244 of file resDivs.c.
00245 { 00246 Abc_Obj_t * pFanin; 00247 int i, Counter = 1; 00248 if ( Abc_ObjIsCi(pNode) ) 00249 return 0; 00250 Abc_ObjForEachFanin( pNode, pFanin, i ) 00251 { 00252 if ( pFanin->vFanouts.nSize++ == 0 ) 00253 Counter += Res_NodeRef_rec( pFanin ); 00254 } 00255 return Counter; 00256 }
void Res_WinDivisors | ( | Res_Win_t * | p, | |
int | nLevDivMax | |||
) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Adds candidate divisors of the node to its window.]
Description []
SideEffects []
SeeAlso []
Definition at line 45 of file resDivs.c.
00046 { 00047 Abc_Obj_t * pObj, * pFanout, * pFanin; 00048 int k, f, m; 00049 00050 // set the maximum level of the divisors 00051 p->nLevDivMax = nLevDivMax; 00052 00053 // mark the TFI with the current trav ID 00054 Abc_NtkIncrementTravId( p->pNode->pNtk ); 00055 Res_WinMarkTfi( p ); 00056 00057 // mark with the current trav ID those nodes that should not be divisors: 00058 // (1) the node and its TFO 00059 // (2) the MFFC of the node 00060 // (3) the node's fanins (these are treated as a special case) 00061 Abc_NtkIncrementTravId( p->pNode->pNtk ); 00062 Res_WinSweepLeafTfo_rec( p->pNode, p->nLevDivMax ); 00063 Res_WinVisitMffc( p->pNode ); 00064 Abc_ObjForEachFanin( p->pNode, pObj, k ) 00065 Abc_NodeSetTravIdCurrent( pObj ); 00066 00067 // at this point the nodes are marked with two trav IDs: 00068 // nodes to be collected as divisors are marked with previous trav ID 00069 // nodes to be avoided as divisors are marked with current trav ID 00070 00071 // start collecting the divisors 00072 Vec_PtrClear( p->vDivs ); 00073 Vec_PtrForEachEntry( p->vLeaves, pObj, k ) 00074 { 00075 assert( (int)pObj->Level >= p->nLevLeafMin ); 00076 if ( !Abc_NodeIsTravIdPrevious(pObj) ) 00077 continue; 00078 if ( (int)pObj->Level > p->nLevDivMax ) 00079 continue; 00080 Vec_PtrPush( p->vDivs, pObj ); 00081 } 00082 // add the internal nodes to the data structure 00083 Vec_PtrForEachEntry( p->vNodes, pObj, k ) 00084 { 00085 if ( !Abc_NodeIsTravIdPrevious(pObj) ) 00086 continue; 00087 if ( (int)pObj->Level > p->nLevDivMax ) 00088 continue; 00089 Vec_PtrPush( p->vDivs, pObj ); 00090 } 00091 00092 // explore the fanouts of already collected divisors 00093 p->nDivsPlus = 0; 00094 Vec_PtrForEachEntry( p->vDivs, pObj, k ) 00095 { 00096 // consider fanouts of this node 00097 Abc_ObjForEachFanout( pObj, pFanout, f ) 00098 { 00099 // stop if there are too many fanouts 00100 if ( f > 20 ) 00101 break; 00102 // skip nodes that are already added 00103 if ( Abc_NodeIsTravIdPrevious(pFanout) ) 00104 continue; 00105 // skip nodes in the TFO or in the MFFC of node 00106 if ( Abc_NodeIsTravIdCurrent(pFanout) ) 00107 continue; 00108 // skip COs 00109 if ( !Abc_ObjIsNode(pFanout) ) 00110 continue; 00111 // skip nodes with large level 00112 if ( (int)pFanout->Level >= p->nLevDivMax ) 00113 continue; 00114 // skip nodes whose fanins are not divisors 00115 Abc_ObjForEachFanin( pFanout, pFanin, m ) 00116 if ( !Abc_NodeIsTravIdPrevious(pFanin) ) 00117 break; 00118 if ( m < Abc_ObjFaninNum(pFanout) ) 00119 continue; 00120 // add the node to the divisors 00121 Vec_PtrPush( p->vDivs, pFanout ); 00122 Vec_PtrPush( p->vNodes, pFanout ); 00123 Abc_NodeSetTravIdPrevious( pFanout ); 00124 p->nDivsPlus++; 00125 } 00126 } 00127 /* 00128 printf( "Node level = %d. ", Abc_ObjLevel(p->pNode) ); 00129 Vec_PtrForEachEntryStart( p->vDivs, pObj, k, Vec_PtrSize(p->vDivs)-p->nDivsPlus ) 00130 printf( "%d ", Abc_ObjLevel(pObj) ); 00131 printf( "\n" ); 00132 */ 00133 //printf( "%d ", p->nDivsPlus ); 00134 }
void Res_WinMarkTfi | ( | Res_Win_t * | p | ) | [static] |
CFile****************************************************************
FileName [resDivs.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Resynthesis package.]
Synopsis [Collect divisors for the given window.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 15, 2007.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Marks the TFI cone of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 171 of file resDivs.c.
00172 { 00173 Abc_Obj_t * pObj; 00174 int i; 00175 // mark the leaves 00176 Vec_PtrForEachEntry( p->vLeaves, pObj, i ) 00177 Abc_NodeSetTravIdCurrent( pObj ); 00178 // start from the node 00179 Res_WinMarkTfi_rec( p, p->pNode ); 00180 }
Function*************************************************************
Synopsis [Marks the TFI cone of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 147 of file resDivs.c.
00148 { 00149 Abc_Obj_t * pFanin; 00150 int i; 00151 if ( Abc_NodeIsTravIdCurrent(pObj) ) 00152 return; 00153 Abc_NodeSetTravIdCurrent( pObj ); 00154 assert( Abc_ObjIsNode(pObj) ); 00155 // visit the fanins of the node 00156 Abc_ObjForEachFanin( pObj, pFanin, i ) 00157 Res_WinMarkTfi_rec( p, pFanin ); 00158 }
void Res_WinSweepLeafTfo_rec | ( | Abc_Obj_t * | pObj, | |
int | nLevelLimit | |||
) |
Function*************************************************************
Synopsis [Marks the TFO of the collected nodes up to the given level.]
Description []
SideEffects []
SeeAlso []
Definition at line 193 of file resDivs.c.
00194 { 00195 Abc_Obj_t * pFanout; 00196 int i; 00197 if ( Abc_ObjIsCo(pObj) || (int)pObj->Level > nLevelLimit ) 00198 return; 00199 if ( Abc_NodeIsTravIdCurrent(pObj) ) 00200 return; 00201 Abc_NodeSetTravIdCurrent( pObj ); 00202 Abc_ObjForEachFanout( pObj, pFanout, i ) 00203 Res_WinSweepLeafTfo_rec( pFanout, nLevelLimit ); 00204 }
int Res_WinVisitMffc | ( | Abc_Obj_t * | pNode | ) |
Function*************************************************************
Synopsis [Labels MFFC of the node with the current trav ID.]
Description []
SideEffects []
SeeAlso []
Definition at line 269 of file resDivs.c.
00270 { 00271 int Count1, Count2; 00272 assert( Abc_ObjIsNode(pNode) ); 00273 // dereference the node (mark with the current trav ID) 00274 Count1 = Res_NodeDeref_rec( pNode ); 00275 // reference it back 00276 Count2 = Res_NodeRef_rec( pNode ); 00277 assert( Count1 == Count2 ); 00278 return Count1; 00279 }