abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ntlnwk.h File Reference

Go to the source code of this file.

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Ntl_Man_t_ 
Ntl_Man_t
 INCLUDES ///. More...
 
typedef struct Nwk_Man_t_ Nwk_Man_t
 

Functions

ABC_DLL Ntl_Man_tNtl_ManReadBlif (char *pFileName, int fCheck)
 MACRO DEFINITIONS ///. More...
 
ABC_DLL void Ntl_ManWriteBlif (Ntl_Man_t *p, char *pFileName)
 
ABC_DLL Tim_Man_tNtl_ManReadTimeMan (Ntl_Man_t *p)
 
ABC_DLL Ntl_Man_tNtl_ManDup (Ntl_Man_t *p)
 
ABC_DLL void Ntl_ManFree (Ntl_Man_t *p)
 
ABC_DLL int Ntl_ManIsComb (Ntl_Man_t *p)
 
ABC_DLL void Ntl_ManPrintStats (Ntl_Man_t *p)
 
ABC_DLL int Ntl_ManSweep (Ntl_Man_t *p, int fVerbose)
 
ABC_DLL Ntl_Man_tNtl_ManInsertNtk (Ntl_Man_t *p, Nwk_Man_t *pNtk)
 
ABC_DLL Ntl_Man_tNtl_ManInsertAig (Ntl_Man_t *p, Aig_Man_t *pAig)
 
ABC_DLL Aig_Man_tNtl_ManExtract (Ntl_Man_t *p)
 
ABC_DLL Aig_Man_tNtl_ManCollapse (Ntl_Man_t *p, int fSeq)
 
ABC_DLL Aig_Man_tNtl_ManCollapseSeq (Ntl_Man_t *p, int nMinDomSize, int fVerbose)
 
ABC_DLL Ntl_Man_tNtl_ManDupCollapseLuts (Ntl_Man_t *p)
 
ABC_DLL Ntl_Man_tNtl_ManFraig (Ntl_Man_t *p, int nPartSize, int nConfLimit, int nLevelMax, int fUseCSat, int fVerbose)
 
ABC_DLL void Ntl_ManPrepareCecMans (Ntl_Man_t *pMan1, Ntl_Man_t *pMan2, Aig_Man_t **ppAig1, Aig_Man_t **ppAig2)
 
ABC_DLL Vec_Ptr_tNtl_ManCollectCiNames (Ntl_Man_t *p)
 
ABC_DLL Vec_Ptr_tNtl_ManCollectCoNames (Ntl_Man_t *p)
 
ABC_DLL Ntl_Man_tNtl_ManScl (Ntl_Man_t *p, int fLatchConst, int fLatchEqual, int fVerbose)
 
ABC_DLL Ntl_Man_tNtl_ManLcorr (Ntl_Man_t *p, int nConfMax, int fScorrGia, int fUseCSat, int fVerbose)
 
ABC_DLL Ntl_Man_tNtl_ManSsw (Ntl_Man_t *p, Fra_Ssw_t *pPars)
 
ABC_DLL Ntl_Man_tNtl_ManScorr (Ntl_Man_t *p, Ssw_Pars_t *pPars)
 
ABC_DLL void Ntl_ManTransformInitValues (Ntl_Man_t *p)
 
ABC_DLL void Ntl_ManPrepareCec (char *pFileName1, char *pFileName2, Aig_Man_t **ppMan1, Aig_Man_t **ppMan2)
 
ABC_DLL Aig_Man_tNtl_ManPrepareSec (char *pFileName1, char *pFileName2)
 
ABC_DLL Nwk_Man_tNtl_ManExtractNwk (Ntl_Man_t *p, Aig_Man_t *pAig, Tim_Man_t *pManTime)
 
ABC_DLL Nwk_Man_tNtl_ManReadNwk (char *pFileName, Aig_Man_t *pAig, Tim_Man_t *pManTime)
 
ABC_DLL void Nwk_ManPrintStats (Nwk_Man_t *p, If_LibLut_t *pLutLib, int fSaveBest, int fDumpResult, int fPower, Ntl_Man_t *pNtl)
 
ABC_DLL void Nwk_ManPrintStatsShort (Ntl_Man_t *p, Aig_Man_t *pAig, Nwk_Man_t *pNtk)
 
ABC_DLL void Nwk_ManPrintFanioNew (Nwk_Man_t *p)
 
ABC_DLL Nwk_Man_tNwk_MappingIf (Aig_Man_t *p, Tim_Man_t *pManTime, If_Par_t *pPars)
 
ABC_DLL void Nwk_ManSetIfParsDefault (If_Par_t *pPars)
 DECLARATIONS ///. More...
 
ABC_DLL void Nwk_ManBidecResyn (Nwk_Man_t *p, int fVerbose)
 
