Commit 1116313d by Alan Mishchenko

Improved DSD.

parent 21e6a59e
...@@ -1987,6 +1987,10 @@ SOURCE=.\src\opt\dau\dauCore.c ...@@ -1987,6 +1987,10 @@ SOURCE=.\src\opt\dau\dauCore.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\opt\dau\dauDivs.c
# End Source File
# Begin Source File
SOURCE=.\src\opt\dau\dauDsd.c SOURCE=.\src\opt\dau\dauDsd.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
ABC_NAMESPACE_HEADER_START ABC_NAMESPACE_HEADER_START
#define DAU_MAX_VAR 16 // should be 6 or more #define DAU_MAX_VAR 12 // should be 6 or more
#define DAU_MAX_STR 256 #define DAU_MAX_STR 256
#define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6)) #define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6))
......
/**CFile****************************************************************
FileName [dauDivs.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [DAG-aware unmapping.]
Synopsis [Divisor computation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: dauDivs.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "dauInt.h"
#include "dau.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Dau_DsdDivisors( word * pTruth, int nVars )
{
word Copy[DAU_MAX_WORD];
int nWords = Abc_TtWordNum(nVars);
int nDigits = Abc_TtHexDigitNum(nVars);
int i, j, k, Digit, Counter[5];
printf( " " );
printf( " !a *!b" );
printf( " !a * b" );
printf( " a *!b" );
printf( " a * b" );
printf( " a + b" );
printf( "\n" );
for ( i = 0; i < nVars; i++ )
for ( j = i+1; j < nVars; j++ )
{
Abc_TtCopy( Copy, pTruth, nWords, 0 );
Abc_TtSwapVars( Copy, nVars, 0, i );
Abc_TtSwapVars( Copy, nVars, 1, j );
for ( k = 0; k < 5; k++ )
Counter[k] = 0;
for ( k = 0; k < nDigits; k++ )
{
Digit = Abc_TtGetHex( Copy, k );
if ( Digit == 1 || Digit == 14 )
Counter[0]++;
else if ( Digit == 2 || Digit == 13 )
Counter[1]++;
else if ( Digit == 4 || Digit == 11 )
Counter[2]++;
else if ( Digit == 8 || Digit == 7 )
Counter[3]++;
else if ( Digit == 6 || Digit == 9 )
Counter[4]++;
}
printf( "%c %c ", 'a'+i, 'a'+j );
for ( k = 0; k < 5; k++ )
printf( "%7d", Counter[k] );
printf( "\n" );
}
return NULL;
}
void Dau_DsdTest()
{
// char * pDsd = "!(!(abc)!(def))";
// char * pDsd = "[(abc)(def)]";
char * pDsd = "<<abc>d(ef)>";
word t = Dau_Dsd6ToTruth( pDsd );
// word t = 0xCA88CA88CA88CA88;
// word t = 0x9ef7a8d9c7193a0f;
int nVars = Abc_TtSupportSize( &t, 6 );
return;
// word t = 0xCACACACACACACACA;
Dau_DsdDivisors( &t, nVars );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
...@@ -1942,7 +1942,7 @@ void Dau_DsdTest888() ...@@ -1942,7 +1942,7 @@ void Dau_DsdTest888()
i = 0; i = 0;
} }
void Dau_DsdTest() void Dau_DsdTest555()
{ {
int nVars = 10; int nVars = 10;
int nWords = Abc_TtWordNum(nVars); int nWords = Abc_TtWordNum(nVars);
...@@ -1953,8 +1953,8 @@ void Dau_DsdTest() ...@@ -1953,8 +1953,8 @@ void Dau_DsdTest()
char pRes[DAU_MAX_STR]; char pRes[DAU_MAX_STR];
int nSizeNonDec; int nSizeNonDec;
int i, Counter = 0; int i, Counter = 0;
clock_t clk = clock(); clock_t clk = clock(), clkDec = 0, clk2;
return; // return;
while ( fgets( pBuffer, DAU_MAX_STR, pFile ) != NULL ) while ( fgets( pBuffer, DAU_MAX_STR, pFile ) != NULL )
{ {
...@@ -1967,14 +1967,15 @@ void Dau_DsdTest() ...@@ -1967,14 +1967,15 @@ void Dau_DsdTest()
continue; continue;
Counter++; Counter++;
for ( i = 0; i < 10; i++ ) for ( i = 0; i < 1; i++ )
{ {
Dau_DsdPermute( pBuffer ); // Dau_DsdPermute( pBuffer );
pTruth = Dau_DsdToTruth( pBuffer[0] == '*' ? pBuffer + 1 : pBuffer, nVars ); pTruth = Dau_DsdToTruth( pBuffer[0] == '*' ? pBuffer + 1 : pBuffer, nVars );
Abc_TtCopy( Tru[0], pTruth, nWords, 0 ); Abc_TtCopy( Tru[0], pTruth, nWords, 0 );
Abc_TtCopy( Tru[1], pTruth, nWords, 0 ); Abc_TtCopy( Tru[1], pTruth, nWords, 0 );
clk2 = clock();
nSizeNonDec = Dau_DsdDecompose( Tru[1], nVars, 0, pRes ); nSizeNonDec = Dau_DsdDecompose( Tru[1], nVars, 0, pRes );
clkDec += clock() - clk2;
Dau_DsdNormalize( pRes ); Dau_DsdNormalize( pRes );
// pStr2 = Dau_DsdPerform( t ); nSizeNonDec = 0; // pStr2 = Dau_DsdPerform( t ); nSizeNonDec = 0;
assert( nSizeNonDec == 0 ); assert( nSizeNonDec == 0 );
...@@ -1990,7 +1991,8 @@ void Dau_DsdTest() ...@@ -1990,7 +1991,8 @@ void Dau_DsdTest()
} }
} }
printf( "Finished trying %d decompositions. ", Counter ); printf( "Finished trying %d decompositions. ", Counter );
Abc_PrintTime( 1, "Time", clock() - clk ); Abc_PrintTime( 1, "Time", clkDec );
Abc_PrintTime( 1, "Total", clock() - clk );
Abc_PrintTime( 1, "Time1", s_Times[0] ); Abc_PrintTime( 1, "Time1", s_Times[0] );
Abc_PrintTime( 1, "Time2", s_Times[1] ); Abc_PrintTime( 1, "Time2", s_Times[1] );
......
SRC += src/opt/dau/dau.c \ SRC += src/opt/dau/dau.c \
src/opt/dau/dauCanon.c \ src/opt/dau/dauCanon.c \
src/opt/dau/dauCore.c \ src/opt/dau/dauCore.c \
src/opt/dau/dauDivs.c \
src/opt/dau/dauDsd.c \ src/opt/dau/dauDsd.c \
src/opt/dau/dauEnum.c \ src/opt/dau/dauEnum.c \
src/opt/dau/dauMerge.c src/opt/dau/dauMerge.c
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