summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2022-04-13 18:54:55 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2022-04-13 18:54:55 +0200
commitb29e8a777bd2b16e891da323485e7473d9843039 (patch)
tree240659bcf9d0b6ebd64e024ed2d4c7b5e324b7b2
parent00b674d5b3ccefc7f2abcbf5b650fc14298ac549 (diff)
downloadabc-b29e8a777bd2b16e891da323485e7473d9843039.tar.gz
abc-b29e8a777bd2b16e891da323485e7473d9843039.tar.bz2
abc-b29e8a777bd2b16e891da323485e7473d9843039.zip
Make read_cex able to append if some latches are missing
-rw-r--r--src/base/io/io.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c
index 3874a6cf..03443e95 100644
--- a/src/base/io/io.c
+++ b/src/base/io/io.c
@@ -705,6 +705,9 @@ int Abc_NtkReadCexFile( char * pFileName, Abc_Ntk_t * pNtk, Abc_Cex_t ** ppCex,
nFrames = -1;
int status = 0;
int i;
+ int nRegsNtk = 0;
+ Abc_Obj_t * pObj;
+ Abc_NtkForEachLatch( pNtk, pObj, i ) nRegsNtk++;
Buffer = ABC_ALLOC( char, MaxLine );
while ( fgets( Buffer, MaxLine, pFile ) != NULL )
@@ -766,6 +769,14 @@ int Abc_NtkReadCexFile( char * pFileName, Abc_Ntk_t * pNtk, Abc_Cex_t ** ppCex,
}
}
nRegs = Vec_IntSize(vNums);
+ if ( nRegs < nRegsNtk )
+ {
+ printf( "WARNING: Register number is smaller then in Ntk. Appending.\n" );
+ for (i=0; i<nRegsNtk-nRegs;i++) {
+ Vec_IntPush( vNums, 0 );
+ }
+ nRegs = Vec_IntSize(vNums);
+ }
state = 3;
break;
default:
@@ -786,12 +797,9 @@ int Abc_NtkReadCexFile( char * pFileName, Abc_Ntk_t * pNtk, Abc_Cex_t ** ppCex,
if (usedX)
printf( "Warning: Using 0 instead of x in latches or primary inputs\n" );
- Abc_Obj_t * pObj;
int iFrameCex = nFrames;
- int nRegsNtk = 0;
int nPiNtk = 0;
int nPoNtk = 0;
- Abc_NtkForEachLatch( pNtk, pObj, i ) nRegsNtk++;
Abc_NtkForEachPi(pNtk, pObj, i ) nPiNtk++;
Abc_NtkForEachPo(pNtk, pObj, i ) nPoNtk++;
if ( nRegs < 0 )