ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcMiter.c File Reference
#include "base/abc/abc.h"
#include "base/io/ioAbc.h"
#include "sat/cnf/cnf.h"
#include "sat/bsat/satStore.h"
Include dependency graph for abcMiter.c:

Go to the source code of this file.

Typedefs

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

Functions

Abc_Ntk_tAbc_NtkFrames2 (Abc_Ntk_t *pNtk, int nFrames, int fInitial, 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 ///.
 
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)
 
Vec_Ptr_tAbc_NtkTryNewMiter (char *pFileName0, char *pFileName1)
 
Vec_Ptr_tAbc_NtkReadNodeNames (Abc_Ntk_t *pNtk, char *pFileName)
 
Abc_Obj_tAbc_NtkSpecialMuxTree_rec (Abc_Ntk_t *pNew, Abc_Obj_t **pCtrl, int nCtrl, Abc_Obj_t **pData, int Shift)
 
Abc_Ntk_tAbc_NtkSpecialMiter (Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes)
 

Typedef Documentation

◆ AddFrameMapping

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

Definition at line 40 of file abcMiter.c.

Function Documentation

◆ Abc_NtkCombinePos()

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 1155 of file abcMiter.c.

1156{
1157 Abc_Obj_t * pNode, * pMiter;
1158 int i;
1159 assert( Abc_NtkIsStrash(pNtk) );
1160// assert( Abc_NtkLatchNum(pNtk) == 0 );
1161 if ( Abc_NtkPoNum(pNtk) == 1 )
1162 return 1;
1163 // start the result
1164 if ( fAnd )
1165 pMiter = Abc_AigConst1(pNtk);
1166 else
1167 pMiter = Abc_ObjNot( Abc_AigConst1(pNtk) );
1168 // perform operations on the POs
1169 Abc_NtkForEachPo( pNtk, pNode, i )
1170 if ( fAnd )
1171 pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1172 else if ( fXor )
1173 pMiter = Abc_AigXor( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1174 else
1175 pMiter = Abc_AigOr( (Abc_Aig_t *)pNtk->pManFunc, pMiter, Abc_ObjChild0(pNode) );
1176 // remove the POs and their names
1177 for ( i = Abc_NtkPoNum(pNtk) - 1; i >= 0; i-- )
1178 Abc_NtkDeleteObj( Abc_NtkPo(pNtk, i) );
1179 assert( Abc_NtkPoNum(pNtk) == 0 );
1180 // create the new PO
1181 pNode = Abc_NtkCreatePo( pNtk );
1182 Abc_ObjAddFanin( pNode, pMiter );
1183 Abc_ObjAssignName( pNode, "miter", NULL );
1184 Abc_NtkOrderCisCos( pNtk );
1185 // make sure that everything is okay
1186 if ( !Abc_NtkCheck( pNtk ) )
1187 {
1188 printf( "Abc_NtkOrPos: The network check has failed.\n" );
1189 return 0;
1190 }
1191 return 1;
1192}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
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
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
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 Abc_Obj_t * Abc_AigOr(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:719
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition abcUtil.c:76
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
void * pManFunc
Definition abc.h:191
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDemiter()

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 1087 of file abcMiter.c.

1088{
1089 Abc_Obj_t * pNodeC, * pNodeA, * pNodeB, * pNode;
1090 Abc_Obj_t * pPoNew;
1091 Vec_Ptr_t * vNodes1, * vNodes2;
1092 int nCommon, i;
1093
1094 assert( Abc_NtkIsStrash(pNtk) );
1095 assert( Abc_NtkPoNum(pNtk) == 1 );
1096 if ( !Abc_NodeIsExorType(Abc_ObjFanin0(Abc_NtkPo(pNtk,0))) )
1097 {
1098 printf( "The root of the miter is not an EXOR gate.\n" );
1099 return 0;
1100 }
1101 pNodeC = Abc_NodeRecognizeMux( Abc_ObjFanin0(Abc_NtkPo(pNtk,0)), &pNodeA, &pNodeB );
1102 assert( Abc_ObjRegular(pNodeA) == Abc_ObjRegular(pNodeB) );
1103 if ( Abc_ObjFaninC0(Abc_NtkPo(pNtk,0)) )
1104 {
1105 pNodeA = Abc_ObjNot(pNodeA);
1106 pNodeB = Abc_ObjNot(pNodeB);
1107 }
1108
1109 // add the PO corresponding to control input
1110 pPoNew = Abc_NtkCreatePo( pNtk );
1111 Abc_ObjAddFanin( pPoNew, pNodeC );
1112 Abc_ObjAssignName( pPoNew, "addOut1", NULL );
1113
1114 // add the PO corresponding to other input
1115 pPoNew = Abc_NtkCreatePo( pNtk );
1116 Abc_ObjAddFanin( pPoNew, pNodeB );
1117 Abc_ObjAssignName( pPoNew, "addOut2", NULL );
1118
1119 // mark the nodes in the first cone
1120 pNodeB = Abc_ObjRegular(pNodeB);
1121 vNodes1 = Abc_NtkDfsNodes( pNtk, &pNodeC, 1 );
1122 vNodes2 = Abc_NtkDfsNodes( pNtk, &pNodeB, 1 );
1123
1124 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode, i )
1125 pNode->fMarkA = 1;
1126 nCommon = 0;
1127 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes2, pNode, i )
1128 nCommon += pNode->fMarkA;
1129 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode, i )
1130 pNode->fMarkA = 0;
1131
1132 printf( "First cone = %6d. Second cone = %6d. Common = %6d.\n", vNodes1->nSize, vNodes2->nSize, nCommon );
1133 Vec_PtrFree( vNodes1 );
1134 Vec_PtrFree( vNodes2 );
1135
1136 // reorder the latches
1137 Abc_NtkOrderCisCos( pNtk );
1138 // make sure that everything is okay
1139 if ( !Abc_NtkCheck( pNtk ) )
1140 printf( "Abc_NtkDemiter: The network check has failed.\n" );
1141 return 1;
1142}
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition abcDfs.c:151
ABC_DLL Abc_Obj_t * Abc_NodeRecognizeMux(Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
Definition abcUtil.c:1430
ABC_DLL int Abc_NodeIsExorType(Abc_Obj_t *pNode)
Definition abcUtil.c:1300
unsigned fMarkA
Definition abc.h:134
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Abc_NtkFrames()

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 775 of file abcMiter.c.

776{
777 char Buffer[1000];
778 ProgressBar * pProgress;
779 Abc_Ntk_t * pNtkFrames;
780 Abc_Obj_t * pLatch, * pLatchOut;
781 int i, Counter;
782 assert( nFrames > 0 );
783 assert( Abc_NtkIsStrash(pNtk) );
785 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
786 // start the new network
787 pNtkFrames = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
788 sprintf( Buffer, "%s_%d_frames", pNtk->pName, nFrames );
789 pNtkFrames->pName = Extra_UtilStrsav(Buffer);
790 // map the constant nodes
791 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkFrames);
792
793 // create new latches (or their initial values) and remember them in the new latches
794 if ( !fInitial )
795 {
796 Abc_NtkForEachLatch( pNtk, pLatch, i )
797 Abc_NtkDupBox( pNtkFrames, pLatch, 1 );
798 }
799 else
800 {
801 Counter = 0;
802 Abc_NtkForEachLatch( pNtk, pLatch, i )
803 {
804 pLatchOut = Abc_ObjFanout0(pLatch);
805 if ( Abc_LatchIsInitNone(pLatch) || Abc_LatchIsInitDc(pLatch) ) // don't-care initial value - create a new PI
806 {
807 pLatchOut->pCopy = Abc_NtkCreatePi(pNtkFrames);
808 Abc_ObjAssignName( pLatchOut->pCopy, Abc_ObjName(pLatchOut), NULL );
809 Counter++;
810 }
811 else
812 pLatchOut->pCopy = Abc_ObjNotCond( Abc_AigConst1(pNtkFrames), Abc_LatchIsInit0(pLatch) );
813 }
814 if ( Counter )
815 printf( "Warning: %d uninitialized latches are replaced by free PI variables.\n", Counter );
816 }
817
818 // create the timeframes
819 pProgress = Extra_ProgressBarStart( stdout, nFrames );
820 for ( i = 0; i < nFrames; i++ )
821 {
822 Extra_ProgressBarUpdate( pProgress, i, NULL );
823 Abc_NtkAddFrame( pNtkFrames, pNtk, i );
824 }
825 Extra_ProgressBarStop( pProgress );
826
827 // connect the new latches to the outputs of the last frame
828 if ( !fInitial )
829 {
830 // we cannot use pLatch->pCopy here because pLatch->pCopy is used for temporary storage of strashed values
831 Abc_NtkForEachLatch( pNtk, pLatch, i )
832 Abc_ObjAddFanin( Abc_ObjFanin0(pLatch)->pCopy, Abc_ObjFanout0(pLatch)->pCopy );
833 }
834
835 // remove dangling nodes
836 Abc_AigCleanup( (Abc_Aig_t *)pNtkFrames->pManFunc );
837 // reorder the latches
838 Abc_NtkOrderCisCos( pNtkFrames );
839 // make sure that everything is okay
840 if ( !Abc_NtkCheck( pNtkFrames ) )
841 {
842 printf( "Abc_NtkFrames: The network check has failed.\n" );
843 Abc_NtkDelete( pNtkFrames );
844 return NULL;
845 }
846 return pNtkFrames;
847}
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition abcDfs.c:698
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition abcAig.c:194
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL Abc_Obj_t * Abc_NtkDupBox(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pBox, int fCopyName)
Definition abcObj.c:415
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Extra_ProgressBarStop(ProgressBar *p)
char * Extra_UtilStrsav(const char *s)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
char * pName
Definition abc.h:158
Abc_Obj_t * pCopy
Definition abc.h:148
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFrames2()

