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

  Synopsis    [Creates the expanded cover.]

  Description [The original cover is expanded by adding some variables.
  These variables are the additional variables in pVmNew, compared to
  pCvr->pVm. The resulting cover is the same as the original one, except
  that it contains the additional variables present as full literals
  in every cube.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Creates the expanded cover.]

Description [The original cover is expanded by adding some variables.
These variables are the additional variables in pVmNew, compared to
pCvr->pVm. The resulting cover is the same as the original one, except
that it contains the additional variables present as full literals
in every cube.]




Function Synopsis [ Creates the expanded cover . ] Description [ The original cover is expanded by adding some variables . These variables are the additional variables in pVmNew compared to pCvr - > pVm . The resulting cover is the same as the original one except that it contains the additional variables present as full literals in every cube . ]
Mvc_Cover_t * Mvc_CoverCreateExpanded( Mvc_Cover_t * pCover, Vm_VarMap_t * pVmNew )
{
    Mvc_Cover_t * pCoverNew;
    Mvc_Cube_t * pCube, * pCubeNew;
    int i, iLast, iLastNew;
    pCoverNew = Mvc_CoverAlloc( pCover->pMem, Vm_VarMapReadValuesInNum(pVmNew) );
    Mvc_CoverAllocateMask( pCoverNew );
    Mvc_CubeBitClean( pCoverNew->pMask );
    for ( i = pCover->nBits; i < pCoverNew->nBits; i++ )
        Mvc_CubeBitInsert( pCoverNew->pMask, i );
    iLast    = pCover->nWords?    pCover->nWords - 1: 0;
    iLastNew = pCoverNew->nWords? pCoverNew->nWords - 1: 0;
    Mvc_CoverForEachCube( pCover, pCube )
    {
        pCubeNew = Mvc_CubeAlloc( pCoverNew );
        Mvc_CubeBitClean( pCubeNew );
        Mvc_CubeSetLast( pCubeNew, iLast );
        Mvc_CubeBitCopy( pCubeNew, pCube );
        Mvc_CubeSetLast( pCubeNew, iLastNew );
        Mvc_CubeBitOr( pCubeNew, pCubeNew, pCoverNew->pMask );
        Mvc_CoverAddCubeTail( pCoverNew, pCubeNew );
    }
    return pCoverNew;
}
Mvc_Cover_t * Mvc_CoverCreateExpanded ( Mvc_Cover_t * pCover , Vm_VarMap_t * pVmNew ) { Mvc_Cover_t * pCoverNew ; Mvc_Cube_t * pCube , * pCubeNew ; int i , iLast , iLastNew ; pCoverNew = Mvc_CoverAlloc ( pCover -> pMem , Vm_VarMapReadValuesInNum ( pVmNew ) ) ; Mvc_CoverAllocateMask ( pCoverNew ) ; Mvc_CubeBitClean ( pCoverNew -> pMask ) ; for ( i = pCover -> nBits ; i < pCoverNew -> nBits ; i ++ ) Mvc_CubeBitInsert ( pCoverNew -> pMask , i ) ; iLast = pCover -> nWords ? pCover -> nWords - 1 : 0 ; iLastNew = pCoverNew -> nWords ? pCoverNew -> nWords - 1 : 0 ; Mvc_CoverForEachCube ( pCover , pCube ) { pCubeNew = Mvc_CubeAlloc ( pCoverNew ) ; Mvc_CubeBitClean ( pCubeNew ) ; Mvc_CubeSetLast ( pCubeNew , iLast ) ; Mvc_CubeBitCopy ( pCubeNew , pCube ) ; Mvc_CubeSetLast ( pCubeNew , iLastNew ) ; Mvc_CubeBitOr ( pCubeNew , pCubeNew , pCoverNew -> pMask ) ; Mvc_CoverAddCubeTail ( pCoverNew , pCubeNew ) ; } return pCoverNew ; }
Function
Synopsis    [Creates the expanded cover.]
Function Synopsis [ Creates the expanded cover . ]
// create the new cover // get the cube composed of extra bits // get the indexes of the last words in both covers // create the cubes of the new cover // copy the bits (cannot immediately use Mvc_CubeBitCopy,  // because covers have different numbers of bits) // add the extra bits // add the cube to the new cover