Commit 028138a7 by Alan Mishchenko

Version abc70330

parent 4da784c0
...@@ -226,6 +226,10 @@ SOURCE=.\src\base\abci\abcDsd.c ...@@ -226,6 +226,10 @@ SOURCE=.\src\base\abci\abcDsd.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\base\abci\abcDsdRes.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcEspresso.c SOURCE=.\src\base\abci\abcEspresso.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -227,6 +227,20 @@ struct Abc_Lib_t_ ...@@ -227,6 +227,20 @@ struct Abc_Lib_t_
void * pGenlib; // the genlib library used to map this design void * pGenlib; // the genlib library used to map this design
}; };
typedef struct Lut_Par_t_ Lut_Par_t;
struct Lut_Par_t_
{
// user-controlled parameters
int nLutsMax; // (N) the maximum number of LUTs in the structure
int nLutsOver; // (Q) the maximum number of LUTs not in the MFFC
int nVarsShared; // (S) the maximum number of shared variables (crossbars)
int fVerbose; // the verbosiness flag
int fVeryVerbose; // additional verbose info printout
// internal parameters
int nLutSize; // (K) the LUT size (determined by the input network)
int nVarsMax; // (V) the largest number of variables: V = N * (K-1) + 1
};
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS /// /// MACRO DEFINITIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -922,8 +922,8 @@ char * Abc_SopFromTruthHex( char * pTruth ) ...@@ -922,8 +922,8 @@ char * Abc_SopFromTruthHex( char * pTruth )
{ {
pCube = pSopCover + i * (nVars + 3); pCube = pSopCover + i * (nVars + 3);
for ( b = 0; b < nVars; b++ ) for ( b = 0; b < nVars; b++ )
if ( Mint & (1 << (nVars-1-b)) ) // if ( Mint & (1 << (nVars-1-b)) )
// if ( Mint & (1 << b) ) if ( Mint & (1 << b) )
pCube[b] = '1'; pCube[b] = '1';
else else
pCube[b] = '0'; pCube[b] = '0';
......
...@@ -63,6 +63,7 @@ static int Abc_CommandSweep ( Abc_Frame_t * pAbc, int argc, char ** arg ...@@ -63,6 +63,7 @@ static int Abc_CommandSweep ( Abc_Frame_t * pAbc, int argc, char ** arg
static int Abc_CommandFastExtract ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFastExtract ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandDisjoint ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDisjoint ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandImfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandImfs ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandLutjam ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv );
...@@ -217,6 +218,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) ...@@ -217,6 +218,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Synthesis", "fx", Abc_CommandFastExtract, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "fx", Abc_CommandFastExtract, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "dsd", Abc_CommandDisjoint, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "dsd", Abc_CommandDisjoint, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "imfs", Abc_CommandImfs, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "imfs", Abc_CommandImfs, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "lutjam", Abc_CommandLutjam, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "rewrite", Abc_CommandRewrite, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "rewrite", Abc_CommandRewrite, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "refactor", Abc_CommandRefactor, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "refactor", Abc_CommandRefactor, 1 );
...@@ -2876,6 +2878,121 @@ usage: ...@@ -2876,6 +2878,121 @@ usage:
return 1; return 1;
} }
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandLutjam( Abc_Frame_t * pAbc, int argc, char ** argv )
{
FILE * pOut, * pErr;
Abc_Ntk_t * pNtk;
Lut_Par_t Pars, * pPars = &Pars;
int c;
extern int Abc_LutResynthesize( Abc_Ntk_t * pNtk, Lut_Par_t * pPars );
// printf( "Implementation of this command is not finished.\n" );
// return 1;
pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc);
// set defaults
memset( pPars, 0, sizeof(Lut_Par_t) );
pPars->nLutsMax = 4; // (N) the maximum number of LUTs in the structure
pPars->nLutsOver = 1; // (Q) the maximum number of LUTs not in the MFFC
pPars->nVarsShared = 0; // (S) the maximum number of shared variables (crossbars)
pPars->fVerbose = 0;
pPars->fVeryVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NQSvwh" ) ) != EOF )
{
switch ( c )
{
case 'N':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" );
goto usage;
}
pPars->nLutsMax = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nLutsMax < 2 || pPars->nLutsMax > 8 )
goto usage;
break;
case 'Q':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-Q\" should be followed by an integer.\n" );
goto usage;
}
pPars->nLutsOver = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nLutsOver < 0 || pPars->nLutsOver > 8 )
goto usage;
break;
case 'S':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" );
goto usage;
}
pPars->nVarsShared = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nVarsShared < 0 || pPars->nVarsShared > 4 )
goto usage;
break;
case 'v':
pPars->fVerbose ^= 1;
break;
case 'w':
pPars->fVeryVerbose ^= 1;
break;
case 'h':
goto usage;
default:
goto usage;
}
}
if ( pNtk == NULL )
{
fprintf( pErr, "Empty network.\n" );
return 1;
}
if ( !Abc_NtkIsLogic(pNtk) )
{
fprintf( pErr, "This command can only be applied to a logic network.\n" );
return 1;
}
// modify the current network
if ( !Abc_LutResynthesize( pNtk, pPars ) )
{
fprintf( pErr, "Resynthesis has failed.\n" );
return 1;
}
return 0;
usage:
fprintf( pErr, "usage: lutjam [-N <num>] [-Q <num>] [-S <num>] [-vwh]\n" );
fprintf( pErr, "\t performs \"rewriting\" for LUT networks\n" );
fprintf( pErr, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax );
fprintf( pErr, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver );
fprintf( pErr, "\t-S <num> : the max number of LUT inputs shared (0 <= num) [default = %d]\n", pPars->nVarsShared );
fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" );
fprintf( pErr, "\t-w : toggle printout subgraph statistics [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n");
return 1;
}
/**Function************************************************************* /**Function*************************************************************
......
...@@ -10,6 +10,7 @@ SRC += src/base/abci/abc.c \ ...@@ -10,6 +10,7 @@ SRC += src/base/abci/abc.c \
src/base/abci/abcDebug.c \ src/base/abci/abcDebug.c \
src/base/abci/abcDress.c \ src/base/abci/abcDress.c \
src/base/abci/abcDsd.c \ src/base/abci/abcDsd.c \
src/base/abci/abcDsdRes.c \
src/base/abci/abcEspresso.c \ src/base/abci/abcEspresso.c \
src/base/abci/abcExtract.c \ src/base/abci/abcExtract.c \
src/base/abci/abcFpga.c \ src/base/abci/abcFpga.c \
......
...@@ -1265,6 +1265,8 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1265,6 +1265,8 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv )
} }
// write out the current network // write out the current network
if ( Abc_NtkIsLogic(pNtk) )
Abc_NtkToSop(pNtk, 0);
pNetlist = Abc_NtkToNetlist(pNtk); pNetlist = Abc_NtkToNetlist(pNtk);
if ( pNetlist == NULL ) if ( pNetlist == NULL )
{ {
...@@ -1406,6 +1408,8 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1406,6 +1408,8 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv )
} }
// write out the current network // write out the current network
if ( Abc_NtkIsLogic(pNtk) )
Abc_NtkToSop(pNtk, 0);
pNetlist = Abc_NtkToNetlist(pNtk); pNetlist = Abc_NtkToNetlist(pNtk);
if ( pNetlist == NULL ) if ( pNetlist == NULL )
{ {
...@@ -1552,6 +1556,8 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -1552,6 +1556,8 @@ int CmdCommandCapo( Abc_Frame_t * pAbc, int argc, char **argv )
} }
// write out the current network // write out the current network
if ( Abc_NtkIsLogic(pNtk) )
Abc_NtkToSop(pNtk, 0);
pNetlist = Abc_NtkToNetlist(pNtk); pNetlist = Abc_NtkToNetlist(pNtk);
if ( pNetlist == NULL ) if ( pNetlist == NULL )
{ {
......
...@@ -525,13 +525,13 @@ usage: ...@@ -525,13 +525,13 @@ usage:
fprintf( pAbc->Err, "\t parses a formula representing DSD of a function\n" ); fprintf( pAbc->Err, "\t parses a formula representing DSD of a function\n" );
fprintf( pAbc->Err, "\t-h : prints the command summary\n" ); fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
fprintf( pAbc->Err, "\tformula : the formula representing disjoint-support decomposition (DSD)\n" ); fprintf( pAbc->Err, "\tformula : the formula representing disjoint-support decomposition (DSD)\n" );
fprintf( pAbc->Err, "\t Example of a formula: !(a*(b+CA(c,!d,e*f))*79B3(g,h,i,k))\n" ); fprintf( pAbc->Err, "\t Example of a formula: !(a*(b+CA(!d,e*f,c))*79B3(g,h,i,k))\n" );
fprintf( pAbc->Err, "\t where \'!\' is an INV, \'*\' is an AND, \'+\' is an XOR, \n" ); fprintf( pAbc->Err, "\t where \'!\' is an INV, \'*\' is an AND, \'+\' is an XOR, \n" );
fprintf( pAbc->Err, "\t CA and 79B3 are hexadecimal representations of truth tables\n" ); fprintf( pAbc->Err, "\t CA and 79B3 are hexadecimal representations of truth tables\n" );
fprintf( pAbc->Err, "\t (in this case CA=11001010 is truth table of MUX(Ctrl,Data1,Data0))\n" ); fprintf( pAbc->Err, "\t (in this case CA=11001010 is truth table of MUX(Data0,Data1,Ctrl))\n" );
fprintf( pAbc->Err, "\t The lower chars (a,b,c,etc) are reserved for elementary variables.\n" ); fprintf( pAbc->Err, "\t The lower chars (a,b,c,etc) are reserved for elementary variables.\n" );
fprintf( pAbc->Err, "\t The upper chars (A,B,C,etc) are reserved for hexadecimal digits.\n" ); fprintf( pAbc->Err, "\t The upper chars (A,B,C,etc) are reserved for hexadecimal digits.\n" );
fprintf( pAbc->Err, "\t No spaces are allowed in the formula.\n" ); fprintf( pAbc->Err, "\t No spaces are allowed in formulas. In parantheses, LSB goes first.\n" );
return 1; return 1;
} }
......
...@@ -177,6 +177,45 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords ) ...@@ -177,6 +177,45 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Allocates the array of truth tables for the given number of vars.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline Vec_Ptr_t * Vec_PtrAllocTruthTables( int nVars )
{
Vec_Ptr_t * p;
unsigned Masks[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
unsigned * pTruth;
int i, k, nWords;
nWords = (nVars <= 5 ? 1 : (1 << (nVars - 5)));
p = Vec_PtrAllocSimInfo( nVars, nWords );
for ( i = 0; i < nVars; i++ )
{
pTruth = p->pArray[i];
if ( i < 5 )
{
for ( k = 0; k < nWords; k++ )
pTruth[k] = Masks[i];
}
else
{
for ( k = 0; k < nWords; k++ )
if ( k & (1 << (i-5)) )
pTruth[k] = ~(unsigned)0;
else
pTruth[k] = 0;
}
}
return p;
}
/**Function*************************************************************
Synopsis [Duplicates the integer array.] Synopsis [Duplicates the integer array.]
Description [] Description []
......
...@@ -293,6 +293,12 @@ static inline void Kit_TruthOr( unsigned * pOut, unsigned * pIn0, unsigned * pIn ...@@ -293,6 +293,12 @@ static inline void Kit_TruthOr( unsigned * pOut, unsigned * pIn0, unsigned * pIn
for ( w = Kit_TruthWordNum(nVars)-1; w >= 0; w-- ) for ( w = Kit_TruthWordNum(nVars)-1; w >= 0; w-- )
pOut[w] = pIn0[w] | pIn1[w]; pOut[w] = pIn0[w] | pIn1[w];
} }
static inline void Kit_TruthXor( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
{
int w;
for ( w = Kit_TruthWordNum(nVars)-1; w >= 0; w-- )
pOut[w] = pIn0[w] ^ pIn1[w];
}
static inline void Kit_TruthSharp( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars ) static inline void Kit_TruthSharp( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
{ {
int w; int w;
......
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