diff options
Diffstat (limited to 'src/base/wlc/wlcBlast.c')
-rw-r--r-- | src/base/wlc/wlcBlast.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/base/wlc/wlcBlast.c b/src/base/wlc/wlcBlast.c index 1c757bd1..ff7e9242 100644 --- a/src/base/wlc/wlcBlast.c +++ b/src/base/wlc/wlcBlast.c @@ -1151,6 +1151,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) int nFFins = 0, nFFouts = 0, curPi = 0, curPo = 0, nFf2Regs = 0; int nBitCis = 0, nBitCos = 0, fAdded = 0; int iFirstAddPi = -1; // remembers the first additional PI that stands for DC-flop output + int iFirstFlop = -1; // remembers the first flop of the design Wlc_BstPar_t Par, * pPar = &Par; Wlc_BstParDefault( pPar ); pPar = pParIn ? pParIn : pPar; @@ -2118,11 +2119,13 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) if ( p->pInits ) { int Length = strlen(p->pInits); + // remember the place in the array where the first PI begins + iFirstAddPi = Vec_PtrSize(pNew->vNamesIn); for ( i = 0; i < Length; i++ ) if ( p->pInits[i] == 'x' || p->pInits[i] == 'X' ) { - char Buffer[100]; - sprintf( Buffer, "%s%d", "init", i ); + //char Buffer[100]; + //sprintf( Buffer, "%s%d", "init", i ); //Vec_PtrPush( pNew->vNamesIn, Abc_UtilStrsav(Buffer) ); // save NULL at this time - to be overwritten later //printf( "Adding NULL in position %d\n", Vec_PtrSize(pNew->vNamesIn) ); @@ -2130,7 +2133,7 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) fAdded = 1; } // remember the place in the array where the first real flop is - iFirstAddPi = Vec_PtrSize(pNew->vNamesIn); + iFirstFlop = Vec_PtrSize(pNew->vNamesIn); } Wlc_NtkForEachCi( p, pObj, i ) if ( !Wlc_ObjIsPi(pObj) ) @@ -2202,17 +2205,18 @@ Gia_Man_t * Wlc_NtkBitBlast( Wlc_Ntk_t * p, Wlc_BstPar_t * pParIn ) // finish creating names of additional primary inputs if ( p->pInits ) { - int Length = strlen(p->pInits); - assert( iFirstAddPi >= 0 ); + int k = iFirstAddPi, Length = strlen(p->pInits); + assert( iFirstAddPi >= 0 && iFirstFlop >= 0 ); for ( i = 0; i < Length; i++ ) if ( p->pInits[i] == 'x' || p->pInits[i] == 'X' ) { char Buffer[1000]; - sprintf( Buffer, "%s_init", (char *)Vec_PtrEntry(pNew->vNamesIn, iFirstAddPi+i) ); - assert( Vec_PtrEntry(pNew->vNamesIn, iFirstAddPi-Length+i) == NULL ); - Vec_PtrWriteEntry( pNew->vNamesIn, iFirstAddPi-Length+i, Abc_UtilStrsav(Buffer) ); + sprintf( Buffer, "%s_init", (char *)Vec_PtrEntry(pNew->vNamesIn, iFirstFlop+i) ); + assert( Vec_PtrEntry(pNew->vNamesIn, k) == NULL ); + Vec_PtrWriteEntry( pNew->vNamesIn, k++, Abc_UtilStrsav(Buffer) ); //printf( "Replacing NULL in position %d\n", iFirstAddPi-Length+i ); } + assert( k == iFirstFlop ); } // create output names pNew->vNamesOut = Vec_PtrAlloc( Gia_ManCoNum(pNew) ); |