abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaCone.c File Reference
#include "gia.h"
#include "misc/extra/extra.h"
#include "misc/vec/vecHsh.h"
#include "misc/vec/vecWec.h"

Go to the source code of this file.

Data Structures

struct  Opa_Man_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Opa_Man_t_ 
Opa_Man_t
 DECLARATIONS ///. More...
 

Functions

static Opa_Man_tOpa_ManStart (Gia_Man_t *pGia)
 FUNCTION DEFINITIONS ///. More...
 
static void Opa_ManStop (Opa_Man_t *p)
 
static void Opa_ManPrint (Opa_Man_t *p)
 
static void Opa_ManPrint2 (Opa_Man_t *p)
 
void Opa_ManMoveOne (Opa_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanin)
 
void Opa_ManPerform (Gia_Man_t *pGia)
 
int Gia_ManConeMark_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots, int nLimit)
 
int Gia_ManConeMark (Gia_Man_t *p, int iOut, int Limit)
 
int Gia_ManCountFlops (Gia_Man_t *p, Vec_Int_t *vOuts)
 
Gia_Man_tGia_ManFindPoPartition3 (Gia_Man_t *p, int iOut, int nDelta, int nOutsMin, int nOutsMax, int fVerbose, Vec_Ptr_t **pvPosEquivs)
 
Vec_Int_tGia_ManFindPivots (Gia_Man_t *p, int SelectShift, int fOnlyCis, int fVerbose)
 
Vec_Wrd_tGia_ManDeriveSigns (Gia_Man_t *p, Vec_Int_t *vPivots, int fVerbose)
 
Vec_Ptr_tGia_ManHashOutputs (Gia_Man_t *p, Vec_Wrd_t *vSigns, int fVerbose)
 
Gia_Man_tGia_ManFindPoPartition2 (Gia_Man_t *p, int iStartNum, int nDelta, int nOutsMin, int nOutsMax, int fSetLargest, int fVerbose, Vec_Ptr_t **pvPosEquivs)
 
Gia_Man_tGia_ManFindPoPartition (Gia_Man_t *p, int SelectShift, int fOnlyCis, int fSetLargest, int fVerbose, Vec_Ptr_t **pvPosEquivs)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Opa_Man_t_ Opa_Man_t

DECLARATIONS ///.

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

