abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcMiter.c File Reference
#include "base/abc/abc.h"

Go to the source code of this file.

Typedefs

typedef void(* AddFrameMapping )(Abc_Obj_t *, Abc_Obj_t *, int, void *)
 

Functions

static
ABC_NAMESPACE_IMPL_START
Abc_Ntk_t
Abc_NtkMiterInt (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
 DECLARATIONS ///. More...
 
static void Abc_NtkMiterPrepare (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
 
static void Abc_NtkMiterAddOne (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter)
 
static void Abc_NtkMiterFinalize (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fImplic, int fMulti)
 
static void Abc_NtkAddFrame (Abc_Ntk_t *pNetNew, Abc_Ntk_t *pNet, int iFrame)
 
Abc_Ntk_tAbc_NtkFrames2 (Abc_Ntk_t *pNtk, int nFrames, int fInitial, AddFrameMapping addFrameMapping, void *arg)
 
static void Abc_NtkAddFrame2 (Abc_Ntk_t *pNtkFrames, Abc_Ntk_t *pNtk, int iFrame, Vec_Ptr_t *vNodes, AddFrameMapping addFrameMapping, void *arg)
 
Abc_Ntk_tAbc_NtkMiter (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
 FUNCTION DEFINITIONS ///. More...
 
void Abc_NtkMiterAddCone (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
 
Abc_Ntk_tAbc_NtkMiterAnd (Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOr, int fCompl2)
 
Abc_Ntk_tAbc_NtkMiterCofactor (Abc_Ntk_t *pNtk, Vec_Int_t *vPiValues)
 
Abc_Ntk_tAbc_NtkMiterForCofactors (Abc_Ntk_t *pNtk, int Out, int In1, int In2)
 
Abc_Ntk_tAbc_NtkMiterQuantify (Abc_Ntk_t *pNtk, int In, int fExist)
 
Abc_Ntk_tAbc_NtkMiterQuantifyPis (Abc_Ntk_t *pNtk)
 
int Abc_NtkMiterIsConstant (Abc_Ntk_t *pMiter)
 
void Abc_NtkMiterReport (Abc_Ntk_t *pMiter)
 
Abc_Ntk_tAbc_NtkFrames (Abc_Ntk_t *pNtk, int nFrames, int fInitial, int fVerbose)
 
int Abc_NtkDemiter (Abc_Ntk_t *pNtk)
 
int Abc_NtkCombinePos (Abc_Ntk_t *pNtk, int fAnd, int fXor)
 

Typedef Documentation

typedef void(* AddFrameMapping)(Abc_Obj_t *, Abc_Obj_t *, int, void *)

Definition at line 37 of file abcMiter.c.

Function Documentation

void Abc_NtkAddFrame ( Abc_Ntk_t pNtkFrames,
Abc_Ntk_t pNtk,
int  iFrame 
)
static

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

Synopsis [Adds one time frame to the new network.]

Description [Assumes that the latches of the old network point to the outputs of the previous frame of the new network (pLatch->pCopy). In the end, updates the latches of the old network to point to the outputs of the current frame of the new network.]

SideEffects []

SeeAlso []

Definition at line 859 of file abcMiter.c.

860 {
861  int fVerbose = 0;
862  int NodeBef = Abc_NtkNodeNum(pNtkFrames);
863  char Buffer[10];
864  Abc_Obj_t * pNode, * pLatch;
865  int i;
866  // create the prefix to be added to the node names
867  sprintf( Buffer, "_%02d", iFrame );
868  // add the new PI nodes
869  Abc_NtkForEachPi( pNtk, pNode, i )
870  Abc_ObjAssignName( Abc_NtkDupObj(pNtkFrames, pNode, 0), Abc_ObjName(pNode), Buffer );
871  // add the internal nodes
872  Abc_AigForEachAnd( pNtk, pNode, i )
873  pNode->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkFrames->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
874  // add the new POs
875  Abc_NtkForEachPo( pNtk, pNode, i )
876  {
877  Abc_ObjAssignName( Abc_NtkDupObj(pNtkFrames, pNode, 0), Abc_ObjName(pNode), Buffer );
878  Abc_ObjAddFanin( pNode->pCopy, Abc_ObjChild0Copy(pNode) );
879  }
880  // transfer the implementation of the latch inputs to the latch outputs
881  Abc_NtkForEachLatch( pNtk, pLatch, i )
882  pLatch->pCopy = Abc_ObjChild0Copy(Abc_ObjFanin0(pLatch));
883  Abc_NtkForEachLatch( pNtk, pLatch, i )
884  Abc_ObjFanout0(pLatch)->pCopy = pLatch->pCopy;
885  // nodes after
886  if ( fVerbose )
887  printf( "F = %4d : Total = %6d. Nodes = %6d. Prop = %s.\n",
888  iFrame, Abc_NtkNodeNum(pNtk), Abc_NtkNodeNum(pNtkFrames)-NodeBef,
889  Abc_AigNodeIsConst( Abc_ObjFanin0(Abc_NtkPo(pNtk,0))->pCopy ) ? "proof" : "unknown" );
890 }
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_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
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
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
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
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
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_NtkAddFrame2 ( Abc_Ntk_t pNtkFrames,
Abc_Ntk_t pNtk,
int  iFrame,
Vec_Ptr_t vNodes,
AddFrameMapping  addFrameMapping,
void *  arg 
)
static

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

Synopsis [Adds one time frame to the new network.]

Description [Assumes that the latches of the old network point to the outputs of the previous frame of the new network (pLatch->pCopy). In the end, updates the latches of the old network to point to the outputs of the current frame of the new network.]

SideEffects []

SeeAlso []

Definition at line 1005 of file abcMiter.c.

1006 {
1007 /*
1008  char Buffer[10];
1009  Abc_Obj_t * pNode, * pNodeNew, * pLatch;
1010  Abc_Obj_t * pConst1, * pConst1New;
1011  int i;
1012  // get the constant nodes
1013  pConst1 = Abc_AigConst1(pNtk);
1014  pConst1New = Abc_AigConst1(pNtkFrames);
1015  // create the prefix to be added to the node names
1016  sprintf( Buffer, "_%02d", iFrame );
1017  // add the new PI nodes
1018  Abc_NtkForEachPi( pNtk, pNode, i )
1019  {
1020  pNodeNew = Abc_NtkDupObj( pNtkFrames, pNode );
1021  Abc_ObjAssignName( pNodeNew, Abc_ObjName(pNode), Buffer );
1022  if (addFrameMapping) addFrameMapping(pNodeNew, pNode, iFrame, arg);
1023  }
1024  // add the internal nodes
1025  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
1026  {
1027  if ( pNode == pConst1 )
1028  pNodeNew = pConst1New;
1029  else
1030  pNodeNew = Abc_AigAnd( pNtkFrames->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
1031  pNode->pCopy = pNodeNew;
1032  if (addFrameMapping) addFrameMapping(pNodeNew, pNode, iFrame, arg);
1033  }
1034  // add the new POs
1035  Abc_NtkForEachPo( pNtk, pNode, i )
1036  {
1037  pNodeNew = Abc_NtkDupObj( pNtkFrames, pNode );
1038  Abc_ObjAddFanin( pNodeNew, Abc_ObjChild0Copy(pNode) );
1039  Abc_ObjAssignName( pNodeNew, Abc_ObjName(pNode), Buffer );
1040  if (addFrameMapping) addFrameMapping(pNodeNew, pNode, iFrame, arg);
1041  }
1042  // transfer the implementation of the latch drivers to the latches
1043 
1044  // it is important that these two steps are performed it two loops
1045  // and not in the same loop
1046  Abc_NtkForEachLatch( pNtk, pLatch, i )
1047  pLatch->pNext = Abc_ObjChild0Copy(pLatch);
1048  Abc_NtkForEachLatch( pNtk, pLatch, i )
1049  pLatch->pCopy = pLatch->pNext;
1050 
1051  Abc_NtkForEachLatch( pNtk, pLatch, i )
1052  {
1053  if (addFrameMapping) {
1054  // don't give Mike complemented pointers because he doesn't like it
1055  if (Abc_ObjIsComplement(pLatch->pCopy)) {
1056  pNodeNew = Abc_NtkCreateNode( pNtkFrames );
1057  Abc_ObjAddFanin( pNodeNew, pLatch->pCopy );
1058  assert(Abc_ObjFaninNum(pNodeNew) == 1);
1059  pNodeNew->Level = 1 + Abc_ObjRegular(pLatch->pCopy)->Level;
1060 
1061  pLatch->pNext = pNodeNew;
1062  pLatch->pCopy = pNodeNew;
1063  }
1064  addFrameMapping(pLatch->pCopy, pLatch, iFrame+1, arg);
1065  }
1066  }
1067 */
1068 }
int Abc_NtkCombinePos ( Abc_Ntk_t pNtk,
int  fAnd,
int  fXor 
)

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

Synopsis [Computes OR or AND of the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 1151 of file abcMiter.c.

1152 {
1153  Abc_Obj_t * pNode, * pMiter;
1154  int i;
1155  assert( Abc_NtkIsStrash(pNtk) );
1156 // assert( Abc_NtkLatchNum(pNtk) == 0 );
1157  if ( Abc_NtkPoNum(pNtk) == 1 )
1158  return 1;
1159  // start the result
1160  if ( fAnd )
1161  pMiter = Abc_AigConst1(pNtk);
1162  else
1163  pMiter = Abc_ObjNot( Abc_AigConst1(pNtk) );
1164  // perform operations on the POs
1165  Abc_NtkForEachPo( pNtk, pNode, i )
1166  if ( fAnd )
1167  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1168  else if ( fXor )
1169  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1170  else
1171  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1172  // remove the POs and their names
1173  for ( i = Abc_NtkPoNum(pNtk) - 1; i >= 0; i-- )
1174  Abc_NtkDeleteObj( Abc_NtkPo(pNtk, i) );
1175  assert( Abc_NtkPoNum(pNtk) == 0 );
1176  // create the new PO
1177  pNode = Abc_NtkCreatePo( pNtk );
1178  Abc_ObjAddFanin( pNode, pMiter );
1179  Abc_ObjAssignName( pNode, "miter", NULL );
1180  Abc_NtkOrderCisCos( pNtk );
1181  // make sure that everything is okay
1182  if ( !Abc_NtkCheck( pNtk ) )
1183  {
1184  printf( "Abc_NtkOrPos: The network check has failed.\n" );
1185  return 0;
1186  }
1187  return 1;
1188 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
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
for(p=first;p->value< newval;p=p->next)
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
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_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
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 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_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
int Abc_NtkDemiter ( Abc_Ntk_t pNtk)

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

Synopsis [Splits the miter into two logic cones combined by an EXOR]

Description []

SideEffects []

SeeAlso []

Definition at line 1083 of file abcMiter.c.

1084 {
1085  Abc_Obj_t * pNodeC, * pNodeA, * pNodeB, * pNode;
1086  Abc_Obj_t * pPoNew;
1087  Vec_Ptr_t * vNodes1, * vNodes2;
1088  int nCommon, i;
1089 
1090  assert( Abc_NtkIsStrash(pNtk) );
1091  assert( Abc_NtkPoNum(pNtk) == 1 );
1092  if ( !Abc_NodeIsExorType(Abc_ObjFanin0(Abc_NtkPo(pNtk,0))) )
1093  {
1094  printf( "The root of the miter is not an EXOR gate.\n" );
1095  return 0;
1096  }
1097  pNodeC = Abc_NodeRecognizeMux( Abc_ObjFanin0(Abc_NtkPo(pNtk,0)), &pNodeA, &pNodeB );
1098  assert( Abc_ObjRegular(pNodeA) == Abc_ObjRegular(pNodeB) );
1099  if ( Abc_ObjFaninC0(Abc_NtkPo(pNtk,0)) )
1100  {
1101  pNodeA = Abc_ObjNot(pNodeA);
1102  pNodeB = Abc_ObjNot(pNodeB);
1103  }
1104 
1105  // add the PO corresponding to control input
1106  pPoNew = Abc_NtkCreatePo( pNtk );
1107  Abc_ObjAddFanin( pPoNew, pNodeC );
1108  Abc_ObjAssignName( pPoNew, "addOut1", NULL );
1109 
1110  // add the PO corresponding to other input
1111  pPoNew = Abc_NtkCreatePo( pNtk );
1112  Abc_ObjAddFanin( pPoNew, pNodeB );
1113  Abc_ObjAssignName( pPoNew, "addOut2", NULL );
1114 
1115  // mark the nodes in the first cone
1116  pNodeB = Abc_ObjRegular(pNodeB);
1117  vNodes1 = Abc_NtkDfsNodes( pNtk, &pNodeC, 1 );
1118  vNodes2 = Abc_NtkDfsNodes( pNtk, &pNodeB, 1 );
1119 
1120  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode, i )
1121  pNode->fMarkA = 1;
1122  nCommon = 0;
1123  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes2, pNode, i )
1124  nCommon += pNode->fMarkA;
1125  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode, i )
1126  pNode->fMarkA = 0;
1127 
1128  printf( "First cone = %6d. Second cone = %6d. Common = %6d.\n", vNodes1->nSize, vNodes2->nSize, nCommon );
1129  Vec_PtrFree( vNodes1 );
1130  Vec_PtrFree( vNodes2 );
1131 
1132  // reorder the latches
1133  Abc_NtkOrderCisCos( pNtk );
1134  // make sure that everything is okay
1135  if ( !Abc_NtkCheck( pNtk ) )
1136  printf( "Abc_NtkDemiter: The network check has failed.\n" );
1137  return 1;
1138 }
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_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
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
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
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
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 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
int Abc_NtkDemiter(Abc_Ntk_t *pNtk)
Definition: abcMiter.c:1083
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
ABC_DLL int Abc_NodeIsExorType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1259
ABC_DLL Abc_Obj_t * Abc_NodeRecognizeMux(Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
Definition: abcUtil.c:1389
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkFrames ( Abc_Ntk_t pNtk,
int  nFrames,
int  fInitial,
int  fVerbose 
)

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

Synopsis [Derives the timeframes of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 772 of file abcMiter.c.

773 {
774  char Buffer[1000];
775  ProgressBar * pProgress;
776  Abc_Ntk_t * pNtkFrames;
777  Abc_Obj_t * pLatch, * pLatchOut;
778  int i, Counter;
779  assert( nFrames > 0 );
780  assert( Abc_NtkIsStrash(pNtk) );
781  assert( Abc_NtkIsDfsOrdered(pNtk) );
783  // start the new network
784  pNtkFrames = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
785  sprintf( Buffer, "%s_%d_frames", pNtk->pName, nFrames );
786  pNtkFrames->pName = Extra_UtilStrsav(Buffer);
787  // map the constant nodes
788  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkFrames);
789  // create new latches (or their initial values) and remember them in the new latches
790  if ( !fInitial )
791  {
792  Abc_NtkForEachLatch( pNtk, pLatch, i )
793  Abc_NtkDupBox( pNtkFrames, pLatch, 1 );
794  }
795  else
796  {
797  Counter = 0;
798  Abc_NtkForEachLatch( pNtk, pLatch, i )
799  {
800  pLatchOut = Abc_ObjFanout0(pLatch);
801  if ( Abc_LatchIsInitNone(pLatch) || Abc_LatchIsInitDc(pLatch) ) // don't-care initial value - create a new PI
802  {
803  pLatchOut->pCopy = Abc_NtkCreatePi(pNtkFrames);
804  Abc_ObjAssignName( pLatchOut->pCopy, Abc_ObjName(pLatchOut), NULL );
805  Counter++;
806  }
807  else
808  pLatchOut->pCopy = Abc_ObjNotCond( Abc_AigConst1(pNtkFrames), Abc_LatchIsInit0(pLatch) );
809  }
810  if ( Counter )
811  printf( "Warning: %d uninitialized latches are replaced by free PI variables.\n", Counter );
812  }
813 
814  // create the timeframes
815  pProgress = Extra_ProgressBarStart( stdout, nFrames );
816  for ( i = 0; i < nFrames; i++ )
817  {
818  Extra_ProgressBarUpdate( pProgress, i, NULL );
819  Abc_NtkAddFrame( pNtkFrames, pNtk, i );
820  }
821  Extra_ProgressBarStop( pProgress );
822 
823  // connect the new latches to the outputs of the last frame
824  if ( !fInitial )
825  {
826  // we cannot use pLatch->pCopy here because pLatch->pCopy is used for temporary storage of strashed values
827  Abc_NtkForEachLatch( pNtk, pLatch, i )
828  Abc_ObjAddFanin( Abc_ObjFanin0(pLatch)->pCopy, Abc_ObjFanout0(pLatch)->pCopy );
829  }
830 
831  // remove dangling nodes
832  Abc_AigCleanup( (Abc_Aig_t *)pNtkFrames->pManFunc );
833  // reorder the latches
834  Abc_NtkOrderCisCos( pNtkFrames );
835  // make sure that everything is okay
836  if ( !Abc_NtkCheck( pNtkFrames ) )
837  {
838  printf( "Abc_NtkFrames: The network check has failed.\n" );
839  Abc_NtkDelete( pNtkFrames );
840  return NULL;
841  }
842  return pNtkFrames;
843 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_LatchIsInitNone(Abc_Obj_t *pLatch)
Definition: abc.h:421
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static void Abc_NtkAddFrame(Abc_Ntk_t *pNetNew, Abc_Ntk_t *pNet, int iFrame)
Definition: abcMiter.c:859
static int Abc_LatchIsInit0(Abc_Obj_t *pLatch)
Definition: abc.h:422
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
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
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_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
DECLARATIONS ///.
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
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
char * sprintf()
static int Counter
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
void Extra_ProgressBarStop(ProgressBar *p)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:667
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 void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:71
char * pName
Definition: abc.h:158
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
Abc_Ntk_t * Abc_NtkFrames2 ( Abc_Ntk_t pNtk,
int  nFrames,
int  fInitial,
AddFrameMapping  addFrameMapping,
void *  arg 
)

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

Synopsis [Derives the timeframes of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 905 of file abcMiter.c.

906 {
907 /*
908  char Buffer[1000];
909  ProgressBar * pProgress;
910  Abc_Ntk_t * pNtkFrames;
911  Vec_Ptr_t * vNodes;
912  Abc_Obj_t * pLatch, * pLatchNew;
913  int i, Counter;
914  assert( nFrames > 0 );
915  assert( Abc_NtkIsStrash(pNtk) );
916  // start the new network
917  pNtkFrames = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
918  sprintf( Buffer, "%s_%d_frames", pNtk->pName, nFrames );
919  pNtkFrames->pName = Extra_UtilStrsav(Buffer);
920  // create new latches (or their initial values) and remember them in the new latches
921  if ( !fInitial )
922  {
923  Abc_NtkForEachLatch( pNtk, pLatch, i ) {
924  Abc_NtkDupObj( pNtkFrames, pLatch );
925  if (addFrameMapping) addFrameMapping(pLatch->pCopy, pLatch, 0, arg);
926  }
927  }
928  else
929  {
930  Counter = 0;
931  Abc_NtkForEachLatch( pNtk, pLatch, i )
932  {
933  if ( Abc_LatchIsInitDc(pLatch) ) // don't-care initial value - create a new PI
934  {
935  pLatch->pCopy = Abc_NtkCreatePi(pNtkFrames);
936  Abc_ObjAssignName( pLatch->pCopy, Abc_ObjName(pLatch), NULL );
937  Counter++;
938  }
939  else {
940  pLatch->pCopy = Abc_ObjNotCond( Abc_AigConst1(pNtkFrames), Abc_LatchIsInit0(pLatch) );
941  }
942 
943  if (addFrameMapping) addFrameMapping(pLatch->pCopy, pLatch, 0, arg);
944  }
945  if ( Counter )
946  printf( "Warning: %d uninitialized latches are replaced by free PI variables.\n", Counter );
947  }
948 
949  // create the timeframes
950  vNodes = Abc_NtkDfs( pNtk, 0 );
951  pProgress = Extra_ProgressBarStart( stdout, nFrames );
952  for ( i = 0; i < nFrames; i++ )
953  {
954  Extra_ProgressBarUpdate( pProgress, i, NULL );
955  Abc_NtkAddFrame2( pNtkFrames, pNtk, i, vNodes, addFrameMapping, arg );
956  }
957  Extra_ProgressBarStop( pProgress );
958  Vec_PtrFree( vNodes );
959 
960  // connect the new latches to the outputs of the last frame
961  if ( !fInitial )
962  {
963  Abc_NtkForEachLatch( pNtk, pLatch, i )
964  {
965  pLatchNew = Abc_NtkBox(pNtkFrames, i);
966  Abc_ObjAddFanin( pLatchNew, pLatch->pCopy );
967  Abc_ObjAssignName( pLatchNew, Abc_ObjName(pLatch), NULL );
968  }
969  }
970  Abc_NtkForEachLatch( pNtk, pLatch, i )
971  pLatch->pNext = NULL;
972 
973  // remove dangling nodes
974  Abc_AigCleanup( pNtkFrames->pManFunc );
975 
976  // reorder the latches
977  Abc_NtkOrderCisCos( pNtkFrames );
978 
979  // make sure that everything is okay
980  if ( !Abc_NtkCheck( pNtkFrames ) )
981  {
982  printf( "Abc_NtkFrames: The network check has failed.\n" );
983  Abc_NtkDelete( pNtkFrames );
984  return NULL;
985  }
986  return pNtkFrames;
987 */
988  return NULL;
989 }
Abc_Ntk_t* Abc_NtkMiter ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fComb,
int  nPartSize,
int  fImplic,
int  fMulti 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Derives the miter of two networks.]

Description [Preprocesses the networks to make sure that they are strashed.]

SideEffects []

SeeAlso []

Definition at line 56 of file abcMiter.c.

57 {
58  Abc_Ntk_t * pTemp = NULL;
59  int fRemove1, fRemove2;
62  // check that the networks have the same PIs/POs/latches
63  if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, fImplic, fComb ) )
64  return NULL;
65  // make sure the circuits are strashed
66  fRemove1 = (!Abc_NtkIsStrash(pNtk1) || Abc_NtkGetChoiceNum(pNtk1)) && (pNtk1 = Abc_NtkStrash(pNtk1, 0, 0, 0));
67  fRemove2 = (!Abc_NtkIsStrash(pNtk2) || Abc_NtkGetChoiceNum(pNtk2)) && (pNtk2 = Abc_NtkStrash(pNtk2, 0, 0, 0));
68  if ( pNtk1 && pNtk2 )
69  pTemp = Abc_NtkMiterInt( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti );
70  if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
71  if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
72  return pTemp;
73 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
ABC_DLL int Abc_NtkCompareSignals(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fOnlyPis, int fComb)
Definition: abcCheck.c:741
static ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkMiterInt(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
DECLARATIONS ///.
Definition: abcMiter.c:86
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkMiterAddCone ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkMiter,
Abc_Obj_t pRoot 
)

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

Synopsis [Performs mitering for one network.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file abcMiter.c.

252 {
253  Vec_Ptr_t * vNodes;
254  Abc_Obj_t * pNode;
255  int i;
256  // map the constant nodes
257  Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkMiter);
258  // perform strashing
259  vNodes = Abc_NtkDfsNodes( pNtk, &pRoot, 1 );
260  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
261  if ( Abc_AigNodeIsAnd(pNode) )
262  pNode->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
263  Vec_PtrFree( vNodes );
264 }
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
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
Abc_Obj_t * pCopy
Definition: abc.h:148
if(last==0)
Definition: sparse_int.h:34
static int Abc_AigNodeIsAnd(Abc_Obj_t *pNode)
Definition: abc.h:397
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_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkMiterAddOne ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkMiter 
)
static

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

Synopsis [Performs mitering for one network.]

Description []

SideEffects []

SeeAlso []

Definition at line 231 of file abcMiter.c.

232 {
233  Abc_Obj_t * pNode;
234  int i;
235  assert( Abc_NtkIsDfsOrdered(pNtk) );
236  Abc_AigForEachAnd( pNtk, pNode, i )
237  pNode->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
238 }
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
DECLARATIONS ///.
Definition: abcAig.c:52
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
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_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:667
#define assert(ex)
Definition: util_old.h:213
Abc_Ntk_t* Abc_NtkMiterAnd ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fOr,
int  fCompl2 
)

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

Synopsis [Derives the AND of two miters.]

Description [The network should have the same names of PIs.]

SideEffects []

SeeAlso []

Definition at line 384 of file abcMiter.c.

385 {
386  char Buffer[1000];
387  Abc_Ntk_t * pNtkMiter;
388  Abc_Obj_t * pOutput1, * pOutput2;
389  Abc_Obj_t * pRoot1, * pRoot2, * pMiter;
390 
391  assert( Abc_NtkIsStrash(pNtk1) );
392  assert( Abc_NtkIsStrash(pNtk2) );
393  assert( 1 == Abc_NtkCoNum(pNtk1) );
394  assert( 1 == Abc_NtkCoNum(pNtk2) );
395  assert( 0 == Abc_NtkLatchNum(pNtk1) );
396  assert( 0 == Abc_NtkLatchNum(pNtk2) );
397  assert( Abc_NtkCiNum(pNtk1) == Abc_NtkCiNum(pNtk2) );
400 
401  // start the new network
402  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
403 // sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
404  sprintf( Buffer, "product" );
405  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
406 
407  // perform strashing
408  Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, 1, -1, 0 );
409  Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
410  Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
411 // Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, 1 );
412  pRoot1 = Abc_NtkPo(pNtk1,0);
413  pRoot2 = Abc_NtkPo(pNtk2,0);
414  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot1)->pCopy, Abc_ObjFaninC0(pRoot1) );
415  pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot2)->pCopy, (int)Abc_ObjFaninC0(pRoot2) ^ fCompl2 );
416 
417  // create the miter of the two outputs
418  if ( fOr )
419  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
420  else
421  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
422  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
423 
424  // make sure that everything is okay
425  if ( !Abc_NtkCheck( pNtkMiter ) )
426  {
427  printf( "Abc_NtkMiterAnd: The network check has failed.\n" );
428  Abc_NtkDelete( pNtkMiter );
429  return NULL;
430  }
431  return pNtkMiter;
432 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
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
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
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_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
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
char * sprintf()
static void Abc_NtkMiterAddOne(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter)
Definition: abcMiter.c:231
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
char * pName
Definition: abc.h:158
Abc_Ntk_t* Abc_NtkMiterCofactor ( Abc_Ntk_t pNtk,
Vec_Int_t vPiValues 
)

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

