abc/src/misc/mvc/mvcUtils.c
/**Function*************************************************************

  Synopsis    [Creates a new cover containing some literals of the old cover.]

  Description [Creates the new cover containing the given number (nVarsRem)
  literals of the old cover. All the bits of the new cover are initialized
  to "1". The selected bits from the old cover are copied on top. The numbers
  of the selected bits to copy are given in the array pVarsRem. The i-set
  entry in this array is the index of the bit in the old cover which goes
  to the i-th place in the new cover. If the i-th entry in pVarsRem is -1, 
  it means that the i-th bit does not change (remains composed of all 1's).
  This is a useful feature to speed up remapping covers, which are known
  to depend only on a subset of input variables.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Creates a new cover containing some literals of the old cover.]

Description [Creates the new cover containing the given number (nVarsRem)
literals of the old cover. All the bits of the new cover are initialized
to "1". The selected bits from the old cover are copied on top. The numbers
of the selected bits to copy are given in the array pVarsRem. The i-set
entry in this array is the index of the bit in the old cover which goes
to the i-th place in the new cover. If the i-th entry in pVarsRem is -1,
it means that the i-th bit does not change (remains composed of all 1's).
This is a useful feature to speed up remapping covers, which are known
to depend only on a subset of input variables.]




Function Synopsis [ Creates a new cover containing some literals of the old cover . ] Description [ Creates the new cover containing the given number ( nVarsRem ) literals of the old cover . All the bits of the new cover are initialized to " 1 " . The selected bits from the old cover are copied on top . The numbers of the selected bits to copy are given in the array pVarsRem . The i - set entry in this array is the index of the bit in the old cover which goes to the i - th place in the new cover . If the i - th entry in pVarsRem is - 1 it means that the i - th bit does not change ( remains composed of all 1 ' s ) . This is a useful feature to speed up remapping covers which are known to depend only on a subset of input variables . ]
Mvc_Cover_t * Mvc_CoverRemap( Mvc_Cover_t * p, int * pVarsRem, int nVarsRem )
{
    Mvc_Cover_t * pCover;
    Mvc_Cube_t * pCube, * pCubeCopy;
    int i;
    pCover = Mvc_CoverAlloc( p->pMem, nVarsRem );
    Mvc_CoverForEachCube( p, pCube )
    {
        pCubeCopy = Mvc_CubeAlloc( pCover );
        Mvc_CubeBitFill( pCubeCopy );      
        Mvc_CoverAddCubeTail( pCover, pCubeCopy );
    }
    for ( i = 0; i < nVarsRem; i++ )
    {
        if (pVarsRem[i] < 0) 
            continue;     
        assert( pVarsRem[i] >= 0 && pVarsRem[i] < p->nBits );
        Mvc_CoverCopyColumn( p, pCover, pVarsRem[i], i );
    }
    return pCover;
}
Mvc_Cover_t * Mvc_CoverRemap ( Mvc_Cover_t * p , int * pVarsRem , int nVarsRem ) { Mvc_Cover_t * pCover ; Mvc_Cube_t * pCube , * pCubeCopy ; int i ; pCover = Mvc_CoverAlloc ( p -> pMem , nVarsRem ) ; Mvc_CoverForEachCube ( p , pCube ) { pCubeCopy = Mvc_CubeAlloc ( pCover ) ; Mvc_CubeBitFill ( pCubeCopy ) ; Mvc_CoverAddCubeTail ( pCover , pCubeCopy ) ; } for ( i = 0 ; i < nVarsRem ; i ++ ) { if ( pVarsRem [ i ] < 0 ) continue ; assert ( pVarsRem [ i ] >= 0 && pVarsRem [ i ] < p -> nBits ) ; Mvc_CoverCopyColumn ( p , pCover , pVarsRem [ i ] , i ) ; } return pCover ; }
Function
Synopsis    [Creates a new cover containing some literals of the old cover.]
Function Synopsis [ Creates a new cover containing some literals of the old cover . ]
// clone the cover // copy the cube list //Mvc_CubeBitClean( pCubeCopy );   //changed by wjiang //changed by wjiang // copy the corresponding columns //added by wjiang