#include "abc.h"
#include "fxu.h"
Go to the source code of this file.
Functions | |
static bool | Abc_NtkFxuCheck (Abc_Ntk_t *pNtk) |
static void | Abc_NtkFxuCollectInfo (Abc_Ntk_t *pNtk, Fxu_Data_t *p) |
static void | Abc_NtkFxuReconstruct (Abc_Ntk_t *pNtk, Fxu_Data_t *p) |
bool | Abc_NtkFastExtract (Abc_Ntk_t *pNtk, Fxu_Data_t *p) |
void | Abc_NtkFxuFreeInfo (Fxu_Data_t *p) |
bool Abc_NtkFastExtract | ( | Abc_Ntk_t * | pNtk, | |
Fxu_Data_t * | p | |||
) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Performs fast_extract on the current network.]
Description [Takes the network and the maximum number of nodes to extract. Uses the concurrent double-cube and single cube divisor extraction procedure. Modifies the network in the end, after extracting all nodes. Note that Ntk_NetworkSweep() may increase the performance of this procedure because the single-literal nodes will not be created in the sparse matrix. Returns 1 if the network has been changed.]
SideEffects []
SeeAlso []
Definition at line 53 of file abcFxu.c.
00054 { 00055 assert( Abc_NtkIsLogic(pNtk) ); 00056 // if the network is already in the SOP form, it may come from BLIF file 00057 // and it may not be SCC-free, in which case FXU will not work correctly 00058 if ( Abc_NtkIsSopLogic(pNtk) ) 00059 { // to make sure the SOPs are SCC-free 00060 // Abc_NtkSopToBdd(pNtk); 00061 // Abc_NtkBddToSop(pNtk); 00062 } 00063 // get the network in the SOP form 00064 if ( !Abc_NtkToSop(pNtk, 0) ) 00065 { 00066 printf( "Abc_NtkFastExtract(): Converting to SOPs has failed.\n" ); 00067 return 0; 00068 } 00069 // check if the network meets the requirements 00070 if ( !Abc_NtkFxuCheck(pNtk) ) 00071 { 00072 printf( "Abc_NtkFastExtract: Nodes have duplicated or complemented fanins. FXU is not performed.\n" ); 00073 return 0; 00074 } 00075 // sweep removes useless nodes 00076 Abc_NtkCleanup( pNtk, 0 ); 00077 // collect information about the covers 00078 Abc_NtkFxuCollectInfo( pNtk, p ); 00079 // call the fast extract procedure 00080 if ( Fxu_FastExtract(p) > 0 ) 00081 { 00082 // update the network 00083 Abc_NtkFxuReconstruct( pNtk, p ); 00084 // make sure everything is okay 00085 if ( !Abc_NtkCheck( pNtk ) ) 00086 printf( "Abc_NtkFastExtract: The network check has failed.\n" ); 00087 return 1; 00088 } 00089 else 00090 printf( "Warning: The network has not been changed by \"fx\".\n" ); 00091 return 0; 00092 }
CFile****************************************************************
FileName [abcFxu.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Interface with the fast extract package.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Makes sure the nodes do not have complemented and duplicated fanins.]
Description []
SideEffects []
SeeAlso []
Definition at line 106 of file abcFxu.c.
00107 { 00108 Abc_Obj_t * pNode, * pFanin1, * pFanin2; 00109 int n, i, k; 00110 Abc_NtkForEachNode( pNtk, pNode, n ) 00111 { 00112 Abc_ObjForEachFanin( pNode, pFanin1, i ) 00113 { 00114 if ( i < 2 && Abc_ObjFaninC(pNode, i) ) 00115 return 0; 00116 Abc_ObjForEachFanin( pNode, pFanin2, k ) 00117 { 00118 if ( i == k ) 00119 continue; 00120 if ( pFanin1 == pFanin2 ) 00121 return 0; 00122 } 00123 } 00124 } 00125 return 1; 00126 }
void Abc_NtkFxuCollectInfo | ( | Abc_Ntk_t * | pNtk, | |
Fxu_Data_t * | p | |||
) | [static] |
Function*************************************************************
Synopsis [Collect information about the network for fast_extract.]
Description []
SideEffects []
SeeAlso []
Definition at line 139 of file abcFxu.c.
00140 { 00141 Abc_Obj_t * pNode; 00142 int i; 00143 // add information to the manager 00144 p->pManSop = pNtk->pManFunc; 00145 p->vSops = Vec_PtrAlloc(0); 00146 p->vFanins = Vec_PtrAlloc(0); 00147 p->vSopsNew = Vec_PtrAlloc(0); 00148 p->vFaninsNew = Vec_PtrAlloc(0); 00149 Vec_PtrFill( p->vSops, Abc_NtkObjNumMax(pNtk), NULL ); 00150 Vec_PtrFill( p->vFanins, Abc_NtkObjNumMax(pNtk), NULL ); 00151 Vec_PtrFill( p->vSopsNew, Abc_NtkObjNumMax(pNtk) + p->nNodesExt, NULL ); 00152 Vec_PtrFill( p->vFaninsNew, Abc_NtkObjNumMax(pNtk) + p->nNodesExt, NULL ); 00153 // add SOPs and fanin array 00154 Abc_NtkForEachNode( pNtk, pNode, i ) 00155 { 00156 if ( Abc_SopGetVarNum(pNode->pData) < 2 ) 00157 continue; 00158 if ( Abc_SopGetCubeNum(pNode->pData) < 1 ) 00159 continue; 00160 p->vSops->pArray[i] = pNode->pData; 00161 p->vFanins->pArray[i] = &pNode->vFanins; 00162 } 00163 p->nNodesOld = Abc_NtkObjNumMax(pNtk); 00164 }
void Abc_NtkFxuFreeInfo | ( | Fxu_Data_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 177 of file abcFxu.c.
00178 { 00179 int i; 00180 // free the arrays of new fanins 00181 if ( p->vFaninsNew ) 00182 for ( i = 0; i < p->vFaninsNew->nSize; i++ ) 00183 if ( p->vFaninsNew->pArray[i] ) 00184 Vec_IntFree( p->vFaninsNew->pArray[i] ); 00185 // free the arrays 00186 if ( p->vSops ) Vec_PtrFree( p->vSops ); 00187 if ( p->vSopsNew ) Vec_PtrFree( p->vSopsNew ); 00188 if ( p->vFanins ) Vec_PtrFree( p->vFanins ); 00189 if ( p->vFaninsNew ) Vec_PtrFree( p->vFaninsNew ); 00190 FREE( p ); 00191 }
void Abc_NtkFxuReconstruct | ( | Abc_Ntk_t * | pNtk, | |
Fxu_Data_t * | p | |||
) | [static] |
Function*************************************************************
Synopsis [Recostructs the network after FX.]
Description []
SideEffects []
SeeAlso []
Definition at line 204 of file abcFxu.c.
00205 { 00206 Vec_Int_t * vFanins; 00207 Abc_Obj_t * pNode, * pFanin; 00208 int i, k; 00209 00210 assert( p->vFanins->nSize < p->vFaninsNew->nSize ); 00211 // create the new nodes 00212 for ( i = p->vFanins->nSize; i < p->vFanins->nSize + p->nNodesNew; i++ ) 00213 { 00214 // start the node 00215 pNode = Abc_NtkCreateNode( pNtk ); 00216 assert( i == (int)pNode->Id ); 00217 } 00218 // update the old nodes 00219 for ( i = 0; i < p->vFanins->nSize; i++ ) 00220 { 00221 // the new array of fanins 00222 vFanins = p->vFaninsNew->pArray[i]; 00223 if ( vFanins == NULL ) 00224 continue; 00225 // remove old fanins 00226 pNode = Abc_NtkObj( pNtk, i ); 00227 Abc_ObjRemoveFanins( pNode ); 00228 // add new fanins 00229 vFanins = p->vFaninsNew->pArray[i]; 00230 for ( k = 0; k < vFanins->nSize; k++ ) 00231 { 00232 pFanin = Abc_NtkObj( pNtk, vFanins->pArray[k] ); 00233 Abc_ObjAddFanin( pNode, pFanin ); 00234 } 00235 pNode->pData = p->vSopsNew->pArray[i]; 00236 assert( pNode->pData != NULL ); 00237 } 00238 // set up the new nodes 00239 for ( i = p->vFanins->nSize; i < p->vFanins->nSize + p->nNodesNew; i++ ) 00240 { 00241 // get the new node 00242 pNode = Abc_NtkObj( pNtk, i ); 00243 // add the fanins 00244 vFanins = p->vFaninsNew->pArray[i]; 00245 for ( k = 0; k < vFanins->nSize; k++ ) 00246 { 00247 pFanin = Abc_NtkObj( pNtk, vFanins->pArray[k] ); 00248 Abc_ObjAddFanin( pNode, pFanin ); 00249 } 00250 pNode->pData = p->vSopsNew->pArray[i]; 00251 assert( pNode->pData != NULL ); 00252 } 00253 }