コード例 #1
0
/**Function*************************************************************

  Synopsis    [Appends a new node to the graph.]

  Description [This procedure is meant for internal use.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Kit_Node_t * Kit_GraphAppendNode( Kit_Graph_t * pGraph )   
{
    Kit_Node_t * pNode;
    if ( pGraph->nSize == pGraph->nCap )
    {
        pGraph->pNodes = ABC_REALLOC( Kit_Node_t, pGraph->pNodes, 2 * pGraph->nCap ); 
        pGraph->nCap   = 2 * pGraph->nCap;
    }
    pNode = pGraph->pNodes + pGraph->nSize++;
    memset( pNode, 0, sizeof(Kit_Node_t) );
    return pNode;
}
コード例 #2
0
ファイル: wlcNtk.c プロジェクト: Shubhankar007/ECEN-699
int Wlc_ObjAlloc( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg )
{
    Wlc_Obj_t * pObj;
    assert( Type != WLC_OBJ_PO && Type != WLC_OBJ_FI );
    if ( p->iObj == p->nObjsAlloc )
    {
        p->pObjs = ABC_REALLOC( Wlc_Obj_t, p->pObjs, 2 * p->nObjsAlloc );
        memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Wlc_Obj_t) * p->nObjsAlloc );
        p->nObjsAlloc *= 2;
    }
    pObj = Wlc_NtkObj( p, p->iObj );
    pObj->Type   = Type;
    pObj->Signed = Signed;
    pObj->End    = End;
    pObj->Beg    = Beg;
    if ( Wlc_ObjIsCi(pObj) )
        Wlc_ObjSetCi( p, pObj );
    p->nObjs[Type]++;
    return p->iObj++;
}
コード例 #3
0
ファイル: cuddRef.c プロジェクト: Shubhankar007/ECEN-699
/**Function********************************************************************

  Synopsis    [Shrinks the death row.]

  Description [Shrinks the death row by a factor of four.]

  SideEffects [None]

  SeeAlso     [cuddClearDeathRow]

******************************************************************************/
void
cuddShrinkDeathRow(
  DdManager *table)
{
#ifndef DD_NO_DEATH_ROW
    int i;

    if (table->deathRowDepth > 3) {
        for (i = table->deathRowDepth/4; i < table->deathRowDepth; i++) {
            if (table->deathRow[i] == NULL) break;
            Cudd_IterDerefBdd(table,table->deathRow[i]);
            table->deathRow[i] = NULL;
        }
        table->deathRowDepth /= 4;
        table->deadMask = table->deathRowDepth - 1;
        if ((unsigned) table->nextDead > table->deadMask) {
            table->nextDead = 0;
        }
        table->deathRow = ABC_REALLOC(DdNodePtr, table->deathRow,
                                   table->deathRowDepth);
    }
#endif

} /* end of cuddShrinkDeathRow */
コード例 #4
0
ファイル: cuddRef.c プロジェクト: Shubhankar007/ECEN-699
/**Function********************************************************************

  Synopsis    [Decreases the reference count of BDD node n.]

  Description [Enqueues node n for later dereferencing. If the queue
  is full decreases the reference count of the oldest node N to make
  room for n. If N dies, recursively decreases the reference counts of
  its children.  It is used to dispose of a BDD that is currently not
  needed, but may be useful again in the near future. The dereferencing
  proper is done as in Cudd_IterDerefBdd.]

  SideEffects [None]

  SeeAlso     [Cudd_RecursiveDeref Cudd_IterDerefBdd]

******************************************************************************/
void
Cudd_DelayedDerefBdd(
  DdManager * table,
  DdNode * n)
{
    DdNode *N;
    int ord;
    DdNodePtr *stack;
    int SP;

    unsigned int live = table->keys - table->dead;
    if (live > table->peakLiveNodes) {
        table->peakLiveNodes = live;
    }

    n = Cudd_Regular(n);
#ifdef DD_DEBUG
    assert(n->ref != 0);
#endif

#ifdef DD_NO_DEATH_ROW
    N = n;
#else
    if (cuddIsConstant(n) || n->ref > 1) {
#ifdef DD_DEBUG
        assert(n->ref != 1 && (!cuddIsConstant(n) || n == DD_ONE(table)));
#endif
        cuddSatDec(n->ref);
        return;
    }

    N = table->deathRow[table->nextDead];

    if (N != NULL) {
#endif
#ifdef DD_DEBUG
        assert(!Cudd_IsComplement(N));
#endif
        stack = table->stack;
        SP = 1;
        do {
#ifdef DD_DEBUG
            assert(N->ref != 0);
#endif
            if (N->ref == 1) {
                N->ref = 0;
                table->dead++;
#ifdef DD_STATS
                table->nodesDropped++;
#endif
                ord = table->perm[N->index];
                stack[SP++] = Cudd_Regular(cuddE(N));
                table->subtables[ord].dead++;
                N = cuddT(N);
            } else {
                cuddSatDec(N->ref);
                N = stack[--SP];
            }
        } while (SP != 0);
#ifndef DD_NO_DEATH_ROW
    }
    table->deathRow[table->nextDead] = n;

    /* Udate insertion point. */
    table->nextDead++;
    table->nextDead &= table->deadMask;
#if 0
    if (table->nextDead == table->deathRowDepth) {
        if (table->deathRowDepth < table->looseUpTo / 2) {
            extern void (*MMoutOfMemory)(long);
            void (*saveHandler)(long) = MMoutOfMemory;
            DdNodePtr *newRow;
            MMoutOfMemory = Cudd_OutOfMem;
            newRow = ABC_REALLOC(DdNodePtr,table->deathRow,2*table->deathRowDepth);
            MMoutOfMemory = saveHandler;
            if (newRow == NULL) {
                table->nextDead = 0;
            } else {
                int i;
                table->memused += table->deathRowDepth;
                i = table->deathRowDepth;
                table->deathRowDepth <<= 1;
                for (; i < table->deathRowDepth; i++) {
                    newRow[i] = NULL;
                }
                table->deadMask = table->deathRowDepth - 1;
                table->deathRow = newRow;
            }
        } else {
            table->nextDead = 0;
        }
    }
#endif
#endif

} /* end of Cudd_DelayedDerefBdd */