FileName [giaCone.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file giaCone.c.

Function Documentation

int Gia_ManConeMark ( Gia_Man_t p,
int  iOut,
int  Limit 
)

Definition at line 246 of file giaCone.c.

247 {
248  Vec_Int_t * vRoots;
249  Gia_Obj_t * pObj;
250  int i, RetValue;
251  // start the outputs
252  pObj = Gia_ManPo( p, iOut );
253  vRoots = Vec_IntAlloc( 100 );
254  Vec_IntPush( vRoots, Gia_ObjId(p, pObj) );
255  // mark internal nodes
258  Gia_ManForEachObjVec( vRoots, p, pObj, i )
259  if ( Gia_ManConeMark_rec( p, pObj, vRoots, Limit ) )
260  break;
261  RetValue = Vec_IntSize( vRoots ) - 1;
262  Vec_IntFree( vRoots );
263  return RetValue;
264 }
int Gia_ManConeMark_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots, int nLimit)
Definition: giaCone.c:222
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Gia_ManConeMark_rec ( Gia_Man_t p,
Gia_Obj_t pObj,
Vec_Int_t vRoots,
int  nLimit 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 222 of file giaCone.c.

223 {
224  if ( Gia_ObjIsTravIdCurrent(p, pObj) )
225  return 0;
226  Gia_ObjSetTravIdCurrent(p, pObj);
227  if ( Gia_ObjIsAnd(pObj) )
228  {
229  if ( Gia_ManConeMark_rec( p, Gia_ObjFanin0(pObj), vRoots, nLimit ) )
230  return 1;
231  if ( Gia_ManConeMark_rec( p, Gia_ObjFanin1(pObj), vRoots, nLimit ) )
232  return 1;
233  }
234  else if ( Gia_ObjIsCo(pObj) )
235  {
236  if ( Gia_ManConeMark_rec( p, Gia_ObjFanin0(pObj), vRoots, nLimit ) )
237  return 1;
238  }
239  else if ( Gia_ObjIsRo(p, pObj) )
240  Vec_IntPush( vRoots, Gia_ObjId(p, Gia_ObjRoToRi(p, pObj)) );
241  else if ( Gia_ObjIsPi(p, pObj) )
242  {}
243  else assert( 0 );
244  return (int)(Vec_IntSize(vRoots) > nLimit);
245 }
int Gia_ManConeMark_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots, int nLimit)
Definition: giaCone.c:222
static int Gia_ObjIsTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:533
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsPi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:441
int Gia_ManCountFlops ( Gia_Man_t p,
Vec_Int_t vOuts 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file giaCone.c.

278 {
279  int Limit = ABC_INFINITY;
280  Vec_Int_t * vRoots;
281  Gia_Obj_t * pObj;
282  int i, RetValue, iOut;
283  // start the outputs
284  vRoots = Vec_IntAlloc( 100 );
285  Vec_IntForEachEntry( vOuts, iOut, i )
286  {
287  pObj = Gia_ManPo( p, iOut );
288  Vec_IntPush( vRoots, Gia_ObjId(p, pObj) );
289  }
290  // mark internal nodes
293  Gia_ManForEachObjVec( vRoots, p, pObj, i )
294  if ( Gia_ManConeMark_rec( p, pObj, vRoots, Limit ) )
295  break;
296  RetValue = Vec_IntSize( vRoots ) - Vec_IntSize(vOuts);
297  Vec_IntFree( vRoots );
298  return RetValue;
299 }
int Gia_ManConeMark_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vRoots, int nLimit)
Definition: giaCone.c:222
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Gia_ObjSetTravIdCurrent(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:531
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Wrd_t* Gia_ManDeriveSigns ( Gia_Man_t p,
Vec_Int_t vPivots,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 427 of file giaCone.c.

428 {
429  Vec_Wrd_t * vSigns;
430  Gia_Obj_t * pObj, * pObjRi;
431  int i, fChange = 1, Counter;
432 
433  Gia_ManFillValue( p );
434  Gia_ManForEachObjVec( vPivots, p, pObj, i )
435  pObj->Value = i;
436 
437  if ( fVerbose )
438  printf( "Signature propagation: " );
439  vSigns = Vec_WrdStart( Gia_ManObjNum(p) );
440  while ( fChange )
441  {
442  fChange = 0;
443  Gia_ManForEachObj( p, pObj, i )
444  {
445  if ( ~pObj->Value )
446  {
447  assert( pObj->Value >= 0 && pObj->Value < 64 );
448  *Vec_WrdEntryP( vSigns, i ) |= ( (word)1 << pObj->Value );
449  }
450  if ( Gia_ObjIsAnd(pObj) )
451  *Vec_WrdEntryP( vSigns, i ) |= Vec_WrdEntry(vSigns, Gia_ObjFaninId0(pObj, i)) | Vec_WrdEntry(vSigns, Gia_ObjFaninId1(pObj, i));
452  else if ( Gia_ObjIsCo(pObj) )
453  *Vec_WrdEntryP( vSigns, i ) |= Vec_WrdEntry(vSigns, Gia_ObjFaninId0(pObj, i));
454  }
455  Counter = 0;
456  Gia_ManForEachRiRo( p, pObjRi, pObj, i )
457  {
458  word Value = Vec_WrdEntry(vSigns, Gia_ObjId(p, pObj));
459  *Vec_WrdEntryP( vSigns, Gia_ObjId(p, pObj) ) |= Vec_WrdEntry(vSigns, Gia_ObjId(p, pObjRi));
460  if ( Value != Vec_WrdEntry(vSigns, Gia_ObjId(p, pObj)) )
461  fChange = 1, Counter++;
462  }
463  if ( fVerbose )
464  printf( "%d ", Counter );
465  }
466  if ( fVerbose )
467  printf( "\n" );
468  return vSigns;
469 }
Definition: gia.h:75
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition: gia.h:1042
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Counter
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:461
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
Definition: gia.h:460
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:401
Vec_Int_t* Gia_ManFindPivots ( Gia_Man_t p,
int  SelectShift,
int  fOnlyCis,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file giaCone.c.

342 {
343  Vec_Int_t * vPivots, * vWeights;
344  Vec_Int_t * vCount, * vResult;
345  int i, j, Count, * pPerm, Limit;
346 /*
347  Gia_Obj_t * pObj;
348  // count MUX controls
349  vCount = Vec_IntStart( Gia_ManObjNum(p) );
350  Gia_ManForEachAnd( p, pObj, i )
351  {
352  Gia_Obj_t * pNodeC, * pNodeT, * pNodeE;
353  if ( !Gia_ObjIsMuxType(pObj) )
354  continue;
355  pNodeC = Gia_ObjRecognizeMux( pObj, &pNodeT, &pNodeE );
356  Vec_IntAddToEntry( vCount, Gia_ObjId(p, Gia_Regular(pNodeC)), 1 );
357  }
358 */
359  // count references
360  Gia_ManCreateRefs( p );
361  vCount = Vec_IntAllocArray( p->pRefs, Gia_ManObjNum(p) ); p->pRefs = NULL;
362 
363  // collect nodes
364  vPivots = Vec_IntAlloc( 100 );
365  vWeights = Vec_IntAlloc( 100 );
366  Vec_IntForEachEntry( vCount, Count, i )
367  {
368  if ( Count < 2 ) continue;
369  if ( fOnlyCis && !Gia_ObjIsCi(Gia_ManObj(p, i)) )
370  continue;
371  Vec_IntPush( vPivots, i );
372  Vec_IntPush( vWeights, Count );
373  }
374  Vec_IntFree( vCount );
375 
376  if ( fVerbose )
377  printf( "Selected %d pivots with more than one fanout (out of %d CIs and ANDs).\n", Vec_IntSize(vWeights), Gia_ManCiNum(p) + Gia_ManAndNum(p) );
378 
379  // permute
380  Gia_ManRandom(1);
381  Gia_ManRandom(0);
382  for ( i = 0; i < Vec_IntSize(vWeights); i++ )
383  {
384  j = (Gia_ManRandom(0) >> 1) % Vec_IntSize(vWeights);
385  ABC_SWAP( int, vPivots->pArray[i], vPivots->pArray[j] );
386  ABC_SWAP( int, vWeights->pArray[i], vWeights->pArray[j] );
387  }
388  // sort
389  if ( SelectShift == 0 )
390  pPerm = Abc_QuickSortCost( Vec_IntArray(vWeights), Vec_IntSize(vWeights), 1 );
391  else
392  {
393  Vec_Int_t * vTemp = Vec_IntStartNatural( Vec_IntSize(vWeights) );
394  pPerm = Vec_IntReleaseArray( vTemp );
395  Vec_IntFree( vTemp );
396  }
397 
398  // select
399  Limit = Abc_MinInt( 64, Vec_IntSize(vWeights) );
400  vResult = Vec_IntAlloc( Limit );
401  for ( i = 0; i < Limit; i++ )
402  {
403  j = (i + SelectShift) % Vec_IntSize(vWeights);
404  if ( fVerbose )
405  printf( "%2d : Pivot =%7d Fanout =%7d\n", j, Vec_IntEntry(vPivots, pPerm[j]), Vec_IntEntry(vWeights, pPerm[j]) );
406  Vec_IntPush( vResult, Vec_IntEntry(vPivots, pPerm[j]) );
407  }
408 
409  Vec_IntFree( vPivots );
410  Vec_IntFree( vWeights );
411  ABC_FREE( pPerm );
412 
413  return vResult;
414 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition: giaUtil.c:715
int * Abc_QuickSortCost(int *pCosts, int nSize, int fDecrease)
Definition: utilSort.c:719
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAllocArray(int *pArray, int nSize)
Definition: bblif.c:214
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
int * pRefs
Definition: gia.h:114
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int pPerm[13719]
Definition: rwrTemp.c:32
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int * Vec_IntReleaseArray(Vec_Int_t *p)
Definition: extraZddTrunc.c:89
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
Gia_Man_t* Gia_ManFindPoPartition ( Gia_Man_t p,
int  SelectShift,
int  fOnlyCis,
int  fSetLargest,
int  fVerbose,
Vec_Ptr_t **  pvPosEquivs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 555 of file giaCone.c.

556 {
557  Gia_Man_t * pGia = NULL;
558  Vec_Int_t * vPivots;
559  Vec_Wrd_t * vSigns;
560  Vec_Ptr_t * vParts;
561  Vec_Int_t * vPart;
562  abctime clk = Abc_Clock();
563  vPivots = Gia_ManFindPivots( p, SelectShift, fOnlyCis, fVerbose );
564  vSigns = Gia_ManDeriveSigns( p, vPivots, fVerbose );
565  Vec_IntFree( vPivots );
566  vParts = Gia_ManHashOutputs( p, vSigns, fVerbose );
567  Vec_WrdFree( vSigns );
568  if ( fSetLargest )
569  {
570  vPart = Vec_VecEntryInt( (Vec_Vec_t *)vParts, 0 );
571  pGia = Gia_ManDupCones( p, Vec_IntArray(vPart), Vec_IntSize(vPart), 1 );
572  }
573  if ( pvPosEquivs )
574  {
575  *pvPosEquivs = vParts;
576  printf( "The algorithm divided %d POs into %d partitions. ", Gia_ManPoNum(p), Vec_PtrSize(vParts) );
577  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
578  }
579  else
580  Vec_VecFree( (Vec_Vec_t *)vParts );
581  return pGia;
582 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Vec_Wrd_t * Gia_ManDeriveSigns(Gia_Man_t *p, Vec_Int_t *vPivots, int fVerbose)
Definition: giaCone.c:427
Gia_Man_t * Gia_ManDupCones(Gia_Man_t *p, int *pPos, int nPos, int fTrimPis)
Definition: giaDup.c:2691
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
Vec_Ptr_t * Gia_ManHashOutputs(Gia_Man_t *p, Vec_Wrd_t *vSigns, int fVerbose)
Definition: giaCone.c:482
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
Definition: vecVec.h:276
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
Vec_Int_t * Gia_ManFindPivots(Gia_Man_t *p, int SelectShift, int fOnlyCis, int fVerbose)
Definition: giaCone.c:341
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
Gia_Man_t* Gia_ManFindPoPartition2 ( Gia_Man_t p,
int  iStartNum,
int  nDelta,
int  nOutsMin,
int  nOutsMax,
int  fSetLargest,
int  fVerbose,
Vec_Ptr_t **  pvPosEquivs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 538 of file giaCone.c.

539 {
540  return NULL;
541 }
Gia_Man_t* Gia_ManFindPoPartition3 ( Gia_Man_t p,
int  iOut,
int  nDelta,
int  nOutsMin,
int  nOutsMax,
int  fVerbose,
Vec_Ptr_t **  pvPosEquivs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 312 of file giaCone.c.

313 {
314 /*
315  int i, Count = 0;
316  // mark nodes belonging to output 'iOut'
317  for ( i = 0; i < Gia_ManPoNum(p); i++ )
318  Count += (Gia_ManConeMark(p, i, 10000) < 10000);
319  // printf( "%d ", Gia_ManConeMark(p, i, 1000) );
320  printf( "%d out of %d\n", Count, Gia_ManPoNum(p) );
321 
322  // add other outputs as long as they are nDelta away
323 */
324 // Opa_ManPerform( p );
325 
326  return NULL;
327 }
Vec_Ptr_t* Gia_ManHashOutputs ( Gia_Man_t p,
Vec_Wrd_t vSigns,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 482 of file giaCone.c.

483 {
484  Vec_Ptr_t * vBins;
485  Vec_Wec_t * vClasses;
486  Vec_Wrd_t * vSignsPo;
487  Vec_Int_t * vPriority, * vBin;
488  Gia_Obj_t * pObj;
489  int i;
490  // collect PO signatures
491  vSignsPo = Vec_WrdAlloc( Gia_ManPoNum(p) );
492  Gia_ManForEachPo( p, pObj, i )
493  Vec_WrdPush( vSignsPo, Vec_WrdEntry(vSigns, Gia_ObjId(p, pObj)) );
494  // find equivalence classes
495  vPriority = Hsh_WrdManHashArray( vSignsPo, 1 );
496  Vec_WrdFree( vSignsPo );
497  vClasses = Vec_WecCreateClasses( vPriority );
498  Vec_IntFree( vPriority );
499  vBins = (Vec_Ptr_t *)Vec_WecConvertToVecPtr( vClasses );
500  Vec_WecFree( vClasses );
501  Vec_VecSort( (Vec_Vec_t *)vBins, 1 );
502 
503  if ( fVerbose )
504  printf( "Computed %d partitions:\n", Vec_PtrSize(vBins) );
505  if ( !fVerbose )
506  printf( "Listing partitions with more than 100 outputs:\n" );
507  Vec_PtrForEachEntry( Vec_Int_t *, vBins, vBin, i )
508  {
509  assert( Vec_IntSize(vBin) > 0 );
510  if ( fVerbose || Vec_IntSize(vBin) > 100 )
511  {
512  int PoNum = Vec_IntEntry( vBin, 0 );
513  Gia_Obj_t * pObj = Gia_ManPo( p, PoNum );
514  word Sign = Vec_WrdEntry( vSigns, Gia_ObjId(p, pObj) );
515  // print
516  printf( "%3d ", i );
517  Extra_PrintBinary( stdout, (unsigned *)&Sign, 64 );
518  printf( " " );
519  printf( "PO =%7d ", Vec_IntSize(vBin) );
520  printf( "FF =%7d", Gia_ManCountFlops(p, vBin) );
521  printf( "\n" );
522  }
523  }
524  return vBins;
525 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static void Vec_VecSort(Vec_Vec_t *p, int fReverse)
Definition: vecVec.h:546
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Ptr_t * Vec_WecConvertToVecPtr(Vec_Wec_t *p)
Definition: vecWec.h:618
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
Definition: gia.h:406
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Int_t * Hsh_WrdManHashArray(Vec_Wrd_t *vDataW, int nSize)
Definition: vecHsh.h:203
Definition: gia.h:75
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
if(last==0)
Definition: sparse_int.h:34
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Gia_ManCountFlops(Gia_Man_t *p, Vec_Int_t *vOuts)
Definition: giaCone.c:277
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
#define assert(ex)
Definition: util_old.h:213
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
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Vec_Wec_t * Vec_WecCreateClasses(Vec_Int_t *vMap)
Definition: vecWec.h:549
void Opa_ManMoveOne ( Opa_Man_t p,
Gia_Obj_t pObj,
Gia_Obj_t pFanin 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file giaCone.c.

131 {
132  int iObj = Gia_ObjId(p->pGia, pObj);
133  int iFanin = Gia_ObjId(p->pGia, pFanin);
134  if ( iFanin == 0 )
135  return;
136  assert( p->pId2Part[ iObj ] >= 0 );
137  if ( p->pId2Part[ iFanin ] == -1 )
138  {
139  p->pId2Part[ iFanin ] = p->pId2Part[ iObj ];
140  Vec_IntPush( p->pvParts + p->pId2Part[ iObj ], iFanin );
141  assert( Gia_ObjIsCi(pFanin) || Gia_ObjIsAnd(pFanin) );
142  if ( Gia_ObjIsAnd(pFanin) )
143  Vec_IntPush( p->vFront, iFanin );
144  else if ( Gia_ObjIsRo(p->pGia, pFanin) )
145  {
146  pFanin = Gia_ObjRoToRi(p->pGia, pFanin);
147  iFanin = Gia_ObjId(p->pGia, pFanin);
148  assert( p->pId2Part[ iFanin ] == -1 );
149  p->pId2Part[ iFanin ] = p->pId2Part[ iObj ];
150  Vec_IntPush( p->pvParts + p->pId2Part[ iObj ], iFanin );
151  Vec_IntPush( p->vFront, iFanin );
152  }
153  }
154  else if ( p->pId2Part[ iObj ] != p->pId2Part[ iFanin ] )
155  {
156  Vec_Int_t * vPartObj = p->pvParts + p->pId2Part[ iObj ];
157  Vec_Int_t * vPartFan = p->pvParts + p->pId2Part[ iFanin ];
158  int iTemp, i;
159 // printf( "Moving %d to %d (%d -> %d)\n", iObj, iFanin, Vec_IntSize(vPartObj), Vec_IntSize(vPartFan) );
160  // add group of iObj to group of iFanin
161  assert( Vec_IntSize(vPartObj) > 0 );
162  Vec_IntForEachEntry( vPartObj, iTemp, i )
163  {
164  Vec_IntPush( vPartFan, iTemp );
165  p->pId2Part[ iTemp ] = p->pId2Part[ iFanin ];
166  }
167  Vec_IntShrink( vPartObj, 0 );
168  p->nParts--;
169  }
170 }
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 Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static Gia_Obj_t * Gia_ObjRoToRi(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:446
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Opa_ManPerform ( Gia_Man_t pGia)

Definition at line 171 of file giaCone.c.

172 {
173  Opa_Man_t * p;
174  Gia_Obj_t * pObj;
175  int i, Limit, Count = 0;
176 
177  p = Opa_ManStart( pGia );
178  Limit = Vec_IntSize(p->vFront);
179 //Opa_ManPrint2( p );
180  Gia_ManForEachObjVec( p->vFront, pGia, pObj, i )
181  {
182  if ( i == Limit )
183  {
184  printf( "%6d : %6d -> %6d\n", ++Count, i, p->nParts );
185  Limit = Vec_IntSize(p->vFront);
186  if ( Count > 1 )
187  Opa_ManPrint2( p );
188  }
189 // printf( "*** Object %d ", Gia_ObjId(pGia, pObj) );
190  if ( Gia_ObjIsAnd(pObj) )
191  {
192  Opa_ManMoveOne( p, pObj, Gia_ObjFanin0(pObj) );
193  Opa_ManMoveOne( p, pObj, Gia_ObjFanin1(pObj) );
194  }
195  else if ( Gia_ObjIsCo(pObj) )
196  Opa_ManMoveOne( p, pObj, Gia_ObjFanin0(pObj) );
197  else assert( 0 );
198 // if ( i % 10 == 0 )
199 // printf( "%d ", p->nParts );
200  if ( p->nParts == 1 )
201  break;
202  if ( Count == 5 )
203  break;
204  }
205  printf( "\n" );
206  Opa_ManStop( p );
207 }
static Opa_Man_t * Opa_ManStart(Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: giaCone.c:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Opa_ManMoveOne(Opa_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pFanin)
Definition: giaCone.c:130
Definition: gia.h:75
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
typedefABC_NAMESPACE_IMPL_START struct Opa_Man_t_ Opa_Man_t
DECLARATIONS ///.
Definition: giaCone.c:33
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static void Opa_ManPrint2(Opa_Man_t *p)
Definition: giaCone.c:101
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Opa_ManStop(Opa_Man_t *p)
Definition: giaCone.c:77
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define assert(ex)
Definition: util_old.h:213
static void Opa_ManPrint ( Opa_Man_t p)
inlinestatic

Definition at line 87 of file giaCone.c.

88 {
89  int i, k;
90  printf( "Groups:\n" );
91  for ( i = 0; i < Gia_ManPoNum(p->pGia); i++ )
92  {
93  if ( p->pvParts[i].nSize == 0 )
94  continue;
95  printf( "%3d : ", i );
96  for ( k = 0; k < p->pvParts[i].nSize; k++ )
97  printf( "%d ", p->pvParts[i].pArray[k] );
98  printf( "\n" );
99  }
100 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Opa_ManPrint2 ( Opa_Man_t p)
inlinestatic

Definition at line 101 of file giaCone.c.

102 {
103  Gia_Obj_t * pObj;
104  int i, k, Count;
105  printf( "Groups %d: ", p->nParts );
106  for ( i = 0; i < Gia_ManPoNum(p->pGia); i++ )
107  {
108  if ( p->pvParts[i].nSize == 0 )
109  continue;
110  // count POs in this group
111  Count = 0;
112  Gia_ManForEachObjVec( p->pvParts + i, p->pGia, pObj, k )
113  Count += Gia_ObjIsPo(p->pGia, pObj);
114  printf( "%d ", Count );
115  }
116  printf( "\n" );
117 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: gia.h:75
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition: gia.h:988
static int Gia_ObjIsPo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:442
static Opa_Man_t* Opa_ManStart ( Gia_Man_t pGia)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file giaCone.c.

59 {
60  Opa_Man_t * p;
61  Gia_Obj_t * pObj;
62  int i;
63  p = ABC_CALLOC( Opa_Man_t, 1 );
64  p->pGia = pGia;
65  p->pvParts = ABC_CALLOC( Vec_Int_t, Gia_ManPoNum(pGia) );
66  p->pId2Part = ABC_FALLOC( int, Gia_ManObjNum(pGia) );
67  p->vFront = Vec_IntAlloc( 100 );
68  Gia_ManForEachPo( pGia, pObj, i )
69  {
70  Vec_IntPush( p->pvParts + i, Gia_ObjId(pGia, pObj) );
71  p->pId2Part[Gia_ObjId(pGia, pObj)] = i;
72  Vec_IntPush( p->vFront, Gia_ObjId(pGia, pObj) );
73  }
74  p->nParts = Gia_ManPoNum(pGia);
75  return p;
76 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
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
Definition: gia.h:75
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
typedefABC_NAMESPACE_IMPL_START struct Opa_Man_t_ Opa_Man_t
DECLARATIONS ///.
Definition: giaCone.c:33
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
static void Opa_ManStop ( Opa_Man_t p)
inlinestatic

Definition at line 77 of file giaCone.c.

78 {
79  int i;
80  Vec_IntFree( p->vFront );
81  for ( i = 0; i < Gia_ManPoNum(p->pGia); i++ )
82  ABC_FREE( p->pvParts[i].pArray );
83  ABC_FREE( p->pvParts );
84  ABC_FREE( p->pId2Part );
85  ABC_FREE( p );
86 }
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235