00001
00021 #include "bdcInt.h"
00022
00026
00030
00042 void Bdc_SuppMinimize( Bdc_Man_t * p, Bdc_Isf_t * pIsf )
00043 {
00044 int v;
00045
00046 for ( v = 0; v < p->nVars; v++ )
00047 {
00048 if ( (pIsf->uSupp & (1 << v)) == 0 )
00049 continue;
00050 Kit_TruthExistNew( p->puTemp1, pIsf->puOn, p->nVars, v );
00051 Kit_TruthExistNew( p->puTemp2, pIsf->puOff, p->nVars, v );
00052 if ( !Kit_TruthIsDisjoint( p->puTemp1, p->puTemp2, p->nVars ) )
00053 continue;
00054
00055 Kit_TruthCopy( pIsf->puOn, p->puTemp1, p->nVars );
00056 Kit_TruthCopy( pIsf->puOff, p->puTemp2, p->nVars );
00057 pIsf->uSupp &= ~(1 << v);
00058 }
00059 }
00060
00072 int Bdc_TableCheckContainment( Bdc_Man_t * p, Bdc_Isf_t * pIsf, unsigned * puTruth )
00073 {
00074 return Kit_TruthIsImply( pIsf->puOn, puTruth, p->nVars ) &&
00075 Kit_TruthIsDisjoint( pIsf->puOff, puTruth, p->nVars );
00076 }
00077
00089 Bdc_Fun_t * Bdc_TableLookup( Bdc_Man_t * p, Bdc_Isf_t * pIsf )
00090 {
00091 Bdc_Fun_t * pFunc;
00092 for ( pFunc = p->pTable[pIsf->uSupp]; pFunc; pFunc = pFunc->pNext )
00093 if ( Bdc_TableCheckContainment( p, pIsf, pFunc->puFunc ) )
00094 return pFunc;
00095 return NULL;
00096 }
00097
00109 void Bdc_TableAdd( Bdc_Man_t * p, Bdc_Fun_t * pFunc )
00110 {
00111 if ( p->pTable[pFunc->uSupp] == NULL )
00112 Vec_IntPush( p->vSpots, pFunc->uSupp );
00113 pFunc->pNext = p->pTable[pFunc->uSupp];
00114 p->pTable[pFunc->uSupp] = pFunc;
00115 }
00116
00128 void Bdc_TableClear( Bdc_Man_t * p )
00129 {
00130 int Spot, i;
00131 Vec_IntForEachEntry( p->vSpots, Spot, i )
00132 p->pTable[Spot] = NULL;
00133 Vec_IntClear( p->vSpots );
00134 }
00135
00139
00140