mirror of https://github.com/YosysHQ/abc.git
New APIs for AIG package.
This commit is contained in:
parent
03b786af99
commit
5e35510e25
|
|
@ -554,9 +554,11 @@ static inline int Gia_ObjFaninIdp( Gia_Man_t * p, Gia_Obj_t * pObj, int
|
|||
static inline int Gia_ObjFaninLit0( Gia_Obj_t * pObj, int ObjId ) { return Abc_Var2Lit( Gia_ObjFaninId0(pObj, ObjId), Gia_ObjFaninC0(pObj) ); }
|
||||
static inline int Gia_ObjFaninLit1( Gia_Obj_t * pObj, int ObjId ) { return Abc_Var2Lit( Gia_ObjFaninId1(pObj, ObjId), Gia_ObjFaninC1(pObj) ); }
|
||||
static inline int Gia_ObjFaninLit2( Gia_Man_t * p, int ObjId ) { return (p->pMuxes && p->pMuxes[ObjId]) ? p->pMuxes[ObjId] : -1; }
|
||||
static inline int Gia_ObjFaninLit( Gia_Obj_t * pObj, int ObjId, int n ){ return n ? Gia_ObjFaninLit1(pObj, ObjId) : Gia_ObjFaninLit0(pObj, ObjId);}
|
||||
static inline int Gia_ObjFaninLit0p( Gia_Man_t * p, Gia_Obj_t * pObj) { return Abc_Var2Lit( Gia_ObjFaninId0p(p, pObj), Gia_ObjFaninC0(pObj) ); }
|
||||
static inline int Gia_ObjFaninLit1p( Gia_Man_t * p, Gia_Obj_t * pObj) { return Abc_Var2Lit( Gia_ObjFaninId1p(p, pObj), Gia_ObjFaninC1(pObj) ); }
|
||||
static inline int Gia_ObjFaninLit2p( Gia_Man_t * p, Gia_Obj_t * pObj) { return (p->pMuxes && p->pMuxes[Gia_ObjId(p, pObj)]) ? p->pMuxes[Gia_ObjId(p, pObj)] : -1; }
|
||||
static inline int Gia_ObjFaninLitp( Gia_Man_t * p, Gia_Obj_t * pObj, int n ){ return n ? Gia_ObjFaninLit1p(p, pObj) : Gia_ObjFaninLit0p(p, pObj);}
|
||||
static inline void Gia_ObjFlipFaninC0( Gia_Obj_t * pObj ) { assert( Gia_ObjIsCo(pObj) ); pObj->fCompl0 ^= 1; }
|
||||
static inline int Gia_ObjFaninNum( Gia_Man_t * p, Gia_Obj_t * pObj ) { if ( Gia_ObjIsMux(p, pObj) ) return 3; if ( Gia_ObjIsAnd(pObj) ) return 2; if ( Gia_ObjIsCo(pObj) ) return 1; return 0; }
|
||||
static inline int Gia_ObjWhatFanin( Gia_Man_t * p, Gia_Obj_t * pObj, Gia_Obj_t * pFanin ) { if ( Gia_ObjFanin0(pObj) == pFanin ) return 0; if ( Gia_ObjFanin1(pObj) == pFanin ) return 1; if ( Gia_ObjFanin2(p, pObj) == pFanin ) return 2; assert(0); return -1; }
|
||||
|
|
@ -1729,6 +1731,7 @@ extern word Gia_ManRandomW( int fReset );
|
|||
extern void Gia_ManRandomInfo( Vec_Ptr_t * vInfo, int iInputStart, int iWordStart, int iWordStop );
|
||||
extern char * Gia_TimeStamp();
|
||||
extern char * Gia_FileNameGenericAppend( char * pBase, char * pSuffix );
|
||||
extern Vec_Ptr_t * Gia_GetFakeNames( int nNames, int fCaps );
|
||||
extern void Gia_ManIncrementTravId( Gia_Man_t * p );
|
||||
extern void Gia_ManCleanMark01( Gia_Man_t * p );
|
||||
extern void Gia_ManSetMark0( Gia_Man_t * p );
|
||||
|
|
@ -1755,6 +1758,7 @@ extern Vec_Int_t * Gia_ManReverseLevel( Gia_Man_t * p );
|
|||
extern Vec_Int_t * Gia_ManRequiredLevel( Gia_Man_t * p );
|
||||
extern void Gia_ManCreateValueRefs( Gia_Man_t * p );
|
||||
extern void Gia_ManCreateRefs( Gia_Man_t * p );
|
||||
extern void Gia_ManCreateLitRefs( Gia_Man_t * p );
|
||||
extern int * Gia_ManCreateMuxRefs( Gia_Man_t * p );
|
||||
extern int Gia_ManCrossCut( Gia_Man_t * p, int fReverse );
|
||||
extern Vec_Int_t * Gia_ManCollectPoIds( Gia_Man_t * p );
|
||||
|
|
|
|||
|
|
@ -42,42 +42,6 @@ extern int Gia_ManFactorNode( Gia_Man_t * p, char * pSop, Vec_Int_t * vLeaves );
|
|||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Ptr_t * Gia_GetFakeNames( int nNames, int fCaps )
|
||||
{
|
||||
Vec_Ptr_t * vNames;
|
||||
char Buffer[5];
|
||||
int i;
|
||||
|
||||
vNames = Vec_PtrAlloc( nNames );
|
||||
for ( i = 0; i < nNames; i++ )
|
||||
{
|
||||
if ( nNames < 26 )
|
||||
{
|
||||
Buffer[0] = (fCaps ? 'A' : 'a') + i;
|
||||
Buffer[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer[0] = (fCaps ? 'A' : 'a') + i%26;
|
||||
Buffer[1] = '0' + i/26;
|
||||
Buffer[2] = 0;
|
||||
}
|
||||
Vec_PtrPush( vNames, Extra_UtilStrsav(Buffer) );
|
||||
}
|
||||
return vNames;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
|
|||
|
|
@ -140,6 +140,42 @@ char * Gia_FileNameGenericAppend( char * pBase, char * pSuffix )
|
|||
return Buffer;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Ptr_t * Gia_GetFakeNames( int nNames, int fCaps )
|
||||
{
|
||||
Vec_Ptr_t * vNames;
|
||||
char Buffer[5];
|
||||
int i;
|
||||
|
||||
vNames = Vec_PtrAlloc( nNames );
|
||||
for ( i = 0; i < nNames; i++ )
|
||||
{
|
||||
if ( nNames < 26 )
|
||||
{
|
||||
Buffer[0] = (fCaps ? 'A' : 'a') + i;
|
||||
Buffer[1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer[0] = (fCaps ? 'A' : 'a') + i%26;
|
||||
Buffer[1] = '0' + i/26;
|
||||
Buffer[2] = 0;
|
||||
}
|
||||
Vec_PtrPush( vNames, Extra_UtilStrsav(Buffer) );
|
||||
}
|
||||
return vNames;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -760,6 +796,23 @@ void Gia_ManCreateRefs( Gia_Man_t * p )
|
|||
Gia_ObjRefFanin0Inc( p, pObj );
|
||||
}
|
||||
}
|
||||
void Gia_ManCreateLitRefs( Gia_Man_t * p )
|
||||
{
|
||||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
assert( p->pRefs == NULL );
|
||||
p->pRefs = ABC_CALLOC( int, 2*Gia_ManObjNum(p) );
|
||||
Gia_ManForEachObj( p, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsAnd(pObj) )
|
||||
{
|
||||
p->pRefs[Gia_ObjFaninLit0(pObj, i)]++;
|
||||
p->pRefs[Gia_ObjFaninLit1(pObj, i)]++;
|
||||
}
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
p->pRefs[Gia_ObjFaninLit0(pObj, i)]++;
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue