abc/src/bdd/cudd/cuddEssent.c
/**Function********************************************************************

  Synopsis    [Computes the two-literal clauses for a node.]

  Description [Computes the two-literal clauses for a node with a zero
  child, given the clauses for its other child and the label of the
  node.  Returns a pointer to a TclInfo structure if successful; NULL
  otherwise.]

  SideEffects [None]

  SeeAlso     [computeClauses]

******************************************************************************/
Function
Synopsis    [Computes the two-literal clauses for a node.]

Description [Computes the two-literal clauses for a node with a zero
child, given the clauses for its other child and the label of the
node.  Returns a pointer to a TclInfo structure if successful; NULL
otherwise.]




Function Synopsis [ Computes the two - literal clauses for a node . ] Description [ Computes the two - literal clauses for a node with a zero child given the clauses for its other child and the label of the node . Returns a pointer to a TclInfo structure if successful ; NULL otherwise . ]
static DdTlcInfo *
computeClausesWithUniverse(
  DdTlcInfo *Cres ,
  DdHalfWord label ,
  short phase )
{
    DdHalfWord *Ccv = Cres->vars; 
    BitVector *Ccp = Cres->phases; 
    DdHalfWord *Vcv = NULL; 
    BitVector *Vcp = NULL; 
    DdTlcInfo *res = NULL; 
    int i;
    res = tlcInfoAlloc();
    if (res == NULL) goto cleanup;
    for (i = 0; !sentinelp(Ccv[i], Ccv[i+1]); i += 2);
    Vcv = ABC_ALLOC(DdHalfWord,i+4);
    if (Vcv == NULL) goto cleanup;
    Vcp = bitVectorAlloc(i+4);
    if (Vcp == NULL) goto cleanup;
    res->vars = Vcv;
    res->phases = Vcp;
    for (i = 0; !sentinelp(Ccv[i], Ccv[i+1]); i += 2) {
        Vcv[i] = Ccv[i];
        Vcv[i+1] = Ccv[i+1];
        bitVectorSet(Vcp, i, bitVectorRead(Ccp, i));
        bitVectorSet(Vcp, i+1, bitVectorRead(Ccp, i+1));
    }
    Vcv[i] = label;
    bitVectorSet(Vcp, i, phase);
    i++;
    Vcv[i] = CUDD_MAXINDEX;
    bitVectorSet(Vcp, i, 1);
    i++;
    Vcv[i] = 0;
    Vcv[i+1] = 0;
    bitVectorSet(Vcp, i, 0);
    bitVectorSet(Vcp, i+1, 0);
    return(res);
 cleanup:
    if (Vcv != NULL) ABC_FREE(Vcv);
    if (res != NULL) Cudd_tlcInfoFree(res);
    return(NULL);
}
static DdTlcInfo * computeClausesWithUniverse ( DdTlcInfo * Cres , DdHalfWord label , short phase ) { DdHalfWord * Ccv = Cres -> vars ; BitVector * Ccp = Cres -> phases ; DdHalfWord * Vcv = NULL ; BitVector * Vcp = NULL ; DdTlcInfo * res = NULL ; int i ; res = tlcInfoAlloc ( ) ; if ( res == NULL ) goto cleanup ; for ( i = 0 ; ! sentinelp ( Ccv [ i ] , Ccv [ i + 1 ] ) ; i += 2 ) ; Vcv = ABC_ALLOC ( DdHalfWord , i + 4 ) ; if ( Vcv == NULL ) goto cleanup ; Vcp = bitVectorAlloc ( i + 4 ) ; if ( Vcp == NULL ) goto cleanup ; res -> vars = Vcv ; res -> phases = Vcp ; for ( i = 0 ; ! sentinelp ( Ccv [ i ] , Ccv [ i + 1 ] ) ; i += 2 ) { Vcv [ i ] = Ccv [ i ] ; Vcv [ i + 1 ] = Ccv [ i + 1 ] ; bitVectorSet ( Vcp , i , bitVectorRead ( Ccp , i ) ) ; bitVectorSet ( Vcp , i + 1 , bitVectorRead ( Ccp , i + 1 ) ) ; } Vcv [ i ] = label ; bitVectorSet ( Vcp , i , phase ) ; i ++ ; Vcv [ i ] = CUDD_MAXINDEX ; bitVectorSet ( Vcp , i , 1 ) ; i ++ ; Vcv [ i ] = 0 ; Vcv [ i + 1 ] = 0 ; bitVectorSet ( Vcp , i , 0 ) ; bitVectorSet ( Vcp , i + 1 , 0 ) ; return ( res ) ; cleanup : if ( Vcv != NULL ) ABC_FREE ( Vcv ) ; if ( res != NULL ) Cudd_tlcInfoFree ( res ) ; return ( NULL ) ; }
Function
Synopsis    [Computes the two-literal clauses for a node.]
Function Synopsis [ Computes the two - literal clauses for a node . ]
/* list of clauses for child */ /* variable labeling the current node */ /* 0 if E child is zero; 1 if T child is zero */ /* variables of clauses for child */ /* phases of clauses for child */ /* pointer to the variables of the clauses for v */ /* pointer to the phases of the clauses for v */ /* the set of clauses to be returned */ /* Initialize result. */ /* Count entries for new list and allocate accordingly. */ /* At this point, i is twice the number of clauses in the child's
    ** list.  We need four more entries for this node: 2 for the one-literal
    ** clause for the label, and 2 for the sentinel. */ /* Copy old list into new. */ /* Add clause corresponding to label. */ /* Add sentinel. */ /* Vcp is guaranteed to be NULL here.  Hence, we do not try to free it. */