Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttopt bugfix #335

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading