src/misc/mvc/mvcCube.c File Reference

#include "mvc.h"
Include dependency graph for mvcCube.c:

Go to the source code of this file.

Functions

Mvc_Cube_tMvc_CubeAlloc (Mvc_Cover_t *pCover)
Mvc_Cube_tMvc_CubeDup (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
void Mvc_CubeFree (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
void Mvc_CubeBitRemoveDcs (Mvc_Cube_t *pCube)

Function Documentation

Mvc_Cube_t* Mvc_CubeAlloc ( Mvc_Cover_t pCover  ) 

CFile****************************************************************

FileName [mvcCube.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Manipulating unate cubes.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id
mvcCube.c,v 1.4 2003/04/03 06:31:49 alanmi Exp

] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 40 of file mvcCube.c.

00041 {
00042     Mvc_Cube_t * pCube;
00043 
00044     assert( pCover->nWords >= 0 );
00045     // allocate the cube
00046 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
00047     if ( pCover->nWords == 0 )
00048         pCube = (Mvc_Cube_t *)malloc( sizeof(Mvc_Cube_t) );
00049     else
00050         pCube = (Mvc_Cube_t *)malloc( sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
00051 #else
00052     switch( pCover->nWords )
00053     {
00054     case 0:
00055     case 1:
00056         pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan1 );
00057         break;
00058     case 2:
00059         pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan2 );
00060         break;
00061     case 3:
00062     case 4:
00063         pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan4 );
00064         break;
00065     default:
00066         pCube = (Mvc_Cube_t *)malloc( sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
00067         break;
00068     }
00069 #endif
00070     // set the parameters charactering this cube
00071     if ( pCover->nWords == 0 )
00072         pCube->iLast   = pCover->nWords;
00073     else
00074         pCube->iLast   = pCover->nWords - 1;
00075     pCube->nUnused = pCover->nUnused;
00076     return pCube;
00077 }

void Mvc_CubeBitRemoveDcs ( Mvc_Cube_t pCube  ) 

Function*************************************************************

Synopsis [Removes the don't-care variable from the cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 156 of file mvcCube.c.

00157 {
00158     unsigned Mask;
00159     int i;
00160     for ( i = Mvc_CubeReadLast(pCube); i >= 0; i-- )
00161     {
00162         // detect those variables that are different (not DCs)
00163         Mask = (pCube->pData[i] ^ (pCube->pData[i] >> 1)) & BITS_DISJOINT; 
00164         // create the mask of all that are different
00165         Mask |= (Mask << 1);
00166         // remove other bits from the set
00167         pCube->pData[i] &= Mask;
00168     }
00169 }

Mvc_Cube_t* Mvc_CubeDup ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file mvcCube.c.

00092 {
00093     Mvc_Cube_t * pCubeCopy;
00094     pCubeCopy = Mvc_CubeAlloc( pCover );
00095     Mvc_CubeBitCopy( pCubeCopy, pCube );
00096     return pCubeCopy;
00097 }

void Mvc_CubeFree ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file mvcCube.c.

00112 {
00113     if ( pCube == NULL )
00114         return;
00115 
00116     // verify the parameters charactering this cube
00117     assert( pCube->iLast == 0 || ((int)pCube->iLast) == pCover->nWords - 1 );
00118     assert( ((int)pCube->nUnused) == pCover->nUnused );
00119 
00120     // deallocate the cube
00121 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
00122     free( pCube );
00123 #else
00124     switch( pCover->nWords )
00125     {
00126     case 0:
00127     case 1:
00128         Extra_MmFixedEntryRecycle( pCover->pMem->pMan1, (char *)pCube );
00129         break;
00130     case 2:
00131         Extra_MmFixedEntryRecycle( pCover->pMem->pMan2, (char *)pCube );
00132         break;
00133     case 3:
00134     case 4:
00135         Extra_MmFixedEntryRecycle( pCover->pMem->pMan4, (char *)pCube );
00136         break;
00137     default:
00138         free( pCube );
00139         break;
00140     }
00141 #endif
00142 }


Generated on Tue Jan 5 12:19:16 2010 for abc70930 by  doxygen 1.6.1