mirror of https://github.com/YosysHQ/abc.git
Integrating barrier buffers.
This commit is contained in:
parent
3e2fad3574
commit
1398de7c46
|
|
@ -423,7 +423,7 @@ static inline int Gia_ObjIsXor( Gia_Obj_t * pObj ) {
|
|||
static inline int Gia_ObjIsMuxId( Gia_Man_t * p, int iObj ) { return p->pMuxes && p->pMuxes[iObj] > 0; }
|
||||
static inline int Gia_ObjIsMux( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsMuxId( p, Gia_ObjId(p, pObj) ); }
|
||||
static inline int Gia_ObjIsAndReal( Gia_Man_t * p, Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) && pObj->iDiff0 > pObj->iDiff1 && !Gia_ObjIsMux(p, pObj); }
|
||||
static inline int Gia_ObjIsBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && pObj->iDiff0 != GIA_NONE; }
|
||||
static inline int Gia_ObjIsBarBuf( Gia_Obj_t * pObj ) { return pObj->iDiff0 == pObj->iDiff1 && !pObj->fTerm; }
|
||||
static inline int Gia_ObjIsCand( Gia_Obj_t * pObj ) { return Gia_ObjIsAnd(pObj) || Gia_ObjIsCi(pObj); }
|
||||
static inline int Gia_ObjIsConst0( Gia_Obj_t * pObj ) { return pObj->iDiff0 == GIA_NONE && pObj->iDiff1 == GIA_NONE; }
|
||||
static inline int Gia_ManObjIsConst0( Gia_Man_t * p, Gia_Obj_t * pObj){ return pObj == p->pObjs; }
|
||||
|
|
@ -955,6 +955,8 @@ static inline int Gia_ObjLutIsMux( Gia_Man_t * p, int Id ) { re
|
|||
|
||||
static inline int Gia_ManHasCellMapping( Gia_Man_t * p ) { return p->vCellMapping != NULL; }
|
||||
static inline int Gia_ObjIsCell( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) != 0; }
|
||||
static inline int Gia_ObjIsCellInv( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) == -1; }
|
||||
static inline int Gia_ObjIsCellBuf( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, iLit) == -2; }
|
||||
static inline int Gia_ObjCellSize( Gia_Man_t * p, int iLit ) { return Vec_IntEntry(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit)); }
|
||||
static inline int * Gia_ObjCellFanins( Gia_Man_t * p, int iLit ) { return Vec_IntEntryP(p->vCellMapping, Vec_IntEntry(p->vCellMapping, iLit))+1; }
|
||||
static inline int Gia_ObjCellFanin( Gia_Man_t * p, int iLit, int i ){ return Gia_ObjCellFanins(p, iLit)[i]; }
|
||||
|
|
@ -990,6 +992,10 @@ static inline int Gia_ObjCellId( Gia_Man_t * p, int iLit ) { re
|
|||
for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
|
||||
#define Gia_ManForEachObjReverse1( p, pObj, i ) \
|
||||
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
|
||||
#define Gia_ManForEachBuf( p, pObj, i ) \
|
||||
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsBarBuf(pObj) ) {} else
|
||||
#define Gia_ManForEachBufId( p, i ) \
|
||||
for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsBarBuf(Gia_ManObj(p, i)) ) {} else
|
||||
#define Gia_ManForEachAnd( p, pObj, i ) \
|
||||
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else
|
||||
#define Gia_ManForEachAndId( p, i ) \
|
||||
|
|
|
|||
|
|
@ -294,7 +294,12 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
|
|||
iNode1 = Abc_LitNotCond( Vec_IntEntry(vNodes, uLit1 >> 1), uLit1 & 1 );
|
||||
assert( Vec_IntSize(vNodes) == i + 1 + nInputs + nLatches );
|
||||
if ( fSkipStrash )
|
||||
Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) );
|
||||
{
|
||||
if ( iNode0 == iNode1 )
|
||||
Vec_IntPush( vNodes, Gia_ManAppendBuf(pNew, iNode0) );
|
||||
else
|
||||
Vec_IntPush( vNodes, Gia_ManAppendAnd(pNew, iNode0, iNode1) );
|
||||
}
|
||||
else
|
||||
Vec_IntPush( vNodes, Gia_ManHashAnd(pNew, iNode0, iNode1) );
|
||||
}
|
||||
|
|
@ -1099,7 +1104,7 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
|
|||
uLit = Abc_Var2Lit( i, 0 );
|
||||
uLit0 = Gia_ObjFaninLit0( pObj, i );
|
||||
uLit1 = Gia_ObjFaninLit1( pObj, i );
|
||||
assert( uLit0 < uLit1 );
|
||||
assert( Gia_ManBufNum(p) || uLit0 < uLit1 );
|
||||
Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit - uLit1 );
|
||||
Pos = Gia_AigerWriteUnsignedBuffer( pBuffer, Pos, uLit1 - uLit0 );
|
||||
if ( Pos > nBufferSize - 10 )
|
||||
|
|
|
|||
|
|
@ -999,7 +999,7 @@ Gia_Man_t * Gia_ManDupMarked( Gia_Man_t * p )
|
|||
pObj->Value = Gia_ManAppendXorReal( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||
else if ( Gia_ObjIsMux(p, pObj) )
|
||||
pObj->Value = Gia_ManAppendMuxReal( pNew, Gia_ObjFanin2Copy(p, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
|
||||
else if ( Gia_ObjIsBuf(pObj) )
|
||||
else if ( Gia_ObjIsBarBuf(pObj) )
|
||||
pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
|
||||
else
|
||||
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ float * Jf_ManInitRefs( Jf_Man_t * pMan )
|
|||
Gia_ManForEachAnd( p, pObj, i )
|
||||
{
|
||||
Gia_ObjRefFanin0Inc( p, pObj );
|
||||
if ( Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsBarBuf(pObj) )
|
||||
continue;
|
||||
Gia_ObjRefFanin1Inc( p, pObj );
|
||||
if ( !Gia_ObjIsMuxType(pObj) )
|
||||
|
|
@ -311,7 +311,7 @@ void Jf_ManProfileClasses( Jf_Man_t * p )
|
|||
int i, iFunc, Total = 0, CostTotal = 0, Other = 0, CostOther = 0;
|
||||
printf( "DSD classes that appear in more than %.1f %% of mapped nodes:\n", 0.1 * p->pPars->nVerbLimit );
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
if ( !Gia_ObjIsBuf(pObj) && Gia_ObjRefNumId(p->pGia, i) )
|
||||
if ( !Gia_ObjIsBarBuf(pObj) && Gia_ObjRefNumId(p->pGia, i) )
|
||||
{
|
||||
iFunc = Jf_CutFuncClass( Jf_ObjCutBest(p, i) );
|
||||
assert( iFunc < 595 );
|
||||
|
|
@ -1100,7 +1100,7 @@ static inline void Jf_ObjAssignCut( Jf_Man_t * p, Gia_Obj_t * pObj )
|
|||
{
|
||||
int iObj = Gia_ObjId(p->pGia, pObj);
|
||||
int pClause[3] = { 1, Jf_CutSetAll(2, 0, 1), Jf_ObjLit(iObj, 0) }; // set function
|
||||
assert( Gia_ObjIsCi(pObj) || Gia_ObjIsBuf(pObj) );
|
||||
assert( Gia_ObjIsCi(pObj) || Gia_ObjIsBarBuf(pObj) );
|
||||
Vec_IntWriteEntry( &p->vCuts, iObj, Vec_SetAppend( &p->pMem, pClause, 3 ) );
|
||||
}
|
||||
static inline void Jf_ObjPropagateBuf( Jf_Man_t * p, Gia_Obj_t * pObj, int fReverse )
|
||||
|
|
@ -1108,7 +1108,7 @@ static inline void Jf_ObjPropagateBuf( Jf_Man_t * p, Gia_Obj_t * pObj, int fReve
|
|||
int iObj = Gia_ObjId( p->pGia, pObj );
|
||||
int iFanin = Gia_ObjFaninId0( pObj, iObj );
|
||||
assert( 0 );
|
||||
assert( Gia_ObjIsBuf(pObj) );
|
||||
assert( Gia_ObjIsBarBuf(pObj) );
|
||||
if ( fReverse )
|
||||
ABC_SWAP( int, iObj, iFanin );
|
||||
Vec_IntWriteEntry( &p->vArr, iObj, Jf_ObjArr(p, iFanin) );
|
||||
|
|
@ -1247,9 +1247,9 @@ void Jf_ManComputeCuts( Jf_Man_t * p, int fEdge )
|
|||
}
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsCi(pObj) || Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsCi(pObj) || Gia_ObjIsBarBuf(pObj) )
|
||||
Jf_ObjAssignCut( p, pObj );
|
||||
if ( Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsBarBuf(pObj) )
|
||||
Jf_ObjPropagateBuf( p, pObj, 0 );
|
||||
else if ( Gia_ObjIsAnd(pObj) )
|
||||
Jf_ObjComputeCuts( p, pObj, fEdge );
|
||||
|
|
@ -1291,7 +1291,7 @@ int Jf_ManComputeDelay( Jf_Man_t * p, int fEval )
|
|||
if ( fEval )
|
||||
{
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
if ( Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsBarBuf(pObj) )
|
||||
Jf_ObjPropagateBuf( p, pObj, 0 );
|
||||
else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 )
|
||||
Vec_IntWriteEntry( &p->vArr, i, Jf_CutArr(p, Jf_ObjCutBest(p, i)) );
|
||||
|
|
@ -1314,7 +1314,7 @@ int Jf_ManComputeRefs( Jf_Man_t * p )
|
|||
p->pPars->Area = p->pPars->Edge = 0;
|
||||
Gia_ManForEachObjReverse( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBarBuf(pObj) )
|
||||
Gia_ObjRefInc( p->pGia, Gia_ObjFanin0(pObj) );
|
||||
else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 )
|
||||
{
|
||||
|
|
@ -1381,7 +1381,7 @@ void Jf_ManPropagateFlow( Jf_Man_t * p, int fEdge )
|
|||
Gia_Obj_t * pObj;
|
||||
int i;
|
||||
Gia_ManForEachObj( p->pGia, pObj, i )
|
||||
if ( Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsBarBuf(pObj) )
|
||||
Jf_ObjPropagateBuf( p, pObj, 0 );
|
||||
else if ( Gia_ObjIsAnd(pObj) && Jf_ObjIsUnit(pObj) )
|
||||
Jf_ObjComputeBestCut( p, pObj, fEdge, 0 );
|
||||
|
|
@ -1393,7 +1393,7 @@ void Jf_ManPropagateEla( Jf_Man_t * p, int fEdge )
|
|||
int i, CostBef, CostAft;
|
||||
p->pPars->Area = p->pPars->Edge = p->pPars->Clause = 0;
|
||||
Gia_ManForEachObjReverse( p->pGia, pObj, i )
|
||||
if ( Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsBarBuf(pObj) )
|
||||
Jf_ObjPropagateBuf( p, pObj, 1 );
|
||||
else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 )
|
||||
{
|
||||
|
|
@ -1457,7 +1457,7 @@ Gia_Man_t * Jf_ManDeriveMappingGia( Jf_Man_t * p )
|
|||
// iterate through nodes used in the mapping
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
continue;
|
||||
pCut = Jf_ObjCutBest( p, i );
|
||||
// printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut);
|
||||
|
|
@ -1549,7 +1549,7 @@ void Jf_ManDeriveMapping( Jf_Man_t * p )
|
|||
Vec_IntFill( vMapping, Gia_ManObjNum(p->pGia), 0 );
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
continue;
|
||||
pCut = Jf_ObjCutBest( p, i );
|
||||
Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
|
||||
|
|
@ -1599,7 +1599,7 @@ Gia_Man_t * Jf_ManDeriveGia( Jf_Man_t * p )
|
|||
Gia_ManHashStart( pNew );
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
continue;
|
||||
pCut = Jf_ObjCutBest( p, i );
|
||||
// printf( "Best cut of node %d: ", i ); Jf_CutPrint(pCut);
|
||||
|
|
|
|||
|
|
@ -914,7 +914,7 @@ int Kf_ManComputeRefs( Kf_Man_t * p )
|
|||
p->pPars->Area = p->pPars->Edge = 0;
|
||||
Gia_ManForEachObjReverse( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBuf(pObj) )
|
||||
if ( Gia_ObjIsCo(pObj) || Gia_ObjIsBarBuf(pObj) )
|
||||
Gia_ObjRefInc( p->pGia, Gia_ObjFanin0(pObj) );
|
||||
else if ( Gia_ObjIsAnd(pObj) && Gia_ObjRefNum(p->pGia, pObj) > 0 )
|
||||
{
|
||||
|
|
@ -1270,7 +1270,7 @@ Gia_Man_t * Kf_ManDerive( Kf_Man_t * p )
|
|||
Vec_IntFill( vMapping, Gia_ManObjNum(p->pGia), 0 );
|
||||
Gia_ManForEachAnd( p->pGia, pObj, i )
|
||||
{
|
||||
if ( Gia_ObjIsBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
if ( Gia_ObjIsBarBuf(pObj) || Gia_ObjRefNum(p->pGia, pObj) == 0 )
|
||||
continue;
|
||||
pCut = Kf_ObjCutBest( p, i );
|
||||
Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
|
||||
|
|
|
|||
|
|
@ -436,6 +436,8 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
|
|||
Abc_Print( 1, " ch =%5d", Gia_ManChoiceNum(p) );
|
||||
if ( p->pManTime )
|
||||
Abc_Print( 1, " box = %d", Gia_ManNonRegBoxNum(p) );
|
||||
if ( Gia_ManBufNum(p) )
|
||||
Abc_Print( 1, " buf = %d", Gia_ManBufNum(p) );
|
||||
if ( pPars && pPars->fMuxXor )
|
||||
printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
|
||||
if ( pPars && pPars->fSwitch )
|
||||
|
|
|
|||
|
|
@ -882,7 +882,7 @@ int Gia_ObjIsMuxType( Gia_Obj_t * pNode )
|
|||
// check that the node is regular
|
||||
assert( !Gia_IsComplement(pNode) );
|
||||
// if the node is not AND, this is not MUX
|
||||
if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBuf(pNode) )
|
||||
if ( !Gia_ObjIsAnd(pNode) || Gia_ObjIsBarBuf(pNode) )
|
||||
return 0;
|
||||
// if the children are not complemented, this is not MUX
|
||||
if ( !Gia_ObjFaninC0(pNode) || !Gia_ObjFaninC1(pNode) )
|
||||
|
|
@ -916,7 +916,7 @@ int Gia_ObjRecognizeExor( Gia_Obj_t * pObj, Gia_Obj_t ** ppFan0, Gia_Obj_t ** pp
|
|||
{
|
||||
Gia_Obj_t * p0, * p1;
|
||||
assert( !Gia_IsComplement(pObj) );
|
||||
if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBuf(pObj) )
|
||||
if ( !Gia_ObjIsAnd(pObj) || Gia_ObjIsBarBuf(pObj) )
|
||||
return 0;
|
||||
assert( Gia_ObjIsAnd(pObj) );
|
||||
p0 = Gia_ObjChild0(pObj);
|
||||
|
|
@ -1273,7 +1273,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
|
|||
printf( "RO( %4d%s )", Gia_ObjFaninId0p(p, Gia_ObjRoToRi(p, pObj)), (Gia_ObjFaninC0(Gia_ObjRoToRi(p, pObj))? "\'" : " ") );
|
||||
else if ( Gia_ObjIsCo(pObj) )
|
||||
printf( "RI( %4d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
|
||||
// else if ( Gia_ObjIsBuf(pObj) )
|
||||
// else if ( Gia_ObjIsBarBuf(pObj) )
|
||||
// printf( "BUF( %d%s )", Gia_ObjFaninId0p(p, pObj), (Gia_ObjFaninC0(pObj)? "\'" : " ") );
|
||||
else if ( Gia_ObjIsXor(pObj) )
|
||||
printf( "XOR( %4d%s, %4d%s )",
|
||||
|
|
@ -1308,7 +1308,7 @@ void Gia_ObjPrint( Gia_Man_t * p, Gia_Obj_t * pObj )
|
|||
printf( "Node %4d : ", Gia_ObjId(pFanout) );
|
||||
if ( Gia_ObjIsPo(pFanout) )
|
||||
printf( "PO( %4d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
|
||||
else if ( Gia_ObjIsBuf(pFanout) )
|
||||
else if ( Gia_ObjIsBarBuf(pFanout) )
|
||||
printf( "BUF( %d%s )", Gia_ObjFanin0(pFanout)->Id, (Gia_ObjFaninC0(pFanout)? "\'" : " ") );
|
||||
else
|
||||
printf( "AND( %4d%s, %4d%s )",
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ struct Abc_Ntk_t_
|
|||
int nObjs; // the number of live objs
|
||||
int nConstrs; // the number of constraints
|
||||
int nBarBufs; // the number of barrier buffers
|
||||
int nBarBufs2; // the number of barrier buffers
|
||||
// the backup network and the step number
|
||||
Abc_Ntk_t * pNetBackup; // the pointer to the previous backup network
|
||||
int iStep; // the generation number for the given network
|
||||
|
|
@ -356,7 +357,7 @@ static inline int Abc_ObjIsLatch( Abc_Obj_t * pObj ) { return pO
|
|||
static inline int Abc_ObjIsBox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_LATCH || pObj->Type == ABC_OBJ_WHITEBOX || pObj->Type == ABC_OBJ_BLACKBOX; }
|
||||
static inline int Abc_ObjIsWhitebox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_WHITEBOX;}
|
||||
static inline int Abc_ObjIsBlackbox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_BLACKBOX;}
|
||||
static inline int Abc_ObjIsBarBuf( Abc_Obj_t * pObj ) { assert( Abc_NtkIsMappedLogic(pObj->pNtk) ); return Vec_IntSize(&pObj->vFanins) == 1 && pObj->pData == NULL; }
|
||||
static inline int Abc_ObjIsBarBuf( Abc_Obj_t * pObj ) { assert( Abc_NtkIsLogic(pObj->pNtk) ); return Vec_IntSize(&pObj->vFanins) == 1 && pObj->pData == NULL; }
|
||||
static inline void Abc_ObjBlackboxToWhitebox( Abc_Obj_t * pObj ) { assert( Abc_ObjIsBlackbox(pObj) ); pObj->Type = ABC_OBJ_WHITEBOX; pObj->pNtk->nObjCounts[ABC_OBJ_BLACKBOX]--; pObj->pNtk->nObjCounts[ABC_OBJ_WHITEBOX]++; }
|
||||
|
||||
// working with fanin/fanout edges
|
||||
|
|
|
|||
|
|
@ -527,6 +527,8 @@ int Abc_NtkCheckNode( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode )
|
|||
// the node should have a function assigned unless it is an AIG
|
||||
if ( pNode->pData == NULL )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
return 1;
|
||||
fprintf( stdout, "NodeCheck: An internal node \"%s\" does not have a logic function.\n", Abc_ObjNameNet(pNode) );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,7 @@ int Abc_NtkLevel_rec( Abc_Obj_t * pNode )
|
|||
if ( pNode->Level < (unsigned)Level )
|
||||
pNode->Level = Level;
|
||||
}
|
||||
if ( Abc_ObjFaninNum(pNode) > 0 )
|
||||
if ( Abc_ObjFaninNum(pNode) > 0 && !Abc_ObjIsBarBuf(pNode) )
|
||||
pNode->Level++;
|
||||
return pNode->Level;
|
||||
}
|
||||
|
|
@ -1216,7 +1216,7 @@ int Abc_NtkLevelReverse_rec( Abc_Obj_t * pNode )
|
|||
if ( pNode->Level < (unsigned)Level )
|
||||
pNode->Level = Level;
|
||||
}
|
||||
if ( Abc_ObjFaninNum(pNode) > 0 )
|
||||
if ( Abc_ObjFaninNum(pNode) > 0 && !Abc_ObjIsBarBuf(pNode) )
|
||||
pNode->Level++;
|
||||
return pNode->Level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk )
|
|||
// convert each node from SOP to BDD
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
assert( pNode->pData );
|
||||
if ( Abc_ObjFaninNum(pNode) > 10 )
|
||||
{
|
||||
|
|
@ -379,6 +381,8 @@ int Abc_NtkBddToSop( Abc_Ntk_t * pNtk, int fDirect )
|
|||
vCube = Vec_StrAlloc( 100 );
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
assert( pNode->pData );
|
||||
bFunc = (DdNode *)pNode->pData;
|
||||
pNode->pNext = (Abc_Obj_t *)Abc_ConvertBddToSop( pManNew, dd, bFunc, bFunc, Abc_ObjFaninNum(pNode), 0, vCube, fMode );
|
||||
|
|
@ -400,6 +404,8 @@ int Abc_NtkBddToSop( Abc_Ntk_t * pNtk, int fDirect )
|
|||
// transfer from next to data
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
Cudd_RecursiveDeref( dd, (DdNode *)pNode->pData );
|
||||
pNode->pData = pNode->pNext;
|
||||
pNode->pNext = NULL;
|
||||
|
|
@ -513,7 +519,7 @@ void Abc_NtkLogicMakeDirectSops( Abc_Ntk_t * pNtk )
|
|||
// check if there are nodes with complemented SOPs
|
||||
fFound = 0;
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
if ( Abc_SopIsComplement((char *)pNode->pData) )
|
||||
if ( !Abc_ObjIsBarBuf(pNode) && Abc_SopIsComplement((char *)pNode->pData) )
|
||||
{
|
||||
fFound = 1;
|
||||
break;
|
||||
|
|
@ -530,7 +536,7 @@ void Abc_NtkLogicMakeDirectSops( Abc_Ntk_t * pNtk )
|
|||
// change the cover of negated nodes
|
||||
vCube = Vec_StrAlloc( 100 );
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
if ( Abc_SopIsComplement((char *)pNode->pData) )
|
||||
if ( !Abc_ObjIsBarBuf(pNode) && Abc_SopIsComplement((char *)pNode->pData) )
|
||||
{
|
||||
bFunc = Abc_ConvertSopToBdd( dd, (char *)pNode->pData, NULL ); Cudd_Ref( bFunc );
|
||||
pNode->pData = Abc_ConvertBddToSop( (Mem_Flex_t *)pNtk->pManFunc, dd, bFunc, bFunc, Abc_ObjFaninNum(pNode), 0, vCube, 1 );
|
||||
|
|
@ -620,6 +626,8 @@ int Abc_NtkSopToAig( Abc_Ntk_t * pNtk )
|
|||
// convert each node from SOP to BDD
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
assert( pNode->pData );
|
||||
pNode->pData = Abc_ConvertSopToAig( pMan, (char *)pNode->pData );
|
||||
if ( pNode->pData == NULL )
|
||||
|
|
@ -726,6 +734,7 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
|
|||
{
|
||||
Abc_Obj_t * pNode;
|
||||
Hop_Man_t * pMan;
|
||||
DdNode * pFunc;
|
||||
DdManager * dd, * ddTemp = NULL;
|
||||
Vec_Int_t * vFanins = NULL;
|
||||
int nFaninsMax, i, k, iVar;
|
||||
|
|
@ -753,7 +762,9 @@ int Abc_NtkAigToBdd( Abc_Ntk_t * pNtk )
|
|||
// convert each node from SOP to BDD
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
DdNode * pFunc = Abc_ConvertAigToBdd( ddTemp, (Hop_Obj_t *)pNode->pData );
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
pFunc = Abc_ConvertAigToBdd( ddTemp, (Hop_Obj_t *)pNode->pData );
|
||||
if ( pFunc == NULL )
|
||||
{
|
||||
printf( "Abc_NtkAigToBdd: Error while converting AIG into BDD.\n" );
|
||||
|
|
@ -944,12 +955,18 @@ Gia_Man_t * Abc_NtkAigToGia( Abc_Ntk_t * p )
|
|||
// find the number of objects
|
||||
nObjs = 1 + Abc_NtkCiNum(p) + Abc_NtkCoNum(p);
|
||||
Abc_NtkForEachNode( p, pNode, i )
|
||||
nObjs += Hop_DagSize( (Hop_Obj_t *)pNode->pData );
|
||||
nObjs += Abc_ObjIsBarBuf(pNode) ? 1 : Hop_DagSize( (Hop_Obj_t *)pNode->pData );
|
||||
vMapping = Vec_IntStart( nObjs );
|
||||
// iterate through nodes used in the mapping
|
||||
vNodes = Abc_NtkDfs( p, 0 );
|
||||
Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
{
|
||||
assert( !Abc_ObjFaninC0(pNode) );
|
||||
pNode->iTemp = Gia_ManAppendBuf( pNew, Abc_ObjFanin0(pNode)->iTemp );
|
||||
continue;
|
||||
}
|
||||
Abc_ObjForEachFanin( pNode, pFanin, k )
|
||||
Hop_ManPi(pHopMan, k)->iData = pFanin->iTemp;
|
||||
pHopObj = Hop_Regular( (Hop_Obj_t *)pNode->pData );
|
||||
|
|
@ -1068,6 +1085,8 @@ int Abc_NtkMapToSop( Abc_Ntk_t * pNtk )
|
|||
// update the nodes
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
continue;
|
||||
pSop = Mio_GateReadSop((Mio_Gate_t *)pNode->pData);
|
||||
assert( Abc_SopGetVarNum(pSop) == Abc_ObjFaninNum(pNode) );
|
||||
pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, pSop );
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ void Abc_NtkFlattenLogicHierarchy_rec( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, in
|
|||
// process the blackbox
|
||||
if ( Abc_NtkHasBlackbox(pNtk) )
|
||||
{
|
||||
printf( "Flatting black box \"%s\".\n", pNtk->pName );
|
||||
// duplicate the blackbox
|
||||
assert( Abc_NtkBoxNum(pNtk) == 1 );
|
||||
pObj = Abc_NtkBox( pNtk, 0 );
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ double Abc_NtkGetMappedArea( Abc_Ntk_t * pNtk )
|
|||
TotalArea = 0.0;
|
||||
Abc_NtkForEachNode( pNtk, pObj, i )
|
||||
{
|
||||
if ( Abc_ObjIsBarBuf(pObj) )
|
||||
continue;
|
||||
// assert( pObj->pData );
|
||||
if ( pObj->pData == NULL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26396,6 +26396,11 @@ int Abc_CommandAbc9Show( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Abc_CommandAbc9Show(): There is no AIG.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( Gia_ManBufNum(pAbc->pGia) )
|
||||
{
|
||||
Abc_Print( -1, "Abc_CommandAbc9Show(): Cannot show GIA with barrier buffers.\n" );
|
||||
return 1;
|
||||
}
|
||||
pMan = Gia_ManToAigSimple( pAbc->pGia );
|
||||
Aig_ManShow( pMan, 0, NULL );
|
||||
Aig_ManStop( pMan );
|
||||
|
|
|
|||
|
|
@ -820,6 +820,8 @@ static inline Abc_Obj_t * Abc_NtkFromCellRead( Abc_Ntk_t * p, Vec_Int_t * vCopyL
|
|||
int iObjNew = Vec_IntEntry( vCopyLits, Abc_Var2Lit(i, c) );
|
||||
if ( iObjNew >= 0 )
|
||||
return Abc_NtkObj(p, iObjNew);
|
||||
// opposite phase should be already constructed
|
||||
assert( 0 );
|
||||
if ( i == 0 )
|
||||
pObjNew = c ? Abc_NtkCreateNodeConst1(p) : Abc_NtkCreateNodeConst0(p);
|
||||
else
|
||||
|
|
@ -838,7 +840,7 @@ Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p )
|
|||
Vec_Int_t * vCopyLits;
|
||||
Abc_Obj_t * pObjNew, * pObjNewLi, * pObjNewLo;
|
||||
Gia_Obj_t * pObj, * pObjLi, * pObjLo;
|
||||
int i, k, iLit, iFanLit, nDupGates, nCells;
|
||||
int i, k, iLit, iFanLit, nDupGates, nCells, fNeedConst[2] = {0};
|
||||
Mio_Cell_t * pCells = Mio_CollectRootsNewDefault( 6, &nCells, 0 );
|
||||
assert( Gia_ManHasCellMapping(p) );
|
||||
// start network
|
||||
|
|
@ -867,16 +869,74 @@ Abc_Ntk_t * Abc_NtkFromCellMappedGia( Gia_Man_t * p )
|
|||
Abc_NtkFromCellWrite( vCopyLits, Gia_ObjId(p, pObjLo), 0, Abc_ObjId( pObjNewLo ) );
|
||||
Abc_LatchSetInit0( pObjNew );
|
||||
}
|
||||
|
||||
// create constants
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
if ( Gia_ObjFaninId0p(p, pObj) == 0 )
|
||||
fNeedConst[Gia_ObjFaninC0(pObj)] = 1;
|
||||
if ( Gia_ManBufNum(p) )
|
||||
Gia_ManForEachBuf( p, pObj, i )
|
||||
if ( Gia_ObjFaninId0p(p, pObj) == 0 )
|
||||
fNeedConst[Gia_ObjFaninC0(pObj)] = 1;
|
||||
if ( fNeedConst[0] )
|
||||
Abc_NtkFromCellWrite( vCopyLits, 0, 0, Abc_ObjId(Abc_NtkCreateNodeConst0(pNtkNew)) );
|
||||
if ( fNeedConst[1] )
|
||||
Abc_NtkFromCellWrite( vCopyLits, 0, 1, Abc_ObjId(Abc_NtkCreateNodeConst1(pNtkNew)) );
|
||||
|
||||
// rebuild the AIG
|
||||
Gia_ManForEachCell( p, iLit )
|
||||
{
|
||||
assert( Vec_IntEntry(vCopyLits, iLit) == -1 );
|
||||
pObjNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Gia_CellForEachFanin( p, iLit, iFanLit, k )
|
||||
int fSkip = 0;
|
||||
if ( Gia_ObjIsCellBuf(p, iLit) )
|
||||
{
|
||||
assert( !Abc_LitIsCompl(iLit) );
|
||||
// build buffer
|
||||
pObjNew = Abc_NtkCreateNode( pNtkNew );
|
||||
iFanLit = Gia_ObjFaninLit0p( p, Gia_ManObj(p, Abc_Lit2Var(iLit)) );
|
||||
Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
|
||||
pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[Gia_ObjCellId(p, iLit)].pName, NULL );
|
||||
pObjNew->pData = NULL; // barrier buffer
|
||||
assert( Abc_ObjIsBarBuf(pObjNew) );
|
||||
pNtkNew->nBarBufs2++;
|
||||
}
|
||||
else if ( Gia_ObjIsCellInv(p, iLit) )
|
||||
{
|
||||
int iLitNot = Abc_LitNot(iLit);
|
||||
if ( !Abc_LitIsCompl(iLit) ) // positive phase
|
||||
{
|
||||
// build negative phase
|
||||
assert( Vec_IntEntry(vCopyLits, iLitNot) == -1 );
|
||||
assert( Gia_ObjCellId(p, iLitNot) > 0 );
|
||||
pObjNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Gia_CellForEachFanin( p, iLitNot, iFanLit, k )
|
||||
Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
|
||||
pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[Gia_ObjCellId(p, iLitNot)].pName, NULL );
|
||||
Abc_NtkFromCellWrite( vCopyLits, Abc_Lit2Var(iLitNot), Abc_LitIsCompl(iLitNot), Abc_ObjId(pObjNew) );
|
||||
fSkip = 1;
|
||||
}
|
||||
else // negative phase
|
||||
{
|
||||
// positive phase is available
|
||||
assert( Vec_IntEntry(vCopyLits, iLitNot) != -1 );
|
||||
}
|
||||
// build inverter
|
||||
pObjNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLitNot)) );
|
||||
pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[3].pName, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( Gia_ObjCellId(p, iLit) > 0 );
|
||||
pObjNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Gia_CellForEachFanin( p, iLit, iFanLit, k )
|
||||
Abc_ObjAddFanin( pObjNew, Abc_NtkFromCellRead(pNtkNew, vCopyLits, Abc_Lit2Var(iFanLit), Abc_LitIsCompl(iFanLit)) );
|
||||
pObjNew->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)pNtkNew->pManFunc, pCells[Gia_ObjCellId(p, iLit)].pName, NULL );
|
||||
}
|
||||
assert( Vec_IntEntry(vCopyLits, iLit) == -1 );
|
||||
Abc_NtkFromCellWrite( vCopyLits, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLit), Abc_ObjId(pObjNew) );
|
||||
// skip next
|
||||
iLit += fSkip;
|
||||
}
|
||||
|
||||
// connect the PO nodes
|
||||
Gia_ManForEachCo( p, pObj, i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -306,7 +306,9 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
|
|||
// Abc_Print( 1," var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) );
|
||||
}
|
||||
else
|
||||
Abc_Print( 1," lev =%3d", Abc_NtkLevel(pNtk) );
|
||||
Abc_Print( 1," lev = %d", Abc_NtkLevel(pNtk) );
|
||||
if ( pNtk->nBarBufs2 )
|
||||
Abc_Print( 1," buf = %d", pNtk->nBarBufs2 );
|
||||
if ( fUseLutLib && Abc_FrameReadLibLut() )
|
||||
Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) );
|
||||
if ( fUseLutLib && Abc_FrameReadLibLut() )
|
||||
|
|
|
|||
|
|
@ -412,7 +412,6 @@ int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fAddPos )
|
|||
***********************************************************************/
|
||||
void Abc_NtkStrashPerform( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew, int fAllNodes, int fRecord )
|
||||
{
|
||||
// ProgressBar * pProgress;
|
||||
Vec_Ptr_t * vNodes;
|
||||
Abc_Obj_t * pNodeOld;
|
||||
int i; //, clk = Abc_Clock();
|
||||
|
|
@ -422,13 +421,13 @@ void Abc_NtkStrashPerform( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew, int fAllNod
|
|||
vNodes = Abc_NtkDfsIter( pNtkOld, fAllNodes );
|
||||
//printf( "Nodes = %d. ", Vec_PtrSize(vNodes) );
|
||||
//ABC_PRT( "Time", Abc_Clock() - clk );
|
||||
// pProgress = Extra_ProgressBarStart( stdout, vNodes->nSize );
|
||||
Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNodeOld, i )
|
||||
{
|
||||
// Extra_ProgressBarUpdate( pProgress, i, NULL );
|
||||
pNodeOld->pCopy = Abc_NodeStrash( pNtkNew, pNodeOld, fRecord );
|
||||
if ( Abc_ObjIsBarBuf(pNodeOld) )
|
||||
pNodeOld->pCopy = Abc_ObjChild0Copy(pNodeOld);
|
||||
else
|
||||
pNodeOld->pCopy = Abc_NodeStrash( pNtkNew, pNodeOld, fRecord );
|
||||
}
|
||||
// Extra_ProgressBarStop( pProgress );
|
||||
Vec_PtrFree( vNodes );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -828,6 +828,13 @@ void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode, Vec_Int_t * vSlacks )
|
|||
// start the arrival time of the node
|
||||
pTimeOut = Abc_NodeArrival(pNode);
|
||||
pTimeOut->Rise = pTimeOut->Fall = -ABC_INFINITY;
|
||||
// consider the buffer
|
||||
if ( Abc_ObjIsBarBuf(pNode) )
|
||||
{
|
||||
pTimeIn = Abc_NodeArrival(Abc_ObjFanin0(pNode));
|
||||
*pTimeOut = *pTimeIn;
|
||||
return;
|
||||
}
|
||||
// go through the pins of the gate
|
||||
pPin = Mio_GateReadPins((Mio_Gate_t *)pNode->pData);
|
||||
Abc_ObjForEachFanin( pNode, pFanin, i )
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ void Cba_PrsWriteVerilogNodes( FILE * pFile, Cba_Ntk_t * p )
|
|||
Cba_PrsWriteVerilogMux( pFile, p, Cba_ObjFanins(p, i) );
|
||||
else
|
||||
{
|
||||
char * pName = Cba_NtkStr(p, Func);
|
||||
//char * pName = Cba_NtkStr(p, Func);
|
||||
assert( 0 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ void Wlc_BlastPower( Gia_Man_t * pNew, int * pNum, int nNum, int * pExp, int nEx
|
|||
{
|
||||
Vec_Int_t * vDegrees = Vec_IntAlloc( nNum );
|
||||
Vec_Int_t * vResTemp = Vec_IntAlloc( nNum );
|
||||
int i, * pDegrees, * pRes = Vec_IntArray(vRes);
|
||||
int i, * pDegrees = NULL, * pRes = Vec_IntArray(vRes);
|
||||
int k, * pResTemp = Vec_IntArray(vResTemp);
|
||||
Vec_IntFill( vRes, nNum, 0 );
|
||||
Vec_IntWriteEntry( vRes, 0, 1 );
|
||||
|
|
|
|||
|
|
@ -443,6 +443,14 @@ Mio_Cell_t * Mio_CollectRootsNew( Mio_Library_t * pLib, int nInputs, int * pnGat
|
|||
}
|
||||
Mio_CollectCopy( ppCells + iCell++, pGate );
|
||||
}
|
||||
if ( ppCells[0].pName == NULL )
|
||||
{ printf( "Error: Cannot find constant 0 gate in the library.\n" ); return NULL; }
|
||||
if ( ppCells[1].pName == NULL )
|
||||
{ printf( "Error: Cannot find constant 1 gate in the library.\n" ); return NULL; }
|
||||
if ( ppCells[2].pName == NULL )
|
||||
{ printf( "Error: Cannot find buffer gate in the library.\n" ); return NULL; }
|
||||
if ( ppCells[3].pName == NULL )
|
||||
{ printf( "Error: Cannot find inverter gate in the library.\n" ); return NULL; }
|
||||
// sort by delay
|
||||
if ( iCell > 1 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue