ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcSymm.c File Reference
#include "base/abc/abc.h"
#include "opt/sim/sim.h"
#include "opt/dau/dau.h"
#include "misc/util/utilTruth.h"
Include dependency graph for abcSymm.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Abc_NtkSymmetries (Abc_Ntk_t *pNtk, int fUseBdds, int fNaive, int fReorder, int fVerbose)
 DECLARATIONS ///.
 
void Ntk_SymTryRandomFlips (word *pFun, word *pNpn, int nVars)
 
void Ntk_SymFunDeriveNpn (word *pFun, int nVars, int *pComp)
 
void Ntk_SymFunGenerate (int nVars, int fVerbose)
 

Function Documentation

◆ Abc_NtkSymmetries()

ABC_NAMESPACE_IMPL_START void Abc_NtkSymmetries ( Abc_Ntk_t * pNtk,
int fUseBdds,
int fNaive,
int fReorder,
int fVerbose )

DECLARATIONS ///.

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

FileName [abcSymm.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Computation of two-variable symmetries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
abcSymm.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 238 of file abcSymm.c.

238{}

◆ Ntk_SymFunDeriveNpn()

void Ntk_SymFunDeriveNpn ( word * pFun,
int nVars,
int * pComp )

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

Synopsis [Find canonical form of symmetric function.]

Description []

SideEffects []

SeeAlso []

Definition at line 276 of file abcSymm.c.

277{
278 int i, nWords = Abc_TtWordNum(nVars);
279 word * pFunB = ABC_CALLOC( word, nWords );
280 Abc_TtCopy( pFunB, pFun, nWords, 1 );
281 if ( Abc_TtCompareRev(pFunB, pFun, nWords) == 1 )
282 Abc_TtCopy( pFunB, pFun, nWords, 0 );
283 for ( i = 0; i < (1 << nVars); i++ )
284 {
285 Abc_TtFlip( pFun, nWords, pComp[i] );
286 if ( Abc_TtCompareRev(pFunB, pFun, nWords) == 1 )
287 Abc_TtCopy( pFunB, pFun, nWords, 0 );
288 Abc_TtNot( pFun, nWords );
289 if ( Abc_TtCompareRev(pFunB, pFun, nWords) == 1 )
290 Abc_TtCopy( pFunB, pFun, nWords, 0 );
291 }
292 //Ntk_SymTryRandomFlips( pFun, pFunB, nVars );
293 Abc_TtCopy( pFun, pFunB, nWords, 0 );
294 ABC_FREE( pFunB );
295}
int nWords
Definition abcNpn.c:127
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the caller graph for this function:

◆ Ntk_SymFunGenerate()

void Ntk_SymFunGenerate ( int nVars,
int fVerbose )

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

Synopsis [Generating NPN classes of all symmetric function of N variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file abcSymm.c.

309{
310 int k, m, Class;
311 int * pComp = Extra_GreyCodeSchedule( nVars );
312 Vec_Mem_t * vTtMem = Vec_MemAlloc( Abc_Truth6WordNum(nVars), 12 );
313 Vec_MemHashAlloc( vTtMem, 10000 );
314 assert( !(nVars < 1 || nVars > 16) );
315 printf( "Generating truth tables of all symmetric functions of %d variables.\n", nVars );
316 for ( m = 0; m < (1 << (nVars+1)); m++ )
317 {
318 word * pFun;
319 char Ones[100] = {0};
320 for ( k = 0; k <= nVars; k++ )
321 Ones[k] = '0' + ((m >> k) & 1);
322 if ( fVerbose )
323 printf( "%s : ", Ones );
324 pFun = Abc_TtSymFunGenerate( Ones, nVars );
325 if ( nVars < 6 )
326 pFun[0] = Abc_Tt6Stretch( pFun[0], nVars );
327 if ( fVerbose )
328 Extra_PrintHex( stdout, (unsigned *)pFun, nVars );
329 Ntk_SymFunDeriveNpn( pFun, nVars, pComp );
330 Class = Vec_MemHashInsert( vTtMem, pFun );
331 if ( fVerbose )
332 {
333 printf( " : NPN " );
334 Extra_PrintHex( stdout, (unsigned *)pFun, nVars );
335 printf( " Class %3d", Class );
336 printf( "\n" );
337 }
338 ABC_FREE( pFun );
339 }
340 printf( "The number of different NPN classes is %d.\n", Vec_MemEntryNum(vTtMem) );
341 Vec_MemHashFree( vTtMem );
342 Vec_MemFreeP( &vTtMem );
343 ABC_FREE( pComp );
344}
void Ntk_SymFunDeriveNpn(word *pFun, int nVars, int *pComp)
Definition abcSymm.c:276
int * Extra_GreyCodeSchedule(int n)
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Definition utilMem.c:35
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Ntk_SymTryRandomFlips()

void Ntk_SymTryRandomFlips ( word * pFun,
word * pNpn,
int nVars )

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

Synopsis [Try different permutations.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file abcSymm.c.

254{
255 int Rand[16] = { 17290, 20203, 19027, 12035, 14687, 10920, 10413, 261, 2072, 16899, 4480, 6192, 3978, 8343, 745, 1370 };
256 int i, nWords = Abc_TtWordNum(nVars);
257 word * pFunT = ABC_CALLOC( word, nWords );
258 Abc_TtCopy( pFunT, pFun, nWords, 0 );
259 for ( i = 0; i < 16; i++ )
260 Abc_TtFlip( pFunT, nWords, Rand[i] % (nVars-1) );
261 assert( Abc_TtCompareRev(pNpn, pFunT, nWords) != 1 );
262 ABC_FREE( pFunT );
263}