abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mvc.h File Reference
#include <stdio.h>
#include "misc/extra/extra.h"

Go to the source code of this file.

Data Structures

struct  MvcCubeStruct
 
struct  MvcListStruct
 
struct  MvcCoverStruct
 
struct  MvcDataStruct
 
struct  MvcManagerStruct
 

Macros

#define BITS_PER_WORD   32
 INCLUDES ///. More...
 
#define BITS_PER_WORD_MINUS   31
 
#define BITS_PER_WORD_LOG   5
 
#define BITS_DISJOINT   ((Mvc_CubeWord_t)0x55555555)
 
#define BITS_FULL   ((Mvc_CubeWord_t)0xffffffff)
 
#define Mvc_CubeReadNext(Cube)   ((Cube)->pNext)
 MACRO DEFINITIONS ///. More...
 
#define Mvc_CubeReadNextP(Cube)   (&(Cube)->pNext)
 
#define Mvc_CubeReadLast(Cube)   ((Cube)->iLast)
 
#define Mvc_CubeReadSize(Cube)   ((Cube)->nOnes)
 
#define Mvc_CubeSetNext(Cube, Next)   ((Cube)->pNext = (Next))
 
#define Mvc_CubeSetLast(Cube, Last)   ((Cube)->iLast = (Last))
 
#define Mvc_CubeSetSize(Cube, Size)   ((Cube)->nOnes = (Size))
 
#define Mvc_Cube1Words(Cube)   ((Cube)->iLast == 0)
 
#define Mvc_Cube2Words(Cube)   ((Cube)->iLast == 1)
 
#define Mvc_CubeNWords(Cube)   ((Cube)->iLast > 1)
 
#define Mvc_CubeWhichWord(Bit)   ((Bit) >> BITS_PER_WORD_LOG)
 
#define Mvc_CubeWhichBit(Bit)   ((Bit) & BITS_PER_WORD_MINUS)
 
#define Mvc_CubeBitValue(Cube, Bit)   (((Cube)->pData[Mvc_CubeWhichWord(Bit)] & (((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit)))) > 0)
 
#define Mvc_CubeBitInsert(Cube, Bit)   ((Cube)->pData[Mvc_CubeWhichWord(Bit)] |= (((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit))))
 
#define Mvc_CubeBitRemove(Cube, Bit)   ((Cube)->pData[Mvc_CubeWhichWord(Bit)] &= ~(((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit))))
 
#define Mvc_CubeVarValue(Cube, Var)   (((Cube)->pData[Mvc_CubeWhichWord(2*(Var))] >> (Mvc_CubeWhichBit(2*(Var)))) & ((Mvc_CubeWord_t)3))
 
#define Mvc_Cube1BitClean(Cube)   ((Cube)->pData[0] = 0)
 
#define Mvc_Cube2BitClean(Cube)
 
#define Mvc_CubeNBitClean(Cube)
 
#define Mvc_CubeBitCleanUnused(Cube)   ((Cube)->pData[(Cube)->iLast] &= (BITS_FULL >> (Cube)->nUnused))
 
#define Mvc_Cube1BitFill(Cube)   (Cube)->pData[0] = (BITS_FULL >> (Cube)->nUnused);
 
#define Mvc_Cube2BitFill(Cube)
 
#define Mvc_CubeNBitFill(Cube)
 
#define Mvc_Cube1BitNot(Cube)   ((Cube)->pData[0] ^= (BITS_FULL >> (Cube)->nUnused))
 
#define Mvc_Cube2BitNot(Cube)
 
#define Mvc_CubeNBitNot(Cube)
 
#define Mvc_Cube1BitCopy(Cube1, Cube2)   (((Cube1)->pData[0]) = ((Cube2)->pData[0]))
 
#define Mvc_Cube2BitCopy(Cube1, Cube2)
 
#define Mvc_CubeNBitCopy(Cube1, Cube2)
 
#define Mvc_Cube1BitOr(CubeR, Cube1, Cube2)   (((CubeR)->pData[0]) = ((Cube1)->pData[0] | (Cube2)->pData[0]))
 
#define Mvc_Cube2BitOr(CubeR, Cube1, Cube2)
 
#define Mvc_CubeNBitOr(CubeR, Cube1, Cube2)
 
#define Mvc_Cube1BitExor(CubeR, Cube1, Cube2)   (((CubeR)->pData[0]) = ((Cube1)->pData[0] ^ (Cube2)->pData[0]))
 
#define Mvc_Cube2BitExor(CubeR, Cube1, Cube2)
 
#define Mvc_CubeNBitExor(CubeR, Cube1, Cube2)
 
#define Mvc_Cube1BitAnd(CubeR, Cube1, Cube2)   (((CubeR)->pData[0]) = ((Cube1)->pData[0] & (Cube2)->pData[0]))
 
#define Mvc_Cube2BitAnd(CubeR, Cube1, Cube2)
 
#define Mvc_CubeNBitAnd(CubeR, Cube1, Cube2)
 
#define Mvc_Cube1BitSharp(CubeR, Cube1, Cube2)   (((CubeR)->pData[0]) = ((Cube1)->pData[0] & ~((Cube2)->pData[0])))
 
#define Mvc_Cube2BitSharp(CubeR, Cube1, Cube2)
 
#define Mvc_CubeNBitSharp(CubeR, Cube1, Cube2)
 
#define Mvc_Cube1BitEmpty(Res, Cube)   (Res = ((Cube)->pData[0] == 0))
 
#define Mvc_Cube2BitEmpty(Res, Cube)   (Res = ((Cube)->pData[0] == 0 && (Cube)->pData[1] == 0))
 
#define Mvc_CubeNBitEmpty(Res, Cube)
 
#define Mvc_Cube1BitEqual(Res, Cube1, Cube2)   (Res = (((Cube1)->pData[0]) == ((Cube2)->pData[0])))
 
#define Mvc_Cube2BitEqual(Res, Cube1, Cube2)
 
#define Mvc_CubeNBitEqual(Res, Cube1, Cube2)
 
#define Mvc_Cube1BitLess(Res, Cube1, Cube2)   (Res = (((Cube1)->pData[0]) < ((Cube2)->pData[0])))
 
#define Mvc_Cube2BitLess(Res, Cube1, Cube2)
 
#define Mvc_CubeNBitLess(Res, Cube1, Cube2)
 
#define Mvc_Cube1BitMore(Res, Cube1, Cube2)   (Res = (((Cube1)->pData[0]) > ((Cube2)->pData[0])))
 
#define Mvc_Cube2BitMore(Res, Cube1, Cube2)
 
#define Mvc_CubeNBitMore(Res, Cube1, Cube2)
 
#define Mvc_Cube1BitNotImpl(Res, Cube1, Cube2)   (Res = (((Cube1)->pData[0]) & ~((Cube2)->pData[0])))
 
#define Mvc_Cube2BitNotImpl(Res, Cube1, Cube2)
 
#define Mvc_CubeNBitNotImpl(Res, Cube1, Cube2)
 
#define Mvc_Cube1BitDisjoint(Res, Cube1, Cube2)   (Res = ((((Cube1)->pData[0]) & ((Cube2)->pData[0])) == 0 ))
 
#define Mvc_Cube2BitDisjoint(Res, Cube1, Cube2)
 
#define Mvc_CubeNBitDisjoint(Res, Cube1, Cube2)
 
#define Mvc_Cube1BitEqualUnderMask(Res, Cube1, Cube2, Mask)   (Res = ((((Cube1)->pData[0]) & ((Mask)->pData[0])) == (((Cube2)->pData[0]) & ((Mask)->pData[0]))))
 
#define Mvc_Cube2BitEqualUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeNBitEqualUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_Cube1BitEqualOutsideMask(Res, Cube1, Cube2, Mask)   (Res = ((((Cube1)->pData[0]) | ((Mask)->pData[0])) == (((Cube2)->pData[0]) | ((Mask)->pData[0]))))
 
#define Mvc_Cube2BitEqualOutsideMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeNBitEqualOutsideMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_Cube1BitIntersectUnderMask(Res, Cube1, Cube2, Mask)   (Res = ((((Cube1)->pData[0]) & ((Cube2)->pData[0]) & ((Mask)->pData[0])) > 0))
 
#define Mvc_Cube2BitIntersectUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeNBitIntersectUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_Cube1BitNotImplUnderMask(Res, Cube1, Cube2, Mask)   (Res = (((Mask)->pData[0]) & ((Cube1)->pData[0]) & ~((Cube2)->pData[0])))
 
#define Mvc_Cube2BitNotImplUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeNBitNotImplUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeBitClean(Cube)
 
#define Mvc_CubeBitFill(Cube)
 
#define Mvc_CubeBitNot(Cube)
 
#define Mvc_CubeBitCopy(Cube1, Cube2)
 
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
 
#define Mvc_CubeBitExor(CubeR, Cube1, Cube2)
 
#define Mvc_CubeBitAnd(CubeR, Cube1, Cube2)
 
#define Mvc_CubeBitSharp(CubeR, Cube1, Cube2)
 
#define Mvc_CubeBitEmpty(Res, Cube)
 
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
 
#define Mvc_CubeBitLess(Res, Cube1, Cube2)
 
#define Mvc_CubeBitMore(Res, Cube1, Cube2)
 
#define Mvc_CubeBitNotImpl(Res, Cube1, Cube2)
 
#define Mvc_CubeBitDisjoint(Res, Cube1, Cube2)
 
#define Mvc_CubeBitEqualUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeBitEqualOutsideMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeBitIntersectUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_CubeBitNotImplUnderMask(Res, Cube1, Cube2, Mask)
 
#define Mvc_ListAddCubeHead(pList, pCube)
 
#define Mvc_ListAddCubeTail(pList, pCube)
 
#define Mvc_ListDeleteCube(pList, pPrev, pCube)
 
#define Mvc_CoverAddCubeHead(pCover, pCube)
 
#define Mvc_CoverAddCubeTail(pCover, pCube)
 
#define Mvc_CoverDeleteCube(pCover, pPrev, pCube)
 
#define Mvc_ListForEachCube(List, Cube)
 
#define Mvc_ListForEachCubeSafe(List, Cube, Cube2)
 
#define Mvc_CoverForEachCube(Cover, Cube)
 
#define Mvc_CoverForEachCubeWithIndex(Cover, Cube, Index)
 
#define Mvc_CoverForEachCubeSafe(Cover, Cube, Cube2)
 
#define Mvc_CoverForEachCubeStart(Start, Cube)
 
#define Mvc_CoverForEachCubeStartSafe(Start, Cube, Cube2)
 
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
 
#define Mvc_CubeForEachVarValue(Cover, Cube, iVar, Value)
 
#define MEM_ALLOC(Manager, Type, Size)   ((Type *)ABC_ALLOC( char, (Size) * sizeof(Type) ))
 
#define MEM_FREE(Manager, Type, Size, Pointer)   if ( Pointer ) { ABC_FREE(Pointer); Pointer = NULL; }
 

Typedefs

typedef unsigned int Mvc_CubeWord_t
 STRUCTURE DEFINITIONS ///. More...
 
typedef struct MvcCubeStruct Mvc_Cube_t
 
typedef struct MvcListStruct Mvc_List_t
 
typedef struct MvcCoverStruct Mvc_Cover_t
 
typedef struct MvcDataStruct Mvc_Data_t
 
typedef struct MvcManagerStruct Mvc_Manager_t
 

Functions

int Mvc_CoverReadWordNum (Mvc_Cover_t *pCover)
 FUNCTION DEFINITIONS ///. More...
 
int Mvc_CoverReadBitNum (Mvc_Cover_t *pCover)
 
int Mvc_CoverReadCubeNum (Mvc_Cover_t *pCover)
 
Mvc_Cube_tMvc_CoverReadCubeHead (Mvc_Cover_t *pCover)
 
Mvc_Cube_tMvc_CoverReadCubeTail (Mvc_Cover_t *pCover)
 
Mvc_List_tMvc_CoverReadCubeList (Mvc_Cover_t *pCover)
 
int Mvc_ListReadCubeNum (Mvc_List_t *pList)
 
Mvc_Cube_tMvc_ListReadCubeHead (Mvc_List_t *pList)
 
Mvc_Cube_tMvc_ListReadCubeTail (Mvc_List_t *pList)
 
void Mvc_CoverSetCubeNum (Mvc_Cover_t *pCover, int nItems)
 
void Mvc_CoverSetCubeHead (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverSetCubeTail (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverSetCubeList (Mvc_Cover_t *pCover, Mvc_List_t *pList)
 
int Mvc_CoverIsEmpty (Mvc_Cover_t *pCover)
 
int Mvc_CoverIsTautology (Mvc_Cover_t *pCover)
 
int Mvc_CoverIsBinaryBuffer (Mvc_Cover_t *pCover)
 
void Mvc_CoverMakeEmpty (Mvc_Cover_t *pCover)
 
void Mvc_CoverMakeTautology (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCreateEmpty (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCreateTautology (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverAlloc (Mvc_Manager_t *pMem, int nBits)
 DECLARATIONS ///. More...
 
Mvc_Cover_tMvc_CoverCreateConst (Mvc_Manager_t *pMem, int nBits, int Phase)
 
Mvc_Cover_tMvc_CoverClone (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverDup (Mvc_Cover_t *pCover)
 
void Mvc_CoverFree (Mvc_Cover_t *pCover)
 
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_Cube_tMvc_CubeAlloc (Mvc_Cover_t *pCover)
 DECLARATIONS ///. More...
 
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)
 
int Mvc_CubeCompareInt (Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
 DECLARATIONS ///. More...
 
int Mvc_CubeCompareSizeAndInt (Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
 
int Mvc_CubeCompareIntUnderMask (Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
 
int Mvc_CubeCompareIntOutsideMask (Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
 
int Mvc_CubeCompareIntOutsideAndUnderMask (Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
 
Mvc_Cover_tMvc_CoverDivisor (Mvc_Cover_t *pCover)
 FUNCTION DEFINITIONS ///. More...
 
void Mvc_CoverDivide (Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
 FUNCTION DEFINITIONS ///. More...
 
void Mvc_CoverDivideInternal (Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
 
void Mvc_CoverDivideByLiteral (Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
 
void Mvc_CoverDivideByCube (Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
 
void Mvc_CoverDivideByLiteralQuo (Mvc_Cover_t *pCover, int iLit)
 
void Mvc_ListAddCubeHead_ (Mvc_List_t *pList, Mvc_Cube_t *pCube)
 DECLARATIONS ///. More...
 
void Mvc_ListAddCubeTail_ (Mvc_List_t *pList, Mvc_Cube_t *pCube)
 
void Mvc_ListDeleteCube_ (Mvc_List_t *pList, Mvc_Cube_t *pPrev, Mvc_Cube_t *pCube)
 
void Mvc_CoverAddCubeHead_ (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverAddCubeTail_ (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverDeleteCube_ (Mvc_Cover_t *pCover, Mvc_Cube_t *pPrev, Mvc_Cube_t *pCube)
 
void Mvc_CoverAddDupCubeHead (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverAddDupCubeTail (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverAddLiteralsOfCube (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverDeleteLiteralsOfCube (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverList2Array (Mvc_Cover_t *pCover)
 
void Mvc_CoverArray2List (Mvc_Cover_t *pCover)
 
Mvc_Cube_tMvc_ListGetTailFromHead (Mvc_Cube_t *pHead)
 
void Mvc_CoverPrint (Mvc_Cover_t *pCover)
 FUNCTION DEFINITIONS ///. More...
 
void Mvc_CubePrint (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverPrintMv (Mvc_Data_t *pData, Mvc_Cover_t *pCover)
 
void Mvc_CubePrintMv (Mvc_Data_t *pData, Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CoverSort (Mvc_Cover_t *pCover, Mvc_Cube_t *pMask, int(*pCompareFunc)(Mvc_Cube_t *, Mvc_Cube_t *, Mvc_Cube_t *))
 FuNCTION DEFINITIONS ///. More...
 
void Mvc_CoverSupport (Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
 FUNCTION DEFINITIONS ///. More...
 
int Mvc_CoverSupportSizeBinary (Mvc_Cover_t *pCover)
 
int Mvc_CoverSupportVarBelongs (Mvc_Cover_t *pCover, int iVar)
 
void Mvc_CoverCommonCube (Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
 
int Mvc_CoverIsCubeFree (Mvc_Cover_t *pCover)
 
void Mvc_CoverMakeCubeFree (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCommonCubeCover (Mvc_Cover_t *pCover)
 
int Mvc_CoverCheckSuppContainment (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverSetCubeSizes (Mvc_Cover_t *pCover)
 
int Mvc_CoverGetCubeSize (Mvc_Cube_t *pCube)
 
int Mvc_CoverCountCubePairDiffs (Mvc_Cover_t *pCover, unsigned char pDiffs[])
 
Mvc_Cover_tMvc_CoverRemap (Mvc_Cover_t *pCover, int *pVarsRem, int nVarsRem)
 
void Mvc_CoverInverse (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverRemoveDontCareLits (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCofactor (Mvc_Cover_t *pCover, int iValue, int iValueOther)
 
Mvc_Cover_tMvc_CoverFlipVar (Mvc_Cover_t *pCover, int iValue0, int iValue1)
 
Mvc_Cover_tMvc_CoverUnivQuantify (Mvc_Cover_t *p, int iValueA0, int iValueA1, int iValueB0, int iValueB1)
 
Mvc_Cover_t ** Mvc_CoverCofactors (Mvc_Data_t *pData, Mvc_Cover_t *pCover, int iVar)
 
int Mvr_CoverCountLitsWithValue (Mvc_Data_t *pData, Mvc_Cover_t *pCover, int iVar, int iValue)
 
Mvc_Cover_tMvc_CoverTranspose (Mvc_Cover_t *pCover)
 
int Mvc_UtilsCheckUnusedZeros (Mvc_Cover_t *pCover)
 
int Mvc_CoverAnyLiteral (Mvc_Cover_t *pCover, Mvc_Cube_t *pMask)
 DECLARATIONS ///. More...
 
int Mvc_CoverBestLiteral (Mvc_Cover_t *pCover, Mvc_Cube_t *pMask)
 
int Mvc_CoverWorstLiteral (Mvc_Cover_t *pCover, Mvc_Cube_t *pMask)
 
Mvc_Cover_tMvc_CoverBestLiteralCover (Mvc_Cover_t *pCover, Mvc_Cover_t *pSimple)
 
int Mvc_CoverFirstCubeFirstLit (Mvc_Cover_t *pCover)
 
int Mvc_CoverCountLiterals (Mvc_Cover_t *pCover)
 
int Mvc_CoverIsOneLiteral (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverAlgebraicMultiply (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 DECLARATIONS ///. More...
 
Mvc_Cover_tMvc_CoverAlgebraicSubtract (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverAlgebraicEqual (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
Mvc_Cover_tMvc_CoverBooleanOr (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 DECLARATIONS ///. More...
 
Mvc_Cover_tMvc_CoverBooleanAnd (Mvc_Data_t *p, Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverBooleanEqual (Mvc_Data_t *p, Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverContain (Mvc_Cover_t *pCover)
 FUNCTION DEFINITIONS ///. More...
 
int Mvc_CoverTautology (Mvc_Data_t *p, Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverComplement (Mvc_Data_t *p, Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverSharp (Mvc_Data_t *p, Mvc_Cover_t *pA, Mvc_Cover_t *pB)
 
int Mvc_CoverDist0Cubes (Mvc_Data_t *pData, Mvc_Cube_t *pA, Mvc_Cube_t *pB)
 
void Mvc_CoverIntersectCubes (Mvc_Data_t *pData, Mvc_Cover_t *pC1, Mvc_Cover_t *pC2)
 
int Mvc_CoverIsIntersecting (Mvc_Data_t *pData, Mvc_Cover_t *pC1, Mvc_Cover_t *pC2)
 
void Mvc_CoverAppendCubes (Mvc_Cover_t *pC1, Mvc_Cover_t *pC2)
 
void Mvc_CoverCopyAndAppendCubes (Mvc_Cover_t *pC1, Mvc_Cover_t *pC2)
 
void Mvc_CoverRemoveCubes (Mvc_Cover_t *pC)
 
void Mvc_CoverMinimizeByReshape (Mvc_Data_t *pData, Mvc_Cover_t *pCover)
 
void Mvc_CoverDist1Merge (Mvc_Data_t *p, Mvc_Cover_t *pCover)
 
void Mvc_ManagerFree (Mvc_Manager_t *p)
 
Mvc_Manager_tMvc_ManagerStart ()
 DECLARATIONS ///. More...
 
Mvc_Manager_tMvc_ManagerAllocCover ()
 
Mvc_Manager_tMvc_ManagerAllocCube (int nWords)
 
Mvc_Manager_tMvc_ManagerFreeCover (Mvc_Cover_t *pCover)
 
Mvc_Manager_tMvc_ManagerFreeCube (Mvc_Cover_t *pCube, int nWords)
 

Macro Definition Documentation

#define BITS_DISJOINT   ((Mvc_CubeWord_t)0x55555555)

Definition at line 44 of file mvc.h.

#define BITS_FULL   ((Mvc_CubeWord_t)0xffffffff)

Definition at line 45 of file mvc.h.

#define BITS_PER_WORD   32

INCLUDES ///.

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

FileName [mvc.h]

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

Synopsis [Data structure for MV cube/cover manipulation.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvc.h,v 1.10 2003/05/02 23:23:59 wjiang Exp

]PARAMETERS ///

Definition at line 41 of file mvc.h.

#define BITS_PER_WORD_LOG   5

Definition at line 43 of file mvc.h.

#define BITS_PER_WORD_MINUS   31

Definition at line 42 of file mvc.h.

#define MEM_ALLOC (   Manager,
  Type,
  Size 
)    ((Type *)ABC_ALLOC( char, (Size) * sizeof(Type) ))

Definition at line 567 of file mvc.h.

#define MEM_FREE (   Manager,
  Type,
  Size,
  Pointer 
)    if ( Pointer ) { ABC_FREE(Pointer); Pointer = NULL; }

Definition at line 568 of file mvc.h.

#define Mvc_CoverAddCubeHead (   pCover,
  pCube 
)
Value:
{\
Mvc_List_t * pList = &pCover->lCubes;\
Mvc_ListAddCubeHead( pList, pCube );\
}
struct MvcListStruct Mvc_List_t
Definition: mvc.h:57
#define Mvc_ListAddCubeHead(pList, pCube)
Definition: mvc.h:456

Definition at line 496 of file mvc.h.

#define Mvc_CoverAddCubeTail (   pCover,
  pCube 
)
Value:
{\
Mvc_List_t * pList = &pCover->lCubes;\
Mvc_ListAddCubeTail( pList, pCube );\
}
#define Mvc_ListAddCubeTail(pList, pCube)
Definition: mvc.h:471
struct MvcListStruct Mvc_List_t
Definition: mvc.h:57

Definition at line 501 of file mvc.h.

#define Mvc_CoverDeleteCube (   pCover,
  pPrev,
  pCube 
)
Value:
{\
Mvc_List_t * pList = &pCover->lCubes;\
Mvc_ListDeleteCube( pList, pPrev, pCube );\
}
#define Mvc_ListDeleteCube(pList, pPrev, pCube)
Definition: mvc.h:481
struct MvcListStruct Mvc_List_t
Definition: mvc.h:57

Definition at line 506 of file mvc.h.

#define Mvc_CoverForEachCube (   Cover,
  Cube 
)
Value:
for ( Cube = (Cover)->lCubes.pHead;\
Cube;\
Cube = Cube->pNext )

Definition at line 528 of file mvc.h.

#define Mvc_CoverForEachCubeSafe (   Cover,
  Cube,
  Cube2 
)
Value:
for ( Cube = (Cover)->lCubes.pHead, Cube2 = (Cube? Cube->pNext: NULL);\
Cube;\
Cube = Cube2, Cube2 = (Cube? Cube->pNext: NULL) )

Definition at line 536 of file mvc.h.

#define Mvc_CoverForEachCubeStart (   Start,
  Cube 
)
Value:
for ( Cube = Start;\
Cube;\
Cube = Cube->pNext )

Definition at line 542 of file mvc.h.

#define Mvc_CoverForEachCubeStartSafe (   Start,
  Cube,
  Cube2 
)
Value:
for ( Cube = Start, Cube2 = (Cube? Cube->pNext: NULL);\
Cube;\
Cube = Cube2, Cube2 = (Cube? Cube->pNext: NULL) )

Definition at line 546 of file mvc.h.

#define Mvc_CoverForEachCubeWithIndex (   Cover,
  Cube,
  Index 
)
Value:
for ( Index = 0, Cube = (Cover)->lCubes.pHead;\
Cube;\
Index++, Cube = Cube->pNext )

Definition at line 532 of file mvc.h.

#define Mvc_Cube1BitAnd (   CubeR,
  Cube1,
  Cube2 
)    (((CubeR)->pData[0]) = ((Cube1)->pData[0] & (Cube2)->pData[0]))

Definition at line 227 of file mvc.h.

#define Mvc_Cube1BitClean (   Cube)    ((Cube)->pData[0] = 0)

Definition at line 147 of file mvc.h.

#define Mvc_Cube1BitCopy (   Cube1,
  Cube2 
)    (((Cube1)->pData[0]) = ((Cube2)->pData[0]))

Definition at line 191 of file mvc.h.

#define Mvc_Cube1BitDisjoint (   Res,
  Cube1,
  Cube2 
)    (Res = ((((Cube1)->pData[0]) & ((Cube2)->pData[0])) == 0 ))

Definition at line 315 of file mvc.h.

#define Mvc_Cube1BitEmpty (   Res,
  Cube 
)    (Res = ((Cube)->pData[0] == 0))

Definition at line 251 of file mvc.h.

#define Mvc_Cube1BitEqual (   Res,
  Cube1,
  Cube2 
)    (Res = (((Cube1)->pData[0]) == ((Cube2)->pData[0])))

Definition at line 263 of file mvc.h.

#define Mvc_Cube1BitEqualOutsideMask (   Res,
  Cube1,
  Cube2,
  Mask 
)    (Res = ((((Cube1)->pData[0]) | ((Mask)->pData[0])) == (((Cube2)->pData[0]) | ((Mask)->pData[0]))))

Definition at line 341 of file mvc.h.

#define Mvc_Cube1BitEqualUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)    (Res = ((((Cube1)->pData[0]) & ((Mask)->pData[0])) == (((Cube2)->pData[0]) & ((Mask)->pData[0]))))

Definition at line 328 of file mvc.h.

#define Mvc_Cube1BitExor (   CubeR,
  Cube1,
  Cube2 
)    (((CubeR)->pData[0]) = ((Cube1)->pData[0] ^ (Cube2)->pData[0]))

Definition at line 215 of file mvc.h.

#define Mvc_Cube1BitFill (   Cube)    (Cube)->pData[0] = (BITS_FULL >> (Cube)->nUnused);

Definition at line 164 of file mvc.h.

#define Mvc_Cube1BitIntersectUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)    (Res = ((((Cube1)->pData[0]) & ((Cube2)->pData[0]) & ((Mask)->pData[0])) > 0))

Definition at line 354 of file mvc.h.

#define Mvc_Cube1BitLess (   Res,
  Cube1,
  Cube2 
)    (Res = (((Cube1)->pData[0]) < ((Cube2)->pData[0])))

Definition at line 276 of file mvc.h.

#define Mvc_Cube1BitMore (   Res,
  Cube1,
  Cube2 
)    (Res = (((Cube1)->pData[0]) > ((Cube2)->pData[0])))

Definition at line 289 of file mvc.h.

#define Mvc_Cube1BitNot (   Cube)    ((Cube)->pData[0] ^= (BITS_FULL >> (Cube)->nUnused))

Definition at line 178 of file mvc.h.

#define Mvc_Cube1BitNotImpl (   Res,
  Cube1,
  Cube2 
)    (Res = (((Cube1)->pData[0]) & ~((Cube2)->pData[0])))

Definition at line 302 of file mvc.h.

#define Mvc_Cube1BitNotImplUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)    (Res = (((Mask)->pData[0]) & ((Cube1)->pData[0]) & ~((Cube2)->pData[0])))

Definition at line 367 of file mvc.h.

#define Mvc_Cube1BitOr (   CubeR,
  Cube1,
  Cube2 
)    (((CubeR)->pData[0]) = ((Cube1)->pData[0] | (Cube2)->pData[0]))

Definition at line 203 of file mvc.h.

#define Mvc_Cube1BitSharp (   CubeR,
  Cube1,
  Cube2 
)    (((CubeR)->pData[0]) = ((Cube1)->pData[0] & ~((Cube2)->pData[0])))

Definition at line 239 of file mvc.h.

#define Mvc_Cube1Words (   Cube)    ((Cube)->iLast == 0)

Definition at line 131 of file mvc.h.

#define Mvc_Cube2BitAnd (   CubeR,
  Cube1,
  Cube2 
)
Value:
((((CubeR)->pData[0]) = ((Cube1)->pData[0] & (Cube2)->pData[0])),\
(((CubeR)->pData[1]) = ((Cube1)->pData[1] & (Cube2)->pData[1])))

Definition at line 229 of file mvc.h.

#define Mvc_Cube2BitClean (   Cube)
Value:
(((Cube)->pData[0] = 0),\
((Cube)->pData[1] = 0))

Definition at line 149 of file mvc.h.

#define Mvc_Cube2BitCopy (   Cube1,
  Cube2 
)
Value:
((((Cube1)->pData[0]) = ((Cube2)->pData[0])),\
(((Cube1)->pData[1])= ((Cube2)->pData[1])))

Definition at line 193 of file mvc.h.

#define Mvc_Cube2BitDisjoint (   Res,
  Cube1,
  Cube2 
)
Value:
(Res = (((((Cube1)->pData[0]) & ((Cube2)->pData[0])) == 0 ) &&\
((((Cube1)->pData[1]) & ((Cube2)->pData[1])) == 0 )))

Definition at line 317 of file mvc.h.

#define Mvc_Cube2BitEmpty (   Res,
  Cube 
)    (Res = ((Cube)->pData[0] == 0 && (Cube)->pData[1] == 0))

Definition at line 253 of file mvc.h.

#define Mvc_Cube2BitEqual (   Res,
  Cube1,
  Cube2 
)
Value:
(Res = ((((Cube1)->pData[0]) == ((Cube2)->pData[0])) &&\
(((Cube1)->pData[1]) == ((Cube2)->pData[1]))))

Definition at line 265 of file mvc.h.

#define Mvc_Cube2BitEqualOutsideMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
(Res = (((((Cube1)->pData[0]) | ((Mask)->pData[0])) == (((Cube2)->pData[0]) | ((Mask)->pData[0]))) &&\
((((Cube1)->pData[1]) | ((Mask)->pData[1])) == (((Cube2)->pData[1]) | ((Mask)->pData[1])))))

Definition at line 343 of file mvc.h.

#define Mvc_Cube2BitEqualUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
(Res = (((((Cube1)->pData[0]) & ((Mask)->pData[0])) == (((Cube2)->pData[0]) & ((Mask)->pData[0]))) &&\
((((Cube1)->pData[1]) & ((Mask)->pData[1])) == (((Cube2)->pData[1]) & ((Mask)->pData[1])))))

Definition at line 330 of file mvc.h.

#define Mvc_Cube2BitExor (   CubeR,
  Cube1,
  Cube2 
)
Value:
((((CubeR)->pData[0]) = ((Cube1)->pData[0] ^ (Cube2)->pData[0])),\
(((CubeR)->pData[1]) = ((Cube1)->pData[1] ^ (Cube2)->pData[1])))

Definition at line 217 of file mvc.h.

#define Mvc_Cube2BitFill (   Cube)
Value:
(((Cube)->pData[0] = BITS_FULL),\
((Cube)->pData[1] = (BITS_FULL >> (Cube)->nUnused)))
#define BITS_FULL
Definition: mvc.h:45

Definition at line 166 of file mvc.h.

#define Mvc_Cube2BitIntersectUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
(Res = (((((Cube1)->pData[0]) & ((Cube2)->pData[0]) & ((Mask)->pData[0])) > 0) ||\
((((Cube1)->pData[1]) & ((Cube2)->pData[1]) & ((Mask)->pData[1])) > 0)))

Definition at line 356 of file mvc.h.

#define Mvc_Cube2BitLess (   Res,
  Cube1,
  Cube2 
)
Value:
(Res = ((((Cube1)->pData[0]) < ((Cube2)->pData[0])) ||\
((((Cube1)->pData[0]) == ((Cube2)->pData[0])) && (((Cube1)->pData[1]) < ((Cube2)->pData[1])))))

Definition at line 278 of file mvc.h.

#define Mvc_Cube2BitMore (   Res,
  Cube1,
  Cube2 
)
Value:
(Res = ((((Cube1)->pData[0]) > ((Cube2)->pData[0])) ||\
((((Cube1)->pData[0]) == ((Cube2)->pData[0])) && (((Cube1)->pData[1]) > ((Cube2)->pData[1])))))

Definition at line 291 of file mvc.h.

#define Mvc_Cube2BitNot (   Cube)
Value:
(((Cube)->pData[0] ^= BITS_FULL),\
((Cube)->pData[1] ^= (BITS_FULL >> (Cube)->nUnused)))
#define BITS_FULL
Definition: mvc.h:45

Definition at line 180 of file mvc.h.

#define Mvc_Cube2BitNotImpl (   Res,
  Cube1,
  Cube2 
)
Value:
(Res = ((((Cube1)->pData[0]) & ~((Cube2)->pData[0])) ||\
(((Cube1)->pData[1]) & ~((Cube2)->pData[1]))))

Definition at line 304 of file mvc.h.

#define Mvc_Cube2BitNotImplUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
(Res = ((((Mask)->pData[0]) & ((Cube1)->pData[0]) & ~((Cube2)->pData[0])) ||\
(((Mask)->pData[1]) & ((Cube1)->pData[1]) & ~((Cube2)->pData[1]))))

Definition at line 369 of file mvc.h.

#define Mvc_Cube2BitOr (   CubeR,
  Cube1,
  Cube2 
)
Value:
((((CubeR)->pData[0]) = ((Cube1)->pData[0] | (Cube2)->pData[0])),\
(((CubeR)->pData[1]) = ((Cube1)->pData[1] | (Cube2)->pData[1])))

Definition at line 205 of file mvc.h.

#define Mvc_Cube2BitSharp (   CubeR,
  Cube1,
  Cube2 
)
Value:
((((CubeR)->pData[0]) = ((Cube1)->pData[0] & ~((Cube2)->pData[0]))),\
(((CubeR)->pData[1]) = ((Cube1)->pData[1] & ~((Cube2)->pData[1]))))

Definition at line 241 of file mvc.h.

#define Mvc_Cube2Words (   Cube)    ((Cube)->iLast == 1)

Definition at line 132 of file mvc.h.

#define Mvc_CubeBitAnd (   CubeR,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitAnd( CubeR, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitAnd( CubeR, Cube1, Cube2 ); }\
else { Mvc_CubeNBitAnd( CubeR, Cube1, Cube2 ); }
#define Mvc_Cube1BitAnd(CubeR, Cube1, Cube2)
Definition: mvc.h:227
else
Definition: sparse_int.h:55
#define Mvc_CubeNBitAnd(CubeR, Cube1, Cube2)
Definition: mvc.h:232
#define Mvc_Cube2BitAnd(CubeR, Cube1, Cube2)
Definition: mvc.h:229
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 405 of file mvc.h.

#define Mvc_CubeBitClean (   Cube)
Value:
if ( Mvc_Cube1Words(Cube) ) { Mvc_Cube1BitClean( Cube ); }\
else if ( Mvc_Cube2Words(Cube) ) { Mvc_Cube2BitClean( Cube ); }\
#define Mvc_Cube2BitClean(Cube)
Definition: mvc.h:149
else
Definition: sparse_int.h:55
#define Mvc_Cube1BitClean(Cube)
Definition: mvc.h:147
#define Mvc_CubeNBitClean(Cube)
Definition: mvc.h:152
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 381 of file mvc.h.

#define Mvc_CubeBitCleanUnused (   Cube)    ((Cube)->pData[(Cube)->iLast] &= (BITS_FULL >> (Cube)->nUnused))

Definition at line 160 of file mvc.h.

#define Mvc_CubeBitCopy (   Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitCopy( Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitCopy( Cube1, Cube2 ); }\
else { Mvc_CubeNBitCopy( Cube1, Cube2 ); }
#define Mvc_Cube2BitCopy(Cube1, Cube2)
Definition: mvc.h:193
#define Mvc_Cube1BitCopy(Cube1, Cube2)
Definition: mvc.h:191
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeNBitCopy(Cube1, Cube2)
Definition: mvc.h:196
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 393 of file mvc.h.

#define Mvc_CubeBitDisjoint (   Res,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitDisjoint( Res, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitDisjoint( Res, Cube1, Cube2 ); }\
else { Mvc_CubeNBitDisjoint( Res, Cube1, Cube2 ); }
#define Mvc_CubeNBitDisjoint(Res, Cube1, Cube2)
Definition: mvc.h:320
#define Mvc_Cube2BitDisjoint(Res, Cube1, Cube2)
Definition: mvc.h:317
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1BitDisjoint(Res, Cube1, Cube2)
Definition: mvc.h:315
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 433 of file mvc.h.

#define Mvc_CubeBitEmpty (   Res,
  Cube 
)
Value:
if ( Mvc_Cube1Words(Cube) ) { Mvc_Cube1BitEmpty( Res, Cube ); }\
else if ( Mvc_Cube2Words(Cube) ) { Mvc_Cube2BitEmpty( Res, Cube ); }\
else { Mvc_CubeNBitEmpty( Res, Cube ); }
#define Mvc_CubeNBitEmpty(Res, Cube)
Definition: mvc.h:255
#define Mvc_Cube2BitEmpty(Res, Cube)
Definition: mvc.h:253
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1BitEmpty(Res, Cube)
Definition: mvc.h:251
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 413 of file mvc.h.

#define Mvc_CubeBitEqual (   Res,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitEqual( Res, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitEqual( Res, Cube1, Cube2 ); }\
else { Mvc_CubeNBitEqual( Res, Cube1, Cube2 ); }
#define Mvc_Cube2BitEqual(Res, Cube1, Cube2)
Definition: mvc.h:265
#define Mvc_CubeNBitEqual(Res, Cube1, Cube2)
Definition: mvc.h:268
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1BitEqual(Res, Cube1, Cube2)
Definition: mvc.h:263
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 417 of file mvc.h.

#define Mvc_CubeBitEqualOutsideMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitEqualOutsideMask( Res, Cube1, Cube2, Mask ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitEqualOutsideMask( Res, Cube1, Cube2, Mask ); }\
else { Mvc_CubeNBitEqualOutsideMask( Res, Cube1, Cube2, Mask ); }
#define Mvc_Cube2BitEqualOutsideMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:343
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1BitEqualOutsideMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:341
#define Mvc_CubeNBitEqualOutsideMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:346
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 441 of file mvc.h.

#define Mvc_CubeBitEqualUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitEqualUnderMask( Res, Cube1, Cube2, Mask ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitEqualUnderMask( Res, Cube1, Cube2, Mask ); }\
else { Mvc_CubeNBitEqualUnderMask( Res, Cube1, Cube2, Mask ); }
#define Mvc_Cube2BitEqualUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:330
else
Definition: sparse_int.h:55
#define Mvc_CubeNBitEqualUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:333
#define Mvc_Cube1BitEqualUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:328
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 437 of file mvc.h.

#define Mvc_CubeBitExor (   CubeR,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitExor( CubeR, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitExor( CubeR, Cube1, Cube2 ); }\
else { Mvc_CubeNBitExor( CubeR, Cube1, Cube2 ); }
#define Mvc_Cube2BitExor(CubeR, Cube1, Cube2)
Definition: mvc.h:217
#define Mvc_CubeNBitExor(CubeR, Cube1, Cube2)
Definition: mvc.h:220
else
Definition: sparse_int.h:55
#define Mvc_Cube1BitExor(CubeR, Cube1, Cube2)
Definition: mvc.h:215
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 401 of file mvc.h.

#define Mvc_CubeBitFill (   Cube)
Value:
if ( Mvc_Cube1Words(Cube) ) { Mvc_Cube1BitFill( Cube ); }\
else if ( Mvc_Cube2Words(Cube) ) { Mvc_Cube2BitFill( Cube ); }\
else { Mvc_CubeNBitFill( Cube ); }
#define Mvc_Cube2BitFill(Cube)
Definition: mvc.h:166
#define Mvc_CubeNBitFill(Cube)
Definition: mvc.h:169
else
Definition: sparse_int.h:55
#define Mvc_Cube1BitFill(Cube)
Definition: mvc.h:164
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 385 of file mvc.h.

#define Mvc_CubeBitInsert (   Cube,
  Bit 
)    ((Cube)->pData[Mvc_CubeWhichWord(Bit)] |= (((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit))))

Definition at line 139 of file mvc.h.

#define Mvc_CubeBitIntersectUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitIntersectUnderMask( Res, Cube1, Cube2, Mask ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitIntersectUnderMask( Res, Cube1, Cube2, Mask ); }\
else { Mvc_CubeNBitIntersectUnderMask( Res, Cube1, Cube2, Mask ); }
#define Mvc_Cube1BitIntersectUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:354
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube2BitIntersectUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:356
#define Mvc_CubeNBitIntersectUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:359
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 445 of file mvc.h.

#define Mvc_CubeBitLess (   Res,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitLess( Res, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitLess( Res, Cube1, Cube2 ); }\
else { Mvc_CubeNBitLess( Res, Cube1, Cube2 ); }
#define Mvc_CubeNBitLess(Res, Cube1, Cube2)
Definition: mvc.h:281
#define Mvc_Cube1BitLess(Res, Cube1, Cube2)
Definition: mvc.h:276
#define Mvc_Cube2BitLess(Res, Cube1, Cube2)
Definition: mvc.h:278
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 421 of file mvc.h.

#define Mvc_CubeBitMore (   Res,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitMore( Res, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitMore( Res, Cube1, Cube2 ); }\
else { Mvc_CubeNBitMore( Res, Cube1, Cube2 ); }
else
Definition: sparse_int.h:55
#define Mvc_CubeNBitMore(Res, Cube1, Cube2)
Definition: mvc.h:294
#define Mvc_Cube1BitMore(Res, Cube1, Cube2)
Definition: mvc.h:289
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube2BitMore(Res, Cube1, Cube2)
Definition: mvc.h:291
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 425 of file mvc.h.

#define Mvc_CubeBitNot (   Cube)
Value:
if ( Mvc_Cube1Words(Cube) ) { Mvc_Cube1BitNot( Cube ); }\
else if ( Mvc_Cube2Words(Cube) ) { Mvc_Cube2BitNot( Cube ); }\
else { Mvc_CubeNBitNot( Cube ); }
#define Mvc_Cube2BitNot(Cube)
Definition: mvc.h:180
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeNBitNot(Cube)
Definition: mvc.h:183
#define Mvc_Cube1BitNot(Cube)
Definition: mvc.h:178
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 389 of file mvc.h.

#define Mvc_CubeBitNotImpl (   Res,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitNotImpl( Res, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitNotImpl( Res, Cube1, Cube2 ); }\
else { Mvc_CubeNBitNotImpl( Res, Cube1, Cube2 ); }
#define Mvc_CubeNBitNotImpl(Res, Cube1, Cube2)
Definition: mvc.h:307
#define Mvc_Cube1BitNotImpl(Res, Cube1, Cube2)
Definition: mvc.h:302
else
Definition: sparse_int.h:55
#define Mvc_Cube2BitNotImpl(Res, Cube1, Cube2)
Definition: mvc.h:304
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 429 of file mvc.h.

#define Mvc_CubeBitNotImplUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitNotImplUnderMask( Res, Cube1, Cube2, Mask ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitNotImplUnderMask( Res, Cube1, Cube2, Mask ); }\
else { Mvc_CubeNBitNotImplUnderMask( Res, Cube1, Cube2, Mask ); }
#define Mvc_Cube1BitNotImplUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:367
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube2BitNotImplUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:369
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
#define Mvc_CubeNBitNotImplUnderMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:372

Definition at line 449 of file mvc.h.

#define Mvc_CubeBitOr (   CubeR,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitOr( CubeR, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitOr( CubeR, Cube1, Cube2 ); }\
else { Mvc_CubeNBitOr( CubeR, Cube1, Cube2 ); }
#define Mvc_Cube1BitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:203
#define Mvc_Cube2BitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:205
#define Mvc_CubeNBitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:208
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131

Definition at line 397 of file mvc.h.

#define Mvc_CubeBitRemove (   Cube,
  Bit 
)    ((Cube)->pData[Mvc_CubeWhichWord(Bit)] &= ~(((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit))))

Definition at line 140 of file mvc.h.

#define Mvc_CubeBitSharp (   CubeR,
  Cube1,
  Cube2 
)
Value:
if ( Mvc_Cube1Words(Cube1) ) { Mvc_Cube1BitSharp( CubeR, Cube1, Cube2 ); }\
else if ( Mvc_Cube2Words(Cube1) ){ Mvc_Cube2BitSharp( CubeR, Cube1, Cube2 ); }\
else { Mvc_CubeNBitSharp( CubeR, Cube1, Cube2 ); }
#define Mvc_Cube1BitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:239
#define Mvc_CubeNBitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:244
else
Definition: sparse_int.h:55
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
#define Mvc_Cube2BitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:241

Definition at line 409 of file mvc.h.

#define Mvc_CubeBitValue (   Cube,
  Bit 
)    (((Cube)->pData[Mvc_CubeWhichWord(Bit)] & (((Mvc_CubeWord_t)1)<<(Mvc_CubeWhichBit(Bit)))) > 0)

Definition at line 138 of file mvc.h.

#define Mvc_CubeForEachBit (   Cover,
  Cube,
  iBit,
  Value 
)
Value:
for ( iBit = 0;\
iBit < Cover->nBits && ((Value = Mvc_CubeBitValue(Cube,iBit))>=0);\
iBit++ )
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138

Definition at line 553 of file mvc.h.

#define Mvc_CubeForEachVarValue (   Cover,
  Cube,
  iVar,
  Value 
)
Value:
for ( iVar = 0;\
iVar < Cover->nBits/2 && (Value = Mvc_CubeVarValue(Cube,iVar));\
iVar++ )
#define Mvc_CubeVarValue(Cube, Var)
Definition: mvc.h:142

Definition at line 558 of file mvc.h.

#define Mvc_CubeNBitAnd (   CubeR,
  Cube1,
  Cube2 
)
Value:
{\
int _i_;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
(((CubeR)->pData[_i_]) = ((Cube1)->pData[_i_] & (Cube2)->pData[_i_]));\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 232 of file mvc.h.

#define Mvc_CubeNBitClean (   Cube)
Value:
{\
int _i_;\
for( _i_ = (Cube)->iLast; _i_ >= 0; _i_--)\
(Cube)->pData[_i_] = 0;\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 152 of file mvc.h.

#define Mvc_CubeNBitCopy (   Cube1,
  Cube2 
)
Value:
{\
int _i_;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
((Cube1)->pData[_i_]) = ((Cube2)->pData[_i_]);\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 196 of file mvc.h.

#define Mvc_CubeNBitDisjoint (   Res,
  Cube1,
  Cube2 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) & ((Cube2)->pData[_i_]))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 320 of file mvc.h.

#define Mvc_CubeNBitEmpty (   Res,
  Cube 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube)->iLast; _i_ >= 0; _i_--)\
if ( (Cube)->pData[_i_] )\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 255 of file mvc.h.

#define Mvc_CubeNBitEqual (   Res,
  Cube1,
  Cube2 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) != ((Cube2)->pData[_i_]))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 268 of file mvc.h.

#define Mvc_CubeNBitEqualOutsideMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if ((((Cube1)->pData[_i_]) | ((Mask)->pData[_i_])) != (((Cube2)->pData[_i_]) | ((Mask)->pData[_i_])))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 346 of file mvc.h.

#define Mvc_CubeNBitEqualUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if ((((Cube1)->pData[_i_]) & ((Mask)->pData[_i_])) != (((Cube2)->pData[_i_]) & ((Mask)->pData[_i_])))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 333 of file mvc.h.

#define Mvc_CubeNBitExor (   CubeR,
  Cube1,
  Cube2 
)
Value:
{\
int _i_;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
(((CubeR)->pData[_i_]) = ((Cube1)->pData[_i_] ^ (Cube2)->pData[_i_]));\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 220 of file mvc.h.

#define Mvc_CubeNBitFill (   Cube)
Value:
{\
int _i_;\
(Cube)->pData[(Cube)->iLast] = (BITS_FULL >> (Cube)->nUnused);\
for( _i_ = (Cube)->iLast - 1; _i_ >= 0; _i_-- )\
(Cube)->pData[_i_] = BITS_FULL;\
}
for(p=first;p->value< newval;p=p->next)
#define BITS_FULL
Definition: mvc.h:45

Definition at line 169 of file mvc.h.

#define Mvc_CubeNBitIntersectUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
{\
int _i_; Res = 0;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) & ((Cube2)->pData[_i_]) & ((Mask)->pData[_i_]))\
{ Res = 1; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 359 of file mvc.h.

#define Mvc_CubeNBitLess (   Res,
  Cube1,
  Cube2 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) >= ((Cube2)->pData[_i_]))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 281 of file mvc.h.

#define Mvc_CubeNBitMore (   Res,
  Cube1,
  Cube2 
)
Value:
{\
int _i_; Res = 1;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) <= ((Cube2)->pData[_i_]))\
{ Res = 0; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 294 of file mvc.h.

#define Mvc_CubeNBitNot (   Cube)
Value:
{\
int _i_;\
(Cube)->pData[(Cube)->iLast] ^= (BITS_FULL >> (Cube)->nUnused);\
for( _i_ = (Cube)->iLast - 1; _i_ >= 0; _i_-- )\
(Cube)->pData[_i_] ^= BITS_FULL;\
}
for(p=first;p->value< newval;p=p->next)
#define BITS_FULL
Definition: mvc.h:45

Definition at line 183 of file mvc.h.

#define Mvc_CubeNBitNotImpl (   Res,
  Cube1,
  Cube2 
)
Value:
{\
int _i_; Res = 0;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Cube1)->pData[_i_]) & ~((Cube2)->pData[_i_]))\
{ Res = 1; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 307 of file mvc.h.

#define Mvc_CubeNBitNotImplUnderMask (   Res,
  Cube1,
  Cube2,
  Mask 
)
Value:
{\
int _i_; Res = 0;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
if (((Mask)->pData[_i_]) & ((Cube1)->pData[_i_]) & ~((Cube2)->pData[_i_]))\
{ Res = 1; break; }\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 372 of file mvc.h.

#define Mvc_CubeNBitOr (   CubeR,
  Cube1,
  Cube2 
)
Value:
{\
int _i_;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
(((CubeR)->pData[_i_]) = ((Cube1)->pData[_i_] | (Cube2)->pData[_i_]));\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 208 of file mvc.h.

#define Mvc_CubeNBitSharp (   CubeR,
  Cube1,
  Cube2 
)
Value:
{\
int _i_;\
for (_i_ = (Cube1)->iLast; _i_ >= 0; _i_--)\
(((CubeR)->pData[_i_]) = ((Cube1)->pData[_i_] & ~(Cube2)->pData[_i_]));\
}
for(p=first;p->value< newval;p=p->next)

Definition at line 244 of file mvc.h.

#define Mvc_CubeNWords (   Cube)    ((Cube)->iLast > 1)

Definition at line 133 of file mvc.h.

#define Mvc_CubeReadLast (   Cube)    ((Cube)->iLast)

Definition at line 123 of file mvc.h.

#define Mvc_CubeReadNext (   Cube)    ((Cube)->pNext)

MACRO DEFINITIONS ///.

Definition at line 121 of file mvc.h.

#define Mvc_CubeReadNextP (   Cube)    (&(Cube)->pNext)

Definition at line 122 of file mvc.h.

#define Mvc_CubeReadSize (   Cube)    ((Cube)->nOnes)

Definition at line 124 of file mvc.h.

#define Mvc_CubeSetLast (   Cube,
  Last 
)    ((Cube)->iLast = (Last))

Definition at line 127 of file mvc.h.

#define Mvc_CubeSetNext (   Cube,
  Next 
)    ((Cube)->pNext = (Next))

Definition at line 126 of file mvc.h.

#define Mvc_CubeSetSize (   Cube,
  Size 
)    ((Cube)->nOnes = (Size))

Definition at line 128 of file mvc.h.

#define Mvc_CubeVarValue (   Cube,
  Var 
)    (((Cube)->pData[Mvc_CubeWhichWord(2*(Var))] >> (Mvc_CubeWhichBit(2*(Var)))) & ((Mvc_CubeWord_t)3))

Definition at line 142 of file mvc.h.

#define Mvc_CubeWhichBit (   Bit)    ((Bit) & BITS_PER_WORD_MINUS)

Definition at line 136 of file mvc.h.

#define Mvc_CubeWhichWord (   Bit)    ((Bit) >> BITS_PER_WORD_LOG)

Definition at line 135 of file mvc.h.

#define Mvc_ListAddCubeHead (   pList,
  pCube 
)
Value:
{\
if ( pList->pHead == NULL )\
{\
Mvc_CubeSetNext( pCube, NULL );\
pList->pHead = pCube;\
pList->pTail = pCube;\
}\
{\
Mvc_CubeSetNext( pCube, pList->pHead );\
pList->pHead = pCube;\
}\
pList->nItems++;\
}
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126

Definition at line 456 of file mvc.h.

#define Mvc_ListAddCubeTail (   pList,
  pCube 
)
Value:
{\
if ( pList->pHead == NULL )\
pList->pHead = pCube;\
Mvc_CubeSetNext( pList->pTail, pCube );\
pList->pTail = pCube;\
Mvc_CubeSetNext( pCube, NULL );\
pList->nItems++;\
}
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126

Definition at line 471 of file mvc.h.

#define Mvc_ListDeleteCube (   pList,
  pPrev,
  pCube 
)
Value:
{\
if ( pPrev == NULL )\
pList->pHead = pCube->pNext;\
else\
pPrev->pNext = pCube->pNext;\
if ( pList->pTail == pCube )\
{\
assert( pCube->pNext == NULL );\
pList->pTail = pPrev;\
}\
pList->nItems--;\
}
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213

Definition at line 481 of file mvc.h.

#define Mvc_ListForEachCube (   List,
  Cube 
)
Value:
for ( Cube = List->pHead;\
Cube;\
Cube = Cube->pNext )

Definition at line 518 of file mvc.h.

#define Mvc_ListForEachCubeSafe (   List,
  Cube,
  Cube2 
)
Value:
for ( Cube = List->pHead, Cube2 = (Cube? Cube->pNext: NULL);\
Cube;\
Cube = Cube2, Cube2 = (Cube? Cube->pNext: NULL) )

Definition at line 522 of file mvc.h.

Typedef Documentation

typedef struct MvcCoverStruct Mvc_Cover_t

Definition at line 58 of file mvc.h.

typedef struct MvcCubeStruct Mvc_Cube_t

Definition at line 56 of file mvc.h.

typedef unsigned int Mvc_CubeWord_t

STRUCTURE DEFINITIONS ///.

Definition at line 55 of file mvc.h.

typedef struct MvcDataStruct Mvc_Data_t

Definition at line 59 of file mvc.h.

typedef struct MvcListStruct Mvc_List_t

Definition at line 57 of file mvc.h.

Definition at line 60 of file mvc.h.

Function Documentation

void Mvc_CoverAddCubeHead_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file mvcList.c.

122 {
123  Mvc_List_t * pList = &pCover->lCubes;
124  if ( pList->pHead == NULL )
125  {
126  Mvc_CubeSetNext( pCube, NULL );
127  pList->pHead = pCube;
128  pList->pTail = pCube;
129  }
130  else
131  {
132  Mvc_CubeSetNext( pCube, pList->pHead );
133  pList->pHead = pCube;
134  }
135  pList->nItems++;
136 }
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126
void Mvc_CoverAddCubeTail_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file mvcList.c.

