abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcTim.c File Reference
#include "base/abc/abc.h"
#include "aig/gia/giaAig.h"
#include "misc/tim/tim.h"
#include "opt/dar/dar.h"
#include "proof/dch/dch.h"
#include "base/main/main.h"

Go to the source code of this file.

Macros

#define TIM_TEST_BOX_RATIO   200
 DECLARATIONS ///. More...
 

Functions

static int Abc_NodeIsWhiteBox (Abc_Obj_t *pObj)
 
void Abc_NtkTestTimNodeStrash_rec (Gia_Man_t *pGia, Hop_Obj_t *pObj)
 FUNCTION DEFINITIONS ///. More...
 
int Abc_NtkTestTimNodeStrash (Gia_Man_t *pGia, Abc_Obj_t *pNode)
 
void Abc_NtkTestTimCollectCone_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tAbc_NtkTestTimCollectCone (Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
 
Vec_Flt_tAbc_NtkTestCreateArrivals (int nInputs)
 
Vec_Flt_tAbc_NtkTestCreateRequired (int nOutputs)
 
Gia_Man_tAbc_NtkTestTimDeriveGia (Abc_Ntk_t *pNtk, int fVerbose)
 
Gia_Man_tAbc_NtkTestTimPerformSynthesis (Gia_Man_t *p, int fChoices)
 
void Gia_ManVerifyChoices (Gia_Man_t *p)
 
void Gia_ManReverseClasses (Gia_Man_t *p, int fNowIncreasing)
 
void Abc_NtkTestTimByWritingFile (Gia_Man_t *pGia, char *pFileName)
 
void Abc_NtkTestTim (Abc_Ntk_t *pNtk, int fVerbose)
 

Macro Definition Documentation

#define TIM_TEST_BOX_RATIO   200

DECLARATIONS ///.

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

FileName [abcTim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Testing hierarchy/timing manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 34 of file abcTim.c.

Function Documentation

static int Abc_NodeIsWhiteBox ( Abc_Obj_t pObj)
inlinestatic

Definition at line 37 of file abcTim.c.

37 { assert( Abc_ObjIsNode(pObj) ); return Abc_ObjId(pObj) % TIM_TEST_BOX_RATIO == 0 && Abc_ObjFaninNum(pObj) > 0 && Abc_ObjFaninNum(pObj) < 10; }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define assert(ex)
Definition: util_old.h:213
#define TIM_TEST_BOX_RATIO
DECLARATIONS ///.
Definition: abcTim.c:34
Vec_Flt_t* Abc_NtkTestCreateArrivals ( int  nInputs)

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

Synopsis [Create arrival times]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file abcTim.c.

242 {
243  Vec_Flt_t * p;
244  int i;
245  p = Vec_FltAlloc( nInputs );
246  for ( i = 0; i < nInputs; i++ )
247  Vec_FltPush( p, 1.0*(i % 10) );
248  return p;
249 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
Vec_Flt_t* Abc_NtkTestCreateRequired ( int  nOutputs)

Definition at line 250 of file abcTim.c.

251 {
252  Vec_Flt_t * p;
253  int i;
254  p = Vec_FltAlloc( nOutputs );
255  for ( i = 0; i < nOutputs; i++ )
256  Vec_FltPush( p, 100.0 + 1.0*i );
257  return p;
258 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
void Abc_NtkTestTim ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Tests construction and serialization.]

Description []

SideEffects []

SeeAlso []

Definition at line 596 of file abcTim.c.

597 {
598  int fUseChoices = 0;
599  Gia_Man_t * pGia, * pTemp;
600 
601  // this test only works for a logic network (for example, network with LUT mapping)
602  assert( Abc_NtkIsLogic(pNtk) );
603  // make sure local functions of the nodes are in the AIG form
604  Abc_NtkToAig( pNtk );
605 
606  // create GIA manager (pGia) with hierarhy/timing manager attached (pGia->pManTime)
607  // while assuming that some nodes are white boxes (see Abc_NodeIsWhiteBox)
608  pGia = Abc_NtkTestTimDeriveGia( pNtk, fVerbose );
609  printf( "Created GIA manager for network with %d white boxes.\n", Tim_ManBoxNum((Tim_Man_t *)pGia->pManTime) );
610 
611  // print the timing manager
612  if ( fVerbose )
613  Tim_ManPrint( (Tim_Man_t *)pGia->pManTime );
614 
615  // test writing both managers into a file and reading them back
616  Abc_NtkTestTimByWritingFile( pGia, "test1.aig" );
617 
618  // perform synthesis
619  pGia = Abc_NtkTestTimPerformSynthesis( pTemp = pGia, fUseChoices );
620  Gia_ManStop( pTemp );
621 
622  // test writing both managers into a file and reading them back
623  Abc_NtkTestTimByWritingFile( pGia, "test2.aig" );
624 
625  Gia_ManStop( pGia );
626 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Tim_ManPrint(Tim_Man_t *p)
Definition: timMan.c:523
Gia_Man_t * Abc_NtkTestTimDeriveGia(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcTim.c:271
void * pManTime
Definition: gia.h:165
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
Gia_Man_t * Abc_NtkTestTimPerformSynthesis(Gia_Man_t *p, int fChoices)
Definition: abcTim.c:413
void Abc_NtkTestTimByWritingFile(Gia_Man_t *pGia, char *pFileName)
Definition: abcTim.c:552
Definition: gia.h:95
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition: abcFunc.c:1192
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Abc_NtkTestTimByWritingFile ( Gia_Man_t pGia,
char *  pFileName 
)

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

Synopsis [Tests the hierarchy-timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 552 of file abcTim.c.

553 {
554  Gia_Man_t * pGia2;
555 
556  // normalize choices
557  if ( Gia_ManHasChoices(pGia) )
558  {
559  Gia_ManVerifyChoices( pGia );
560  Gia_ManReverseClasses( pGia, 0 );
561  }
562  // write file
563  Gia_AigerWrite( pGia, pFileName, 0, 0 );
564  // unnormalize choices
565  if ( Gia_ManHasChoices(pGia) )
566  Gia_ManReverseClasses( pGia, 1 );
567 
568  // read file
569  pGia2 = Gia_AigerRead( pFileName, 1, 1 );
570 
571  // normalize choices
572  if ( Gia_ManHasChoices(pGia2) )
573  {
574  Gia_ManVerifyChoices( pGia2 );
575  Gia_ManReverseClasses( pGia2, 1 );
576  }
577 
578  // compare resulting managers
579  if ( Gia_ManCompare( pGia, pGia2 ) )
580  printf( "Verification suceessful.\n" );
581 
582  Gia_ManStop( pGia2 );
583 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Gia_Man_t * Gia_AigerRead(char *pFileName, int fSkipStrash, int fCheck)
Definition: giaAiger.c:821
int Gia_ManCompare(Gia_Man_t *p1, Gia_Man_t *p2)
Definition: giaUtil.c:1511
void Gia_ManReverseClasses(Gia_Man_t *p, int fNowIncreasing)
Definition: abcTim.c:492
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
Definition: gia.h:95
void Gia_ManVerifyChoices(Gia_Man_t *p)
Definition: abcTim.c:443
Vec_Ptr_t* Abc_NtkTestTimCollectCone ( Abc_Ntk_t pNtk,
Abc_Obj_t pObj 
)

Definition at line 206 of file abcTim.c.

207 {
208  Vec_Ptr_t * vCone = Vec_PtrAlloc( 1000 );
209  if ( pObj != NULL )
210  {
211  // collect for one node
212  assert( Abc_ObjIsNode(pObj) );
213  assert( !Abc_NodeIsTravIdCurrent( pObj ) );
214  Abc_NtkTestTimCollectCone_rec( pObj, vCone );
215  // remove the node because it is a white box
216  Vec_PtrPop( vCone );
217  }
218  else
219  {
220  // collect for all COs
221  Abc_Obj_t * pObj;
222  int i;
223  Abc_NtkForEachCo( pNtk, pObj, i )
225  }
226  return vCone;
227 
228 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkTestTimCollectCone_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: abcTim.c:192
void Abc_NtkTestTimCollectCone_rec ( Abc_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Collect nodes reachable from this box.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file abcTim.c.

193 {
194  Abc_Obj_t * pFanin;
195  int i;
196  if ( Abc_NodeIsTravIdCurrent( pObj ) )
197  return;
198  Abc_NodeSetTravIdCurrent( pObj );
199  if ( Abc_ObjIsCi(pObj) )
200  return;
201  assert( Abc_ObjIsNode( pObj ) );
202  Abc_ObjForEachFanin( pObj, pFanin, i )
203  Abc_NtkTestTimCollectCone_rec( pFanin, vNodes );
204  Vec_PtrPush( vNodes, pObj );
205 }
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_NtkTestTimCollectCone_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: abcTim.c:192
Gia_Man_t* Abc_NtkTestTimDeriveGia ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

Synopsis [Derives GIA manager together with the hierachy manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file abcTim.c.

272 {
273  Gia_Man_t * pTemp;
274  Gia_Man_t * pGia = NULL;
275  Gia_Man_t * pHoles = NULL;
276  Tim_Man_t * pTim = NULL;
277  Vec_Int_t * vGiaCoLits, * vGiaCoLits2;
278  Vec_Flt_t * vArrTimes, * vReqTimes;
279  Abc_Obj_t * pObj, * pFanin;
280  int i, k, Entry, curPi, curPo, BoxUniqueId;
281  int nBoxFaninMax = 0;
282  assert( Abc_NtkIsTopo(pNtk) );
283  Abc_NtkFillTemp( pNtk );
284 
285  // create white boxes
286  curPi = Abc_NtkCiNum(pNtk);
287  curPo = Abc_NtkCoNum(pNtk);
288  Abc_NtkForEachNode( pNtk, pObj, i )
289  {
290  pObj->fMarkA = Abc_NodeIsWhiteBox( pObj );
291  if ( !pObj->fMarkA )
292  continue;
293  nBoxFaninMax = Abc_MaxInt( nBoxFaninMax, Abc_ObjFaninNum(pObj) );
294  curPi++;
295  curPo += Abc_ObjFaninNum(pObj);
296  if ( fVerbose )
297  printf( "Selecting node %6d as white boxes with %d inputs and %d output.\n", i, Abc_ObjFaninNum(pObj), 1 );
298  }
299 
300  // construct GIA
301  pGia = Gia_ManStart( Abc_NtkObjNumMax(pNtk) );
302  pHoles = Gia_ManStart( 1000 );
303  for ( i = 0; i < curPi; i++ )
304  Gia_ManAppendCi(pGia);
305  for ( i = 0; i < nBoxFaninMax; i++ )
306  Gia_ManAppendCi(pHoles);
307  Gia_ManHashAlloc( pGia );
308  Gia_ManHashAlloc( pHoles );
309 
310  // construct the timing manager
311  pTim = Tim_ManStart( curPi, curPo );
312 
313  // assign primary inputs
314  curPi = 0;
315  curPo = 0;
316  Abc_NtkForEachCi( pNtk, pObj, i )
317  pObj->iTemp = Abc_Var2Lit( Gia_ObjId(pGia, Gia_ManCi(pGia, curPi++)), 0 );
318  // create internal nodes in a topologic order from white boxes
319  vGiaCoLits = Vec_IntAlloc( 1000 );
320  vGiaCoLits2 = Vec_IntAlloc( 1000 );
321  Abc_NtkForEachNode( pNtk, pObj, i )
322  {
323  if ( !pObj->fMarkA ) // not a white box
324  {
325  pObj->iTemp = Abc_NtkTestTimNodeStrash( pGia, pObj );
326  continue;
327  }
328  // create box
329  BoxUniqueId = Abc_ObjFaninNum(pObj); // in this case, the node size is the ID of its delay table
330  Tim_ManCreateBox( pTim, curPo, Abc_ObjFaninNum(pObj), curPi, 1, BoxUniqueId );
331  curPo += Abc_ObjFaninNum(pObj);
332 
333  // handle box inputs
334  Abc_ObjForEachFanin( pObj, pFanin, k )
335  {
336  // save CO drivers for the AIG
337  Vec_IntPush( vGiaCoLits, pFanin->iTemp );
338  // load CI nodes for the Holes
339  pFanin->iTemp = Abc_Var2Lit( Gia_ObjId(pHoles, Gia_ManCi(pHoles, k)), 0 );
340  }
341 
342  // handle logic of the box
343  pObj->iTemp = Abc_NtkTestTimNodeStrash( pHoles, pObj );
344 
345  // handle box outputs
346  // save CO drivers for the Holes
347  Vec_IntPush( vGiaCoLits2, pObj->iTemp );
348 // Gia_ManAppendCo( pHoles, pObj->iTemp );
349  // load CO drivers for the AIG
350  pObj->iTemp = Abc_Var2Lit( Gia_ObjId(pGia, Gia_ManCi(pGia, curPi++)), 0 );
351  }
352  Abc_NtkCleanMarkA( pNtk );
353  // create COs of the AIG
354  Abc_NtkForEachCo( pNtk, pObj, i )
355  Gia_ManAppendCo( pGia, Abc_ObjFanin0(pObj)->iTemp );
356  Vec_IntForEachEntry( vGiaCoLits, Entry, i )
357  Gia_ManAppendCo( pGia, Entry );
358  Vec_IntFree( vGiaCoLits );
359  // second AIG
360  Vec_IntForEachEntry( vGiaCoLits2, Entry, i )
361  Gia_ManAppendCo( pHoles, Entry );
362  Vec_IntFree( vGiaCoLits2 );
363  // check parameters
364  curPo += Abc_NtkPoNum( pNtk );
365  assert( curPi == Gia_ManPiNum(pGia) );
366  assert( curPo == Gia_ManPoNum(pGia) );
367  // finalize GIA
368  Gia_ManHashStop( pGia );
369  Gia_ManSetRegNum( pGia, 0 );
370  Gia_ManHashStop( pHoles );
371  Gia_ManSetRegNum( pHoles, 0 );
372 
373  // clean up GIA
374  pGia = Gia_ManCleanup( pTemp = pGia );
375  Gia_ManStop( pTemp );
376  pHoles = Gia_ManCleanup( pTemp = pHoles );
377  Gia_ManStop( pTemp );
378 
379  // attach the timing manager
380  assert( pGia->pManTime == NULL );
381  pGia->pManTime = pTim;
382 
383  // derive hierarchy manager from box info and input/output arrival/required info
384  vArrTimes = Abc_NtkTestCreateArrivals( Abc_NtkPiNum(pNtk) );
385  vReqTimes = Abc_NtkTestCreateRequired( Abc_NtkPoNum(pNtk) );
386 
387  Tim_ManPrint( (Tim_Man_t *)pGia->pManTime );
388  Tim_ManCreate( (Tim_Man_t *)pGia->pManTime, Abc_FrameReadLibBox(), vArrTimes, vReqTimes );
389  Tim_ManPrint( (Tim_Man_t *)pGia->pManTime );
390 
391  Vec_FltFree( vArrTimes );
392  Vec_FltFree( vReqTimes );
393 
394 Gia_AigerWrite( pHoles, "holes00.aig", 0, 0 );
395 
396  // return
397  pGia->pAigExtra = pHoles;
398  return pGia;
399 }
int iTemp
Definition: abc.h:149
Vec_Flt_t * Abc_NtkTestCreateRequired(int nOutputs)
Definition: abcTim.c:250
unsigned fMarkA
Definition: abc.h:134
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
ABC_DLL void Abc_NtkFillTemp(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:553
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static void Vec_FltFree(Vec_Flt_t *p)
Definition: vecFlt.h:218
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
int Abc_NtkTestTimNodeStrash(Gia_Man_t *pGia, Abc_Obj_t *pNode)
Definition: abcTim.c:65
void Tim_ManCreate(Tim_Man_t *p, void *pLib, Vec_Flt_t *vInArrs, Vec_Flt_t *vOutReqs)
Definition: timMan.c:403
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
void Tim_ManPrint(Tim_Man_t *p)
Definition: timMan.c:523
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:663
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_DLL int Abc_NtkIsTopo(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2839
ABC_DLL void * Abc_FrameReadLibBox()
Definition: mainFrame.c:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
Definition: gia.h:95
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
static int Abc_NodeIsWhiteBox(Abc_Obj_t *pObj)
Definition: abcTim.c:37
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Flt_t * Abc_NtkTestCreateArrivals(int nInputs)
Definition: abcTim.c:241
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
int Abc_NtkTestTimNodeStrash ( Gia_Man_t pGia,
Abc_Obj_t pNode 
)

Definition at line 65 of file abcTim.c.

66 {
67  Hop_Man_t * pMan;
68  Hop_Obj_t * pRoot;
69  Abc_Obj_t * pFanin;
70  int i;
71  assert( Abc_ObjIsNode(pNode) );
72  assert( Abc_NtkIsAigLogic(pNode->pNtk) );
73  // get the local AIG manager and the local root node
74  pMan = (Hop_Man_t *)pNode->pNtk->pManFunc;
75  pRoot = (Hop_Obj_t *)pNode->pData;
76  // check the constant case
77  if ( Abc_NodeIsConst(pNode) || Hop_Regular(pRoot) == Hop_ManConst1(pMan) )
78  return !Hop_IsComplement(pRoot);
79  // set elementary variables
80  Abc_ObjForEachFanin( pNode, pFanin, i )
81  Hop_IthVar(pMan, i)->iData = pFanin->iTemp;
82  // strash the AIG of this node
85  // return the final node with complement if needed
86  return Abc_LitNotCond( Hop_Regular(pRoot)->iData, Hop_IsComplement(pRoot) );
87 }
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
static int Abc_NtkIsAigLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:266
Definition: hop.h:65
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition: hopDfs.c:257
void Abc_NtkTestTimNodeStrash_rec(Gia_Man_t *pGia, Hop_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: abcTim.c:54
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
void Abc_NtkTestTimNodeStrash_rec ( Gia_Man_t pGia,
Hop_Obj_t pObj 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Derives GIA for the output of the local function of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 54 of file abcTim.c.

55 {
56  assert( !Hop_IsComplement(pObj) );
57  if ( !Hop_ObjIsNode(pObj) || Hop_ObjIsMarkA(pObj) )
58  return;
61  pObj->iData = Gia_ManHashAnd( pGia, Hop_ObjChild0CopyI(pObj), Hop_ObjChild1CopyI(pObj) );
62  assert( !Hop_ObjIsMarkA(pObj) ); // loop detection
63  Hop_ObjSetMarkA( pObj );
64 }
static Hop_Obj_t * Hop_ObjFanin1(Hop_Obj_t *pObj)
Definition: hop.h:183
static int Hop_ObjIsMarkA(Hop_Obj_t *pObj)
Definition: hop.h:164
static void Hop_ObjSetMarkA(Hop_Obj_t *pObj)
Definition: hop.h:165
static int Hop_ObjIsNode(Hop_Obj_t *pObj)
Definition: hop.h:160
int iData
Definition: hop.h:69
static int Hop_ObjChild0CopyI(Hop_Obj_t *pObj)
Definition: hop.h:188
void Abc_NtkTestTimNodeStrash_rec(Gia_Man_t *pGia, Hop_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: abcTim.c:54
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static Hop_Obj_t * Hop_ObjFanin0(Hop_Obj_t *pObj)
Definition: hop.h:182
static int Hop_ObjChild1CopyI(Hop_Obj_t *pObj)
Definition: hop.h:189
#define assert(ex)
Definition: util_old.h:213
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Gia_Man_t* Abc_NtkTestTimPerformSynthesis ( Gia_Man_t p,
int  fChoices 
)

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

Synopsis [Performs synthesis with or without structural choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 413 of file abcTim.c.

414 {
415  Gia_Man_t * pGia;
416  Aig_Man_t * pNew, * pTemp;
417  Dch_Pars_t Pars, * pPars = &Pars;
418  Dch_ManSetDefaultParams( pPars );
419  pNew = Gia_ManToAig( p, 0 );
420  if ( fChoices )
421  pNew = Dar_ManChoiceNew( pNew, pPars );
422  else
423  {
424  pNew = Dar_ManCompress2( pTemp = pNew, 1, 1, 1, 0, 0 );
425  Aig_ManStop( pTemp );
426  }
427  pGia = Gia_ManFromAig( pNew );
428  Aig_ManStop( pNew );
429  return pGia;
430 }
Aig_Man_t * Dar_ManChoiceNew(Aig_Man_t *pAig, Dch_Pars_t *pPars)
Definition: darScript.c:849
void Dch_ManSetDefaultParams(Dch_Pars_t *p)
DECLARATIONS ///.
Definition: dchCore.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
Definition: dch.h:43
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
Aig_Man_t * Dar_ManCompress2(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
Definition: darScript.c:235
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
Definition: gia.h:95
void Gia_ManReverseClasses ( Gia_Man_t p,
int  fNowIncreasing 
)

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

Synopsis [Reverse the order of nodes in equiv classes.]

Description [If the flag is 1, assumed current increasing order ]

SideEffects []

SeeAlso []

Definition at line 492 of file abcTim.c.

493 {
494  Vec_Int_t * vCollected;
495  Vec_Int_t * vClass;
496  int i, k, iRepr, iNode, iPrev;
497  // collect classes
498  vCollected = Vec_IntAlloc( 100 );
499  Gia_ManForEachClass( p, iRepr )
500  Vec_IntPush( vCollected, iRepr );
501  // correct each class
502  vClass = Vec_IntAlloc( 100 );
503  Vec_IntForEachEntry( vCollected, iRepr, i )
504  {
505  Vec_IntClear( vClass );
506  Vec_IntPush( vClass, iRepr );
507  Gia_ClassForEachObj1( p, iRepr, iNode )
508  {
509  if ( fNowIncreasing )
510  assert( iRepr < iNode );
511  else
512  assert( iRepr > iNode );
513  Vec_IntPush( vClass, iNode );
514  }
515 // if ( !fNowIncreasing )
516 // Vec_IntSort( vClass, 1 );
517  // reverse the class
518  iPrev = 0;
519  iRepr = Vec_IntEntryLast( vClass );
520  Vec_IntForEachEntry( vClass, iNode, k )
521  {
522  if ( fNowIncreasing )
523  Gia_ObjSetReprRev( p, iNode, iNode == iRepr ? GIA_VOID : iRepr );
524  else
525  Gia_ObjSetRepr( p, iNode, iNode == iRepr ? GIA_VOID : iRepr );
526  Gia_ObjSetNext( p, iNode, iPrev );
527  iPrev = iNode;
528  }
529  }
530  Vec_IntFree( vCollected );
531  Vec_IntFree( vClass );
532  // verify
533  Gia_ManForEachClass( p, iRepr )
534  Gia_ClassForEachObj1( p, iRepr, iNode )
535  if ( fNowIncreasing )
536  assert( Gia_ObjRepr(p, iNode) == iRepr && iRepr > iNode );
537  else
538  assert( Gia_ObjRepr(p, iNode) == iRepr && iRepr < iNode );
539 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Gia_ClassForEachObj1(p, i, iObj)
Definition: gia.h:933
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Gia_ObjSetReprRev(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:889
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
static int Vec_IntEntryLast(Vec_Int_t *p)
Definition: bblif.c:319
#define GIA_VOID
Definition: gia.h:45
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
void Gia_ManVerifyChoices ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 443 of file abcTim.c.

444 {
445  Gia_Obj_t * pObj;
446  int i, iRepr, iNode, fProb = 0;
447  assert( p->pReprs );
448 
449  // mark nodes
451  Gia_ManForEachClass( p, iRepr )
452  Gia_ClassForEachObj1( p, iRepr, iNode )
453  {
454  if ( Gia_ObjIsHead(p, iNode) )
455  printf( "Member %d of choice class %d is a representative.\n", iNode, iRepr ), fProb = 1;
456  if ( Gia_ManObj( p, iNode )->fMark0 == 1 )
457  printf( "Node %d participates in more than one choice node.\n", iNode ), fProb = 1;
458  Gia_ManObj( p, iNode )->fMark0 = 1;
459  }
461 
462  Gia_ManForEachObj( p, pObj, i )
463  {
464  if ( Gia_ObjIsAnd(pObj) )
465  {
466  if ( Gia_ObjHasRepr(p, Gia_ObjFaninId0(pObj, i)) )
467  printf( "Fanin 0 of AND node %d has a repr.\n", i ), fProb = 1;
468  if ( Gia_ObjHasRepr(p, Gia_ObjFaninId1(pObj, i)) )
469  printf( "Fanin 1 of AND node %d has a repr.\n", i ), fProb = 1;
470  }
471  else if ( Gia_ObjIsCo(pObj) )
472  {
473  if ( Gia_ObjHasRepr(p, Gia_ObjFaninId0(pObj, i)) )
474  printf( "Fanin 0 of CO node %d has a repr.\n", i ), fProb = 1;
475  }
476  }
477 // if ( !fProb )
478 // printf( "GIA with choices is correct.\n" );
479 }
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static int Gia_ObjIsHead(Gia_Man_t *p, int Id)
Definition: gia.h:916
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
#define Gia_ClassForEachObj1(p, i, iObj)
Definition: gia.h:933
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static int Gia_ObjHasRepr(Gia_Man_t *p, int Id)
Definition: gia.h:891