Synopsis [Derives the cofactor of the miter w.r.t. the set of vars.]

Description [The array of variable values contains -1/0/1 for each PI. -1 means this PI remains, 0/1 means this PI is set to 0/1.]

SideEffects []

SeeAlso []

Definition at line 447 of file abcMiter.c.

448 {
449  char Buffer[1000];
450  Abc_Ntk_t * pNtkMiter;
451  Abc_Obj_t * pRoot, * pOutput1;
452  int Value, i;
453 
454  assert( Abc_NtkIsStrash(pNtk) );
455  assert( 1 == Abc_NtkCoNum(pNtk) );
457 
458  // start the new network
459  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
460  sprintf( Buffer, "%s_miter", pNtk->pName );
461  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
462 
463  // get the root output
464  pRoot = Abc_NtkCo( pNtk, 0 );
465 
466  // perform strashing
467  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
468  // set the first cofactor
469  Vec_IntForEachEntry( vPiValues, Value, i )
470  {
471  if ( Value == -1 )
472  continue;
473  if ( Value == 0 )
474  {
475  Abc_NtkCi(pNtk, i)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
476  continue;
477  }
478  if ( Value == 1 )
479  {
480  Abc_NtkCi(pNtk, i)->pCopy = Abc_AigConst1(pNtkMiter);
481  continue;
482  }
483  assert( 0 );
484  }
485  // add the first cofactor
486  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
487 
488  // save the output
489  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
490 
491  // create the miter of the two outputs
492  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pOutput1 );
493 
494  // make sure that everything is okay
495  if ( !Abc_NtkCheck( pNtkMiter ) )
496  {
497  printf( "Abc_NtkMiterCofactor: The network check has failed.\n" );
498  Abc_NtkDelete( pNtkMiter );
499  return NULL;
500  }
501  return pNtkMiter;
502 }
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 int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
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
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
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_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
char * sprintf()
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
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 Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
char * pName
Definition: abc.h:158
void Abc_NtkMiterFinalize ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
Abc_Ntk_t pNtkMiter,
int  fComb,
int  nPartSize,
int  fImplic,
int  fMulti 
)
static

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

