src/misc/mvc/mvcList.c File Reference

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

Go to the source code of this file.

Functions

void Mvc_ListAddCubeHead_ (Mvc_List_t *pList, Mvc_Cube_t *pCube)
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)

Function Documentation

void Mvc_CoverAddCubeHead_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 118 of file mvcList.c.

00119 {
00120     Mvc_List_t * pList = &pCover->lCubes;
00121     if ( pList->pHead == NULL )
00122     {
00123         Mvc_CubeSetNext( pCube, NULL );
00124         pList->pHead = pCube;
00125         pList->pTail = pCube;
00126     }
00127     else
00128     {
00129         Mvc_CubeSetNext( pCube, pList->pHead );
00130         pList->pHead = pCube;
00131     }
00132     pList->nItems++;
00133 }

void Mvc_CoverAddCubeTail_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file mvcList.c.

00147 {
00148     Mvc_List_t * pList = &pCover->lCubes;
00149 
00150     if ( pList->pHead == NULL )
00151         pList->pHead = pCube;
00152     else
00153         Mvc_CubeSetNext( pList->pTail, pCube );
00154     pList->pTail    = pCube;
00155     Mvc_CubeSetNext( pCube, NULL );
00156     pList->nItems++;
00157 }

void Mvc_CoverAddDupCubeHead ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file mvcList.c.

00200 {
00201     Mvc_Cube_t * pCubeNew;
00202     pCubeNew = Mvc_CubeAlloc( pCover );
00203     Mvc_CubeBitCopy( pCubeNew, pCube );
00204     Mvc_CoverAddCubeHead( pCover, pCubeNew );
00205 }

void Mvc_CoverAddDupCubeTail ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file mvcList.c.

00219 {
00220     Mvc_Cube_t * pCubeNew;
00221     // copy the cube as part of this cover
00222     pCubeNew = Mvc_CubeAlloc( pCover );
00223     Mvc_CubeBitCopy( pCubeNew, pCube );
00224     // clean the last bits of the new cube
00225 //    pCubeNew->pData[pCubeNew->iLast] &= (BITS_FULL >> pCubeNew->nUnused);
00226     // add the cube at the end
00227     Mvc_CoverAddCubeTail( pCover, pCubeNew );
00228 }

void Mvc_CoverAddLiteralsOfCube ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 242 of file mvcList.c.

00243 {
00244 //    int iBit, Value;
00245 //    assert( pCover->pLits );
00246 //    Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
00247 //        if ( Value )
00248 //            pCover->pLits[iBit] += Value;
00249 }

void Mvc_CoverArray2List ( Mvc_Cover_t pCover  ) 

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file mvcList.c.

00308 {
00309     Mvc_Cube_t * pCube;
00310     int nCubes, i;
00311 
00312     assert( pCover->pCubes );
00313 
00314     nCubes = Mvc_CoverReadCubeNum(pCover);
00315     if ( nCubes == 0 )
00316         return;
00317     if ( nCubes == 1 )
00318     {
00319         pCube    = pCover->pCubes[0];
00320         pCube->pNext = NULL;
00321         pCover->lCubes.pHead = pCover->lCubes.pTail = pCube;
00322         return;
00323     }
00324     // set up the first cube
00325     pCube = pCover->pCubes[0];
00326     pCover->lCubes.pHead = pCube;
00327     // set up the last cube
00328     pCube = pCover->pCubes[nCubes-1];
00329     pCube->pNext = NULL;
00330     pCover->lCubes.pTail = pCube;
00331 
00332     // link all cubes starting from the first one
00333     for ( i = 0; i < nCubes - 1; i++ )
00334         pCover->pCubes[i]->pNext = pCover->pCubes[i+1];
00335 }

void Mvc_CoverDeleteCube_ ( Mvc_Cover_t pCover,
Mvc_Cube_t pPrev,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file mvcList.c.

00171 {
00172     Mvc_List_t * pList = &pCover->lCubes;
00173  
00174     if ( pPrev == NULL ) // deleting the head cube
00175         pList->pHead = Mvc_CubeReadNext(pCube);
00176     else
00177         pPrev->pNext = pCube->pNext;
00178     if ( pList->pTail == pCube ) // deleting the tail cube
00179     {
00180         assert( Mvc_CubeReadNext(pCube) == NULL );
00181         pList->pTail = pPrev;
00182     }
00183     pList->nItems--;
00184 }

void Mvc_CoverDeleteLiteralsOfCube ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file mvcList.c.

00263 {
00264 //    int iBit, Value;
00265 //    assert( pCover->pLits );
00266 //    Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
00267 //        if ( Value )
00268 //            pCover->pLits[iBit] -= Value;
00269 }

void Mvc_CoverList2Array ( Mvc_Cover_t pCover  ) 

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 283 of file mvcList.c.

00284 {
00285     Mvc_Cube_t * pCube;
00286     int Counter;
00287     // resize storage if necessary
00288     Mvc_CoverAllocateArrayCubes( pCover );
00289     // iterate through the cubes
00290     Counter = 0;
00291     Mvc_CoverForEachCube( pCover, pCube )
00292         pCover->pCubes[ Counter++ ] = pCube;
00293     assert( Counter == Mvc_CoverReadCubeNum(pCover) );
00294 }

void Mvc_ListAddCubeHead_ ( Mvc_List_t pList,
Mvc_Cube_t pCube 
)

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 40 of file mvcList.c.

00041 {
00042     if ( pList->pHead == NULL )
00043     {
00044         Mvc_CubeSetNext( pCube, NULL );
00045         pList->pHead = pCube;
00046         pList->pTail = pCube;
00047     }
00048     else
00049     {
00050         Mvc_CubeSetNext( pCube, pList->pHead );
00051         pList->pHead = pCube;
00052     }
00053     pList->nItems++;
00054 }

void Mvc_ListAddCubeTail_ ( Mvc_List_t pList,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file mvcList.c.

00069 {
00070     if ( pList->pHead == NULL )
00071         pList->pHead = pCube;
00072     else
00073         Mvc_CubeSetNext( pList->pTail, pCube );
00074     pList->pTail    = pCube;
00075     Mvc_CubeSetNext( pCube, NULL );
00076     pList->nItems++;
00077 }

void Mvc_ListDeleteCube_ ( Mvc_List_t pList,
Mvc_Cube_t pPrev,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file mvcList.c.

00092 {
00093     if ( pPrev == NULL ) // deleting the head cube
00094         pList->pHead = Mvc_CubeReadNext(pCube);
00095     else
00096         pPrev->pNext = pCube->pNext;
00097     if ( pList->pTail == pCube ) // deleting the tail cube
00098     {
00099         assert( Mvc_CubeReadNext(pCube) == NULL );
00100         pList->pTail = pPrev;
00101     }
00102     pList->nItems--;
00103 }

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 348 of file mvcList.c.

00349 {
00350     Mvc_Cube_t * pCube, * pTail;
00351     for ( pTail = pCube = pHead; 
00352           pCube; 
00353           pTail = pCube, pCube = Mvc_CubeReadNext(pCube) );
00354     return pTail;
00355 }


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