abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mvcList.c File Reference
#include "mvc.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START 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)
 

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 }
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
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 }
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
ABC_NAMESPACE_IMPL_START 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