Commit 416f300d by Alan Mishchenko

Exploration of functions.

parent 73289034
...@@ -454,6 +454,10 @@ struct Abc_EnuMan_t_ ...@@ -454,6 +454,10 @@ struct Abc_EnuMan_t_
word nBuilds; // actually built gates word nBuilds; // actually built gates
word nFinished; // finished structures word nFinished; // finished structures
}; };
static inline int Abc_EnumEquiv( word a, word b )
{
return a == b || a == ~b;
}
static inline void Abc_EnumRef( Abc_EnuMan_t * p, int i ) static inline void Abc_EnumRef( Abc_EnuMan_t * p, int i )
{ {
assert( p->pRefs[i] >= 0 ); assert( p->pRefs[i] >= 0 );
...@@ -492,7 +496,7 @@ static inline void Abc_EnumPrintOne( Abc_EnuMan_t * p ) ...@@ -492,7 +496,7 @@ static inline void Abc_EnumPrintOne( Abc_EnuMan_t * p )
} }
void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p ) void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p )
{ {
word uTruth, uTemp; word uTruth;
word * pTruth = p->pTruths; word * pTruth = p->pTruths;
int f = p->nVarsFree; int f = p->nVarsFree;
int n = p->nNodes; int n = p->nNodes;
...@@ -551,15 +555,32 @@ void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p ) ...@@ -551,15 +555,32 @@ void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p )
for ( c1 = 0; c1 < 2; c1++ ) for ( c1 = 0; c1 < 2; c1++ )
{ {
uTruth = (c0 ? ~pTruth[i] : pTruth[i]) & (c1 ? ~pTruth[k] : pTruth[k]); uTruth = (c0 ? ~pTruth[i] : pTruth[i]) & (c1 ? ~pTruth[k] : pTruth[k]);
// skip constants
if ( uTruth == 0 || ~uTruth == 0 ) if ( uTruth == 0 || ~uTruth == 0 )
continue; continue;
// skip equal ones
for ( t = f; t < n; t++ ) for ( t = f; t < n; t++ )
if ( uTruth == p->pTruths[t] || ~uTruth == p->pTruths[t] ) if ( uTruth == p->pTruths[t] || ~uTruth == p->pTruths[t] )
break; break;
if ( t < n ) if ( t < n )
continue; continue;
// skip those that can be derived by fanin and any other one in the cone
for ( a = f; a < i; a++ )
if ( Abc_EnumEquiv(uTruth, p->pTruths[a] & p->pTruths[k]) || Abc_EnumEquiv(uTruth, ~p->pTruths[a] & p->pTruths[k]) )
break;
if ( a < i )
continue;
for ( b = f; b < k; b++ )
if ( Abc_EnumEquiv(uTruth, p->pTruths[b] & p->pTruths[i]) || Abc_EnumEquiv(uTruth, ~p->pTruths[b] & p->pTruths[i]) )
break;
if ( b < k )
continue;
/*
// skip those that can be derived by any two in the cone, except the top ones
for ( a = f; a <= i; a++ ) for ( a = f; a <= i; a++ )
{ {
word uTemp;
for ( b = a + 1; b <= k; b++ ) for ( b = a + 1; b <= k; b++ )
{ {
if ( a == i && b == k ) if ( a == i && b == k )
...@@ -582,6 +603,8 @@ void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p ) ...@@ -582,6 +603,8 @@ void Abc_EnumerateFuncs_rec( Abc_EnuMan_t * p )
} }
if ( a <= i ) if ( a <= i )
continue; continue;
*/
p->pFans0[n] = i; p->pFans0[n] = i;
p->pFans1[n] = k; p->pFans1[n] = k;
p->fCompl0[n] = c0; p->fCompl0[n] = c0;
......
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