Synopsis [Finalizes the miter by adding the output part.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file abcMiter.c.

279 {
280  Vec_Ptr_t * vPairs;
281  Abc_Obj_t * pMiter, * pNode;
282  int i;
283  assert( nPartSize == 0 || fMulti == 0 );
284  // collect the PO pairs from both networks
285  vPairs = Vec_PtrAlloc( 100 );
286  if ( fComb )
287  {
288  // collect the CO nodes for the miter
289  Abc_NtkForEachCo( pNtk1, pNode, i )
290  {
291  if ( fMulti )
292  {
293  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild0Copy(Abc_NtkCo(pNtk2, i)) );
294  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,i), pMiter );
295  }
296  else
297  {
298  Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
299  pNode = Abc_NtkCo( pNtk2, i );
300  Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
301  }
302  }
303  }
304  else
305  {
306  // collect the PO nodes for the miter
307  Abc_NtkForEachPo( pNtk1, pNode, i )
308  {
309  if ( fMulti )
310  {
311  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild0Copy(Abc_NtkCo(pNtk2, i)) );
312  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,i), pMiter );
313  }
314  else
315  {
316  Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
317  pNode = Abc_NtkPo( pNtk2, i );
318  Vec_PtrPush( vPairs, Abc_ObjChild0Copy(pNode) );
319  }
320  }
321  // connect new latches
322  Abc_NtkForEachLatch( pNtk1, pNode, i )
324  Abc_NtkForEachLatch( pNtk2, pNode, i )
326  }
327  // add the miter
328  if ( nPartSize <= 0 )
329  {
330  if ( !fMulti )
331  {
332  pMiter = Abc_AigMiter( (Abc_Aig_t *)pNtkMiter->pManFunc, vPairs, fImplic );
333  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
334  }
335  }
336  else
337  {
338  char Buffer[1024];
339  Vec_Ptr_t * vPairsPart;
340  int nParts, i, k, iCur;
341  assert( Vec_PtrSize(vPairs) == 2 * Abc_NtkCoNum(pNtk1) );
342  // create partitions
343  nParts = Abc_NtkCoNum(pNtk1) / nPartSize + (int)((Abc_NtkCoNum(pNtk1) % nPartSize) > 0);
344  vPairsPart = Vec_PtrAlloc( nPartSize );
345  for ( i = 0; i < nParts; i++ )
346  {
347  Vec_PtrClear( vPairsPart );
348  for ( k = 0; k < nPartSize; k++ )
349  {
350  iCur = i * nPartSize + k;
351  if ( iCur >= Abc_NtkCoNum(pNtk1) )
352  break;
353  Vec_PtrPush( vPairsPart, Vec_PtrEntry(vPairs, 2*iCur ) );
354  Vec_PtrPush( vPairsPart, Vec_PtrEntry(vPairs, 2*iCur+1) );
355  }
356  pMiter = Abc_AigMiter( (Abc_Aig_t *)pNtkMiter->pManFunc, vPairsPart, fImplic );
357  pNode = Abc_NtkCreatePo( pNtkMiter );
358  Abc_ObjAddFanin( pNode, pMiter );
359  // assign the name to the node
360  if ( nPartSize == 1 )
361  sprintf( Buffer, "%s", Abc_ObjName(Abc_NtkCo(pNtk1,i)) );
362  else
363  sprintf( Buffer, "%d", i );
364  Abc_ObjAssignName( pNode, "miter_", Buffer );
365  }
366  Vec_PtrFree( vPairsPart );
367  }
368  Vec_PtrFree( vPairs );
369 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
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
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
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 void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
void * pManFunc
Definition: abc.h:191
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
ABC_DLL Abc_Obj_t * Abc_AigMiter(Abc_Aig_t *pMan, Vec_Ptr_t *vPairs, int fImplic)
Definition: abcAig.c:789
if(last==0)
Definition: sparse_int.h:34
char * sprintf()
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkMiterForCofactors ( Abc_Ntk_t pNtk,
int  Out,
int  In1,
int  In2 
)

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