Abc_Ntk_t * Abc_NtkFrames2 ( Abc_Ntk_t * pNtk,
int nFrames,
int fInitial,
AddFrameMapping addFrameMapping,
void * arg )
extern

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

Synopsis [Derives the timeframes of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 909 of file abcMiter.c.

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

◆ Abc_NtkMiter()

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 59 of file abcMiter.c.

60{
61 Abc_Ntk_t * pTemp = NULL;
62 int fRemove1, fRemove2;
63 assert( Abc_NtkHasOnlyLatchBoxes(pNtk1) );
64 assert( Abc_NtkHasOnlyLatchBoxes(pNtk2) );
65 // check that the networks have the same PIs/POs/latches
66 if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, fImplic, fComb ) )
67 return NULL;
68 // make sure the circuits are strashed
69 fRemove1 = (!Abc_NtkIsStrash(pNtk1) || Abc_NtkGetChoiceNum(pNtk1)) && (pNtk1 = Abc_NtkStrash(pNtk1, 0, 0, 0));
70 fRemove2 = (!Abc_NtkIsStrash(pNtk2) || Abc_NtkGetChoiceNum(pNtk2)) && (pNtk2 = Abc_NtkStrash(pNtk2, 0, 0, 0));
71 if ( pNtk1 && pNtk2 )
72 pTemp = Abc_NtkMiterInt( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti );
73 if ( fRemove1 ) Abc_NtkDelete( pNtk1 );
74 if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
75 return pTemp;
76}
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
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:749
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterAddCone()

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 254 of file abcMiter.c.

255{
256 Vec_Ptr_t * vNodes;
257 Abc_Obj_t * pNode;
258 int i;
259 // map the constant nodes
260 Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkMiter);
261 // perform strashing
262 vNodes = Abc_NtkDfsNodes( pNtk, &pRoot, 1 );
263 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
264 if ( Abc_AigNodeIsAnd(pNode) )
265 pNode->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, Abc_ObjChild0Copy(pNode), Abc_ObjChild1Copy(pNode) );
266 Vec_PtrFree( vNodes );
267}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterAnd()

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 387 of file abcMiter.c.

388{
389 char Buffer[1000];
390 Abc_Ntk_t * pNtkMiter;
391 Abc_Obj_t * pOutput1, * pOutput2;
392 Abc_Obj_t * pRoot1, * pRoot2, * pMiter;
393
394 assert( Abc_NtkIsStrash(pNtk1) );
395 assert( Abc_NtkIsStrash(pNtk2) );
396 assert( 1 == Abc_NtkCoNum(pNtk1) );
397 assert( 1 == Abc_NtkCoNum(pNtk2) );
398 assert( 0 == Abc_NtkLatchNum(pNtk1) );
399 assert( 0 == Abc_NtkLatchNum(pNtk2) );
400 assert( Abc_NtkCiNum(pNtk1) == Abc_NtkCiNum(pNtk2) );
401 assert( Abc_NtkHasOnlyLatchBoxes(pNtk1) );
402 assert( Abc_NtkHasOnlyLatchBoxes(pNtk2) );
403
404 // start the new network
405 pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
406// sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
407 sprintf( Buffer, "product" );
408 pNtkMiter->pName = Extra_UtilStrsav(Buffer);
409
410 // perform strashing
411 Abc_NtkMiterPrepare( pNtk1, pNtk2, pNtkMiter, 1, -1, 0 );
412 Abc_NtkMiterAddOne( pNtk1, pNtkMiter );
413 Abc_NtkMiterAddOne( pNtk2, pNtkMiter );
414// Abc_NtkMiterFinalize( pNtk1, pNtk2, pNtkMiter, 1 );
415 pRoot1 = Abc_NtkPo(pNtk1,0);
416 pRoot2 = Abc_NtkPo(pNtk2,0);
417 pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot1)->pCopy, Abc_ObjFaninC0(pRoot1) );
418 pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot2)->pCopy, (int)Abc_ObjFaninC0(pRoot2) ^ fCompl2 );
419
420 // create the miter of the two outputs
421 if ( fOr )
422 pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
423 else
424 pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
425 Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
426
427 // make sure that everything is okay
428 if ( !Abc_NtkCheck( pNtkMiter ) )
429 {
430 printf( "Abc_NtkMiterAnd: The network check has failed.\n" );
431 Abc_NtkDelete( pNtkMiter );
432 return NULL;
433 }
434 return pNtkMiter;
435}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterCofactor()

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 450 of file abcMiter.c.

451{
452 char Buffer[1000];
453 Abc_Ntk_t * pNtkMiter;
454 Abc_Obj_t * pRoot, * pOutput1;
455 int Value, i;
456
457 assert( Abc_NtkIsStrash(pNtk) );
458 assert( 1 == Abc_NtkCoNum(pNtk) );
459 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
460
461 // start the new network
462 pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
463 sprintf( Buffer, "%s_miter", pNtk->pName );
464 pNtkMiter->pName = Extra_UtilStrsav(Buffer);
465
466 // get the root output
467 pRoot = Abc_NtkCo( pNtk, 0 );
468
469 // perform strashing
470 Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
471 // set the first cofactor
472 Vec_IntForEachEntry( vPiValues, Value, i )
473 {
474 if ( Value == -1 )
475 continue;
476 if ( Value == 0 )
477 {
478 Abc_NtkCi(pNtk, i)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
479 continue;
480 }
481 if ( Value == 1 )
482 {
483 Abc_NtkCi(pNtk, i)->pCopy = Abc_AigConst1(pNtkMiter);
484 continue;
485 }
486 assert( 0 );
487 }
488 // add the first cofactor
489 Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
490
491 // save the output
492 pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
493
494 // create the miter of the two outputs
495 Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pOutput1 );
496
497 // make sure that everything is okay
498 if ( !Abc_NtkCheck( pNtkMiter ) )
499 {
500 printf( "Abc_NtkMiterCofactor: The network check has failed.\n" );
501 Abc_NtkDelete( pNtkMiter );
502 return NULL;
503 }
504 return pNtkMiter;
505}
void Abc_NtkMiterAddCone(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkMiter, Abc_Obj_t *pRoot)
Definition abcMiter.c:254
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterForCofactors()

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 517 of file abcMiter.c.

