Commit edf3622c by Alan Mishchenko

Several improvements to CBA data-structure.

parent ea2d82ab
...@@ -370,7 +370,7 @@ int Abc_NtkBddToSop( Abc_Ntk_t * pNtk, int fDirect, int nCubeLimit ) ...@@ -370,7 +370,7 @@ int Abc_NtkBddToSop( Abc_Ntk_t * pNtk, int fDirect, int nCubeLimit )
{ {
// collect all BDDs into one array // collect all BDDs into one array
Vec_Ptr_t * vFuncs = Vec_PtrAlloc( Abc_NtkNodeNum(pNtk) ); Vec_Ptr_t * vFuncs = Vec_PtrAlloc( Abc_NtkNodeNum(pNtk) );
assert( !Cudd_ReorderingStatus(dd, &nCubes) ); assert( !Cudd_ReorderingStatus(dd, (Cudd_ReorderingType *)&nCubes) );
Abc_NtkForEachNode( pNtk, pNode, i ) Abc_NtkForEachNode( pNtk, pNode, i )
if ( !Abc_ObjIsBarBuf(pNode) ) if ( !Abc_ObjIsBarBuf(pNode) )
Vec_PtrPush( vFuncs, pNode->pData ); Vec_PtrPush( vFuncs, pNode->pData );
......
...@@ -241,14 +241,15 @@ static inline int Cba_ObjIsCio( Cba_Ntk_t * p, int i ) { r ...@@ -241,14 +241,15 @@ static inline int Cba_ObjIsCio( Cba_Ntk_t * p, int i ) { r
static inline int Cba_ObjFanin( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsCo(p, i)); return Vec_IntEntry(&p->vFanin, i); } static inline int Cba_ObjFanin( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsCo(p, i)); return Vec_IntEntry(&p->vFanin, i); }
static inline int Cba_ObjIndex( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsCio(p, i)); return Vec_IntEntry(&p->vIndex, i); } static inline int Cba_ObjIndex( Cba_Ntk_t * p, int i ) { assert(Cba_ObjIsCio(p, i)); return Vec_IntEntry(&p->vIndex, i); }
static inline int Cba_ObjFaninTwo( Cba_Ntk_t * p, int i ) { return Cba_ObjFanin(p, Cba_ObjFanin(p, i)); } static inline int Cba_ObjFaninTwo( Cba_Ntk_t * p, int i ) { return Cba_ObjFanin(p, Cba_ObjFanin(p, i)); }
static inline int Cba_ObjName( Cba_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vName, i); } static inline int Cba_ObjNameInt( Cba_Ntk_t * p, int i ) { assert(!Cba_ObjIsCo(p, i)); return Vec_IntEntry(&p->vName, i); }
static inline int Cba_ObjName( Cba_Ntk_t * p, int i ) { return Cba_ObjIsCo(p, i) ? Cba_ObjNameInt(p, Cba_ObjFanin(p,i)) : Cba_ObjNameInt(p, i); }
static inline int Cba_ObjRange( Cba_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vRange, i); } static inline int Cba_ObjRange( Cba_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vRange, i); }
static inline int Cba_ObjCopy( Cba_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vCopy, i); } static inline int Cba_ObjCopy( Cba_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vCopy, i); }
static inline char * Cba_ObjNameStr( Cba_Ntk_t * p, int i ) { return Cba_NtkStr(p, Cba_ObjName(p, i)); } static inline char * Cba_ObjNameStr( Cba_Ntk_t * p, int i ) { return Cba_NtkStr(p, Cba_ObjName(p, i)); }
static inline char * Cba_ObjRangeStr( Cba_Ntk_t * p, int i ) { return Cba_NtkStr(p, Cba_ObjRange(p, i)); } static inline char * Cba_ObjRangeStr( Cba_Ntk_t * p, int i ) { return Cba_NtkStr(p, Cba_ObjRange(p, i)); }
static inline void Cba_ObjSetFanin( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjFanin(p, i) == -1); Vec_IntWriteEntry( &p->vFanin, i, x ); } static inline void Cba_ObjSetFanin( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjFanin(p, i) == -1 && Cba_ObjIsCo(p, i)); Vec_IntWriteEntry( &p->vFanin, i, x);}
static inline void Cba_ObjSetIndex( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjIndex(p, i) == -1); Vec_IntWriteEntry( &p->vIndex, i, x ); } static inline void Cba_ObjSetIndex( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjIndex(p, i) == -1); Vec_IntWriteEntry( &p->vIndex, i, x ); }
static inline void Cba_ObjSetName( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjName(p, i) == 0); Vec_IntWriteEntry( &p->vName, i, x ); } static inline void Cba_ObjSetName( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjName(p, i) == 0 && !Cba_ObjIsCo(p, i)); Vec_IntWriteEntry( &p->vName, i, x ); }
static inline void Cba_ObjSetRange( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjRange(p, i) == 0); Vec_IntWriteEntry( &p->vRange, i, x ); } static inline void Cba_ObjSetRange( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjRange(p, i) == 0); Vec_IntWriteEntry( &p->vRange, i, x ); }
static inline void Cba_ObjSetCopy( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjCopy(p, i) == -1); Vec_IntWriteEntry( &p->vCopy, i, x ); } static inline void Cba_ObjSetCopy( Cba_Ntk_t * p, int i, int x ) { assert(Cba_ObjCopy(p, i) == -1); Vec_IntWriteEntry( &p->vCopy, i, x ); }
...@@ -324,9 +325,11 @@ static inline int Cba_NtkNameRanges( char * pName, int * pRanges, char * pSymbs ...@@ -324,9 +325,11 @@ static inline int Cba_NtkNameRanges( char * pName, int * pRanges, char * pSymbs
for ( i = 0; (i < Cba_ManNtkNum(p)) && (((pNtk) = Cba_ManNtk(p, i)), 1); i++ ) for ( i = 0; (i < Cba_ManNtkNum(p)) && (((pNtk) = Cba_ManNtk(p, i)), 1); i++ )
#define Cba_NtkForEachPi( p, iObj, i ) \ #define Cba_NtkForEachPi( p, iObj, i ) \
for ( i = 0; (i < Cba_NtkPiNum(p)) && (((iObj) = Vec_IntEntry(&p->vInputs, i)), 1); i++ ) for ( i = 0; (i < Cba_NtkPiNum(p)) && (((iObj) = Cba_NtkPi(p, i)), 1); i++ )
#define Cba_NtkForEachPo( p, iObj, i ) \ #define Cba_NtkForEachPo( p, iObj, i ) \
for ( i = 0; (i < Cba_NtkPoNum(p)) && (((iObj) = Vec_IntEntry(&p->vOutputs, i)), 1); i++ ) for ( i = 0; (i < Cba_NtkPoNum(p)) && (((iObj) = Cba_NtkPo(p, i)), 1); i++ )
#define Cba_NtkForEachPoDriver( p, iObj, i ) \
for ( i = 0; (i < Cba_NtkPoNum(p)) && (((iObj) = Cba_ObjFanin(p, Cba_NtkPo(p, i))), 1); i++ )
#define Cba_NtkForEachObj( p, i ) \ #define Cba_NtkForEachObj( p, i ) \
for ( i = 0; (i < Cba_NtkObjNum(p)); i++ ) for ( i = 0; (i < Cba_NtkObjNum(p)); i++ )
...@@ -394,7 +397,7 @@ static inline int Cba_ObjAlloc( Cba_Ntk_t * p, Cba_ObjType_t Type, int Fanin ) ...@@ -394,7 +397,7 @@ static inline int Cba_ObjAlloc( Cba_Ntk_t * p, Cba_ObjType_t Type, int Fanin )
static inline int Cba_ObjDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p, int i ) static inline int Cba_ObjDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p, int i )
{ {
int iObj = Cba_ObjAlloc( pNew, Cba_ObjType(p, i), Cba_ObjIsBox(p, i) ? Cba_BoxNtkId(p, i) : -1 ); int iObj = Cba_ObjAlloc( pNew, Cba_ObjType(p, i), Cba_ObjIsBox(p, i) ? Cba_BoxNtkId(p, i) : -1 );
if ( Cba_NtkHasNames(p) && Cba_NtkHasNames(pNew) ) if ( Cba_NtkHasNames(p) && Cba_NtkHasNames(pNew) && !Cba_ObjIsCo(p, i) )
Cba_ObjSetName( pNew, iObj, Cba_ObjName(p, i) ); Cba_ObjSetName( pNew, iObj, Cba_ObjName(p, i) );
if ( Cba_NtkHasRanges(p) && Cba_NtkHasRanges(pNew) ) if ( Cba_NtkHasRanges(p) && Cba_NtkHasRanges(pNew) )
Cba_ObjSetRange( pNew, iObj, Cba_ObjRange(p, i) ); Cba_ObjSetRange( pNew, iObj, Cba_ObjRange(p, i) );
...@@ -473,7 +476,7 @@ static inline void Cba_NtkDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p ) ...@@ -473,7 +476,7 @@ static inline void Cba_NtkDup( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
Cba_ObjDup( pNew, p, iObj ); Cba_ObjDup( pNew, p, iObj );
Cba_NtkForEachCo( p, iObj ) Cba_NtkForEachCo( p, iObj )
Cba_ObjSetFanin( pNew, Cba_ObjCopy(p, iObj), Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) ); Cba_ObjSetFanin( pNew, Cba_ObjCopy(p, iObj), Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) );
//Cba_NtkFreeCopies( p ); // needed for host ntk //Cba_NtkFreeCopies( p ); // needed for name transfer and host ntk
assert( Cba_NtkObjNum(pNew) == Cba_NtkObjNumAlloc(pNew) ); assert( Cba_NtkObjNum(pNew) == Cba_NtkObjNumAlloc(pNew) );
} }
static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p ) static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
...@@ -482,8 +485,6 @@ static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p ) ...@@ -482,8 +485,6 @@ static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
assert( pNew != p ); assert( pNew != p );
Cba_NtkAlloc( pNew, Cba_NtkNameId(p), Cba_NtkPiNum(p), Cba_NtkPoNum(p), Cba_NtkObjNum(p) + 3*Cba_NtkCoNum(p) ); Cba_NtkAlloc( pNew, Cba_NtkNameId(p), Cba_NtkPiNum(p), Cba_NtkPoNum(p), Cba_NtkObjNum(p) + 3*Cba_NtkCoNum(p) );
Cba_NtkStartCopies( p ); Cba_NtkStartCopies( p );
if ( Cba_NtkHasNames(p) )
Cba_NtkStartNames( pNew );
Cba_NtkForEachPi( p, iObj, i ) Cba_NtkForEachPi( p, iObj, i )
Cba_ObjDup( pNew, p, iObj ); Cba_ObjDup( pNew, p, iObj );
Cba_NtkForEachPo( p, iObj, i ) Cba_NtkForEachPo( p, iObj, i )
...@@ -492,11 +493,29 @@ static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p ) ...@@ -492,11 +493,29 @@ static inline void Cba_NtkDupUserBoxes( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
Cba_BoxDup( pNew, p, iObj ); Cba_BoxDup( pNew, p, iObj );
// connect feed-throughs // connect feed-throughs
Cba_NtkForEachCo( p, iObj ) Cba_NtkForEachCo( p, iObj )
if ( Cba_ObjCopy(p, iObj) >= 0 && if ( Cba_ObjCopy(p, iObj) >= 0 && Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) >= 0 )
Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) >= 0 &&
Cba_ObjName(p, iObj) == Cba_ObjName(p, Cba_ObjFanin(p, iObj)) )
Cba_ObjSetFanin( pNew, Cba_ObjCopy(p, iObj), Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) ); Cba_ObjSetFanin( pNew, Cba_ObjCopy(p, iObj), Cba_ObjCopy(p, Cba_ObjFanin(p, iObj)) );
} }
static inline void Cba_NtkMoveNames( Cba_Ntk_t * pNew, Cba_Ntk_t * p )
{
int i, iBox, iObj;
assert( Cba_NtkHasNames(p) );
assert( !Cba_NtkHasNames(pNew) );
Cba_NtkStartNames( pNew );
Cba_NtkForEachPi( p, iObj, i )
Cba_ObjSetName( pNew, Cba_ObjCopy(p, iObj), Cba_ObjName(p, iObj) );
Cba_NtkForEachBoxUser( p, iBox )
Cba_BoxForEachBo( p, iBox, iObj, i )
Cba_ObjSetName( pNew, Cba_ObjCopy(p, iObj), Cba_ObjName(p, iObj) );
Cba_NtkForEachBoxUser( p, iBox )
Cba_BoxForEachBi( p, iBox, iObj, i )
if ( !Cba_ObjName(pNew, Cba_ObjFanin(pNew, Cba_ObjCopy(p, iObj))) )
Cba_ObjSetName( pNew, Cba_ObjFanin(pNew, Cba_ObjCopy(p, iObj)), Cba_ObjName(p, iObj) );
Cba_NtkForEachPo( p, iObj, i )
if ( !Cba_ObjName(pNew, Cba_ObjFanin(pNew, Cba_ObjCopy(p, iObj))) )
Cba_ObjSetName( pNew, Cba_ObjFanin(pNew, Cba_ObjCopy(p, iObj)), Cba_ObjName(p, iObj) );
}
static inline void Cba_NtkFree( Cba_Ntk_t * p ) static inline void Cba_NtkFree( Cba_Ntk_t * p )
{ {
Vec_IntErase( &p->vInputs ); Vec_IntErase( &p->vInputs );
...@@ -619,6 +638,12 @@ static inline Cba_Man_t * Cba_ManDupUserBoxes( Cba_Man_t * p ) ...@@ -619,6 +638,12 @@ static inline Cba_Man_t * Cba_ManDupUserBoxes( Cba_Man_t * p )
Cba_NtkSetHost( Cba_NtkCopyNtk(pNew, pNtk), Cba_NtkCopy(pHost), Cba_ObjCopy(pHost, Cba_NtkHostObj(pNtk)) ); Cba_NtkSetHost( Cba_NtkCopyNtk(pNew, pNtk), Cba_NtkCopy(pHost), Cba_ObjCopy(pHost, Cba_NtkHostObj(pNtk)) );
return pNew; return pNew;
} }
static inline void Cba_ManMoveNames( Cba_Man_t * pNew, Cba_Man_t * p )
{
Cba_Ntk_t * pNtk; int i;
Cba_ManForEachNtk( p, pNtk, i )
Cba_NtkMoveNames( Cba_NtkCopyNtk(pNew, pNtk), pNtk );
}
static inline void Cba_ManFree( Cba_Man_t * p ) static inline void Cba_ManFree( Cba_Man_t * p )
......
...@@ -300,9 +300,7 @@ void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_ ...@@ -300,9 +300,7 @@ void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_
int iObj; int iObj;
if ( pGia && Gia_ObjFaninId0p(pGia, pObj) > 0 ) if ( pGia && Gia_ObjFaninId0p(pGia, pObj) > 0 )
{ {
assert( Cba_ObjName(p, Gia_ObjFanin0(pObj)->Value) != Cba_ObjName(p, iTerm) ); // not a feedthrough
iObj = Cba_ObjAlloc( p, CBA_OBJ_BI, Gia_ObjFanin0(pObj)->Value ); iObj = Cba_ObjAlloc( p, CBA_OBJ_BI, Gia_ObjFanin0(pObj)->Value );
Cba_ObjSetName( p, iObj, Cba_ObjName(p, Gia_ObjFanin0(pObj)->Value) );
Cba_ObjAlloc( p, Gia_ObjFaninC0(pObj) ? CBA_BOX_INV : CBA_BOX_BUF, -1 ); Cba_ObjAlloc( p, Gia_ObjFaninC0(pObj) ? CBA_BOX_INV : CBA_BOX_BUF, -1 );
} }
else else
...@@ -310,7 +308,6 @@ void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_ ...@@ -310,7 +308,6 @@ void Cba_NtkCreateAndConnectBuffer( Gia_Man_t * pGia, Gia_Obj_t * pObj, Cba_Ntk_
Cba_ObjAlloc( p, pGia && Gia_ObjFaninC0(pObj) ? CBA_BOX_CT : CBA_BOX_CF, -1 ); Cba_ObjAlloc( p, pGia && Gia_ObjFaninC0(pObj) ? CBA_BOX_CT : CBA_BOX_CF, -1 );
} }
iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 ); iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 );
Cba_ObjSetName( p, iObj, Cba_ObjName(p, iTerm) );
Cba_ObjSetFanin( p, iTerm, iObj ); Cba_ObjSetFanin( p, iTerm, iObj );
} }
void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia ) void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia )
...@@ -353,9 +350,7 @@ void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia ) ...@@ -353,9 +350,7 @@ void Cba_NtkInsertGia( Cba_Man_t * p, Gia_Man_t * pGia )
Type = CBA_BOX_AND; Type = CBA_BOX_AND;
// create box // create box
iTerm = Cba_ObjAlloc( pNtk, CBA_OBJ_BI, iLit1 ); iTerm = Cba_ObjAlloc( pNtk, CBA_OBJ_BI, iLit1 );
Cba_ObjSetName( pNtk, iTerm, Cba_ObjName(pNtk, iLit1) );
iTerm = Cba_ObjAlloc( pNtk, CBA_OBJ_BI, iLit0 ); iTerm = Cba_ObjAlloc( pNtk, CBA_OBJ_BI, iLit0 );
Cba_ObjSetName( pNtk, iTerm, Cba_ObjName(pNtk, iLit0) );
Cba_ObjAlloc( pNtk, Type, -1 ); Cba_ObjAlloc( pNtk, Type, -1 );
pObj->Value = Cba_ObjAlloc( pNtk, CBA_OBJ_BO, -1 ); pObj->Value = Cba_ObjAlloc( pNtk, CBA_OBJ_BO, -1 );
} }
...@@ -384,6 +379,7 @@ Cba_Man_t * Cba_ManInsertGia( Cba_Man_t * p, Gia_Man_t * pGia ) ...@@ -384,6 +379,7 @@ Cba_Man_t * Cba_ManInsertGia( Cba_Man_t * p, Gia_Man_t * pGia )
Cba_ManMarkNodesGia( p, pGia ); Cba_ManMarkNodesGia( p, pGia );
Cba_ManRemapBarbufs( pNew, p ); Cba_ManRemapBarbufs( pNew, p );
Cba_NtkInsertGia( pNew, pGia ); Cba_NtkInsertGia( pNew, pGia );
Cba_ManMoveNames( pNew, p );
return pNew; return pNew;
} }
...@@ -450,15 +446,13 @@ void Cba_ManMarkNodesAbc( Cba_Man_t * p, Abc_Ntk_t * pNtk ) ...@@ -450,15 +446,13 @@ void Cba_ManMarkNodesAbc( Cba_Man_t * p, Abc_Ntk_t * pNtk )
void Cba_NtkCreateOrConnectFanin( Abc_Obj_t * pFanin, Cba_Ntk_t * p, int iTerm ) void Cba_NtkCreateOrConnectFanin( Abc_Obj_t * pFanin, Cba_Ntk_t * p, int iTerm )
{ {
int iObj; int iObj;
if ( pFanin && Abc_NodeIsSeriousGate(pFanin) && Cba_ObjName(p, pFanin->iTemp) == -1 ) // gate without name if ( pFanin && Abc_NodeIsSeriousGate(pFanin) )//&& Cba_ObjName(p, pFanin->iTemp) == -1 ) // gate without name
{ {
iObj = pFanin->iTemp; iObj = pFanin->iTemp;
} }
else if ( pFanin && (Abc_ObjIsPi(pFanin) || Abc_ObjIsBarBuf(pFanin) || Abc_NodeIsSeriousGate(pFanin)) ) // PI/BO or gate with name else if ( pFanin && (Abc_ObjIsPi(pFanin) || Abc_ObjIsBarBuf(pFanin) || Abc_NodeIsSeriousGate(pFanin)) ) // PI/BO or gate with name
{ {
assert( Cba_ObjName(p, pFanin->iTemp) != Cba_ObjName(p, iTerm) ); // not a feedthrough
iObj = Cba_ObjAlloc( p, CBA_OBJ_BI, pFanin->iTemp ); iObj = Cba_ObjAlloc( p, CBA_OBJ_BI, pFanin->iTemp );
Cba_ObjSetName( p, iObj, Cba_ObjName(p, pFanin->iTemp) );
Cba_ObjAlloc( p, CBA_BOX_GATE, p->pDesign->ElemGates[2] ); // buffer Cba_ObjAlloc( p, CBA_BOX_GATE, p->pDesign->ElemGates[2] ); // buffer
iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 ); iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 );
} }
...@@ -468,7 +462,6 @@ void Cba_NtkCreateOrConnectFanin( Abc_Obj_t * pFanin, Cba_Ntk_t * p, int iTerm ) ...@@ -468,7 +462,6 @@ void Cba_NtkCreateOrConnectFanin( Abc_Obj_t * pFanin, Cba_Ntk_t * p, int iTerm )
Cba_ObjAlloc( p, CBA_BOX_GATE, p->pDesign->ElemGates[(pFanin && Abc_NodeIsConst1(pFanin))] ); // const 0/1 Cba_ObjAlloc( p, CBA_BOX_GATE, p->pDesign->ElemGates[(pFanin && Abc_NodeIsConst1(pFanin))] ); // const 0/1
iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 ); iObj = Cba_ObjAlloc( p, CBA_OBJ_BO, -1 );
} }
Cba_ObjSetName( p, iObj, Cba_ObjName(p, iTerm) );
Cba_ObjSetFanin( p, iTerm, iObj ); Cba_ObjSetFanin( p, iTerm, iObj );
} }
void Cba_NtkPrepareLibrary( Cba_Man_t * p, Mio_Library_t * pLib ) void Cba_NtkPrepareLibrary( Cba_Man_t * p, Mio_Library_t * pLib )
...@@ -528,10 +521,7 @@ void Cba_NtkInsertNtk( Cba_Man_t * p, Abc_Ntk_t * pNtk ) ...@@ -528,10 +521,7 @@ void Cba_NtkInsertNtk( Cba_Man_t * p, Abc_Ntk_t * pNtk )
{ {
pCbaNtk = Cba_ManNtk( p, pObj->iTemp ); pCbaNtk = Cba_ManNtk( p, pObj->iTemp );
for ( k = Abc_ObjFaninNum(pObj)-1; k >= 0; k-- ) for ( k = Abc_ObjFaninNum(pObj)-1; k >= 0; k-- )
{
iTerm = Cba_ObjAlloc( pCbaNtk, CBA_OBJ_BI, Abc_ObjFanin(pObj, k)->iTemp ); iTerm = Cba_ObjAlloc( pCbaNtk, CBA_OBJ_BI, Abc_ObjFanin(pObj, k)->iTemp );
Cba_ObjSetName( pCbaNtk, iTerm, Cba_ObjName(pCbaNtk, Abc_ObjFanin(pObj, k)->iTemp) );
}
Cba_ObjAlloc( pCbaNtk, CBA_BOX_GATE, Abc_NamStrFind(p->pMods, Mio_GateReadName((Mio_Gate_t *)pObj->pData)) ); Cba_ObjAlloc( pCbaNtk, CBA_BOX_GATE, Abc_NamStrFind(p->pMods, Mio_GateReadName((Mio_Gate_t *)pObj->pData)) );
pObj->iTemp = Cba_ObjAlloc( pCbaNtk, CBA_OBJ_BO, -1 ); pObj->iTemp = Cba_ObjAlloc( pCbaNtk, CBA_OBJ_BO, -1 );
} }
...@@ -561,6 +551,7 @@ void * Cba_ManInsertAbc( Cba_Man_t * p, void * pAbc ) ...@@ -561,6 +551,7 @@ void * Cba_ManInsertAbc( Cba_Man_t * p, void * pAbc )
Cba_ManMarkNodesAbc( p, pNtk ); Cba_ManMarkNodesAbc( p, pNtk );
Cba_ManRemapBarbufs( pNew, p ); Cba_ManRemapBarbufs( pNew, p );
Cba_NtkInsertNtk( pNew, pNtk ); Cba_NtkInsertNtk( pNew, pNtk );
Cba_ManMoveNames( pNew, p );
return pNew; return pNew;
} }
......
...@@ -77,30 +77,18 @@ void Cba_ManAssignInternNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap ) ...@@ -77,30 +77,18 @@ void Cba_ManAssignInternNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
// set all names // set all names
Cba_NtkForEachPi( p, iObj, i ) Cba_NtkForEachPi( p, iObj, i )
nNameless += Cba_ManSetInternOne( p, iObj, vMap ); nNameless += Cba_ManSetInternOne( p, iObj, vMap );
Cba_NtkForEachPo( p, iObj, i )
nNameless += Cba_ManSetInternOne( p, iObj, vMap );
Cba_NtkForEachBox( p, iObj ) Cba_NtkForEachBox( p, iObj )
{
Cba_BoxForEachBi( p, iObj, iTerm, i )
nNameless += Cba_ManSetInternOne( p, iTerm, vMap );
Cba_BoxForEachBo( p, iObj, iTerm, i ) Cba_BoxForEachBo( p, iObj, iTerm, i )
nNameless += Cba_ManSetInternOne( p, iTerm, vMap ); nNameless += Cba_ManSetInternOne( p, iTerm, vMap );
} // generate new names
if ( nNameless ) if ( nNameless )
{ {
int nNameless2 = 0; int nNameless2 = 0;
// generate new names
Cba_NtkForEachPi( p, iObj, i ) Cba_NtkForEachPi( p, iObj, i )
nNameless2 += Cba_ManAssignInternOne( p, iObj, vMap ); nNameless2 += Cba_ManAssignInternOne( p, iObj, vMap );
Cba_NtkForEachPo( p, iObj, i )
nNameless2 += Cba_ManAssignInternOne( p, iObj, vMap );
Cba_NtkForEachBox( p, iObj ) Cba_NtkForEachBox( p, iObj )
{
Cba_BoxForEachBi( p, iObj, iTerm, i )
nNameless2 += Cba_ManAssignInternOne( p, iTerm, vMap );
Cba_BoxForEachBo( p, iObj, iTerm, i ) Cba_BoxForEachBo( p, iObj, iTerm, i )
nNameless2 += Cba_ManAssignInternOne( p, iTerm, vMap ); nNameless2 += Cba_ManAssignInternOne( p, iTerm, vMap );
}
assert( nNameless == nNameless2 ); assert( nNameless == nNameless2 );
if ( nNameless ) if ( nNameless )
printf( "Generated unique names for %d objects in network \"%s\".\n", nNameless, Cba_NtkName(p) ); printf( "Generated unique names for %d objects in network \"%s\".\n", nNameless, Cba_NtkName(p) );
...@@ -108,16 +96,9 @@ void Cba_ManAssignInternNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap ) ...@@ -108,16 +96,9 @@ void Cba_ManAssignInternNamesNtk( Cba_Ntk_t * p, Vec_Int_t * vMap )
// unmark all names // unmark all names
Cba_NtkForEachPi( p, iObj, i ) Cba_NtkForEachPi( p, iObj, i )
Vec_IntWriteEntry( vMap, Cba_ObjName(p, iObj), 0 ); Vec_IntWriteEntry( vMap, Cba_ObjName(p, iObj), 0 );
Cba_NtkForEachPo( p, iObj, i )
Vec_IntWriteEntry( vMap, Cba_ObjName(p, iObj), 0 );
Cba_NtkForEachBox( p, iObj ) Cba_NtkForEachBox( p, iObj )
{
Cba_BoxForEachBi( p, iObj, iTerm, i )
Vec_IntWriteEntry( vMap, Cba_ObjName(p, iTerm), 0 );
Cba_BoxForEachBo( p, iObj, iTerm, i ) Cba_BoxForEachBo( p, iObj, iTerm, i )
Vec_IntWriteEntry( vMap, Cba_ObjName(p, iTerm), 0 ); Vec_IntWriteEntry( vMap, Cba_ObjName(p, iTerm), 0 );
}
} }
void Cba_ManAssignInternNames( Cba_Man_t * p ) void Cba_ManAssignInternNames( Cba_Man_t * p )
{ {
...@@ -315,8 +296,9 @@ Cba_Man_t * Cba_ManCollapse( Cba_Man_t * p ) ...@@ -315,8 +296,9 @@ Cba_Man_t * Cba_ManCollapse( Cba_Man_t * p )
Cba_NtkStartNames( pRootNew ); Cba_NtkStartNames( pRootNew );
Cba_NtkForEachPi( pRoot, iObj, i ) Cba_NtkForEachPi( pRoot, iObj, i )
Cba_ObjSetName( pRootNew, Cba_NtkPi(pRootNew, i), Cba_ObjName(pRoot, iObj) ); Cba_ObjSetName( pRootNew, Cba_NtkPi(pRootNew, i), Cba_ObjName(pRoot, iObj) );
Cba_NtkForEachPo( pRoot, iObj, i ) Cba_NtkForEachPoDriver( pRoot, iObj, i )
Cba_ObjSetName( pRootNew, Cba_NtkPo(pRootNew, i), Cba_ObjName(pRoot, iObj) ); if ( !Cba_ObjIsPi(pRoot, iObj) )
Cba_ObjSetName( pRootNew, Cba_ObjCopy(pRoot, iObj), Cba_ObjName(pRoot, iObj) );
} }
return pNew; return pNew;
} }
......
...@@ -269,7 +269,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_ ...@@ -269,7 +269,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
nNonDriven++; nNonDriven++;
} }
Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) ); Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
Cba_ObjSetName( pNew, iTerm, NameId ); //Cba_ObjSetName( pNew, iTerm, NameId );
} }
} }
else else
...@@ -291,7 +291,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_ ...@@ -291,7 +291,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
nNonDriven++; nNonDriven++;
} }
Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) ); Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
Cba_ObjSetName( pNew, iTerm, NameId ); //Cba_ObjSetName( pNew, iTerm, NameId );
} }
} }
} }
...@@ -312,7 +312,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_ ...@@ -312,7 +312,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
nNonDriven++; nNonDriven++;
} }
Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) ); Cba_ObjSetFanin( pNew, iTerm, Vec_IntEntry(vMap, NameId) );
Cba_ObjSetName( pNew, iTerm, NameId ); //Cba_ObjSetName( pNew, iTerm, NameId );
} }
} }
// add fanins for primary outputs // add fanins for primary outputs
...@@ -328,7 +328,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_ ...@@ -328,7 +328,7 @@ void Prs_ManBuildNtk( Cba_Ntk_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Vec_
Prs_NtkForEachPo( pNtk, NameId, i ) Prs_NtkForEachPo( pNtk, NameId, i )
{ {
iObj = Cba_ObjAlloc( pNew, CBA_OBJ_PO, Vec_IntEntry(vMap, NameId) ); iObj = Cba_ObjAlloc( pNew, CBA_OBJ_PO, Vec_IntEntry(vMap, NameId) );
Cba_ObjSetName( pNew, iObj, NameId ); //Cba_ObjSetName( pNew, iObj, NameId );
} }
if ( nNonDriven ) if ( nNonDriven )
printf( "Module %s has %d non-driven nets (for example, %s).\n", Prs_NtkName(pNtk), nNonDriven, Prs_NtkStr(pNtk, iNonDriven) ); printf( "Module %s has %d non-driven nets (for example, %s).\n", Prs_NtkName(pNtk), nNonDriven, Prs_NtkStr(pNtk, iNonDriven) );
......
...@@ -331,7 +331,7 @@ int Cba_NtkDeriveFromPtr( Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vMap, ...@@ -331,7 +331,7 @@ int Cba_NtkDeriveFromPtr( Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vMap,
if ( Vec_IntGetEntryFull(vMap, NameId) == -1 ) if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
printf( "Signal \"%s\" in not driven in module \"%s\".\n", pName, pModuleName ); printf( "Signal \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
Cba_ObjSetFanin( pNtk, iTerm, Vec_IntGetEntryFull(vMap, NameId) ); Cba_ObjSetFanin( pNtk, iTerm, Vec_IntGetEntryFull(vMap, NameId) );
Cba_ObjSetName( pNtk, iTerm, NameId ); //Cba_ObjSetName( pNtk, iTerm, NameId );
} }
} }
// connect POs // connect POs
...@@ -341,7 +341,7 @@ int Cba_NtkDeriveFromPtr( Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vMap, ...@@ -341,7 +341,7 @@ int Cba_NtkDeriveFromPtr( Cba_Ntk_t * pNtk, Vec_Ptr_t * vNtk, Vec_Int_t * vMap,
if ( Vec_IntGetEntryFull(vMap, NameId) == -1 ) if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
printf( "PO with name \"%s\" in not driven in module \"%s\".\n", pName, pModuleName ); printf( "PO with name \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
iObj = Cba_ObjAlloc( pNtk, CBA_OBJ_PO, Vec_IntGetEntryFull(vMap, NameId) ); iObj = Cba_ObjAlloc( pNtk, CBA_OBJ_PO, Vec_IntGetEntryFull(vMap, NameId) );
Cba_ObjSetName( pNtk, iObj, NameId ); //Cba_ObjSetName( pNtk, iObj, NameId );
} }
// update map // update map
Cba_NtkForEachCi( pNtk, iObj ) Cba_NtkForEachCi( pNtk, iObj )
......
...@@ -275,6 +275,7 @@ void Cba_ManWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p ) ...@@ -275,6 +275,7 @@ void Cba_ManWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p )
fprintf( pFile, "%s.%s(%s)", Cba_BoxBiNum(p, i) ? ", " : "", Mio_GateReadOutName(pGate), Cba_ObjNameStr(p, iTerm) ); fprintf( pFile, "%s.%s(%s)", Cba_BoxBiNum(p, i) ? ", " : "", Mio_GateReadOutName(pGate), Cba_ObjNameStr(p, iTerm) );
fprintf( pFile, ");\n" ); fprintf( pFile, ");\n" );
} }
/*
else if ( Cba_BoxNtkId(p, i) ) else if ( Cba_BoxNtkId(p, i) )
{ {
int pRanges[8]; char pSymbs[8]; int pRanges[8]; char pSymbs[8];
...@@ -323,6 +324,7 @@ void Cba_ManWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p ) ...@@ -323,6 +324,7 @@ void Cba_ManWriteVerilogBoxes( FILE * pFile, Cba_Ntk_t * p )
} }
fprintf( pFile, ") );\n" ); fprintf( pFile, ") );\n" );
} }
*/
else else
{ {
Cba_ObjType_t Type = Cba_ObjType( p, i ); Cba_ObjType_t Type = Cba_ObjType( p, i );
......
...@@ -667,7 +667,6 @@ Wlc_Ntk_t * Wlc_ReadSmtBuffer( char * pFileName, char * pBuffer, char * pLimit ) ...@@ -667,7 +667,6 @@ Wlc_Ntk_t * Wlc_ReadSmtBuffer( char * pFileName, char * pBuffer, char * pLimit )
Wlc_Ntk_t * Wlc_ReadSmt( char * pFileName ) Wlc_Ntk_t * Wlc_ReadSmt( char * pFileName )
{ {
Wlc_Ntk_t * pNtk = NULL; Wlc_Ntk_t * pNtk = NULL;
Prs_Smt_t * p = NULL;
char * pBuffer, * pLimit; char * pBuffer, * pLimit;
pBuffer = Prs_SmtLoadFile( pFileName, &pLimit ); pBuffer = Prs_SmtLoadFile( pFileName, &pLimit );
if ( pBuffer == NULL ) if ( pBuffer == NULL )
......
...@@ -1505,6 +1505,7 @@ int Extra_bddCountCubes( DdManager * dd, DdNode ** pFuncs, int nFuncs, int fDire ...@@ -1505,6 +1505,7 @@ int Extra_bddCountCubes( DdManager * dd, DdNode ** pFuncs, int nFuncs, int fDire
CounterAll += Abc_MinInt( Count0, Count1 ); CounterAll += Abc_MinInt( Count0, Count1 );
if ( CounterAll > nLimit ) if ( CounterAll > nLimit )
break; break;
//printf( "Output %d has %d cubes\n", i, Abc_MinInt(Count0, Count1) );
} }
dd->maxLive = saveLimit; dd->maxLive = saveLimit;
st__free_table( table ); st__free_table( table );
......
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