45 for (
const auto& it: subcir.forbidden_pairs) {
46 const auto& inputs = it.second;
47 inputs_in_forbidden_pairs.insert(inputs.begin(), inputs.end());
51 Vec_Int_t* RelationGeneratorABC::getRelationImpl() {
53 int nTimeOut = 600, nConfLimit = 1000000;
54 int i, iNode, iSatVar, Iter, Mask, nSolutions = 0, RetValue = 0;
60 int iLit = Abc_Var2Lit( 1, 0 );
62 Vec_Int_t * vSatVars = Vec_IntAlloc( Vec_IntSize(subcir.io) );
64 Vec_IntPush( vSatVars, i < subcir.nof_inputs ? 2+i : pCnf->nVars-Vec_IntSize(subcir.io)+i );
67 for ( Iter = 0; Iter < 1000000; Iter++ )
69 int status =
sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
70 if ( status ==
l_False ) { RetValue = 1;
break; }
71 if ( status ==
l_Undef ) { RetValue = 0;
break; }
75 Vec_IntClear( vLits );
77 Vec_IntPush( vLits, Abc_Var2Lit(iSatVar, sat_solver_var_value(pSat, iSatVar)) );
78 if ( sat_solver_var_value(pSat, iSatVar) )
79 Mask |= 1 << (Vec_IntSize(subcir.io)-1-i);
81 Vec_IntPush( vRes, Mask );
82 if ( !
sat_solver_addclause( pSat, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits) ) )
83 { RetValue = 1;
break; }
84 if ( nTimeOut && (Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = 0;
break; }
87 Vec_Int_t * vBits = Vec_IntStart( 1 << Vec_IntSize(subcir.io) );
89 Vec_IntWriteEntry( vBits, Mask, 1 );
93 Vec_IntPush( vRes, i );
97 Vec_IntFree( vSatVars );
102 Vec_IntFreeP( &vRes );
106 Gia_Man_t * RelationGeneratorABC::generateMiter() {
108 int nIns = subcir.nof_inputs;
112 Vec_Int_t * vInLits = Vec_IntAlloc( nIns );
113 Vec_Int_t * vOutLits = Vec_IntAlloc( Vec_IntSize(vInsOuts) - nIns );
120 if ( Gia_ObjIsCi(pObj) )
121 pObj->
Value = Gia_ManAppendCi(pNew);
122 for ( i = 0; i < Vec_IntSize(vInsOuts)-nIns; i++ )
123 Vec_IntPush( vInLits, Gia_ManAppendCi(pNew) );
125 if ( Gia_ObjIsAnd(pObj) )
128 if ( Gia_ObjIsCo(pObj) )
129 pObj->
Value = Gia_ObjFanin0Copy(pObj);
132 Vec_IntPush( vOutLits, pObj->
Value );
134 pObj->
Value = Vec_IntEntry( vInLits, i-nIns );
138 Gia_ObjSetTravIdCurrent(pGia, pObj);
143 if ( Gia_ObjIsAnd(pObj) && !Gia_ObjIsTravIdCurrent(pGia, pObj) )
146 if ( Gia_ObjIsCo(pObj) )
151 for (
int inp : inputs_in_forbidden_pairs) {
152 int node_id = Vec_IntEntry(vInsOuts, inp);
153 pObj = Gia_ManObj(pGia, node_id);
154 Vec_IntWriteEntry(vOutLits, inp, pObj->
Value);
157 Gia_ManAppendCo( pNew, iLit );
159 Gia_ManAppendCo( pNew, iLit );
162 Vec_IntFree( vInLits );
163 Vec_IntFree( vOutLits );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define sat_solver_addclause
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
void Gia_ManStop(Gia_Man_t *p)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
void Gia_ManHashAlloc(Gia_Man_t *p)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
void Gia_ManIncrementTravId(Gia_Man_t *p)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Vec_Int_t * Gia_ManCollectNodeTfos(Gia_Man_t *p, int *pNodes, int nNodes)
Vec_Int_t * Gia_ManCollectNodeTfis(Gia_Man_t *p, Vec_Int_t *vNodes)
ABC_NAMESPACE_HEADER_START void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
void sat_solver_delete(sat_solver *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.