#include "mvc.h"
Go to the source code of this file.
Functions | |
Mvc_Cover_t * | Mvc_CoverAlloc (Mvc_Manager_t *pMem, int nBits) |
Mvc_Cover_t * | Mvc_CoverClone (Mvc_Cover_t *p) |
Mvc_Cover_t * | Mvc_CoverDup (Mvc_Cover_t *p) |
void | Mvc_CoverFree (Mvc_Cover_t *p) |
void | Mvc_CoverAllocateMask (Mvc_Cover_t *pCover) |
void | Mvc_CoverAllocateArrayLits (Mvc_Cover_t *pCover) |
void | Mvc_CoverAllocateArrayCubes (Mvc_Cover_t *pCover) |
void | Mvc_CoverDeallocateMask (Mvc_Cover_t *pCover) |
void | Mvc_CoverDeallocateArrayLits (Mvc_Cover_t *pCover) |
Mvc_Cover_t* Mvc_CoverAlloc | ( | Mvc_Manager_t * | pMem, | |
int | nBits | |||
) |
CFile****************************************************************
FileName [mvcCover.c]
PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]
Synopsis [Basic procedures to manipulate unate cube covers.]
Author [MVSIS Group]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - February 1, 2003.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 40 of file mvcCover.c.
00041 { 00042 Mvc_Cover_t * p; 00043 int nBitsInUnsigned; 00044 00045 nBitsInUnsigned = 8 * sizeof(Mvc_CubeWord_t); 00046 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT 00047 p = (Mvc_Cover_t *)malloc( sizeof(Mvc_Cover_t) ); 00048 #else 00049 p = (Mvc_Cover_t *)Extra_MmFixedEntryFetch( pMem->pManC ); 00050 #endif 00051 p->pMem = pMem; 00052 p->nBits = nBits; 00053 p->nWords = nBits / nBitsInUnsigned + (int)(nBits % nBitsInUnsigned > 0); 00054 p->nUnused = p->nWords * nBitsInUnsigned - p->nBits; 00055 p->lCubes.nItems = 0; 00056 p->lCubes.pHead = NULL; 00057 p->lCubes.pTail = NULL; 00058 p->nCubesAlloc = 0; 00059 p->pCubes = NULL; 00060 p->pMask = NULL; 00061 p->pLits = NULL; 00062 return p; 00063 }
void Mvc_CoverAllocateArrayCubes | ( | Mvc_Cover_t * | pCover | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 199 of file mvcCover.c.
00200 { 00201 if ( pCover->nCubesAlloc < pCover->lCubes.nItems ) 00202 { 00203 if ( pCover->nCubesAlloc > 0 ) 00204 MEM_FREE( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc, pCover->pCubes ); 00205 pCover->nCubesAlloc = pCover->lCubes.nItems; 00206 pCover->pCubes = MEM_ALLOC( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc ); 00207 } 00208 }
void Mvc_CoverAllocateArrayLits | ( | Mvc_Cover_t * | pCover | ) |
void Mvc_CoverAllocateMask | ( | Mvc_Cover_t * | pCover | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 165 of file mvcCover.c.
00166 { 00167 if ( pCover->pMask == NULL ) 00168 pCover->pMask = Mvc_CubeAlloc( pCover ); 00169 }
Mvc_Cover_t* Mvc_CoverClone | ( | Mvc_Cover_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 76 of file mvcCover.c.
00077 { 00078 Mvc_Cover_t * pCover; 00079 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT 00080 pCover = (Mvc_Cover_t *)malloc( sizeof(Mvc_Cover_t) ); 00081 #else 00082 pCover = (Mvc_Cover_t *)Extra_MmFixedEntryFetch( p->pMem->pManC ); 00083 #endif 00084 pCover->pMem = p->pMem; 00085 pCover->nBits = p->nBits; 00086 pCover->nWords = p->nWords; 00087 pCover->nUnused = p->nUnused; 00088 pCover->lCubes.nItems = 0; 00089 pCover->lCubes.pHead = NULL; 00090 pCover->lCubes.pTail = NULL; 00091 pCover->nCubesAlloc = 0; 00092 pCover->pCubes = NULL; 00093 pCover->pMask = NULL; 00094 pCover->pLits = NULL; 00095 return pCover; 00096 }
void Mvc_CoverDeallocateArrayLits | ( | Mvc_Cover_t * | pCover | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 238 of file mvcCover.c.
void Mvc_CoverDeallocateMask | ( | Mvc_Cover_t * | pCover | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 221 of file mvcCover.c.
00222 { 00223 Mvc_CubeFree( pCover, pCover->pMask ); 00224 pCover->pMask = NULL; 00225 }
Mvc_Cover_t* Mvc_CoverDup | ( | Mvc_Cover_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 109 of file mvcCover.c.
00110 { 00111 Mvc_Cover_t * pCover; 00112 Mvc_Cube_t * pCube, * pCubeCopy; 00113 // clone the cover 00114 pCover = Mvc_CoverClone( p ); 00115 // copy the cube list 00116 Mvc_CoverForEachCube( p, pCube ) 00117 { 00118 pCubeCopy = Mvc_CubeDup( p, pCube ); 00119 Mvc_CoverAddCubeTail( pCover, pCubeCopy ); 00120 } 00121 return pCover; 00122 }
void Mvc_CoverFree | ( | Mvc_Cover_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 135 of file mvcCover.c.
00136 { 00137 Mvc_Cube_t * pCube, * pCube2; 00138 // recycle cube list 00139 Mvc_CoverForEachCubeSafe( p, pCube, pCube2 ) 00140 Mvc_CubeFree( p, pCube ); 00141 // recycle other pointers 00142 Mvc_CubeFree( p, p->pMask ); 00143 MEM_FREE( p->pMem, Mvc_Cube_t *, p->nCubesAlloc, p->pCubes ); 00144 MEM_FREE( p->pMem, int, p->nBits, p->pLits ); 00145 00146 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT 00147 free( p ); 00148 #else 00149 Extra_MmFixedEntryRecycle( p->pMem->pManC, (char *)p ); 00150 #endif 00151 }