ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
satTruth.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/util/abc_global.h"
Include dependency graph for satTruth.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Tru_Man_t_ Tru_Man_t
 INCLUDES ///.
 

Functions

Tru_Man_tTru_ManAlloc (int nVars)
 FUNCTION DECLARATIONS ///.
 
void Tru_ManFree (Tru_Man_t *p)
 
wordTru_ManVar (Tru_Man_t *p, int v)
 
wordTru_ManFunc (Tru_Man_t *p, int h)
 
int Tru_ManInsert (Tru_Man_t *p, word *pTruth)
 

Typedef Documentation

◆ Tru_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Tru_Man_t_ Tru_Man_t

INCLUDES ///.

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

FileName [satTruth.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT solver.]

Synopsis [Truth table computation package.]

Author [Alan Mishchenko alanm.nosp@m.i@ee.nosp@m.cs.be.nosp@m.rkel.nosp@m.ey.ed.nosp@m.u]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 1, 2004.]

Revision [

Id
satTruth.h,v 1.0 2004/01/01 1:00:00 alanmi Exp

] PARAMETERS /// STRUCTURE DEFINITIONS ///

Definition at line 44 of file satTruth.h.

Function Documentation

◆ Tru_ManAlloc()

Tru_Man_t * Tru_ManAlloc ( int nVars)
extern

FUNCTION DECLARATIONS ///.

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

Synopsis [Start the truth table logging.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file satTruth.c.

199{
200 word Masks[6] =
201 {
202 ABC_CONST(0xAAAAAAAAAAAAAAAA),
203 ABC_CONST(0xCCCCCCCCCCCCCCCC),
204 ABC_CONST(0xF0F0F0F0F0F0F0F0),
205 ABC_CONST(0xFF00FF00FF00FF00),
206 ABC_CONST(0xFFFF0000FFFF0000),
207 ABC_CONST(0xFFFFFFFF00000000)
208 };
209 Tru_Man_t * p;
210 int i, w;
211 assert( nVars > 0 && nVars <= 16 );
212 p = ABC_CALLOC( Tru_Man_t, 1 );
213 p->nVars = nVars;
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;
217 p->pTable = ABC_CALLOC( int, p->nTableSize );
218 p->pMem = Vec_SetAlloc( 16 );
219 // initialize truth tables
220 p->pZero = ABC_ALLOC( word, p->nWords );
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
229 p->pZero[w] = 0;
230 p->hIthVars[i] = Tru_ManInsert( p, p->pZero );
231 assert( !i || p->hIthVars[i] > p->hIthVars[i-1] );
232 }
233 Tru_ManClear( p->pZero, p->nWords );
234 return p;
235}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
Cube * p
Definition exorList.c:222
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
int Tru_ManInsert(Tru_Man_t *p, word *pTruth)
Definition satTruth.c:158
struct Tru_One_t_ Tru_One_t
Definition satTruth.c:48
typedefABC_NAMESPACE_HEADER_START struct Tru_Man_t_ Tru_Man_t
INCLUDES ///.
Definition satTruth.h:44
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Tru_ManFree()

void Tru_ManFree ( Tru_Man_t * p)
extern

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 );
252 ABC_FREE( p->pZero );
253 ABC_FREE( p->pTable );
254 ABC_FREE( p );
255}
#define ABC_FREE(obj)
Definition abc_global.h:267

◆ Tru_ManFunc()

word * Tru_ManFunc ( Tru_Man_t * p,
int h )
extern

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

Synopsis [Returns stored truth table]

Description []

SideEffects []

SeeAlso []

Definition at line 285 of file satTruth.c.

286{
287 assert( (h & 1) == 0 );
288 if ( h == 0 )
289 return p->pZero;
290 return Tru_ManReadOne( p, h )->pTruth;
291}

◆ Tru_ManInsert()

int Tru_ManInsert ( Tru_Man_t * p,
word * pTruth )
extern

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;
165 p->nTableLookups++;
166 if ( Vec_SetEntryNum(p->pMem) > 2 * p->nTableSize )
167 Tru_ManResize( p );
168 fCompl = pTruth[0] & 1;
169 if ( fCompl )
170 Tru_ManNot( pTruth, p->nWords );
171 pSpot = Tru_ManLookup( p, pTruth );
172 if ( *pSpot == 0 )
173 {
174 Tru_One_t * pEntry;
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 );
179 pEntry->Handle = *pSpot;
180 pEntry->Next = 0;
181 }
182 if ( fCompl )
183 Tru_ManNot( pTruth, p->nWords );
184 return *pSpot ^ fCompl;
185}
int * Tru_ManLookup(Tru_Man_t *p, word *pTruth)
Definition satTruth.c:93
void Tru_ManResize(Tru_Man_t *p)
Definition satTruth.c:117
word pTruth[0]
Definition satTruth.c:53
int Handle
Definition satTruth.c:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tru_ManVar()

word * Tru_ManVar ( Tru_Man_t * p,
int v )
extern

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}