/**CFile**************************************************************** FileName [extraUtilPrime.c] SystemName [ABC: Logic synthesis and verification system.] PackageName [extra] Synopsis [Function enumeration.] Author [Alan Mishchenko] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] Revision [$Id: extraUtilPrime.c,v 1.0 2003/02/01 00:00:00 alanmi Exp $] ***********************************************************************/ #include #include #include #include #include "misc/vec/vec.h" #include "misc/vec/vecHsh.h" #include "bool/kit/kit.h" ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_GenCountDump( Vec_Int_t * vPrimes, int nVars, char * pFileName ) { FILE * pFile; int i, k, Prime; pFile = fopen( pFileName, "wb" ); fprintf( pFile, "# %d prime numbers up to 2^%d generated by ABC on %s\n", Vec_IntSize(vPrimes), nVars, Extra_TimeStamp() ); fprintf( pFile, ".i %d\n", nVars ); fprintf( pFile, ".o %d\n", 1 ); fprintf( pFile, ".p %d\n", Vec_IntSize(vPrimes) ); Vec_IntForEachEntry( vPrimes, Prime, i ) for ( k = nVars-1; k >= 0; k-- ) fprintf( pFile, "%d%s", (Prime >> k)&1, k ? "" : " 1\n" ); fprintf( pFile, ".e\n\n" ); fclose( pFile ); } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_GenCountHits1( Vec_Bit_t * vMap, Vec_Int_t * vPrimes, int nVars ) { abctime clk = Abc_Clock(); int i, k, Prime, Count = 0; Vec_IntForEachEntry( vPrimes, Prime, i ) { for ( k = 0; k < nVars; k++ ) if ( !Vec_BitEntry(vMap, Prime ^ (1<