ABC_DLL Aig_Man_tNwk_ManSpeedup (Nwk_Man_t *p, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
 
ABC_DLL Aig_Man_tNwk_ManStrash (Nwk_Man_t *p)
 
ABC_DLL Vec_Int_tNwk_ManLutMerge (Nwk_Man_t *p, void *pPars)
 
ABC_DLL int Nwk_ManCheck (Nwk_Man_t *p)
 DECLARATIONS ///. More...
 
ABC_DLL void Nwk_ManDumpBlif (Nwk_Man_t *p, char *pFileName, Vec_Ptr_t *vCiNames, Vec_Ptr_t *vCoNames)
 
ABC_DLL void Nwk_ManFree (Nwk_Man_t *p)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Ntl_Man_t_ Ntl_Man_t

INCLUDES ///.

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

FileName [ntlnwk.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Netlist and network representation.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
ntlnwk.h,v 1.3 2008/10/24 14:18:44 mjarvin Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 40 of file ntlnwk.h.

typedef struct Nwk_Man_t_ Nwk_Man_t

Definition at line 41 of file ntlnwk.h.

Function Documentation

ABC_DLL Aig_Man_t* Ntl_ManCollapse ( Ntl_Man_t p,
int  fSeq 
)
ABC_DLL Aig_Man_t* Ntl_ManCollapseSeq ( Ntl_Man_t p,
int  nMinDomSize,
int  fVerbose 
)
ABC_DLL Vec_Ptr_t* Ntl_ManCollectCiNames ( Ntl_Man_t p)
ABC_DLL Vec_Ptr_t* Ntl_ManCollectCoNames ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManDup ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManDupCollapseLuts ( Ntl_Man_t p)
ABC_DLL Aig_Man_t* Ntl_ManExtract ( Ntl_Man_t p)
ABC_DLL Nwk_Man_t* Ntl_ManExtractNwk ( Ntl_Man_t p,
Aig_Man_t pAig,
Tim_Man_t pManTime 
)
ABC_DLL Ntl_Man_t* Ntl_ManFraig ( Ntl_Man_t p,
int  nPartSize,
int  nConfLimit,
int  nLevelMax,
int  fUseCSat,
int  fVerbose 
)
ABC_DLL void Ntl_ManFree ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManInsertAig ( Ntl_Man_t p,
Aig_Man_t pAig 
)
ABC_DLL Ntl_Man_t* Ntl_ManInsertNtk ( Ntl_Man_t p,
Nwk_Man_t pNtk 
)
ABC_DLL int Ntl_ManIsComb ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManLcorr ( Ntl_Man_t p,
int  nConfMax,
int  fScorrGia,
int  fUseCSat,
int  fVerbose 
)
ABC_DLL void Ntl_ManPrepareCec ( char *  pFileName1,
char *  pFileName2,
Aig_Man_t **  ppMan1,
Aig_Man_t **  ppMan2 
)
ABC_DLL void Ntl_ManPrepareCecMans ( Ntl_Man_t pMan1,
Ntl_Man_t pMan2,
Aig_Man_t **  ppAig1,
Aig_Man_t **  ppAig2 
)
ABC_DLL Aig_Man_t* Ntl_ManPrepareSec ( char *  pFileName1,
char *  pFileName2 
)
ABC_DLL void Ntl_ManPrintStats ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManReadBlif ( char *  pFileName,
int  fCheck 
)

MACRO DEFINITIONS ///.

INLINED FUNCTIONS ///ITERATORS ///FUNCTION DECLARATIONS ///

ABC_DLL Nwk_Man_t* Ntl_ManReadNwk ( char *  pFileName,
Aig_Man_t pAig,
Tim_Man_t pManTime 
)
ABC_DLL Tim_Man_t* Ntl_ManReadTimeMan ( Ntl_Man_t p)
ABC_DLL Ntl_Man_t* Ntl_ManScl ( Ntl_Man_t p,
int  fLatchConst,
int  fLatchEqual,
int  fVerbose 
)
ABC_DLL Ntl_Man_t* Ntl_ManScorr ( Ntl_Man_t p,
Ssw_Pars_t pPars 
)
ABC_DLL Ntl_Man_t* Ntl_ManSsw ( Ntl_Man_t p,
Fra_Ssw_t pPars 
)
ABC_DLL int Ntl_ManSweep ( Ntl_Man_t p,
int  fVerbose 
)
ABC_DLL void Ntl_ManTransformInitValues ( Ntl_Man_t p)
ABC_DLL void Ntl_ManWriteBlif ( Ntl_Man_t p,
char *  pFileName 
)
ABC_DLL void Nwk_ManBidecResyn ( Nwk_Man_t pNtk,
int  fVerbose 
)

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

Synopsis [Resynthesizes nodes using bi-decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file nwkBidec.c.

130 {
131  Bdc_Par_t Pars = {0}, * pPars = &Pars;
132  Bdc_Man_t * p;
133  Nwk_Obj_t * pObj;
134  Vec_Int_t * vTruth;
135  int i, nGainTotal = 0, nNodes1, nNodes2;
136  abctime clk = Abc_Clock();
137  pPars->nVarsMax = Nwk_ManGetFaninMax( pNtk );
138  pPars->fVerbose = fVerbose;
139  if ( pPars->nVarsMax < 2 )
140  {
141  printf( "Resynthesis is not performed for networks whose nodes are less than 2 inputs.\n" );
142  return;
143  }
144  if ( pPars->nVarsMax > 15 )
145  {
146  if ( fVerbose )
147  printf( "Resynthesis is not performed for nodes with more than 15 inputs.\n" );
148  pPars->nVarsMax = 15;
149  }
150  vTruth = Vec_IntAlloc( 0 );
151  p = Bdc_ManAlloc( pPars );
152  Nwk_ManForEachNode( pNtk, pObj, i )
153  {
154  if ( Nwk_ObjFaninNum(pObj) > 15 )
155  continue;
156  nNodes1 = Hop_DagSize(pObj->pFunc);
157  pObj->pFunc = Nwk_NodeIfNodeResyn( p, pNtk->pManHop, pObj->pFunc, Nwk_ObjFaninNum(pObj), vTruth, NULL, -1.0 );
158  nNodes2 = Hop_DagSize(pObj->pFunc);
159  nGainTotal += nNodes1 - nNodes2;
160  }
161  Bdc_ManFree( p );
162  Vec_IntFree( vTruth );
163  if ( fVerbose )
164  {
165  printf( "Total gain in AIG nodes = %d. ", nGainTotal );
166  ABC_PRT( "Total runtime", Abc_Clock() - clk );
167  }
168 }
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Bdc_Man_t * Bdc_ManAlloc(Bdc_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: bdcCore.c:68
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
Hop_Man_t * pManHop
Definition: nwk.h:73
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_DLL int Nwk_ManGetFaninMax(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:71
Definition: bdc.h:45
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Hop_Obj_t * Nwk_NodeIfNodeResyn(Bdc_Man_t *p, Hop_Man_t *pHop, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, unsigned *puCare, float dProb)
FUNCTION DEFINITIONS ///.
Definition: nwkBidec.c:67
void Bdc_ManFree(Bdc_Man_t *p)
Definition: bdcCore.c:113
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL int Nwk_ManCheck ( Nwk_Man_t p)

DECLARATIONS ///.

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

FileName [nwkCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Consistency checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
nwkCheck.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Checking the logic network for consistency.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nwkCheck.c.

46 {
47  Nwk_Obj_t * pObj, * pNext;
48  int i, k, m;
49  // check if the nodes have duplicated fanins
50  Nwk_ManForEachNode( p, pObj, i )
51  {
52  for ( k = 0; k < pObj->nFanins; k++ )
53  for ( m = k + 1; m < pObj->nFanins; m++ )
54  if ( pObj->pFanio[k] == pObj->pFanio[m] )
55  printf( "Node %d has duplicated fanin %d.\n", pObj->Id, pObj->pFanio[k]->Id );
56  }
57  // check if all nodes are in the correct fanin/fanout relationship
58  Nwk_ManForEachObj( p, pObj, i )
59  {
60  Nwk_ObjForEachFanin( pObj, pNext, k )
61  if ( Nwk_ObjFanoutNum(pNext) < 100 && Nwk_ObjFindFanout( pNext, pObj ) == -1 )
62  printf( "Nwk_ManCheck(): Object %d has fanin %d which does not have a corresponding fanout.\n", pObj->Id, pNext->Id );
63  Nwk_ObjForEachFanout( pObj, pNext, k )
64  if ( Nwk_ObjFindFanin( pNext, pObj ) == -1 )
65  printf( "Nwk_ManCheck(): Object %d has fanout %d which does not have a corresponding fanin.\n", pObj->Id, pNext->Id );
66  }
67  return 1;
68 }
ABC_DLL int Nwk_ObjFindFanout(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanout)
Definition: nwkFanio.c:106
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
Definition: nwk.h:201
ABC_DLL int Nwk_ObjFindFanin(Nwk_Obj_t *pObj, Nwk_Obj_t *pFanin)
Definition: nwkFanio.c:85
if(last==0)
Definition: sparse_int.h:34
ABC_NAMESPACE_IMPL_START int Nwk_ManCheck(Nwk_Man_t *p)
DECLARATIONS ///.
Definition: nwkCheck.c:45
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManDumpBlif ( Nwk_Man_t pNtk,
char *  pFileName,
Vec_Ptr_t vPiNames,
Vec_Ptr_t vPoNames 
)

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

Synopsis [Dumps the BLIF file for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file nwkUtil.c.

258 {
259  FILE * pFile;
260  Vec_Ptr_t * vNodes;
261  Vec_Int_t * vTruth;
262  Vec_Int_t * vCover;
263  Nwk_Obj_t * pObj, * pFanin;
264  Aig_MmFlex_t * pMem;
265  char * pSop = NULL;
266  unsigned * pTruth;
267  int i, k, nDigits;
268  if ( Nwk_ManPoNum(pNtk) == 0 )
269  {
270  printf( "Nwk_ManDumpBlif(): Network does not have POs.\n" );
271  return;
272  }
273  // collect nodes in the DFS order
274  nDigits = Abc_Base10Log( Nwk_ManObjNumMax(pNtk) );
275  // write the file
276  pFile = fopen( pFileName, "w" );
277  fprintf( pFile, "# BLIF file written by procedure Nwk_ManDumpBlif()\n" );
278 // fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
279  fprintf( pFile, ".model %s\n", pNtk->pName );
280  // write PIs
281  fprintf( pFile, ".inputs" );
282  Nwk_ManForEachCi( pNtk, pObj, i )
283  if ( vPiNames )
284  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
285  else
286  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
287  fprintf( pFile, "\n" );
288  // write POs
289  fprintf( pFile, ".outputs" );
290  Nwk_ManForEachCo( pNtk, pObj, i )
291  if ( vPoNames )
292  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
293  else
294  fprintf( pFile, " n%0*d", nDigits, pObj->Id );
295  fprintf( pFile, "\n" );
296  // write nodes
297  pMem = Aig_MmFlexStart();
298  vTruth = Vec_IntAlloc( 1 << 16 );
299  vCover = Vec_IntAlloc( 1 << 16 );
300  vNodes = Nwk_ManDfs( pNtk );
301  Vec_PtrForEachEntry( Nwk_Obj_t *, vNodes, pObj, i )
302  {
303  if ( !Nwk_ObjIsNode(pObj) )
304  continue;
305  // derive SOP for the AIG
306  pTruth = Hop_ManConvertAigToTruth( pNtk->pManHop, Hop_Regular(pObj->pFunc), Nwk_ObjFaninNum(pObj), vTruth, 0 );
307  if ( Hop_IsComplement(pObj->pFunc) )
308  Kit_TruthNot( pTruth, pTruth, Nwk_ObjFaninNum(pObj) );
309  pSop = Kit_PlaFromTruth( pMem, pTruth, Nwk_ObjFaninNum(pObj), vCover );
310  // write the node
311  fprintf( pFile, ".names" );
312  if ( !Kit_TruthIsConst0(pTruth, Nwk_ObjFaninNum(pObj)) && !Kit_TruthIsConst1(pTruth, Nwk_ObjFaninNum(pObj)) )
313  {
314  Nwk_ObjForEachFanin( pObj, pFanin, k )
315  if ( vPiNames && Nwk_ObjIsPi(pFanin) )
316  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(pFanin)) );
317  else
318  fprintf( pFile, " n%0*d", nDigits, pFanin->Id );
319  }
320  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
321  // write the function
322  fprintf( pFile, "%s", pSop );
323  }
324  Vec_IntFree( vCover );
325  Vec_IntFree( vTruth );
326  Vec_PtrFree( vNodes );
327  Aig_MmFlexStop( pMem, 0 );
328  // write POs
329  Nwk_ManForEachCo( pNtk, pObj, i )
330  {
331  fprintf( pFile, ".names" );
332  if ( vPiNames && Nwk_ObjIsPi(Nwk_ObjFanin0(pObj)) )
333  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Nwk_ObjPioNum(Nwk_ObjFanin0(pObj))) );
334  else
335  fprintf( pFile, " n%0*d", nDigits, Nwk_ObjFanin0(pObj)->Id );
336  if ( vPoNames )
337  fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Nwk_ObjPioNum(pObj)) );
338  else
339  fprintf( pFile, " n%0*d\n", nDigits, pObj->Id );
340  fprintf( pFile, "%d 1\n", !pObj->fInvert );
341  }
342  fprintf( pFile, ".end\n\n" );
343  fclose( pFile );
344 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Nwk_ManForEachCo(p, pObj, i)
Definition: nwk.h:181
int Nwk_ManPoNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:135
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * Kit_PlaFromTruth(void *p, unsigned *pTruth, int nVars, Vec_Int_t *vCover)
Definition: kitPla.c:337
#define Nwk_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: nwk.h:179
static int Nwk_ObjIsPi(Nwk_Obj_t *p)
Definition: nwk.h:150
static int Kit_TruthIsConst0(unsigned *pIn, int nVars)
Definition: kit.h:315
char * pName
Definition: nwk.h:64
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
Definition: kit.h:323
ABC_DLL Vec_Ptr_t * Nwk_ManDfs(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:321
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static void Kit_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: kit.h:373
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Nwk_ObjPioNum(Nwk_Obj_t *p)
Definition: nwk.h:136
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static int Nwk_ManObjNumMax(Nwk_Man_t *p)
Definition: nwk.h:129
Aig_MmFlex_t * Aig_MmFlexStart()
Definition: aigMem.c:305
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL void Nwk_ManFree ( Nwk_Man_t p)

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

Synopsis [Deallocates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file nwkMan.c.

72 {
73 // printf( "The number of realloced nodes = %d.\n", p->nRealloced );
74  if ( p->pName ) ABC_FREE( p->pName );
75  if ( p->pSpec ) ABC_FREE( p->pSpec );
76  if ( p->vCis ) Vec_PtrFree( p->vCis );
77  if ( p->vCos ) Vec_PtrFree( p->vCos );
78  if ( p->vObjs ) Vec_PtrFree( p->vObjs );
79  if ( p->vTemp ) Vec_PtrFree( p->vTemp );
80  if ( p->pManTime ) Tim_ManStop( p->pManTime );
81  if ( p->pMemObjs ) Aig_MmFlexStop( p->pMemObjs, 0 );
82  if ( p->pManHop ) Hop_ManStop( p->pManHop );
83  ABC_FREE( p );
84 }
char * pSpec
Definition: nwk.h:65
Aig_MmFlex_t * pMemObjs
Definition: nwk.h:76
Vec_Ptr_t * vCos
Definition: nwk.h:68
char * pName
Definition: nwk.h:64
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
Vec_Ptr_t * vCis
Definition: nwk.h:67
Hop_Man_t * pManHop
Definition: nwk.h:73
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
Tim_Man_t * pManTime
Definition: nwk.h:74
Vec_Ptr_t * vObjs
Definition: nwk.h:69
Vec_Ptr_t * vTemp
Definition: nwk.h:77
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Vec_Int_t* Nwk_ManLutMerge ( Nwk_Man_t pNtk,
void *  pParsInit 
)

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

Synopsis [Performs LUT merging with parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 970 of file nwkMerge.c.

971 {
972  Nwk_LMPars_t * pPars = (Nwk_LMPars_t *)pParsInit;
973  Nwk_Grf_t * p;
974  Vec_Int_t * vResult;
975  Vec_Ptr_t * vStart, * vNext, * vCands1, * vCands2;
976  Nwk_Obj_t * pLut, * pCand;
977  int i, k, nVertsMax, nCands;
978  abctime clk = Abc_Clock();
979  // count the number of vertices
980  nVertsMax = 0;
981  Nwk_ManForEachNode( pNtk, pLut, i )
982  nVertsMax += (int)(Nwk_ObjFaninNum(pLut) <= pPars->nMaxLutSize);
983  p = Nwk_ManGraphAlloc( nVertsMax );
984  // create graph
985  vStart = Vec_PtrAlloc( 1000 );
986  vNext = Vec_PtrAlloc( 1000 );
987  vCands1 = Vec_PtrAlloc( 1000 );
988  vCands2 = Vec_PtrAlloc( 1000 );
989  nCands = 0;
990  Nwk_ManForEachNode( pNtk, pLut, i )
991  {
992  if ( Nwk_ObjFaninNum(pLut) > pPars->nMaxLutSize )
993  continue;
994  Nwk_ManCollectOverlapCands( pLut, vCands1, pPars );
995  if ( pPars->fUseDiffSupp )
996  Nwk_ManCollectNonOverlapCands( pLut, vStart, vNext, vCands2, pPars );
997  if ( Vec_PtrSize(vCands1) == 0 && Vec_PtrSize(vCands2) == 0 )
998  continue;
999  nCands += Vec_PtrSize(vCands1) + Vec_PtrSize(vCands2);
1000  // save candidates
1001  Vec_PtrForEachEntry( Nwk_Obj_t *, vCands1, pCand, k )
1002  Nwk_ManGraphHashEdge( p, Nwk_ObjId(pLut), Nwk_ObjId(pCand) );
1003  Vec_PtrForEachEntry( Nwk_Obj_t *, vCands2, pCand, k )
1004  Nwk_ManGraphHashEdge( p, Nwk_ObjId(pLut), Nwk_ObjId(pCand) );
1005  // print statistics about this node
1006  if ( pPars->fVeryVerbose )
1007  printf( "Node %6d : Fanins = %d. Fanouts = %3d. Cand1 = %3d. Cand2 = %3d.\n",
1008  Nwk_ObjId(pLut), Nwk_ObjFaninNum(pLut), Nwk_ObjFaninNum(pLut),
1009  Vec_PtrSize(vCands1), Vec_PtrSize(vCands2) );
1010  }
1011  Vec_PtrFree( vStart );
1012  Vec_PtrFree( vNext );
1013  Vec_PtrFree( vCands1 );
1014  Vec_PtrFree( vCands2 );
1015  if ( pPars->fVerbose )
1016  {
1017  printf( "Mergable LUTs = %6d. Total cands = %6d. ", p->nVertsMax, nCands );
1018  ABC_PRT( "Deriving graph", Abc_Clock() - clk );
1019  }
1020  // solve the graph problem
1021  clk = Abc_Clock();
1022  Nwk_ManGraphSolve( p );
1023  if ( pPars->fVerbose )
1024  {
1025  printf( "GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
1026  p->nVerts, p->nEdges, Vec_IntSize(p->vPairs)/2 );
1027  ABC_PRT( "Solving", Abc_Clock() - clk );
1029  }
1030  vResult = p->vPairs; p->vPairs = NULL;
1031 /*
1032  for ( i = 0; i < vResult->nSize; i += 2 )
1033  printf( "(%d,%d) ", vResult->pArray[i], vResult->pArray[i+1] );
1034  printf( "\n" );
1035 */
1036  Nwk_ManGraphFree( p );
1037  return vResult;
1038 }
void Nwk_ManGraphReportMemoryUsage(Nwk_Grf_t *p)
Definition: nwkMerge.c:93
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int fUseDiffSupp
Definition: nwkMerge.h:53
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Nwk_ObjId(Nwk_Obj_t *p)
Definition: nwk.h:135
void Nwk_ManGraphFree(Nwk_Grf_t *p)
Definition: nwkMerge.c:70
void Nwk_ManGraphSolve(Nwk_Grf_t *p)
Definition: nwkMerge.c:621
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
void Nwk_ManCollectOverlapCands(Nwk_Obj_t *pLut, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
Definition: nwkMerge.c:920
void Nwk_ManGraphHashEdge(Nwk_Grf_t *p, int iLut1, int iLut2)
Definition: nwkMerge.c:119
ABC_NAMESPACE_IMPL_START Nwk_Grf_t * Nwk_ManGraphAlloc(int nVertsMax)
DECLARATIONS ///.
Definition: nwkMerge.c:46
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Nwk_ManCollectNonOverlapCands(Nwk_Obj_t *pLut, Vec_Ptr_t *vStart, Vec_Ptr_t *vNext, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
Definition: nwkMerge.c:830
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int nMaxLutSize
Definition: nwkMerge.h:48
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
int fVerbose
Definition: nwkMerge.h:56
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManPrintFanioNew ( Nwk_Man_t pNtk)

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

Synopsis [Prints the distribution of fanins/fanouts in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 357 of file nwkUtil.c.

358 {
359  char Buffer[100];
360  Nwk_Obj_t * pNode;
361  Vec_Int_t * vFanins, * vFanouts;
362  int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
363  int i, k, nSizeMax;
364 
365  // determine the largest fanin and fanout
366  nFaninsMax = nFanoutsMax = 0;
367  nFaninsAll = nFanoutsAll = 0;
368  Nwk_ManForEachNode( pNtk, pNode, i )
369  {
370  nFanins = Nwk_ObjFaninNum(pNode);
371  nFanouts = Nwk_ObjFanoutNum(pNode);
372  nFaninsAll += nFanins;
373  nFanoutsAll += nFanouts;
374  nFaninsMax = Abc_MaxInt( nFaninsMax, nFanins );
375  nFanoutsMax = Abc_MaxInt( nFanoutsMax, nFanouts );
376  }
377 
378  // allocate storage for fanin/fanout numbers
379  nSizeMax = Abc_MaxInt( 10 * (Abc_Base10Log(nFaninsMax) + 1), 10 * (Abc_Base10Log(nFanoutsMax) + 1) );
380  vFanins = Vec_IntStart( nSizeMax );
381  vFanouts = Vec_IntStart( nSizeMax );
382 
383  // count the number of fanins and fanouts
384  Nwk_ManForEachNode( pNtk, pNode, i )
385  {
386  nFanins = Nwk_ObjFaninNum(pNode);
387  nFanouts = Nwk_ObjFanoutNum(pNode);
388 // nFanouts = Nwk_NodeMffcSize(pNode);
389 
390  if ( nFanins < 10 )
391  Vec_IntAddToEntry( vFanins, nFanins, 1 );
392  else if ( nFanins < 100 )
393  Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
394  else if ( nFanins < 1000 )
395  Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
396  else if ( nFanins < 10000 )
397  Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
398  else if ( nFanins < 100000 )
399  Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
400  else if ( nFanins < 1000000 )
401  Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
402  else if ( nFanins < 10000000 )
403  Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
404 
405  if ( nFanouts < 10 )
406  Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
407  else if ( nFanouts < 100 )
408  Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
409  else if ( nFanouts < 1000 )
410  Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
411  else if ( nFanouts < 10000 )
412  Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
413  else if ( nFanouts < 100000 )
414  Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
415  else if ( nFanouts < 1000000 )
416  Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
417  else if ( nFanouts < 10000000 )
418  Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
419  }
420 
421  printf( "The distribution of fanins and fanouts in the network:\n" );
422  printf( " Number Nodes with fanin Nodes with fanout\n" );
423  for ( k = 0; k < nSizeMax; k++ )
424  {
425  if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
426  continue;
427  if ( k < 10 )
428  printf( "%15d : ", k );
429  else
430  {
431  sprintf( Buffer, "%d - %d", (int)pow((double)10, k/10) * (k%10), (int)pow((double)10, k/10) * (k%10+1) - 1 );
432  printf( "%15s : ", Buffer );
433  }
434  if ( vFanins->pArray[k] == 0 )
435  printf( " " );
436  else
437  printf( "%12d ", vFanins->pArray[k] );
438  printf( " " );
439  if ( vFanouts->pArray[k] == 0 )
440  printf( " " );
441  else
442  printf( "%12d ", vFanouts->pArray[k] );
443  printf( "\n" );
444  }
445  Vec_IntFree( vFanins );
446  Vec_IntFree( vFanouts );
447 
448  printf( "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
449  nFaninsMax, 1.0*nFaninsAll/Nwk_ManNodeNum(pNtk),
450  nFanoutsMax, 1.0*nFanoutsAll/Nwk_ManNodeNum(pNtk) );
451 }
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
Definition: nwk.h:138
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
Definition: nwk.h:137
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
char * sprintf()
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL void Nwk_ManPrintStats ( Nwk_Man_t pNtk,
If_LibLut_t pLutLib,
int  fSaveBest,
int  fDumpResult,
int  fPower,
Ntl_Man_t pNtl 
)

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

Synopsis [Prints stats of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file nwkMan.c.

235 {
236 // extern int Ntl_ManLatchNum( Ntl_Man_t * p );
237 // extern void Ntl_ManWriteBlifLogic( Nwk_Man_t * pNtk, void * pNtl, char * pFileName );
238  if ( fSaveBest )
239  Nwk_ManCompareAndSaveBest( pNtk, pNtl );
240  if ( fDumpResult )
241  {
242  char Buffer[1000] = {0};
243  const char * pNameGen = pNtk->pSpec? Nwk_FileNameGeneric( pNtk->pSpec ) : "nameless_";
244  sprintf( Buffer, "%s_dump.blif", pNameGen );
245 // Ntl_ManWriteBlifLogic( pNtk, pNtl, Buffer );
246 // sprintf( Buffer, "%s_dump_map.blif", pNameGen );
247 // Nwk_ManDumpBlif( pNtk, Buffer, NULL, NULL );
248  if ( pNtk->pSpec ) ABC_FREE( pNameGen );
249  }
250 
251  pNtk->pLutLib = pLutLib;
252  printf( "%-15s : ", pNtk->pName );
253  printf( "pi = %5d ", Nwk_ManPiNum(pNtk) );
254  printf( "po = %5d ", Nwk_ManPoNum(pNtk) );
255  printf( "ci = %5d ", Nwk_ManCiNum(pNtk) );
256  printf( "co = %5d ", Nwk_ManCoNum(pNtk) );
257 // printf( "lat = %5d ", Ntl_ManLatchNum(pNtl) );
258  printf( "node = %5d ", Nwk_ManNodeNum(pNtk) );
259  printf( "edge = %5d ", Nwk_ManGetTotalFanins(pNtk) );
260  printf( "aig = %6d ", Nwk_ManGetAigNodeNum(pNtk) );
261  printf( "lev = %3d ", Nwk_ManLevel(pNtk) );
262 // printf( "lev2 = %3d ", Nwk_ManLevelBackup(pNtk) );
263  printf( "delay = %5.2f ", Nwk_ManDelayTraceLut(pNtk) );
264  if ( fPower )
265  printf( "power = %7.2f ", Nwl_ManComputeTotalSwitching(pNtk) );
266  Nwk_ManPrintLutSizes( pNtk, pLutLib );
267  printf( "\n" );
268 // Nwk_ManDelayTracePrint( pNtk, pLutLib );
269  fflush( stdout );
270 }
ABC_DLL int Nwk_ManLevel(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:215
ABC_DLL int Nwk_ManPoNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:135
char * pSpec
Definition: nwk.h:65
char * pName
Definition: nwk.h:64
ABC_DLL int Nwk_ManGetAigNodeNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:155
char * Nwk_FileNameGeneric(char *FileName)
Definition: nwkMan.c:178
If_LibLut_t * pLutLib
Definition: nwk.h:75
ABC_DLL int Nwk_ManPiNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:115
char * sprintf()
static int Nwk_ManCiNum(Nwk_Man_t *p)
MACRO DEFINITIONS ///.
Definition: nwk.h:125
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Nwk_ManCompareAndSaveBest(Nwk_Man_t *pNtk, void *pNtl)
Definition: nwkMan.c:121
ABC_DLL float Nwk_ManDelayTraceLut(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:326
float Nwl_ManComputeTotalSwitching(Nwk_Man_t *pNtk)
Definition: nwkMan.c:198
ABC_DLL int Nwk_ManGetTotalFanins(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:94
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
void Nwk_ManPrintLutSizes(Nwk_Man_t *p, If_LibLut_t *pLutLib)
Definition: nwkMan.c:97
static int Nwk_ManCoNum(Nwk_Man_t *p)
Definition: nwk.h:126
ABC_DLL void Nwk_ManPrintStatsShort ( Ntl_Man_t p,
Aig_Man_t pAig,
Nwk_Man_t pNtk 
)
ABC_DLL void Nwk_ManSetIfParsDefault ( If_Par_t pPars)

DECLARATIONS ///.

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

FileName [nwkMap.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [Interface to technology mapping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
nwkMap.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Load the network into FPGA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file nwkMap.c.

47 {
48 // extern void * Abc_FrameReadLibLut();
49  // set defaults
50  memset( pPars, 0, sizeof(If_Par_t) );
51  // user-controlable paramters
52 // pPars->nLutSize = -1;
53  pPars->nLutSize = 6;
54  pPars->nCutsMax = 8;
55  pPars->nFlowIters = 1;
56  pPars->nAreaIters = 2;
57  pPars->DelayTarget = -1;
58  pPars->Epsilon = (float)0.005;
59  pPars->fPreprocess = 1;
60  pPars->fArea = 0;
61  pPars->fFancy = 0;
62  pPars->fExpRed = 1; ////
63  pPars->fLatchPaths = 0;
64  pPars->fEdge = 1;
65  pPars->fPower = 0;
66  pPars->fCutMin = 0;
67  pPars->fVerbose = 0;
68  // internal parameters
69  pPars->fTruth = 0;
70  pPars->nLatchesCi = 0;
71  pPars->nLatchesCo = 0;
72  pPars->fLiftLeaves = 0;
73 // pPars->pLutLib = Abc_FrameReadLibLut();
74  pPars->pLutLib = NULL;
75  pPars->pTimesArr = NULL;
76  pPars->pTimesArr = NULL;
77  pPars->pFuncCost = NULL;
78 /*
79  if ( pPars->nLutSize == -1 )
80  {
81  if ( pPars->pLutLib == NULL )
82  {
83  printf( "The LUT library is not given.\n" );
84  return;
85  }
86  // get LUT size from the library
87  pPars->nLutSize = pPars->pLutLib->LutMax;
88  }
89 */
90 }
char * memset()
int nLutSize
Definition: if.h:103
Definition: if.h:100
int fVerbose
Definition: if.h:140
int(* pFuncCost)(If_Man_t *, If_Cut_t *)
Definition: if.h:163
int nLatchesCi
Definition: if.h:152
int fExpRed
Definition: if.h:116
int nFlowIters
Definition: if.h:105
int fEdge
Definition: if.h:118
int fPreprocess
Definition: if.h:113
int fTruth
Definition: if.h:146
int fLatchPaths
Definition: if.h:117
float * pTimesArr
Definition: if.h:161
float Epsilon
Definition: if.h:110
int fFancy
Definition: if.h:115
float DelayTarget
Definition: if.h:109
int nLatchesCo
Definition: if.h:153
int nAreaIters
Definition: if.h:106
int fPower
Definition: if.h:119
int fCutMin
Definition: if.h:120
int nCutsMax
Definition: if.h:104
int fArea
Definition: if.h:114
int fLiftLeaves
Definition: if.h:156
If_LibLut_t * pLutLib
Definition: if.h:160
ABC_DLL Aig_Man_t* Nwk_ManSpeedup ( Nwk_Man_t pNtk,
int  fUseLutLib,
int  Percentage,
int  Degree,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Adds choices to speed up the network by the given percentage.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file nwkSpeedup.c.

204 {
205  Aig_Man_t * pAig, * pTemp;
206  Vec_Ptr_t * vTimeCries, * vTimeFanins;
207  Nwk_Obj_t * pNode, * pFanin, * pFanin2;
208  Aig_Obj_t * pAnd;
209  If_LibLut_t * pTempLib = pNtk->pLutLib;
210  Tim_Man_t * pTempTim = NULL;
211  float tDelta, tArrival;
212  int i, k, k2, Counter, CounterRes, nTimeCris;
213  unsigned * puTCEdges;
214  // perform delay trace
215  if ( !fUseLutLib )
216  {
217  pNtk->pLutLib = NULL;
218  if ( pNtk->pManTime )
219  {
220  pTempTim = pNtk->pManTime;
221  pNtk->pManTime = Tim_ManDup( pTempTim, 1 );
222  }
223  }
224  tArrival = Nwk_ManDelayTraceLut( pNtk );
225  tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
226  if ( fVerbose )
227  {
228  printf( "Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
229  printf( "Using %s model. ", fUseLutLib? "LUT library" : "unit-delay" );
230  if ( fUseLutLib )
231  printf( "Percentage = %d. ", Percentage );
232  printf( "\n" );
233  }
234  // mark the timing critical nodes and edges
235  puTCEdges = ABC_ALLOC( unsigned, Nwk_ManObjNumMax(pNtk) );
236  memset( puTCEdges, 0, sizeof(unsigned) * Nwk_ManObjNumMax(pNtk) );
237  Nwk_ManForEachNode( pNtk, pNode, i )
238  {
239  if ( Nwk_ObjSlack(pNode) >= tDelta )
240  continue;
241  puTCEdges[pNode->Id] = Nwk_ManDelayTraceTCEdges( pNtk, pNode, tDelta, fUseLutLib );
242  }
243  if ( fVerbose )
244  {
245  Counter = CounterRes = 0;
246  Nwk_ManForEachNode( pNtk, pNode, i )
247  {
248  Nwk_ObjForEachFanin( pNode, pFanin, k )
249  if ( !Nwk_ObjIsCi(pFanin) && Nwk_ObjSlack(pFanin) < tDelta )
250  Counter++;
251  CounterRes += Aig_WordCountOnes( puTCEdges[pNode->Id] );
252  }
253  printf( "Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
254  Nwk_ManGetTotalFanins(pNtk), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
255  }
256  // start the resulting network
257  pAig = Nwk_ManStrash( pNtk );
258  pAig->pEquivs = ABC_ALLOC( Aig_Obj_t *, 3 * Aig_ManObjNumMax(pAig) );
259  memset( pAig->pEquivs, 0, sizeof(Aig_Obj_t *) * 3 * Aig_ManObjNumMax(pAig) );
260 
261  // collect nodes to be used for resynthesis
262  Counter = CounterRes = 0;
263  vTimeCries = Vec_PtrAlloc( 16 );
264  vTimeFanins = Vec_PtrAlloc( 16 );
265  Nwk_ManForEachNode( pNtk, pNode, i )
266  {
267  if ( Nwk_ObjSlack(pNode) >= tDelta )
268  continue;
269  // count the number of non-PI timing-critical nodes
270  nTimeCris = 0;
271  Nwk_ObjForEachFanin( pNode, pFanin, k )
272  if ( !Nwk_ObjIsCi(pFanin) && (puTCEdges[pNode->Id] & (1<<k)) )
273  nTimeCris++;
274  if ( !fVeryVerbose && nTimeCris == 0 )
275  continue;
276  Counter++;
277  // count the total number of timing critical second-generation nodes
278  Vec_PtrClear( vTimeCries );
279  if ( nTimeCris )
280  {
281  Nwk_ObjForEachFanin( pNode, pFanin, k )
282  if ( !Nwk_ObjIsCi(pFanin) && (puTCEdges[pNode->Id] & (1<<k)) )
283  Nwk_ObjForEachFanin( pFanin, pFanin2, k2 )
284  if ( puTCEdges[pFanin->Id] & (1<<k2) )
285  Vec_PtrPushUnique( vTimeCries, pFanin2 );
286  }
287 // if ( !fVeryVerbose && (Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree) )
288  if ( (Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree) )
289  continue;
290  CounterRes++;
291  // collect second generation nodes
292  Vec_PtrClear( vTimeFanins );
293  Nwk_ObjForEachFanin( pNode, pFanin, k )
294  {
295  if ( Nwk_ObjIsCi(pFanin) )
296  Vec_PtrPushUnique( vTimeFanins, pFanin );
297  else
298  Nwk_ObjForEachFanin( pFanin, pFanin2, k2 )
299  Vec_PtrPushUnique( vTimeFanins, pFanin2 );
300  }
301  // print the results
302  if ( fVeryVerbose )
303  {
304  printf( "%5d Node %5d : %d %2d %2d ", Counter, pNode->Id,
305  nTimeCris, Vec_PtrSize(vTimeCries), Vec_PtrSize(vTimeFanins) );
306  Nwk_ObjForEachFanin( pNode, pFanin, k )
307  printf( "%d(%.2f)%s ", pFanin->Id, Nwk_ObjSlack(pFanin), (puTCEdges[pNode->Id] & (1<<k))? "*":"" );
308  printf( "\n" );
309  }
310  // add the node to choices
311  if ( Vec_PtrSize(vTimeCries) == 0 || Vec_PtrSize(vTimeCries) > Degree )
312  continue;
313  // order the fanins in the increasing order of criticalily
314  if ( Vec_PtrSize(vTimeCries) > 1 )
315  {
316  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 0 );
317  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
318  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
319  {
320  Vec_PtrWriteEntry( vTimeCries, 0, pFanin2 );
321  Vec_PtrWriteEntry( vTimeCries, 1, pFanin );
322  }
323  }
324  if ( Vec_PtrSize(vTimeCries) > 2 )
325  {
326  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
327  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 2 );
328  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
329  {
330  Vec_PtrWriteEntry( vTimeCries, 1, pFanin2 );
331  Vec_PtrWriteEntry( vTimeCries, 2, pFanin );
332  }
333  pFanin = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 0 );
334  pFanin2 = (Nwk_Obj_t *)Vec_PtrEntry( vTimeCries, 1 );
335  if ( Nwk_ObjSlack(pFanin) < Nwk_ObjSlack(pFanin2) )
336  {
337  Vec_PtrWriteEntry( vTimeCries, 0, pFanin2 );
338  Vec_PtrWriteEntry( vTimeCries, 1, pFanin );
339  }
340  }
341  // add choice
342  Aig_ManSpeedupNode( pNtk, pAig, pNode, vTimeFanins, vTimeCries );
343  }
344  Vec_PtrFree( vTimeCries );
345  Vec_PtrFree( vTimeFanins );
346  ABC_FREE( puTCEdges );
347  if ( fVerbose )
348  printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
349  Nwk_ManNodeNum(pNtk), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
350 
351  // remove invalid choice nodes
352  Aig_ManForEachNode( pAig, pAnd, i )
353  if ( Aig_ObjEquiv(pAig, pAnd) )
354  {
355  if ( Aig_ObjRefs(Aig_ObjEquiv(pAig, pAnd)) > 0 )
356  pAig->pEquivs[pAnd->Id] = NULL;
357  }
358 
359  // put back the library
360  if ( !fUseLutLib )
361  pNtk->pLutLib = pTempLib;
362  if ( pTempTim )
363  {
364  Tim_ManStop( pNtk->pManTime );
365  pNtk->pManTime = pTempTim;
366  }
367 
368  // reconstruct the network
369  pAig = Aig_ManDupDfs( pTemp = pAig );
370  Aig_ManStop( pTemp );
371  // reset levels
372  Aig_ManChoiceLevel( pAig );
373  return pAig;
374 }
char * memset()
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
static float Nwk_ObjSlack(Nwk_Obj_t *pObj)
Definition: nwk.h:157
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
ABC_DLL Aig_Man_t * Nwk_ManStrash(Nwk_Man_t *p)
Definition: nwkStrash.c:99
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Aig_ManChoiceLevel(Aig_Man_t *p)
Definition: aigDfs.c:581
static int Aig_WordCountOnes(unsigned uWord)
Definition: aig.h:229
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
If_LibLut_t * pLutLib
Definition: nwk.h:75
void Aig_ManSpeedupNode(Nwk_Man_t *pNtk, Aig_Man_t *pAig, Nwk_Obj_t *pNode, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vTimes)
Definition: nwkSpeedup.c:72
if(last==0)
Definition: sparse_int.h:34
static Aig_Obj_t * Aig_ObjEquiv(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:328
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
static int Counter
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
Tim_Man_t * pManTime
Definition: nwk.h:74
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
unsigned Nwk_ManDelayTraceTCEdges(Nwk_Man_t *pNtk, Nwk_Obj_t *pNode, float tDelta, int fUseLutLib)
Definition: nwkSpeedup.c:158
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
Definition: nwk.h:199
static int Nwk_ManObjNumMax(Nwk_Man_t *p)
Definition: nwk.h:129
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL float Nwk_ManDelayTraceLut(Nwk_Man_t *pNtk)
Definition: nwkTiming.c:326
ABC_DLL int Nwk_ManGetTotalFanins(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:94
static int Nwk_ManNodeNum(Nwk_Man_t *p)
Definition: nwk.h:127
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Nwk_ManForEachNode(p, pObj, i)
Definition: nwk.h:192
ABC_DLL Aig_Man_t* Nwk_ManStrash ( Nwk_Man_t pNtk)

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

Synopsis [Derives AIG from the logic network.]

Description [Assumes topological ordering of nodes.]

SideEffects []

SeeAlso []

Definition at line 99 of file nwkStrash.c.

100 {
101  Vec_Ptr_t * vObjs;
102  Aig_Man_t * pMan;
103  Aig_Obj_t * pObjNew;
104  Nwk_Obj_t * pObj;
105  int i, Level;
106  pMan = Aig_ManStart( Nwk_ManGetAigNodeNum(pNtk) );
107  pMan->pName = Abc_UtilStrsav( pNtk->pName );
108  pMan->pSpec = Abc_UtilStrsav( pNtk->pSpec );
109  pMan->pManTime = Tim_ManDup( (Tim_Man_t *)pNtk->pManTime, 1 );
110  Tim_ManIncrementTravId( (Tim_Man_t *)pMan->pManTime );
111  Nwk_ManForEachObj( pNtk, pObj, i )
112  pObj->pCopy = NULL;
113 // Nwk_ManForEachObj( pNtk, pObj, i )
114  vObjs = Nwk_ManDfs( pNtk );
115  Vec_PtrForEachEntry( Nwk_Obj_t *, vObjs, pObj, i )
116  {
117  if ( Nwk_ObjIsCi(pObj) )
118  {
119  pObjNew = Aig_ObjCreateCi(pMan);
120  Level = Tim_ManGetCiArrival( (Tim_Man_t *)pMan->pManTime, pObj->PioId );
121  Aig_ObjSetLevel( pObjNew, Level );
122  }
123  else if ( Nwk_ObjIsCo(pObj) )
124  {
125  pObjNew = Aig_ObjCreateCo( pMan, Aig_NotCond((Aig_Obj_t *)Nwk_ObjFanin0(pObj)->pCopy, pObj->fInvert) );
126  Level = Aig_ObjLevel( pObjNew );
127  Tim_ManSetCoArrival( (Tim_Man_t *)pMan->pManTime, pObj->PioId, (float)Level );
128  }
129  else if ( Nwk_ObjIsNode(pObj) )
130  {
131  pObjNew = Nwk_ManStrashNode( pMan, pObj );
132  }
133  else
134  assert( 0 );
135  pObj->pCopy = pObjNew;
136  }
137  Vec_PtrFree( vObjs );
138  Aig_ManCleanup( pMan );
139  Aig_ManSetRegNum( pMan, 0 );
140  return pMan;
141 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
static int Aig_ObjSetLevel(Aig_Obj_t *pObj, int i)
Definition: aig.h:325
static int Nwk_ObjIsCi(Nwk_Obj_t *p)
Definition: nwk.h:146
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition: timTrav.c:44
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
Definition: nwk.h:49
char * pSpec
Definition: nwk.h:65
Aig_Obj_t * Nwk_ManStrashNode(Aig_Man_t *p, Nwk_Obj_t *pObj)
Definition: nwkStrash.c:68
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:116
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
char * pName
Definition: nwk.h:64
ABC_DLL int Nwk_ManGetAigNodeNum(Nwk_Man_t *pNtk)
Definition: nwkUtil.c:155
ABC_DLL Vec_Ptr_t * Nwk_ManDfs(Nwk_Man_t *pNtk)
Definition: nwkDfs.c:321
static int Nwk_ObjIsCo(Nwk_Obj_t *p)
Definition: nwk.h:147
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
Definition: aig.h:69
Tim_Man_t * pManTime
Definition: nwk.h:74
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
Definition: nwk.h:148
#define Nwk_ManForEachObj(p, pObj, i)
Definition: nwk.h:189
static int Aig_ObjLevel(Aig_Obj_t *pObj)
Definition: aig.h:323
static Nwk_Obj_t * Nwk_ObjFanin0(Nwk_Obj_t *p)
Definition: nwk.h:140
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_DLL Nwk_Man_t* Nwk_MappingIf ( Aig_Man_t p,
Tim_Man_t pManTime,
If_Par_t pPars 
)

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

Synopsis [Interface with the FPGA mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file nwkMap.c.

361 {
362  Nwk_Man_t * pNtk;
363  If_Man_t * pIfMan;
364  Vec_Ptr_t * vAigToIf;
365  // set the arrival times
366  pPars->pTimesArr = ABC_ALLOC( float, Aig_ManCiNum(p) );
367  memset( pPars->pTimesArr, 0, sizeof(float) * Aig_ManCiNum(p) );
368  // translate into the mapper
369  vAigToIf = Vec_PtrStart( Aig_ManObjNumMax(p) );
370  pIfMan = Nwk_ManToIf( p, pPars, vAigToIf );
371  if ( pIfMan == NULL )
372  return NULL;
373  pIfMan->pManTim = Tim_ManDup( pManTime, 0 );
374  pIfMan->pPars->fCutMin = 0; // is not compatible with deriving result
375  if ( !If_ManPerformMapping( pIfMan ) )
376  {
377  If_ManStop( pIfMan );
378  return NULL;
379  }
380  // transform the result of mapping into the new network
381  pNtk = Nwk_ManFromIf( pIfMan, p, vAigToIf );
382  if ( pPars->fBidec && pPars->nLutSize <= 8 )
383  Nwk_ManBidecResyn( pNtk, 0 );
384  If_ManStop( pIfMan );
385  Vec_PtrFree( vAigToIf );
386  return pNtk;
387 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int nLutSize
Definition: if.h:103
static Llb_Mgr_t * p
Definition: llb3Image.c:950
If_Man_t * Nwk_ManToIf(Aig_Man_t *p, If_Par_t *pPars, Vec_Ptr_t *vAigToIf)
Definition: nwkMap.c:103
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Tim_Man_t * pManTim
Definition: if.h:263
Definition: nwk.h:61
Definition: if.h:180
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
float * pTimesArr
Definition: if.h:161
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
int fBidec
Definition: if.h:125
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
If_Par_t * pPars
Definition: if.h:184
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
ABC_DLL void Nwk_ManBidecResyn(Nwk_Man_t *p, int fVerbose)
Definition: nwkBidec.c:129
int fCutMin
Definition: if.h:120
Nwk_Man_t * Nwk_ManFromIf(If_Man_t *pIfMan, Aig_Man_t *p, Vec_Ptr_t *vAigToIf)
Definition: nwkMap.c:275
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223