mirror of https://github.com/YosysHQ/abc.git
Adding barrier buffers.
This commit is contained in:
parent
7a3e57a4cb
commit
89eed1aaf9
|
|
@ -99,6 +99,10 @@ SOURCE=.\src\base\abc\abcAig.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abc\abcBarBuf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abc\abcBlifMv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ struct Abc_Ntk_t_
|
|||
int nObjCounts[ABC_OBJ_NUMBER]; // the number of objects by type
|
||||
int nObjs; // the number of live objs
|
||||
int nConstrs; // the number of constraints
|
||||
int nBarBufs; // 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
|
||||
|
|
@ -330,6 +331,7 @@ static inline Vec_Int_t * Abc_ObjFaninVec( Abc_Obj_t * pObj ) { return &p
|
|||
static inline Vec_Int_t * Abc_ObjFanoutVec( Abc_Obj_t * pObj ) { return &pObj->vFanouts; }
|
||||
static inline Abc_Obj_t * Abc_ObjCopy( Abc_Obj_t * pObj ) { return pObj->pCopy; }
|
||||
static inline Abc_Ntk_t * Abc_ObjNtk( Abc_Obj_t * pObj ) { return pObj->pNtk; }
|
||||
static inline Abc_Ntk_t * Abc_ObjModel( Abc_Obj_t * pObj ) { assert( pObj->Type == ABC_OBJ_WHITEBOX ); return (Abc_Ntk_t *)pObj->pData; }
|
||||
static inline void * Abc_ObjData( Abc_Obj_t * pObj ) { return pObj->pData; }
|
||||
static inline Abc_Obj_t * Abc_ObjEquiv( Abc_Obj_t * pObj ) { return (Abc_Obj_t *)pObj->pData; }
|
||||
static inline Abc_Obj_t * Abc_ObjCopyCond( Abc_Obj_t * pObj ) { return Abc_ObjRegular(pObj)->pCopy? Abc_ObjNotCond(Abc_ObjRegular(pObj)->pCopy, Abc_ObjIsComplement(pObj)) : NULL; }
|
||||
|
|
@ -552,6 +554,9 @@ extern ABC_DLL void Abc_AigUpdateStop( Abc_Aig_t * pMan );
|
|||
extern ABC_DLL void Abc_AigUpdateReset( Abc_Aig_t * pMan );
|
||||
/*=== abcAttach.c ==========================================================*/
|
||||
extern ABC_DLL int Abc_NtkAttach( Abc_Ntk_t * pNtk );
|
||||
/*=== abcBarBuf.c ==========================================================*/
|
||||
extern ABC_DLL Abc_Ntk_t * Abc_NtkToBarBufs( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL Abc_Ntk_t * Abc_NtkFromBarBufs( Abc_Ntk_t * pNtkBase, Abc_Ntk_t * pNtk );
|
||||
/*=== abcBlifMv.c ==========================================================*/
|
||||
extern ABC_DLL void Abc_NtkStartMvVars( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkFreeMvVars( Abc_Ntk_t * pNtk );
|
||||
|
|
@ -945,12 +950,14 @@ extern ABC_DLL int Abc_NtkGetFaninMax( Abc_Ntk_t * pNtk );
|
|||
extern ABC_DLL int Abc_NtkGetFanoutMax( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL int Abc_NtkGetTotalFanins( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanCopy( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanCopy_rec( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanData( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkFillTemp( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL int Abc_NtkCountCopy( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL Vec_Ptr_t * Abc_NtkSaveCopy( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkLoadCopy( Abc_Ntk_t * pNtk, Vec_Ptr_t * vCopies );
|
||||
extern ABC_DLL void Abc_NtkCleanNext( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanNext_rec( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanMarkA( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanMarkB( Abc_Ntk_t * pNtk );
|
||||
extern ABC_DLL void Abc_NtkCleanMarkC( Abc_Ntk_t * pNtk );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,353 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [abcHie.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Network and node package.]
|
||||
|
||||
Synopsis [Procedures to handle hierarchy.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: abcHie.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "abc.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Checks the the hie design has no duplicated networks.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_NtkCheckSingleInstance( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pTemp, * pModel;
|
||||
Abc_Obj_t * pBox;
|
||||
int i, k, RetValue = 1;
|
||||
if ( pNtk->pDesign == NULL )
|
||||
return 1;
|
||||
Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
|
||||
pTemp->fHieVisited = 0;
|
||||
Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
|
||||
Abc_NtkForEachBox( pTemp, pBox, k )
|
||||
{
|
||||
pModel = (Abc_Ntk_t *)pBox->pData;
|
||||
if ( pModel == NULL )
|
||||
continue;
|
||||
if ( Abc_NtkLatchNum(pModel) > 0 )
|
||||
{
|
||||
printf( "Network \"%s\" contains %d flops.\n",
|
||||
Abc_NtkName(pNtk), Abc_NtkLatchNum(pModel) );
|
||||
RetValue = 0;
|
||||
}
|
||||
if ( pModel->fHieVisited )
|
||||
{
|
||||
printf( "Network \"%s\" contains box \"%s\" whose model \"%s\" is instantiated more than once.\n",
|
||||
Abc_NtkName(pNtk), Abc_ObjName(pBox), Abc_NtkName(pModel) );
|
||||
RetValue = 0;
|
||||
}
|
||||
pModel->fHieVisited = 1;
|
||||
}
|
||||
Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
|
||||
pTemp->fHieVisited = 0;
|
||||
return RetValue;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Collect PIs and POs of internal networks in the topo order.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkCollectPiPos_rec( Abc_Obj_t * pNet, Vec_Ptr_t * vPiPos )
|
||||
{
|
||||
extern void Abc_NtkCollectPiPos_int( Abc_Ntk_t * pNtk, Vec_Ptr_t * vPiPos, int fAdd );
|
||||
Abc_Obj_t * pObj, * pFanin; int i;
|
||||
assert( Abc_ObjIsNet(pNet) );
|
||||
if ( Abc_NodeIsTravIdCurrent( pNet ) )
|
||||
return;
|
||||
Abc_NodeSetTravIdCurrent( pNet );
|
||||
pObj = Abc_ObjFanin0(pNet);
|
||||
assert( Abc_ObjIsNode(pObj) || Abc_ObjIsBox(pObj) );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
Abc_NtkCollectPiPos_rec( pFanin, vPiPos );
|
||||
if ( Abc_ObjIsBox(pObj) )
|
||||
Abc_NtkCollectPiPos_int( (Abc_Ntk_t *)pObj->pData, vPiPos, 1 );
|
||||
}
|
||||
void Abc_NtkCollectPiPos_int( Abc_Ntk_t * pNtk, Vec_Ptr_t * vPiPos, int fAdd )
|
||||
{
|
||||
Abc_Obj_t * pObj; int i;
|
||||
// mark primary inputs
|
||||
Abc_NtkIncrementTravId( pNtk );
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Abc_NodeSetTravIdCurrent( Abc_ObjFanout0(pObj) );
|
||||
// add primary inputs
|
||||
if ( fAdd )
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Vec_PtrPush( vPiPos, pObj );
|
||||
// visit primary outputs
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Abc_NtkCollectPiPos_rec( Abc_ObjFanin0(pObj), vPiPos );
|
||||
// add primary outputs
|
||||
if ( fAdd )
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Vec_PtrPush( vPiPos, pObj );
|
||||
}
|
||||
Vec_Ptr_t * Abc_NtkCollectPiPos( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Vec_Ptr_t * vPiPos = Vec_PtrAlloc( 1000 );
|
||||
Abc_NtkCollectPiPos_int( pNtk, vPiPos, 0 );
|
||||
return vPiPos;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives logic network while introducing barbufs.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkToBarBufs_rec( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNet )
|
||||
{
|
||||
Abc_Ntk_t * pModel;
|
||||
Abc_Obj_t * pObj, * pFanin, * pFanout, * pLatch;
|
||||
int i;
|
||||
assert( Abc_ObjIsNet(pNet) );
|
||||
if ( pNet->pCopy )
|
||||
return;
|
||||
pObj = Abc_ObjFanin0(pNet);
|
||||
assert( Abc_ObjIsNode(pObj) || Abc_ObjIsBox(pObj) );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
Abc_NtkToBarBufs_rec( pNtkNew, pFanin );
|
||||
// create and connect object
|
||||
if ( Abc_ObjIsNode(pObj) )
|
||||
{
|
||||
pNet->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 0 );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
|
||||
return;
|
||||
}
|
||||
pModel = Abc_ObjModel(pObj);
|
||||
Abc_NtkCleanCopy( pModel );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
{
|
||||
pLatch = Abc_NtkAddLatch( pNtkNew, pFanin->pCopy, ABC_INIT_ZERO );
|
||||
Abc_ObjFanout0(Abc_NtkPi(pModel, i))->pCopy = Abc_ObjFanout0(pLatch);
|
||||
}
|
||||
Abc_NtkForEachPo( pModel, pObj, i )
|
||||
Abc_NtkToBarBufs_rec( pNtkNew, Abc_ObjFanin0(pObj) );
|
||||
Abc_ObjForEachFanout( pObj, pFanout, i )
|
||||
{
|
||||
pLatch = Abc_NtkAddLatch( pNtkNew, Abc_ObjFanin0(Abc_NtkPo(pModel, i))->pCopy, ABC_INIT_ZERO );
|
||||
pFanout->pCopy = Abc_ObjFanout0(pLatch);
|
||||
}
|
||||
}
|
||||
Abc_Ntk_t * Abc_NtkToBarBufs( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
if ( !Abc_NtkCheckSingleInstance(pNtk) )
|
||||
return NULL;
|
||||
Abc_NtkCleanCopy( pNtk );
|
||||
// start the network
|
||||
pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, pNtk->ntkFunc, 1 );
|
||||
pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
|
||||
pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
|
||||
// clone CIs/CIs/boxes
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Abc_ObjFanout0(pObj)->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
// create logic
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
{
|
||||
Abc_NtkToBarBufs_rec( pNtkNew, Abc_ObjFanin0(pObj) );
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pObj)->pCopy );
|
||||
}
|
||||
pNtkNew->nBarBufs = Abc_NtkLatchNum(pNtkNew);
|
||||
return pNtkNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Converts the logic with barbufs into a hierarchical network.]
|
||||
|
||||
Description [The base network is the original hierarchical network. The
|
||||
second argument is the optimized network with barbufs. This procedure
|
||||
reconstructs the original hierarcical network which adding logic from
|
||||
the optimized network. It is assumed that the PIs/POs of the original
|
||||
network one-to-one mapping with the flops of the optimized network.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkFromBarBufs_rec( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pFanin; int i;
|
||||
if ( pObj->pCopy )
|
||||
return pObj->pCopy;
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 0 );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pNtkNew, pFanin) );
|
||||
return pObj->pCopy;
|
||||
}
|
||||
Abc_Ntk_t * Abc_NtkFromBarBufsInt( Abc_Ntk_t * pNtkBase, Abc_Ntk_t * pNtk, int fRoot )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pTerm, * pLatch, * pNet;
|
||||
int i, k;
|
||||
// start the network
|
||||
pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
|
||||
// clone CIs/CIs/boxes
|
||||
if ( fRoot )
|
||||
{
|
||||
pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
|
||||
pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
|
||||
Abc_NtkCleanCopy( pNtk );
|
||||
Abc_NtkForEachCi( pNtk, pObj, i )
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pNtkNew->pName = Extra_UtilStrsav(pNtkBase->pName);
|
||||
pNtkNew->pSpec = Extra_UtilStrsav(pNtkBase->pSpec);
|
||||
Abc_NtkForEachCi( pNtkBase, pObj, i )
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
Abc_NtkForEachCo( pNtkBase, pObj, i )
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
}
|
||||
Abc_NtkForEachBox( pNtkBase, pObj, i )
|
||||
{
|
||||
Abc_NtkDupObj( pNtkNew, pObj, 1 );
|
||||
Abc_ObjForEachFanout( pObj, pTerm, k )
|
||||
{
|
||||
pNet = Abc_ObjFanout0(pTerm);
|
||||
assert( Abc_ObjIsNet(pNet) );
|
||||
Abc_NtkDupObj( pNtkNew, pNet, 0 );
|
||||
pLatch = Abc_NtkCi( Abc_ObjModel(pObj), k )->pNext;
|
||||
assert( Abc_ObjIsLatch(pLatch) );
|
||||
assert( Abc_ObjIsCi(Abc_ObjFanout0(pLatch)->pCopy) );
|
||||
Abc_ObjAddFanin( Abc_ObjFanout0(pLatch)->pCopy, pObj->pCopy );
|
||||
Abc_ObjAddFanin( pNet->pCopy, Abc_ObjFanout0(pLatch)->pCopy );
|
||||
assert( Abc_ObjFanout0(Abc_ObjFanout0(pLatch))->pCopy == NULL );
|
||||
Abc_ObjFanout0(Abc_ObjFanout0(pLatch))->pCopy = pNet->pCopy;
|
||||
}
|
||||
}
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
assert( Abc_ObjFanout0(Abc_ObjFanout0(pLatch))->pCopy != NULL );
|
||||
// build PO cones
|
||||
if ( fRoot )
|
||||
{
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_NtkFromBarBufs_rec(pNtkNew, Abc_ObjFanin0(pObj)) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Abc_NtkForEachPo( pNtkBase, pObj, i )
|
||||
{
|
||||
pLatch = pObj->pNext;
|
||||
assert( Abc_ObjIsLatch(pLatch) );
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pLatch)->pCopy );
|
||||
Abc_ObjAddFanin( Abc_ObjFanin0(pLatch)->pCopy, Abc_NtkFromBarBufs_rec(pNtkNew, Abc_ObjFanin0(Abc_ObjFanin0(pLatch))) );
|
||||
}
|
||||
}
|
||||
// build BI cones
|
||||
Abc_NtkForEachBox( pNtkBase, pObj, i )
|
||||
{
|
||||
Abc_ObjForEachFanin( pObj, pTerm, k )
|
||||
{
|
||||
pNet = Abc_ObjFanin0(pTerm);
|
||||
assert( Abc_ObjIsNet(pNet) );
|
||||
pLatch = Abc_NtkCo( Abc_ObjModel(pObj), k )->pNext;
|
||||
assert( Abc_ObjIsLatch(pLatch) );
|
||||
assert( Abc_ObjIsCo(Abc_ObjFanin0(pLatch)->pCopy) );
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pLatch)->pCopy );
|
||||
Abc_ObjAddFanin( Abc_ObjFanin0(pLatch)->pCopy, Abc_NtkFromBarBufs_rec(pNtkNew, Abc_ObjFanin0(Abc_ObjFanin0(pLatch))) );
|
||||
}
|
||||
}
|
||||
return (pNtkBase->pCopy = pNtkNew);
|
||||
}
|
||||
Abc_Ntk_t * Abc_NtkFromBarBufs( Abc_Ntk_t * pNtkBase, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew, * pTemp;
|
||||
Vec_Ptr_t * vPiPos;
|
||||
Abc_Obj_t * pObj;
|
||||
int i, k;
|
||||
assert( pNtkBase->pDesign != NULL );
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
assert( Abc_NtkIsNetlist(pNtkBase) );
|
||||
assert( Abc_NtkLatchNum(pNtkBase) == 0 );
|
||||
assert( Abc_NtkLatchNum(pNtk) == pNtk->nBarBufs );
|
||||
assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkBase) );
|
||||
assert( Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkBase) );
|
||||
// annotate PIs/POs of base with flops from optimized network
|
||||
vPiPos = Abc_NtkCollectPiPos( pNtkBase );
|
||||
assert( Vec_PtrSize(vPiPos) == Abc_NtkLatchNum(pNtk) );
|
||||
Abc_NtkCleanCopy_rec( pNtkBase );
|
||||
Abc_NtkCleanNext_rec( pNtkBase );
|
||||
Vec_PtrForEachEntry( Abc_Obj_t *, vPiPos, pObj, i )
|
||||
pObj->pNext = Abc_NtkBox( pNtk, i );
|
||||
Vec_PtrFree( vPiPos );
|
||||
// duplicate the networks
|
||||
pNtkNew = Abc_NtkFromBarBufsInt( pNtkBase, pNtk, 1 );
|
||||
pNtkNew->pDesign = Abc_LibCreate( pNtkBase->pDesign->pName );
|
||||
Abc_LibAddModel( pNtkNew->pDesign, pNtkNew );
|
||||
Vec_PtrPush( pNtkNew->pDesign->vTops, pNtkNew );
|
||||
Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
|
||||
if ( pTemp != pNtkBase )
|
||||
{
|
||||
pTemp = Abc_NtkFromBarBufsInt( pTemp, pNtk, 0 );
|
||||
Abc_LibAddModel( pNtkNew->pDesign, pTemp );
|
||||
}
|
||||
// set node models
|
||||
Vec_PtrForEachEntry( Abc_Ntk_t *, pNtkBase->pDesign->vModules, pTemp, i )
|
||||
Abc_NtkForEachBox( pTemp, pObj, k )
|
||||
pObj->pCopy->pData = Abc_ObjModel(pObj)->pCopy;
|
||||
return pNtkNew;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
||||
|
|
@ -509,6 +509,14 @@ void Abc_NtkCleanCopy( Abc_Ntk_t * pNtk )
|
|||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
}
|
||||
void Abc_NtkCleanCopy_rec( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Abc_NtkCleanCopy( pNtk );
|
||||
Abc_NtkForEachBox( pNtk, pObj, i )
|
||||
Abc_NtkCleanCopy_rec( Abc_ObjModel(pObj) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
@ -630,6 +638,14 @@ void Abc_NtkCleanNext( Abc_Ntk_t * pNtk )
|
|||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
pObj->pNext = NULL;
|
||||
}
|
||||
void Abc_NtkCleanNext_rec( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Abc_NtkCleanNext( pNtk );
|
||||
Abc_NtkForEachBox( pNtk, pObj, i )
|
||||
Abc_NtkCleanNext_rec( Abc_ObjModel(pObj) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
@ -1451,7 +1467,7 @@ int Abc_NtkPrepareTwoNtks( FILE * pErr, Abc_Ntk_t * pNtk, char ** argv, int argc
|
|||
else
|
||||
fclose( pFile );
|
||||
pNtk1 = Abc_NtkDup(pNtk);
|
||||
pNtk2 = Io_Read( pNtk->pSpec, Io_ReadFileType(pNtk->pSpec), fCheck );
|
||||
pNtk2 = Io_Read( pNtk->pSpec, Io_ReadFileType(pNtk->pSpec), fCheck, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
return 0;
|
||||
*pfDelete1 = 1;
|
||||
|
|
@ -1465,7 +1481,7 @@ int Abc_NtkPrepareTwoNtks( FILE * pErr, Abc_Ntk_t * pNtk, char ** argv, int argc
|
|||
return 0;
|
||||
}
|
||||
pNtk1 = Abc_NtkDup(pNtk);
|
||||
pNtk2 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck );
|
||||
pNtk2 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
return 0;
|
||||
*pfDelete1 = 1;
|
||||
|
|
@ -1473,10 +1489,10 @@ int Abc_NtkPrepareTwoNtks( FILE * pErr, Abc_Ntk_t * pNtk, char ** argv, int argc
|
|||
}
|
||||
else if ( argc == util_optind + 2 )
|
||||
{
|
||||
pNtk1 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck );
|
||||
pNtk1 = Io_Read( argv[util_optind], Io_ReadFileType(argv[util_optind]), fCheck, 0 );
|
||||
if ( pNtk1 == NULL )
|
||||
return 0;
|
||||
pNtk2 = Io_Read( argv[util_optind+1], Io_ReadFileType(argv[util_optind+1]), fCheck );
|
||||
pNtk2 = Io_Read( argv[util_optind+1], Io_ReadFileType(argv[util_optind+1]), fCheck, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
{
|
||||
Abc_NtkDelete( pNtk1 );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
SRC += src/base/abc/abcAig.c \
|
||||
src/base/abc/abcBarBuf.c \
|
||||
src/base/abc/abcBlifMv.c \
|
||||
src/base/abc/abcCheck.c \
|
||||
src/base/abc/abcDfs.c \
|
||||
|
|
|
|||
|
|
@ -7268,7 +7268,7 @@ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
// read the second network
|
||||
FileName = argv[globalUtilOptind];
|
||||
pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1 );
|
||||
pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
return 1;
|
||||
|
||||
|
|
@ -7360,7 +7360,7 @@ int Abc_CommandPutOnTop( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
// read the second network
|
||||
FileName = argv[globalUtilOptind];
|
||||
pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1 );
|
||||
pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
return 1;
|
||||
|
||||
|
|
@ -9031,7 +9031,7 @@ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fclose( pFile );
|
||||
|
||||
// set the new network
|
||||
pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1 );
|
||||
pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 );
|
||||
if ( pNtkNew == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Reading network from file has failed.\n" );
|
||||
|
|
@ -9115,7 +9115,7 @@ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fclose( pFile );
|
||||
|
||||
// set the new network
|
||||
pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1 );
|
||||
pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 );
|
||||
if ( pNtkNew == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Reading network from file has failed.\n" );
|
||||
|
|
@ -13321,7 +13321,7 @@ int Abc_CommandFraigDress( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pFileName = (argc == globalUtilOptind + 1) ? argv[globalUtilOptind] : Abc_NtkSpec(pNtk);
|
||||
// modify the current network
|
||||
// Abc_NtkDress( pNtk, pFileName, fVerbose );
|
||||
pNtk2 = Io_Read( pFileName, Io_ReadFileType(pFileName), 1 );
|
||||
pNtk2 = Io_Read( pFileName, Io_ReadFileType(pFileName), 1, 0 );
|
||||
Abc_NtkDress2( pNtk, pNtk2, nConfs, fVerbose );
|
||||
Abc_NtkDelete( pNtk2 );
|
||||
return 0;
|
||||
|
|
@ -18949,7 +18949,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
if ( argc == globalUtilOptind + 1 )
|
||||
{
|
||||
pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 );
|
||||
pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1, 0 );
|
||||
if ( pNtkCare == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Reading care network has failed.\n" );
|
||||
|
|
@ -19171,7 +19171,7 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Not enough command-line arguments.\n" );
|
||||
return 1;
|
||||
}
|
||||
pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 );
|
||||
pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1, 0 );
|
||||
if ( pNtkCare == NULL )
|
||||
{
|
||||
Abc_Print( -1, "Reading care network has failed.\n" );
|
||||
|
|
@ -20032,7 +20032,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
{
|
||||
char FileName[100];
|
||||
sprintf(FileName, "sm%02d.aig", pSecPar->nSMnumber );
|
||||
pNtk = Io_Read( FileName, Io_ReadFileType(FileName), 1 );
|
||||
pNtk = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 );
|
||||
if ( pNtk == NULL )
|
||||
Abc_Print( -1, "Cannot read back unsolved reduced sequential miter \"%s\",\n", FileName );
|
||||
else
|
||||
|
|
@ -20128,7 +20128,7 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
if ( fMiter )
|
||||
{
|
||||
// pNtk = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 );
|
||||
// pNtk = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1, 0 );
|
||||
if ( argc == globalUtilOptind + 1 )
|
||||
{
|
||||
Abc_Print( -1, "The miter cannot be given on the command line. Use \"read\".\n" );
|
||||
|
|
@ -23627,10 +23627,10 @@ int Abc_CommandReconcile( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
if ( argc == globalUtilOptind + 2 )
|
||||
{
|
||||
// derive networks
|
||||
pNtk1 = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 );
|
||||
pNtk1 = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1, 0 );
|
||||
if ( pNtk1 == NULL )
|
||||
return 1;
|
||||
pNtk2 = Io_Read( argv[globalUtilOptind+1], Io_ReadFileType(argv[globalUtilOptind+1]), 1 );
|
||||
pNtk2 = Io_Read( argv[globalUtilOptind+1], Io_ReadFileType(argv[globalUtilOptind+1]), 1, 0 );
|
||||
if ( pNtk2 == NULL )
|
||||
{
|
||||
Abc_NtkDelete( pNtk1 );
|
||||
|
|
|
|||
|
|
@ -1731,7 +1731,7 @@ int CmdCommandSis( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
fclose( pFile );
|
||||
|
||||
// set the new network
|
||||
pNtkNew = Io_Read( "_sis_out.blif", IO_FILE_BLIF, 1 );
|
||||
pNtkNew = Io_Read( "_sis_out.blif", IO_FILE_BLIF, 1, 0 );
|
||||
// set the original spec of the new network
|
||||
if ( pNtk->pSpec )
|
||||
{
|
||||
|
|
@ -1873,7 +1873,7 @@ int CmdCommandMvsis( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
fclose( pFile );
|
||||
|
||||
// set the new network
|
||||
pNtkNew = Io_Read( "_mvsis_out.blif", IO_FILE_BLIF, 1 );
|
||||
pNtkNew = Io_Read( "_mvsis_out.blif", IO_FILE_BLIF, 1, 0 );
|
||||
// set the original spec of the new network
|
||||
if ( pNtk->pSpec )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -172,12 +172,13 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
char Command[1000];
|
||||
Abc_Ntk_t * pNtk;
|
||||
char * pFileName, * pTemp;
|
||||
int c, fCheck;
|
||||
int c, fCheck, fBarBufs;
|
||||
|
||||
fCheck = 1;
|
||||
fBarBufs = 0;
|
||||
glo_fMapped = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "mch" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "mcbh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -187,6 +188,9 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
case 'c':
|
||||
fCheck ^= 1;
|
||||
break;
|
||||
case 'b':
|
||||
fBarBufs ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
|
|
@ -230,7 +234,7 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
}
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, Io_ReadFileType(pFileName), fCheck );
|
||||
pNtk = Io_Read( pFileName, Io_ReadFileType(pFileName), fCheck, fBarBufs );
|
||||
if ( pNtk == NULL )
|
||||
return 0;
|
||||
if ( Abc_NtkPiNum(pNtk) == 0 )
|
||||
|
|
@ -245,12 +249,13 @@ int IoCommandRead( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: read [-mch] <file>\n" );
|
||||
fprintf( pAbc->Err, "usage: read [-mcbh] <file>\n" );
|
||||
fprintf( pAbc->Err, "\t replaces the current network by the network read from <file>\n" );
|
||||
fprintf( pAbc->Err, "\t by calling the parser that matches the extension of <file>\n" );
|
||||
fprintf( pAbc->Err, "\t (to read a hierarchical design, use \"read_hie\")\n" );
|
||||
fprintf( pAbc->Err, "\t-m : toggle reading mapped Verilog [default = %s]\n", glo_fMapped? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-c : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-b : toggle reading barrier buffers [default = %s]\n", fBarBufs? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
|
||||
fprintf( pAbc->Err, "\tfile : the name of a file to read\n" );
|
||||
return 1;
|
||||
|
|
@ -294,7 +299,7 @@ int IoCommandReadAiger( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_AIGER, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_AIGER, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -349,7 +354,7 @@ int IoCommandReadBaf( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BAF, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BAF, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -404,7 +409,7 @@ int IoCommandReadBblif( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BBLIF, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BBLIF, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -473,7 +478,7 @@ int IoCommandReadBlif( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
if ( fReadAsAig )
|
||||
pNtk = Io_ReadBlifAsAig( pFileName, fCheck );
|
||||
else if ( fUseNewParser )
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BLIF, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BLIF, fCheck, 0 );
|
||||
else
|
||||
{
|
||||
Abc_Ntk_t * pTemp;
|
||||
|
|
@ -541,7 +546,7 @@ int IoCommandReadBlifMv( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BLIFMV, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BLIFMV, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -597,7 +602,7 @@ int IoCommandReadBench( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BENCH, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_BENCH, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -714,7 +719,7 @@ int IoCommandReadEdif( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_EDIF, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_EDIF, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -769,7 +774,7 @@ int IoCommandReadEqn( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_EQN, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_EQN, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -910,7 +915,7 @@ int IoCommandReadPla( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_NtkDelete( pTemp );
|
||||
}
|
||||
else
|
||||
pNtk = Io_Read( pFileName, IO_FILE_PLA, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_PLA, fCheck, 0 );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -1015,13 +1020,14 @@ int IoCommandReadVerilog( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
{
|
||||
Abc_Ntk_t * pNtk;
|
||||
char * pFileName;
|
||||
int fCheck;
|
||||
int fCheck, fBarBufs;
|
||||
int c;
|
||||
|
||||
fCheck = 1;
|
||||
fBarBufs = 0;
|
||||
glo_fMapped = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "mch" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "mcbh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -1031,6 +1037,9 @@ int IoCommandReadVerilog( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
case 'c':
|
||||
fCheck ^= 1;
|
||||
break;
|
||||
case 'b':
|
||||
fBarBufs ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
|
|
@ -1042,7 +1051,7 @@ int IoCommandReadVerilog( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// get the input file name
|
||||
pFileName = argv[globalUtilOptind];
|
||||
// read the file using the corresponding file reader
|
||||
pNtk = Io_Read( pFileName, IO_FILE_VERILOG, fCheck );
|
||||
pNtk = Io_Read( pFileName, IO_FILE_VERILOG, fCheck, fBarBufs );
|
||||
if ( pNtk == NULL )
|
||||
return 1;
|
||||
// replace the current network
|
||||
|
|
@ -1051,10 +1060,11 @@ int IoCommandReadVerilog( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: read_verilog [-mch] <file>\n" );
|
||||
fprintf( pAbc->Err, "usage: read_verilog [-mcbh] <file>\n" );
|
||||
fprintf( pAbc->Err, "\t reads the network in Verilog (IWLS 2002/2005 subset)\n" );
|
||||
fprintf( pAbc->Err, "\t-m : toggle reading mapped Verilog [default = %s]\n", glo_fMapped? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-c : toggle network check after reading [default = %s]\n", fCheck? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-b : toggle reading barrier buffers [default = %s]\n", fBarBufs? "yes":"no" );
|
||||
fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
|
||||
fprintf( pAbc->Err, "\tfile : the name of a file to read\n" );
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ extern void Io_WriteVerilog( Abc_Ntk_t * pNtk, char * FileName );
|
|||
extern Io_FileType_t Io_ReadFileType( char * pFileName );
|
||||
extern Io_FileType_t Io_ReadLibType( char * pFileName );
|
||||
extern Abc_Ntk_t * Io_ReadNetlist( char * pFileName, Io_FileType_t FileType, int fCheck );
|
||||
extern Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck );
|
||||
extern Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs );
|
||||
extern void Io_Write( Abc_Ntk_t * pNtk, char * pFileName, Io_FileType_t FileType );
|
||||
extern void Io_WriteHie( Abc_Ntk_t * pNtk, char * pBaseName, char * pFileName );
|
||||
extern Abc_Obj_t * Io_ReadCreatePi( Abc_Ntk_t * pNtk, char * pName );
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ void updateLtlStoreOfNtk( Abc_Ntk_t *pNtk, Vec_Ptr_t *tempLtlStore )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck )
|
||||
Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs )
|
||||
{
|
||||
Abc_Ntk_t * pNtk, * pTemp;
|
||||
Vec_Ptr_t * vLtl;
|
||||
|
|
@ -234,6 +234,14 @@ Abc_Ntk_t * Io_Read( char * pFileName, Io_FileType_t FileType, int fCheck )
|
|||
vLtl = temporaryLtlStore( pNtk );
|
||||
if ( !Abc_NtkIsNetlist(pNtk) )
|
||||
return pNtk;
|
||||
// derive barbufs
|
||||
if ( fBarBufs )
|
||||
{
|
||||
pNtk = Abc_NtkToBarBufs( pTemp = pNtk );
|
||||
Abc_NtkDelete( pTemp );
|
||||
assert( Abc_NtkIsLogic(pNtk) );
|
||||
return pNtk;
|
||||
}
|
||||
// flatten logic hierarchy
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
if ( Abc_NtkWhiteboxNum(pNtk) > 0 )
|
||||
|
|
@ -481,13 +489,22 @@ void Io_WriteHie( Abc_Ntk_t * pNtk, char * pBaseName, char * pFileName )
|
|||
if ( Abc_NtkWhiteboxNum(pNtkBase) > 0 )
|
||||
{
|
||||
pNtkBase = Abc_NtkFlattenLogicHierarchy( pNtkTemp = pNtkBase );
|
||||
Abc_NtkDelete( pNtkTemp );
|
||||
if ( pNtkBase == NULL )
|
||||
return;
|
||||
Abc_NtkDelete( pNtkTemp );
|
||||
}
|
||||
|
||||
// reintroduce the boxes into the netlist
|
||||
if ( Io_ReadFileType(pBaseName) == IO_FILE_BLIFMV )
|
||||
if ( pNtk->nBarBufs > 0 )
|
||||
{
|
||||
// derive the netlist
|
||||
pNtkResult = Abc_NtkToNetlist( pNtk );
|
||||
pNtkResult = Abc_NtkFromBarBufs( pNtkBase, pNtkTemp = pNtkResult );
|
||||
Abc_NtkDelete( pNtkTemp );
|
||||
if ( pNtkResult )
|
||||
printf( "Hierarchy writer reintroduced %d barbufs.\n", pNtk->nBarBufs );
|
||||
}
|
||||
else if ( Io_ReadFileType(pBaseName) == IO_FILE_BLIFMV )
|
||||
{
|
||||
if ( Abc_NtkBlackboxNum(pNtkBase) > 0 )
|
||||
{
|
||||
|
|
@ -499,7 +516,10 @@ void Io_WriteHie( Abc_Ntk_t * pNtk, char * pBaseName, char * pFileName )
|
|||
assert( !Abc_NtkIsNetlist(pNtk) );
|
||||
pNtkResult = Abc_NtkToNetlist( pNtk );
|
||||
if ( !Abc_NtkConvertToBlifMv( pNtkResult ) )
|
||||
{
|
||||
Abc_NtkDelete( pNtkBase );
|
||||
return;
|
||||
}
|
||||
// reintroduce the network
|
||||
pNtkResult = Abc_NtkInsertBlifMv( pNtkBase, pNtkTemp = pNtkResult );
|
||||
Abc_NtkDelete( pNtkTemp );
|
||||
|
|
|
|||
Loading…
Reference in New Issue