150 {
151  Mvc_List_t * pList = &pCover->lCubes;
152 
153  if ( pList->pHead == NULL )
154  pList->pHead = pCube;
155  else
156  Mvc_CubeSetNext( pList->pTail, pCube );
157  pList->pTail = pCube;
158  Mvc_CubeSetNext( pCube, NULL );
159  pList->nItems++;
160 }
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126
void Mvc_CoverAddDupCubeHead ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file mvcList.c.

203 {
204  Mvc_Cube_t * pCubeNew;
205  pCubeNew = Mvc_CubeAlloc( pCover );
206  Mvc_CubeBitCopy( pCubeNew, pCube );
207  Mvc_CoverAddCubeHead( pCover, pCubeNew );
208 }
#define Mvc_CoverAddCubeHead(pCover, pCube)
Definition: mvc.h:496
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitCopy(Cube1, Cube2)
Definition: mvc.h:393
void Mvc_CoverAddDupCubeTail ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 221 of file mvcList.c.

222 {
223  Mvc_Cube_t * pCubeNew;
224  // copy the cube as part of this cover
225  pCubeNew = Mvc_CubeAlloc( pCover );
226  Mvc_CubeBitCopy( pCubeNew, pCube );
227  // clean the last bits of the new cube
228 // pCubeNew->pData[pCubeNew->iLast] &= (BITS_FULL >> pCubeNew->nUnused);
229  // add the cube at the end
230  Mvc_CoverAddCubeTail( pCover, pCubeNew );
231 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitCopy(Cube1, Cube2)
Definition: mvc.h:393
void Mvc_CoverAddLiteralsOfCube ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file mvcList.c.

246 {
247 // int iBit, Value;
248 // assert( pCover->pLits );
249 // Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
250 // if ( Value )
251 // pCover->pLits[iBit] += Value;
252 }
int Mvc_CoverAlgebraicEqual ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 134 of file mvcOpAlg.c.

135 {
136  Mvc_Cube_t * pCube1, * pCube2;
137  int fFound;
138  int CompResult;
139 
140  // covers should be the same base
141  assert( pCover1->nBits == pCover2->nBits );
142  // iterate through the cubes
143  Mvc_CoverForEachCube( pCover1, pCube1 )
144  {
145  fFound = 0;
146  Mvc_CoverForEachCube( pCover2, pCube2 )
147  {
148  Mvc_CubeBitEqual( CompResult, pCube1, pCube2 );
149  if ( CompResult )
150  {
151  fFound = 1;
152  break;
153  }
154  }
155  if ( !fFound )
156  return 0;
157  }
158  return 1;
159 }
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
Definition: mvc.h:417
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
Mvc_Cover_t* Mvc_CoverAlgebraicMultiply ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

DECLARATIONS ///.

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

FileName [mvcOperAlg.c]

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

Synopsis [Miscellaneous operations on covers.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcOpAlg.c,v 1.4 2003/04/26 20:41:36 alanmi Exp

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

Synopsis [Multiplies two disjoint-support covers.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcOpAlg.c.

44 {
45  Mvc_Cover_t * pCover;
46  Mvc_Cube_t * pCube1, * pCube2, * pCube;
47  int CompResult;
48 
49  // covers should be the same base
50  assert( pCover1->nBits == pCover2->nBits );
51  // make sure that supports do not overlap
52  Mvc_CoverAllocateMask( pCover1 );
53  Mvc_CoverAllocateMask( pCover2 );
54  Mvc_CoverSupport( pCover1, pCover1->pMask );
55  Mvc_CoverSupport( pCover2, pCover2->pMask );
56  // check if the cubes are bit-wise disjoint
57  Mvc_CubeBitDisjoint( CompResult, pCover1->pMask, pCover2->pMask );
58  if ( !CompResult )
59  printf( "Mvc_CoverMultiply(): Cover supports are not disjoint!\n" );
60 
61  // iterate through the cubes
62  pCover = Mvc_CoverClone( pCover1 );
63  Mvc_CoverForEachCube( pCover1, pCube1 )
64  Mvc_CoverForEachCube( pCover2, pCube2 )
65  {
66  // create the product cube
67  pCube = Mvc_CubeAlloc( pCover );
68  // set the product cube equal to the product of the two cubes
69  Mvc_CubeBitOr( pCube, pCube1, pCube2 );
70  // add the cube to the cover
71  Mvc_CoverAddCubeTail( pCover, pCube );
72  }
73  return pCover;
74 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
#define Mvc_CubeBitDisjoint(Res, Cube1, Cube2)
Definition: mvc.h:433
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:397
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition: mvcUtils.c:58
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
Mvc_Cover_t* Mvc_CoverAlgebraicSubtract ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

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

Synopsis [Subtracts the second cover from the first.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file mvcOpAlg.c.

89 {
90  Mvc_Cover_t * pCover;
91  Mvc_Cube_t * pCube1, * pCube2, * pCube;
92  int fFound;
93  int CompResult;
94 
95  // covers should be the same base
96  assert( pCover1->nBits == pCover2->nBits );
97 
98  // iterate through the cubes
99  pCover = Mvc_CoverClone( pCover1 );
100  Mvc_CoverForEachCube( pCover1, pCube1 )
101  {
102  fFound = 0;
103  Mvc_CoverForEachCube( pCover2, pCube2 )
104  {
105  Mvc_CubeBitEqual( CompResult, pCube1, pCube2 );
106  if ( CompResult )
107  {
108  fFound = 1;
109  break;
110  }
111  }
112  if ( !fFound )
113  {
114  // create the copy of the cube
115  pCube = Mvc_CubeDup( pCover, pCube1 );
116  // add the cube copy to the cover
117  Mvc_CoverAddCubeTail( pCover, pCube );
118  }
119  }
120  return pCover;
121 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
Definition: mvc.h:417
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
Mvc_Cover_t* Mvc_CoverAlloc ( Mvc_Manager_t pMem,
int  nBits 
)

DECLARATIONS ///.

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 [

Id:
mvcCover.c,v 1.5 2003/04/09 18:02:05 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcCover.c.

44 {
45  Mvc_Cover_t * p;
46  int nBitsInUnsigned;
47 
48  nBitsInUnsigned = 8 * sizeof(Mvc_CubeWord_t);
49 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
50  p = (Mvc_Cover_t *)ABC_ALLOC( char, sizeof(Mvc_Cover_t) );
51 #else
53 #endif
54  p->pMem = pMem;
55  p->nBits = nBits;
56  p->nWords = nBits / nBitsInUnsigned + (int)(nBits % nBitsInUnsigned > 0);
57  p->nUnused = p->nWords * nBitsInUnsigned - p->nBits;
58  p->lCubes.nItems = 0;
59  p->lCubes.pHead = NULL;
60  p->lCubes.pTail = NULL;
61  p->nCubesAlloc = 0;
62  p->pCubes = NULL;
63  p->pMask = NULL;
64  p->pLits = NULL;
65  return p;
66 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nWords
Definition: mvc.h:85
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nItems
Definition: mvc.h:79
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int * pLits
Definition: mvc.h:91
int nUnused
Definition: mvc.h:86
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
int nCubesAlloc
Definition: mvc.h:90
int nBits
Definition: mvc.h:87
Extra_MmFixed_t * pManC
Definition: mvc.h:110
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateArrayCubes ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file mvcCover.c.

203 {
204  if ( pCover->nCubesAlloc < pCover->lCubes.nItems )
205  {
206  if ( pCover->nCubesAlloc > 0 )
207  MEM_FREE( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc, pCover->pCubes );
208  pCover->nCubesAlloc = pCover->lCubes.nItems;
209  pCover->pCubes = MEM_ALLOC( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc );
210  }
211 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nItems
Definition: mvc.h:79
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
Mvc_List_t lCubes
Definition: mvc.h:88
#define MEM_ALLOC(Manager, Type, Size)
Definition: mvc.h:567
int nCubesAlloc
Definition: mvc.h:90
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateArrayLits ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file mvcCover.c.

186 {
187  if ( pCover->pLits == NULL )
188  pCover->pLits = MEM_ALLOC( pCover->pMem, int, pCover->nBits );
189 }
int * pLits
Definition: mvc.h:91
#define MEM_ALLOC(Manager, Type, Size)
Definition: mvc.h:567
int nBits
Definition: mvc.h:87
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateMask ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file mvcCover.c.

169 {
170  if ( pCover->pMask == NULL )
171  pCover->pMask = Mvc_CubeAlloc( pCover );
172 }
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
Mvc_Cube_t * pMask
Definition: mvc.h:92
int Mvc_CoverAnyLiteral ( Mvc_Cover_t pCover,
Mvc_Cube_t pMask 
)

DECLARATIONS ///.

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

FileName [mvcLits.c]

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

Synopsis [Literal counting/updating procedures.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcLits.c,v 1.4 2003/04/03 06:31:50 alanmi Exp

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

Synopsis [Find the any literal that occurs more than once.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcLits.c.

44 {
45  Mvc_Cube_t * pCube;
46  int nWord, nBit, i;
47  int nLitsCur;
48  int fUseFirst = 0;
49 
50  // go through each literal
51  if ( fUseFirst )
52  {
53  for ( i = 0; i < pCover->nBits; i++ )
54  if ( !pMask || Mvc_CubeBitValue(pMask,i) )
55  {
56  // get the word and bit of this literal
57  nWord = Mvc_CubeWhichWord(i);
58  nBit = Mvc_CubeWhichBit(i);
59  // go through all the cubes
60  nLitsCur = 0;
61  Mvc_CoverForEachCube( pCover, pCube )
62  if ( pCube->pData[nWord] & (1<<nBit) )
63  {
64  nLitsCur++;
65  if ( nLitsCur > 1 )
66  return i;
67  }
68  }
69  }
70  else
71  {
72  for ( i = pCover->nBits - 1; i >=0; i-- )
73  if ( !pMask || Mvc_CubeBitValue(pMask,i) )
74  {
75  // get the word and bit of this literal
76  nWord = Mvc_CubeWhichWord(i);
77  nBit = Mvc_CubeWhichBit(i);
78  // go through all the cubes
79  nLitsCur = 0;
80  Mvc_CoverForEachCube( pCover, pCube )
81  if ( pCube->pData[nWord] & (1<<nBit) )
82  {
83  nLitsCur++;
84  if ( nLitsCur > 1 )
85  return i;
86  }
87  }
88  }
89  return -1;
90 }
#define Mvc_CubeWhichWord(Bit)
Definition: mvc.h:135
#define Mvc_CubeWhichBit(Bit)
Definition: mvc.h:136
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
void Mvc_CoverAppendCubes ( Mvc_Cover_t pC1,
Mvc_Cover_t pC2 
)
void Mvc_CoverArray2List ( Mvc_Cover_t pCover)

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

Synopsis [Transfers the cubes from the array into list.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file mvcList.c.

311 {
312  Mvc_Cube_t * pCube;
313  int nCubes, i;
314 
315  assert( pCover->pCubes );
316 
317  nCubes = Mvc_CoverReadCubeNum(pCover);
318  if ( nCubes == 0 )
319  return;
320  if ( nCubes == 1 )
321  {
322  pCube = pCover->pCubes[0];
323  pCube->pNext = NULL;
324  pCover->lCubes.pHead = pCover->lCubes.pTail = pCube;
325  return;
326  }
327  // set up the first cube
328  pCube = pCover->pCubes[0];
329  pCover->lCubes.pHead = pCube;
330  // set up the last cube
331  pCube = pCover->pCubes[nCubes-1];
332  pCube->pNext = NULL;
333  pCover->lCubes.pTail = pCube;
334 
335  // link all cubes starting from the first one
336  for ( i = 0; i < nCubes - 1; i++ )
337  pCover->pCubes[i]->pNext = pCover->pCubes[i+1];
338 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pNext
Definition: mvc.h:65
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define assert(ex)
Definition: util_old.h:213
int Mvc_CoverBestLiteral ( Mvc_Cover_t pCover,
Mvc_Cube_t pMask 
)

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

Synopsis [Find the most often occurring literal.]

Description [Find the most often occurring literal among those that occur more than once.]

SideEffects []

SeeAlso []

Definition at line 104 of file mvcLits.c.

105 {
106  Mvc_Cube_t * pCube;
107  int nWord, nBit;
108  int i, iMax, nLitsMax, nLitsCur;
109  int fUseFirst = 1;
110 
111  // go through each literal
112  iMax = -1;
113  nLitsMax = -1;
114  for ( i = 0; i < pCover->nBits; i++ )
115  if ( !pMask || Mvc_CubeBitValue(pMask,i) )
116  {
117  // get the word and bit of this literal
118  nWord = Mvc_CubeWhichWord(i);
119  nBit = Mvc_CubeWhichBit(i);
120  // go through all the cubes
121  nLitsCur = 0;
122  Mvc_CoverForEachCube( pCover, pCube )
123  if ( pCube->pData[nWord] & (1<<nBit) )
124  nLitsCur++;
125 
126  // check if this is the best literal
127  if ( fUseFirst )
128  {
129  if ( nLitsMax < nLitsCur )
130  {
131  nLitsMax = nLitsCur;
132  iMax = i;
133  }
134  }
135  else
136  {
137  if ( nLitsMax <= nLitsCur )
138  {
139  nLitsMax = nLitsCur;
140  iMax = i;
141  }
142  }
143  }
144 
145  if ( nLitsMax > 1 )
146  return iMax;
147  return -1;
148 }
#define Mvc_CubeWhichWord(Bit)
Definition: mvc.h:135
#define Mvc_CubeWhichBit(Bit)
Definition: mvc.h:136
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
Mvc_Cover_t* Mvc_CoverBestLiteralCover ( Mvc_Cover_t pCover,
Mvc_Cover_t pSimple 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file mvcLits.c.

224 {
225  Mvc_Cover_t * pCoverNew;
226  Mvc_Cube_t * pCubeNew;
227  Mvc_Cube_t * pCubeS;
228  int iLitBest;
229 
230  // create the new cover
231  pCoverNew = Mvc_CoverClone( pCover );
232  // get the new cube
233  pCubeNew = Mvc_CubeAlloc( pCoverNew );
234  // clean the cube
235  Mvc_CubeBitClean( pCubeNew );
236 
237  // get the first cube of pSimple
238  assert( Mvc_CoverReadCubeNum(pSimple) == 1 );
239  pCubeS = Mvc_CoverReadCubeHead( pSimple );
240  // find the best literal among those of pCubeS
241  iLitBest = Mvc_CoverBestLiteral( pCover, pCubeS );
242 
243  // insert this literal into the cube
244  Mvc_CubeBitInsert( pCubeNew, iLitBest );
245  // add the cube to the cover
246  Mvc_CoverAddCubeTail( pCoverNew, pCubeNew );
247  return pCoverNew;
248 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
int Mvc_CoverBestLiteral(Mvc_Cover_t *pCover, Mvc_Cube_t *pMask)
Definition: mvcLits.c:104
#define assert(ex)
Definition: util_old.h:213
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
#define Mvc_CubeBitInsert(Cube, Bit)
Definition: mvc.h:139
#define Mvc_CubeBitClean(Cube)
Definition: mvc.h:381
Mvc_Cover_t* Mvc_CoverBooleanAnd ( Mvc_Data_t p,
Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)
int Mvc_CoverBooleanEqual ( Mvc_Data_t p,
Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)
Mvc_Cover_t* Mvc_CoverBooleanOr ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

DECLARATIONS ///.

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

FileName [mvcProc.c]

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

Synopsis [Various boolean procedures working with covers.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcOpBool.c,v 1.4 2003/04/16 01:55:37 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcOpBool.c.

44 {
45  Mvc_Cover_t * pCover;
46  Mvc_Cube_t * pCube, * pCubeCopy;
47  // make sure the covers are compatible
48  assert( pCover1->nBits == pCover2->nBits );
49  // clone the cover
50  pCover = Mvc_CoverClone( pCover1 );
51  // create the cubes by making pair-wise products
52  // of cubes in pCover1 and pCover2
53  Mvc_CoverForEachCube( pCover1, pCube )
54  {
55  pCubeCopy = Mvc_CubeDup( pCover, pCube );
56  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
57  }
58  Mvc_CoverForEachCube( pCover2, pCube )
59  {
60  pCubeCopy = Mvc_CubeDup( pCover, pCube );
61  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
62  }
63  return pCover;
64 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
int Mvc_CoverCheckSuppContainment ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

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

Synopsis [Returns 1 if the support of cover2 is contained in the support of cover1.]

Description []

SideEffects []

SeeAlso []

Definition at line 247 of file mvcUtils.c.

248 {
249  int Result;
250  assert( pCover1->nBits == pCover2->nBits );
251  // set the supports
252  Mvc_CoverAllocateMask( pCover1 );
253  Mvc_CoverSupport( pCover1, pCover1->pMask );
254  Mvc_CoverAllocateMask( pCover2 );
255  Mvc_CoverSupport( pCover2, pCover2->pMask );
256  // check the containment
257  Mvc_CubeBitNotImpl( Result, pCover2->pMask, pCover1->pMask );
258  return !Result;
259 }
#define Mvc_CubeBitNotImpl(Res, Cube1, Cube2)
Definition: mvc.h:429
Mvc_Cube_t * pMask
Definition: mvc.h:92
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition: mvcUtils.c:58
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
Mvc_Cover_t* Mvc_CoverClone ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file mvcCover.c.

80 {
81  Mvc_Cover_t * pCover;
82 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
83  pCover = (Mvc_Cover_t *)ABC_ALLOC( char, sizeof(Mvc_Cover_t) );
84 #else
85  pCover = (Mvc_Cover_t *)Extra_MmFixedEntryFetch( p->pMem->pManC );
86 #endif
87  pCover->pMem = p->pMem;
88  pCover->nBits = p->nBits;
89  pCover->nWords = p->nWords;
90  pCover->nUnused = p->nUnused;
91  pCover->lCubes.nItems = 0;
92  pCover->lCubes.pHead = NULL;
93  pCover->lCubes.pTail = NULL;
94  pCover->nCubesAlloc = 0;
95  pCover->pCubes = NULL;
96  pCover->pMask = NULL;
97  pCover->pLits = NULL;
98  return pCover;
99 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nWords
Definition: mvc.h:85
int nItems
Definition: mvc.h:79
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int * pLits
Definition: mvc.h:91
int nUnused
Definition: mvc.h:86
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
int nCubesAlloc
Definition: mvc.h:90
int nBits
Definition: mvc.h:87
Extra_MmFixed_t * pManC
Definition: mvc.h:110
Mvc_Manager_t * pMem
Definition: mvc.h:93
Mvc_Cover_t* Mvc_CoverCofactor ( Mvc_Cover_t p,
int  iValue,
int  iValueOther 
)

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

Synopsis [Returns the cofactor w.r.t. to a binary var.]

Description []

SideEffects []

SeeAlso []

Definition at line 518 of file mvcUtils.c.

519 {
520  Mvc_Cover_t * pCover;
521  Mvc_Cube_t * pCube, * pCubeCopy;
522  // clone the cover
523  pCover = Mvc_CoverClone( p );
524  // copy the cube list
525  Mvc_CoverForEachCube( p, pCube )
526  if ( Mvc_CubeBitValue( pCube, iValue ) )
527  {
528  pCubeCopy = Mvc_CubeDup( pCover, pCube );
529  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
530  Mvc_CubeBitInsert( pCubeCopy, iValueOther );
531  }
532  return pCover;
533 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
if(last==0)
Definition: sparse_int.h:34
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
#define Mvc_CubeBitInsert(Cube, Bit)
Definition: mvc.h:139
Mvc_Cover_t** Mvc_CoverCofactors ( Mvc_Data_t pData,
Mvc_Cover_t pCover,
int  iVar 
)
void Mvc_CoverCommonCube ( Mvc_Cover_t pCover,
Mvc_Cube_t pComCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file mvcUtils.c.

156 {
157  Mvc_Cube_t * pCube;
158  // clean the support
159  Mvc_CubeBitFill( pComCube );
160  // collect the support
161  Mvc_CoverForEachCube( pCover, pCube )
162  Mvc_CubeBitAnd( pComCube, pComCube, pCube );
163 }
#define Mvc_CubeBitAnd(CubeR, Cube1, Cube2)
Definition: mvc.h:405
#define Mvc_CubeBitFill(Cube)
Definition: mvc.h:385
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
Mvc_Cover_t* Mvc_CoverCommonCubeCover ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file mvcUtils.c.

221 {
222  Mvc_Cover_t * pRes;
223  Mvc_Cube_t * pCube;
224  // create the new cover
225  pRes = Mvc_CoverClone( pCover );
226  // get the new cube
227  pCube = Mvc_CubeAlloc( pRes );
228  // get the common cube
229  Mvc_CoverCommonCube( pCover, pCube );
230  // add the cube to the cover
231  Mvc_CoverAddCubeTail( pRes, pCube );
232  return pRes;
233 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
void Mvc_CoverCommonCube(Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
Definition: mvcUtils.c:155
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
Mvc_Cover_t* Mvc_CoverComplement ( Mvc_Data_t p,
Mvc_Cover_t pCover 
)
int Mvc_CoverContain ( Mvc_Cover_t pCover)

FUNCTION DEFINITIONS ///.

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

Synopsis [Removes the contained cubes.]

Description [Returns 1 if the cover has been changed.]

SideEffects []

SeeAlso []

Definition at line 47 of file mvcContain.c.

48 {
49  int nCubes;
50  nCubes = Mvc_CoverReadCubeNum( pCover );
51  if ( nCubes < 2 )
52  return 0;
53  Mvc_CoverSetCubeSizes(pCover);
55  Mvc_CoverRemoveDuplicates( pCover );
56  if ( nCubes > 1 )
57  Mvc_CoverRemoveContained( pCover );
58  return (nCubes != Mvc_CoverReadCubeNum(pCover));
59 }
static ABC_NAMESPACE_IMPL_START void Mvc_CoverRemoveDuplicates(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcContain.c:72
int Mvc_CubeCompareSizeAndInt(Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
Definition: mvcCompare.c:91
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
static void Mvc_CoverRemoveContained(Mvc_Cover_t *pCover)
Definition: mvcContain.c:108
int Mvc_CoverSetCubeSizes(Mvc_Cover_t *pCover)
Definition: mvcUtils.c:272
void Mvc_CoverSort(Mvc_Cover_t *pCover, Mvc_Cube_t *pMask, int(*pCompareFunc)(Mvc_Cube_t *, Mvc_Cube_t *, Mvc_Cube_t *))
FuNCTION DEFINITIONS ///.
Definition: mvcSort.c:47
void Mvc_CoverCopyAndAppendCubes ( Mvc_Cover_t pC1,
Mvc_Cover_t pC2 
)
int Mvc_CoverCountCubePairDiffs ( Mvc_Cover_t pCover,
unsigned char  pDiffs[] 
)

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

Synopsis [Counts the differences in each cube pair in the cover.]

Description [Takes the cover (pCover) and the array where the diff counters go (pDiffs). The array pDiffs should have as many entries as there are different pairs of cubes in the cover: n(n-1)/2. Fills out the array pDiffs with the following info: For each cube pair, included in the array is the number of literals in both cubes after they are made cube ABC_FREE.]

SideEffects []

SeeAlso []

Definition at line 342 of file mvcUtils.c.

343 {
344  Mvc_Cube_t * pCube1;
345  Mvc_Cube_t * pCube2;
346  Mvc_Cube_t * pMask;
347  unsigned char * pByte, * pByteStart, * pByteStop;
348  int nBytes, nOnes;
349  int nCubePairs;
350 
351  // allocate a temporary mask
352  pMask = Mvc_CubeAlloc( pCover );
353  // get the number of unsigned chars in the cube's bit strings
354  nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
355  // iterate through the cubes
356  nCubePairs = 0;
357  Mvc_CoverForEachCube( pCover, pCube1 )
358  {
360  {
361  // find the bit-wise exor of cubes
362  Mvc_CubeBitExor( pMask, pCube1, pCube2 );
363  // set the starting and stopping positions
364  pByteStart = (unsigned char *)pMask->pData;
365  pByteStop = pByteStart + nBytes;
366  // clean the counter of ones
367  nOnes = 0;
368  // iterate through the positions
369  for ( pByte = pByteStart; pByte < pByteStop; pByte++ )
370  nOnes += bit_count[*pByte];
371  // set the nOnes
372  pDiffs[nCubePairs++] = nOnes;
373  }
374  }
375  // deallocate the mask
376  Mvc_CubeFree( pCover, pMask );
377  return 1;
378 }
#define Mvc_CubeReadNext(Cube)
MACRO DEFINITIONS ///.
Definition: mvc.h:121
for(p=first;p->value< newval;p=p->next)
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitExor(CubeR, Cube1, Cube2)
Definition: mvc.h:401
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
static ABC_NAMESPACE_IMPL_START int bit_count[256]
DECLARATIONS ///.
Definition: mvcUtils.c:28
int nBits
Definition: mvc.h:87
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
#define Mvc_CoverForEachCubeStart(Start, Cube)
Definition: mvc.h:542
int Mvc_CoverCountLiterals ( Mvc_Cover_t pCover)

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

Synopsis [Returns the number of literals in the cover.]

Description [Allocates storage for literal counters and fills it up using the current information.]

SideEffects []

SeeAlso []

Definition at line 287 of file mvcLits.c.

288 {
289  Mvc_Cube_t * pCube;
290  int nWord, nBit;
291  int i, CounterTot, CounterCur;
292 
293  // allocate/clean the storage for literals
294 // Mvc_CoverAllocateArrayLits( pCover );
295 // memset( pCover->pLits, 0, pCover->nBits * sizeof(int) );
296  // go through each literal
297  CounterTot = 0;
298  for ( i = 0; i < pCover->nBits; i++ )
299  {
300  // get the word and bit of this literal
301  nWord = Mvc_CubeWhichWord(i);
302  nBit = Mvc_CubeWhichBit(i);
303  // go through all the cubes
304  CounterCur = 0;
305  Mvc_CoverForEachCube( pCover, pCube )
306  if ( pCube->pData[nWord] & (1<<nBit) )
307  CounterCur++;
308  CounterTot += CounterCur;
309  }
310  return CounterTot;
311 }
#define Mvc_CubeWhichWord(Bit)
Definition: mvc.h:135
#define Mvc_CubeWhichBit(Bit)
Definition: mvc.h:136
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
Mvc_Cover_t* Mvc_CoverCreateConst ( Mvc_Manager_t pMem,
int  nBits,
int  Phase 
)
Mvc_Cover_t* Mvc_CoverCreateEmpty ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file mvcApi.c.

203 {
204  Mvc_Cover_t * pCoverNew;
205  pCoverNew = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
206  return pCoverNew;
207 }
int nBits
Definition: mvc.h:87
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
Mvc_Manager_t * pMem
Definition: mvc.h:93
Mvc_Cover_t* Mvc_CoverCreateTautology ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file mvcApi.c.

221 {
222  Mvc_Cube_t * pCubeNew;
223  Mvc_Cover_t * pCoverNew;
224  pCoverNew = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
225  pCubeNew = Mvc_CubeAlloc( pCoverNew );
226  Mvc_CubeBitFill( pCubeNew );
227  Mvc_CoverAddCubeTail( pCoverNew, pCubeNew );
228  return pCoverNew;
229 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitFill(Cube)
Definition: mvc.h:385
int nBits
Definition: mvc.h:87
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDeallocateArrayLits ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file mvcCover.c.

242 {
243  if ( pCover->pLits )
244  {
245  MEM_FREE( pCover->pMem, int, pCover->nBits, pCover->pLits );
246  pCover->pLits = NULL;
247  }
248 }
int * pLits
Definition: mvc.h:91
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
int nBits
Definition: mvc.h:87
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDeallocateMask ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file mvcCover.c.

225 {
226  Mvc_CubeFree( pCover, pCover->pMask );
227  pCover->pMask = NULL;
228 }
Mvc_Cube_t * pMask
Definition: mvc.h:92
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
void Mvc_CoverDeleteCube_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pPrev,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file mvcList.c.

174 {
175  Mvc_List_t * pList = &pCover->lCubes;
176 
177  if ( pPrev == NULL ) // deleting the head cube
178  pList->pHead = Mvc_CubeReadNext(pCube);
179  else
180  pPrev->pNext = pCube->pNext;
181  if ( pList->pTail == pCube ) // deleting the tail cube
182  {
183  assert( Mvc_CubeReadNext(pCube) == NULL );
184  pList->pTail = pPrev;
185  }
186  pList->nItems--;
187 }
#define Mvc_CubeReadNext(Cube)
MACRO DEFINITIONS ///.
Definition: mvc.h:121
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pNext
Definition: mvc.h:65
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverDeleteLiteralsOfCube ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file mvcList.c.

266 {
267 // int iBit, Value;
268 // assert( pCover->pLits );
269 // Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
270 // if ( Value )
271 // pCover->pLits[iBit] -= Value;
272 }
int Mvc_CoverDist0Cubes ( Mvc_Data_t pData,
Mvc_Cube_t pA,
Mvc_Cube_t pB 
)
void Mvc_CoverDist1Merge ( Mvc_Data_t p,
Mvc_Cover_t pCover 
)
void Mvc_CoverDivide ( Mvc_Cover_t pCover,
Mvc_Cover_t pDiv,
Mvc_Cover_t **  ppQuo,
Mvc_Cover_t **  ppRem 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file mvcDivide.c.

48 {
49  // check the number of cubes
50  if ( Mvc_CoverReadCubeNum( pCover ) < Mvc_CoverReadCubeNum( pDiv ) )
51  {
52  *ppQuo = NULL;
53  *ppRem = NULL;
54  return;
55  }
56 
57  // make sure that support of pCover contains that of pDiv
58  if ( !Mvc_CoverCheckSuppContainment( pCover, pDiv ) )
59  {
60  *ppQuo = NULL;
61  *ppRem = NULL;
62  return;
63  }
64 
65  // perform the general division
66  Mvc_CoverDivideInternal( pCover, pDiv, ppQuo, ppRem );
67 }
void Mvc_CoverDivideInternal(Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
Definition: mvcDivide.c:81
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
int Mvc_CoverCheckSuppContainment(Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
Definition: mvcUtils.c:247
void Mvc_CoverDivideByCube ( Mvc_Cover_t pCover,
Mvc_Cover_t pDiv,
Mvc_Cover_t **  ppQuo,
Mvc_Cover_t **  ppRem 
)

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

Synopsis [Divides the cover by a cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file mvcDivide.c.

270 {
271  Mvc_Cover_t * pQuo, * pRem;
272  Mvc_Cube_t * pCubeC, * pCubeD, * pCubeCopy;
273  int CompResult;
274 
275  // get the only cube of D
276  assert( Mvc_CoverReadCubeNum(pDiv) == 1 );
277 
278  // start the quotient and the remainder
279  pQuo = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
280  pRem = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
281 
282  // get the first and only cube of the divisor
283  pCubeD = Mvc_CoverReadCubeHead( pDiv );
284 
285  // iterate through the cubes in the cover
286  Mvc_CoverForEachCube( pCover, pCubeC )
287  {
288  // check the containment of literals from pCubeD in pCube
289  Mvc_Cube2BitNotImpl( CompResult, pCubeD, pCubeC );
290  if ( !CompResult )
291  { // this cube belongs to the quotient
292  // alloc the cube
293  pCubeCopy = Mvc_CubeAlloc( pQuo );
294  // clean the support of D
295  Mvc_CubeBitSharp( pCubeCopy, pCubeC, pCubeD );
296  // add the cube to the quotient
297  Mvc_CoverAddCubeTail( pQuo, pCubeCopy );
298  }
299  else
300  {
301  // copy the cube
302  pCubeCopy = Mvc_CubeDup( pRem, pCubeC );
303  // add the cube to the remainder
304  Mvc_CoverAddCubeTail( pRem, pCubeCopy );
305  }
306  }
307  // return the results
308  *ppRem = pRem;
309  *ppQuo = pQuo;
310 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
#define Mvc_CubeBitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:409
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_Cube2BitNotImpl(Res, Cube1, Cube2)
Definition: mvc.h:304
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDivideByLiteral ( Mvc_Cover_t pCover,
Mvc_Cover_t pDiv,
Mvc_Cover_t **  ppQuo,
Mvc_Cover_t **  ppRem 
)

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

Synopsis [Divides the cover by a literal.]

Description []

SideEffects []

SeeAlso []

Definition at line 323 of file mvcDivide.c.

324 {
325  Mvc_Cover_t * pQuo, * pRem;
326  Mvc_Cube_t * pCubeC, * pCubeCopy;
327  int iLit;
328 
329  // get the only cube of D
330  assert( Mvc_CoverReadCubeNum(pDiv) == 1 );
331 
332  // start the quotient and the remainder
333  pQuo = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
334  pRem = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
335 
336  // get the first and only literal in the divisor cube
337  iLit = Mvc_CoverFirstCubeFirstLit( pDiv );
338 
339  // iterate through the cubes in the cover
340  Mvc_CoverForEachCube( pCover, pCubeC )
341  {
342  // copy the cube
343  pCubeCopy = Mvc_CubeDup( pCover, pCubeC );
344  // add the cube to the quotient or to the remainder depending on the literal
345  if ( Mvc_CubeBitValue( pCubeCopy, iLit ) )
346  { // remove the literal
347  Mvc_CubeBitRemove( pCubeCopy, iLit );
348  // add the cube ot the quotient
349  Mvc_CoverAddCubeTail( pQuo, pCubeCopy );
350  }
351  else
352  { // add the cube ot the remainder
353  Mvc_CoverAddCubeTail( pRem, pCubeCopy );
354  }
355  }
356  // return the results
357  *ppRem = pRem;
358  *ppQuo = pQuo;
359 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
int Mvc_CoverFirstCubeFirstLit(Mvc_Cover_t *pCover)
Definition: mvcLits.c:261
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
#define Mvc_CubeBitRemove(Cube, Bit)
Definition: mvc.h:140
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDivideByLiteralQuo ( Mvc_Cover_t pCover,
int  iLit 
)

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

Synopsis [Derives the quotient of division by literal.]

Description [Reduces the cover to be the equal to the result of division of the given cover by the literal.]

SideEffects []

SeeAlso []

Definition at line 374 of file mvcDivide.c.

375 {
376  Mvc_Cube_t * pCube, * pCube2, * pPrev;
377  // delete those cubes that do not have this literal
378  // remove this literal from other cubes
379  pPrev = NULL;
380  Mvc_CoverForEachCubeSafe( pCover, pCube, pCube2 )
381  {
382  if ( Mvc_CubeBitValue( pCube, iLit ) == 0 )
383  { // delete the cube from the cover
384  Mvc_CoverDeleteCube( pCover, pPrev, pCube );
385  Mvc_CubeFree( pCover, pCube );
386  // don't update the previous cube
387  }
388  else
389  { // delete this literal from the cube
390  Mvc_CubeBitRemove( pCube, iLit );
391  // update the previous cube
392  pPrev = pCube;
393  }
394  }
395 }
#define Mvc_CubeBitRemove(Cube, Bit)
Definition: mvc.h:140
#define Mvc_CoverForEachCubeSafe(Cover, Cube, Cube2)
Definition: mvc.h:536
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
#define Mvc_CoverDeleteCube(pCover, pPrev, pCube)
Definition: mvc.h:506
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
void Mvc_CoverDivideInternal ( Mvc_Cover_t pCover,
Mvc_Cover_t pDiv,
Mvc_Cover_t **  ppQuo,
Mvc_Cover_t **  ppRem 
)

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

Synopsis [Merge the cubes inside the groups.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file mvcDivide.c.

82 {
83  Mvc_Cover_t * pQuo, * pRem;
84  Mvc_Cube_t * pCubeC, * pCubeD, * pCubeCopy;
85  Mvc_Cube_t * pCube1, * pCube2;
86  int * pGroups, nGroups; // the cube groups
87  int nCubesC, nCubesD, nMerges, iCubeC, iCubeD;
88  int iMerge = -1; // Suppress "might be used uninitialized"
89  int fSkipG, GroupSize, g, c, RetValue;
90  int nCubes;
91 
92  // get cover sizes
93  nCubesD = Mvc_CoverReadCubeNum( pDiv );
94  nCubesC = Mvc_CoverReadCubeNum( pCover );
95 
96  // check trivial cases
97  if ( nCubesD == 1 )
98  {
99  if ( Mvc_CoverIsOneLiteral( pDiv ) )
100  Mvc_CoverDivideByLiteral( pCover, pDiv, ppQuo, ppRem );
101  else
102  Mvc_CoverDivideByCube( pCover, pDiv, ppQuo, ppRem );
103  return;
104  }
105 
106  // create the divisor and the remainder
107  pQuo = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
108  pRem = Mvc_CoverAlloc( pCover->pMem, pCover->nBits );
109 
110  // get the support of the divisor
111  Mvc_CoverAllocateMask( pDiv );
112  Mvc_CoverSupport( pDiv, pDiv->pMask );
113 
114  // sort the cubes of the divisor
115  Mvc_CoverSort( pDiv, NULL, Mvc_CubeCompareInt );
116  // sort the cubes of the cover
118 
119  // allocate storage for cube groups
120  pGroups = MEM_ALLOC( pCover->pMem, int, nCubesC + 1 );
121 
122  // mask contains variables in the support of Div
123  // split the cubes into groups using the mask
124  Mvc_CoverList2Array( pCover );
125  Mvc_CoverList2Array( pDiv );
126  pGroups[0] = 0;
127  nGroups = 1;
128  for ( c = 1; c < nCubesC; c++ )
129  {
130  // get the cubes
131  pCube1 = pCover->pCubes[c-1];
132  pCube2 = pCover->pCubes[c ];
133  // compare the cubes
134  Mvc_CubeBitEqualOutsideMask( RetValue, pCube1, pCube2, pDiv->pMask );
135  if ( !RetValue )
136  pGroups[nGroups++] = c;
137  }
138  // finish off the last group
139  pGroups[nGroups] = nCubesC;
140 
141  // consider each group separately and decide
142  // whether it can produce a quotient cube
143  nCubes = 0;
144  for ( g = 0; g < nGroups; g++ )
145  {
146  // if the group has less than nCubesD cubes,
147  // there is no way it can produce the quotient cube
148  // copy the cubes to the remainder
149  GroupSize = pGroups[g+1] - pGroups[g];
150  if ( GroupSize < nCubesD )
151  {
152  for ( c = pGroups[g]; c < pGroups[g+1]; c++ )
153  {
154  pCubeCopy = Mvc_CubeDup( pRem, pCover->pCubes[c] );
155  Mvc_CoverAddCubeTail( pRem, pCubeCopy );
156  nCubes++;
157  }
158  continue;
159  }
160 
161  // mark the cubes as those that should be added to the remainder
162  for ( c = pGroups[g]; c < pGroups[g+1]; c++ )
163  Mvc_CubeSetSize( pCover->pCubes[c], 1 );
164 
165  // go through the cubes in the group and at the same time
166  // go through the cubes in the divisor
167  iCubeD = 0;
168  iCubeC = 0;
169  pCubeD = pDiv->pCubes[iCubeD++];
170  pCubeC = pCover->pCubes[pGroups[g]+iCubeC++];
171  fSkipG = 0;
172  nMerges = 0;
173 
174  while ( 1 )
175  {
176  // compare the topmost cubes in F and in D
177  RetValue = Mvc_CubeCompareIntUnderMask( pCubeC, pCubeD, pDiv->pMask );
178  // cube are ordered in increasing order of their int value
179  if ( RetValue == -1 ) // pCubeC is above pCubeD
180  { // cube in C should be added to the remainder
181  // check that there is enough cubes in the group
182  if ( GroupSize - iCubeC < nCubesD - nMerges )
183  {
184  fSkipG = 1;
185  break;
186  }
187  // get the next cube in the cover
188  pCubeC = pCover->pCubes[pGroups[g]+iCubeC++];
189  continue;
190  }
191  if ( RetValue == 1 ) // pCubeD is above pCubeC
192  { // given cube in D does not have a corresponding cube in the cover
193  fSkipG = 1;
194  break;
195  }
196  // mark the cube as the one that should NOT be added to the remainder
197  Mvc_CubeSetSize( pCubeC, 0 );
198  // remember this merged cube
199  iMerge = iCubeC-1;
200  nMerges++;
201 
202  // stop if we considered the last cube of the group
203  if ( iCubeD == nCubesD )
204  break;
205 
206  // advance the cube of the divisor
207  assert( iCubeD < nCubesD );
208  pCubeD = pDiv->pCubes[iCubeD++];
209 
210  // advance the cube of the group
211  assert( pGroups[g]+iCubeC < nCubesC );
212  pCubeC = pCover->pCubes[pGroups[g]+iCubeC++];
213  }
214 
215  if ( fSkipG )
216  {
217  // the group has failed, add all the cubes to the remainder
218  for ( c = pGroups[g]; c < pGroups[g+1]; c++ )
219  {
220  pCubeCopy = Mvc_CubeDup( pRem, pCover->pCubes[c] );
221  Mvc_CoverAddCubeTail( pRem, pCubeCopy );
222  nCubes++;
223  }
224  continue;
225  }
226 
227  // the group has worked, add left-over cubes to the remainder
228  for ( c = pGroups[g]; c < pGroups[g+1]; c++ )
229  {
230  pCubeC = pCover->pCubes[c];
231  if ( Mvc_CubeReadSize(pCubeC) )
232  {
233  pCubeCopy = Mvc_CubeDup( pRem, pCubeC );
234  Mvc_CoverAddCubeTail( pRem, pCubeCopy );
235  nCubes++;
236  }
237  }
238 
239  // create the quotient cube
240  pCube1 = Mvc_CubeAlloc( pQuo );
241  Mvc_CubeBitSharp( pCube1, pCover->pCubes[pGroups[g]+iMerge], pDiv->pMask );
242  // add the cube to the quotient
243  Mvc_CoverAddCubeTail( pQuo, pCube1 );
244  nCubes += nCubesD;
245  }
246  assert( nCubes == nCubesC );
247 
248  // deallocate the memory
249  MEM_FREE( pCover->pMem, int, nCubesC + 1, pGroups );
250 
251  // return the results
252  *ppRem = pRem;
253  *ppQuo = pQuo;
254 // Mvc_CoverVerifyDivision( pCover, pDiv, pQuo, pRem );
255 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
int Mvc_CoverIsOneLiteral(Mvc_Cover_t *pCover)
Definition: mvcLits.c:324
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition: mvcUtils.c:58
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
#define Mvc_CubeSetSize(Cube, Size)
Definition: mvc.h:128
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
void Mvc_CoverList2Array(Mvc_Cover_t *pCover)
Definition: mvcList.c:286
Mvc_Cube_t * pMask
Definition: mvc.h:92
void Mvc_CoverDivideByCube(Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
Definition: mvcDivide.c:269
int Mvc_CubeCompareInt(Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
DECLARATIONS ///.
Definition: mvcCompare.c:43
#define Mvc_CubeBitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:409
int Mvc_CubeCompareIntOutsideAndUnderMask(Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
Definition: mvcCompare.c:265
#define MEM_ALLOC(Manager, Type, Size)
Definition: mvc.h:567
int Mvc_CubeCompareIntUnderMask(Mvc_Cube_t *pC1, Mvc_Cube_t *pC2, Mvc_Cube_t *pMask)
Definition: mvcCompare.c:146
void Mvc_CoverDivideByLiteral(Mvc_Cover_t *pCover, Mvc_Cover_t *pDiv, Mvc_Cover_t **ppQuo, Mvc_Cover_t **ppRem)
Definition: mvcDivide.c:323
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverSort(Mvc_Cover_t *pCover, Mvc_Cube_t *pMask, int(*pCompareFunc)(Mvc_Cube_t *, Mvc_Cube_t *, Mvc_Cube_t *))
FuNCTION DEFINITIONS ///.
Definition: mvcSort.c:47
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
#define Mvc_CubeBitEqualOutsideMask(Res, Cube1, Cube2, Mask)
Definition: mvc.h:441
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
Mvc_Manager_t * pMem
Definition: mvc.h:93
#define Mvc_CubeReadSize(Cube)
Definition: mvc.h:124
Mvc_Cover_t* Mvc_CoverDivisor ( Mvc_Cover_t pCover)

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns the quick divisor of the cover.]

Description [Returns NULL, if there is not divisor other than trivial.]

SideEffects []

SeeAlso []

Definition at line 46 of file mvcDivisor.c.

47 {
48  Mvc_Cover_t * pKernel;
49  if ( Mvc_CoverReadCubeNum(pCover) <= 1 )
50  return NULL;
51  // allocate the literal array and count literals
52  if ( Mvc_CoverAnyLiteral( pCover, NULL ) == -1 )
53  return NULL;
54  // duplicate the cover
55  pKernel = Mvc_CoverDup(pCover);
56  // perform the kerneling
57  Mvc_CoverDivisorZeroKernel( pKernel );
58  assert( Mvc_CoverReadCubeNum(pKernel) );
59  return pKernel;
60 }
static ABC_NAMESPACE_IMPL_START void Mvc_CoverDivisorZeroKernel(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcDivisor.c:73
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
#define assert(ex)
Definition: util_old.h:213
int Mvc_CoverAnyLiteral(Mvc_Cover_t *pCover, Mvc_Cube_t *pMask)
DECLARATIONS ///.
Definition: mvcLits.c:43
Mvc_Cover_t * Mvc_CoverDup(Mvc_Cover_t *pCover)
Definition: mvcCover.c:112
Mvc_Cover_t* Mvc_CoverDup ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file mvcCover.c.

113 {
114  Mvc_Cover_t * pCover;
115  Mvc_Cube_t * pCube, * pCubeCopy;
116  // clone the cover
117  pCover = Mvc_CoverClone( p );
118  // copy the cube list
119  Mvc_CoverForEachCube( p, pCube )
120  {
121  pCubeCopy = Mvc_CubeDup( p, pCube );
122  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
123  }
124  return pCover;
125 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *p)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int Mvc_CoverFirstCubeFirstLit ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file mvcLits.c.

262 {
263  Mvc_Cube_t * pCube;
264  int iBit, Value;
265 
266  // get the first cube
267  pCube = Mvc_CoverReadCubeHead( pCover );
268  // get the first literal
269  Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
270  if ( Value )
271  return iBit;
272  return -1;
273 }
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
Definition: mvc.h:553
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
Mvc_Cover_t* Mvc_CoverFlipVar ( Mvc_Cover_t p,
int  iValue0,
int  iValue1 
)

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

Synopsis [Returns the cover, in which the binary var is complemented.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file mvcUtils.c.

547 {
548  Mvc_Cover_t * pCover;
549  Mvc_Cube_t * pCube, * pCubeCopy;
550  int Value0, Value1, Temp;
551 
552  assert( iValue0 + 1 == iValue1 ); // should be adjacent
553 
554  // clone the cover
555  pCover = Mvc_CoverClone( p );
556  // copy the cube list
557  Mvc_CoverForEachCube( p, pCube )
558  {
559  pCubeCopy = Mvc_CubeDup( pCover, pCube );
560  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
561 
562  // get the bits
563  Value0 = Mvc_CubeBitValue( pCubeCopy, iValue0 );
564  Value1 = Mvc_CubeBitValue( pCubeCopy, iValue1 );
565 
566  // if both bits are one, nothing to swap
567  if ( Value0 && Value1 )
568  continue;
569  // cannot be both zero because they belong to the same var
570  assert( Value0 || Value1 );
571 
572  // swap the bits
573  Temp = Value0;
574  Value0 = Value1;
575  Value1 = Temp;
576 
577  // set the bits after the swap
578  if ( Value0 )
579  Mvc_CubeBitInsert( pCubeCopy, iValue0 );
580  else
581  Mvc_CubeBitRemove( pCubeCopy, iValue0 );
582 
583  if ( Value1 )
584  Mvc_CubeBitInsert( pCubeCopy, iValue1 );
585  else
586  Mvc_CubeBitRemove( pCubeCopy, iValue1 );
587  }
588  return pCover;
589 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
#define Mvc_CubeBitRemove(Cube, Bit)
Definition: mvc.h:140
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
#define assert(ex)
Definition: util_old.h:213
#define Mvc_CubeBitInsert(Cube, Bit)
Definition: mvc.h:139
void Mvc_CoverFree ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file mvcCover.c.

139 {
140  Mvc_Cube_t * pCube, * pCube2;
141  // recycle cube list
142  Mvc_CoverForEachCubeSafe( p, pCube, pCube2 )
143  Mvc_CubeFree( p, pCube );
144  // recycle other pointers
145  Mvc_CubeFree( p, p->pMask );
146  MEM_FREE( p->pMem, Mvc_Cube_t *, p->nCubesAlloc, p->pCubes );
147  MEM_FREE( p->pMem, int, p->nBits, p->pLits );
148 
149 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
150  ABC_FREE( p );
151 #else
152  Extra_MmFixedEntryRecycle( p->pMem->pManC, (char *)p );
153 #endif
154 }
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
#define Mvc_CoverForEachCubeSafe(Cover, Cube, Cube2)
Definition: mvc.h:536
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
int Mvc_CoverGetCubeSize ( Mvc_Cube_t pCube)

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

Synopsis [Counts the cube sizes.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file mvcUtils.c.

309 {
310  unsigned char * pByte, * pByteStart, * pByteStop;
311  int nOnes, nBytes, nBits;
312  // get the number of unsigned chars in the cube's bit strings
313  nBits = (pCube->iLast + 1) * sizeof(Mvc_CubeWord_t) * 8 - pCube->nUnused;
314  nBytes = nBits / (8 * sizeof(unsigned char)) + (int)(nBits % (8 * sizeof(unsigned char)) > 0);
315  // clean the counter of ones
316  nOnes = 0;
317  // set the starting and stopping positions
318  pByteStart = (unsigned char *)pCube->pData;
319  pByteStop = pByteStart + nBytes;
320  // iterate through the positions
321  for ( pByte = pByteStart; pByte < pByteStop; pByte++ )
322  nOnes += bit_count[*pByte];
323  return nOnes;
324 }
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
for(p=first;p->value< newval;p=p->next)
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
static ABC_NAMESPACE_IMPL_START int bit_count[256]
DECLARATIONS ///.
Definition: mvcUtils.c:28
void Mvc_CoverIntersectCubes ( Mvc_Data_t pData,
Mvc_Cover_t pC1,
Mvc_Cover_t pC2 
)
void Mvc_CoverInverse ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 477 of file mvcUtils.c.

478 {
479  Mvc_Cube_t * pCube;
480  // complement the cubes
481  Mvc_CoverForEachCube( pCover, pCube )
482  Mvc_CubeBitNot( pCube );
483 }
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitNot(Cube)
Definition: mvc.h:389
int Mvc_CoverIsBinaryBuffer ( Mvc_Cover_t pCover)

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

Synopsis [Returns 1 if the cover is a binary buffer.]

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file mvcApi.c.

136 {
137  Mvc_Cube_t * pCube;
138  if ( pCover->nBits != 2 )
139  return 0;
140  if ( Mvc_CoverReadCubeNum(pCover) != 1 )
141  return 0;
142  pCube = pCover->lCubes.pHead;
143  if ( Mvc_CubeBitValue(pCube, 0) == 0 && Mvc_CubeBitValue(pCube, 1) == 1 )
144  return 1;
145  return 0;
146 }
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
int Mvc_CoverIsCubeFree ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file mvcUtils.c.

177 {
178  int Result;
179  // get the common cube
180  Mvc_CoverAllocateMask( pCover );
181  Mvc_CoverCommonCube( pCover, pCover->pMask );
182  // check whether the common cube is empty
183  Mvc_CubeBitEmpty( Result, pCover->pMask );
184  return Result;
185 }
void Mvc_CoverCommonCube(Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
Definition: mvcUtils.c:155
Mvc_Cube_t * pMask
Definition: mvc.h:92
#define Mvc_CubeBitEmpty(Res, Cube)
Definition: mvc.h:413
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
int Mvc_CoverIsEmpty ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file mvcApi.c.

94 {
95  return Mvc_CoverReadCubeNum(pCover) == 0;
96 }
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
int Mvc_CoverIsIntersecting ( Mvc_Data_t pData,
Mvc_Cover_t pC1,
Mvc_Cover_t pC2 
)
int Mvc_CoverIsOneLiteral ( Mvc_Cover_t pCover)

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

Synopsis [Returns the number of literals in the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 324 of file mvcLits.c.

325 {
326  Mvc_Cube_t * pCube;
327  int iBit, Counter, Value;
328  if ( Mvc_CoverReadCubeNum(pCover) != 1 )
329  return 0;
330  pCube = Mvc_CoverReadCubeHead(pCover);
331  // count literals
332  Counter = 0;
333  Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
334  {
335  if ( Value )
336  {
337  if ( Counter++ )
338  return 0;
339  }
340  }
341  return 1;
342 }
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
static int Counter
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
Definition: mvc.h:553
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
int Mvc_CoverIsTautology ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file mvcApi.c.

110 {
111  Mvc_Cube_t * pCube;
112  int iBit, Value;
113 
114  if ( Mvc_CoverReadCubeNum(pCover) != 1 )
115  return 0;
116 
117  pCube = Mvc_CoverReadCubeHead( pCover );
118  Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
119  if ( Value == 0 )
120  return 0;
121  return 1;
122 }
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
Definition: mvc.h:553
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
void Mvc_CoverList2Array ( Mvc_Cover_t pCover)

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

Synopsis [Transfers the cubes from the list into the array.]

Description []

SideEffects []

SeeAlso []

Definition at line 286 of file mvcList.c.

287 {
288  Mvc_Cube_t * pCube;
289  int Counter;
290  // resize storage if necessary
291  Mvc_CoverAllocateArrayCubes( pCover );
292  // iterate through the cubes
293  Counter = 0;
294  Mvc_CoverForEachCube( pCover, pCube )
295  pCover->pCubes[ Counter++ ] = pCube;
296  assert( Counter == Mvc_CoverReadCubeNum(pCover) );
297 }
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
static int Counter
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
void Mvc_CoverAllocateArrayCubes(Mvc_Cover_t *pCover)
Definition: mvcCover.c:202
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverMakeCubeFree ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file mvcUtils.c.

199 {
200  Mvc_Cube_t * pCube;
201  // get the common cube
202  Mvc_CoverAllocateMask( pCover );
203  Mvc_CoverCommonCube( pCover, pCover->pMask );
204  // remove this cube from the cubes in the cover
205  Mvc_CoverForEachCube( pCover, pCube )
206  Mvc_CubeBitSharp( pCube, pCube, pCover->pMask );
207 }
void Mvc_CoverCommonCube(Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
Definition: mvcUtils.c:155
Mvc_Cube_t * pMask
Definition: mvc.h:92
#define Mvc_CubeBitSharp(CubeR, Cube1, Cube2)
Definition: mvc.h:409
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
void Mvc_CoverMakeEmpty ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file mvcApi.c.

161 {
162  Mvc_Cube_t * pCube, * pCube2;
163  Mvc_CoverForEachCubeSafe( pCover, pCube, pCube2 )
164  Mvc_CubeFree( pCover, pCube );
165  pCover->lCubes.nItems = 0;
166  pCover->lCubes.pHead = NULL;
167  pCover->lCubes.pTail = NULL;
168 }
#define Mvc_CoverForEachCubeSafe(Cover, Cube, Cube2)
Definition: mvc.h:536
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
void Mvc_CoverMakeTautology ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file mvcApi.c.

182 {
183  Mvc_Cube_t * pCubeNew;
184  Mvc_CoverMakeEmpty( pCover );
185  pCubeNew = Mvc_CubeAlloc( pCover );
186  Mvc_CubeBitFill( pCubeNew );
187  Mvc_CoverAddCubeTail( pCover, pCubeNew );
188 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitFill(Cube)
Definition: mvc.h:385
void Mvc_CoverMakeEmpty(Mvc_Cover_t *pCover)
Definition: mvcApi.c:160
void Mvc_CoverMinimizeByReshape ( Mvc_Data_t pData,
Mvc_Cover_t pCover 
)
void Mvc_CoverPrint ( Mvc_Cover_t pCover)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file mvcPrint.c.

48 {
49  Mvc_Cube_t * pCube;
50  int i;
51  // print general statistics
52  printf( "The cover contains %d cubes (%d bits and %d words)\n",
53  pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
54  // iterate through the cubes
55  Mvc_CoverForEachCube( pCover, pCube )
56  Mvc_CubePrint( pCover, pCube );
57 
58  if ( pCover->pLits )
59  {
60  for ( i = 0; i < pCover->nBits; i++ )
61  printf( " %d", pCover->pLits[i] );
62  printf( "\n" );
63  }
64  printf( "End of cover printout\n" );
65 }
void Mvc_CubePrint(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcPrint.c:79
int nWords
Definition: mvc.h:85
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
void Mvc_CoverPrintMv ( Mvc_Data_t pData,
Mvc_Cover_t pCover 
)
int Mvc_CoverReadBitNum ( Mvc_Cover_t pCover)

Definition at line 44 of file mvcApi.c.

44 { return pCover->nBits; }
int nBits
Definition: mvc.h:87
Mvc_Cube_t* Mvc_CoverReadCubeHead ( Mvc_Cover_t pCover)

Definition at line 46 of file mvcApi.c.

46 { return pCover->lCubes.pHead; }
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pHead
Definition: mvc.h:77
Mvc_List_t* Mvc_CoverReadCubeList ( Mvc_Cover_t pCover)

Definition at line 48 of file mvcApi.c.

48 { return &pCover->lCubes; }
Mvc_List_t lCubes
Definition: mvc.h:88
int Mvc_CoverReadCubeNum ( Mvc_Cover_t pCover)

Definition at line 45 of file mvcApi.c.

45 { return pCover->lCubes.nItems; }
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t* Mvc_CoverReadCubeTail ( Mvc_Cover_t pCover)

Definition at line 47 of file mvcApi.c.

47 { return pCover->lCubes.pTail; }
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
int Mvc_CoverReadWordNum ( Mvc_Cover_t pCover)

FUNCTION DEFINITIONS ///.

FUNCTION DEFINITIONS ///.

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

FileName [mvcApi.c]

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

Synopsis []

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcApi.c,v 1.4 2003/04/03 06:31:48 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcApi.c.

43 { return pCover->nWords; }
int nWords
Definition: mvc.h:85
Mvc_Cover_t* Mvc_CoverRemap ( Mvc_Cover_t p,
int *  pVarsRem,
int  nVarsRem 
)

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 []

Definition at line 400 of file mvcUtils.c.

401 {
402  Mvc_Cover_t * pCover;
403  Mvc_Cube_t * pCube, * pCubeCopy;
404  int i;
405  // clone the cover
406  pCover = Mvc_CoverAlloc( p->pMem, nVarsRem );
407  // copy the cube list
408  Mvc_CoverForEachCube( p, pCube )
409  {
410  pCubeCopy = Mvc_CubeAlloc( pCover );
411  //Mvc_CubeBitClean( pCubeCopy ); //changed by wjiang
412  Mvc_CubeBitFill( pCubeCopy ); //changed by wjiang
413  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
414  }
415  // copy the corresponding columns
416  for ( i = 0; i < nVarsRem; i++ )
417  {
418  if (pVarsRem[i] < 0)
419  continue; //added by wjiang
420  assert( pVarsRem[i] >= 0 && pVarsRem[i] < p->nBits );
421  Mvc_CoverCopyColumn( p, pCover, pVarsRem[i], i );
422  }
423  return pCover;
424 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitFill(Cube)
Definition: mvc.h:385
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
static void Mvc_CoverCopyColumn(Mvc_Cover_t *pCoverOld, Mvc_Cover_t *pCoverNew, int iColOld, int iColNew)
Definition: mvcUtils.c:440
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverRemoveCubes ( Mvc_Cover_t pC)
Mvc_Cover_t* Mvc_CoverRemoveDontCareLits ( Mvc_Cover_t pCover)

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

Synopsis [This function dups the cover and removes DC literals from cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 496 of file mvcUtils.c.

497 {
498  Mvc_Cover_t * pCoverNew;
499  Mvc_Cube_t * pCube;
500 
501  pCoverNew = Mvc_CoverDup( pCover );
502  Mvc_CoverForEachCube( pCoverNew, pCube )
503  Mvc_CubeBitRemoveDcs( pCube );
504  return pCoverNew;
505 }
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
void Mvc_CubeBitRemoveDcs(Mvc_Cube_t *pCube)
Definition: mvcCube.c:159
Mvc_Cover_t * Mvc_CoverDup(Mvc_Cover_t *pCover)
Definition: mvcCover.c:112
void Mvc_CoverSetCubeHead ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

Definition at line 78 of file mvcApi.c.

78 { pCover->lCubes.pHead = pCube; }
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pHead
Definition: mvc.h:77
void Mvc_CoverSetCubeList ( Mvc_Cover_t pCover,
Mvc_List_t pList 
)

Definition at line 80 of file mvcApi.c.

80 { pCover->lCubes = *pList; }
Mvc_List_t lCubes
Definition: mvc.h:88
void Mvc_CoverSetCubeNum ( Mvc_Cover_t pCover,
int  nItems 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file mvcApi.c.

77 { pCover->lCubes.nItems = nItems; }
int nItems
Definition: mvc.h:79
Mvc_List_t lCubes
Definition: mvc.h:88
int Mvc_CoverSetCubeSizes ( Mvc_Cover_t pCover)

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

Synopsis [Counts the cube sizes.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file mvcUtils.c.

273 {
274  Mvc_Cube_t * pCube;
275  unsigned char * pByte, * pByteStart, * pByteStop;
276  int nBytes, nOnes;
277 
278  // get the number of unsigned chars in the cube's bit strings
279  nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
280  // iterate through the cubes
281  Mvc_CoverForEachCube( pCover, pCube )
282  {
283  // clean the counter of ones
284  nOnes = 0;
285  // set the starting and stopping positions
286  pByteStart = (unsigned char *)pCube->pData;
287  pByteStop = pByteStart + nBytes;
288  // iterate through the positions
289  for ( pByte = pByteStart; pByte < pByteStop; pByte++ )
290  nOnes += bit_count[*pByte];
291  // set the nOnes
292  Mvc_CubeSetSize( pCube, nOnes );
293  }
294  return 1;
295 }
for(p=first;p->value< newval;p=p->next)
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_CubeSetSize(Cube, Size)
Definition: mvc.h:128
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
static ABC_NAMESPACE_IMPL_START int bit_count[256]
DECLARATIONS ///.
Definition: mvcUtils.c:28
int nBits
Definition: mvc.h:87
void Mvc_CoverSetCubeTail ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

Definition at line 79 of file mvcApi.c.

79 { pCover->lCubes.pTail = pCube; }
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cover_t* Mvc_CoverSharp ( Mvc_Data_t p,
Mvc_Cover_t pA,
Mvc_Cover_t pB 
)
void Mvc_CoverSort ( Mvc_Cover_t pCover,
Mvc_Cube_t pMask,
int(*)(Mvc_Cube_t *, Mvc_Cube_t *, Mvc_Cube_t *)  pCompareFunc 
)

FuNCTION DEFINITIONS ///.

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

Synopsis [Sorts cubes using the given cost function.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file mvcSort.c.

48 {
49  Mvc_Cube_t * pHead;
50  int nCubes;
51  // one cube does not need sorting
52  nCubes = Mvc_CoverReadCubeNum(pCover);
53  if ( nCubes <= 1 )
54  return;
55  // sort the cubes
56  pHead = Mvc_CoverSort_rec( Mvc_CoverReadCubeHead(pCover), nCubes, pMask, pCompareFunc );
57  // insert the sorted list into the cover
58  Mvc_CoverSetCubeHead( pCover, pHead );
60  // make sure that the list is sorted in the increasing order
61  assert( pCompareFunc( Mvc_CoverReadCubeHead(pCover), Mvc_CoverReadCubeTail(pCover), pMask ) <= 0 );
62 }
Mvc_Cube_t * Mvc_CoverReadCubeTail(Mvc_Cover_t *pCover)
Definition: mvcApi.c:47
void Mvc_CoverSetCubeTail(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcApi.c:79
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
void Mvc_CoverSetCubeHead(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcApi.c:78
Mvc_Cube_t * Mvc_ListGetTailFromHead(Mvc_Cube_t *pHead)
Definition: mvcList.c:351
ABC_NAMESPACE_IMPL_START Mvc_Cube_t * Mvc_CoverSort_rec(Mvc_Cube_t *pList, int nItems, Mvc_Cube_t *pMask, int(*pCompareFunc)(Mvc_Cube_t *, Mvc_Cube_t *, Mvc_Cube_t *))
DECLARATIONS ///.
Definition: mvcSort.c:75
#define assert(ex)
Definition: util_old.h:213
Mvc_Cube_t * Mvc_CoverReadCubeHead(Mvc_Cover_t *pCover)
Definition: mvcApi.c:46
void Mvc_CoverSupport ( Mvc_Cover_t pCover,
Mvc_Cube_t pSupp 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file mvcUtils.c.

59 {
60  Mvc_Cube_t * pCube;
61  // clean the support
62  Mvc_CubeBitClean( pSupp );
63  // collect the support
64  Mvc_CoverForEachCube( pCover, pCube )
65  Mvc_CubeBitOr( pSupp, pSupp, pCube );
66 }
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:397
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitClean(Cube)
Definition: mvc.h:381
int Mvc_CoverSupportSizeBinary ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file mvcUtils.c.

101 {
102  Mvc_Cube_t * pSupp;
103  int Counter, i, v0, v1;
104  // compute the support
105  pSupp = Mvc_CubeAlloc( pCover );
106  Mvc_CoverSupportAnd( pCover, pSupp );
107  Counter = pCover->nBits/2;
108  for ( i = 0; i < pCover->nBits/2; i++ )
109  {
110  v0 = Mvc_CubeBitValue( pSupp, 2*i );
111  v1 = Mvc_CubeBitValue( pSupp, 2*i+1 );
112  if ( v0 && v1 )
113  Counter--;
114  }
115  Mvc_CubeFree( pCover, pSupp );
116  return Counter;
117 }
void Mvc_CoverSupportAnd(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
Definition: mvcUtils.c:79
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
static int Counter
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
int Mvc_CoverSupportVarBelongs ( Mvc_Cover_t pCover,
int  iVar 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file mvcUtils.c.

131 {
132  Mvc_Cube_t * pSupp;
133  int RetValue, v0, v1;
134  // compute the support
135  pSupp = Mvc_CubeAlloc( pCover );
136  Mvc_CoverSupportAnd( pCover, pSupp );
137  v0 = Mvc_CubeBitValue( pSupp, 2*iVar );
138  v1 = Mvc_CubeBitValue( pSupp, 2*iVar+1 );
139  RetValue = (int)( !v0 || !v1 );
140  Mvc_CubeFree( pCover, pSupp );
141  return RetValue;
142 }
void Mvc_CoverSupportAnd(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
Definition: mvcUtils.c:79
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
int Mvc_CoverTautology ( Mvc_Data_t p,
Mvc_Cover_t pCover 
)
Mvc_Cover_t* Mvc_CoverTranspose ( Mvc_Cover_t pCover)

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

Synopsis [Transposes the cube cover.]

Description [Returns the cube cover that looks like a transposed matrix, compared to the matrix derived from the original cover.]

SideEffects []

SeeAlso []

Definition at line 804 of file mvcUtils.c.

805 {
806  Mvc_Cover_t * pRes;
807  Mvc_Cube_t * pCubeRes, * pCube;
808  int nWord, nBit, i, iCube;
809 
810  pRes = Mvc_CoverAlloc( pCover->pMem, Mvc_CoverReadCubeNum(pCover) );
811  for ( i = 0; i < pCover->nBits; i++ )
812  {
813  // get the word and bit of this literal
814  nWord = Mvc_CubeWhichWord(i);
815  nBit = Mvc_CubeWhichBit(i);
816  // get the transposed cube
817  pCubeRes = Mvc_CubeAlloc( pRes );
818  Mvc_CubeBitClean( pCubeRes );
819  iCube = 0;
820  Mvc_CoverForEachCube( pCover, pCube )
821  {
822  if ( pCube->pData[nWord] & (1<<nBit) )
823  Mvc_CubeBitInsert( pCubeRes, iCube );
824  iCube++;
825  }
826  Mvc_CoverAddCubeTail( pRes, pCubeRes );
827  }
828  return pRes;
829 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
#define Mvc_CubeWhichWord(Bit)
Definition: mvc.h:135
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeWhichBit(Bit)
Definition: mvc.h:136
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition: mvcCover.c:43
#define Mvc_CubeBitInsert(Cube, Bit)
Definition: mvc.h:139
Mvc_Manager_t * pMem
Definition: mvc.h:93
#define Mvc_CubeBitClean(Cube)
Definition: mvc.h:381
Mvc_Cover_t* Mvc_CoverUnivQuantify ( Mvc_Cover_t p,
int  iValueA0,
int  iValueA1,
int  iValueB0,
int  iValueB1 
)

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

Synopsis [Returns the cover derived by universal quantification.]

Description [Returns the cover computed by universal quantification as follows: CoverNew = Univ(B) [Cover & (A==B)]. Removes the second binary var from the support (given by values iValueB0 and iValueB1). Leaves the first binary variable (given by values iValueA0 and iValueA1) in the support.]

SideEffects []

SeeAlso []

Definition at line 606 of file mvcUtils.c.

608 {
609  Mvc_Cover_t * pCover;
610  Mvc_Cube_t * pCube, * pCubeCopy;
611  int ValueA0, ValueA1, ValueB0, ValueB1;
612 
613  // clone the cover
614  pCover = Mvc_CoverClone( p );
615  // copy the cube list
616  Mvc_CoverForEachCube( p, pCube )
617  {
618  // get the bits
619  ValueA0 = Mvc_CubeBitValue( pCube, iValueA0 );
620  ValueA1 = Mvc_CubeBitValue( pCube, iValueA1 );
621  ValueB0 = Mvc_CubeBitValue( pCube, iValueB0 );
622  ValueB1 = Mvc_CubeBitValue( pCube, iValueB1 );
623 
624  // cannot be both zero because they belong to the same var
625  assert( ValueA0 || ValueA1 );
626  assert( ValueB0 || ValueB1 );
627 
628  // if the values of this var are different, do not add the cube
629  if ( ValueA0 != ValueB0 && ValueA1 != ValueB1 )
630  continue;
631 
632  // create the cube
633  pCubeCopy = Mvc_CubeDup( pCover, pCube );
634  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
635 
636  // insert 1's into for the first var, if both have this value
637  if ( ValueA0 && ValueB0 )
638  Mvc_CubeBitInsert( pCubeCopy, iValueA0 );
639  else
640  Mvc_CubeBitRemove( pCubeCopy, iValueA0 );
641 
642  if ( ValueA1 && ValueB1 )
643  Mvc_CubeBitInsert( pCubeCopy, iValueA1 );
644  else
645  Mvc_CubeBitRemove( pCubeCopy, iValueA1 );
646 
647  // insert 1's into for the second var (the cover does not depend on it)
648  Mvc_CubeBitInsert( pCubeCopy, iValueB0 );
649  Mvc_CubeBitInsert( pCubeCopy, iValueB1 );
650  }
651  return pCover;
652 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
#define Mvc_CubeBitRemove(Cube, Bit)
Definition: mvc.h:140
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
#define assert(ex)
Definition: util_old.h:213
#define Mvc_CubeBitInsert(Cube, Bit)
Definition: mvc.h:139
int Mvc_CoverWorstLiteral ( Mvc_Cover_t pCover,
Mvc_Cube_t pMask 
)

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

Synopsis [Find the most often occurring literal.]

Description [Find the most often occurring literal among those that occur more than once.]

SideEffects []

SeeAlso []

Definition at line 162 of file mvcLits.c.

163 {
164  Mvc_Cube_t * pCube;
165  int nWord, nBit;
166  int i, iMin, nLitsMin, nLitsCur;
167  int fUseFirst = 1;
168 
169  // go through each literal
170  iMin = -1;
171  nLitsMin = 1000000;
172  for ( i = 0; i < pCover->nBits; i++ )
173  if ( !pMask || Mvc_CubeBitValue(pMask,i) )
174  {
175  // get the word and bit of this literal
176  nWord = Mvc_CubeWhichWord(i);
177  nBit = Mvc_CubeWhichBit(i);
178  // go through all the cubes
179  nLitsCur = 0;
180  Mvc_CoverForEachCube( pCover, pCube )
181  if ( pCube->pData[nWord] & (1<<nBit) )
182  nLitsCur++;
183 
184  // skip the literal that does not occur or occurs once
185  if ( nLitsCur < 2 )
186  continue;
187 
188  // check if this is the best literal
189  if ( fUseFirst )
190  {
191  if ( nLitsMin > nLitsCur )
192  {
193  nLitsMin = nLitsCur;
194  iMin = i;
195  }
196  }
197  else
198  {
199  if ( nLitsMin >= nLitsCur )
200  {
201  nLitsMin = nLitsCur;
202  iMin = i;
203  }
204  }
205  }
206 
207  if ( nLitsMin < 1000000 )
208  return iMin;
209  return -1;
210 }
#define Mvc_CubeWhichWord(Bit)
Definition: mvc.h:135
#define Mvc_CubeWhichBit(Bit)
Definition: mvc.h:136
if(last==0)
Definition: sparse_int.h:34
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
Mvc_Cube_t* Mvc_CubeAlloc ( Mvc_Cover_t pCover)

DECLARATIONS ///.

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcCube.c.

44 {
45  Mvc_Cube_t * pCube;
46 
47  assert( pCover->nWords >= 0 );
48  // allocate the cube
49 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
50  if ( pCover->nWords == 0 )
51  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) );
52  else
53  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
54 #else
55  switch( pCover->nWords )
56  {
57  case 0:
58  case 1:
59  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan1 );
60  break;
61  case 2:
62  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan2 );
63  break;
64  case 3:
65  case 4:
66  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan4 );
67  break;
68  default:
69  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
70  break;
71  }
72 #endif
73  // set the parameters charactering this cube
74  if ( pCover->nWords == 0 )
75  pCube->iLast = pCover->nWords;
76  else
77  pCube->iLast = pCover->nWords - 1;
78  pCube->nUnused = pCover->nUnused;
79  return pCube;
80 }
int nWords
Definition: mvc.h:85
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int nUnused
Definition: mvc.h:86
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
#define assert(ex)
Definition: util_old.h:213
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CubeBitRemoveDcs ( Mvc_Cube_t pCube)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file mvcCube.c.

160 {
161  unsigned Mask;
162  int i;
163  for ( i = Mvc_CubeReadLast(pCube); i >= 0; i-- )
164  {
165  // detect those variables that are different (not DCs)
166  Mask = (pCube->pData[i] ^ (pCube->pData[i] >> 1)) & BITS_DISJOINT;
167  // create the mask of all that are different
168  Mask |= (Mask << 1);
169  // remove other bits from the set
170  pCube->pData[i] &= Mask;
171  }
172 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define BITS_DISJOINT
Definition: mvc.h:44
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
int Mvc_CubeCompareInt ( Mvc_Cube_t pC1,
Mvc_Cube_t pC2,
Mvc_Cube_t pMask 
)

DECLARATIONS ///.

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

FileName [mvcCompare.c]

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

Synopsis [Various cube comparison functions.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcCompare.c,v 1.5 2003/04/03 23:25:41 alanmi Exp

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

Synopsis [Compares two cubes according to their integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcCompare.c.

44 {
45  if ( Mvc_Cube1Words(pC1) )
46  {
47  if ( pC1->pData[0] < pC2->pData[0] )
48  return -1;
49  if ( pC1->pData[0] > pC2->pData[0] )
50  return 1;
51  return 0;
52  }
53  else if ( Mvc_Cube2Words(pC1) )
54  {
55  if ( pC1->pData[1] < pC2->pData[1] )
56  return -1;
57  if ( pC1->pData[1] > pC2->pData[1] )
58  return 1;
59  if ( pC1->pData[0] < pC2->pData[0] )
60  return -1;
61  if ( pC1->pData[0] > pC2->pData[0] )
62  return 1;
63  return 0;
64  }
65  else
66  {
67  int i = Mvc_CubeReadLast(pC1);
68  for(; i >= 0; i--)
69  {
70  if ( pC1->pData[i] < pC2->pData[i] )
71  return -1;
72  if ( pC1->pData[i] > pC2->pData[i] )
73  return 1;
74  }
75  return 0;
76  }
77 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
int Mvc_CubeCompareIntOutsideAndUnderMask ( Mvc_Cube_t pC1,
Mvc_Cube_t pC2,
Mvc_Cube_t pMask 
)

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

Synopsis [Compares the cubes (1) outside the mask, (2) under the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file mvcCompare.c.

266 {
267  unsigned uBits1, uBits2;
268 
269  if ( Mvc_Cube1Words(pC1) )
270  {
271  // compare the cubes outside the mask
272  uBits1 = pC1->pData[0] & ~(pMask->pData[0]);
273  uBits2 = pC2->pData[0] & ~(pMask->pData[0]);
274  if ( uBits1 < uBits2 )
275  return -1;
276  if ( uBits1 > uBits2 )
277  return 1;
278 
279  // compare the cubes under the mask
280  uBits1 = pC1->pData[0] & pMask->pData[0];
281  uBits2 = pC2->pData[0] & pMask->pData[0];
282  if ( uBits1 < uBits2 )
283  return -1;
284  if ( uBits1 > uBits2 )
285  return 1;
286  // cubes are equal
287  // should never happen
288  assert( 0 );
289  return 0;
290  }
291  else if ( Mvc_Cube2Words(pC1) )
292  {
293  // compare the cubes outside the mask
294  uBits1 = pC1->pData[1] & ~(pMask->pData[1]);
295  uBits2 = pC2->pData[1] & ~(pMask->pData[1]);
296  if ( uBits1 < uBits2 )
297  return -1;
298  if ( uBits1 > uBits2 )
299  return 1;
300 
301  uBits1 = pC1->pData[0] & ~(pMask->pData[0]);
302  uBits2 = pC2->pData[0] & ~(pMask->pData[0]);
303  if ( uBits1 < uBits2 )
304  return -1;
305  if ( uBits1 > uBits2 )
306  return 1;
307 
308  // compare the cubes under the mask
309  uBits1 = pC1->pData[1] & pMask->pData[1];
310  uBits2 = pC2->pData[1] & pMask->pData[1];
311  if ( uBits1 < uBits2 )
312  return -1;
313  if ( uBits1 > uBits2 )
314  return 1;
315 
316  uBits1 = pC1->pData[0] & pMask->pData[0];
317  uBits2 = pC2->pData[0] & pMask->pData[0];
318  if ( uBits1 < uBits2 )
319  return -1;
320  if ( uBits1 > uBits2 )
321  return 1;
322 
323  // cubes are equal
324  // should never happen
325  assert( 0 );
326  return 0;
327  }
328  else
329  {
330  int i;
331 
332  // compare the cubes outside the mask
333  for( i = Mvc_CubeReadLast(pC1); i >= 0; i-- )
334  {
335  uBits1 = pC1->pData[i] & ~(pMask->pData[i]);
336  uBits2 = pC2->pData[i] & ~(pMask->pData[i]);
337  if ( uBits1 < uBits2 )
338  return -1;
339  if ( uBits1 > uBits2 )
340  return 1;
341  }
342  // compare the cubes under the mask
343  for( i = Mvc_CubeReadLast(pC1); i >= 0; i-- )
344  {
345  uBits1 = pC1->pData[i] & pMask->pData[i];
346  uBits2 = pC2->pData[i] & pMask->pData[i];
347  if ( uBits1 < uBits2 )
348  return -1;
349  if ( uBits1 > uBits2 )
350  return 1;
351  }
352 /*
353  {
354  Mvc_Cover_t * pCover;
355  pCover = Mvc_CoverAlloc( NULL, 96 );
356  Mvc_CubePrint( pCover, pC1 );
357  Mvc_CubePrint( pCover, pC2 );
358  Mvc_CubePrint( pCover, pMask );
359  }
360 */
361  // cubes are equal
362  // should never happen
363  assert( 0 );
364  return 0;
365  }
366 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
#define assert(ex)
Definition: util_old.h:213
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
int Mvc_CubeCompareIntOutsideMask ( Mvc_Cube_t pC1,
Mvc_Cube_t pC2,
Mvc_Cube_t pMask 
)

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

Synopsis [Compares two cubes under the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file mvcCompare.c.

206 {
207  unsigned uBits1, uBits2;
208 
209  // compare the cubes under the mask
210  if ( Mvc_Cube1Words(pC1) )
211  {
212  uBits1 = pC1->pData[0] | pMask->pData[0];
213  uBits2 = pC2->pData[0] | pMask->pData[0];
214  if ( uBits1 < uBits2 )
215  return -1;
216  if ( uBits1 > uBits2 )
217  return 1;
218  // cubes are equal
219  return 0;
220  }
221  else if ( Mvc_Cube2Words(pC1) )
222  {
223  uBits1 = pC1->pData[1] | pMask->pData[1];
224  uBits2 = pC2->pData[1] | pMask->pData[1];
225  if ( uBits1 < uBits2 )
226  return -1;
227  if ( uBits1 > uBits2 )
228  return 1;
229  uBits1 = pC1->pData[0] | pMask->pData[0];
230  uBits2 = pC2->pData[0] | pMask->pData[0];
231  if ( uBits1 < uBits2 )
232  return -1;
233  if ( uBits1 > uBits2 )
234  return 1;
235  return 0;
236  }
237  else
238  {
239  int i = Mvc_CubeReadLast(pC1);
240  for(; i >= 0; i--)
241  {
242  uBits1 = pC1->pData[i] | pMask->pData[i];
243  uBits2 = pC2->pData[i] | pMask->pData[i];
244  if ( uBits1 < uBits2 )
245  return -1;
246  if ( uBits1 > uBits2 )
247  return 1;
248  }
249  return 0;
250  }
251 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
int Mvc_CubeCompareIntUnderMask ( Mvc_Cube_t pC1,
Mvc_Cube_t pC2,
Mvc_Cube_t pMask 
)

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

Synopsis [Compares two cubes under the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file mvcCompare.c.

147 {
148  unsigned uBits1, uBits2;
149 
150  // compare the cubes under the mask
151  if ( Mvc_Cube1Words(pC1) )
152  {
153  uBits1 = pC1->pData[0] & pMask->pData[0];
154  uBits2 = pC2->pData[0] & pMask->pData[0];
155  if ( uBits1 < uBits2 )
156  return -1;
157  if ( uBits1 > uBits2 )
158  return 1;
159  // cubes are equal
160  return 0;
161  }
162  else if ( Mvc_Cube2Words(pC1) )
163  {
164  uBits1 = pC1->pData[1] & pMask->pData[1];
165  uBits2 = pC2->pData[1] & pMask->pData[1];
166  if ( uBits1 < uBits2 )
167  return -1;
168  if ( uBits1 > uBits2 )
169  return 1;
170  uBits1 = pC1->pData[0] & pMask->pData[0];
171  uBits2 = pC2->pData[0] & pMask->pData[0];
172  if ( uBits1 < uBits2 )
173  return -1;
174  if ( uBits1 > uBits2 )
175  return 1;
176  return 0;
177  }
178  else
179  {
180  int i = Mvc_CubeReadLast(pC1);
181  for(; i >= 0; i--)
182  {
183  uBits1 = pC1->pData[i] & pMask->pData[i];
184  uBits2 = pC2->pData[i] & pMask->pData[i];
185  if ( uBits1 < uBits2 )
186  return -1;
187  if ( uBits1 > uBits2 )
188  return 1;
189  }
190  return 0;
191  }
192 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
int Mvc_CubeCompareSizeAndInt ( Mvc_Cube_t pC1,
Mvc_Cube_t pC2,
Mvc_Cube_t pMask 
)

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

Synopsis [Compares the cubes (1) by size, (2) by integer value.]

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file mvcCompare.c.

92 {
93  // compare the cubes by size
94  if ( Mvc_CubeReadSize( pC1 ) < Mvc_CubeReadSize( pC2 ) )
95  return 1;
96  if ( Mvc_CubeReadSize( pC1 ) > Mvc_CubeReadSize( pC2 ) )
97  return -1;
98  // the cubes have the same size
99 
100  // compare the cubes as integers
101  if ( Mvc_Cube1Words( pC1 ) )
102  {
103  if ( pC1->pData[0] < pC2->pData[0] )
104  return -1;
105  if ( pC1->pData[0] > pC2->pData[0] )
106  return 1;
107  return 0;
108  }
109  else if ( Mvc_Cube2Words( pC1 ) )
110  {
111  if ( pC1->pData[1] < pC2->pData[1] )
112  return -1;
113  if ( pC1->pData[1] > pC2->pData[1] )
114  return 1;
115  if ( pC1->pData[0] < pC2->pData[0] )
116  return -1;
117  if ( pC1->pData[0] > pC2->pData[0] )
118  return 1;
119  return 0;
120  }
121  else
122  {
123  int i = Mvc_CubeReadLast( pC1 );
124  for(; i >= 0; i--)
125  {
126  if ( pC1->pData[i] < pC2->pData[i] )
127  return -1;
128  if ( pC1->pData[i] > pC2->pData[i] )
129  return 1;
130  }
131  return 0;
132  }
133 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define Mvc_Cube2Words(Cube)
Definition: mvc.h:132
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
#define Mvc_Cube1Words(Cube)
Definition: mvc.h:131
#define Mvc_CubeReadSize(Cube)
Definition: mvc.h:124
Mvc_Cube_t* Mvc_CubeDup ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file mvcCube.c.

95 {
96  Mvc_Cube_t * pCubeCopy;
97  pCubeCopy = Mvc_CubeAlloc( pCover );
98  Mvc_CubeBitCopy( pCubeCopy, pCube );
99  return pCubeCopy;
100 }
ABC_NAMESPACE_IMPL_START Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitCopy(Cube1, Cube2)
Definition: mvc.h:393
void Mvc_CubeFree ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file mvcCube.c.

115 {
116  if ( pCube == NULL )
117  return;
118 
119  // verify the parameters charactering this cube
120  assert( pCube->iLast == 0 || ((int)pCube->iLast) == pCover->nWords - 1 );
121  assert( ((int)pCube->nUnused) == pCover->nUnused );
122 
123  // deallocate the cube
124 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
125  ABC_FREE( pCube );
126 #else
127  switch( pCover->nWords )
128  {
129  case 0:
130  case 1:
131  Extra_MmFixedEntryRecycle( pCover->pMem->pMan1, (char *)pCube );
132  break;
133  case 2:
134  Extra_MmFixedEntryRecycle( pCover->pMem->pMan2, (char *)pCube );
135  break;
136  case 3:
137  case 4:
138  Extra_MmFixedEntryRecycle( pCover->pMem->pMan4, (char *)pCube );
139  break;
140  default:
141  ABC_FREE( pCube );
142  break;
143  }
144 #endif
145 }
int nWords
Definition: mvc.h:85
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
int nUnused
Definition: mvc.h:86
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CubePrint ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file mvcPrint.c.

80 {
81  int iBit, Value;
82  // iterate through the literals
83 // printf( "Size = %2d ", Mvc_CubeReadSize(pCube) );
84  Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
85  printf( "%c", '0' + Value );
86  printf( "\n" );
87 }
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
Definition: mvc.h:553
void Mvc_CubePrintMv ( Mvc_Data_t pData,
Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)
void Mvc_ListAddCubeHead_ ( Mvc_List_t pList,
Mvc_Cube_t pCube 
)

DECLARATIONS ///.

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

FileName [mvcList.c]

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

Synopsis [Manipulating list of cubes in the cover.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcList.c,v 1.4 2003/04/03 06:31:50 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcList.c.

44 {
45  if ( pList->pHead == NULL )
46  {
47  Mvc_CubeSetNext( pCube, NULL );
48  pList->pHead = pCube;
49  pList->pTail = pCube;
50  }
51  else
52  {
53  Mvc_CubeSetNext( pCube, pList->pHead );
54  pList->pHead = pCube;
55  }
56  pList->nItems++;
57 }
int nItems
Definition: mvc.h:79
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126
void Mvc_ListAddCubeTail_ ( Mvc_List_t pList,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file mvcList.c.

72 {
73  if ( pList->pHead == NULL )
74  pList->pHead = pCube;
75  else
76  Mvc_CubeSetNext( pList->pTail, pCube );
77  pList->pTail = pCube;
78  Mvc_CubeSetNext( pCube, NULL );
79  pList->nItems++;
80 }
int nItems
Definition: mvc.h:79
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define Mvc_CubeSetNext(Cube, Next)
Definition: mvc.h:126
void Mvc_ListDeleteCube_ ( Mvc_List_t pList,
Mvc_Cube_t pPrev,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file mvcList.c.

95 {
96  if ( pPrev == NULL ) // deleting the head cube
97  pList->pHead = Mvc_CubeReadNext(pCube);
98  else
99  pPrev->pNext = pCube->pNext;
100  if ( pList->pTail == pCube ) // deleting the tail cube
101  {
102  assert( Mvc_CubeReadNext(pCube) == NULL );
103  pList->pTail = pPrev;
104  }
105  pList->nItems--;
106 }
#define Mvc_CubeReadNext(Cube)
MACRO DEFINITIONS ///.
Definition: mvc.h:121
int nItems
Definition: mvc.h:79
Mvc_Cube_t * pNext
Definition: mvc.h:65
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
#define assert(ex)
Definition: util_old.h:213
Mvc_Cube_t* Mvc_ListGetTailFromHead ( Mvc_Cube_t pHead)

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

Synopsis [Returns the tail of the linked list given by the head.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file mvcList.c.

352 {
353  Mvc_Cube_t * pCube, * pTail;
354  for ( pTail = pCube = pHead;
355  pCube;
356  pTail = pCube, pCube = Mvc_CubeReadNext(pCube) );
357  return pTail;
358 }
#define Mvc_CubeReadNext(Cube)
MACRO DEFINITIONS ///.
Definition: mvc.h:121
Mvc_Cube_t* Mvc_ListReadCubeHead ( Mvc_List_t pList)

Definition at line 63 of file mvcApi.c.

63 { return pList->pHead; }
Mvc_Cube_t * pHead
Definition: mvc.h:77
int Mvc_ListReadCubeNum ( Mvc_List_t pList)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 62 of file mvcApi.c.

62 { return pList->nItems; }
int nItems
Definition: mvc.h:79
Mvc_Cube_t* Mvc_ListReadCubeTail ( Mvc_List_t pList)

Definition at line 64 of file mvcApi.c.

64 { return pList->pTail; }
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Manager_t* Mvc_ManagerAllocCover ( )
Mvc_Manager_t* Mvc_ManagerAllocCube ( int  nWords)
void Mvc_ManagerFree ( Mvc_Manager_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file mvcMan.c.

68 {
73  ABC_FREE( p );
74 }
void Extra_MmFixedStop(Extra_MmFixed_t *p)
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
#define ABC_FREE(obj)
Definition: abc_global.h:232
Extra_MmFixed_t * pManC
Definition: mvc.h:110
Mvc_Manager_t* Mvc_ManagerFreeCover ( Mvc_Cover_t pCover)
Mvc_Manager_t* Mvc_ManagerFreeCube ( Mvc_Cover_t pCube,
int  nWords 
)
Mvc_Manager_t* Mvc_ManagerStart ( )

DECLARATIONS ///.

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

FileName [mvcMan.c]

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

Synopsis [Procedures working with the MVC memory manager.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcMan.c,v 1.3 2003/03/19 19:50:26 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file mvcMan.c.

45 {
46  Mvc_Manager_t * p;
47  p = ABC_ALLOC( Mvc_Manager_t, 1 );
48  memset( p, 0, sizeof(Mvc_Manager_t) );
49  p->pMan1 = Extra_MmFixedStart( sizeof(Mvc_Cube_t) );
50  p->pMan2 = Extra_MmFixedStart( sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) );
51  p->pMan4 = Extra_MmFixedStart( sizeof(Mvc_Cube_t) + 3 * sizeof(Mvc_CubeWord_t) );
52  p->pManC = Extra_MmFixedStart( sizeof(Mvc_Cover_t) );
53  return p;
54 }
char * memset()
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
Extra_MmFixed_t * pManC
Definition: mvc.h:110
int Mvc_UtilsCheckUnusedZeros ( Mvc_Cover_t pCover)

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

Synopsis [Checks that the cubes of the cover have 0's in unused bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 842 of file mvcUtils.c.

843 {
844  unsigned Unsigned;
845  Mvc_Cube_t * pCube;
846  int nCubes;
847 
848  nCubes = 0;
849  Mvc_CoverForEachCube( pCover, pCube )
850  {
851  if ( pCube->nUnused == 0 )
852  continue;
853 
854  Unsigned = ( pCube->pData[pCube->iLast] &
855  (BITS_FULL << (32-pCube->nUnused)) );
856  if( Unsigned )
857  {
858  printf( "Cube %2d out of %2d contains dirty bits.\n", nCubes,
859  Mvc_CoverReadCubeNum(pCover) );
860  }
861  nCubes++;
862  }
863  return 1;
864 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define BITS_FULL
Definition: mvc.h:45
int Mvr_CoverCountLitsWithValue ( Mvc_Data_t pData,
Mvc_Cover_t pCover,
int  iVar,
int  iValue 
)