Go to the source code of this file.
◆ Tru_One_t
◆ Tru_ManAlloc()
FUNCTION DECLARATIONS ///.
Function*************************************************************
Synopsis [Start the truth table logging.]
Description []
SideEffects []
SeeAlso []
Definition at line 198 of file satTruth.c.
199{
201 {
208 };
210 int i, w;
211 assert( nVars > 0 && nVars <= 16 );
214 p->nWords = (nVars < 6) ? 1 : (1 << (nVars-6));
215 p->nEntrySize = (
sizeof(
Tru_One_t) +
p->nWords *
sizeof(
word))/
sizeof(int);
216 p->nTableSize = 8147;
218 p->pMem = Vec_SetAlloc( 16 );
219
221 for ( i = 0; i < nVars; i++ )
222 {
223 for ( w = 0; w <
p->nWords; w++ )
224 if ( i < 6 )
225 p->pZero[w] = Masks[i];
226 else if ( w & (1 << (i-6)) )
227 p->pZero[w] = ~(
word)0;
228 else
231 assert( !i ||
p->hIthVars[i] >
p->hIthVars[i-1] );
232 }
233 Tru_ManClear(
p->pZero,
p->nWords );
235}
#define ABC_ALLOC(type, num)
#define ABC_CALLOC(type, num)
#define ABC_CONST(number)
PARAMETERS ///.
unsigned __int64 word
DECLARATIONS ///.
int Tru_ManInsert(Tru_Man_t *p, word *pTruth)
struct Tru_One_t_ Tru_One_t
typedefABC_NAMESPACE_HEADER_START struct Tru_Man_t_ Tru_Man_t
INCLUDES ///.
◆ Tru_ManFree()
Function*************************************************************
Synopsis [Stop the truth table logging.]
Description []
SideEffects []
SeeAlso []
Definition at line 248 of file satTruth.c.
249{
250 printf(
"Lookups = %d. Entries = %d.\n",
p->nTableLookups, Vec_SetEntryNum(
p->pMem) );
251 Vec_SetFree(
p->pMem );
255}
◆ Tru_ManFunc()
Function*************************************************************
Synopsis [Returns stored truth table]
Description []
SideEffects []
SeeAlso []
Definition at line 285 of file satTruth.c.
286{
288 if ( h == 0 )
290 return Tru_ManReadOne(
p, h )->pTruth;
291}
◆ Tru_ManInsert()
Function*************************************************************
Synopsis [Adds entry to the hash table.]
Description []
SideEffects []
SeeAlso []
Definition at line 158 of file satTruth.c.
159{
160 int fCompl, * pSpot;
161 if ( Tru_ManEqual0(pTruth,
p->nWords) )
162 return 0;
163 if ( Tru_ManEqual1(pTruth,
p->nWords) )
164 return 1;
166 if ( Vec_SetEntryNum(
p->pMem) > 2 *
p->nTableSize )
168 fCompl = pTruth[0] & 1;
169 if ( fCompl )
170 Tru_ManNot( pTruth,
p->nWords );
172 if ( *pSpot == 0 )
173 {
175 *pSpot = Vec_SetAppend(
p->pMem, NULL,
p->nEntrySize );
176 assert( (*pSpot & 1) == 0 );
177 pEntry = Tru_ManReadOne(
p, *pSpot );
178 Tru_ManCopy( pEntry->
pTruth, pTruth,
p->nWords );
181 }
182 if ( fCompl )
183 Tru_ManNot( pTruth,
p->nWords );
184 return *pSpot ^ fCompl;
185}
int * Tru_ManLookup(Tru_Man_t *p, word *pTruth)
void Tru_ManResize(Tru_Man_t *p)
◆ Tru_ManLookup()
Function*************************************************************
Synopsis [Returns the given record.]
Description []
SideEffects []
SeeAlso []
Definition at line 93 of file satTruth.c.
94{
95 static int s_Primes[10] = { 1291, 1699, 2357, 4177, 5147, 5647, 6343, 7103, 7873, 8147 };
97 int * pSpot;
98 assert( (pTruth[0] & 1) == 0 );
99 pSpot =
p->pTable + Tru_ManHash( pTruth,
p->nWords,
p->nTableSize, s_Primes );
100 for ( pEntry = Tru_ManReadOne(
p, *pSpot); pEntry; pSpot = &pEntry->
Next, pEntry = Tru_ManReadOne(
p, *pSpot) )
101 if ( Tru_ManEqual(pEntry->
pTruth, pTruth,
p->nWords) )
102 return pSpot;
103 return pSpot;
104}
◆ Tru_ManResize()
Function*************************************************************
Synopsis [Returns the given record.]
Description []
SideEffects []
SeeAlso []
Definition at line 117 of file satTruth.c.
118{
120 int * pTableOld, * pSpot;
121 int nTableSizeOld, iNext, Counter, i;
123
124 pTableOld =
p->pTable;
125 nTableSizeOld =
p->nTableSize;
126 p->nTableSize = 2 *
p->nTableSize + 1;
128
129 Counter = 0;
130 for ( i = 0; i < nTableSizeOld; i++ )
131 for ( pThis = Tru_ManReadOne(
p, pTableOld[i]),
132 iNext = (pThis? pThis->
Next : 0);
133 pThis; pThis = Tru_ManReadOne(
p, iNext),
134 iNext = (pThis? pThis->
Next : 0) )
135 {
141 Counter++;
142 }
143 assert( Counter == Vec_SetEntryNum(
p->pMem) );
145}
◆ Tru_ManVar()
Function*************************************************************
Synopsis [Returns elementary variable.]
Description []
SideEffects []
SeeAlso []
Definition at line 268 of file satTruth.c.
269{
270 assert( v >= 0 && v < p->nVars );
271 return Tru_ManReadOne(
p,
p->hIthVars[v] )->pTruth;
272}