Commit 1d54983b by Alan Mishchenko

Minor changes to hash table and utilSignal.c.

parent 35e05b7e
...@@ -2365,6 +2365,10 @@ SOURCE=.\src\misc\util\utilMem.c ...@@ -2365,6 +2365,10 @@ SOURCE=.\src\misc\util\utilMem.c
SOURCE=.\src\misc\util\utilMem.h SOURCE=.\src\misc\util\utilMem.h
# End Source File # End Source File
# Begin Source File
SOURCE=.\src\misc\util\utilSignal.c
# End Source File
# End Group # End Group
# Begin Group "nm" # Begin Group "nm"
......
...@@ -80,74 +80,59 @@ extern int nSuppMax; ...@@ -80,74 +80,59 @@ extern int nSuppMax;
***********************************************************************/ ***********************************************************************/
int Llb_NonlinFindBestVar( DdManager * dd, DdNode * bFunc, Aig_Man_t * pAig ) int Llb_NonlinFindBestVar( DdManager * dd, DdNode * bFunc, Aig_Man_t * pAig )
{ {
int fVerbose = 0;
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
// Vec_Int_t * vVars;
DdNode * bCof, * bVar, * bTemp; DdNode * bCof, * bVar, * bTemp;
int i, iVar, iVarBest = -1, iValue, iValueBest = ABC_INFINITY; int i, iVar, iVarBest = -1, iValue, iValueBest = ABC_INFINITY, Size0Best = -1;
int Size, Size0, Size1; int Size, Size0, Size1;
int clk = clock(); int clk = clock();
// vVars = Vec_IntStartNatural( Cudd_ReadSize(dd) ); Size = Cudd_DagSize(bFunc);
printf( "Original = %6d. SuppSize = %3d. Vars = %3d.\n", // printf( "Original = %6d. SuppSize = %3d. Vars = %3d.\n",
Size = Cudd_DagSize(bFunc), Cudd_SupportSize(dd, bFunc), Aig_ManRegNum(pAig) ); // Size = Cudd_DagSize(bFunc), Cudd_SupportSize(dd, bFunc), Aig_ManRegNum(pAig) );
// Vec_IntForEachEntry( vVars, iVar, i )
Saig_ManForEachLo( pAig, pObj, i ) Saig_ManForEachLo( pAig, pObj, i )
{ {
iVar = Aig_ObjId(pObj); iVar = Aig_ObjId(pObj);
/*
printf( "Var =%3d : ", iVar );
bVar = Cudd_bddIthVar(dd, iVar);
bCof = Cudd_Cofactor( dd, bFunc, Cudd_Not(bVar) ); Cudd_Ref( bCof ); if ( fVerbose )
// bCof = Cudd_bddAnd( dd, bTemp = bCof, Cudd_Not(bVar) ); Cudd_Ref( bCof ); printf( "Var =%3d : ", iVar );
// Cudd_RecursiveDeref( dd, bTemp );
printf( "Supp0 =%3d ", Cudd_SupportSize(dd, bCof) );
printf( "Size0 =%6d ", Size0 = Cudd_DagSize(bCof) );
Cudd_RecursiveDeref( dd, bCof );
bCof = Cudd_Cofactor( dd, bFunc, bVar ); Cudd_Ref( bCof );
// bCof = Cudd_bddAnd( dd, bTemp = bCof, bVar ); Cudd_Ref( bCof );
// Cudd_RecursiveDeref( dd, bTemp );
printf( "Supp1 =%3d ", Cudd_SupportSize(dd, bCof) );
printf( "Size1 =%6d ", Size1 = Cudd_DagSize(bCof) );
Cudd_RecursiveDeref( dd, bCof );
printf( "D =%6d ", Size0 + Size1 - Size );
printf( "B =%6d\n", ABC_MAX(Size0, Size1) - ABC_MIN(Size0, Size1) );
*/
// printf( "Var =%3d : ", iVar );
bVar = Cudd_bddIthVar(dd, iVar); bVar = Cudd_bddIthVar(dd, iVar);
bCof = Cudd_Cofactor( dd, bFunc, Cudd_Not(bVar) ); Cudd_Ref( bCof ); bCof = Cudd_Cofactor( dd, bFunc, Cudd_Not(bVar) ); Cudd_Ref( bCof );
bCof = Cudd_bddAnd( dd, bTemp = bCof, Cudd_Not(bVar) ); Cudd_Ref( bCof ); bCof = Cudd_bddAnd( dd, bTemp = bCof, Cudd_Not(bVar) ); Cudd_Ref( bCof );
Cudd_RecursiveDeref( dd, bTemp ); Cudd_RecursiveDeref( dd, bTemp );
Size0 = Cudd_DagSize(bCof); Size0 = Cudd_DagSize(bCof);
// printf( "Supp0 =%3d ", Cudd_SupportSize(dd, bCof) ); if ( fVerbose )
// printf( "Size0 =%6d ", Size0 ); printf( "Supp0 =%3d ", Cudd_SupportSize(dd, bCof) );
if ( fVerbose )
printf( "Size0 =%6d ", Size0 );
Cudd_RecursiveDeref( dd, bCof ); Cudd_RecursiveDeref( dd, bCof );
bCof = Cudd_Cofactor( dd, bFunc, bVar ); Cudd_Ref( bCof ); bCof = Cudd_Cofactor( dd, bFunc, bVar ); Cudd_Ref( bCof );
bCof = Cudd_bddAnd( dd, bTemp = bCof, bVar ); Cudd_Ref( bCof ); bCof = Cudd_bddAnd( dd, bTemp = bCof, bVar ); Cudd_Ref( bCof );
Cudd_RecursiveDeref( dd, bTemp ); Cudd_RecursiveDeref( dd, bTemp );
Size1 = Cudd_DagSize(bCof); Size1 = Cudd_DagSize(bCof);
// printf( "Supp1 =%3d ", Cudd_SupportSize(dd, bCof) ); if ( fVerbose )
// printf( "Size1 =%6d ", Size1 ); printf( "Supp1 =%3d ", Cudd_SupportSize(dd, bCof) );
if ( fVerbose )
printf( "Size1 =%6d ", Size1 );
Cudd_RecursiveDeref( dd, bCof ); Cudd_RecursiveDeref( dd, bCof );
iValue = ABC_MAX(Size0, Size1) - ABC_MIN(Size0, Size1) + Size0 + Size1 - Size; iValue = ABC_MAX(Size0, Size1) - ABC_MIN(Size0, Size1) + Size0 + Size1 - Size;
// printf( "D =%6d ", Size0 + Size1 - Size ); if ( fVerbose )
// printf( "B =%6d ", ABC_MAX(Size0, Size1) - ABC_MIN(Size0, Size1) ); printf( "D =%6d ", Size0 + Size1 - Size );
// printf( "S =%6d\n", iValue ); if ( fVerbose )
printf( "B =%6d ", ABC_MAX(Size0, Size1) - ABC_MIN(Size0, Size1) );
if ( fVerbose )
printf( "S =%6d\n", iValue );
if ( iValueBest > iValue ) if ( iValueBest > iValue )
{ {
iValueBest = iValue; iValueBest = iValue;
iVarBest = i; iVarBest = iVar;
Size0Best = Size0;
} }
} }
// Vec_IntFree( vVars ); printf( "BestVar = %4d. Value =%6d. Orig =%6d. Size0 =%6d. ", iVarBest, iValueBest, Size, Size0Best );
printf( "Best var = %d. Best value = %d. ", iVarBest, iValueBest );
Abc_PrintTime( 1, "Time", clock() - clk ); Abc_PrintTime( 1, "Time", clock() - clk );
return iVarBest; return iVarBest;
} }
...@@ -424,12 +409,14 @@ int Llb_NonlinReachability( Llb_Mnn_t * p ) ...@@ -424,12 +409,14 @@ int Llb_NonlinReachability( Llb_Mnn_t * p )
{ {
int iVar; int iVar;
DdNode * bVar; DdNode * bVar;
int nDagSize;
// if ( !p->pPars->fSilent ) // if ( !p->pPars->fSilent )
// printf( "Reached timeout during image computation (%d seconds).\n", p->pPars->TimeLimit ); // printf( "Reached timeout during image computation (%d seconds).\n", p->pPars->TimeLimit );
// p->pPars->iFrame = nIters - 1; // p->pPars->iFrame = nIters - 1;
// return -1; // return -1;
bCurrent = Extra_TransferPermute( p->ddG, p->dd, p->ddG->bFunc2, Vec_IntArray(p->vGlo2Cs) ); Cudd_Ref( bCurrent ); bCurrent = Extra_TransferPermute( p->ddG, p->dd, p->ddG->bFunc2, Vec_IntArray(p->vGlo2Cs) ); Cudd_Ref( bCurrent );
nDagSize = Cudd_DagSize(bCurrent);
iVar = Llb_NonlinFindBestVar( p->dd, bCurrent, p->pAig ); iVar = Llb_NonlinFindBestVar( p->dd, bCurrent, p->pAig );
bVar = Cudd_bddIthVar(p->dd, iVar); bVar = Cudd_bddIthVar(p->dd, iVar);
...@@ -438,6 +425,10 @@ int Llb_NonlinReachability( Llb_Mnn_t * p ) ...@@ -438,6 +425,10 @@ int Llb_NonlinReachability( Llb_Mnn_t * p )
Cudd_RecursiveDeref( p->dd, bTemp ); Cudd_RecursiveDeref( p->dd, bTemp );
bCurrent = Cudd_bddAnd( p->dd, bTemp = bCurrent, Cudd_Not(bVar) ); Cudd_Ref( bCurrent ); bCurrent = Cudd_bddAnd( p->dd, bTemp = bCurrent, Cudd_Not(bVar) ); Cudd_Ref( bCurrent );
Cudd_RecursiveDeref( p->dd, bTemp ); Cudd_RecursiveDeref( p->dd, bTemp );
// printf( "Before = %6d. After = %6d.\n", nDagSize, Cudd_DagSize(bCurrent) );
p->pPars->nBddMax = 3 * p->pPars->nBddMax / 2;
continue; continue;
} }
Cudd_Ref( bNext ); Cudd_Ref( bNext );
......
...@@ -87,7 +87,7 @@ struct Hash_Gen_t_ ...@@ -87,7 +87,7 @@ struct Hash_Gen_t_
***********************************************************************/ ***********************************************************************/
static int Hash_DefaultHashFuncStr( void * key, int nBins ) static int Hash_DefaultHashFuncStr( void * key, int nBins )
{ {
char* p = (const char*)key; const char* p = (const char*)key;
int h=0; int h=0;
for( ; *p ; ++p ) for( ; *p ; ++p )
...@@ -151,7 +151,6 @@ static inline Hash_Gen_t * Hash_GenAlloc( ...@@ -151,7 +151,6 @@ static inline Hash_Gen_t * Hash_GenAlloc(
int fFreeKey) int fFreeKey)
{ {
Hash_Gen_t * p; Hash_Gen_t * p;
int i;
assert(nBins > 0); assert(nBins > 0);
p = ABC_CALLOC( Hash_Gen_t, 1 ); p = ABC_CALLOC( Hash_Gen_t, 1 );
p->nBins = nBins; p->nBins = nBins;
......
...@@ -18,19 +18,19 @@ ...@@ -18,19 +18,19 @@
***********************************************************************/ ***********************************************************************/
#ifndef _MSC_VER
#include <main.h> #include <main.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <signal.h> #include <signal.h>
#include <hashGen.h> #include "abc_global.h"
#include "hashGen.h"
#ifndef _MSC_VER
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "abc_global.h"
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment