ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcNpn.c File Reference
#include "misc/extra/extra.h"
#include "misc/vec/vec.h"
#include "bool/kit/kit.h"
#include "bool/lucky/lucky.h"
#include "opt/dau/dau.h"
Include dependency graph for abcNpn.c:

Go to the source code of this file.

Classes

struct  Abc_TtStore_t_
 

Functions

Abc_TtStore_tAbc_TtStoreLoad (char *pFileName, int nVarNum)
 
void Abc_TtStoreFree (Abc_TtStore_t *p, int nVarNum)
 
void Abc_TtStoreWrite (char *pFileName, Abc_TtStore_t *p, int fBinary)
 
int Abc_TruthNpnCountUnique (Abc_TtStore_t *p)
 
int Abc_TruthCompare (word **p1, word **p2)
 
int Abc_TruthNpnCountUniqueSort (Abc_TtStore_t *p)
 
void Abc_TruthNpnPrint (char *pCanonPermInit, unsigned uCanonPhase, int nVars)
 
void Abc_TruthNpnPerform (Abc_TtStore_t *p, int NpnType, int fVerbose)
 
void Abc_TruthNpnTest (char *pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose)
 
int Abc_NpnTest (char *pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose)
 

Variables

int nWords = 0
 

Function Documentation

◆ Abc_NpnTest()

int Abc_NpnTest ( char * pFileName,
int NpnType,
int nVarNum,
int fDumpRes,
int fBinary,
int fVerbose )

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

