本文整理汇总了C++中Vec_IntPush函数的典型用法代码示例。如果您正苦于以下问题:C++ Vec_IntPush函数的具体用法?C++ Vec_IntPush怎么用?C++ Vec_IntPush使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Vec_IntPush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Gia_NodeCollect_rec
static inline void Gia_NodeCollect_rec( Gia_Man_t * p, Gia_Obj_t * pNode, Vec_Int_t * vSupp, Vec_Int_t * vSuppRefs )
{
if ( Gia_ObjIsTravIdCurrent(p, pNode) )
return;
Gia_ObjSetTravIdCurrent(p, pNode);
if ( Gia_ObjRefNum(p, pNode) || Gia_ObjIsCi(pNode) )
{
Vec_IntPush( vSupp, Gia_ObjId(p, pNode) );
Vec_IntPush( vSuppRefs, Gia_ObjRefNum(p, pNode) );
return;
}
assert( Gia_ObjIsAnd(pNode) );
Gia_NodeCollect_rec( p, Gia_ObjFanin0(pNode), vSupp, vSuppRefs );
Gia_NodeCollect_rec( p, Gia_ObjFanin1(pNode), vSupp, vSuppRefs );
}
示例2: Gia_ManCollectNodesCis_rec
/**Function*************************************************************
Synopsis [Counts the support size of the node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManCollectNodesCis_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vNodes )
{
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return;
Gia_ObjSetTravIdCurrent(p, pObj);
if ( Gia_ObjIsCi(pObj) )
{
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
return;
}
assert( Gia_ObjIsAnd(pObj) );
Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin0(pObj), vNodes );
Gia_ManCollectNodesCis_rec( p, Gia_ObjFanin1(pObj), vNodes );
Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
}
示例3: Pdr_ObjSatVar2FindOrAdd
static inline int Pdr_ObjSatVar2FindOrAdd( Pdr_Man_t * p, int k, Aig_Obj_t * pObj )
{
Vec_Int_t * vId2Vars = p->pvId2Vars + Aig_ObjId(pObj);
assert( p->pCnf2->pObj2Count[Aig_ObjId(pObj)] >= 0 );
if ( Vec_IntSize(vId2Vars) == 0 )
Vec_IntGrow(vId2Vars, 2 * k + 1);
if ( Vec_IntGetEntry(vId2Vars, k) == 0 )
{
sat_solver * pSat = Pdr_ManSolver(p, k);
Vec_Int_t * vVar2Ids = (Vec_Int_t *)Vec_PtrEntry(&p->vVar2Ids, k);
int iVarNew = Vec_IntSize( vVar2Ids );
assert( iVarNew > 0 );
Vec_IntPush( vVar2Ids, Aig_ObjId(pObj) );
Vec_IntWriteEntry( vId2Vars, k, iVarNew << 2 );
sat_solver_setnvars( pSat, iVarNew + 1 );
if ( k == 0 && Saig_ObjIsLo(p->pAig, pObj) ) // initialize the register output
{
int Lit = toLitCond( iVarNew, 1 );
int RetValue = sat_solver_addclause( pSat, &Lit, &Lit + 1 );
assert( RetValue == 1 );
(void) RetValue;
sat_solver_compress( pSat );
}
}
return Vec_IntEntry( vId2Vars, k );
}
示例4: Gia_ManPrintTents
void Gia_ManPrintTents( Gia_Man_t * p )
{
Vec_Int_t * vObjs;
Gia_Obj_t * pObj;
int t, i, iObjId, nSizePrev, nSizeCurr;
assert( Gia_ManPoNum(p) > 0 );
vObjs = Vec_IntAlloc( 100 );
// save constant class
Gia_ManIncrementTravId( p );
Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
Vec_IntPush( vObjs, 0 );
// create starting root
nSizePrev = Vec_IntSize(vObjs);
Gia_ManForEachPo( p, pObj, i )
Gia_ManPrintTents_rec( p, pObj, vObjs );
// build tents
printf( "Tents: " );
for ( t = 1; nSizePrev < Vec_IntSize(vObjs); t++ )
{
nSizeCurr = Vec_IntSize(vObjs);
Vec_IntForEachEntryStartStop( vObjs, iObjId, i, nSizePrev, nSizeCurr )
if ( Gia_ObjIsRo(p, Gia_ManObj(p, iObjId)) )
Gia_ManPrintTents_rec( p, Gia_ObjRoToRi(p, Gia_ManObj(p, iObjId)), vObjs );
printf( "%d=%d ", t, nSizeCurr - nSizePrev );
nSizePrev = nSizeCurr;
}
printf( " Unused=%d\n", Gia_ManObjNum(p) - Vec_IntSize(vObjs) );
Vec_IntFree( vObjs );
// the remaining objects are PIs without fanout
// Gia_ManForEachObj( p, pObj, i )
// if ( !Gia_ObjIsTravIdCurrent(p, pObj) )
// Gia_ObjPrint( p, pObj );
}
示例5: Cnf_AddCardinConstrTest
void Cnf_AddCardinConstrTest()
{
int i, status, nVars = 7;
Vec_Int_t * vVars = Vec_IntStartNatural( nVars );
sat_solver * pSat = sat_solver_new();
sat_solver_setnvars( pSat, nVars );
Cnf_AddCardinConstr( pSat, vVars );
while ( 1 )
{
status = sat_solver_solve( pSat, NULL, NULL, 0, 0, 0, 0 );
if ( status != l_True )
break;
Vec_IntClear( vVars );
for ( i = 0; i < nVars; i++ )
{
Vec_IntPush( vVars, Abc_Var2Lit(i, sat_solver_var_value(pSat, i)) );
printf( "%d", sat_solver_var_value(pSat, i) );
}
printf( "\n" );
status = sat_solver_addclause( pSat, Vec_IntArray(vVars), Vec_IntArray(vVars) + Vec_IntSize(vVars) );
if ( status == 0 )
break;
}
sat_solver_delete( pSat );
Vec_IntFree( vVars );
}
示例6: Ivy_ManDfsSeq
/**Function*************************************************************
Synopsis [Collects AND/EXOR nodes in the DFS order from CIs to COs.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Ivy_ManDfsSeq( Ivy_Man_t * p, Vec_Int_t ** pvLatches )
{
Vec_Int_t * vNodes, * vLatches;
Ivy_Obj_t * pObj;
int i;
// assert( Ivy_ManLatchNum(p) > 0 );
// make sure the nodes are not marked
Ivy_ManForEachObj( p, pObj, i )
assert( !pObj->fMarkA && !pObj->fMarkB );
// collect the latches
vLatches = Vec_IntAlloc( Ivy_ManLatchNum(p) );
Ivy_ManForEachLatch( p, pObj, i )
Vec_IntPush( vLatches, pObj->Id );
// collect the nodes
vNodes = Vec_IntAlloc( Ivy_ManNodeNum(p) );
Ivy_ManForEachPo( p, pObj, i )
Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
Ivy_ManForEachNodeVec( p, vLatches, pObj, i )
Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
// unmark the collected nodes
// Ivy_ManForEachNodeVec( p, vNodes, pObj, i )
// Ivy_ObjClearMarkA(pObj);
Ivy_ManForEachObj( p, pObj, i )
Ivy_ObjClearMarkA(pObj);
// make sure network does not have dangling nodes
// assert( Vec_IntSize(vNodes) == Ivy_ManNodeNum(p) + Ivy_ManBufNum(p) );
// temporary!!!
if ( pvLatches == NULL )
Vec_IntFree( vLatches );
else
*pvLatches = vLatches;
return vNodes;
}
示例7: Sfm_NtkComputeRoots_rec
void Sfm_NtkComputeRoots_rec( Sfm_Ntk_t * p, int iNode, int nLevelMax, Vec_Int_t * vRoots, Vec_Int_t * vTfo )
{
int i, iFanout;
assert( Sfm_ObjIsNode(p, iNode) );
if ( Sfm_ObjIsTravIdCurrent(p, iNode) )
return;
Sfm_ObjSetTravIdCurrent(p, iNode);
if ( iNode != p->iPivotNode )
Vec_IntPush( vTfo, iNode );
// check if the node should be the root
if ( Sfm_NtkCheckRoot( p, iNode, nLevelMax ) )
Vec_IntPush( vRoots, iNode );
else // if not, explore its fanouts
Sfm_ObjForEachFanout( p, iNode, iFanout, i )
Sfm_NtkComputeRoots_rec( p, iFanout, nLevelMax, vRoots, vTfo );
}
示例8: Ivy_ManDfs_rec
/**Function*************************************************************
Synopsis [Collects nodes in the DFS order.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Ivy_ManDfs_rec( Ivy_Man_t * p, Ivy_Obj_t * pObj, Vec_Int_t * vNodes )
{
if ( Ivy_ObjIsMarkA(pObj) )
return;
Ivy_ObjSetMarkA(pObj);
if ( Ivy_ObjIsConst1(pObj) || Ivy_ObjIsCi(pObj) )
{
if ( p->pHaig == NULL && pObj->pEquiv )
Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes );
return;
}
//printf( "visiting node %d\n", pObj->Id );
/*
if ( pObj->Id == 87 || pObj->Id == 90 )
{
int y = 0;
}
*/
assert( Ivy_ObjIsBuf(pObj) || Ivy_ObjIsAnd(pObj) || Ivy_ObjIsExor(pObj) );
Ivy_ManDfs_rec( p, Ivy_ObjFanin0(pObj), vNodes );
if ( !Ivy_ObjIsBuf(pObj) )
Ivy_ManDfs_rec( p, Ivy_ObjFanin1(pObj), vNodes );
if ( p->pHaig == NULL && pObj->pEquiv )
Ivy_ManDfs_rec( p, Ivy_Regular(pObj->pEquiv), vNodes );
Vec_IntPush( vNodes, pObj->Id );
//printf( "adding node %d with fanins %d and %d and equiv %d (refs = %d)\n",
// pObj->Id, Ivy_ObjFanin0(pObj)->Id, Ivy_ObjFanin1(pObj)->Id,
// pObj->pEquiv? Ivy_Regular(pObj->pEquiv)->Id: -1, Ivy_ObjRefs(pObj) );
}
示例9: Agi_ManAppendCi
static inline int Agi_ManAppendCi( Agi_Man_t * p )
{
int iObj = Agi_ManAppendObj( p );
p->pObjs[iObj] = AGI_PI | (word)Vec_IntSize(&p->vCis);
Vec_IntPush( &p->vCis, iObj );
return Abc_Var2Lit( iObj, 0 ); // return lit
}
示例10: Gia_ManMarkSeqGiaWithBoxes_rec
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Mark GIA nodes that feed into POs.]
Description [Returns the array of classes of remaining registers.]
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManMarkSeqGiaWithBoxes_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vRoots )
{
Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
int i, iBox, nBoxIns, nBoxOuts, iShift, nRealCis;
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return;
Gia_ObjSetTravIdCurrent(p, pObj);
if ( Gia_ObjIsAnd(pObj) )
{
Gia_ManMarkSeqGiaWithBoxes_rec( p, Gia_ObjFanin0(pObj), vRoots );
Gia_ManMarkSeqGiaWithBoxes_rec( p, Gia_ObjFanin1(pObj), vRoots );
return;
}
assert( Gia_ObjIsCi(pObj) );
nRealCis = Tim_ManPiNum(pManTime);
if ( Gia_ObjCioId(pObj) < nRealCis )
{
int nRegs = Gia_ManRegBoxNum(p);
int iFlop = Gia_ObjCioId(pObj) - (nRealCis - nRegs);
assert( iFlop >= 0 && iFlop < nRegs );
pObj = Gia_ManCo( p, Gia_ManPoNum(p) - nRegs + iFlop );
Vec_IntPush( vRoots, Gia_ObjId(p, pObj) );
return;
}
// get the box
iBox = Tim_ManBoxForCi( pManTime, Gia_ObjCioId(pObj) );
nBoxIns = Tim_ManBoxInputNum(pManTime, iBox);
nBoxOuts = Tim_ManBoxOutputNum(pManTime, iBox);
// mark all outputs
iShift = Tim_ManBoxOutputFirst(pManTime, iBox);
for ( i = 0; i < nBoxOuts; i++ )
Gia_ObjSetTravIdCurrent(p, Gia_ManCi(p, iShift + i));
// traverse from inputs
iShift = Tim_ManBoxInputFirst(pManTime, iBox);
for ( i = 0; i < nBoxIns; i++ )
Gia_ObjSetTravIdCurrent(p, Gia_ManCo(p, iShift + i));
for ( i = 0; i < nBoxIns; i++ )
Gia_ManMarkSeqGiaWithBoxes_rec( p, Gia_ObjFanin0(Gia_ManCo(p, iShift + i)), vRoots );
}
示例11: Agi_ManAppendCo
static inline int Agi_ManAppendCo( Agi_Man_t * p, int iLit0 )
{
int iObj = Agi_ManAppendObj( p );
p->pObjs[iObj] = AGI_PO | (word)iLit0;
Vec_IntPush( &p->vCos, iObj );
return Abc_Var2Lit( iObj, 0 ); // return lit
}
示例12: Bdc_TableAdd
/**Function*************************************************************
Synopsis [Adds the new entry to the hash table.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Bdc_TableAdd( Bdc_Man_t * p, Bdc_Fun_t * pFunc )
{
if ( p->pTable[pFunc->uSupp] == NULL )
Vec_IntPush( p->vSpots, pFunc->uSupp );
pFunc->pNext = p->pTable[pFunc->uSupp];
p->pTable[pFunc->uSupp] = pFunc;
}
示例13: Abc_NtkClauseTriv
/**Function*************************************************************
Synopsis [Adds trivial clause.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_NtkClauseTriv( sat_solver * pSat, Abc_Obj_t * pNode, Vec_Int_t * vVars )
{
//printf( "Adding triv %d. %d\n", Abc_ObjRegular(pNode)->Id, (int)pSat->sat_solver_stats.clauses );
vVars->nSize = 0;
Vec_IntPush( vVars, toLitCond( (int)(ABC_PTRINT_T)Abc_ObjRegular(pNode)->pCopy, Abc_ObjIsComplement(pNode) ) );
// Vec_IntPush( vVars, toLitCond( (int)Abc_ObjRegular(pNode)->Id, Abc_ObjIsComplement(pNode) ) );
return sat_solver_addclause( pSat, vVars->pArray, vVars->pArray + vVars->nSize );
}
示例14: Gia_ObjCheckMffc_rec
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Computes MFFCs of all qualifying nodes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Gia_ObjCheckMffc_rec( Gia_Man_t * p,Gia_Obj_t * pObj, int Limit, Vec_Int_t * vNodes )
{
int iFanin;
if ( Gia_ObjIsCi(pObj) )
return 1;
assert( Gia_ObjIsAnd(pObj) );
iFanin = Gia_ObjFaninId0p(p, pObj);
Vec_IntPush( vNodes, iFanin );
if ( !Gia_ObjRefDecId(p, iFanin) && (Vec_IntSize(vNodes) > Limit || !Gia_ObjCheckMffc_rec(p, Gia_ObjFanin0(pObj), Limit, vNodes)) )
return 0;
iFanin = Gia_ObjFaninId1p(p, pObj);
Vec_IntPush( vNodes, iFanin );
if ( !Gia_ObjRefDecId(p, iFanin) && (Vec_IntSize(vNodes) > Limit || !Gia_ObjCheckMffc_rec(p, Gia_ObjFanin1(pObj), Limit, vNodes)) )
return 0;
if ( !Gia_ObjIsMux(p, pObj) )
return 1;
iFanin = Gia_ObjFaninId2p(p, pObj);
Vec_IntPush( vNodes, iFanin );
if ( !Gia_ObjRefDecId(p, iFanin) && (Vec_IntSize(vNodes) > Limit || !Gia_ObjCheckMffc_rec(p, Gia_ObjFanin2(p, pObj), Limit, vNodes)) )
return 0;
return 1;
}
示例15: Abc_NtkFromMiniAig
Abc_Ntk_t * Abc_NtkFromMiniAig( Mini_Aig_t * p )
{
Abc_Ntk_t * pNtk;
Abc_Obj_t * pObj;
Vec_Int_t * vCopies;
int i, nNodes;
// get the number of nodes
nNodes = Mini_AigNodeNum(p);
// create ABC network
pNtk = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
pNtk->pName = Abc_UtilStrsav( "MiniAig" );
// create mapping from MiniAIG objects into ABC objects
vCopies = Vec_IntAlloc( nNodes );
Vec_IntPush( vCopies, Abc_LitNot(Abc_ObjToLit(Abc_AigConst1(pNtk))) );
// iterate through the objects
for ( i = 1; i < nNodes; i++ )
{
if ( Mini_AigNodeIsPi( p, i ) )
pObj = Abc_NtkCreatePi(pNtk);
else if ( Mini_AigNodeIsPo( p, i ) )
Abc_ObjAddFanin( (pObj = Abc_NtkCreatePo(pNtk)), Abc_NodeFanin0Copy(pNtk, vCopies, p, i) );
else if ( Mini_AigNodeIsAnd( p, i ) )
pObj = Abc_AigAnd((Abc_Aig_t *)pNtk->pManFunc, Abc_NodeFanin0Copy(pNtk, vCopies, p, i), Abc_NodeFanin1Copy(pNtk, vCopies, p, i));
else assert( 0 );
Vec_IntPush( vCopies, Abc_ObjToLit(pObj) );
}
assert( Vec_IntSize(vCopies) == nNodes );
Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
Vec_IntFree( vCopies );
Abc_NtkAddDummyPiNames( pNtk );
Abc_NtkAddDummyPoNames( pNtk );
if ( !Abc_NtkCheck( pNtk ) )
fprintf( stdout, "Abc_NtkFromMini(): Network check has failed.\n" );
// add latches
if ( Mini_AigRegNum(p) > 0 )
{
extern Abc_Ntk_t * Abc_NtkRestrashWithLatches( Abc_Ntk_t * pNtk, int nLatches );
Abc_Ntk_t * pTemp;
pNtk = Abc_NtkRestrashWithLatches( pTemp = pNtk, Mini_AigRegNum(p) );
Abc_NtkDelete( pTemp );
}
return pNtk;
}