abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcNtk.c File Reference
#include "abc.h"
#include "abcInt.h"
#include "base/main/main.h"
#include "map/mio/mio.h"
#include "aig/gia/gia.h"
#include "misc/extra/extraBdd.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Abc_Ntk_t
Abc_NtkAlloc (Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
 DECLARATIONS ///. More...
 
Abc_Ntk_tAbc_NtkStartFrom (Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
 
Abc_Ntk_tAbc_NtkStartFromWithLatches (Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func, int nLatches)
 
Abc_Ntk_tAbc_NtkStartFromNoLatches (Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
 
void Abc_NtkFinalize (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
 
Abc_Ntk_tAbc_NtkStartRead (char *pName)
 
void Abc_NtkFinalizeRead (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkDup (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkDupDfs (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkRestrashWithLatches (Abc_Ntk_t *pNtk, int nLatches)
 
Abc_Ntk_tAbc_NtkDupTransformMiter (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkDouble (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkBottom (Abc_Ntk_t *pNtk, int Level)
 
Abc_Ntk_tAbc_NtkAttachBottom (Abc_Ntk_t *pNtkTop, Abc_Ntk_t *pNtkBottom)
 
Abc_Ntk_tAbc_NtkCreateCone (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
 
Abc_Ntk_tAbc_NtkCreateConeArray (Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fUseAllCis)
 
void Abc_NtkAppendToCone (Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
 
Abc_Ntk_tAbc_NtkCreateMffc (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName)
 
Abc_Ntk_tAbc_NtkCreateTarget (Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, Vec_Int_t *vValues)
 
Abc_Ntk_tAbc_NtkCreateFromNode (Abc_Ntk_t *pNtk, Abc_Obj_t *pNode)
 
Abc_Ntk_tAbc_NtkCreateWithNode (char *pSop)
 
void Abc_NtkDelete (Abc_Ntk_t *pNtk)
 
void Abc_NtkFixNonDrivenNets (Abc_Ntk_t *pNtk)
 
void Abc_NtkMakeComb (Abc_Ntk_t *pNtk, int fRemoveLatches)
 
void Abc_NtkMakeSeq (Abc_Ntk_t *pNtk, int nLatchesToAdd)
 
Abc_Ntk_tAbc_NtkMakeOnePo (Abc_Ntk_t *pNtkInit, int Output, int nRange)
 
Abc_Ntk_tAbc_NtkTrim (Abc_Ntk_t *pNtk)
 
void Abc_NtkDropSatOutputs (Abc_Ntk_t *pNtk, Vec_Ptr_t *vCexes, int fVerbose)
 
void Abc_NtkDropOneOutput (Abc_Ntk_t *pNtk, int iOutput, int fSkipSweep, int fUseConst1)
 
void Abc_NtkSwapOneOutput (Abc_Ntk_t *pNtk, int iOutput)
 
void Abc_NtkRemovePo (Abc_Ntk_t *pNtk, int iOutput, int fRemoveConst0)
 
Vec_Int_tAbc_NtkReadFlopPerm (char *pFileName, int nFlops)
 
void Abc_NtkPermute (Abc_Ntk_t *pNtk, int fInputs, int fOutputs, int fFlops, char *pFlopPermFile)
 
void Abc_NtkUnpermute (Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_NtkNodeDup (Abc_Ntk_t *pNtkInit, int nLimit, int fVerbose)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Abc_Ntk_t* Abc_NtkAlloc ( Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func,
int  fUseMemMan 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [abcNtk.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Network creation/duplication/deletion procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
abcNtk.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates a new Ntk.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file abcNtk.c.

51 {
52  Abc_Ntk_t * pNtk;
53  pNtk = ABC_ALLOC( Abc_Ntk_t, 1 );
54  memset( pNtk, 0, sizeof(Abc_Ntk_t) );
55  pNtk->ntkType = Type;
56  pNtk->ntkFunc = Func;
57  // start the object storage
58  pNtk->vObjs = Vec_PtrAlloc( 100 );
59  pNtk->vPios = Vec_PtrAlloc( 100 );
60  pNtk->vPis = Vec_PtrAlloc( 100 );
61  pNtk->vPos = Vec_PtrAlloc( 100 );
62  pNtk->vCis = Vec_PtrAlloc( 100 );
63  pNtk->vCos = Vec_PtrAlloc( 100 );
64  pNtk->vBoxes = Vec_PtrAlloc( 100 );
65  pNtk->vLtlProperties = Vec_PtrAlloc( 100 );
66  // start the memory managers
67  pNtk->pMmObj = fUseMemMan? Mem_FixedStart( sizeof(Abc_Obj_t) ) : NULL;
68  pNtk->pMmStep = fUseMemMan? Mem_StepStart( ABC_NUM_STEPS ) : NULL;
69  // get ready to assign the first Obj ID
70  pNtk->nTravIds = 1;
71  // start the functionality manager
72  if ( !Abc_NtkIsStrash(pNtk) )
73  Vec_PtrPush( pNtk->vObjs, NULL );
74  if ( Abc_NtkIsStrash(pNtk) )
75  pNtk->pManFunc = Abc_AigAlloc( pNtk );
76  else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
77  pNtk->pManFunc = Mem_FlexStart();
78  else if ( Abc_NtkHasBdd(pNtk) )
80  else if ( Abc_NtkHasAig(pNtk) )
81  pNtk->pManFunc = Hop_ManStart();
82  else if ( Abc_NtkHasMapping(pNtk) )
83  pNtk->pManFunc = Abc_FrameReadLibGen();
84  else if ( !Abc_NtkHasBlackbox(pNtk) )
85  assert( 0 );
86  // name manager
87  pNtk->pManName = Nm_ManCreate( 200 );
88  // attribute manager
90  // estimated AndGateDelay
91  pNtk->AndGateDelay = 0.0;
92  return pNtk;
93 }
char * memset()
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Vec_Ptr_t * vAttrs
Definition: abc.h:214
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Vec_Ptr_t * vLtlProperties
Definition: abc.h:169
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Nm_Man_t * pManName
Definition: abc.h:160
Vec_Ptr_t * vBoxes
Definition: abc.h:168
float AndGateDelay
Definition: abc.h:194
Vec_Ptr_t * vPios
Definition: abc.h:167
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
Vec_Ptr_t * vCis
Definition: abc.h:165
Mem_Fixed_t * Mem_FixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Definition: mem.c:100
void * pManFunc
Definition: abc.h:191
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
Mem_Fixed_t * pMmObj
Definition: abc.h:189
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
ABC_DLL Abc_Aig_t * Abc_AigAlloc(Abc_Ntk_t *pNtk)
FUNCTION DECLARATIONS ///.
Definition: abcAig.c:128
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
Mem_Step_t * Mem_StepStart(int nSteps)
Definition: mem.c:474
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Nm_Man_t * Nm_ManCreate(int nSize)
MACRO DEFINITIONS ///.
Definition: nmApi.c:45
Mem_Step_t * pMmStep
Definition: abc.h:190
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
int nTravIds
Definition: abc.h:187
Abc_NtkType_t ntkType
Definition: abc.h:156
#define ABC_NUM_STEPS
INCLUDES ///.
Definition: abcInt.h:36
void Abc_NtkAppendToCone ( Abc_Ntk_t pNtkNew,
Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots 
)

Function*************************************************************

Synopsis [Adds new nodes to the cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 969 of file abcNtk.c.

970 {
971  Vec_Ptr_t * vNodes;
972  Abc_Obj_t * pObj;
973  int i, iNodeId;
974 
975  assert( Abc_NtkIsStrash(pNtkNew) );
976  assert( Abc_NtkIsStrash(pNtk) );
977 
978  // collect the nodes in the TFI of the output (mark the TFI)
979  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
980 
981  // establish connection between the constant nodes
982  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
983 
984  // create the PIs
985  Abc_NtkForEachCi( pNtk, pObj, i )
986  {
987  // skip CIs that are not used
988  if ( !Abc_NodeIsTravIdCurrent(pObj) )
989  continue;
990  // find the corresponding CI in the new network
992  if ( iNodeId == -1 )
993  {
994  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
995  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
996  }
997  else
998  pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
999  }
1000 
1001  // copy the nodes
1002  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1003  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1004  Vec_PtrFree( vNodes );
1005 
1006  // do not add the COs
1007  if ( !Abc_NtkCheck( pNtkNew ) )
1008  fprintf( stdout, "Abc_NtkAppendToCone(): Network check has failed.\n" );
1009 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Nm_Man_t * pManName
Definition: abc.h:160
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
void Abc_NtkAppendToCone(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots)
Definition: abcNtk.c:969
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
int Nm_ManFindIdByNameTwoTypes(Nm_Man_t *p, char *pName, int Type1, int Type2)
Definition: nmApi.c:239
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkAttachBottom ( Abc_Ntk_t pNtkTop,
Abc_Ntk_t pNtkBottom 
)

Function*************************************************************

Synopsis [Attaches the second network at the bottom of the first.]

Description [Returns the first network. Deletes the second network.]

SideEffects []

SeeAlso []

Definition at line 760 of file abcNtk.c.

761 {
762  Abc_Obj_t * pObj, * pFanin, * pBuffer;
763  Vec_Ptr_t * vNodes;
764  int i, k;
765  assert( pNtkBottom != NULL );
766  if ( pNtkTop == NULL )
767  return pNtkBottom;
768  // make sure the networks are combinational
769  assert( Abc_NtkPiNum(pNtkTop) == Abc_NtkCiNum(pNtkTop) );
770  assert( Abc_NtkPiNum(pNtkBottom) == Abc_NtkCiNum(pNtkBottom) );
771  // make sure the POs of the bottom correspond to the PIs of the top
772  assert( Abc_NtkPoNum(pNtkBottom) == Abc_NtkPiNum(pNtkTop) );
773  assert( Abc_NtkPiNum(pNtkBottom) < Abc_NtkPiNum(pNtkTop) );
774  // add buffers for the PIs of the top - save results in the POs of the bottom
775  Abc_NtkForEachPi( pNtkTop, pObj, i )
776  {
777  pBuffer = Abc_NtkCreateNodeBuf( pNtkTop, NULL );
778  Abc_ObjTransferFanout( pObj, pBuffer );
779  Abc_NtkPo(pNtkBottom, i)->pCopy = pBuffer;
780  }
781  // remove useless PIs of the top
782  for ( i = Abc_NtkPiNum(pNtkTop) - 1; i >= Abc_NtkPiNum(pNtkBottom); i-- )
783  Abc_NtkDeleteObj( Abc_NtkPi(pNtkTop, i) );
784  assert( Abc_NtkPiNum(pNtkBottom) == Abc_NtkPiNum(pNtkTop) );
785  // copy the bottom network
786  Abc_NtkForEachPi( pNtkBottom, pObj, i )
787  Abc_NtkPi(pNtkBottom, i)->pCopy = Abc_NtkPi(pNtkTop, i);
788  // construct all nodes
789  vNodes = Abc_NtkDfs( pNtkBottom, 0 );
790  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
791  {
792  Abc_NtkDupObj(pNtkTop, pObj, 0);
793  Abc_ObjForEachFanin( pObj, pFanin, k )
794  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
795  }
796  Vec_PtrFree( vNodes );
797  // connect the POs
798  Abc_NtkForEachPo( pNtkBottom, pObj, i )
799  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pObj)->pCopy );
800  // delete old network
801  Abc_NtkDelete( pNtkBottom );
802  // return the network
803  if ( !Abc_NtkCheck( pNtkTop ) )
804  fprintf( stdout, "Abc_NtkAttachBottom(): Network check has failed.\n" );
805  return pNtkTop;
806 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Abc_Ntk_t * Abc_NtkAttachBottom(Abc_Ntk_t *pNtkTop, Abc_Ntk_t *pNtkBottom)
Definition: abcNtk.c:760
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition: abcFanio.c:264
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkBottom ( Abc_Ntk_t pNtk,
int  Level 
)

Function*************************************************************

Synopsis [Duplicate the bottom levels of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 702 of file abcNtk.c.

703 {
704  char Buffer[500];
705  Abc_Ntk_t * pNtkNew;
706  Abc_Obj_t * pObj, * pFanin;
707  int i, k;
708  assert( Abc_NtkIsLogic(pNtk) );
709  assert( Abc_NtkLatchNum(pNtk) == 0 );
710 
711  // start the network
712  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
713  sprintf( Buffer, "%s%s", pNtk->pName, "_bot" );
714  pNtkNew->pName = Extra_UtilStrsav(Buffer);
715 
716  // clean the node copy fields
717  Abc_NtkCleanCopy( pNtk );
718  // clone CIs/CIs/boxes
719  Abc_NtkForEachPi( pNtk, pObj, i )
720  Abc_NtkDupObj( pNtkNew, pObj, 1 );
721 
722  // copy the internal nodes
723  // duplicate the nets and nodes (CIs/COs/latches already dupped)
724  Abc_NtkForEachObj( pNtk, pObj, i )
725  if ( pObj->pCopy == NULL && Abc_ObjIsNode(pObj) && Abc_ObjLevel(pObj) <= Level )
726  Abc_NtkDupObj(pNtkNew, pObj, 0);
727  // reconnect all objects (no need to transfer attributes on edges)
728  Abc_NtkForEachObj( pNtk, pObj, i )
729  Abc_ObjForEachFanin( pObj, pFanin, k )
730  if ( pObj->pCopy && pFanin->pCopy )
731  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
732 
733  // create new primary outputs
734  Abc_NtkForEachObj( pNtk, pObj, i )
735  Abc_ObjForEachFanin( pObj, pFanin, k )
736  if ( !pObj->pCopy && pFanin->pCopy && Abc_ObjIsNode(pFanin) )
737  {
738  Abc_Obj_t * pNodeNew = Abc_NtkCreatePo(pNtkNew);
739  Abc_ObjAddFanin( pNodeNew, pFanin->pCopy );
740  Abc_ObjAssignName( pNodeNew, Abc_ObjName(pNodeNew), NULL );
741  }
742 
743  // perform the final check
744  if ( !Abc_NtkCheck( pNtkNew ) )
745  fprintf( stdout, "Abc_NtkBottom(): Network check has failed.\n" );
746  return pNtkNew;
747 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Obj_t * pCopy
Definition: abc.h:148
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
Abc_Ntk_t* Abc_NtkCreateCone ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode,
char *  pNodeName,
int  fUseAllCis 
)

Function*************************************************************

Synopsis [Creates the network composed of one logic cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 819 of file abcNtk.c.

820 {
821  Abc_Ntk_t * pNtkNew;
822  Vec_Ptr_t * vNodes;
823  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
824  char Buffer[1000];
825  int i, k;
826 
827  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
828  assert( Abc_ObjIsNode(pNode) || (Abc_NtkIsStrash(pNtk) && (Abc_AigNodeIsConst(pNode) || Abc_ObjIsCi(pNode))) );
829 
830  // start the network
831  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
832  // set the name
833  sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName );
834  pNtkNew->pName = Extra_UtilStrsav(Buffer);
835 
836  // establish connection between the constant nodes
837  if ( Abc_NtkIsStrash(pNtk) )
838  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
839 
840  // collect the nodes in the TFI of the output (mark the TFI)
841  vNodes = Abc_NtkDfsNodes( pNtk, &pNode, 1 );
842  // create the PIs
843  Abc_NtkForEachCi( pNtk, pObj, i )
844  {
845  if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS
846  {
847  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
848  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
849  }
850  }
851  // add the PO corresponding to this output
852  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
853  Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL );
854  // copy the nodes
855  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
856  {
857  // if it is an AIG, add to the hash table
858  if ( Abc_NtkIsStrash(pNtk) )
859  {
860  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
861  }
862  else
863  {
864  Abc_NtkDupObj( pNtkNew, pObj, 0 );
865  Abc_ObjForEachFanin( pObj, pFanin, k )
866  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
867  }
868  }
869  // connect the internal nodes to the new CO
870  Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy );
871  Vec_PtrFree( vNodes );
872 
873  if ( !Abc_NtkCheck( pNtkNew ) )
874  fprintf( stdout, "Abc_NtkCreateCone(): Network check has failed.\n" );
875  return pNtkNew;
876 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
Abc_Ntk_t * Abc_NtkCreateCone(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName, int fUseAllCis)
Definition: abcNtk.c:819
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkCreateConeArray ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots,
int  fUseAllCis 
)

Function*************************************************************

Synopsis [Creates the network composed of several logic cones.]

Description []

SideEffects []

SeeAlso []

Definition at line 889 of file abcNtk.c.

890 {
891  Abc_Ntk_t * pNtkNew;
892  Vec_Ptr_t * vNodes;
893  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
894  char Buffer[1000];
895  int i, k;
896 
897  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
898 
899  // start the network
900  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
901  // set the name
902  sprintf( Buffer, "%s_part", pNtk->pName );
903  pNtkNew->pName = Extra_UtilStrsav(Buffer);
904 
905  // establish connection between the constant nodes
906  if ( Abc_NtkIsStrash(pNtk) )
907  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
908 
909  // collect the nodes in the TFI of the output (mark the TFI)
910  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
911 
912  // create the PIs
913  Abc_NtkForEachCi( pNtk, pObj, i )
914  {
915  if ( fUseAllCis || Abc_NodeIsTravIdCurrent(pObj) ) // TravId is set by DFS
916  {
917  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
918  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
919  }
920  }
921 
922  // copy the nodes
923  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
924  {
925  // if it is an AIG, add to the hash table
926  if ( Abc_NtkIsStrash(pNtk) )
927  {
928  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
929  }
930  else
931  {
932  Abc_NtkDupObj( pNtkNew, pObj, 0 );
933  Abc_ObjForEachFanin( pObj, pFanin, k )
934  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
935  }
936  }
937  Vec_PtrFree( vNodes );
938 
939  // add the POs corresponding to the root nodes
940  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
941  {
942  // create the PO node
943  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
944  // connect the internal nodes to the new CO
945  if ( Abc_ObjIsCo(pObj) )
946  Abc_ObjAddFanin( pNodeCoNew, Abc_ObjChild0Copy(pObj) );
947  else
948  Abc_ObjAddFanin( pNodeCoNew, pObj->pCopy );
949  // assign the name
950  Abc_ObjAssignName( pNodeCoNew, Abc_ObjName(pObj), NULL );
951  }
952 
953  if ( !Abc_NtkCheck( pNtkNew ) )
954  fprintf( stdout, "Abc_NtkCreateConeArray(): Network check has failed.\n" );
955  return pNtkNew;
956 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkCreateFromNode ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode 
)

Function*************************************************************

Synopsis [Creates the network composed of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1154 of file abcNtk.c.

1155 {
1156  Abc_Ntk_t * pNtkNew;
1157  Abc_Obj_t * pFanin, * pNodePo;
1158  int i;
1159  // start the network
1160  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
1161  pNtkNew->pName = Extra_UtilStrsav(Abc_ObjName(pNode));
1162  // add the PIs corresponding to the fanins of the node
1163  Abc_ObjForEachFanin( pNode, pFanin, i )
1164  {
1165  pFanin->pCopy = Abc_NtkCreatePi( pNtkNew );
1166  Abc_ObjAssignName( pFanin->pCopy, Abc_ObjName(pFanin), NULL );
1167  }
1168  // duplicate and connect the node
1169  pNode->pCopy = Abc_NtkDupObj( pNtkNew, pNode, 0 );
1170  Abc_ObjForEachFanin( pNode, pFanin, i )
1171  Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy );
1172  // create the only PO
1173  pNodePo = Abc_NtkCreatePo( pNtkNew );
1174  Abc_ObjAddFanin( pNodePo, pNode->pCopy );
1175  Abc_ObjAssignName( pNodePo, Abc_ObjName(pNode), NULL );
1176  if ( !Abc_NtkCheck( pNtkNew ) )
1177  fprintf( stdout, "Abc_NtkCreateFromNode(): Network check has failed.\n" );
1178  return pNtkNew;
1179 }
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
Abc_Ntk_t * Abc_NtkCreateFromNode(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode)
Definition: abcNtk.c:1154
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
Abc_Ntk_t* Abc_NtkCreateMffc ( Abc_Ntk_t pNtk,
Abc_Obj_t pNode,
char *  pNodeName 
)

Function*************************************************************

Synopsis [Creates the network composed of MFFC of one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1022 of file abcNtk.c.

1023 {
1024  Abc_Ntk_t * pNtkNew;
1025  Abc_Obj_t * pObj, * pFanin, * pNodeCoNew;
1026  Vec_Ptr_t * vCone, * vSupp;
1027  char Buffer[1000];
1028  int i, k;
1029 
1030  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsStrash(pNtk) );
1031  assert( Abc_ObjIsNode(pNode) );
1032 
1033  // start the network
1034  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
1035  // set the name
1036  sprintf( Buffer, "%s_%s", pNtk->pName, pNodeName );
1037  pNtkNew->pName = Extra_UtilStrsav(Buffer);
1038 
1039  // establish connection between the constant nodes
1040  if ( Abc_NtkIsStrash(pNtk) )
1041  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
1042 
1043  // collect the nodes in MFFC
1044  vCone = Vec_PtrAlloc( 100 );
1045  vSupp = Vec_PtrAlloc( 100 );
1046  Abc_NodeDeref_rec( pNode );
1047  Abc_NodeMffcConeSupp( pNode, vCone, vSupp );
1048  Abc_NodeRef_rec( pNode );
1049  // create the PIs
1050  Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
1051  {
1052  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
1053  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
1054  }
1055  // create the PO
1056  pNodeCoNew = Abc_NtkCreatePo( pNtkNew );
1057  Abc_ObjAssignName( pNodeCoNew, pNodeName, NULL );
1058  // copy the nodes
1059  Vec_PtrForEachEntry( Abc_Obj_t *, vCone, pObj, i )
1060  {
1061  // if it is an AIG, add to the hash table
1062  if ( Abc_NtkIsStrash(pNtk) )
1063  {
1064  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1065  }
1066  else
1067  {
1068  Abc_NtkDupObj( pNtkNew, pObj, 0 );
1069  Abc_ObjForEachFanin( pObj, pFanin, k )
1070  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
1071  }
1072  }
1073  // connect the topmost node
1074  Abc_ObjAddFanin( pNodeCoNew, pNode->pCopy );
1075  Vec_PtrFree( vCone );
1076  Vec_PtrFree( vSupp );
1077 
1078  if ( !Abc_NtkCheck( pNtkNew ) )
1079  fprintf( stdout, "Abc_NtkCreateMffc(): Network check has failed.\n" );
1080  return pNtkNew;
1081 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
ABC_DLL int Abc_NodeRef_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:241
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
Abc_Ntk_t * Abc_NtkCreateMffc(Abc_Ntk_t *pNtk, Abc_Obj_t *pNode, char *pNodeName)
Definition: abcNtk.c:1022
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NodeMffcConeSupp(Abc_Obj_t *pNode, Vec_Ptr_t *vCone, Vec_Ptr_t *vSupp)
Definition: abcRefs.c:299
char * sprintf()
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
ABC_DLL int Abc_NodeDeref_rec(Abc_Obj_t *pNode)
Definition: abcRefs.c:215
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkCreateTarget ( Abc_Ntk_t pNtk,
Vec_Ptr_t vRoots,
Vec_Int_t vValues 
)

Function*************************************************************

Synopsis [Creates the miter composed of one multi-output cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 1094 of file abcNtk.c.

1095 {
1096  Vec_Ptr_t * vNodes;
1097  Abc_Ntk_t * pNtkNew;
1098  Abc_Obj_t * pObj, * pFinal, * pOther, * pNodePo;
1099  int i;
1100 
1101  assert( Abc_NtkIsLogic(pNtk) );
1102 
1103  // start the network
1104  Abc_NtkCleanCopy( pNtk );
1105  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
1106  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
1107 
1108  // collect the nodes in the TFI of the output
1109  vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)vRoots->pArray, vRoots->nSize );
1110  // create the PIs
1111  Abc_NtkForEachCi( pNtk, pObj, i )
1112  {
1113  pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
1114  Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
1115  }
1116  // copy the nodes
1117  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1118  pObj->pCopy = Abc_NodeStrash( pNtkNew, pObj, 0 );
1119  Vec_PtrFree( vNodes );
1120 
1121  // add the PO
1122  pFinal = Abc_AigConst1( pNtkNew );
1123  Vec_PtrForEachEntry( Abc_Obj_t *, vRoots, pObj, i )
1124  {
1125  if ( Abc_ObjIsCo(pObj) )
1126  pOther = Abc_ObjFanin0(pObj)->pCopy;
1127  else
1128  pOther = pObj->pCopy;
1129  if ( Vec_IntEntry(vValues, i) == 0 )
1130  pOther = Abc_ObjNot(pOther);
1131  pFinal = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, pFinal, pOther );
1132  }
1133 
1134  // add the PO corresponding to this output
1135  pNodePo = Abc_NtkCreatePo( pNtkNew );
1136  Abc_ObjAddFanin( pNodePo, pFinal );
1137  Abc_ObjAssignName( pNodePo, "miter", NULL );
1138  if ( !Abc_NtkCheck( pNtkNew ) )
1139  fprintf( stdout, "Abc_NtkCreateTarget(): Network check has failed.\n" );
1140  return pNtkNew;
1141 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NodeStrash(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int fRecord)
Definition: abcStrash.c:468
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition: abcDfs.c:120
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkCreateWithNode ( char *  pSop)

Function*************************************************************

Synopsis [Creates the network composed of one node with the given SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 1192 of file abcNtk.c.

1193 {
1194  Abc_Ntk_t * pNtkNew;
1195  Abc_Obj_t * pFanin, * pNode, * pNodePo;
1196  Vec_Ptr_t * vNames;
1197  int i, nVars;
1198  // start the network
1199  pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 );
1200  pNtkNew->pName = Extra_UtilStrsav("ex");
1201  // create PIs
1202  Vec_PtrPush( pNtkNew->vObjs, NULL );
1203  nVars = Abc_SopGetVarNum( pSop );
1204  vNames = Abc_NodeGetFakeNames( nVars );
1205  for ( i = 0; i < nVars; i++ )
1206  Abc_ObjAssignName( Abc_NtkCreatePi(pNtkNew), (char *)Vec_PtrEntry(vNames, i), NULL );
1207  Abc_NodeFreeNames( vNames );
1208  // create the node, add PIs as fanins, set the function
1209  pNode = Abc_NtkCreateNode( pNtkNew );
1210  Abc_NtkForEachPi( pNtkNew, pFanin, i )
1211  Abc_ObjAddFanin( pNode, pFanin );
1212  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, pSop );
1213  // create the only PO
1214  pNodePo = Abc_NtkCreatePo(pNtkNew);
1215  Abc_ObjAddFanin( pNodePo, pNode );
1216  Abc_ObjAssignName( pNodePo, "F", NULL );
1217  if ( !Abc_NtkCheck( pNtkNew ) )
1218  fprintf( stdout, "Abc_NtkCreateWithNode(): Network check has failed.\n" );
1219  return pNtkNew;
1220 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * Abc_NtkCreateWithNode(char *pSop)
Definition: abcNtk.c:1192
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vObjs
Definition: abc.h:162
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition: abcNames.c:257
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
ABC_DLL Vec_Ptr_t * Abc_NodeGetFakeNames(int nNames)
Definition: abcNames.c:221
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
void Abc_NtkDelete ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Deletes the Ntk.]

Description []

SideEffects []

SeeAlso []

Definition at line 1233 of file abcNtk.c.

1234 {
1235  Abc_Obj_t * pObj;
1236  void * pAttrMan;
1237  int TotalMemory, i;
1238 // int LargePiece = (4 << ABC_NUM_STEPS);
1239  if ( pNtk == NULL )
1240  return;
1241  // free EXDC Ntk
1242  if ( pNtk->pExdc )
1243  Abc_NtkDelete( pNtk->pExdc );
1244  if ( pNtk->pExcare )
1245  Abc_NtkDelete( (Abc_Ntk_t *)pNtk->pExcare );
1246  // dereference the BDDs
1247  if ( Abc_NtkHasBdd(pNtk) )
1248  {
1249  Abc_NtkForEachNode( pNtk, pObj, i )
1250  Cudd_RecursiveDeref( (DdManager *)pNtk->pManFunc, (DdNode *)pObj->pData );
1251  }
1252  // make sure all the marks are clean
1253  Abc_NtkForEachObj( pNtk, pObj, i )
1254  {
1255  // free large fanout arrays
1256 // if ( pNtk->pMmObj && pObj->vFanouts.nCap * 4 > LargePiece )
1257 // ABC_FREE( pObj->vFanouts.pArray );
1258  // these flags should be always zero
1259  // if this is not true, something is wrong somewhere
1260  assert( pObj->fMarkA == 0 );
1261  assert( pObj->fMarkB == 0 );
1262  assert( pObj->fMarkC == 0 );
1263  }
1264  // free the nodes
1265  if ( pNtk->pMmStep == NULL )
1266  {
1267  Abc_NtkForEachObj( pNtk, pObj, i )
1268  {
1269  ABC_FREE( pObj->vFanouts.pArray );
1270  ABC_FREE( pObj->vFanins.pArray );
1271  }
1272  }
1273  if ( pNtk->pMmObj == NULL )
1274  {
1275  Abc_NtkForEachObj( pNtk, pObj, i )
1276  ABC_FREE( pObj );
1277  }
1278 
1279  // free the arrays
1280  Vec_PtrFree( pNtk->vPios );
1281  Vec_PtrFree( pNtk->vPis );
1282  Vec_PtrFree( pNtk->vPos );
1283  Vec_PtrFree( pNtk->vCis );
1284  Vec_PtrFree( pNtk->vCos );
1285  Vec_PtrFree( pNtk->vObjs );
1286  Vec_PtrFree( pNtk->vBoxes );
1287  ABC_FREE( pNtk->vTravIds.pArray );
1288  if ( pNtk->vLevelsR ) Vec_IntFree( pNtk->vLevelsR );
1289  ABC_FREE( pNtk->pModel );
1290  ABC_FREE( pNtk->pSeqModel );
1291  if ( pNtk->vSeqModelVec )
1292  Vec_PtrFreeFree( pNtk->vSeqModelVec );
1293  TotalMemory = 0;
1294  TotalMemory += pNtk->pMmObj? Mem_FixedReadMemUsage(pNtk->pMmObj) : 0;
1295  TotalMemory += pNtk->pMmStep? Mem_StepReadMemUsage(pNtk->pMmStep) : 0;
1296 // fprintf( stdout, "The total memory allocated internally by the network = %0.2f MB.\n", ((double)TotalMemory)/(1<<20) );
1297  // free the storage
1298  if ( pNtk->pMmObj )
1299  Mem_FixedStop( pNtk->pMmObj, 0 );
1300  if ( pNtk->pMmStep )
1301  Mem_StepStop ( pNtk->pMmStep, 0 );
1302  // name manager
1303  Nm_ManFree( pNtk->pManName );
1304  // free the timing manager
1305  if ( pNtk->pManTime )
1306  Abc_ManTimeStop( pNtk->pManTime );
1307  Vec_IntFreeP( &pNtk->vPhases );
1308  // start the functionality manager
1309  if ( Abc_NtkIsStrash(pNtk) )
1310  Abc_AigFree( (Abc_Aig_t *)pNtk->pManFunc );
1311  else if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
1312  Mem_FlexStop( (Mem_Flex_t *)pNtk->pManFunc, 0 );
1313  else if ( Abc_NtkHasBdd(pNtk) )
1314  Extra_StopManager( (DdManager *)pNtk->pManFunc );
1315  else if ( Abc_NtkHasAig(pNtk) )
1316  { if ( pNtk->pManFunc ) Hop_ManStop( (Hop_Man_t *)pNtk->pManFunc ); }
1317  else if ( Abc_NtkHasMapping(pNtk) )
1318  pNtk->pManFunc = NULL;
1319  else if ( !Abc_NtkHasBlackbox(pNtk) )
1320  assert( 0 );
1321  // free the hierarchy
1322  if ( pNtk->pDesign )
1323  {
1324  Abc_DesFree( pNtk->pDesign, pNtk );
1325  pNtk->pDesign = NULL;
1326  }
1327 // if ( pNtk->pBlackBoxes )
1328 // Vec_IntFree( pNtk->pBlackBoxes );
1329  // free node attributes
1330  Vec_PtrForEachEntry( Abc_Obj_t *, pNtk->vAttrs, pAttrMan, i )
1331  if ( pAttrMan )
1332  Vec_AttFree( (Vec_Att_t *)pAttrMan, 1 );
1333  assert( pNtk->pSCLib == NULL );
1334  Vec_IntFreeP( &pNtk->vGates );
1335  Vec_PtrFree( pNtk->vAttrs );
1336  Vec_IntFreeP( &pNtk->vNameIds );
1337  ABC_FREE( pNtk->pWLoadUsed );
1338  ABC_FREE( pNtk->pName );
1339  ABC_FREE( pNtk->pSpec );
1340  ABC_FREE( pNtk->pLutTimes );
1341  if ( pNtk->vOnehots )
1342  Vec_VecFree( (Vec_Vec_t *)pNtk->vOnehots );
1343  Vec_PtrFreeP( &pNtk->vLtlProperties );
1344  Vec_IntFreeP( &pNtk->vObjPerm );
1345  Vec_IntFreeP( &pNtk->vTopo );
1346  ABC_FREE( pNtk );
1347 }
void Mem_StepStop(Mem_Step_t *p, int fVerbose)
Definition: mem.c:510
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
Abc_Ntk_t * pExdc
Definition: abc.h:201
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL void Abc_AigFree(Abc_Aig_t *pMan)
Definition: abcAig.c:165
Vec_Int_t vFanins
Definition: abc.h:143
void Mem_FixedStop(Mem_Fixed_t *p, int fVerbose)
Definition: mem.c:139
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
DECLARATIONS ///.
Definition: abcAig.c:52
int Mem_StepReadMemUsage(Mem_Step_t *p)
Definition: mem.c:593
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
ABC_DLL void Abc_DesFree(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition: abcLib.c:94
Mem_Fixed_t * pMmObj
Definition: abc.h:189
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
void * pExcare
Definition: abc.h:202
void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void * Vec_AttFree(Vec_Att_t *p, int fFreeMan)
Definition: vecAtt.h:126
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
Vec_Int_t vFanouts
Definition: abc.h:144
ABC_DLL void Abc_ManTimeStop(Abc_ManTime_t *p)
Definition: abcTiming.c:455
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Mem_Step_t * pMmStep
Definition: abc.h:190
int Mem_FixedReadMemUsage(Mem_Fixed_t *p)
Definition: mem.c:277
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void Nm_ManFree(Nm_Man_t *p)
Definition: nmApi.c:76
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkDouble ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Duplicate the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file abcNtk.c.

620 {
621  char Buffer[500];
622  Abc_Ntk_t * pNtkNew;
623  Abc_Obj_t * pObj, * pFanin;
624  int i, k;
625  assert( Abc_NtkIsLogic(pNtk) );
626 
627  // start the network
628  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
629  sprintf( Buffer, "%s%s", pNtk->pName, "_2x" );
630  pNtkNew->pName = Extra_UtilStrsav(Buffer);
631 
632  // clean the node copy fields
633  Abc_NtkCleanCopy( pNtk );
634  // clone CIs/CIs/boxes
635  Abc_NtkForEachPi( pNtk, pObj, i )
636  Abc_NtkDupObj( pNtkNew, pObj, 0 );
637  Abc_NtkForEachPo( pNtk, pObj, i )
638  Abc_NtkDupObj( pNtkNew, pObj, 0 );
639  Abc_NtkForEachBox( pNtk, pObj, i )
640  Abc_NtkDupBox( pNtkNew, pObj, 0 );
641  // copy the internal nodes
642  // duplicate the nets and nodes (CIs/COs/latches already dupped)
643  Abc_NtkForEachObj( pNtk, pObj, i )
644  if ( pObj->pCopy == NULL )
645  Abc_NtkDupObj(pNtkNew, pObj, 0);
646  // reconnect all objects (no need to transfer attributes on edges)
647  Abc_NtkForEachObj( pNtk, pObj, i )
648  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
649  Abc_ObjForEachFanin( pObj, pFanin, k )
650  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
651 
652  // clean the node copy fields
653  Abc_NtkCleanCopy( pNtk );
654  // clone CIs/CIs/boxes
655  Abc_NtkForEachPi( pNtk, pObj, i )
656  Abc_NtkDupObj( pNtkNew, pObj, 0 );
657  Abc_NtkForEachPo( pNtk, pObj, i )
658  Abc_NtkDupObj( pNtkNew, pObj, 0 );
659  Abc_NtkForEachBox( pNtk, pObj, i )
660  Abc_NtkDupBox( pNtkNew, pObj, 0 );
661  // copy the internal nodes
662  // duplicate the nets and nodes (CIs/COs/latches already dupped)
663  Abc_NtkForEachObj( pNtk, pObj, i )
664  if ( pObj->pCopy == NULL )
665  Abc_NtkDupObj(pNtkNew, pObj, 0);
666  // reconnect all objects (no need to transfer attributes on edges)
667  Abc_NtkForEachObj( pNtk, pObj, i )
668  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
669  Abc_ObjForEachFanin( pObj, pFanin, k )
670  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
671 
672  // assign names
673  Abc_NtkForEachCi( pNtk, pObj, i )
674  {
675  Abc_ObjAssignName( Abc_NtkCi(pNtkNew, i), "1_", Abc_ObjName(pObj) );
676  Abc_ObjAssignName( Abc_NtkCi(pNtkNew, Abc_NtkCiNum(pNtk) + i), "2_", Abc_ObjName(pObj) );
677  }
678  Abc_NtkForEachCo( pNtk, pObj, i )
679  {
680  Abc_ObjAssignName( Abc_NtkCo(pNtkNew, i), "1_", Abc_ObjName(pObj) );
681  Abc_ObjAssignName( Abc_NtkCo(pNtkNew, Abc_NtkCoNum(pNtk) + i), "2_", Abc_ObjName(pObj) );
682  }
683  Abc_NtkOrderCisCos( pNtkNew );
684 
685  // perform the final check
686  if ( !Abc_NtkCheck( pNtkNew ) )
687  fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
688  return pNtkNew;
689 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
char * Extra_UtilStrsav(const char *s)
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
void Abc_NtkDropOneOutput ( Abc_Ntk_t pNtk,
int  iOutput,
int  fSkipSweep,
int  fUseConst1 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1772 of file abcNtk.c.

1773 {
1774  Abc_Obj_t * pObj, * pConst0, * pFaninNew;
1775  pObj = Abc_NtkPo( pNtk, iOutput );
1776  if ( Abc_ObjFanin0(pObj) == Abc_AigConst1(pNtk) )
1777  {
1778  if ( !Abc_ObjFaninC0(pObj) ^ fUseConst1 )
1779  Abc_ObjXorFaninC( pObj, 0 );
1780  return;
1781  }
1782  pConst0 = Abc_ObjNotCond( Abc_AigConst1(pNtk), !fUseConst1 );
1783  pFaninNew = Abc_ObjNotCond( pConst0, Abc_ObjFaninC0(pObj) );
1784  Abc_ObjPatchFanin( pObj, Abc_ObjFanin0(pObj), pFaninNew );
1785  assert( Abc_ObjChild0(pObj) == pConst0 );
1786  if ( fSkipSweep )
1787  return;
1788  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1789 }
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void * pManFunc
Definition: abc.h:191
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkDropSatOutputs ( Abc_Ntk_t pNtk,
Vec_Ptr_t vCexes,
int  fVerbose 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1737 of file abcNtk.c.

1738 {
1739  Abc_Obj_t * pObj, * pConst0, * pFaninNew;
1740  int i, Counter = 0;
1741  assert( Vec_PtrSize(vCexes) == Abc_NtkPoNum(pNtk) );
1742  pConst0 = Abc_ObjNot( Abc_AigConst1(pNtk) );
1743  Abc_NtkForEachPo( pNtk, pObj, i )
1744  {
1745  if ( Vec_PtrEntry( vCexes, i ) == NULL )
1746  continue;
1747  Counter++;
1748  pFaninNew = Abc_ObjNotCond( pConst0, Abc_ObjFaninC0(pObj) );
1749  Abc_ObjPatchFanin( pObj, Abc_ObjFanin0(pObj), pFaninNew );
1750  assert( Abc_ObjChild0(pObj) == pConst0 );
1751  // if a PO is driven by a latch, they have the same name...
1752 // if ( Abc_ObjIsBo(pObj) )
1753 // Nm_ManDeleteIdName( pNtk->pManName, Abc_ObjId(pObj) );
1754  }
1755  if ( fVerbose )
1756  printf( "Logic cones of %d POs have been replaced by constant 0.\n", Counter );
1757  Counter = Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1758 // printf( "Cleanup removed %d nodes.\n", Counter );
1759 }
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
DECLARATIONS ///.
Definition: abcAig.c:52
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
void * pManFunc
Definition: abc.h:191
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
Abc_Ntk_t* Abc_NtkDup ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Duplicate the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 419 of file abcNtk.c.

420 {
421  Abc_Ntk_t * pNtkNew;
422  Abc_Obj_t * pObj, * pFanin;
423  int i, k;
424  if ( pNtk == NULL )
425  return NULL;
426  // start the network
427  pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc );
428  // copy the internal nodes
429  if ( Abc_NtkIsStrash(pNtk) )
430  {
431  // copy the AND gates
432  Abc_AigForEachAnd( pNtk, pObj, i )
433  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
434  // relink the choice nodes
435  Abc_AigForEachAnd( pNtk, pObj, i )
436  if ( pObj->pData )
437  pObj->pCopy->pData = ((Abc_Obj_t *)pObj->pData)->pCopy;
438  // relink the CO nodes
439  Abc_NtkForEachCo( pNtk, pObj, i )
440  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
441  // get the number of nodes before and after
442  if ( Abc_NtkNodeNum(pNtk) != Abc_NtkNodeNum(pNtkNew) )
443  printf( "Warning: Structural hashing during duplication reduced %d nodes (this is a minor bug).\n",
444  Abc_NtkNodeNum(pNtk) - Abc_NtkNodeNum(pNtkNew) );
445  }
446  else
447  {
448  // duplicate the nets and nodes (CIs/COs/latches already dupped)
449  Abc_NtkForEachObj( pNtk, pObj, i )
450  if ( pObj->pCopy == NULL )
451  Abc_NtkDupObj(pNtkNew, pObj, Abc_NtkHasBlackbox(pNtk) && Abc_ObjIsNet(pObj));
452  // reconnect all objects (no need to transfer attributes on edges)
453  Abc_NtkForEachObj( pNtk, pObj, i )
454  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
455  Abc_ObjForEachFanin( pObj, pFanin, k )
456  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
457  }
458  // duplicate the EXDC Ntk
459  if ( pNtk->pExdc )
460  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
461  if ( pNtk->pExcare )
462  pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare );
463  // duplicate timing manager
464  if ( pNtk->pManTime )
465  Abc_NtkTimeInitialize( pNtkNew, pNtk );
466  if ( pNtk->vPhases )
467  Abc_NtkTransferPhases( pNtkNew, pNtk );
468  if ( pNtk->pWLoadUsed )
469  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
470  // check correctness
471  if ( !Abc_NtkCheck( pNtkNew ) )
472  fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
473  pNtk->pCopy = pNtkNew;
474  return pNtkNew;
475 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Abc_NtkType_t ntkType
Definition: abc.h:156
Abc_Ntk_t* Abc_NtkDupDfs ( Abc_Ntk_t pNtk)

Definition at line 476 of file abcNtk.c.

477 {
478  Vec_Ptr_t * vNodes;
479  Abc_Ntk_t * pNtkNew;
480  Abc_Obj_t * pObj, * pFanin;
481  int i, k;
482  if ( pNtk == NULL )
483  return NULL;
484  assert( !Abc_NtkIsStrash(pNtk) && !Abc_NtkIsNetlist(pNtk) );
485  // start the network
486  pNtkNew = Abc_NtkStartFrom( pNtk, pNtk->ntkType, pNtk->ntkFunc );
487  // copy the internal nodes
488  vNodes = Abc_NtkDfs( pNtk, 0 );
489  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
490  Abc_NtkDupObj( pNtkNew, pObj, 0 );
491  Vec_PtrFree( vNodes );
492  // reconnect all objects (no need to transfer attributes on edges)
493  Abc_NtkForEachObj( pNtk, pObj, i )
494  if ( !Abc_ObjIsBox(pObj) && !Abc_ObjIsBo(pObj) )
495  Abc_ObjForEachFanin( pObj, pFanin, k )
496  if ( pObj->pCopy && pFanin->pCopy )
497  Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
498  // duplicate the EXDC Ntk
499  if ( pNtk->pExdc )
500  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
501  if ( pNtk->pExcare )
502  pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare );
503  // duplicate timing manager
504  if ( pNtk->pManTime )
505  Abc_NtkTimeInitialize( pNtkNew, pNtk );
506  if ( pNtk->vPhases )
507  Abc_NtkTransferPhases( pNtkNew, pNtk );
508  if ( pNtk->pWLoadUsed )
509  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
510  // check correctness
511  if ( !Abc_NtkCheck( pNtkNew ) )
512  fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
513  pNtk->pCopy = pNtkNew;
514  return pNtkNew;
515 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
if(last==0)
Definition: sparse_int.h:34
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Abc_NtkType_t ntkType
Definition: abc.h:156
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkDupTransformMiter ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Duplicate the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file abcNtk.c.

564 {
565  Abc_Ntk_t * pNtkNew;
566  Abc_Obj_t * pObj, * pObj2, * pMiter;
567  int i;
568  assert( Abc_NtkIsStrash(pNtk) );
569  // start the network
570  pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
571  pNtkNew->nConstrs = pNtk->nConstrs;
572  pNtkNew->nBarBufs = pNtk->nBarBufs;
573  // duplicate the name and the spec
574  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
575  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
576  // clean the node copy fields
577  Abc_NtkCleanCopy( pNtk );
578  // map the constant nodes
579  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
580  // clone CIs/CIs/boxes
581  Abc_NtkForEachPi( pNtk, pObj, i )
582  Abc_NtkDupObj( pNtkNew, pObj, 1 );
583  Abc_NtkForEachPo( pNtk, pObj, i )
584  Abc_NtkDupObj( pNtkNew, pObj, 1 ), i++;
585  Abc_NtkForEachBox( pNtk, pObj, i )
586  Abc_NtkDupBox( pNtkNew, pObj, 1 );
587  // copy the AND gates
588  Abc_AigForEachAnd( pNtk, pObj, i )
589  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
590  // create new miters
591  Abc_NtkForEachPo( pNtk, pObj, i )
592  {
593  pObj2 = Abc_NtkPo( pNtk, ++i );
594  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild0Copy(pObj2) );
595  Abc_ObjAddFanin( pObj->pCopy, pMiter );
596  }
597  Abc_NtkForEachLatchInput( pNtk, pObj, i )
598  Abc_ObjAddFanin( pObj->pCopy, Abc_ObjChild0Copy(pObj) );
599  // cleanup
600  Abc_AigCleanup( (Abc_Aig_t *)pNtkNew->pManFunc );
601  // check that the CI/CO/latches are copied correctly
602  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
603  assert( Abc_NtkPoNum(pNtk) == 2*Abc_NtkPoNum(pNtkNew) );
604  assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
605  return pNtkNew;
606 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
int nBarBufs
Definition: abc.h:174
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
char * pName
Definition: abc.h:158
Abc_NtkType_t ntkType
Definition: abc.h:156
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
void Abc_NtkFinalize ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkNew 
)

Function*************************************************************

Synopsis [Finalizes the network using the existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file abcNtk.c.

303 {
304  Abc_Obj_t * pObj, * pDriver, * pDriverNew;
305  int i;
306  // set the COs of the strashed network
307  Abc_NtkForEachCo( pNtk, pObj, i )
308  {
309  pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pObj) );
310  pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj));
311  Abc_ObjAddFanin( pObj->pCopy, pDriverNew );
312  }
313  // duplicate timing manager
314  if ( pNtk->pManTime )
315  Abc_NtkTimeInitialize( pNtkNew, pNtk );
316  if ( pNtk->vPhases )
317  Abc_NtkTransferPhases( pNtkNew, pNtk );
318  if ( pNtk->pWLoadUsed )
319  pNtkNew->pWLoadUsed = Abc_UtilStrsav( pNtk->pWLoadUsed );
320 }
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL void Abc_NtkTransferPhases(Abc_Ntk_t *pNtkNew, Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2875
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Vec_Int_t * vPhases
Definition: abc.h:208
Abc_ManTime_t * pManTime
Definition: abc.h:192
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char * pWLoadUsed
Definition: abc.h:209
void Abc_NtkFinalizeRead ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Finalizes the network using the existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 360 of file abcNtk.c.

361 {
362  Abc_Obj_t * pBox, * pObj, * pTerm, * pNet;
363  int i;
364  if ( Abc_NtkHasBlackbox(pNtk) && Abc_NtkBoxNum(pNtk) == 0 )
365  {
366  pBox = Abc_NtkCreateBlackbox(pNtk);
367  Abc_NtkForEachPi( pNtk, pObj, i )
368  {
369  pTerm = Abc_NtkCreateBi(pNtk);
370  Abc_ObjAddFanin( pTerm, Abc_ObjFanout0(pObj) );
371  Abc_ObjAddFanin( pBox, pTerm );
372  }
373  Abc_NtkForEachPo( pNtk, pObj, i )
374  {
375  pTerm = Abc_NtkCreateBo(pNtk);
376  Abc_ObjAddFanin( pTerm, pBox );
377  Abc_ObjAddFanin( Abc_ObjFanin0(pObj), pTerm );
378  }
379  return;
380  }
381  assert( Abc_NtkIsNetlist(pNtk) );
382 
383  // check if constant 0 net is used
384  pNet = Abc_NtkFindNet( pNtk, "1\'b0" );
385  if ( pNet )
386  {
387  if ( Abc_ObjFanoutNum(pNet) == 0 )
388  Abc_NtkDeleteObj(pNet);
389  else if ( Abc_ObjFaninNum(pNet) == 0 )
391  }
392  // check if constant 1 net is used
393  pNet = Abc_NtkFindNet( pNtk, "1\'b1" );
394  if ( pNet )
395  {
396  if ( Abc_ObjFanoutNum(pNet) == 0 )
397  Abc_NtkDeleteObj(pNet);
398  else if ( Abc_ObjFaninNum(pNet) == 0 )
400  }
401  // fix the net drivers
402  Abc_NtkFixNonDrivenNets( pNtk );
403 
404  // reorder the CI/COs to PI/POs first
405  Abc_NtkOrderCisCos( pNtk );
406 }
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void Abc_NtkFixNonDrivenNets(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1360
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
static Abc_Obj_t * Abc_NtkCreateBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:311
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
void Abc_NtkFixNonDrivenNets ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Reads the verilog file.]

Description []

SideEffects []

SeeAlso []

Definition at line 1360 of file abcNtk.c.

1361 {
1362  Vec_Ptr_t * vNets;
1363  Abc_Obj_t * pNet, * pNode;
1364  int i;
1365 
1366  if ( Abc_NtkNodeNum(pNtk) == 0 && Abc_NtkBoxNum(pNtk) == 0 )
1367  return;
1368 
1369  // special case
1370  pNet = Abc_NtkFindNet( pNtk, "[_c1_]" );
1371  if ( pNet != NULL )
1372  {
1373  pNode = Abc_NtkCreateNodeConst1( pNtk );
1374  Abc_ObjAddFanin( pNet, pNode );
1375  }
1376 
1377  // check for non-driven nets
1378  vNets = Vec_PtrAlloc( 100 );
1379  Abc_NtkForEachNet( pNtk, pNet, i )
1380  {
1381  if ( Abc_ObjFaninNum(pNet) > 0 )
1382  continue;
1383  // add the constant 0 driver
1384  pNode = Abc_NtkCreateNodeConst0( pNtk );
1385  // add the fanout net
1386  Abc_ObjAddFanin( pNet, pNode );
1387  // add the net to those for which the warning will be printed
1388  Vec_PtrPush( vNets, pNet );
1389  }
1390 
1391  // print the warning
1392  if ( vNets->nSize > 0 )
1393  {
1394  printf( "Warning: Constant-0 drivers added to %d non-driven nets in network \"%s\":\n", Vec_PtrSize(vNets), pNtk->pName );
1395  Vec_PtrForEachEntry( Abc_Obj_t *, vNets, pNet, i )
1396  {
1397  printf( "%s%s", (i? ", ": ""), Abc_ObjName(pNet) );
1398  if ( i == 3 )
1399  {
1400  if ( Vec_PtrSize(vNets) > 3 )
1401  printf( " ..." );
1402  break;
1403  }
1404  }
1405  printf( "\n" );
1406  }
1407  Vec_PtrFree( vNets );
1408 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
#define Abc_NtkForEachNet(pNtk, pNet, i)
Definition: abc.h:458
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * pName
Definition: abc.h:158
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkMakeComb ( Abc_Ntk_t pNtk,
int  fRemoveLatches 
)

Function*************************************************************

Synopsis [Converts the network to combinational.]

Description []

SideEffects []

SeeAlso []

Definition at line 1422 of file abcNtk.c.

1423 {
1424  Abc_Obj_t * pObj;
1425  int i;
1426 
1427  if ( Abc_NtkIsComb(pNtk) )
1428  return;
1429 
1430  assert( !Abc_NtkIsNetlist(pNtk) );
1432 
1433  // detach the latches
1434 // Abc_NtkForEachLatch( pNtk, pObj, i )
1435  Vec_PtrForEachEntryReverse( Abc_Obj_t *, pNtk->vBoxes, pObj, i )
1436  Abc_NtkDeleteObj( pObj );
1437  assert( Abc_NtkLatchNum(pNtk) == 0 );
1438  assert( Abc_NtkBoxNum(pNtk) == 0 );
1439 
1440  // move CIs to become PIs
1441  Vec_PtrClear( pNtk->vPis );
1442  Abc_NtkForEachCi( pNtk, pObj, i )
1443  {
1444  if ( Abc_ObjIsBo(pObj) )
1445  {
1446  pObj->Type = ABC_OBJ_PI;
1447  pNtk->nObjCounts[ABC_OBJ_PI]++;
1448  pNtk->nObjCounts[ABC_OBJ_BO]--;
1449  }
1450  Vec_PtrPush( pNtk->vPis, pObj );
1451  }
1452  assert( Abc_NtkBoNum(pNtk) == 0 );
1453 
1454  if ( fRemoveLatches )
1455  {
1456  // remove registers
1457  Vec_Ptr_t * vBos;
1458  vBos = Vec_PtrAlloc( 100 );
1459  Vec_PtrClear( pNtk->vPos );
1460  Abc_NtkForEachCo( pNtk, pObj, i )
1461  if ( Abc_ObjIsBi(pObj) )
1462  Vec_PtrPush( vBos, pObj );
1463  else
1464  Vec_PtrPush( pNtk->vPos, pObj );
1465  // remove COs
1466  Vec_PtrFree( pNtk->vCos );
1467  pNtk->vCos = NULL;
1468  // remove the BOs
1469  Vec_PtrForEachEntry( Abc_Obj_t *, vBos, pObj, i )
1470  Abc_NtkDeleteObj( pObj );
1471  Vec_PtrFree( vBos );
1472  // create COs
1473  pNtk->vCos = Vec_PtrDup( pNtk->vPos );
1474  // cleanup
1475  if ( Abc_NtkIsLogic(pNtk) )
1476  Abc_NtkCleanup( pNtk, 0 );
1477  else if ( Abc_NtkIsStrash(pNtk) )
1478  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1479  else
1480  assert( 0 );
1481  }
1482  else
1483  {
1484  // move COs to become POs
1485  Vec_PtrClear( pNtk->vPos );
1486  Abc_NtkForEachCo( pNtk, pObj, i )
1487  {
1488  if ( Abc_ObjIsBi(pObj) )
1489  {
1490  pObj->Type = ABC_OBJ_PO;
1491  pNtk->nObjCounts[ABC_OBJ_PO]++;
1492  pNtk->nObjCounts[ABC_OBJ_BI]--;
1493  }
1494  Vec_PtrPush( pNtk->vPos, pObj );
1495  }
1496  }
1497  assert( Abc_NtkBiNum(pNtk) == 0 );
1498 
1499  if ( !Abc_NtkCheck( pNtk ) )
1500  fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" );
1501 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
Definition: abc.h:91
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkIsComb(Abc_Ntk_t *pNtk)
Definition: abc.h:297
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
Vec_Ptr_t * vBoxes
Definition: abc.h:168
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition: vecPtr.h:63
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
static int Abc_NtkBiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:290
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:476
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
static int Abc_NtkBoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:291
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkMakeOnePo ( Abc_Ntk_t pNtkInit,
int  Output,
int  nRange 
)

Function*************************************************************

Synopsis [Removes all POs, except one.]

Description []

SideEffects []

SeeAlso []

Definition at line 1590 of file abcNtk.c.

1591 {
1592  Abc_Ntk_t * pNtk;
1593  Vec_Ptr_t * vPosLeft;
1594  Vec_Ptr_t * vCosLeft;
1595  Abc_Obj_t * pNodePo;
1596  int i;
1597  assert( !Abc_NtkIsNetlist(pNtkInit) );
1598  assert( Abc_NtkHasOnlyLatchBoxes(pNtkInit) );
1599  if ( Output < 0 || Output >= Abc_NtkPoNum(pNtkInit) )
1600  {
1601  printf( "PO index is incorrect.\n" );
1602  return NULL;
1603  }
1604 
1605  pNtk = Abc_NtkDup( pNtkInit );
1606  if ( Abc_NtkPoNum(pNtk) == 1 )
1607  return pNtk;
1608 
1609  if ( nRange < 1 )
1610  nRange = 1;
1611 
1612  // filter POs
1613  vPosLeft = Vec_PtrAlloc( nRange );
1614  Abc_NtkForEachPo( pNtk, pNodePo, i )
1615  if ( i < Output || i >= Output + nRange )
1616  Abc_NtkDeleteObjPo( pNodePo );
1617  else
1618  Vec_PtrPush( vPosLeft, pNodePo );
1619  // filter COs
1620  vCosLeft = Vec_PtrDup( vPosLeft );
1621  for ( i = Abc_NtkPoNum(pNtk); i < Abc_NtkCoNum(pNtk); i++ )
1622  Vec_PtrPush( vCosLeft, Abc_NtkCo(pNtk, i) );
1623  // update arrays
1624  Vec_PtrFree( pNtk->vPos ); pNtk->vPos = vPosLeft;
1625  Vec_PtrFree( pNtk->vCos ); pNtk->vCos = vCosLeft;
1626 
1627  // clean the network
1628  if ( Abc_NtkIsStrash(pNtk) )
1629  {
1630  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1631  printf( "Run sequential cleanup (\"scl\") to get rid of dangling logic.\n" );
1632  }
1633  else
1634  {
1635  printf( "Run sequential cleanup (\"st; scl\") to get rid of dangling logic.\n" );
1636  }
1637 
1638  if ( !Abc_NtkCheck( pNtk ) )
1639  fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" );
1640  return pNtk;
1641 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NtkDeleteObjPo(Abc_Obj_t *pObj)
Definition: abcObj.c:244
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkMakeSeq ( Abc_Ntk_t pNtk,
int  nLatchesToAdd 
)

Function*************************************************************

Synopsis [Converts the network to sequential.]

Description []

SideEffects []

SeeAlso []

Definition at line 1514 of file abcNtk.c.

1515 {
1516  Abc_Obj_t * pObjLi, * pObjLo, * pObj;
1517  int i;
1518  assert( Abc_NtkBoxNum(pNtk) == 0 );
1519  if ( !Abc_NtkIsComb(pNtk) )
1520  {
1521  printf( "The network is a not a combinational one.\n" );
1522  return;
1523  }
1524  if ( nLatchesToAdd >= Abc_NtkPiNum(pNtk) )
1525  {
1526  printf( "The number of latches is more or equal than the number of PIs.\n" );
1527  return;
1528  }
1529  if ( nLatchesToAdd >= Abc_NtkPoNum(pNtk) )
1530  {
1531  printf( "The number of latches is more or equal than the number of POs.\n" );
1532  return;
1533  }
1534 
1535  // move the last PIs to become CIs
1536  Vec_PtrClear( pNtk->vPis );
1537  Abc_NtkForEachCi( pNtk, pObj, i )
1538  {
1539  if ( i < Abc_NtkCiNum(pNtk) - nLatchesToAdd )
1540  {
1541  Vec_PtrPush( pNtk->vPis, pObj );
1542  continue;
1543  }
1544  pObj->Type = ABC_OBJ_BO;
1545  pNtk->nObjCounts[ABC_OBJ_PI]--;
1546  pNtk->nObjCounts[ABC_OBJ_BO]++;
1547  }
1548 
1549  // move the last POs to become COs
1550  Vec_PtrClear( pNtk->vPos );
1551  Abc_NtkForEachCo( pNtk, pObj, i )
1552  {
1553  if ( i < Abc_NtkCoNum(pNtk) - nLatchesToAdd )
1554  {
1555  Vec_PtrPush( pNtk->vPos, pObj );
1556  continue;
1557  }
1558  pObj->Type = ABC_OBJ_BI;
1559  pNtk->nObjCounts[ABC_OBJ_PO]--;
1560  pNtk->nObjCounts[ABC_OBJ_BI]++;
1561  }
1562 
1563  // create latches
1564  for ( i = 0; i < nLatchesToAdd; i++ )
1565  {
1566  pObjLo = Abc_NtkCi( pNtk, Abc_NtkCiNum(pNtk) - nLatchesToAdd + i );
1567  pObjLi = Abc_NtkCo( pNtk, Abc_NtkCoNum(pNtk) - nLatchesToAdd + i );
1568  pObj = Abc_NtkCreateLatch( pNtk );
1569  Abc_ObjAddFanin( pObj, pObjLi );
1570  Abc_ObjAddFanin( pObjLo, pObj );
1571  Abc_LatchSetInit0( pObj );
1572  }
1573 
1574  if ( !Abc_NtkCheck( pNtk ) )
1575  fprintf( stdout, "Abc_NtkMakeSeq(): Network check has failed.\n" );
1576 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
static int Abc_NtkIsComb(Abc_Ntk_t *pNtk)
Definition: abc.h:297
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
Vec_Ptr_t * vPis
Definition: abc.h:163
unsigned Type
Definition: abc.h:133
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
Vec_Ptr_t * vPos
Definition: abc.h:164
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
Definition: abc.h:89
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
Abc_Ntk_t* Abc_NtkNodeDup ( Abc_Ntk_t pNtkInit,
int  nLimit,
int  fVerbose 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2079 of file abcNtk.c.

2080 {
2081  Vec_Ptr_t * vNodes, * vFanouts;
2082  Abc_Ntk_t * pNtk;
2083  Abc_Obj_t * pObj, * pObjNew, * pFanin, * pFanout;
2084  int i, k;
2085  pNtk = Abc_NtkDup( pNtkInit );
2086  vNodes = Vec_PtrAlloc( 100 );
2087  vFanouts = Vec_PtrAlloc( 100 );
2088  do
2089  {
2090  Vec_PtrClear( vNodes );
2091  Abc_NtkForEachNode( pNtk, pObj, i )
2092  if ( Abc_ObjFanoutNum(pObj) >= nLimit )
2093  Vec_PtrPush( vNodes, pObj );
2094  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
2095  {
2096  pObjNew = Abc_NtkDupObj( pNtk, pObj, 0 );
2097  Abc_ObjForEachFanin( pObj, pFanin, k )
2098  Abc_ObjAddFanin( pObjNew, pFanin );
2099  Abc_NodeCollectFanouts( pObj, vFanouts );
2100  Vec_PtrShrink( vFanouts, nLimit / 2 );
2101  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, k )
2102  Abc_ObjPatchFanin( pFanout, pObj, pObjNew );
2103  }
2104  if ( fVerbose )
2105  printf( "Duplicated %d nodes.\n", Vec_PtrSize(vNodes) );
2106  }
2107  while ( Vec_PtrSize(vNodes) > 0 );
2108  Vec_PtrFree( vFanouts );
2109  Vec_PtrFree( vNodes );
2110  return pNtk;
2111 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkPermute ( Abc_Ntk_t pNtk,
int  fInputs,
int  fOutputs,
int  fFlops,
char *  pFlopPermFile 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1906 of file abcNtk.c.

1907 {
1908  Abc_Obj_t * pTemp;
1909  Vec_Int_t * vInputs, * vOutputs, * vFlops, * vTemp;
1910  int i, k, Entry;
1911  // start permutation arrays
1912  if ( pFlopPermFile )
1913  {
1914  vFlops = Abc_NtkReadFlopPerm( pFlopPermFile, Abc_NtkLatchNum(pNtk) );
1915  if ( vFlops == NULL )
1916  return;
1917  fInputs = 0;
1918  fOutputs = 0;
1919  fFlops = 0;
1920  }
1921  else
1922  vFlops = Vec_IntStartNatural( Abc_NtkLatchNum(pNtk) );
1923  vInputs = Vec_IntStartNatural( Abc_NtkPiNum(pNtk) );
1924  vOutputs = Vec_IntStartNatural( Abc_NtkPoNum(pNtk) );
1925  // permute inputs
1926  if ( fInputs )
1927  for ( i = 0; i < Abc_NtkPiNum(pNtk); i++ )
1928  {
1929  k = rand() % Abc_NtkPiNum(pNtk);
1930  // swap indexes
1931  Entry = Vec_IntEntry( vInputs, i );
1932  Vec_IntWriteEntry( vInputs, i, Vec_IntEntry(vInputs, k) );
1933  Vec_IntWriteEntry( vInputs, k, Entry );
1934  // swap PIs
1935  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPis, i );
1936  Vec_PtrWriteEntry( pNtk->vPis, i, Vec_PtrEntry(pNtk->vPis, k) );
1937  Vec_PtrWriteEntry( pNtk->vPis, k, pTemp );
1938  // swap CIs
1939  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, i );
1940  Vec_PtrWriteEntry( pNtk->vCis, i, Vec_PtrEntry(pNtk->vCis, k) );
1941  Vec_PtrWriteEntry( pNtk->vCis, k, pTemp );
1942 //printf( "Swapping PIs %d and %d.\n", i, k );
1943  }
1944  // permute outputs
1945  if ( fOutputs )
1946  for ( i = 0; i < Abc_NtkPoNum(pNtk); i++ )
1947  {
1948  k = rand() % Abc_NtkPoNum(pNtk);
1949  // swap indexes
1950  Entry = Vec_IntEntry( vOutputs, i );
1951  Vec_IntWriteEntry( vOutputs, i, Vec_IntEntry(vOutputs, k) );
1952  Vec_IntWriteEntry( vOutputs, k, Entry );
1953  // swap POs
1954  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPos, i );
1955  Vec_PtrWriteEntry( pNtk->vPos, i, Vec_PtrEntry(pNtk->vPos, k) );
1956  Vec_PtrWriteEntry( pNtk->vPos, k, pTemp );
1957  // swap COs
1958  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, i );
1959  Vec_PtrWriteEntry( pNtk->vCos, i, Vec_PtrEntry(pNtk->vCos, k) );
1960  Vec_PtrWriteEntry( pNtk->vCos, k, pTemp );
1961 //printf( "Swapping POs %d and %d.\n", i, k );
1962  }
1963  // permute flops
1964  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
1965  if ( fFlops )
1966  for ( i = 0; i < Abc_NtkLatchNum(pNtk); i++ )
1967  {
1968  k = rand() % Abc_NtkLatchNum(pNtk);
1969  // swap indexes
1970  Entry = Vec_IntEntry( vFlops, i );
1971  Vec_IntWriteEntry( vFlops, i, Vec_IntEntry(vFlops, k) );
1972  Vec_IntWriteEntry( vFlops, k, Entry );
1973  // swap flops
1974  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vBoxes, i );
1975  Vec_PtrWriteEntry( pNtk->vBoxes, i, Vec_PtrEntry(pNtk->vBoxes, k) );
1976  Vec_PtrWriteEntry( pNtk->vBoxes, k, pTemp );
1977  // swap CIs
1978  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+i );
1979  Vec_PtrWriteEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+i, Vec_PtrEntry(pNtk->vCis, Abc_NtkPiNum(pNtk)+k) );
1980  Vec_PtrWriteEntry( pNtk->vCis, Abc_NtkPiNum(pNtk)+k, pTemp );
1981  // swap COs
1982  pTemp = (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+i );
1983  Vec_PtrWriteEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+i, Vec_PtrEntry(pNtk->vCos, Abc_NtkPoNum(pNtk)+k) );
1984  Vec_PtrWriteEntry( pNtk->vCos, Abc_NtkPoNum(pNtk)+k, pTemp );
1985 
1986 //printf( "Swapping flops %d and %d.\n", i, k );
1987  }
1988  // invert arrays
1989  vInputs = Vec_IntInvert( vTemp = vInputs, -1 );
1990  Vec_IntFree( vTemp );
1991  vOutputs = Vec_IntInvert( vTemp = vOutputs, -1 );
1992  Vec_IntFree( vTemp );
1993  vFlops = Vec_IntInvert( vTemp = vFlops, -1 );
1994  Vec_IntFree( vTemp );
1995  // pack the results into the output array
1996  Vec_IntFreeP( &pNtk->vObjPerm );
1997  pNtk->vObjPerm = Vec_IntAlloc( Abc_NtkPiNum(pNtk) + Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) );
1998  Vec_IntForEachEntry( vInputs, Entry, i )
1999  Vec_IntPush( pNtk->vObjPerm, Entry );
2000  Vec_IntForEachEntry( vOutputs, Entry, i )
2001  Vec_IntPush( pNtk->vObjPerm, Entry );
2002  Vec_IntForEachEntry( vFlops, Entry, i )
2003  Vec_IntPush( pNtk->vObjPerm, Entry );
2004  // cleanup
2005  Vec_IntFree( vInputs );
2006  Vec_IntFree( vOutputs );
2007  Vec_IntFree( vFlops );
2008 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
Vec_Ptr_t * vPis
Definition: abc.h:163
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
Vec_Int_t * vObjPerm
Definition: abc.h:212
Vec_Int_t * Abc_NtkReadFlopPerm(char *pFileName, int nFlops)
Definition: abcNtk.c:1859
Vec_Ptr_t * vCis
Definition: abc.h:165
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Ptr_t * vPos
Definition: abc.h:164
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Ptr_t * vCos
Definition: abc.h:166
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t* Abc_NtkReadFlopPerm ( char *  pFileName,
int  nFlops 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1859 of file abcNtk.c.

1860 {
1861  char Buffer[1000];
1862  FILE * pFile;
1863  Vec_Int_t * vFlops;
1864  int iFlop = -1;
1865  pFile = fopen( pFileName, "rb" );
1866  if ( pFile == NULL )
1867  {
1868  printf( "Cannot open input file \"%s\".\n", pFileName );
1869  return NULL;
1870  }
1871  vFlops = Vec_IntAlloc( nFlops );
1872  while ( fgets( Buffer, 1000, pFile ) != NULL )
1873  {
1874  if ( Buffer[0] == ' ' || Buffer[0] == '\r' || Buffer[0] == '\n' )
1875  continue;
1876  iFlop = atoi( Buffer );
1877  if ( iFlop < 0 || iFlop >= nFlops )
1878  {
1879  printf( "Flop ID (%d) is out of range.\n", iFlop );
1880  fclose( pFile );
1881  Vec_IntFree( vFlops );
1882  return NULL;
1883  }
1884  Vec_IntPush( vFlops, iFlop );
1885  }
1886  fclose( pFile );
1887  if ( Vec_IntSize(vFlops) != nFlops )
1888  {
1889  printf( "The number of flops read in from file (%d) is different from the number of flops in the circuit (%d).\n", iFlop, nFlops );
1890  Vec_IntFree( vFlops );
1891  return NULL;
1892  }
1893  return vFlops;
1894 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Abc_NtkRemovePo ( Abc_Ntk_t pNtk,
int  iOutput,
int  fRemoveConst0 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1841 of file abcNtk.c.

1842 {
1843  Abc_Obj_t * pObj = Abc_NtkPo(pNtk, iOutput);
1844  if ( Abc_ObjFanin0(pObj) == Abc_AigConst1(pNtk) && Abc_ObjFaninC0(pObj) == fRemoveConst0 )
1845  Abc_NtkDeleteObj( pObj );
1846 }
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
Abc_Ntk_t* Abc_NtkRestrashWithLatches ( Abc_Ntk_t pNtk,
int  nLatches 
)

Function*************************************************************

Synopsis [Duplicate the AIG while adding latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 528 of file abcNtk.c.

529 {
530  Abc_Ntk_t * pNtkAig;
531  Abc_Obj_t * pObj;
532  int i;
533  assert( Abc_NtkIsStrash(pNtk) );
534  // start the new network (constants and CIs of the old network will point to the their counterparts in the new network)
535  pNtkAig = Abc_NtkStartFromWithLatches( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG, nLatches );
536  // restrash the nodes (assuming a topological order of the old network)
537  Abc_NtkForEachNode( pNtk, pObj, i )
538  pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
539  // finalize the network
540  Abc_NtkFinalize( pNtk, pNtkAig );
541  // make sure everything is okay
542  if ( !Abc_NtkCheck( pNtkAig ) )
543  {
544  printf( "Abc_NtkStrash: The network check has failed.\n" );
545  Abc_NtkDelete( pNtkAig );
546  return NULL;
547  }
548  return pNtkAig;
549 
550 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
if(last==0)
Definition: sparse_int.h:34
Abc_Ntk_t * Abc_NtkStartFromWithLatches(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func, int nLatches)
Definition: abcNtk.c:171
void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition: abcNtk.c:302
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t* Abc_NtkStartFrom ( Abc_Ntk_t pNtk,
Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func 
)

Function*************************************************************

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file abcNtk.c.

107 {
108  Abc_Ntk_t * pNtkNew;
109  Abc_Obj_t * pObj;
110  int fCopyNames, i;
111  if ( pNtk == NULL )
112  return NULL;
113  // decide whether to copy the names
114  fCopyNames = ( Type != ABC_NTK_NETLIST );
115  // start the network
116  pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
117  pNtkNew->nConstrs = pNtk->nConstrs;
118  pNtkNew->nBarBufs = pNtk->nBarBufs;
119  // duplicate the name and the spec
120  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
121  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
122  // clean the node copy fields
123  Abc_NtkCleanCopy( pNtk );
124  // map the constant nodes
125  if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) )
126  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
127  // clone CIs/CIs/boxes
128  Abc_NtkForEachPi( pNtk, pObj, i )
129  Abc_NtkDupObj( pNtkNew, pObj, fCopyNames );
130  Abc_NtkForEachPo( pNtk, pObj, i )
131  Abc_NtkDupObj( pNtkNew, pObj, fCopyNames );
132  Abc_NtkForEachBox( pNtk, pObj, i )
133  Abc_NtkDupBox( pNtkNew, pObj, fCopyNames );
134  // transfer logic level
135  Abc_NtkForEachCi( pNtk, pObj, i )
136  pObj->pCopy->Level = pObj->Level;
137  // transfer the names
138 // Abc_NtkTrasferNames( pNtk, pNtkNew );
139  Abc_ManTimeDup( pNtk, pNtkNew );
140  if ( pNtk->vOnehots )
141  pNtkNew->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
142  if ( pNtk->pSeqModel )
143  pNtkNew->pSeqModel = Abc_CexDup( pNtk->pSeqModel, Abc_NtkLatchNum(pNtk) );
144  if ( pNtk->vObjPerm )
145  pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
146  pNtkNew->AndGateDelay = pNtk->AndGateDelay;
147  // initialize logic level of the CIs
148  if ( pNtk->AndGateDelay != 0.0 && pNtk->pManTime != NULL && pNtk->ntkType != ABC_NTK_STRASH && Type == ABC_NTK_STRASH )
149  {
150  Abc_NtkForEachCi( pNtk, pObj, i )
151  pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay);
152  }
153  // check that the CI/CO/latches are copied correctly
154  assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkNew) );
155  assert( Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkNew) );
156  assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
157  return pNtkNew;
158 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
char * Extra_UtilStrsav(const char *s)
static Vec_Vec_t * Vec_VecDupInt(Vec_Vec_t *p)
Definition: vecVec.h:395
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int nBarBufs
Definition: abc.h:174
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
ABC_DLL float Abc_NodeReadArrivalAve(Abc_Obj_t *pNode)
Definition: abcTiming.c:87
char * pName
Definition: abc.h:158
ABC_DLL void Abc_ManTimeDup(Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
Definition: abcTiming.c:481
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
Abc_Ntk_t* Abc_NtkStartFromNoLatches ( Abc_Ntk_t pNtk,
Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func 
)

Function*************************************************************

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 248 of file abcNtk.c.

249 {
250  Abc_Ntk_t * pNtkNew;
251  Abc_Obj_t * pObj;
252  int i;
253  if ( pNtk == NULL )
254  return NULL;
255  assert( Type != ABC_NTK_NETLIST );
256  // start the network
257  pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
258  pNtkNew->nConstrs = pNtk->nConstrs;
259  pNtkNew->nBarBufs = pNtk->nBarBufs;
260  // duplicate the name and the spec
261  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
262  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
263  // clean the node copy fields
264  Abc_NtkCleanCopy( pNtk );
265  // map the constant nodes
266  if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) )
267  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
268  // clone CIs/CIs/boxes
269  Abc_NtkForEachPi( pNtk, pObj, i )
270  Abc_NtkDupObj( pNtkNew, pObj, 1 );
271  Abc_NtkForEachPo( pNtk, pObj, i )
272  Abc_NtkDupObj( pNtkNew, pObj, 1 );
273  Abc_NtkForEachBox( pNtk, pObj, i )
274  {
275  if ( Abc_ObjIsLatch(pObj) )
276  continue;
277  Abc_NtkDupBox(pNtkNew, pObj, 1);
278  }
279  if ( pNtk->vObjPerm )
280  pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
281  pNtkNew->AndGateDelay = pNtk->AndGateDelay;
282  // transfer the names
283 // Abc_NtkTrasferNamesNoLatches( pNtk, pNtkNew );
284  Abc_ManTimeDup( pNtk, pNtkNew );
285  // check that the CI/CO/latches are copied correctly
286  assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
287  assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
288  return pNtkNew;
289 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
char * Extra_UtilStrsav(const char *s)
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition: abcObj.c:407
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition: abc.h:495
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
int nBarBufs
Definition: abc.h:174
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
char * pName
Definition: abc.h:158
ABC_DLL void Abc_ManTimeDup(Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
Definition: abcTiming.c:481
int nConstrs
Definition: abc.h:173
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
Abc_Ntk_t* Abc_NtkStartFromWithLatches ( Abc_Ntk_t pNtk,
Abc_NtkType_t  Type,
Abc_NtkFunc_t  Func,
int  nLatches 
)

Function*************************************************************

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file abcNtk.c.

172 {
173  Abc_Ntk_t * pNtkNew;
174  Abc_Obj_t * pObj, * pNode0, * pNode1;
175  int fCopyNames, i;
176  if ( pNtk == NULL )
177  return NULL;
178  assert( Abc_NtkLatchNum(pNtk) == 0 );
179  // decide whether to copy the names
180  fCopyNames = ( Type != ABC_NTK_NETLIST );
181  // start the network
182  pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
183  pNtkNew->nConstrs = pNtk->nConstrs;
184  pNtkNew->nBarBufs = pNtk->nBarBufs;
185  // duplicate the name and the spec
186  pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
187  pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
188  // clean the node copy fields
189  Abc_NtkCleanCopy( pNtk );
190  // map the constant nodes
191  if ( Abc_NtkIsStrash(pNtk) && Abc_NtkIsStrash(pNtkNew) )
192  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
193  // clone CIs/CIs/boxes
194  for ( i = 0; i < Abc_NtkPiNum(pNtk)-nLatches; i++ )
195  Abc_NtkDupObj( pNtkNew, Abc_NtkPi(pNtk, i), fCopyNames );
196  for ( i = 0; i < Abc_NtkPoNum(pNtk)-nLatches; i++ )
197  Abc_NtkDupObj( pNtkNew, Abc_NtkPo(pNtk, i), fCopyNames );
198  for ( i = 0; i < nLatches; i++ )
199  {
200  pObj = Abc_NtkCreateLatch(pNtkNew);
201  Abc_LatchSetInit0( pObj );
202  pNode0 = Abc_NtkCreateBi(pNtkNew);
203  Abc_NtkPo(pNtk, Abc_NtkPoNum(pNtk)-nLatches+i)->pCopy = pNode0;
204  pNode1 = Abc_NtkCreateBo(pNtkNew);
205  Abc_NtkPi(pNtk, Abc_NtkPiNum(pNtk)-nLatches+i)->pCopy = pNode1;
206  Abc_ObjAddFanin( pObj, pNode0 );
207  Abc_ObjAddFanin( pNode1, pObj );
208  Abc_ObjAssignName( pNode0, Abc_ObjName(pNode0), NULL );
209  Abc_ObjAssignName( pNode1, Abc_ObjName(pNode1), NULL );
210  }
211  // transfer logic level
212 // Abc_NtkForEachCi( pNtk, pObj, i )
213 // pObj->pCopy->Level = pObj->Level;
214  // transfer the names
215 // Abc_NtkTrasferNames( pNtk, pNtkNew );
216  Abc_ManTimeDup( pNtk, pNtkNew );
217  if ( pNtk->vOnehots )
218  pNtkNew->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
219  if ( pNtk->pSeqModel )
220  pNtkNew->pSeqModel = Abc_CexDup( pNtk->pSeqModel, Abc_NtkLatchNum(pNtk) );
221  if ( pNtk->vObjPerm )
222  pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
223  pNtkNew->AndGateDelay = pNtk->AndGateDelay;
224  // initialize logic level of the CIs
225  if ( pNtk->AndGateDelay != 0.0 && pNtk->pManTime != NULL && pNtk->ntkType != ABC_NTK_STRASH && Type == ABC_NTK_STRASH )
226  {
227  Abc_NtkForEachCi( pNtk, pObj, i )
228  pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay);
229  }
230  // check that the CI/CO/latches are copied correctly
231  assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkNew) );
232  assert( Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkNew) );
233  assert( nLatches == Abc_NtkLatchNum(pNtkNew) );
234  return pNtkNew;
235 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
float AndGateDelay
Definition: abc.h:194
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
Vec_Int_t * vObjPerm
Definition: abc.h:212
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
static Vec_Vec_t * Vec_VecDupInt(Vec_Vec_t *p)
Definition: vecVec.h:395
Abc_Obj_t * pCopy
Definition: abc.h:148
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
Abc_Cex_t * pSeqModel
Definition: abc.h:199
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
int nBarBufs
Definition: abc.h:174
Vec_Ptr_t * vOnehots
Definition: abc.h:211
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition: utilCex.c:145
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
Abc_ManTime_t * pManTime
Definition: abc.h:192
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
ABC_DLL float Abc_NodeReadArrivalAve(Abc_Obj_t *pNode)
Definition: abcTiming.c:87
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
char * pName
Definition: abc.h:158
ABC_DLL void Abc_ManTimeDup(Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
Definition: abcTiming.c:481
Abc_NtkType_t ntkType
Definition: abc.h:156
int nConstrs
Definition: abc.h:173
Abc_Ntk_t* Abc_NtkStartRead ( char *  pName)

Function*************************************************************

Synopsis [Starts a new network using existing network as a model.]

Description []

SideEffects []

SeeAlso []

Definition at line 333 of file abcNtk.c.

334 {
335  Abc_Ntk_t * pNtkNew;
336  // allocate the empty network
337  pNtkNew = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_SOP, 1 );
338  // set the specs
339  pNtkNew->pName = Extra_FileNameGeneric(pName);
340  pNtkNew->pSpec = Extra_UtilStrsav(pName);
341  if ( pNtkNew->pName == NULL || strlen(pNtkNew->pName) == 0 )
342  {
343  ABC_FREE( pNtkNew->pName );
344  pNtkNew->pName = Extra_UtilStrsav("unknown");
345  }
346  return pNtkNew;
347 }
char * Extra_UtilStrsav(const char *s)
char * Extra_FileNameGeneric(char *FileName)
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
char * pSpec
Definition: abc.h:159
#define ABC_FREE(obj)
Definition: abc_global.h:232
int strlen()
char * pName
Definition: abc.h:158
void Abc_NtkSwapOneOutput ( Abc_Ntk_t pNtk,
int  iOutput 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1802 of file abcNtk.c.

1803 {
1804  Abc_Obj_t * pObj1, * pObj2;
1805  Abc_Obj_t * pChild1Old, * pChild2Old;
1806  Abc_Obj_t * pChild1, * pChild2;
1807  if ( iOutput == 0 )
1808  return;
1809  pObj1 = Abc_NtkPo( pNtk, 0 );
1810  pObj2 = Abc_NtkPo( pNtk, iOutput );
1811  if ( Abc_ObjFanin0(pObj1) == Abc_ObjFanin0(pObj2) )
1812  {
1813  if ( Abc_ObjFaninC0(pObj1) ^ Abc_ObjFaninC0(pObj2) )
1814  {
1815  Abc_ObjXorFaninC( pObj1, 0 );
1816  Abc_ObjXorFaninC( pObj2, 0 );
1817  }
1818  return;
1819  }
1820  pChild1Old = Abc_ObjChild0( pObj1 );
1821  pChild2Old = Abc_ObjChild0( pObj2 );
1822  pChild1 = Abc_ObjNotCond( pChild1Old, Abc_ObjFaninC0(pObj2) );
1823  pChild2 = Abc_ObjNotCond( pChild2Old, Abc_ObjFaninC0(pObj1) );
1824  Abc_ObjPatchFanin( pObj1, Abc_ObjFanin0(pObj1), pChild2 );
1825  Abc_ObjPatchFanin( pObj2, Abc_ObjFanin0(pObj2), pChild1 );
1826  assert( Abc_ObjChild0(pObj1) == pChild2Old );
1827  assert( Abc_ObjChild0(pObj2) == pChild1Old );
1828 }
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static void Abc_ObjXorFaninC(Abc_Obj_t *pObj, int i)
Definition: abc.h:381
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t* Abc_NtkTrim ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Removes POs with suppsize less than 2 and PIs without fanout.]

Description []

SideEffects []

SeeAlso []

Definition at line 1654 of file abcNtk.c.

1655 {
1656  Abc_Obj_t * pObj;
1657  int i, k, m;
1658 
1659  // filter POs
1660  k = m = 0;
1661  Abc_NtkForEachCo( pNtk, pObj, i )
1662  {
1663  if ( Abc_ObjIsPo(pObj) )
1664  {
1665  // remove constant nodes and PI pointers
1666  if ( Abc_ObjFaninNum(Abc_ObjFanin0(pObj)) == 0 )
1667  {
1668  Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) );
1669  if ( Abc_ObjFanoutNum(Abc_ObjFanin0(pObj)) == 0 && !Abc_ObjIsPi(Abc_ObjFanin0(pObj)) )
1670  Abc_NtkDeleteObj_rec( Abc_ObjFanin0(pObj), 1 );
1671  pNtk->vObjs->pArray[pObj->Id] = NULL;
1672  pObj->Id = (1<<26)-1;
1673  pNtk->nObjCounts[pObj->Type]--;
1674  pNtk->nObjs--;
1675  Abc_ObjRecycle( pObj );
1676  continue;
1677  }
1678  // remove buffers/inverters of PIs
1679  if ( Abc_ObjFaninNum(Abc_ObjFanin0(pObj)) == 1 )
1680  {
1681  if ( Abc_ObjIsPi(Abc_ObjFanin0(Abc_ObjFanin0(pObj))) )
1682  {
1683  Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) );
1684  if ( Abc_ObjFanoutNum(Abc_ObjFanin0(pObj)) == 0 )
1685  Abc_NtkDeleteObj_rec( Abc_ObjFanin0(pObj), 1 );
1686  pNtk->vObjs->pArray[pObj->Id] = NULL;
1687  pObj->Id = (1<<26)-1;
1688  pNtk->nObjCounts[pObj->Type]--;
1689  pNtk->nObjs--;
1690  Abc_ObjRecycle( pObj );
1691  continue;
1692  }
1693  }
1694  Vec_PtrWriteEntry( pNtk->vPos, m++, pObj );
1695  }
1696  Vec_PtrWriteEntry( pNtk->vCos, k++, pObj );
1697  }
1698  Vec_PtrShrink( pNtk->vPos, m );
1699  Vec_PtrShrink( pNtk->vCos, k );
1700 
1701  // filter PIs
1702  k = m = 0;
1703  Abc_NtkForEachCi( pNtk, pObj, i )
1704  {
1705  if ( Abc_ObjIsPi(pObj) )
1706  {
1707  if ( Abc_ObjFanoutNum(pObj) == 0 )
1708  {
1709  pNtk->vObjs->pArray[pObj->Id] = NULL;
1710  pObj->Id = (1<<26)-1;
1711  pNtk->nObjCounts[pObj->Type]--;
1712  pNtk->nObjs--;
1713  Abc_ObjRecycle( pObj );
1714  continue;
1715  }
1716  Vec_PtrWriteEntry( pNtk->vPis, m++, pObj );
1717  }
1718  Vec_PtrWriteEntry( pNtk->vCis, k++, pObj );
1719  }
1720  Vec_PtrShrink( pNtk->vPis, m );
1721  Vec_PtrShrink( pNtk->vCis, k );
1722 
1723  return Abc_NtkDup( pNtk );
1724 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
unsigned Type
Definition: abc.h:133
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int nObjs
Definition: abc.h:172
ABC_DLL void Abc_ObjRecycle(Abc_Obj_t *pObj)
Definition: abcObj.c:74
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int Id
Definition: abc.h:132
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
void Abc_NtkUnpermute ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2021 of file abcNtk.c.

2022 {
2023  Vec_Ptr_t * vTemp, * vTemp2, * vLatch;
2024  int i, * pInputs, * pOutputs, * pFlops;
2025  if ( pNtk->vObjPerm == NULL )
2026  {
2027  printf( "Abc_NtkUnpermute(): Initial permutation is not available.\n" );
2028  return;
2029  }
2030  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
2031  // get reverve permutation
2032  pInputs = Vec_IntArray( pNtk->vObjPerm );
2033  pOutputs = pInputs + Abc_NtkPiNum(pNtk);
2034  pFlops = pOutputs + Abc_NtkPoNum(pNtk);
2035  // create new PI array
2036  vTemp = Vec_PtrAlloc( Abc_NtkPiNum(pNtk) );
2037  for ( i = 0; i < Abc_NtkPiNum(pNtk); i++ )
2038  Vec_PtrPush( vTemp, Abc_NtkPi(pNtk, pInputs[i]) );
2039  Vec_PtrFreeP( &pNtk->vPis );
2040  pNtk->vPis = vTemp;
2041  // create new PO array
2042  vTemp = Vec_PtrAlloc( Abc_NtkPoNum(pNtk) );
2043  for ( i = 0; i < Abc_NtkPoNum(pNtk); i++ )
2044  Vec_PtrPush( vTemp, Abc_NtkPo(pNtk, pOutputs[i]) );
2045  Vec_PtrFreeP( &pNtk->vPos );
2046  pNtk->vPos = vTemp;
2047  // create new CI/CO arrays
2048  vTemp = Vec_PtrDup( pNtk->vPis );
2049  vTemp2 = Vec_PtrDup( pNtk->vPos );
2050  vLatch = Vec_PtrAlloc( Abc_NtkLatchNum(pNtk) );
2051  for ( i = 0; i < Abc_NtkLatchNum(pNtk); i++ )
2052  {
2053 //printf( "Setting flop %d to be %d.\n", i, pFlops[i] );
2054  Vec_PtrPush( vTemp, Abc_NtkCi(pNtk, Abc_NtkPiNum(pNtk) + pFlops[i]) );
2055  Vec_PtrPush( vTemp2, Abc_NtkCo(pNtk, Abc_NtkPoNum(pNtk) + pFlops[i]) );
2056  Vec_PtrPush( vLatch, Abc_NtkBox(pNtk, pFlops[i]) );
2057  }
2058  Vec_PtrFreeP( &pNtk->vCis );
2059  Vec_PtrFreeP( &pNtk->vCos );
2060  Vec_PtrFreeP( &pNtk->vBoxes );
2061  pNtk->vCis = vTemp;
2062  pNtk->vCos = vTemp2;
2063  pNtk->vBoxes = vLatch;
2064  // cleanup
2065  Vec_IntFreeP( &pNtk->vObjPerm );
2066 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
Vec_Ptr_t * vPis
Definition: abc.h:163
Vec_Int_t * vObjPerm
Definition: abc.h:212
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkPi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:315