Synopsis [Testbench for decomposition algorithms.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file abcNpn.c.

432{
433 if ( fVerbose )
434 printf( "Using truth tables from file \"%s\"...\n", pFileName );
435 if ( NpnType >= 0 && NpnType <= 12 )
436 Abc_TruthNpnTest( pFileName, NpnType, nVarNum, fDumpRes, fBinary, fVerbose );
437 else
438 printf( "Unknown canonical form value (%d).\n", NpnType );
439 fflush( stdout );
440 return 0;
441}
void Abc_TruthNpnTest(char *pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose)
Definition abcNpn.c:389
Here is the call graph for this function:

◆ Abc_TruthCompare()

int Abc_TruthCompare ( word ** p1,
word ** p2 )

Definition at line 128 of file abcNpn.c.

128{ return memcmp(*p1, *p2, sizeof(word) * nWords); }
int nWords
Definition abcNpn.c:127
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
int memcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_TruthNpnCountUnique()

int Abc_TruthNpnCountUnique ( Abc_TtStore_t * p)

Definition at line 90 of file abcNpn.c.

91{
92 // allocate hash table
93 int nTableSize = Abc_PrimeCudd(p->nFuncs);
94 int * pTable = ABC_FALLOC( int, nTableSize );
95 int * pNexts = ABC_FALLOC( int, nTableSize );
96 // hash functions
97 int i, k, Key;
98 for ( i = 0; i < p->nFuncs; i++ )
99 {
100 Key = Abc_TruthHashKey( p->pFuncs[i], p->nWords, nTableSize );
101 if ( Abc_TruthHashLookup( p->pFuncs, i, p->nWords, pTable, pNexts, Key ) ) // found equal
102 p->pFuncs[i] = NULL;
103 else // there is no equal (the first time this one occurs so far)
104 pNexts[i] = pTable[Key], pTable[Key] = i;
105 }
106 ABC_FREE( pTable );
107 ABC_FREE( pNexts );
108 // count the number of unqiue functions
109 assert( p->pFuncs[0] != NULL );
110 for ( i = k = 1; i < p->nFuncs; i++ )
111 if ( p->pFuncs[i] != NULL )
112 p->pFuncs[k++] = p->pFuncs[i];
113 return (p->nFuncs = k);
114}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Abc_TruthNpnCountUniqueSort()

int Abc_TruthNpnCountUniqueSort ( Abc_TtStore_t * p)

Definition at line 129 of file abcNpn.c.

130{
131 int i, k;
132 // sort them by value
133 nWords = p->nWords;
134 assert( nWords > 0 );
135 qsort( (void *)p->pFuncs, (size_t)p->nFuncs, sizeof(word *), (int(*)(const void *,const void *))Abc_TruthCompare );
136 // count the number of unqiue functions
137 for ( i = k = 1; i < p->nFuncs; i++ )
138 if ( memcmp( p->pFuncs[i-1], p->pFuncs[i], sizeof(word) * nWords ) )
139 p->pFuncs[k++] = p->pFuncs[i];
140 return (p->nFuncs = k);
141}
int Abc_TruthCompare(word **p1, word **p2)
Definition abcNpn.c:128
Here is the call graph for this function:

◆ Abc_TruthNpnPerform()

void Abc_TruthNpnPerform ( Abc_TtStore_t * p,
int NpnType,
int fVerbose )

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

Synopsis [Apply decomposition to the truth table.]

Description [Returns the number of AIG nodes.]

SideEffects []

SeeAlso []

Definition at line 177 of file abcNpn.c.

178{
179 unsigned pAux[2048];
180 word pAuxWord[1024], pAuxWord1[1024];
181 char pCanonPerm[16];
182 unsigned uCanonPhase=0;
183 abctime clk = Abc_Clock();
184 int i;
185
186 char * pAlgoName = NULL;
187 if ( NpnType == 0 )
188 pAlgoName = "uniqifying ";
189 else if ( NpnType == 1 )
190 pAlgoName = "exact NPN ";
191 else if ( NpnType == 2 )
192 pAlgoName = "counting 1s ";
193 else if ( NpnType == 3 )
194 pAlgoName = "Jake's hybrid fast ";
195 else if ( NpnType == 4 )
196 pAlgoName = "Jake's hybrid good ";
197 else if ( NpnType == 5 )
198 pAlgoName = "new hybrid fast ";
199 else if ( NpnType == 6 )
200 pAlgoName = "new phase flipping ";
201 else if ( NpnType == 7 )
202 pAlgoName = "new hier. matching ";
203 else if ( NpnType == 8 )
204 pAlgoName = "new adap. matching ";
205 else if ( NpnType == 9 )
206 pAlgoName = "adjustable algorithm (heuristic) ";
207 else if ( NpnType == 10 )
208 pAlgoName = "adjustable algorithm (exact) ";
209 else if ( NpnType == 11 )
210 pAlgoName = "new cost-aware exact algorithm ";
211 else if ( NpnType == 12 )
212 pAlgoName = "new hybrid fast (P) ";
213
214 assert( p->nVars <= 16 );
215 if ( pAlgoName )
216 printf( "Applying %-20s to %8d func%s of %2d vars... ",
217 pAlgoName, p->nFuncs, (p->nFuncs == 1 ? "":"s"), p->nVars );
218 if ( fVerbose )
219 printf( "\n" );
220
221 if ( NpnType == 0 )
222 {
223 for ( i = 0; i < p->nFuncs; i++ )
224 {
225 if ( fVerbose )
226 printf( "%7d : ", i );
227 if ( fVerbose )
228 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), printf( "\n" );
229 }
230 }
231 else if ( NpnType == 1 )
232 {
233 permInfo* pi;
235 pi = setPermInfoPtr(p->nVars);
236 for ( i = 0; i < p->nFuncs; i++ )
237 {
238 if ( fVerbose )
239 printf( "%7d : ", i );
240 simpleMinimal(p->pFuncs[i], pAuxWord, pAuxWord1, pi, p->nVars);
241 if ( fVerbose )
242 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
243 }
244 freePermInfoPtr(pi);
245 }
246 else if ( NpnType == 2 )
247 {
248 for ( i = 0; i < p->nFuncs; i++ )
249 {
250 if ( fVerbose )
251 printf( "%7d : ", i );
252 resetPCanonPermArray(pCanonPerm, p->nVars);
253 uCanonPhase = Kit_TruthSemiCanonicize( (unsigned *)p->pFuncs[i], pAux, p->nVars, pCanonPerm );
254 if ( fVerbose )
255 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
256 }
257 }
258 else if ( NpnType == 3 )
259 {
260 for ( i = 0; i < p->nFuncs; i++ )
261 {
262 if ( fVerbose )
263 printf( "%7d : ", i );
264 resetPCanonPermArray(pCanonPerm, p->nVars);
265 uCanonPhase = luckyCanonicizer_final_fast( p->pFuncs[i], p->nVars, pCanonPerm );
266 if ( fVerbose )
267 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
268 }
269 }
270 else if ( NpnType == 4 )
271 {
272 for ( i = 0; i < p->nFuncs; i++ )
273 {
274 if ( fVerbose )
275 printf( "%7d : ", i );
276 resetPCanonPermArray(pCanonPerm, p->nVars);
277 uCanonPhase = luckyCanonicizer_final_fast1( p->pFuncs[i], p->nVars, pCanonPerm );
278 if ( fVerbose )
279 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
280 }
281 }
282 else if ( NpnType == 5 )
283 {
284 for ( i = 0; i < p->nFuncs; i++ )
285 {
286 if ( fVerbose )
287 printf( "%7d : ", i );
288 uCanonPhase = Abc_TtCanonicize( p->pFuncs[i], p->nVars, pCanonPerm );
289 if ( fVerbose )
290 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
291 }
292 }
293 else if ( NpnType == 6 )
294 {
295 for ( i = 0; i < p->nFuncs; i++ )
296 {
297 if ( fVerbose )
298 printf( "%7d : ", i );
299 uCanonPhase = Abc_TtCanonicizePhase( p->pFuncs[i], p->nVars );
300 if ( fVerbose )
301 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(NULL, uCanonPhase, p->nVars), printf( "\n" );
302 }
303 }
304 else if ( NpnType == 7 )
305 {
306 int fExact = 0;
307 Abc_TtHieMan_t * pMan = Abc_TtHieManStart( p->nVars, 5 );
308 for ( i = 0; i < p->nFuncs; i++ )
309 {
310 if ( fVerbose )
311 printf( "%7d : ", i );
312 uCanonPhase = Abc_TtCanonicizeHie( pMan, p->pFuncs[i], p->nVars, pCanonPerm, fExact );
313 if ( fVerbose )
314// Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(NULL, uCanonPhase, p->nVars), printf( "\n" );
315 printf( "\n" );
316 }
317 // nClasses = Abc_TtManNumClasses( pMan );
318 Abc_TtHieManStop( pMan );
319 }
320 else if ( NpnType == 8 )
321 {
322// typedef unsigned(*TtCanonicizeFunc)(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
323 unsigned Abc_TtCanonicizeWrap(TtCanonicizeFunc func, Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
324 unsigned Abc_TtCanonicizeAda(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres);
325
326 int fHigh = 1, iEnumThres = 25;
327 Abc_TtHieMan_t * pMan = Abc_TtHieManStart(p->nVars, 5);
328 for ( i = 0; i < p->nFuncs; i++ )
329 {
330 if ( fVerbose )
331 printf( "%7d : ", i );
332 uCanonPhase = Abc_TtCanonicizeWrap(Abc_TtCanonicizeAda, pMan, p->pFuncs[i], p->nVars, pCanonPerm, fHigh*100 + iEnumThres);
333 if ( fVerbose )
334 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
335 }
336 Abc_TtHieManStop(pMan);
337 }
338 else if ( NpnType == 9 || NpnType == 10 || NpnType == 11 )
339 {
340// typedef unsigned(*TtCanonicizeFunc)(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
341 unsigned Abc_TtCanonicizeWrap(TtCanonicizeFunc func, Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
342 unsigned Abc_TtCanonicizeAda(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres);
343 unsigned Abc_TtCanonicizeCA(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres);
344
345 Abc_TtHieMan_t * pMan = Abc_TtHieManStart(p->nVars, 5);
346 for ( i = 0; i < p->nFuncs; i++ )
347 {
348 if ( fVerbose )
349 printf( "%7d : ", i );
350 if ( NpnType == 9 )
351 uCanonPhase = Abc_TtCanonicizeWrap(Abc_TtCanonicizeAda, pMan, p->pFuncs[i], p->nVars, pCanonPerm, 125); // -A 8, adjustable algorithm (heuristic)
352 else if ( NpnType == 10 )
353 uCanonPhase = Abc_TtCanonicizeWrap(Abc_TtCanonicizeAda, pMan, p->pFuncs[i], p->nVars, pCanonPerm, 1199); // -A 9, adjustable algorithm (exact)
354 else if ( NpnType == 11 )
355 uCanonPhase = Abc_TtCanonicizeWrap(Abc_TtCanonicizeCA, pMan, p->pFuncs[i], p->nVars, pCanonPerm, 1); // -A 10, new cost-aware exact algorithm
356 if ( fVerbose )
357 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
358 }
359 Abc_TtHieManStop(pMan);
360 }
361 else if ( NpnType == 12 )
362 {
363 for ( i = 0; i < p->nFuncs; i++ )
364 {
365 if ( fVerbose )
366 printf( "%7d : ", i );
367 uCanonPhase = Abc_TtCanonicizePerm( p->pFuncs[i], p->nVars, pCanonPerm );
368 if ( fVerbose )
369 Extra_PrintHex( stdout, (unsigned *)p->pFuncs[i], p->nVars ), Abc_TruthNpnPrint(pCanonPerm, uCanonPhase, p->nVars), printf( "\n" );
370 }
371 }
372 else assert( 0 );
373 clk = Abc_Clock() - clk;
374 printf( "Classes =%9d ", Abc_TruthNpnCountUnique(p) );
375 Abc_PrintTime( 1, "Time", clk );
376}
int Abc_TruthNpnCountUnique(Abc_TtStore_t *p)
Definition abcNpn.c:90
void Abc_TruthNpnPrint(char *pCanonPermInit, unsigned uCanonPhase, int nVars)
Definition abcNpn.c:154
ABC_INT64_T abctime
Definition abc_global.h:332
void freePermInfoPtr(permInfo *x)
void simpleMinimal(word *x, word *pAux, word *minimal, permInfo *pi, int nVars)
void resetPCanonPermArray(char *x, int nVars)
Definition luckyFast6.c:30
unsigned luckyCanonicizer_final_fast1(word *pInOut, int nVars, char *pCanonPerm)
permInfo * setPermInfoPtr(int var)
unsigned luckyCanonicizer_final_fast(word *pInOut, int nVars, char *pCanonPerm)
unsigned Abc_TtCanonicizeCA(Abc_TtHieMan_t *p, word *pTruth, int nVars, char *pCanonPerm, int fCA)
Definition dauCanon.c:2637
struct Abc_TtHieMan_t_ Abc_TtHieMan_t
Definition dau.h:62
unsigned Abc_TtCanonicizePhase(word *pTruth, int nVars)
Definition dauCanon.c:1187
unsigned(* TtCanonicizeFunc)(Abc_TtHieMan_t *p, word *pTruth, int nVars, char *pCanonPerm, int flag)
Definition dau.h:63
unsigned Abc_TtCanonicizePerm(word *pTruth, int nVars, char *pCanonPerm)
Definition dauCanon.c:1085
unsigned Abc_TtCanonicizeAda(Abc_TtHieMan_t *p, word *pTruth, int nVars, char *pCanonPerm, int iThres)
Definition dauCanon.c:2573
unsigned Abc_TtCanonicizeHie(Abc_TtHieMan_t *p, word *pTruth, int nVars, char *pCanonPerm, int fExact)
Definition dauCanon.c:1318
Abc_TtHieMan_t * Abc_TtHieManStart(int nVars, int nLevels)
Definition dauCanon.c:1255
void Abc_TtHieManStop(Abc_TtHieMan_t *p)
Definition dauCanon.c:1273
unsigned Abc_TtCanonicizeWrap(TtCanonicizeFunc func, Abc_TtHieMan_t *p, word *pTruth, int nVars, char *pCanonPerm, int flag)
Definition dauCanon.c:1530
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition dauCanon.c:1036
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
unsigned Kit_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm)
Definition kitTruth.c:1657
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_TruthNpnPrint()

void Abc_TruthNpnPrint ( char * pCanonPermInit,
unsigned uCanonPhase,
int nVars )

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

Synopsis [Prints out one NPN transform.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file abcNpn.c.

155{
156 char pCanonPerm[16]; int i;
157 assert( nVars <= 16 );
158 for ( i = 0; i < nVars; i++ )
159 pCanonPerm[i] = pCanonPermInit ? pCanonPermInit[i] : 'a' + i;
160 printf( " %c = ( ", Abc_InfoHasBit(&uCanonPhase, nVars) ? 'Z':'z' );
161 for ( i = 0; i < nVars; i++ )
162 printf( "%c%s", pCanonPerm[i] + ('A'-'a') * Abc_InfoHasBit(&uCanonPhase, pCanonPerm[i]-'a'), i == nVars-1 ? "":"," );
163 printf( " ) " );
164}
Here is the caller graph for this function:

◆ Abc_TruthNpnTest()

void Abc_TruthNpnTest ( char * pFileName,
int NpnType,
int nVarNum,
int fDumpRes,
int fBinary,
int fVerbose )

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

Synopsis [Apply decomposition to truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 389 of file abcNpn.c.

390{
392 char * pFileNameOut;
393
394 // read info from file
395 p = Abc_TtStoreLoad( pFileName, nVarNum );
396 if ( p == NULL )
397 return;
398
399 // consider functions from the file
400 Abc_TruthNpnPerform( p, NpnType, fVerbose );
401
402 // write the result
403 if ( fDumpRes )
404 {
405 if ( fBinary )
406 pFileNameOut = Extra_FileNameGenericAppend( pFileName, "_out.tt" );
407 else
408 pFileNameOut = Extra_FileNameGenericAppend( pFileName, "_out.txt" );
409 Abc_TtStoreWrite( pFileNameOut, p, fBinary );
410 if ( fVerbose )
411 printf( "The resulting functions are written into file \"%s\".\n", pFileNameOut );
412 }
413
414 // delete data-structure
415 Abc_TtStoreFree( p, nVarNum );
416// printf( "Finished computing canonical forms for functions from file \"%s\".\n", pFileName );
417}
void Abc_TtStoreWrite(char *pFileName, Abc_TtStore_t *p, int fBinary)
Definition abcDec.c:359
void Abc_TtStoreFree(Abc_TtStore_t *p, int nVarNum)
Definition abcDec.c:176
Abc_TtStore_t * Abc_TtStoreLoad(char *pFileName, int nVarNum)
Definition abcDec.c:396
void Abc_TruthNpnPerform(Abc_TtStore_t *p, int NpnType, int fVerbose)
Definition abcNpn.c:177
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_TtStoreFree()

void Abc_TtStoreFree ( Abc_TtStore_t * p,
int nVarNum )
extern

Definition at line 176 of file abcDec.c.

177{
178 if ( nVarNum >= 0 )
179 ABC_FREE( p->pFuncs[0] );
180 ABC_FREE( p->pFuncs );
181 ABC_FREE( p );
182}
Here is the caller graph for this function:

◆ Abc_TtStoreLoad()

Abc_TtStore_t * Abc_TtStoreLoad ( char * pFileName,
int nVarNum )
extern

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

Synopsis [Read truth tables from input file and write them into output file.]

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file abcDec.c.

397{
399 if ( nVarNum < 0 )
400 {
401 int nVars, nTruths;
402 // figure out how many truth table and how many variables
403 Abc_TruthGetParams( pFileName, &nVars, &nTruths );
404 if ( nVars < 2 || nVars > 16 || nTruths == 0 )
405 return NULL;
406 // allocate data-structure
407 p = Abc_TruthStoreAlloc( nVars, nTruths );
408 // read info from file
409 Abc_TruthStoreRead( pFileName, p );
410 }
411 else
412 {
413 char * pBuffer;
414 int nFileSize = Abc_FileSize( pFileName );
415 int nBytes = (1 << (nVarNum-3));
416 int nTruths = nFileSize / nBytes;
417 if ( nFileSize == -1 )
418 return NULL;
419 assert( nVarNum >= 6 );
420 if ( nFileSize % nBytes != 0 )
421 Abc_Print( 0, "The file size (%d) is divided by the truth table size (%d) with remainder (%d).\n",
422 nFileSize, nBytes, nFileSize % nBytes );
423 // read file contents
424 pBuffer = Abc_FileRead( pFileName );
425 // allocate data-structure
426 p = Abc_TruthStoreAlloc2( nVarNum, nTruths, (word *)pBuffer );
427 }
428 return p;
429}
void Abc_TruthStoreRead(char *pFileName, Abc_TtStore_t *p)
Definition abcDec.c:321
int Abc_FileSize(char *pFileName)
Definition abcDec.c:195
Abc_TtStore_t * Abc_TruthStoreAlloc2(int nVars, int nFuncs, word *pBuffer)
Definition abcDec.c:159
void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
Definition abcDec.c:263
Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
Definition abcDec.c:141
char * Abc_FileRead(char *pFileName)
Definition abcDec.c:223
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_TtStoreWrite()

void Abc_TtStoreWrite ( char * pFileName,
Abc_TtStore_t * p,
int fBinary )
extern

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

Synopsis [Write truth tables into file.]

Description []

SideEffects []

SeeAlso []

Definition at line 359 of file abcDec.c.

360{
361 FILE * pFile;
362 char pBuffer[1000];
363 int i, nBytes = 8 * Abc_Truth6WordNum( p->nVars );
364 pFile = fopen( pFileName, "wb" );
365 if ( pFile == NULL )
366 {
367 printf( "Cannot open file \"%s\" for writing.\n", pFileName );
368 return;
369 }
370 for ( i = 0; i < p->nFuncs; i++ )
371 {
372 if ( fBinary )
373 fwrite( p->pFuncs[i], nBytes, 1, pFile );
374 else
375 {
376 Abc_TruthWriteHex( pFile, p->pFuncs[i], p->nVars ), fprintf( pFile, " " );
377 Dau_DsdDecompose( p->pFuncs[i], p->nVars, 0, (int)(p->nVars <= 10), pBuffer );
378 fprintf( pFile, "%s\n", pBuffer );
379 }
380 }
381 fclose( pFile );
382}
void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)
Definition abcDec.c:117
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition dauDsd.c:1912
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ nWords

int nWords = 0

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

Synopsis [Counts the number of unique truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file abcNpn.c.