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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Abc_Obj_t
Abc_ObjAlloc (Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
 DECLARATIONS ///. More...
 
void Abc_ObjRecycle (Abc_Obj_t *pObj)
 
Abc_Obj_tAbc_NtkCreateObj (Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
 
void Abc_NtkDeleteObj (Abc_Obj_t *pObj)
 
void Abc_NtkDeleteObjPo (Abc_Obj_t *pObj)
 
void Abc_NtkDeleteObj_rec (Abc_Obj_t *pObj, int fOnlyNodes)
 
void Abc_NtkDeleteAll_rec (Abc_Obj_t *pObj)
 
Abc_Obj_tAbc_NtkDupObj (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
 
Abc_Obj_tAbc_NtkDupBox (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
 
Abc_Obj_tAbc_NtkCloneObj (Abc_Obj_t *pObj)
 
Abc_Obj_tAbc_NtkFindNode (Abc_Ntk_t *pNtk, char *pName)
 
Abc_Obj_tAbc_NtkFindNet (Abc_Ntk_t *pNtk, char *pName)
 
Abc_Obj_tAbc_NtkFindCi (Abc_Ntk_t *pNtk, char *pName)
 
Abc_Obj_tAbc_NtkFindCo (Abc_Ntk_t *pNtk, char *pName)
 
Abc_Obj_tAbc_NtkFindOrCreateNet (Abc_Ntk_t *pNtk, char *pName)
 
Abc_Obj_tAbc_NtkCreateNodeConst0 (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_NtkCreateNodeConst1 (Abc_Ntk_t *pNtk)
 
Abc_Obj_tAbc_NtkCreateNodeInv (Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
 
Abc_Obj_tAbc_NtkCreateNodeBuf (Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
 
Abc_Obj_tAbc_NtkCreateNodeAnd (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
Abc_Obj_tAbc_NtkCreateNodeOr (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
Abc_Obj_tAbc_NtkCreateNodeExor (Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
 
Abc_Obj_tAbc_NtkCreateNodeMux (Abc_Ntk_t *pNtk, Abc_Obj_t *pNodeC, Abc_Obj_t *pNode1, Abc_Obj_t *pNode0)
 
int Abc_NodeIsConst (Abc_Obj_t *pNode)
 
int Abc_NodeIsConst0 (Abc_Obj_t *pNode)
 
int Abc_NodeIsConst1 (Abc_Obj_t *pNode)
 
int Abc_NodeIsBuf (Abc_Obj_t *pNode)
 
int Abc_NodeIsInv (Abc_Obj_t *pNode)
 
void Abc_NodeComplement (Abc_Obj_t *pNode)
 
void Abc_NodeComplementInput (Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
 

Function Documentation

void Abc_NodeComplement ( Abc_Obj_t pNode)

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

Synopsis [Complements the local functions of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 980 of file abcObj.c.

981 {
982  assert( Abc_NtkIsLogic(pNode->pNtk) || Abc_NtkIsNetlist(pNode->pNtk) );
983  assert( Abc_ObjIsNode(pNode) );
984  if ( Abc_NtkHasSop(pNode->pNtk) )
985  Abc_SopComplement( (char *)pNode->pData );
986  else if ( Abc_NtkHasAig(pNode->pNtk) )
987  pNode->pData = Hop_Not( (Hop_Obj_t *)pNode->pData );
988  else if ( Abc_NtkHasBdd(pNode->pNtk) )
989  pNode->pData = Cudd_Not( pNode->pData );
990  else
991  assert( 0 );
992 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
#define Cudd_Not(node)
Definition: cudd.h:367
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
ABC_DLL void Abc_SopComplement(char *pSop)
Definition: abcSop.c:600
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Abc_NodeComplementInput ( Abc_Obj_t pNode,
Abc_Obj_t pFanin 
)

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

Synopsis [Changes the polarity of one fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 1005 of file abcObj.c.

1006 {
1007  int iFanin;
1008  if ( (iFanin = Vec_IntFind( &pNode->vFanins, pFanin->Id )) == -1 )
1009  {
1010  printf( "Node %s should be among", Abc_ObjName(pFanin) );
1011  printf( " the fanins of node %s...\n", Abc_ObjName(pNode) );
1012  return;
1013  }
1014  if ( Abc_NtkHasSop(pNode->pNtk) )
1015  Abc_SopComplementVar( (char *)pNode->pData, iFanin );
1016  else if ( Abc_NtkHasAig(pNode->pNtk) )
1017  pNode->pData = Hop_Complement( (Hop_Man_t *)pNode->pNtk->pManFunc, (Hop_Obj_t *)pNode->pData, iFanin );
1018  else if ( Abc_NtkHasBdd(pNode->pNtk) )
1019  {
1020  DdManager * dd = (DdManager *)pNode->pNtk->pManFunc;
1021  DdNode * bVar, * bCof0, * bCof1;
1022  bVar = Cudd_bddIthVar( dd, iFanin );
1023  bCof0 = Cudd_Cofactor( dd, (DdNode *)pNode->pData, Cudd_Not(bVar) ); Cudd_Ref( bCof0 );
1024  bCof1 = Cudd_Cofactor( dd, (DdNode *)pNode->pData, bVar ); Cudd_Ref( bCof1 );
1025  Cudd_RecursiveDeref( dd, (DdNode *)pNode->pData );
1026  pNode->pData = Cudd_bddIte( dd, bVar, bCof0, bCof1 ); Cudd_Ref( (DdNode *)pNode->pData );
1027  Cudd_RecursiveDeref( dd, bCof0 );
1028  Cudd_RecursiveDeref( dd, bCof1 );
1029  }
1030  else
1031  assert( 0 );
1032 }
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
#define Cudd_Not(node)
Definition: cudd.h:367
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
Vec_Int_t vFanins
Definition: abc.h:143
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
Definition: hop.h:65
ABC_DLL void Abc_SopComplementVar(char *pSop, int iVar)
Definition: abcSop.c:630
void * pManFunc
Definition: abc.h:191
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddCof.c:123
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_Complement(Hop_Man_t *p, Hop_Obj_t *pRoot, int iVar)
Definition: hopDfs.c:469
int Abc_NodeIsBuf ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a buffer.]

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file abcObj.c.

921 {
922  Abc_Ntk_t * pNtk = pNode->pNtk;
923  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
924  assert( Abc_ObjIsNode(pNode) );
925  if ( Abc_ObjFaninNum(pNode) != 1 )
926  return 0;
927  if ( Abc_NtkHasSop(pNtk) )
928  return Abc_SopIsBuf((char *)pNode->pData);
929  if ( Abc_NtkHasBdd(pNtk) )
930  return !Cudd_IsComplement(pNode->pData);
931  if ( Abc_NtkHasAig(pNtk) )
932  return !Hop_IsComplement((Hop_Obj_t *)pNode->pData);
933  if ( Abc_NtkHasMapping(pNtk) )
935  assert( 0 );
936  return 0;
937 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
ABC_DLL int Abc_SopIsBuf(char *pSop)
Definition: abcSop.c:708
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
int Abc_NodeIsConst ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 843 of file abcObj.c.

844 {
845  assert( Abc_NtkIsLogic(pNode->pNtk) || Abc_NtkIsNetlist(pNode->pNtk) );
846  return Abc_ObjIsNode(pNode) && Abc_ObjFaninNum(pNode) == 0;
847 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
int Abc_NodeIsConst0 ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 860 of file abcObj.c.

861 {
862  Abc_Ntk_t * pNtk = pNode->pNtk;
863  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
864  assert( Abc_ObjIsNode(pNode) );
865  if ( !Abc_NodeIsConst(pNode) )
866  return 0;
867  if ( Abc_NtkHasSop(pNtk) )
868  return Abc_SopIsConst0((char *)pNode->pData);
869  if ( Abc_NtkHasBdd(pNtk) )
870  return Cudd_IsComplement(pNode->pData);
871  if ( Abc_NtkHasAig(pNtk) )
872  return Hop_IsComplement((Hop_Obj_t *)pNode->pData)? 1:0;
873  if ( Abc_NtkHasMapping(pNtk) )
875  assert( 0 );
876  return 0;
877 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition: abcSop.c:676
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
int Abc_NodeIsConst1 ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is a constant 1 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 890 of file abcObj.c.

891 {
892  Abc_Ntk_t * pNtk = pNode->pNtk;
893  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
894  assert( Abc_ObjIsNode(pNode) );
895  if ( !Abc_NodeIsConst(pNode) )
896  return 0;
897  if ( Abc_NtkHasSop(pNtk) )
898  return Abc_SopIsConst1((char *)pNode->pData);
899  if ( Abc_NtkHasBdd(pNtk) )
900  return !Cudd_IsComplement(pNode->pData);
901  if ( Abc_NtkHasAig(pNtk) )
902  return !Hop_IsComplement((Hop_Obj_t *)pNode->pData);
903  if ( Abc_NtkHasMapping(pNtk) )
905  assert( 0 );
906  return 0;
907 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Definition: hop.h:65
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition: abcObj.c:843
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
ABC_DLL int Abc_SopIsConst1(char *pSop)
Definition: abcSop.c:692
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
int Abc_NodeIsInv ( Abc_Obj_t pNode)

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

Synopsis [Returns 1 if the node is an inverter.]

Description []

SideEffects []

SeeAlso []

Definition at line 950 of file abcObj.c.

951 {
952  Abc_Ntk_t * pNtk = pNode->pNtk;
953  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
954  assert( Abc_ObjIsNode(pNode) );
955  if ( Abc_ObjFaninNum(pNode) != 1 )
956  return 0;
957  if ( Abc_NtkHasSop(pNtk) )
958  return Abc_SopIsInv((char *)pNode->pData);
959  if ( Abc_NtkHasBdd(pNtk) )
960  return Cudd_IsComplement(pNode->pData);
961  if ( Abc_NtkHasAig(pNtk) )
962  return Hop_IsComplement((Hop_Obj_t *)pNode->pData)? 1:0;
963  if ( Abc_NtkHasMapping(pNtk) )
965  assert( 0 );
966  return 0;
967 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
ABC_DLL int Abc_SopIsInv(char *pSop)
Definition: abcSop.c:728
Definition: hop.h:65
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Cudd_IsComplement(node)
Definition: cudd.h:425
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
Abc_Obj_t* Abc_NtkCloneObj ( Abc_Obj_t pObj)

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

Synopsis [Clones the objects in the same network but does not assign its function.]

Description []

SideEffects []

SeeAlso []

Definition at line 434 of file abcObj.c.

435 {
436  Abc_Obj_t * pClone, * pFanin;
437  int i;
438  pClone = Abc_NtkCreateObj( pObj->pNtk, (Abc_ObjType_t)pObj->Type );
439  Abc_ObjForEachFanin( pObj, pFanin, i )
440  Abc_ObjAddFanin( pClone, pFanin );
441  return pClone;
442 }
Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
unsigned Type
Definition: abc.h:133
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
Abc_ObjType_t
Definition: abc.h:86
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
Abc_Obj_t* Abc_NtkCreateNodeAnd ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates AND.]

Description []

SideEffects []

SeeAlso []

Definition at line 722 of file abcObj.c.

723 {
724  Abc_Obj_t * pNode;
725  int i;
726  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
727  pNode = Abc_NtkCreateNode( pNtk );
728  for ( i = 0; i < vFanins->nSize; i++ )
729  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
730  if ( Abc_NtkHasSop(pNtk) )
731  pNode->pData = Abc_SopCreateAnd( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins), NULL );
732  else if ( Abc_NtkHasBdd(pNtk) )
733  pNode->pData = Extra_bddCreateAnd( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
734  else if ( Abc_NtkHasAig(pNtk) )
735  pNode->pData = Hop_CreateAnd( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
736  else
737  assert( 0 );
738  return pNode;
739 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:162
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
void * pManFunc
Definition: abc.h:191
Hop_Obj_t * Hop_CreateAnd(Hop_Man_t *p, int nVars)
Definition: hopOper.c:320
DdNode * Extra_bddCreateAnd(DdManager *dd, int nVars)
Definition: extraBddMisc.c:858
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Obj_t* Abc_NtkCreateNodeBuf ( Abc_Ntk_t pNtk,
Abc_Obj_t pFanin 
)

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

Synopsis [Creates buffer.]

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file abcObj.c.

693 {
694  Abc_Obj_t * pNode;
695  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
696  pNode = Abc_NtkCreateNode( pNtk );
697  if ( pFanin ) Abc_ObjAddFanin( pNode, pFanin );
698  if ( Abc_NtkHasSop(pNtk) )
699  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "1 1\n" );
700  else if ( Abc_NtkHasBdd(pNtk) )
701  pNode->pData = Cudd_bddIthVar((DdManager *)pNtk->pManFunc,0), Cudd_Ref( (DdNode *)pNode->pData );
702  else if ( Abc_NtkHasAig(pNtk) )
703  pNode->pData = Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0);
704  else if ( Abc_NtkHasMapping(pNtk) )
706  else
707  assert( 0 );
708  return pNode;
709 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
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 char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
Abc_Obj_t* Abc_NtkCreateNodeConst0 ( Abc_Ntk_t pNtk)

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

Synopsis [Creates constant 0 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 604 of file abcObj.c.

605 {
606  Abc_Obj_t * pNode;
607  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
608  pNode = Abc_NtkCreateNode( pNtk );
609  if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
610  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 0\n" );
611  else if ( Abc_NtkHasBdd(pNtk) )
612  pNode->pData = Cudd_ReadLogicZero((DdManager *)pNtk->pManFunc), Cudd_Ref( (DdNode *)pNode->pData );
613  else if ( Abc_NtkHasAig(pNtk) )
614  pNode->pData = Hop_ManConst0((Hop_Man_t *)pNtk->pManFunc);
615  else if ( Abc_NtkHasMapping(pNtk) )
617  else if ( !Abc_NtkHasBlackbox(pNtk) )
618  assert( 0 );
619  return pNode;
620 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
Definition: hop.h:131
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Obj_t* Abc_NtkCreateNodeConst1 ( Abc_Ntk_t pNtk)

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

Synopsis [Creates constant 1 node.]

Description []

SideEffects []

SeeAlso []

Definition at line 633 of file abcObj.c.

634 {
635  Abc_Obj_t * pNode;
636  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
637  pNode = Abc_NtkCreateNode( pNtk );
638  if ( Abc_NtkHasSop(pNtk) || Abc_NtkHasBlifMv(pNtk) )
639  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 1\n" );
640  else if ( Abc_NtkHasBdd(pNtk) )
641  pNode->pData = Cudd_ReadOne((DdManager *)pNtk->pManFunc), Cudd_Ref( (DdNode *)pNode->pData );
642  else if ( Abc_NtkHasAig(pNtk) )
643  pNode->pData = Hop_ManConst1((Hop_Man_t *)pNtk->pManFunc);
644  else if ( Abc_NtkHasMapping(pNtk) )
646  else if ( !Abc_NtkHasBlackbox(pNtk) )
647  assert( 0 );
648  return pNode;
649 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
void * pManFunc
Definition: abc.h:191
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static int Abc_NtkHasBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:258
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Obj_t* Abc_NtkCreateNodeExor ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates EXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file abcObj.c.

783 {
784  Abc_Obj_t * pNode;
785  int i;
786  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
787  pNode = Abc_NtkCreateNode( pNtk );
788  for ( i = 0; i < vFanins->nSize; i++ )
789  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
790  if ( Abc_NtkHasSop(pNtk) )
791  pNode->pData = Abc_SopCreateXorSpecial( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
792  else if ( Abc_NtkHasBdd(pNtk) )
793  pNode->pData = Extra_bddCreateExor( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
794  else if ( Abc_NtkHasAig(pNtk) )
795  pNode->pData = Hop_CreateExor( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
796  else
797  assert( 0 );
798  return pNode;
799 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
Hop_Obj_t * Hop_CreateExor(Hop_Man_t *p, int nVars)
Definition: hopOper.c:362
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
void * pManFunc
Definition: abc.h:191
DdNode * Extra_bddCreateExor(DdManager *dd, int nVars)
Definition: extraBddMisc.c:908
ABC_DLL char * Abc_SopCreateXorSpecial(Mem_Flex_t *pMan, int nVars)
Definition: abcSop.c:291
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Obj_t* Abc_NtkCreateNodeInv ( Abc_Ntk_t pNtk,
Abc_Obj_t pFanin 
)

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

Synopsis [Creates inverter.]

Description []

SideEffects []

SeeAlso []

Definition at line 662 of file abcObj.c.

663 {
664  Abc_Obj_t * pNode;
665  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
666  pNode = Abc_NtkCreateNode( pNtk );
667  if ( pFanin ) Abc_ObjAddFanin( pNode, pFanin );
668  if ( Abc_NtkHasSop(pNtk) )
669  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "0 1\n" );
670  else if ( Abc_NtkHasBdd(pNtk) )
671  pNode->pData = Cudd_Not(Cudd_bddIthVar((DdManager *)pNtk->pManFunc,0)), Cudd_Ref( (DdNode *)pNode->pData );
672  else if ( Abc_NtkHasAig(pNtk) )
673  pNode->pData = Hop_Not(Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0));
674  else if ( Abc_NtkHasMapping(pNtk) )
676  else
677  assert( 0 );
678  return pNode;
679 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
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 char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
Abc_Obj_t* Abc_NtkCreateNodeMux ( Abc_Ntk_t pNtk,
Abc_Obj_t pNodeC,
Abc_Obj_t pNode1,
Abc_Obj_t pNode0 
)

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

Synopsis [Creates MUX.]

Description []

SideEffects []

SeeAlso []

Definition at line 812 of file abcObj.c.

813 {
814  Abc_Obj_t * pNode;
815  assert( Abc_NtkIsLogic(pNtk) );
816  pNode = Abc_NtkCreateNode( pNtk );
817  Abc_ObjAddFanin( pNode, pNodeC );
818  Abc_ObjAddFanin( pNode, pNode1 );
819  Abc_ObjAddFanin( pNode, pNode0 );
820  if ( Abc_NtkHasSop(pNtk) )
821  pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, "11- 1\n0-1 1\n" );
822  else if ( Abc_NtkHasBdd(pNtk) )
824  else if ( Abc_NtkHasAig(pNtk) )
825  pNode->pData = Hop_Mux((Hop_Man_t *)pNtk->pManFunc,Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,0),Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,1),Hop_IthVar((Hop_Man_t *)pNtk->pManFunc,2));
826  else
827  assert( 0 );
828  return pNode;
829 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
DdNode * Cudd_bddIte(DdManager *dd, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddBddIte.c:143
Hop_Obj_t * Hop_Mux(Hop_Man_t *p, Hop_Obj_t *pC, Hop_Obj_t *p1, Hop_Obj_t *p0)
Definition: hopOper.c:187
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 char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
Abc_Obj_t* Abc_NtkCreateNodeOr ( Abc_Ntk_t pNtk,
Vec_Ptr_t vFanins 
)

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

Synopsis [Creates OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file abcObj.c.

753 {
754  Abc_Obj_t * pNode;
755  int i;
756  assert( Abc_NtkIsLogic(pNtk) || Abc_NtkIsNetlist(pNtk) );
757  pNode = Abc_NtkCreateNode( pNtk );
758  for ( i = 0; i < vFanins->nSize; i++ )
759  Abc_ObjAddFanin( pNode, (Abc_Obj_t *)vFanins->pArray[i] );
760  if ( Abc_NtkHasSop(pNtk) )
761  pNode->pData = Abc_SopCreateOr( (Mem_Flex_t *)pNtk->pManFunc, Vec_PtrSize(vFanins), NULL );
762  else if ( Abc_NtkHasBdd(pNtk) )
763  pNode->pData = Extra_bddCreateOr( (DdManager *)pNtk->pManFunc, Vec_PtrSize(vFanins) ), Cudd_Ref((DdNode *)pNode->pData);
764  else if ( Abc_NtkHasAig(pNtk) )
765  pNode->pData = Hop_CreateOr( (Hop_Man_t *)pNtk->pManFunc, Vec_PtrSize(vFanins) );
766  else
767  assert( 0 );
768  return pNode;
769 }
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:250
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
static int Abc_NtkHasSop(Abc_Ntk_t *pNtk)
Definition: abc.h:253
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DdNode * Extra_bddCreateOr(DdManager *dd, int nVars)
Definition: extraBddMisc.c:883
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void * pManFunc
Definition: abc.h:191
Hop_Obj_t * Hop_CreateOr(Hop_Man_t *p, int nVars)
Definition: hopOper.c:341
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_DLL char * Abc_SopCreateOr(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:206
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Obj_t* Abc_NtkCreateObj ( Abc_Ntk_t pNtk,
Abc_ObjType_t  Type 
)

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

Synopsis [Adds the node to the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file abcObj.c.

107 {
108  Abc_Obj_t * pObj;
109  // create new object, assign ID, and add to the array
110  pObj = Abc_ObjAlloc( pNtk, Type );
111  pObj->Id = pNtk->vObjs->nSize;
112  Vec_PtrPush( pNtk->vObjs, pObj );
113  pNtk->nObjCounts[Type]++;
114  pNtk->nObjs++;
115  // perform specialized operations depending on the object type
116  switch (Type)
117  {
118  case ABC_OBJ_NONE:
119  assert(0);
120  break;
121  case ABC_OBJ_CONST1:
122  assert(0);
123  break;
124  case ABC_OBJ_PI:
125 // pObj->iTemp = Vec_PtrSize(pNtk->vCis);
126  Vec_PtrPush( pNtk->vPis, pObj );
127  Vec_PtrPush( pNtk->vCis, pObj );
128  break;
129  case ABC_OBJ_PO:
130 // pObj->iTemp = Vec_PtrSize(pNtk->vCos);
131  Vec_PtrPush( pNtk->vPos, pObj );
132  Vec_PtrPush( pNtk->vCos, pObj );
133  break;
134  case ABC_OBJ_BI:
135  if ( pNtk->vCos ) Vec_PtrPush( pNtk->vCos, pObj );
136  break;
137  case ABC_OBJ_BO:
138  if ( pNtk->vCis ) Vec_PtrPush( pNtk->vCis, pObj );
139  break;
140  case ABC_OBJ_NET:
141  case ABC_OBJ_NODE:
142  break;
143  case ABC_OBJ_LATCH:
144  pObj->pData = (void *)ABC_INIT_NONE;
145  case ABC_OBJ_WHITEBOX:
146  case ABC_OBJ_BLACKBOX:
147  if ( pNtk->vBoxes ) Vec_PtrPush( pNtk->vBoxes, pObj );
148  break;
149  default:
150  assert(0);
151  break;
152  }
153  return pObj;
154 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
Vec_Ptr_t * vBoxes
Definition: abc.h:168
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
int nObjs
Definition: abc.h:172
Vec_Ptr_t * vCis
Definition: abc.h:165
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_ObjAlloc(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
DECLARATIONS ///.
Definition: abcObj.c:49
Definition: abc.h:89
int Id
Definition: abc.h:132
Definition: abc.h:90
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
void Abc_NtkDeleteAll_rec ( Abc_Obj_t pObj)

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

Synopsis [Deletes the node and MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 310 of file abcObj.c.

311 {
312  Vec_Ptr_t * vNodes;
313  int i;
314  assert( !Abc_ObjIsComplement(pObj) );
315  assert( Abc_ObjFanoutNum(pObj) == 0 );
316  // delete fanins and fanouts
317  vNodes = Vec_PtrAlloc( 100 );
318  Abc_NodeCollectFanins( pObj, vNodes );
319  Abc_NtkDeleteObj( pObj );
320  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
321  if ( !Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
322  Abc_NtkDeleteAll_rec( pObj );
323  Vec_PtrFree( vNodes );
324 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_NtkDeleteAll_rec(Abc_Obj_t *pObj)
Definition: abcObj.c:310
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkDeleteObj ( Abc_Obj_t pObj)

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

Synopsis [Deletes the object from the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file abcObj.c.

168 {
169  Abc_Ntk_t * pNtk = pObj->pNtk;
170  Vec_Ptr_t * vNodes;
171  int i;
172  assert( !Abc_ObjIsComplement(pObj) );
173  // remove from the table of names
174  if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) )
175  Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id);
176  // delete fanins and fanouts
177  vNodes = Vec_PtrAlloc( 100 );
178  Abc_NodeCollectFanouts( pObj, vNodes );
179  for ( i = 0; i < vNodes->nSize; i++ )
180  Abc_ObjDeleteFanin( (Abc_Obj_t *)vNodes->pArray[i], pObj );
181  Abc_NodeCollectFanins( pObj, vNodes );
182  for ( i = 0; i < vNodes->nSize; i++ )
183  Abc_ObjDeleteFanin( pObj, (Abc_Obj_t *)vNodes->pArray[i] );
184  Vec_PtrFree( vNodes );
185  // remove from the list of objects
186  Vec_PtrWriteEntry( pNtk->vObjs, pObj->Id, NULL );
187  pObj->Id = (1<<26)-1;
188  pNtk->nObjCounts[pObj->Type]--;
189  pNtk->nObjs--;
190  // perform specialized operations depending on the object type
191  switch (pObj->Type)
192  {
193  case ABC_OBJ_NONE:
194  assert(0);
195  break;
196  case ABC_OBJ_CONST1:
197  assert(0);
198  break;
199  case ABC_OBJ_PI:
200  Vec_PtrRemove( pNtk->vPis, pObj );
201  Vec_PtrRemove( pNtk->vCis, pObj );
202  break;
203  case ABC_OBJ_PO:
204  Vec_PtrRemove( pNtk->vPos, pObj );
205  Vec_PtrRemove( pNtk->vCos, pObj );
206  break;
207  case ABC_OBJ_BI:
208  if ( pNtk->vCos ) Vec_PtrRemove( pNtk->vCos, pObj );
209  break;
210  case ABC_OBJ_BO:
211  if ( pNtk->vCis ) Vec_PtrRemove( pNtk->vCis, pObj );
212  break;
213  case ABC_OBJ_NET:
214  break;
215  case ABC_OBJ_NODE:
216  if ( Abc_NtkHasBdd(pNtk) )
217  Cudd_RecursiveDeref( (DdManager *)pNtk->pManFunc, (DdNode *)pObj->pData );
218  pObj->pData = NULL;
219  break;
220  case ABC_OBJ_LATCH:
221  case ABC_OBJ_WHITEBOX:
222  case ABC_OBJ_BLACKBOX:
223  if ( pNtk->vBoxes ) Vec_PtrRemove( pNtk->vBoxes, pObj );
224  break;
225  default:
226  assert(0);
227  break;
228  }
229  // recycle the object memory
230  Abc_ObjRecycle( pObj );
231 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
Definition: abc.h:91
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
static int Abc_NtkHasBdd(Abc_Ntk_t *pNtk)
Definition: abc.h:254
Nm_Man_t * pManName
Definition: abc.h:160
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
Vec_Ptr_t * vBoxes
Definition: abc.h:168
void Abc_ObjRecycle(Abc_Obj_t *pObj)
Definition: abcObj.c:74
Vec_Ptr_t * vObjs
Definition: abc.h:162
Vec_Ptr_t * vPis
Definition: abc.h:163
unsigned Type
Definition: abc.h:133
static void Vec_PtrRemove(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:714
int nObjs
Definition: abc.h:172
Vec_Ptr_t * vCis
Definition: abc.h:165
void * pManFunc
Definition: abc.h:191
Vec_Ptr_t * vPos
Definition: abc.h:164
Vec_Ptr_t * vCos
Definition: abc.h:166
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:199
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Abc_Ntk_t * pNtk
Definition: abc.h:130
Definition: abc.h:89
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Id
Definition: abc.h:132
Definition: abc.h:90
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
Definition: abc.h:92
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:111
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkDeleteObj_rec ( Abc_Obj_t pObj,
int  fOnlyNodes 
)

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

Synopsis [Deletes the node and MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 273 of file abcObj.c.

274 {
275  Vec_Ptr_t * vNodes;
276  int i;
277  assert( !Abc_ObjIsComplement(pObj) );
278  assert( !Abc_ObjIsPi(pObj) );
279  assert( Abc_ObjFanoutNum(pObj) == 0 );
280  // delete fanins and fanouts
281  vNodes = Vec_PtrAlloc( 100 );
282  Abc_NodeCollectFanins( pObj, vNodes );
283  Abc_NtkDeleteObj( pObj );
284  if ( fOnlyNodes )
285  {
286  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
287  if ( Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
288  Abc_NtkDeleteObj_rec( pObj, fOnlyNodes );
289  }
290  else
291  {
292  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
293  if ( !Abc_ObjIsPi(pObj) && Abc_ObjFanoutNum(pObj) == 0 )
294  Abc_NtkDeleteObj_rec( pObj, fOnlyNodes );
295  }
296  Vec_PtrFree( vNodes );
297 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
Definition: abcObj.c:273
void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1587
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkDeleteObjPo ( Abc_Obj_t pObj)

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

Synopsis [Deletes the PO from the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file abcObj.c.

245 {
246  assert( Abc_ObjIsPo(pObj) );
247  // remove from the table of names
248  if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) )
249  Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id);
250  // delete fanins
251  Abc_ObjDeleteFanin( pObj, Abc_ObjFanin0(pObj) );
252  // remove from the list of objects
253  Vec_PtrWriteEntry( pObj->pNtk->vObjs, pObj->Id, NULL );
254  pObj->Id = (1<<26)-1;
255  pObj->pNtk->nObjCounts[pObj->Type]--;
256  pObj->pNtk->nObjs--;
257  // recycle the object memory
258  Abc_ObjRecycle( pObj );
259 }
int nObjCounts[ABC_OBJ_NUMBER]
Definition: abc.h:171
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:149
Nm_Man_t * pManName
Definition: abc.h:160
void Abc_ObjRecycle(Abc_Obj_t *pObj)
Definition: abcObj.c:74
Vec_Ptr_t * vObjs
Definition: abc.h:162
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
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:199
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Abc_Ntk_t * pNtk
Definition: abc.h:130
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
#define assert(ex)
Definition: util_old.h:213
Abc_Obj_t* Abc_NtkDupBox ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pBox,
int  fCopyName 
)

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

Synopsis [Duplicates the latch with its input/output terminals.]

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file abcObj.c.

408 {
409  Abc_Obj_t * pTerm, * pBoxNew;
410  int i;
411  assert( Abc_ObjIsBox(pBox) );
412  // duplicate the box
413  pBoxNew = Abc_NtkDupObj( pNtkNew, pBox, fCopyName );
414  // duplicate the fanins and connect them
415  Abc_ObjForEachFanin( pBox, pTerm, i )
416  Abc_ObjAddFanin( pBoxNew, Abc_NtkDupObj(pNtkNew, pTerm, fCopyName) );
417  // duplicate the fanouts and connect them
418  Abc_ObjForEachFanout( pBox, pTerm, i )
419  Abc_ObjAddFanin( Abc_NtkDupObj(pNtkNew, pTerm, fCopyName), pBoxNew );
420  return pBoxNew;
421 }
Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition: abcObj.c:337
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#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
Abc_Obj_t* Abc_NtkDupObj ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pObj,
int  fCopyName 
)

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

Synopsis [Duplicate the Obj.]

Description []

SideEffects []

SeeAlso []

Definition at line 337 of file abcObj.c.

338 {
339  Abc_Obj_t * pObjNew;
340  // create the new object
341  pObjNew = Abc_NtkCreateObj( pNtkNew, (Abc_ObjType_t)pObj->Type );
342  // transfer names of the terminal objects
343  if ( fCopyName )
344  {
345  if ( Abc_ObjIsCi(pObj) )
346  {
347  if ( !Abc_NtkIsNetlist(pNtkNew) )
348  Abc_ObjAssignName( pObjNew, Abc_ObjName(Abc_ObjFanout0Ntk(pObj)), NULL );
349  }
350  else if ( Abc_ObjIsCo(pObj) )
351  {
352  if ( !Abc_NtkIsNetlist(pNtkNew) )
353  {
354  if ( Abc_ObjIsPo(pObj) )
355  Abc_ObjAssignName( pObjNew, Abc_ObjName(Abc_ObjFanin0Ntk(pObj)), NULL );
356  else
357  {
359  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
360  }
361  }
362  }
363  else if ( Abc_ObjIsBox(pObj) || Abc_ObjIsNet(pObj) )
364  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
365  }
366  // copy functionality/names
367  if ( Abc_ObjIsNode(pObj) ) // copy the function if functionality is compatible
368  {
369  if ( pNtkNew->ntkFunc == pObj->pNtk->ntkFunc )
370  {
371  if ( Abc_NtkIsStrash(pNtkNew) )
372  {}
373  else if ( Abc_NtkHasSop(pNtkNew) || Abc_NtkHasBlifMv(pNtkNew) )
374  pObjNew->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, (char *)pObj->pData );
375  else if ( Abc_NtkHasBdd(pNtkNew) )
376  pObjNew->pData = Cudd_bddTransfer((DdManager *)pObj->pNtk->pManFunc, (DdManager *)pNtkNew->pManFunc, (DdNode *)pObj->pData), Cudd_Ref((DdNode *)pObjNew->pData);
377  else if ( Abc_NtkHasAig(pNtkNew) )
378  pObjNew->pData = Hop_Transfer((Hop_Man_t *)pObj->pNtk->pManFunc, (Hop_Man_t *)pNtkNew->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj));
379  else if ( Abc_NtkHasMapping(pNtkNew) )
380  pObjNew->pData = pObj->pData;
381  else assert( 0 );
382  }
383  }
384  else if ( Abc_ObjIsNet(pObj) ) // copy the name
385  {
386  }
387  else if ( Abc_ObjIsLatch(pObj) ) // copy the reset value
388  pObjNew->pData = pObj->pData;
389  // transfer HAIG
390 // pObjNew->pEquiv = pObj->pEquiv;
391  // remember the new node in the old node
392  pObj->pCopy = pObjNew;
393  return pObjNew;
394 }
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
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
Definition: cudd.h:278
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
static Abc_Obj_t * Abc_ObjFanin0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:375
Hop_Obj_t * Hop_Transfer(Hop_Man_t *pSour, Hop_Man_t *pDest, Hop_Obj_t *pObj, int nVars)
Definition: hopDfs.c:353
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
Abc_Obj_t * Abc_NtkCreateObj(Abc_Ntk_t *pNtk, Abc_ObjType_t Type)
Definition: abcObj.c:106
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
static int Abc_NtkHasBlifMv(Abc_Ntk_t *pNtk)
Definition: abc.h:257
unsigned Type
Definition: abc.h:133
Definition: hop.h:65
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
Abc_Obj_t * pCopy
Definition: abc.h:148
Abc_ObjType_t
Definition: abc.h:86
static Abc_Obj_t * Abc_ObjFanout0Ntk(Abc_Obj_t *pObj)
Definition: abc.h:376
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_ObjIsNet(Abc_Obj_t *pObj)
Definition: abc.h:354
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static int Abc_ObjIsBox(Abc_Obj_t *pObj)
Definition: abc.h:357
void * pData
Definition: abc.h:145
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
Abc_Obj_t* Abc_NtkFindCi ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns CI with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 530 of file abcObj.c.

531 {
532  int Num;
533  assert( !Abc_NtkIsNetlist(pNtk) );
534  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PI );
535  if ( Num >= 0 )
536  return Abc_NtkObj( pNtk, Num );
537  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BO );
538  if ( Num >= 0 )
539  return Abc_NtkObj( pNtk, Num );
540  return NULL;
541 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Definition: abc.h:89
Definition: abc.h:92
#define assert(ex)
Definition: util_old.h:213
Abc_Obj_t* Abc_NtkFindCo ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns CO with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 554 of file abcObj.c.

555 {
556  int Num;
557  assert( !Abc_NtkIsNetlist(pNtk) );
558  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PO );
559  if ( Num >= 0 )
560  return Abc_NtkObj( pNtk, Num );
561  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BI );
562  if ( Num >= 0 )
563  return Abc_NtkObj( pNtk, Num );
564  return NULL;
565 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Definition: abc.h:91
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Definition: abc.h:90
#define assert(ex)
Definition: util_old.h:213
Abc_Obj_t* Abc_NtkFindNet ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns the net with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 507 of file abcObj.c.

508 {
509  Abc_Obj_t * pNet;
510  int ObjId;
511  assert( Abc_NtkIsNetlist(pNtk) );
512  ObjId = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_NET );
513  if ( ObjId == -1 )
514  return NULL;
515  pNet = Abc_NtkObj( pNtk, ObjId );
516  return pNet;
517 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
#define assert(ex)
Definition: util_old.h:213
Abc_Obj_t* Abc_NtkFindNode ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Returns the net with the given name.]

Description []

SideEffects []

SeeAlso []

Definition at line 456 of file abcObj.c.

457 {
458  Abc_Obj_t * pObj;
459  int Num;
460  // try to find the terminal
461  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_PO );
462  if ( Num >= 0 )
463  return Abc_ObjFanin0( Abc_NtkObj( pNtk, Num ) );
464  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_BI );
465  if ( Num >= 0 )
466  return Abc_ObjFanin0( Abc_NtkObj( pNtk, Num ) );
467  Num = Nm_ManFindIdByName( pNtk->pManName, pName, ABC_OBJ_NODE );
468  if ( Num >= 0 )
469  return Abc_NtkObj( pNtk, Num );
470  // find the internal node
471  if ( pName[0] != 'n' )
472  {
473  printf( "Name \"%s\" is not found among CO or node names (internal names often look as \"n<num>\").\n", pName );
474  return NULL;
475  }
476  Num = atoi( pName + 1 );
477  if ( Num < 0 || Num >= Abc_NtkObjNumMax(pNtk) )
478  {
479  printf( "The node \"%s\" with ID %d is not in the current network.\n", pName, Num );
480  return NULL;
481  }
482  pObj = Abc_NtkObj( pNtk, Num );
483  if ( pObj == NULL )
484  {
485  printf( "The node \"%s\" with ID %d has been removed from the current network.\n", pName, Num );
486  return NULL;
487  }
488  if ( !Abc_ObjIsNode(pObj) )
489  {
490  printf( "Object with ID %d is not a node.\n", Num );
491  return NULL;
492  }
493  return pObj;
494 }
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition: nmApi.c:219
Definition: abc.h:91
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
Definition: abc.h:90
Abc_Obj_t* Abc_NtkFindOrCreateNet ( Abc_Ntk_t pNtk,
char *  pName 
)

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

Synopsis [Finds or creates the net.]

Description []

SideEffects []

SeeAlso []

Definition at line 579 of file abcObj.c.

580 {
581  Abc_Obj_t * pNet;
582  assert( Abc_NtkIsNetlist(pNtk) );
583  if ( pName && (pNet = Abc_NtkFindNet( pNtk, pName )) )
584  return pNet;
585 //printf( "Creating net %s.\n", pName );
586  // create a new net
587  pNet = Abc_NtkCreateNet( pNtk );
588  if ( pName )
589  Nm_ManStoreIdName( pNtk->pManName, pNet->Id, pNet->Type, pName, NULL );
590  return pNet;
591 }
Nm_Man_t * pManName
Definition: abc.h:160
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
unsigned Type
Definition: abc.h:133
Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
char * Nm_ManStoreIdName(Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
Definition: nmApi.c:112
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkCreateNet(Abc_Ntk_t *pNtk)
Definition: abc.h:307
ABC_NAMESPACE_IMPL_START Abc_Obj_t* Abc_ObjAlloc ( Abc_Ntk_t pNtk,
Abc_ObjType_t  Type 
)

DECLARATIONS ///.

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

FileName [abcObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Object creation/duplication/deletion procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Creates a new object.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file abcObj.c.

50 {
51  Abc_Obj_t * pObj;
52  if ( pNtk->pMmObj )
53  pObj = (Abc_Obj_t *)Mem_FixedEntryFetch( pNtk->pMmObj );
54  else
55  pObj = (Abc_Obj_t *)ABC_ALLOC( Abc_Obj_t, 1 );
56  memset( pObj, 0, sizeof(Abc_Obj_t) );
57  pObj->pNtk = pNtk;
58  pObj->Type = Type;
59  pObj->Id = -1;
60  return pObj;
61 }
char * memset()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned Type
Definition: abc.h:133
Mem_Fixed_t * pMmObj
Definition: abc.h:189
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
char * Mem_FixedEntryFetch(Mem_Fixed_t *p)
Definition: mem.c:168
void Abc_ObjRecycle ( Abc_Obj_t pObj)

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

Synopsis [Recycles the object.]

Description []

SideEffects []

SeeAlso []

Definition at line 74 of file abcObj.c.

75 {
76  Abc_Ntk_t * pNtk = pObj->pNtk;
77 // int LargePiece = (4 << ABC_NUM_STEPS);
78  // free large fanout arrays
79 // if ( pNtk->pMmStep && pObj->vFanouts.nCap * 4 > LargePiece )
80 // free( pObj->vFanouts.pArray );
81  if ( pNtk->pMmStep == NULL )
82  {
83  ABC_FREE( pObj->vFanouts.pArray );
84  ABC_FREE( pObj->vFanins.pArray );
85  }
86  // clean the memory to make deleted object distinct from the live one
87  memset( pObj, 0, sizeof(Abc_Obj_t) );
88  // recycle the object
89  if ( pNtk->pMmObj )
90  Mem_FixedEntryRecycle( pNtk->pMmObj, (char *)pObj );
91  else
92  ABC_FREE( pObj );
93 }
char * memset()
Vec_Int_t vFanins
Definition: abc.h:143
Mem_Fixed_t * pMmObj
Definition: abc.h:189
void Mem_FixedEntryRecycle(Mem_Fixed_t *p, char *pEntry)
Definition: mem.c:219
Vec_Int_t vFanouts
Definition: abc.h:144
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define ABC_FREE(obj)
Definition: abc_global.h:232
Mem_Step_t * pMmStep
Definition: abc.h:190