518{
519 char Buffer[1000];
520 Abc_Ntk_t * pNtkMiter;
521 Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
522
523 assert( Abc_NtkIsStrash(pNtk) );
524 assert( Out < Abc_NtkCoNum(pNtk) );
525 assert( In1 < Abc_NtkCiNum(pNtk) );
526 assert( In2 < Abc_NtkCiNum(pNtk) );
527 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
528
529 // start the new network
530 pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
531 sprintf( Buffer, "%s_miter", Abc_ObjName(Abc_NtkCo(pNtk, Out)) );
532 pNtkMiter->pName = Extra_UtilStrsav(Buffer);
533
534 // get the root output
535 pRoot = Abc_NtkCo( pNtk, Out );
536
537 // perform strashing
538 Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
539 // set the first cofactor
540 Abc_NtkCi(pNtk, In1)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
541 if ( In2 >= 0 )
542 Abc_NtkCi(pNtk, In2)->pCopy = Abc_AigConst1(pNtkMiter);
543 // add the first cofactor
544 Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
545
546 // save the output
547 pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
548
549 // set the second cofactor
550 Abc_NtkCi(pNtk, In1)->pCopy = Abc_AigConst1(pNtkMiter);
551 if ( In2 >= 0 )
552 Abc_NtkCi(pNtk, In2)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
553 // add the second cofactor
554 Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
555
556 // save the output
557 pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
558
559 // create the miter of the two outputs
560 pMiter = Abc_AigXor( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
561 Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
562
563 // make sure that everything is okay
564 if ( !Abc_NtkCheck( pNtkMiter ) )
565 {
566 printf( "Abc_NtkMiter: The network check has failed.\n" );
567 Abc_NtkDelete( pNtkMiter );
568 return NULL;
569 }
570 return pNtkMiter;
571}
Here is the call graph for this function:

◆ Abc_NtkMiterIsConstant()

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 682 of file abcMiter.c.

683{
684 Abc_Obj_t * pNodePo, * pChild;
685 int i;
686 assert( Abc_NtkIsStrash(pMiter) );
687 Abc_NtkForEachPo( pMiter, pNodePo, i )
688 {
689 pChild = Abc_ObjChild0( pNodePo );
690 // check if the output is constant 1
691 if ( Abc_AigNodeIsConst(pChild) )
692 {
693 assert( Abc_ObjRegular(pChild) == Abc_AigConst1(pMiter) );
694 if ( !Abc_ObjIsComplement(pChild) )
695 {
696 // if the miter is constant 1, return immediately
697// printf( "MITER IS CONSTANT 1!\n" );
698 return 0;
699 }
700 }
701/*
702 // check if the output is not constant 0
703 else if ( Abc_ObjRegular(pChild)->fPhase != (unsigned)Abc_ObjIsComplement(pChild) )
704 {
705 return 0;
706 }
707*/
708 // if the miter is undecided (or satisfiable), return immediately
709 else
710 return -1;
711 }
712 // return 1, meaning all outputs are constant zero
713 return 1;
714}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterQuantify()

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 585 of file abcMiter.c.

586{
587 Abc_Ntk_t * pNtkMiter;
588 Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
589
590 assert( Abc_NtkIsStrash(pNtk) );
591 assert( 1 == Abc_NtkCoNum(pNtk) );
592 assert( In < Abc_NtkCiNum(pNtk) );
593 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
594
595 // start the new network
596 pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
597 pNtkMiter->pName = Extra_UtilStrsav( Abc_ObjName(Abc_NtkCo(pNtk, 0)) );
598
599 // get the root output
600 pRoot = Abc_NtkCo( pNtk, 0 );
601
602 // perform strashing
603 Abc_NtkMiterPrepare( pNtk, pNtk, pNtkMiter, 1, -1, 0 );
604 // set the first cofactor
605 Abc_NtkCi(pNtk, In)->pCopy = Abc_ObjNot( Abc_AigConst1(pNtkMiter) );
606 // add the first cofactor
607 Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
608 // save the output
609// pOutput1 = Abc_ObjFanin0(pRoot)->pCopy;
610 pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
611
612 // set the second cofactor
613 Abc_NtkCi(pNtk, In)->pCopy = Abc_AigConst1(pNtkMiter);
614 // add the second cofactor
615 Abc_NtkMiterAddCone( pNtk, pNtkMiter, pRoot );
616 // save the output
617// pOutput2 = Abc_ObjFanin0(pRoot)->pCopy;
618 pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot)->pCopy, Abc_ObjFaninC0(pRoot) );
619
620 // create the miter of the two outputs
621 if ( fExist )
622 pMiter = Abc_AigOr( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
623 else
624 pMiter = Abc_AigAnd( (Abc_Aig_t *)pNtkMiter->pManFunc, pOutput1, pOutput2 );
625 Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
626
627 // make sure that everything is okay
628 if ( !Abc_NtkCheck( pNtkMiter ) )
629 {
630 printf( "Abc_NtkMiter: The network check has failed.\n" );
631 Abc_NtkDelete( pNtkMiter );
632 return NULL;
633 }
634 return pNtkMiter;
635}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMiterQuantifyPis()

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 648 of file abcMiter.c.

649{
650 Abc_Ntk_t * pNtkTemp;
651 Abc_Obj_t * pObj;
652 int i;
653 assert( Abc_NtkHasOnlyLatchBoxes(pNtk) );
654
655 Abc_NtkForEachPi( pNtk, pObj, i )
656 {
657 if ( Abc_ObjFanoutNum(pObj) == 0 )
658 continue;
659 pNtk = Abc_NtkMiterQuantify( pNtkTemp = pNtk, i, 1 );
660 Abc_NtkDelete( pNtkTemp );
661 }
662
663 return pNtk;
664}
Abc_Ntk_t * Abc_NtkMiterQuantify(Abc_Ntk_t *pNtk, int In, int fExist)
Definition abcMiter.c:585
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
Here is the call graph for this function:

◆ Abc_NtkMiterReport()

void Abc_NtkMiterReport ( Abc_Ntk_t * pMiter)

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

Synopsis [Reports the status of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 727 of file abcMiter.c.

728{
729 Abc_Obj_t * pChild, * pNode;
730 int i;
731 if ( Abc_NtkPoNum(pMiter) == 1 )
732 {
733 pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,0) );
734 if ( Abc_AigNodeIsConst(pChild) )
735 {
736 if ( Abc_ObjIsComplement(pChild) )
737 printf( "Unsatisfiable.\n" );
738 else
739 printf( "Satisfiable. (Constant 1).\n" );
740 }
741 else
742 printf( "Satisfiable.\n" );
743 }
744 else
745 {
746 Abc_NtkForEachPo( pMiter, pNode, i )
747 {
748 pChild = Abc_ObjChild0( Abc_NtkPo(pMiter,i) );
749 printf( "Output #%2d : ", i );
750 if ( Abc_AigNodeIsConst(pChild) )
751 {
752 if ( Abc_ObjIsComplement(pChild) )
753 printf( "Unsatisfiable.\n" );
754 else
755 printf( "Satisfiable. (Constant 1).\n" );
756 }
757 else
758 printf( "Satisfiable.\n" );
759 }
760 }
761}

