summaryrefslogtreecommitdiffstats
path: root/src/opt/dau/dauNpn.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2018-08-01 22:26:42 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2018-08-01 22:26:42 -0800
commit3fb3c6bdd2035842eb4399100ae3fe6b2d6eb107 (patch)
tree862cc9820ef7b6d275ca629699d641b9754c0288 /src/opt/dau/dauNpn.c
parent905a627758841c5dee5e1ce4a180badcaff303f1 (diff)
downloadabc-3fb3c6bdd2035842eb4399100ae3fe6b2d6eb107.tar.gz
abc-3fb3c6bdd2035842eb4399100ae3fe6b2d6eb107.tar.bz2
abc-3fb3c6bdd2035842eb4399100ae3fe6b2d6eb107.zip
Experiments with function enumeration.
Diffstat (limited to 'src/opt/dau/dauNpn.c')
-rw-r--r--src/opt/dau/dauNpn.c77
1 files changed, 61 insertions, 16 deletions
diff --git a/src/opt/dau/dauNpn.c b/src/opt/dau/dauNpn.c
index 1af758cb..d8c19111 100644
--- a/src/opt/dau/dauNpn.c
+++ b/src/opt/dau/dauNpn.c
@@ -194,15 +194,28 @@ void Dau_NetworkEnum()
//Dau_DsdPrintFromTruth( &uTruth, 4 );
for ( v = 0; v < nSupp; v++ )
{
+ word tGate, tCur;
word Cof0 = Abc_Tt6Cofactor0( uTruth, nVars-1-v );
word Cof1 = Abc_Tt6Cofactor1( uTruth, nVars-1-v );
for ( g = 0; g < Limit; g++ )
{
if ( nSupp < nVars )
{
- word tGate = g ? s_Truths6[nVars-1-v] ^ s_Truths6[nVars-1-nSupp] : s_Truths6[nVars-1-v] & s_Truths6[nVars-1-nSupp];
- word tCur = (tGate & Cof1) | (~tGate & Cof0);
- Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ if ( g == 0 )
+ {
+ tGate = s_Truths6[nVars-1-v] & s_Truths6[nVars-1-nSupp];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ }
+ else
+ {
+ tGate = s_Truths6[nVars-1-v] ^ s_Truths6[nVars-1-nSupp];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ }
}
}
for ( g = 0; g < Limit; g++ )
@@ -210,13 +223,26 @@ void Dau_NetworkEnum()
// add one cross bar
for ( k = 0; k < nSupp; k++ ) if ( k != v )
{
- word tGate = g ? s_Truths6[nVars-1-v] ^ s_Truths6[nVars-1-k] : s_Truths6[nVars-1-v] & s_Truths6[nVars-1-k];
- word tCur = (tGate & Cof1) | (~tGate & Cof0);
- Dau_AddFunction( tCur, nVars, pTable, vNpns );
- if ( g == 0 ) // skip XOR
+ if ( g == 0 )
{
- word tGate = s_Truths6[nVars-1-v] & ~s_Truths6[nVars-1-k];
- word tCur = (tGate & Cof1) | (~tGate & Cof0);
+ tGate = s_Truths6[nVars-1-v] & s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tGate = s_Truths6[nVars-1-v] & ~s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ }
+ else
+ {
+ tGate = s_Truths6[nVars-1-v] ^ s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_AddFunction( tCur, nVars, pTable, vNpns );
}
}
@@ -227,22 +253,41 @@ void Dau_NetworkEnum()
for ( k = 0; k < nSupp; k++ ) if ( k != v )
for ( m = k+1; m < nSupp; m++ ) if ( m != v )
{
- word tGate = g ? s_Truths6[nVars-1-m] ^ s_Truths6[nVars-1-k] : s_Truths6[nVars-1-m] & s_Truths6[nVars-1-k];
- word tCur = (tGate & Cof1) | (~tGate & Cof0);
- Dau_AddFunction( tCur, nVars, pTable, vNpns );
- if ( g == 0 ) // skip XOR
+ if ( g == 0 )
{
- tGate = s_Truths6[nVars-1-m] & ~s_Truths6[nVars-1-k];
+ tGate = s_Truths6[nVars-1-m] & s_Truths6[nVars-1-k];
tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_AddFunction( tCur, nVars, pTable, vNpns );
- tGate = ~s_Truths6[nVars-1-m] & s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tGate = s_Truths6[nVars-1-m] & ~s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tGate = ~s_Truths6[nVars-1-m] & s_Truths6[nVars-1-k];
tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
tGate = ~s_Truths6[nVars-1-m] & ~s_Truths6[nVars-1-k];
tCur = (tGate & Cof1) | (~tGate & Cof0);
Dau_AddFunction( tCur, nVars, pTable, vNpns );
+
+ tCur = (tGate & Cof0) | (~tGate & Cof1);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
+ }
+ else
+ {
+ tGate = s_Truths6[nVars-1-m] ^ s_Truths6[nVars-1-k];
+ tCur = (tGate & Cof1) | (~tGate & Cof0);
+ Dau_AddFunction( tCur, nVars, pTable, vNpns );
}
}
}
@@ -252,7 +297,7 @@ void Dau_NetworkEnum()
//printf("Finished %d nodes with %d functions.\n", Count++, Vec_IntSize(vNpns) );
iPrev = iLast;
iLast = Vec_IntSize(vNpns)-1;
- printf("Finished %2d nodes with %6d functions our of %6d. ", Count++, iLast - iPrev, Vec_IntSize(vNpns) );
+ printf("Finished %2d nodes with %6d functions out of %6d. ", Count++, iLast - iPrev, Vec_IntSize(vNpns) );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
fflush(stdout);
}