From d92bfbaddc0c0ba1f5eb145f00c079f944257eb6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 20 Mar 2017 23:45:03 -0700 Subject: Experiments with new network data-structure. --- src/base/abc/abcUtil.c | 2 +- src/base/acb/acb.h | 17 +++++++++++++---- src/base/acb/acbAbc.c | 8 +------- src/map/mio/mio.h | 1 + src/map/mio/mioApi.c | 1 + src/misc/vec/vecInt.h | 2 ++ 6 files changed, 19 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c index 65e5e529..dc6cd3b3 100644 --- a/src/base/abc/abcUtil.c +++ b/src/base/abc/abcUtil.c @@ -3123,7 +3123,6 @@ Vec_Wec_t * Abc_SopSynthesize( Vec_Ptr_t * vSops ) Abc_FrameReplaceCurrentNetwork( Abc_FrameReadGlobalFrame(), pNtk ); Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "fx; strash; balance; dc2; map -a" ); pNtkNew = Abc_FrameReadNtk( Abc_FrameReadGlobalFrame() ); - Abc_NtkDelete( pNtk ); vRes = Vec_WecStart( Abc_NtkPiNum(pNtkNew) + Abc_NtkNodeNum(pNtkNew) + Abc_NtkPoNum(pNtkNew) ); Abc_NtkForEachPi( pNtkNew, pObj, i ) pObj->iTemp = iNode++; @@ -3131,6 +3130,7 @@ Vec_Wec_t * Abc_SopSynthesize( Vec_Ptr_t * vSops ) { Vec_Int_t * vNode = Vec_WecEntry(vRes, iNode); Vec_IntPush( vNode, Abc_GateToType(pObj) ); + Vec_IntPush( vNode, iNode ); Abc_ObjForEachFanin( pObj, pFanin, k ) Vec_IntPush( vNode, pFanin->iTemp ); pObj->iTemp = iNode++; diff --git a/src/base/acb/acb.h b/src/base/acb/acb.h index 0979c545..c9d2128d 100644 --- a/src/base/acb/acb.h +++ b/src/base/acb/acb.h @@ -259,8 +259,8 @@ static inline int Acb_ObjRangeSign( Acb_Ntk_t * p, int i ) { r static inline int Acb_ObjTravId( Acb_Ntk_t * p, int i ) { return Vec_IntGetEntry(&p->vObjTrav, i); } static inline int Acb_ObjIsTravIdCur( Acb_Ntk_t * p, int i ) { return Acb_ObjTravId(p, i) == p->nObjTravs; } static inline int Acb_ObjIsTravIdPrev( Acb_Ntk_t * p, int i ) { return Acb_ObjTravId(p, i) == p->nObjTravs-1; } -static inline int Acb_ObjSetTravIdCur( Acb_Ntk_t * p, int i ) { int r = Acb_ObjIsTravIdCur(p, i); Vec_IntWriteEntry(&p->vObjTrav, i, p->nObjTravs); return r; } -static inline int Acb_ObjSetTravIdPrev( Acb_Ntk_t * p, int i ) { int r = Acb_ObjSetTravIdPrev(p, i); Vec_IntWriteEntry(&p->vObjTrav, i, p->nObjTravs-1); return r; } +static inline int Acb_ObjSetTravIdCur( Acb_Ntk_t * p, int i ) { int r = Acb_ObjIsTravIdCur(p, i); Vec_IntWriteEntry(&p->vObjTrav, i, p->nObjTravs); return r; } +static inline int Acb_ObjSetTravIdPrev( Acb_Ntk_t * p, int i ) { int r = Acb_ObjIsTravIdPrev(p, i); Vec_IntWriteEntry(&p->vObjTrav, i, p->nObjTravs-1); return r; } static inline int Acb_NtkTravId( Acb_Ntk_t * p ) { return p->nObjTravs; } static inline void Acb_NtkIncTravId( Acb_Ntk_t * p ) { if ( !Acb_NtkHasObjTravs(p) ) Acb_NtkCleanObjTravs(p); p->nObjTravs++; } @@ -280,17 +280,26 @@ static inline void Acb_NtkIncTravId( Acb_Ntk_t * p ) { i for ( i = 0; (i < Acb_NtkCiNum(p)) && (((iObj) = Acb_NtkCi(p, i)), 1); i++ ) #define Acb_NtkForEachCo( p, iObj, i ) \ for ( i = 0; (i < Acb_NtkCoNum(p)) && (((iObj) = Acb_NtkCo(p, i)), 1); i++ ) +#define Acb_NtkForEachCoDriver( p, iObj, i ) \ + for ( i = 0; (i < Acb_NtkCoNum(p)) && (((iObj) = Acb_ObjFanin(p, Acb_NtkCo(p, i), 0)), 1); i++ ) + +#define Acb_NtkForEachCiVec( vVec, p, iObj, i ) \ + for ( i = 0; (i < Vec_IntSize(vVec)) && (((iObj) = Acb_NtkCi(p, Vec_IntEntry(vVec,i))), 1); i++ ) +#define Acb_NtkForEachCoVec( vVec, p, iObj, i ) \ + for ( i = 0; (i < Vec_IntSize(vVec)) && (((iObj) = Acb_NtkCo(p, Vec_IntEntry(vVec,i))), 1); i++ ) +#define Acb_NtkForEachCoDriverVec( vVec, p, iObj, i ) \ + for ( i = 0; (i < Vec_IntSize(vVec)) && (((iObj) = Acb_ObjFanin(p, Acb_NtkCo(p, Vec_IntEntry(vVec,i)), 0)), 1); i++ ) #define Acb_NtkForEachBoxSeq( p, iObj, i ) \ for ( i = 0; (i < Acb_NtkSeqNum(p)) && (((iObj) = Acb_NtkBoxSeq(p, i)), 1); i++ ) #define Acb_NtkForEachCioOrder( p, iObj, i ) \ for ( i = 0; (i < Acb_NtkCioOrderNum(p)) && (((iObj) = Acb_NtkCioOrder(p, i)), 1); i++ ) -#define Acb_NtkForEachCoDriver( p, iObj, i ) \ - for ( i = 0; (i < Acb_NtkCoNum(p)) && (((iObj) = Acb_ObjFanin(p, Acb_NtkCo(p, i), 0)), 1); i++ ) #define Acb_NtkForEachObj( p, i ) \ for ( i = 1; i < Vec_StrSize(&p->vObjType); i++ ) if ( !Acb_ObjType(p, i) ) {} else +#define Acb_NtkForEachNode( p, i ) \ + for ( i = 1; i < Vec_StrSize(&p->vObjType); i++ ) if ( !Acb_ObjType(p, i) || Acb_ObjIsCio(p, i) ) {} else #define Acb_NtkForEachObjType( p, Type, i ) \ for ( i = 1; i < Vec_StrSize(&p->vObjType) && (((Type) = Acb_ObjType(p, i)), 1); i++ ) if ( !Type ) {} else #define Acb_NtkForEachBox( p, i ) \ diff --git a/src/base/acb/acbAbc.c b/src/base/acb/acbAbc.c index 7aba364e..c726ba73 100644 --- a/src/base/acb/acbAbc.c +++ b/src/base/acb/acbAbc.c @@ -96,13 +96,7 @@ Acb_Ntk_t * Acb_NtkFromNdr( char * pFileName, void * pModule, Abc_Nam_t * pNames ObjId = Acb_ObjAlloc( pNtk, ABC_OPER_CI, 0, 0 ); Vec_IntWriteEntry( vMap, NameId, ObjId ); Acb_ObjSetName( pNtk, ObjId, NameId ); - } - Ndr_ModForEachPi( p, Mod, Obj ) - { - NameId = Ndr_ObjReadBody( p, Obj, NDR_OUTPUT ); - ObjId = Acb_ObjAlloc( pNtk, ABC_OPER_CI, 0, 0 ); - Vec_IntWriteEntry( vMap, NameId, ObjId ); - Acb_ObjSetName( pNtk, ObjId, NameId ); + Acb_ObjSetWeight( pNtk, ObjId, vWeights ? Vec_IntEntry(vWeights, NameId) : 0 ); } Ndr_ModForEachTarget( p, Mod, Obj ) { diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 6e16a57f..a957f33c 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -136,6 +136,7 @@ extern float Mio_LibraryReadAreaInv ( Mio_Library_t * pLib ); extern float Mio_LibraryReadAreaBuf ( Mio_Library_t * pLib ); extern float Mio_LibraryReadAreaNand2 ( Mio_Library_t * pLib ); extern int Mio_LibraryReadGateNameMax( Mio_Library_t * pLib ); +extern void Mio_LibrarySetName ( Mio_Library_t * pLib, char * pName ); extern char * Mio_GateReadName ( Mio_Gate_t * pGate ); extern char * Mio_GateReadOutName ( Mio_Gate_t * pGate ); extern double Mio_GateReadArea ( Mio_Gate_t * pGate ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 38e754a6..90639518 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -64,6 +64,7 @@ float Mio_LibraryReadDelayAigNode ( Mio_Library_t * pLib ) { retur float Mio_LibraryReadAreaInv ( Mio_Library_t * pLib ) { return (float)(pLib->pGateInv? pLib->pGateInv->dArea : 0.0); } float Mio_LibraryReadAreaBuf ( Mio_Library_t * pLib ) { return (float)(pLib->pGateBuf? pLib->pGateBuf->dArea : 0.0); } float Mio_LibraryReadAreaNand2 ( Mio_Library_t * pLib ) { return (float)(pLib->pGateNand2? pLib->pGateNand2->dArea : 0.0); } +void Mio_LibrarySetName ( Mio_Library_t * pLib, char * pName ) { ABC_FREE(pLib->pName); pLib->pName = pName; } /**Function************************************************************* diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index d952518f..092d95b4 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -71,6 +71,8 @@ struct Vec_Int_t_ for ( i = 0; (i+2 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1) && (((Entry3) = Vec_IntEntry(vVec, i+2)), 1); i += 3 ) #define Vec_IntForEachEntryThisNext( vVec, This, Next, i ) \ for ( i = 0, (This) = (Next) = (Vec_IntSize(vVec) ? Vec_IntEntry(vVec, 0) : -1); (i+1 < Vec_IntSize(vVec)) && (((Next) = Vec_IntEntry(vVec, i+1)), 1); i += 2, (This) = (Next) ) +#define Vec_IntForEachEntryInVec( vVec2, vVec, Entry, i ) \ + for ( i = 0; (i < Vec_IntSize(vVec)) && (((Entry) = Vec_IntEntry(vVec2, Vec_IntEntry(vVec, i))), 1); i++ ) //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// -- cgit v1.2.3