Skip to content

Commit

Permalink
Merge pull request #335 from MyskYko/fix_ttopt
Browse files Browse the repository at this point in the history
ttopt bugfix
  • Loading branch information
alanminko authored Sep 23, 2024
2 parents db245f5 + 35a8768 commit 3f7a308
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/aig/gia/giaMinLut.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Gia_Man_t * Vec_WrdReadTest( char * pFileName )
void Vec_WrdReadText( char * pFileName, Vec_Wrd_t ** pvSimI, Vec_Wrd_t ** pvSimO, int nIns, int nOuts )
{
int i, nSize, iLine, nLines, nWords;
char pLine[1000];
char pLine[2000];
Vec_Wrd_t * vSimI, * vSimO;
FILE * pFile = fopen( pFileName, "rb" );
if ( pFile == NULL )
Expand All @@ -214,7 +214,7 @@ void Vec_WrdReadText( char * pFileName, Vec_Wrd_t ** pvSimI, Vec_Wrd_t ** pvSimO
nWords = (nLines + 63)/64;
vSimI = Vec_WrdStart( nIns *nWords );
vSimO = Vec_WrdStart( nOuts*nWords );
for ( iLine = 0; fgets( pLine, 1000, pFile ); iLine++ )
for ( iLine = 0; fgets( pLine, 2000, pFile ); iLine++ )
{
for ( i = 0; i < nIns; i++ )
if ( pLine[nIns-1-i] == '1' )
Expand All @@ -233,15 +233,15 @@ void Vec_WrdReadText( char * pFileName, Vec_Wrd_t ** pvSimI, Vec_Wrd_t ** pvSimO
int Vec_WrdReadText2( char * pFileName, Vec_Wrd_t ** pvSimI )
{
int i, nSize, iLine, nLines, nWords, nIns;
char pLine[1000];
char pLine[2000];
Vec_Wrd_t * vSimI;
FILE * pFile = fopen( pFileName, "rb" );
if ( pFile == NULL )
{
printf( "Cannot open file \"%s\" for reading.\n", pFileName );
return 0;
}
if ( !fgets(pLine, 1000, pFile) || (nIns = strlen(pLine)-1) < 1 )
if ( !fgets(pLine, 2000, pFile) || (nIns = strlen(pLine)-1) < 1 )
{
printf( "Cannot find the number of inputs in file \"%s\".\n", pFileName );
fclose( pFile );
Expand All @@ -259,7 +259,7 @@ int Vec_WrdReadText2( char * pFileName, Vec_Wrd_t ** pvSimI )
nLines = nSize / (nIns + 1);
nWords = (nLines + 63)/64;
vSimI = Vec_WrdStart( nIns *nWords );
for ( iLine = 0; fgets( pLine, 1000, pFile ); iLine++ )
for ( iLine = 0; fgets( pLine, 2000, pFile ); iLine++ )
{
for ( i = 0; i < nIns; i++ )
if ( pLine[nIns-1-i] == '1' )
Expand Down
11 changes: 11 additions & 0 deletions src/aig/gia/giaTtopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,17 @@ Gia_Man_t * Gia_ManTtoptCare( Gia_Man_t * p, int nIns, int nOuts, int nRounds, c
{
vSupp = Gia_ManCollectSuppNew( p, g, nOuts );
nInputs = Vec_IntSize( vSupp );
if ( nInputs == 0 )
{
for ( k = 0; k < nOuts; k++ )
{
pObj = Gia_ManCo( p, g+k );
pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
Gia_ManAppendCo( pNew, pTruth[0] & 1 );
}
Vec_IntFree( vSupp );
continue;
}
Ttopt::TruthTableLevelTSM tt( nInputs, nOuts );
for ( k = 0; k < nOuts; k++ )
{
Expand Down

0 comments on commit 3f7a308

Please sign in to comment.