◆ Abc_NtkReadNodeNames()

Vec_Ptr_t * Abc_NtkReadNodeNames ( Abc_Ntk_t * pNtk,
char * pFileName )

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

Synopsis [Read node names.]

Description []

SideEffects []

SeeAlso []

Definition at line 1261 of file abcMiter.c.

1262{
1263 char Buffer[1000];
1264 Vec_Ptr_t * vNodes = NULL;
1265 FILE * pFile = fopen( pFileName, "rb" );
1266 if ( pFile == NULL )
1267 {
1268 printf( "Cannot open node list \"%s\".\n", pFileName );
1269 return NULL;
1270 }
1271 vNodes = Vec_PtrAlloc( 100 );
1272 while ( fgets(Buffer, 1000, pFile) != NULL )
1273 {
1274 char * pToken = strtok( Buffer, " \n\r\t" );
1275 while ( pToken )
1276 {
1277 Abc_Obj_t * pObj = Abc_NtkFindNode( pNtk, pToken );
1278 if ( pObj == NULL )
1279 {
1280 printf( "Cannot find node \"%s\".\n", pToken );
1281 Vec_PtrFree( vNodes );
1282 fclose( pFile );
1283 return NULL;
1284 }
1285 Vec_PtrPush( vNodes, pObj );
1286 pToken = strtok( NULL, " \n\r\t" );
1287 }
1288 }
1289 fclose( pFile );
1290 return vNodes;
1291}
ABC_DLL Abc_Obj_t * Abc_NtkFindNode(Abc_Ntk_t *pNtk, char *pName)
Definition abcObj.c:464
char * strtok()
Here is the call graph for this function:

◆ Abc_NtkSpecialMiter()

Abc_Ntk_t * Abc_NtkSpecialMiter ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vNodes )

Definition at line 1313 of file abcMiter.c.

