abc/src/aig/ivy/ivySeq.c
/**Function*************************************************************

  Synopsis    [Transforms the decomposition graph into the AIG.]

  Description [AIG nodes for the fanins should be assigned to pNode->pFunc
  of the leaves of the graph before calling this procedure.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Transforms the decomposition graph into the AIG.]

Description [AIG nodes for the fanins should be assigned to pNode->pFunc
of the leaves of the graph before calling this procedure.]




Function Synopsis [ Transforms the decomposition graph into the AIG . ] Description [ AIG nodes for the fanins should be assigned to pNode - > pFunc of the leaves of the graph before calling this procedure . ]
Ivy_Obj_t * Ivy_GraphToNetworkSeq( Ivy_Man_t * p, Dec_Graph_t * pGraph )
{
    Ivy_Obj_t * pAnd0, * pAnd1;
    Dec_Node_t * pNode = NULL; 
    int i, k;
    if ( Dec_GraphIsConst(pGraph) )
        return Ivy_NotCond( Ivy_ManConst1(p), Dec_GraphIsComplement(pGraph) );
    if ( Dec_GraphIsVar(pGraph) )
    {
        pNode = Dec_GraphVar(pGraph);
        for ( k = 0; k < (int)pNode->nLat2; k++ )
            pNode->pFunc = Ivy_Latch( p, (Ivy_Obj_t *)pNode->pFunc, IVY_INIT_DC );
        return Ivy_NotCond( (Ivy_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) );
    }
    Dec_GraphForEachNode( pGraph, pNode, i )
    {
        pAnd0 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl ); 
        pAnd1 = Ivy_NotCond( (Ivy_Obj_t *)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl ); 
        for ( k = 0; k < (int)pNode->nLat0; k++ )
            pAnd0 = Ivy_Latch( p, pAnd0, IVY_INIT_DC );
        for ( k = 0; k < (int)pNode->nLat1; k++ )
            pAnd1 = Ivy_Latch( p, pAnd1, IVY_INIT_DC );
        pNode->pFunc = Ivy_And( p, pAnd0, pAnd1 );
    }
    for ( k = 0; k < (int)pNode->nLat2; k++ )
        pNode->pFunc = Ivy_Latch( p, (Ivy_Obj_t *)pNode->pFunc, IVY_INIT_DC );
    return Ivy_NotCond( (Ivy_Obj_t *)pNode->pFunc, Dec_GraphIsComplement(pGraph) );
}
Ivy_Obj_t * Ivy_GraphToNetworkSeq ( Ivy_Man_t * p , Dec_Graph_t * pGraph ) { Ivy_Obj_t * pAnd0 , * pAnd1 ; Dec_Node_t * pNode = NULL ; int i , k ; if ( Dec_GraphIsConst ( pGraph ) ) return Ivy_NotCond ( Ivy_ManConst1 ( p ) , Dec_GraphIsComplement ( pGraph ) ) ; if ( Dec_GraphIsVar ( pGraph ) ) { pNode = Dec_GraphVar ( pGraph ) ; for ( k = 0 ; k < ( int ) pNode -> nLat2 ; k ++ ) pNode -> pFunc = Ivy_Latch ( p , ( Ivy_Obj_t * ) pNode -> pFunc , IVY_INIT_DC ) ; return Ivy_NotCond ( ( Ivy_Obj_t * ) pNode -> pFunc , Dec_GraphIsComplement ( pGraph ) ) ; } Dec_GraphForEachNode ( pGraph , pNode , i ) { pAnd0 = Ivy_NotCond ( ( Ivy_Obj_t * ) Dec_GraphNode ( pGraph , pNode -> eEdge0 . Node ) -> pFunc , pNode -> eEdge0 . fCompl ) ; pAnd1 = Ivy_NotCond ( ( Ivy_Obj_t * ) Dec_GraphNode ( pGraph , pNode -> eEdge1 . Node ) -> pFunc , pNode -> eEdge1 . fCompl ) ; for ( k = 0 ; k < ( int ) pNode -> nLat0 ; k ++ ) pAnd0 = Ivy_Latch ( p , pAnd0 , IVY_INIT_DC ) ; for ( k = 0 ; k < ( int ) pNode -> nLat1 ; k ++ ) pAnd1 = Ivy_Latch ( p , pAnd1 , IVY_INIT_DC ) ; pNode -> pFunc = Ivy_And ( p , pAnd0 , pAnd1 ) ; } for ( k = 0 ; k < ( int ) pNode -> nLat2 ; k ++ ) pNode -> pFunc = Ivy_Latch ( p , ( Ivy_Obj_t * ) pNode -> pFunc , IVY_INIT_DC ) ; return Ivy_NotCond ( ( Ivy_Obj_t * ) pNode -> pFunc , Dec_GraphIsComplement ( pGraph ) ) ; }
Function
Synopsis    [Transforms the decomposition graph into the AIG.]
Function Synopsis [ Transforms the decomposition graph into the AIG . ]
// Suppress "might be used uninitialized" // check for constant function // check for a literal // get the variable node // add the remaining latches // build the AIG nodes corresponding to the AND gates of the graph // add the latches // create the node // add the remaining latches // complement the result if necessary