Synopsis [Derives the miter of two cofactors of one output.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file abcMiter.c.

515 {
516  char Buffer[1000];
517  Abc_Ntk_t * pNtkMiter;
518  Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
519 
520  assert( Abc_NtkIsStrash(pNtk) );
521  assert( Out < Abc_NtkCoNum(pNtk) );
522  assert( In1 < Abc_NtkCiNum(pNtk) );
523  assert( In2 < Abc_NtkCiNum(pNtk) );
525 
526  // start the new network
527  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
528  sprintf( Buffer, "%s_miter", Abc_ObjName(Abc_NtkCo(pNtk, Out)) );
529  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
530 
531  // get the root output
532  pRoot = Abc_NtkCo( pNtk, Out );
533 
534  // perform strashing
535  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
536  // set the first cofactor
537  Abc_NtkCi(pNtk, In1)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
538  if ( In2 >= 0 )
539  Abc_NtkCi(pNtk, In2)->pCopy = Abc_AigConst1(pNtkMiter);
540  // add the first cofactor
541  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
542 
543  // save the output
544  pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
545 
546  // set the second cofactor
547  Abc_NtkCi(pNtk, In1)->pCopy = Abc_AigConst1(pNtkMiter);
548  if ( In2 >= 0 )
549  Abc_NtkCi(pNtk, In2)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
550  // add the second cofactor
551  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
552 
553  // save the output
554  pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
555 
556  // create the miter of the two outputs
557  pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
558  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
559 
560  // make sure that everything is okay
561  if ( !Abc_NtkCheck( pNtkMiter ) )
562  {
563  printf( "Abc_NtkMiter: The network check has failed.\n" );
564  Abc_NtkDelete( pNtkMiter );
565  return NULL;
566  }
567  return pNtkMiter;
568 }
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 int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
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
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
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_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
ABC_DLL Abc_Obj_t * Abc_AigXor(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:735
void * pManFunc
Definition: abc.h:191
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
char * sprintf()
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
char * pName
Definition: abc.h:158
Abc_Ntk_t * Abc_NtkMiterInt ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
int  fComb,
int  nPartSize,
int  fImplic,
int  fMulti 
)
static

DECLARATIONS ///.

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

FileName [abcMiter.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Procedures to derive the miter of two circuits.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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

Synopsis [Derives the miter of two sequential networks.]

Description [Assumes that the networks are strashed.]

SideEffects []

SeeAlso []

Definition at line 86 of file abcMiter.c.

87 {
88  char Buffer[1000];
89  Abc_Ntk_t * pNtkMiter;
90 
91  assert( Abc_NtkIsStrash(pNtk1) );
92  assert( Abc_NtkIsStrash(pNtk2) );
93 
94  // start the new network
95  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
96  sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
97  pNtkMiter->pName = Extra_UtilStrsav(Buffer);
98 
99  // perform strashing
100  Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize, fMulti );
101  Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
102  Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
103  Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, fComb, nPartSize, fImplic, fMulti );
104  Abc_AigCleanup((Abc_Aig_t *)pNtkMiter->pManFunc);
105 
106  // make sure that everything is okay
107  if ( !Abc_NtkCheck( pNtkMiter ) )
108  {
109  printf( "Abc_NtkMiter: The network check has failed.\n" );
110  Abc_NtkDelete( pNtkMiter );
111  return NULL;
112  }
113  return pNtkMiter;
114 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
void * pManFunc
Definition: abc.h:191
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
char * sprintf()
static void Abc_NtkMiterAddOne(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter)
Definition: abcMiter.c:231
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
#define assert(ex)
Definition: util_old.h:213
static void Abc_NtkMiterFinalize(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fImplic, int fMulti)
Definition: abcMiter.c:278
char * pName
Definition: abc.h:158
int Abc_NtkMiterIsConstant ( Abc_Ntk_t pMiter)

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

Synopsis [Checks the status of the miter.]

Description [Return 0 if the miter is sat for at least one output. Return 1 if the miter is unsat for all its outputs. Returns -1 if the miter is undecided for some outputs.]

SideEffects []

SeeAlso []

Definition at line 679 of file abcMiter.c.

680 {
681  Abc_Obj_t * pNodePo, * pChild;
682  int i;
683  assert( Abc_NtkIsStrash(pMiter) );
684  Abc_NtkForEachPo( pMiter, pNodePo, i )
685  {
686  pChild = Abc_ObjChild0( pNodePo );
687  // check if the output is constant 1
688  if ( Abc_AigNodeIsConst(pChild) )
689  {
690  assert( Abc_ObjRegular(pChild) == Abc_AigConst1(pMiter) );
691  if ( !Abc_ObjIsComplement(pChild) )
692  {
693  // if the miter is constant 1, return immediately
694 // printf( "MITER IS CONSTANT 1!\n" );
695  return 0;
696  }
697  }
698 /*
699  // check if the output is not constant 0
700  else if ( Abc_ObjRegular(pChild)->fPhase != (unsigned)Abc_ObjIsComplement(pChild) )
701  {
702  return 0;
703  }
704 */
705  // if the miter is undecided (or satisfiable), return immediately
706  else
707  return -1;
708  }
709  // return 1, meaning all outputs are constant zero
710  return 1;
711 }
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 int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
void Abc_NtkMiterPrepare ( Abc_Ntk_t pNtk1,
Abc_Ntk_t pNtk2,
Abc_Ntk_t pNtkMiter,
int  fComb,
int  nPartSize,
int  fMulti 
)
static

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

Synopsis [Prepares the network for mitering.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file abcMiter.c.

128 {
129  Abc_Obj_t * pObj, * pObjNew;
130  int i;
131  // clean the copy field in all objects
132 // Abc_NtkCleanCopy( pNtk1 );
133 // Abc_NtkCleanCopy( pNtk2 );
134  Abc_AigConst1(pNtk1)->pCopy = Abc_AigConst1(pNtkMiter);
135  Abc_AigConst1(pNtk2)->pCopy = Abc_AigConst1(pNtkMiter);
136 
137  if ( fComb )
138  {
139  // create new PIs and remember them in the old PIs
140  Abc_NtkForEachCi( pNtk1, pObj, i )
141  {
142  pObjNew = Abc_NtkCreatePi( pNtkMiter );
143  // remember this PI in the old PIs
144  pObj->pCopy = pObjNew;
145  pObj = Abc_NtkCi(pNtk2, i);
146  pObj->pCopy = pObjNew;
147  // add name
148  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
149  }
150  if ( nPartSize <= 0 )
151  {
152  // create POs
153  if ( fMulti )
154  {
155  Abc_NtkForEachCo( pNtk1, pObj, i )
156  {
157  pObjNew = Abc_NtkCreatePo( pNtkMiter );
158  Abc_ObjAssignName( pObjNew, "miter", Abc_ObjName(pObjNew) );
159  }
160 
161  }
162  else
163  {
164  pObjNew = Abc_NtkCreatePo( pNtkMiter );
165  Abc_ObjAssignName( pObjNew, "miter", NULL );
166  }
167  }
168  }
169  else
170  {
171  // create new PIs and remember them in the old PIs
172  Abc_NtkForEachPi( pNtk1, pObj, i )
173  {
174  pObjNew = Abc_NtkCreatePi( pNtkMiter );
175  // remember this PI in the old PIs
176  pObj->pCopy = pObjNew;
177  pObj = Abc_NtkPi(pNtk2, i);
178  pObj->pCopy = pObjNew;
179  // add name
180  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), NULL );
181  }
182  if ( nPartSize <= 0 )
183  {
184  // create POs
185  if ( fMulti )
186  {
187  Abc_NtkForEachPo( pNtk1, pObj, i )
188  {
189  pObjNew = Abc_NtkCreatePo( pNtkMiter );
190  Abc_ObjAssignName( pObjNew, "miter", Abc_ObjName(pObjNew) );
191  }
192 
193  }
194  else
195  {
196  pObjNew = Abc_NtkCreatePo( pNtkMiter );
197  Abc_ObjAssignName( pObjNew, "miter", NULL );
198  }
199  }
200  // create the latches
201  Abc_NtkForEachLatch( pNtk1, pObj, i )
202  {
203  pObjNew = Abc_NtkDupBox( pNtkMiter, pObj, 0 );
204  // add names
205  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), "_1" );
206  Abc_ObjAssignName( Abc_ObjFanin0(pObjNew), Abc_ObjName(Abc_ObjFanin0(pObj)), "_1" );
208  }
209  Abc_NtkForEachLatch( pNtk2, pObj, i )
210  {
211  pObjNew = Abc_NtkDupBox( pNtkMiter, pObj, 0 );
212  // add name
213  Abc_ObjAssignName( pObjNew, Abc_ObjName(pObj), "_2" );
214  Abc_ObjAssignName( Abc_ObjFanin0(pObjNew), Abc_ObjName(Abc_ObjFanin0(pObj)), "_2" );
216  }
217  }
218 }
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
#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 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
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_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
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
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
Abc_Ntk_t* Abc_NtkMiterQuantify ( Abc_Ntk_t pNtk,
int  In,
int  fExist 
)

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

Synopsis [Derives the miter of two cofactors of one output.]

Description []

SideEffects []

SeeAlso []

Definition at line 582 of file abcMiter.c.

583 {
584  Abc_Ntk_t * pNtkMiter;
585  Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
586 
587  assert( Abc_NtkIsStrash(pNtk) );
588  assert( 1 == Abc_NtkCoNum(pNtk) );
589  assert( In < Abc_NtkCiNum(pNtk) );
591 
592  // start the new network
593  pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
594  pNtkMiter->pName = Extra_UtilStrsav( Abc_ObjName(Abc_NtkCo(pNtk, 0)) );
595 
596  // get the root output
597  pRoot = Abc_NtkCo( pNtk, 0 );
598 
599  // perform strashing
600  Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
601  // set the first cofactor
602  Abc_NtkCi(pNtk, In)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
603  // add the first cofactor
604  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
605  // save the output
606 // pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
607  pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
608 
609  // set the second cofactor
610  Abc_NtkCi(pNtk, In)->pCopy = Abc_AigConst1(pNtkMiter);
611  // add the second cofactor
612  Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
613  // save the output
614 // pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
615  pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
616 
617  // create the miter of the two outputs
618  if ( fExist )
619  pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
620  else
621  pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
622  Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
623 
624  // make sure that everything is okay
625  if ( !Abc_NtkCheck( pNtkMiter ) )
626  {
627  printf( "Abc_NtkMiter: The network check has failed.\n" );
628  Abc_NtkDelete( pNtkMiter );
629  return NULL;
630  }
631  return pNtkMiter;
632 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
ABC_DLL Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:719
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 Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
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
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
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_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
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
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition: abcMiter.c:251
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
static void Abc_NtkMiterPrepare(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, Abc_Ntk_t *pNtkMiter, int fComb, int nPartSize, int fMulti)
Definition: abcMiter.c:127
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
char * pName
Definition: abc.h:158
Abc_Ntk_t* Abc_NtkMiterQuantifyPis ( Abc_Ntk_t pNtk)

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

Synopsis [Quantifies all the PIs existentially from the only PO of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 645 of file abcMiter.c.

646 {
647  Abc_Ntk_t * pNtkTemp;
648  Abc_Obj_t * pObj;
649  int i;
651 
652  Abc_NtkForEachPi( pNtk, pObj, i )
653  {
654  if ( Abc_ObjFanoutNum(pObj) == 0 )
655  continue;
656  pNtk = Abc_NtkMiterQuantify( pNtkTemp = pNtk, i, 1 );
657  Abc_NtkDelete( pNtkTemp );
658  }
659 
660  return pNtk;
661 }
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
Abc_Ntk_t * Abc_NtkMiterQuantify(Abc_Ntk_t *pNtk, int In, int fExist)
Definition: abcMiter.c:582
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
void Abc_NtkMiterReport ( Abc_Ntk_t pMiter)

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 724 of file abcMiter.c.

725 {
726  Abc_Obj_t * pChild, * pNode;
727  int i;
728  if ( Abc_NtkPoNum(pMiter) == 1 )
729  {
730  pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,0) );
731  if ( Abc_AigNodeIsConst(pChild) )
732  {
733  if ( Abc_ObjIsComplement(pChild) )
734  printf( "Unsatisfiable.\n" );
735  else
736  printf( "Satisfiable. (Constant 1).\n" );
737  }
738  else
739  printf( "Satisfiable.\n" );
740  }
741  else
742  {
743  Abc_NtkForEachPo( pMiter, pNode, i )
744  {
745  pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,i) );
746  printf( "Output #%2d : ", i );
747  if ( Abc_AigNodeIsConst(pChild) )
748  {
749  if ( Abc_ObjIsComplement(pChild) )
750  printf( "Unsatisfiable.\n" );
751  else
752  printf( "Satisfiable. (Constant 1).\n" );
753  }
754  else
755  printf( "Satisfiable.\n" );
756  }
757  }
758 }
static int Abc_AigNodeIsConst(Abc_Obj_t *pNode)
Definition: abc.h:396
static Abc_Obj_t * Abc_ObjChild0(Abc_Obj_t *pObj)
Definition: abc.h:383
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_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322