Commit d071e026 by Alan Mishchenko

Updated for memory abstraction.

parent 36585eff
...@@ -176,8 +176,8 @@ int Ndr_TypeWlc2Ndr( int Type ) ...@@ -176,8 +176,8 @@ int Ndr_TypeWlc2Ndr( int Type )
***********************************************************************/ ***********************************************************************/
char * Ndr_ObjWriteConstant( unsigned * pBits, int nBits ) char * Ndr_ObjWriteConstant( unsigned * pBits, int nBits )
{ {
static char Buffer[1000]; int i, Len; static char Buffer[10000]; int i, Len;
assert( nBits + 10 < 1000 ); assert( nBits + 10 < 10000 );
sprintf( Buffer, "%d\'b", nBits ); sprintf( Buffer, "%d\'b", nBits );
Len = strlen(Buffer); Len = strlen(Buffer);
for ( i = nBits-1; i >= 0; i-- ) for ( i = nBits-1; i >= 0; i-- )
...@@ -205,7 +205,7 @@ void * Wlc_NtkToNdr( Wlc_Ntk_t * pNtk ) ...@@ -205,7 +205,7 @@ void * Wlc_NtkToNdr( Wlc_Ntk_t * pNtk )
Wlc_NtkForEachObj( pNtk, pObj, iOutId ) Wlc_NtkForEachObj( pNtk, pObj, iOutId )
{ {
char * pFunction = NULL; char * pFunction = NULL;
if ( Wlc_ObjIsPi(pObj) ) if ( Wlc_ObjIsPi(pObj) || pObj->Type == 0 )
continue; continue;
Vec_IntClear( vFanins ); Vec_IntClear( vFanins );
Wlc_ObjForEachFanin( pObj, iFanin, k ) Wlc_ObjForEachFanin( pObj, iFanin, k )
...@@ -214,8 +214,17 @@ void * Wlc_NtkToNdr( Wlc_Ntk_t * pNtk ) ...@@ -214,8 +214,17 @@ void * Wlc_NtkToNdr( Wlc_Ntk_t * pNtk )
pFunction = Ndr_ObjWriteConstant( (unsigned *)Wlc_ObjFanins(pObj), Wlc_ObjRange(pObj) ); pFunction = Ndr_ObjWriteConstant( (unsigned *)Wlc_ObjFanins(pObj), Wlc_ObjRange(pObj) );
if ( pObj->Type == WLC_OBJ_MUX && Wlc_ObjRange(Wlc_ObjFanin0(pNtk, pObj)) > 1 ) if ( pObj->Type == WLC_OBJ_MUX && Wlc_ObjRange(Wlc_ObjFanin0(pNtk, pObj)) > 1 )
Type = ABC_OPER_SEL_NMUX; Type = ABC_OPER_SEL_NMUX;
else if ( pObj->Type == WLC_OBJ_FO )
{
Wlc_Obj_t * pFi = Wlc_ObjFo2Fi( pNtk, pObj );
assert( Vec_IntSize(vFanins) == 0 );
Vec_IntPush( vFanins, Wlc_ObjId(pNtk, pFi) );
Vec_IntFillExtra( vFanins, 7, 0 );
Type = ABC_OPER_DFFRSE;
}
else else
Type = Ndr_TypeWlc2Ndr(pObj->Type); Type = Ndr_TypeWlc2Ndr(pObj->Type);
assert( Type > 0 );
Ndr_AddObject( pDesign, ModId, Type, 0, Ndr_AddObject( pDesign, ModId, Type, 0,
pObj->End, pObj->Beg, pObj->Signed, pObj->End, pObj->Beg, pObj->Signed,
Vec_IntSize(vFanins), Vec_IntArray(vFanins), 1, &iOutId, pFunction ); Vec_IntSize(vFanins), Vec_IntArray(vFanins), 1, &iOutId, pFunction );
......
...@@ -521,7 +521,7 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fTwoSides, int fVerbose ) ...@@ -521,7 +521,7 @@ void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fTwoSides, int fVerbose )
else else
{ {
assert( Wlc_ObjFaninNum(pObj) >= 2 ); assert( Wlc_ObjFaninNum(pObj) >= 2 );
Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), Wlc_ObjSign(Wlc_ObjFanin0(p, pObj)), Wlc_ObjSign(Wlc_ObjFanin1(p, pObj)) ); Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), Wlc_ObjFaninId(pObj, 0) ? Wlc_ObjSign(Wlc_ObjFanin0(p, pObj)) : 0, Wlc_ObjFaninId(pObj, 1) ? Wlc_ObjSign(Wlc_ObjFanin1(p, pObj)) : 0 );
} }
// add to storage // add to storage
Wlc_NtkPrintDistribAddOne( vTypes, vOccurs, pObj->Type, Sign ); Wlc_NtkPrintDistribAddOne( vTypes, vOccurs, pObj->Type, Sign );
...@@ -991,7 +991,7 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq ) ...@@ -991,7 +991,7 @@ Wlc_Ntk_t * Wlc_NtkDupDfs( Wlc_Ntk_t * p, int fMarked, int fSeq )
pObjNew->fXConst = pObj->fXConst; pObjNew->fXConst = pObj->fXConst;
} }
Vec_IntFree( vFanins ); Vec_IntFree( vFanins );
if ( fSeq ) if ( fSeq && p->vInits )
{ {
if ( fMarked ) if ( fMarked )
{ {
......
...@@ -892,7 +892,7 @@ int Wlc_PrsReadDeclaration( Wlc_Prs_t * p, char * pStart ) ...@@ -892,7 +892,7 @@ int Wlc_PrsReadDeclaration( Wlc_Prs_t * p, char * pStart )
} }
while ( 1 ) while ( 1 )
{ {
char * pName; int XValue; char * pName; int XValue, TypeNew;
// read name // read name
pStart = Wlc_PrsFindName( pStart, &pName ); pStart = Wlc_PrsFindName( pStart, &pName );
if ( pStart == NULL ) if ( pStart == NULL )
...@@ -911,11 +911,11 @@ int Wlc_PrsReadDeclaration( Wlc_Prs_t * p, char * pStart ) ...@@ -911,11 +911,11 @@ int Wlc_PrsReadDeclaration( Wlc_Prs_t * p, char * pStart )
continue; continue;
} }
// check definition // check definition
Type = Wlc_PrsFindDefinition( p, pStart, p->vFanins, &XValue ); TypeNew = Wlc_PrsFindDefinition( p, pStart, p->vFanins, &XValue );
if ( Type ) if ( TypeNew )
{ {
Wlc_Obj_t * pObj = Wlc_NtkObj( p->pNtk, iObj ); Wlc_Obj_t * pObj = Wlc_NtkObj( p->pNtk, iObj );
Wlc_ObjUpdateType( p->pNtk, pObj, Type ); Wlc_ObjUpdateType( p->pNtk, pObj, TypeNew );
Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins ); Wlc_ObjAddFanins( p->pNtk, pObj, p->vFanins );
pObj->fXConst = XValue; pObj->fXConst = XValue;
} }
......
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