1314{
1315 Abc_Ntk_t * pNtkNew;
1316 Abc_Obj_t * pObj, * pFanin, * pObjNew, * pPoNew; char * pName;
1317 Vec_Int_t * vFirsts = Vec_IntAlloc( Vec_PtrSize(vNodes) );
1318 Vec_Ptr_t * vNames = Vec_PtrAlloc( 100 );
1319 Vec_Ptr_t * vFanins = Vec_PtrAlloc( 100 );
1320 Vec_Ptr_t * vDatas = Vec_PtrAlloc( 100 );
1321 Vec_Ptr_t * vDfs = Abc_NtkDfs( pNtk, 1 );
1322 Vec_Ptr_t * vCopies = Vec_PtrStart( Abc_NtkObjNumMax(pNtk) );
1323 int i, k, Index, First, nNewPis = 0;
1324 // count the number of additional inputs
1325 Abc_NtkCleanCopy( pNtk );
1326 Abc_NtkCleanMarkA( pNtk );
1327 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1328 {
1329 char Buffer[1000];
1330 assert( Abc_ObjIsNode(pObj) );
1331 pObj->fMarkA = 1;
1332 Vec_IntPush( vFirsts, nNewPis );
1333 nNewPis += 1 << Abc_ObjFaninNum(pObj);
1334 for ( k = 0; k < (1 << Abc_ObjFaninNum(pObj)); k++ )
1335 {
1336 sprintf( Buffer, "pi_%s_%d", Abc_ObjName(pObj), k );
1337 Vec_PtrPush( vNames, Abc_UtilStrsav(Buffer) );
1338 }
1339 }
1340 // create new network with the additional PIs
1341 pNtkNew = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
1342 pNtkNew->pName = Extra_UtilStrsav( "miter" );
1343 Vec_PtrForEachEntry( char *, vNames, pName, i )
1344 Abc_ObjAssignName( Abc_NtkCreatePi(pNtkNew), pName, NULL );
1345 // duplicate PIs
1346 Abc_NtkForEachCi( pNtk, pObj, i )
1347 pObj->pCopy = Abc_NtkDupObj( pNtkNew, pObj, 1 );
1348 // copy nodes
1349 Vec_PtrForEachEntry( Abc_Obj_t *, vDfs, pObj, i )
1350 {
1351 if ( !pObj->fMarkA )
1352 {
1353 Abc_NtkDupObj( pNtkNew, pObj, 1 );
1354 Abc_ObjForEachFanin( pObj, pFanin, k )
1355 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
1356 Vec_PtrWriteEntry( vCopies, pObj->Id, pObj->pCopy );
1357 continue;
1358 }
1359 Vec_PtrClear( vFanins );
1360 Abc_ObjForEachFanin( pObj, pFanin, k )
1361 Vec_PtrPush( vFanins, pFanin->pCopy );
1362 Index = Vec_PtrFind( vNodes, pObj );
1363 assert( Index >= 0 );
1364 First = Vec_IntEntry( vFirsts, Index );
1365 Vec_PtrClear( vDatas );
1366 for ( k = 0; k < (1 << Abc_ObjFaninNum(pObj)); k++ )
1367 Vec_PtrPush( vDatas, Abc_NtkCi(pNtkNew, First + k) );
1368 pObj->pCopy = Abc_NtkSpecialMuxTree_rec( pNtkNew,
1369 (Abc_Obj_t **)Vec_PtrArray(vFanins), Vec_PtrSize(vFanins),
1370 (Abc_Obj_t **)Vec_PtrArray(vDatas), 0 );
1371 Vec_PtrWriteEntry( vCopies, pObj->Id, pObj->pCopy );
1372 }
1373 Vec_PtrForEachEntry( Abc_Obj_t *, vDfs, pObj, i )
1374 {
1375 pObj->fMarkA = 0;
1376 Abc_NtkDupObj( pNtkNew, pObj, 0 );
1377 Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), "_copy" );
1378 Abc_ObjForEachFanin( pObj, pFanin, k )
1379 Abc_ObjAddFanin( pObj->pCopy, pFanin->pCopy );
1380 }
1381 // create miter
1382 Vec_PtrClear( vDatas );
1383 Abc_NtkForEachCo( pNtk, pObj, i )
1384 {
1385 Vec_PtrClear( vFanins );
1386 Vec_PtrPush( vFanins, Abc_ObjFanin0(pObj)->pCopy );
1387 Vec_PtrPush( vFanins, (Abc_Obj_t *)Vec_PtrEntry(vCopies, Abc_ObjId(Abc_ObjFanin0(pObj))) );
1388 Vec_PtrPush( vDatas, Abc_NtkCreateNodeExor(pNtkNew, vFanins) );
1389 }
1390 if ( Vec_PtrSize(vDatas) > 1 )
1391 pObjNew = Abc_NtkCreateNodeOr( pNtkNew, vDatas );
1392 else
1393 pObjNew = (Abc_Obj_t *)Vec_PtrEntry(vDatas, 0);
1394 Abc_ObjAddFanin( (pPoNew = Abc_NtkCreatePo(pNtkNew)), pObjNew );
1395 Abc_ObjAssignName( pPoNew, "miter_output", NULL );
1396 // cleanup
1397 Vec_IntFree( vFirsts );
1398 Vec_PtrFreeFree( vNames );
1399 Vec_PtrFree( vFanins );
1400 Vec_PtrFree( vDatas );
1401 Vec_PtrFree( vDfs );
1402 Vec_PtrFree( vCopies );
1403 return pNtkNew;
1404}
Abc_Obj_t * Abc_NtkSpecialMuxTree_rec(Abc_Ntk_t *pNew, Abc_Obj_t **pCtrl, int nCtrl, Abc_Obj_t **pData, int Shift)
Definition abcMiter.c:1304
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
Definition abcUtil.c:696
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeOr(Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
Definition abcObj.c:770
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeExor(Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
Definition abcObj.c:802
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Abc_NtkType_t ntkType
Definition abc.h:156
Abc_NtkFunc_t ntkFunc
Definition abc.h:157
int Id
Definition abc.h:132
Here is the call graph for this function:

◆ Abc_NtkSpecialMuxTree_rec()

Abc_Obj_t * Abc_NtkSpecialMuxTree_rec ( Abc_Ntk_t * pNew,
Abc_Obj_t ** pCtrl,
int nCtrl,
Abc_Obj_t ** pData,
int Shift )

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

Synopsis [Deriving specialized miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 1304 of file abcMiter.c.

1305{
1306 Abc_Obj_t * pLit0, * pLit1;
1307 if ( nCtrl == 0 )
1308 return pData[Shift];
1309 pLit0 = Abc_NtkSpecialMuxTree_rec( pNew, pCtrl, nCtrl-1, pData, Shift );
1310 pLit1 = Abc_NtkSpecialMuxTree_rec( pNew, pCtrl, nCtrl-1, pData, Shift + (1<<(nCtrl-1)) );
1311 return Abc_NtkCreateNodeMux( pNew, pCtrl[nCtrl-1], pLit1, pLit0 );
1312}
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeMux(Abc_Ntk_t *pNtk, Abc_Obj_t *pNodeC, Abc_Obj_t *pNode1, Abc_Obj_t *pNode0)
Definition abcObj.c:834
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkTryNewMiter()

Vec_Ptr_t * Abc_NtkTryNewMiter ( char * pFileName0,
char * pFileName1 )

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

Synopsis [Miter construction for two networks.]

Description []

SideEffects []

SeeAlso []

Definition at line 1205 of file abcMiter.c.

1206{
1207 extern void * Cnf_DataWriteIntoSolver2( Cnf_Dat_t * p, int nFrames, int fInit );
1208 int i, nVars, * pVars, iCiVarBeg, iCoVarBeg = 1, nBTLimit = 100000;
1209 sat_solver * pSat = NULL;
1210 Cnf_Dat_t * pCnf = NULL;
1211 Vec_Ptr_t * vCexes = NULL;
1212 Abc_Ntk_t * pNtk1 = Io_Read( pFileName0, IO_FILE_VERILOG, 1, 0 );
1213 Abc_Ntk_t * pNtk2 = Io_Read( pFileName1, IO_FILE_VERILOG, 1, 0 );
1214 Abc_Ntk_t * pNtk1_ = Abc_NtkStrash( pNtk1, 1, 1, 0 );
1215 Abc_Ntk_t * pNtk2_ = Abc_NtkStrash( pNtk2, 1, 1, 0 );
1216 Abc_Ntk_t * pMiter = Abc_NtkMiter( pNtk1_, pNtk2_, 1, 0, 0, 1 );
1217 Gia_Man_t * pGia = Abc_NtkClpGia( pMiter );
1218 assert( Abc_NtkCiNum(pNtk1) == Abc_NtkCiNum(pNtk2) );
1219 assert( Abc_NtkCoNum(pNtk1) == Abc_NtkCoNum(pNtk2) );
1220 Abc_NtkDelete( pNtk1 );
1221 Abc_NtkDelete( pNtk2 );
1222 Abc_NtkDelete( pNtk1_ );
1223 Abc_NtkDelete( pNtk2_ );
1224 Abc_NtkDelete( pMiter );
1225 vCexes = Vec_PtrStart( Gia_ManPoNum(pGia) );
1226 pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( pGia, 8, 0, 0, 0, 0 );
1227 nVars = Gia_ManPiNum(pGia);
1228 iCiVarBeg = pCnf->nVars - nVars;
1229 pVars = ABC_ALLOC( int, nVars );
1230 for ( i = 0; i < nVars; i++ )
1231 pVars[i] = iCiVarBeg + i;
1232 pSat = (sat_solver *)Cnf_DataWriteIntoSolver(pCnf, 1, 0);
1233 Cnf_DataFree( pCnf );
1234 for ( i = 0; i < Gia_ManPoNum(pGia); i++ )
1235 {
1236 int Lit = Abc_Var2Lit( iCoVarBeg + i, 0 );
1237 int status = sat_solver_solve( pSat, &Lit, &Lit + 1, nBTLimit, 0, 0, 0 );
1238 assert( status != l_Undef );
1239 if ( status == l_False )
1240 continue;
1241 Vec_PtrWriteEntry( vCexes, i, Sat_SolverGetModel(pSat, pVars, nVars) );
1242 printf( "Output %3d (out of %3d) is SAT.\n", i, Gia_ManPoNum(pGia) );
1243 }
1244 Gia_ManStop( pGia );
1245 sat_solver_delete( pSat );
1246 ABC_FREE( pVars );
1247 return vCexes;
1248}
Abc_Ntk_t * Abc_NtkMiter(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int fComb, int nPartSize, int fImplic, int fMulti)
FUNCTION DEFINITIONS ///.
Definition abcMiter.c:59
ABC_DLL Gia_Man_t * Abc_NtkClpGia(Abc_Ntk_t *pNtk)
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define sat_solver
Definition cecSatG2.c:34
#define sat_solver_solve
Definition cecSatG2.c:45
void * Cnf_DataWriteIntoSolver2(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:595
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
Cube * p
Definition exorList.c:222
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
Definition giaMf.c:1877
@ IO_FILE_VERILOG
Definition ioAbc.h:67
Abc_Ntk_t * Io_Read(char *pFileName, Io_FileType_t FileType, int fCheck, int fBarBufs)
Definition ioUtil.c:241
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition cnfMan.c:579
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
int * Sat_SolverGetModel(sat_solver *p, int *pVars, int nVars)
Definition satUtil.c:270
int nVars
Definition cnf.h:59
Here is the call graph for this function: