15 if( n == k )
return 1;
16 if( k == 1 )
return n;
23 int i, j, combCounter = 0;
35 printf(
"Comb-%3d : ", ++combCounter);
57 int combN,
int combK )
63 int totalCombination_KNUTH = 0;
69 for(i_KNUTH=-1; i_KNUTH<combK; i_KNUTH++)
76 totalCombination_KNUTH++;
78 for( i_KNUTH=combK; i_KNUTH>0; i_KNUTH--)
82 pObjMonoCand =
Aig_Or( pAigNew, pObj, pObjMonoCand );
90 j_KNUTH = j_KNUTH + 1;
92 if( j_KNUTH > combK )
break;
98 return totalCombination_KNUTH;
103 int combN,
int combK )
109 int totalCombination_KNUTH = 0;
111 int i_KNUTH, j_KNUTH;
115 for(i_KNUTH=-1; i_KNUTH<combK; i_KNUTH++)
122 totalCombination_KNUTH++;
124 for( i_KNUTH=combK; i_KNUTH>0; i_KNUTH--)
129 pObjMonoCand =
Aig_Or( pAigNew, pObj, pObjMonoCand );
137 j_KNUTH = j_KNUTH + 1;
139 if( j_KNUTH > combK )
break;
145 return totalCombination_KNUTH;
152 int piCopied = 0, loCopied = 0, loCreated = 0, liCopied = 0, liCreated = 0, poCopied = 0;
154 int i, nRegCount, hintSingalBeginningMarker, hintSingalEndMarker;
155 int combN_internal, combK_internal;
156 long longI, lCombinationCount;
158 Aig_Obj_t *pObj, *pObjLO_nCk, *pObjDisj_nCk;
159 Vec_Ptr_t *vLO_nCk, *vPODriver_nCk, *vDisj_nCk;
170 if( vCandidateMonotoneSignals == NULL )
172 printf(
"\nTraget Signal Set is Empty: Duplicating given AIG\n");
179 hintSingalBeginningMarker =
Vec_IntEntry( vCandidateMonotoneSignals, 0 );
181 combN_internal = hintSingalEndMarker - hintSingalBeginningMarker + 1;
197 sprintf(pNewAig->pName,
"%s_%s", pAig->pName,
"nCk");
198 pNewAig->pSpec = NULL;
219 lCombinationCount = 0;
220 for(combK_internal=1; combK_internal<=combK; combK_internal++)
222 assert( lCombinationCount > 0 );
224 for( longI = 0; longI < lCombinationCount; longI++ )
266 for( combK_internal=1; combK_internal<=combK; combK_internal++ )
268 vDisj_nCk, combN_internal, combK_internal );
273 for( longI = 0; longI < lCombinationCount; longI++ )
290 for( longI = 0; longI < lCombinationCount; longI++ )
303 for( longI = 0; longI < lCombinationCount; longI++ )
310 assert( liCopied + liCreated == loCopied + loCreated );
311 nRegCount = loCopied + loCreated;
325 int piCopied = 0, loCopied = 0, loCreated = 0, liCopied = 0, liCreated = 0, poCopied = 0;
328 int combN_internal, combK_internal;
329 long longI, lCombinationCount;
331 Aig_Obj_t *pObj, *pObjLO_nCk, *pObjDisj_nCk;
332 Vec_Ptr_t *vLO_nCk, *vPODriver_nCk, *vDisj_nCk;
360 sprintf(pNewAig->pName,
"%s_%s", pAig->pName,
"nCk");
361 pNewAig->pSpec = NULL;
382 lCombinationCount = 0;
383 for(combK_internal=1; combK_internal<=combK; combK_internal++)
385 assert( lCombinationCount > 0 );
387 for( longI = 0; longI < lCombinationCount; longI++ )
403 for( combK_internal=1; combK_internal<=combK; combK_internal++ )
406 vDisj_nCk, combN_internal, combK_internal );
412 for( longI = 0; longI < lCombinationCount; longI++ )
429 for( longI = 0; longI < lCombinationCount; longI++ )
442 for( longI = 0; longI < lCombinationCount; longI++ )
449 assert( liCopied + liCreated == loCopied + loCreated );
450 nRegCount = loCopied + loCreated;
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Aig_Man_t * generateGeneralDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combK)
void listCombination(int n, int t)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
ABC_NAMESPACE_IMPL_START long countCombination(long n, long k)
static Aig_Obj_t * Aig_ManLo(Aig_Man_t *p, int i)
#define Aig_ManForEachNode(p, pObj, i)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
#define Saig_ManForEachLi(p, pObj, i)
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Saig_ManForEachLo(p, pObj, i)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
int generateCombinatorialStabil(Aig_Man_t *pAigNew, Aig_Man_t *pAigOld, Vec_Int_t *vCandidateMonotoneSignals_, Vec_Ptr_t *vDisj_nCk_, int combN, int combK)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
static int Aig_ManRegNum(Aig_Man_t *p)
static int Vec_IntSize(Vec_Int_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Saig_ManForEachPo(p, pObj, i)
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
static void Vec_IntFree(Vec_Int_t *p)
int Aig_ManCleanup(Aig_Man_t *p)
Aig_Man_t * generateDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combN, int combK)
int generateCombinatorialStabilExhaust(Aig_Man_t *pAigNew, Aig_Man_t *pAigOld, Vec_Ptr_t *vDisj_nCk_, int combN, int combK)
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Saig_ManForEachPi(p, pObj, i)