51 if ( Wlc_ObjCopy(
p, iObj) )
53 pObj = Wlc_NtkObj(
p, iObj );
63 int DataW = Wlc_ObjRange(pData);
64 int AddrW = Wlc_ObjRange(pAddr);
65 int nRegs = 1 << AddrW, iObjNew, iObjDec;
66 assert( nRegs * DataW == Wlc_ObjRange(pMem) );
67 assert( Wlc_ObjRange(pObj) == Wlc_ObjRange(pMem) );
70 Vec_IntFill( vTemp, 1, Wlc_ObjCopy(
p, Wlc_ObjId(
p, pAddr)) );
73 for ( i = 0; i < nRegs; i++ )
76 Vec_IntFill( vTemp, 1, iObjDec );
77 Vec_IntPushTwo( vTemp, i, i );
79 Vec_IntPush( vBits, iObj2 );
82 Vec_IntClear( vFanins );
83 for ( i = 0; i < nRegs; i++ )
86 Vec_IntFill( vTemp, 1, Wlc_ObjCopy(
p, Wlc_ObjId(
p, pMem)) );
87 Vec_IntPushTwo( vTemp, i*DataW+DataW-1, i*DataW );
89 Vec_IntPush( vFanins, iObj2 );
92 for ( i = 0; i < nRegs; i++ )
95 Vec_IntFill( vTemp, 1, Vec_IntEntry(vBits, i) );
96 Vec_IntPushTwo( vTemp, Wlc_ObjCopy(
p, Wlc_ObjId(
p, pData)), Vec_IntEntry(vFanins, i) );
98 Vec_IntWriteEntry( vFanins, i, iObj2 );
103 Wlc_ObjSetCopy(
p, iObj, iObjNew );
104 Vec_IntFree( vTemp );
105 Vec_IntFree( vBits );
112 int DataW = Wlc_ObjRange(pObj);
113 int AddrW = Wlc_ObjRange(pAddr);
114 int nRegs = 1 << AddrW, iObjNew;
115 assert( nRegs * DataW == Wlc_ObjRange(pMem) );
116 Vec_IntClear( vFanins );
117 Vec_IntPush( vFanins, Wlc_ObjCopy(
p, Wlc_ObjId(
p, pAddr)) );
118 for ( i = 0; i < nRegs; i++ )
121 Vec_IntFill( vTemp, 1, Wlc_ObjCopy(
p, Wlc_ObjId(
p, pMem)) );
122 Vec_IntPushTwo( vTemp, i*DataW+DataW-1, i*DataW );
124 Vec_IntPush( vFanins, iObj2 );
128 Wlc_ObjSetCopy(
p, iObj, iObjNew );
129 Vec_IntFree( vTemp );
140 Wlc_NtkCleanCopy(
p );
141 vFanins = Vec_IntAlloc( 100 );
154 pNew->
vInits = Vec_IntDup(
p->vInits );
156 pNew->
pInits = Abc_UtilStrsav(
p->pInits );
157 Vec_IntFree( vFanins );
159 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
178 Vec_Int_t * vMemSizes = Vec_IntAlloc( 10 );
183 pObj = Wlc_ObjFanin(
p, pObj, 0 );
184 Vec_IntPushUnique( vMemSizes, Wlc_ObjRange(pObj) );
192 if ( Wlc_ObjType(pObj) == 0 )
194 if ( Wlc_ObjIsPi(pObj) )
195 return Vec_IntEntry(&
p->vRefs, Wlc_ObjId(
p, pObj)) == 0;
196 else if ( Wlc_ObjIsCi(pObj) )
206 Vec_Int_t * vMemObjs = Vec_IntAlloc( 10 );
212 Vec_IntPush( vMemObjs, Wlc_ObjId(
p, pObj) );
220 Vec_Int_t * vMemObjs = Vec_IntAlloc( 10 );
224 Vec_IntPush( vMemObjs, i );
225 else if ( Vec_IntFind(vMemSizes, Wlc_ObjRange(pObj)) >= 0 )
226 Vec_IntPush( vMemObjs, i );
228 Vec_IntFree( vMemSizes );
229 Vec_IntSort( vMemObjs, 0 );
235 Vec_IntFree( vTemp );
243 printf(
"Memory subsystem is composed of the following objects:\n" );
245 Vec_IntFree( vMemory );
262 Vec_Int_t * vMemFanins = Vec_IntAlloc( 100 );
266 Vec_IntPush( vMemFanins, Wlc_ObjFaninId0(pObj) );
271 Vec_IntPush( vMemFanins, iFanin );
291 for ( ; *pInit; pInit++ )
292 Count += (*pInit ==
'x' || *pInit ==
'X');
297 int iObj = Wlc_ObjId(
p, pObj);
298 unsigned Type = pObj->
Type;
299 int iObjNew, nFanins = Wlc_ObjFaninNum(pObj);
300 int iObjCopy = Wlc_ObjCopy(
p, iObj);
301 pObj->
Type = TypeNew;
305 pObj->
nFanins = (unsigned)nFanins;
308 Vec_IntPush( pNew->
vInits, -Wlc_ObjRange(pObj) );
309 Wlc_ObjSetCopy(
p, iObj, iObjCopy );
316 Wlc_Obj_t * pObjNew = Wlc_NtkObj( pNew, iObj );
317 Vec_IntFill( vFanins, 1, iFanin );
326 Vec_IntPushUnique( vNodeFrames, Entry );
327 Vec_IntSort( vNodeFrames, 0 );
331 Vec_Int_t * vNewObjs = Vec_IntAlloc( 2*Vec_IntSize(vNodeFrames) );
333 int i, Entry, iObj, iFrame;
337 iFrame = (Entry >> 1) & 0x3FF;
338 pObj = Wlc_NtkObj(
p, iObj );
341 pFanin = Wlc_ObjFanin0(
p, pObj);
343 pFanin = Wlc_ObjFanin1(
p, pObj);
352 pFanin = Wlc_ObjFanin2(
p, pObj);
356 assert( Vec_IntSize(vNewObjs) == 2 * Vec_IntSize(vNodeFrames) );
361 Wlc_Obj_t * pObj, * pFanin, * pFlop, * pCond, * pMux, * pConst;
362 int i, n, Entry, Value, iObj, iFrame;
367 iFrame = (Entry >> 1) & 0x3FF;
368 pObj = Wlc_NtkObj(
p, iObj );
369 for ( n = 0; n < 2; n++ )
371 pFlop = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*i+n) );
373 pFanin = Wlc_ObjCopyObj( pNew,
p, n ? Wlc_ObjFanin2(
p, pObj) : Wlc_ObjFanin1(
p, pObj) );
375 pFanin = n ? Wlc_NtkObj(pNew, Wlc_ObjCopy(
p, iObj)) : Wlc_ObjCopyObj( pNew,
p, Wlc_ObjFanin1(
p, pObj) );
379 pFanin = Wlc_ObjCopyObj( pNew,
p, Wlc_ObjFanin0(
p, pObj) );
382 Vec_IntFill( vFanins, 1, Wlc_ObjId(pNew, pFanin) );
388 assert( Wlc_ObjRange(pFlop) == Wlc_ObjRange(pFanin) );
391 Vec_IntFill( vFanins, 1, iFrame );
395 Vec_IntFillTwo( vFanins, 2, Wlc_ObjId(pNew, pConst), Wlc_ObjId(pNew, pCounter) );
399 Vec_IntClear( vFanins );
400 Vec_IntPush( vFanins, Wlc_ObjId(pNew, pCond) );
401 Vec_IntPush( vFanins, Wlc_ObjId(pNew, pFlop) );
402 Vec_IntPush( vFanins, Wlc_ObjId(pNew, pFanin) );
411 Vec_Int_t * vBitConstr = Vec_IntAlloc( 100 );
412 Vec_Int_t * vLevConstr = Vec_IntAlloc( 100 );
413 Wlc_Obj_t * pAddrs[2], * pDatas[2], * pCond, * pConstr = NULL;
414 int i, k, Entry, Index[2], iFrameLast, iFrameThis;
415 assert( Vec_IntSize(vNewObjs) == 2 * Vec_IntSize(vNodeFrames) );
418 if ( Vec_IntSize(vTrace) == 0 )
420 assert( Vec_IntSize(vTrace) >= 2 );
421 Vec_IntClear( vLevConstr );
423 iFrameThis = (Vec_IntEntry(vTrace, 0) >> 1) & 0x3FF;
424 iFrameLast = (Vec_IntEntryLast(vTrace) >> 1) & 0x3FF;
426 Index[0] = Vec_IntFind( vNodeFrames, Vec_IntEntry(vTrace, 0) );
427 Index[1] = Vec_IntFind( vNodeFrames, Vec_IntEntryLast(vTrace) );
428 assert( Index[0] >= 0 && Index[1] >= 0 );
430 pAddrs[0] = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*Index[0]) );
431 pAddrs[1] = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*Index[1]) );
433 pDatas[0] = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*Index[0]+1) );
434 pDatas[1] = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*Index[1]+1) );
437 if ( iFrameThis == iFrameLast )
439 pAddrs[0] = Wlc_ObjFo2Fi(pNew, pAddrs[0]);
440 pDatas[0] = Wlc_ObjFo2Fi(pNew, pDatas[0]);
444 pAddrs[1] = Wlc_ObjFo2Fi(pNew, pAddrs[1]);
445 pDatas[1] = Wlc_ObjFo2Fi(pNew, pDatas[1]);
449 Vec_IntFillTwo( vFanins, 2, Wlc_ObjId(pNew, pAddrs[0]), Wlc_ObjId(pNew, pAddrs[1]) );
451 Vec_IntPush( vLevConstr, Wlc_ObjId(pNew, pCond) );
455 Vec_IntFillTwo( vFanins, 2, Wlc_ObjId(pNew, pDatas[0]), Wlc_ObjId(pNew, pDatas[1]) );
457 Vec_IntPush( vLevConstr, Wlc_ObjId(pNew, pCond) );
461 iFrameThis = (Entry >> 1) & 0x3FF;
462 Index[0] = Vec_IntFind( vNodeFrames, Entry );
464 pAddrs[0] = Wlc_NtkObj( pNew, Vec_IntEntry(vNewObjs, 2*Index[0]) );
466 if ( iFrameThis == iFrameLast )
467 pAddrs[0] = Wlc_ObjFo2Fi(pNew, pAddrs[0]);
468 if ( Vec_IntEntry(vNewObjs, 2*Index[0]+1) == 0 )
471 Vec_IntPush( vLevConstr, Wlc_ObjId(pNew, pAddrs[0]) );
475 assert( Wlc_ObjRange(pAddrs[0]) == Wlc_ObjRange(pAddrs[1]) );
477 Vec_IntFillTwo( vFanins, 2, Wlc_ObjId(pNew, pAddrs[0]), Wlc_ObjId(pNew, pAddrs[1]) );
479 Vec_IntPush( vLevConstr, Wlc_ObjId(pNew, pCond) );
486 Vec_IntFill( vFanins, 1, Wlc_ObjId(pNew, pConstr) );
491 Vec_IntPush( vBitConstr, Wlc_ObjId(pNew, pConstr) );
493 if ( Vec_IntSize(vBitConstr) > 0 )
499 Vec_IntFill( vFanins, 1, Wlc_ObjId(pNew, pConstr) );
506 Vec_IntFill( vFanins, 1, 0 );
510 Vec_IntFree( vBitConstr );
511 Vec_IntFree( vLevConstr );
513 Vec_IntFill( vFanins, 1, Wlc_ObjId(pNew, pConstr) );
519 Wlc_Obj_t * pObj, * pCounter, * pConst, * pAdder, * pConstr = NULL;
521 Vec_Int_t * vFanins = Vec_IntAlloc( 100 );
522 int i, Po0, Po1, AdderBits = 16, nBits = 0;
530 Wlc_NtkCleanCopy(
p );
536 pNew->
vInits = Vec_IntAlloc( 100 );
543 nBits += Wlc_ObjRange(pObj);
547 *piFirstMemPi = nBits;
552 nBits += Wlc_ObjRange(pObj);
558 if ( !Wlc_ObjIsPi(pObj) && !pObj->
Mark )
561 Vec_IntPush( pNew->
vInits, Vec_IntEntry(
p->vInits, i-Wlc_NtkPiNum(
p)) );
562 nBits += Wlc_ObjRange(pObj);
567 Vec_IntPush( pNew->
vInits, -AdderBits );
571 *piFirstMemCi = nBits;
582 if ( !Wlc_ObjIsCi(pObj) && !pObj->
Mark )
585 if ( Vec_IntSize(&
p->vPoPairs) )
590 int iCopy0 = Wlc_ObjCopy(
p, Wlc_ObjId(
p, Wlc_NtkPo(
p, Po0)));
591 int iCopy1 = Wlc_ObjCopy(
p, Wlc_ObjId(
p, Wlc_NtkPo(
p, Po1)));
593 Wlc_Obj_t * pObjNew = Wlc_NtkObj( pNew, iObj );
594 Vec_IntFillTwo( vFanins, 1, iCopy0, iCopy1 );
598 printf(
"Memory abstraction created %d miter outputs.\n", Wlc_NtkPoNum(pNew) );
618 if ( !Wlc_ObjIsPo(pObj) && !pObj->
Mark )
624 Vec_IntFill( vFanins, 1, 1 );
628 Vec_IntFillTwo( vFanins, 2, Wlc_ObjId(pNew, pCounter), Wlc_ObjId(pNew, pConst) );
648 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
650 Vec_IntFree( vFanins );
651 Vec_IntFreeP( &vNewObjs );
672 Vec_Int_t * vFirstTotal = Vec_IntStart( 3 * Vec_IntSize(vMemObjs) );
673 Wlc_Obj_t * pObj, * pFanin;
int i, k, iFanin, nMemFanins = 0;
679 pFanin = Wlc_ObjFanin0(
p, pObj);
680 assert( Wlc_ObjRange(pFanin) == 1 );
681 Vec_IntWriteEntry( vFirstTotal, 3*i, (iFirstMemCi << 10) | Wlc_ObjRange(pFanin) );
682 iFirstMemCi += Wlc_ObjRange(pFanin);
691 pFanin = Wlc_NtkObj(
p, iFanin);
692 Vec_IntWriteEntry( vFirstTotal, 3*i + k, (iFirstMemCi << 10) | Wlc_ObjRange(pFanin) );
693 iFirstMemCi += Wlc_ObjRange(pFanin);
698 Vec_IntWriteEntry( vFirstTotal, 3*i + 2, (iFirstMemPi << 10) | Wlc_ObjRange(pObj) );
699 iFirstMemPi += Wlc_ObjRange(pObj);
703 assert( nMemFanins == Vec_IntSize(vMemFanins) );
707 printf(
"Obj %5d Fanin %5d : ", i/3, i%3 );
708 printf(
"%16s : %d(%d)\n",
Wlc_ObjName(
p, Vec_IntEntry(vMemObjs, i/3)), iFanin >> 10, iFanin & 0x3FF );
715 int k, b, Entry, First, nBits;
word Value;
719 pObj->
fMark0 = Abc_InfoHasBit(
p->pData, iBit++);
722 pObj->
fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
723 (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
726 pObj->
fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
736 Vec_WrdWriteEntry( vRes, Vec_IntSize(vFirstTotal)*iFrame + k, ~(
word)0 );
740 assert( First < Gia_ManCiNum(pAbs) );
741 nBits = Entry & 0x3FF;
744 for ( b = 0; b < nBits; b++ )
745 if ( Gia_ManCi(pAbs, First+b)->fMark0 )
746 Value |= ((
word)1) << b;
747 Vec_WrdWriteEntry( vRes, Vec_IntSize(vFirstTotal)*iFrame + k, Value );
753 Vec_Wrd_t * vValues = Vec_WrdStartFull( Vec_IntSize(vFirstTotal) * (pCex->iFrame + 1) );
754 int k, f, nBits = pCex->nRegs;
word Value;
756 for ( f = 0; f <= pCex->iFrame; f++ )
761 if ( k % Vec_IntSize(vFirstTotal) == 0 )
762 printf(
"Frame %d:\n", k/Vec_IntSize(vFirstTotal) );
763 printf(
"Obj %5d Fanin %5d : ", k/3, k%3 );
783 int iObj = Wlc_ObjId(
p, pObj);
784 int iNum = Wlc_ObjCopy(
p, iObj );
785 assert( iObj == Vec_IntEntry(vMemObjs, iNum) );
787 if ( Wlc_ObjIsPi(pObj) )
788 Vec_IntPush( vRes, (iObj << 11) | (iFrame << 1) );
789 else if ( Wlc_ObjIsCi(pObj) && iFrame == 0 )
791 int PiId = Vec_IntEntry(
p->vInits, Wlc_ObjCiId(pObj)-Wlc_NtkPiNum(
p) );
792 int iPiObj = Wlc_ObjId(
p, Wlc_NtkPi(
p, PiId) );
793 Vec_IntPush( vRes, (iPiObj << 11) | (iFrame << 1) );
795 else if ( Wlc_ObjIsCi(pObj) )
796 Wlc_NtkTrace_rec(
p, Wlc_ObjFo2Fi(
p, pObj), iFrame - 1, vMemObjs, vValues, ValueA, vRes );
798 Wlc_NtkTrace_rec(
p, Wlc_ObjFanin0(
p, pObj), iFrame, vMemObjs, vValues, ValueA, vRes );
801 int Index = 3*(iFrame*Vec_IntSize(vMemObjs) + iNum);
802 int Value = (int)Vec_WrdEntry( vValues, Index );
803 assert( Value == 0 || Value == 1 );
804 Wlc_NtkTrace_rec(
p, Value ? Wlc_ObjFanin2(
p, pObj) : Wlc_ObjFanin1(
p, pObj), iFrame, vMemObjs, vValues, ValueA, vRes );
805 Vec_IntPush( vRes, (iObj << 11) | (iFrame << 1) | Value );
809 int Index = 3*(iFrame*Vec_IntSize(vMemObjs) + iNum);
810 if ( Vec_WrdEntry(vValues, Index + 1) != ValueA )
811 Wlc_NtkTrace_rec(
p, Wlc_ObjFanin0(
p, pObj), iFrame, vMemObjs, vValues, ValueA, vRes );
812 Vec_IntPush( vRes, (iObj << 11) | (iFrame << 1) );
818 int iObj = Wlc_ObjId(
p, pObj );
819 int iNum = Wlc_ObjCopy(
p, iObj );
822 assert( iObj == Vec_IntEntry(vMemObjs, iNum) );
823 Wlc_NtkTrace_rec(
p, Wlc_ObjFanin0(
p, pObj), iFrame, vMemObjs, vValues, Vec_WrdEntry(vValues, 3*(iFrame*Vec_IntSize(vMemObjs) + iNum) + 1), vTrace );
824 Vec_IntPush( vTrace, (iObj << 11) | (iFrame << 1) );
830 int iObjLast = Vec_IntEntryLast(vTrace) >> 11;
831 int iFrmLast =(Vec_IntEntryLast(vTrace) >> 1) & 0x3FF;
832 int iNumLast = Wlc_ObjCopy(
p, iObjLast );
833 int iIndLast = 3*(iFrmLast*Vec_IntSize(vMemObjs) + iNumLast);
834 int iObjFirst = Vec_IntEntry(vTrace, 0) >> 11;
835 int iFrmFirst =(Vec_IntEntry(vTrace, 0) >> 1) & 0x3FF;
836 int iNumFirst = Wlc_ObjCopy(
p, iObjFirst );
837 int iIndFirst = 3*(iFrmFirst*Vec_IntSize(vMemObjs) + iNumFirst);
838 assert( Vec_IntSize(vTrace) >= 2 );
839 assert( iObjLast == Vec_IntEntry(vMemObjs, iNumLast) );
840 assert( iObjFirst == Vec_IntEntry(vMemObjs, iNumFirst) );
841 pObjLast = Wlc_NtkObj(
p, iObjLast);
842 pObjFirst = Wlc_NtkObj(
p, iObjFirst);
845 if ( Wlc_ObjIsPi(pObjFirst) )
847 assert( Vec_WrdEntry(vValues, iIndLast + 1) == Vec_WrdEntry(vValues, iIndFirst + 1) );
848 return Vec_WrdEntry(vValues, iIndLast + 2) != Vec_WrdEntry(vValues, iIndFirst + 2);
853 Vec_Wec_t * vTraces = Vec_WecAlloc( 100 );
854 Vec_Int_t * vTrace, * vTrace1, * vTrace2;
855 assert( 3 * nFrames * Vec_IntSize(vMemObjs) == Vec_WrdSize(vValues) );
856 Wlc_NtkCleanCopy(
p );
858 Wlc_ObjSetCopy(
p, Entry, i );
859 for ( f = 0; f < nFrames; f++ )
868 Vec_WecFree( vTraces );
871 Vec_WecPushLevel( vTraces );
872 Vec_IntAppend( Vec_WecEntryLast(vTraces), vTrace );
873 Vec_IntFree( vTrace );
879 if ( Vec_IntEntry(vTrace1, 0) == Vec_IntEntry(vTrace2, 0) )
881 int iObj1 = Vec_IntEntryLast(vTrace1) >> 11;
882 int iFrm1 =(Vec_IntEntryLast(vTrace1) >> 1) & 0x3FF;
883 int iNum1 = Wlc_ObjCopy(
p, iObj1 );
884 int iInd1 = 3*(iFrm1*Vec_IntSize(vMemObjs) + iNum1);
886 int iObj2 = Vec_IntEntryLast(vTrace2) >> 11;
887 int iFrm2 =(Vec_IntEntryLast(vTrace2) >> 1) & 0x3FF;
888 int iNum2 = Wlc_ObjCopy(
p, iObj2 );
889 int iInd2 = 3*(iFrm2*Vec_IntSize(vMemObjs) + iNum2);
891 assert( iObj1 == Vec_IntEntry(vMemObjs, iNum1) );
892 assert( iObj2 == Vec_IntEntry(vMemObjs, iNum2) );
893 if ( Vec_WrdEntry(vValues, iInd1 + 1) == Vec_WrdEntry(vValues, iInd2 + 1) &&
894 Vec_WrdEntry(vValues, iInd1 + 2) != Vec_WrdEntry(vValues, iInd2 + 2) )
896 vTrace = Vec_IntAlloc( 100 );
897 Vec_IntPush( vTrace, Vec_IntPop(vTrace1) );
899 Vec_IntPushUnique( vTrace, Entry );
901 Vec_IntPushUnique( vTrace, Entry );
902 Vec_WecFree( vTraces );
906 Vec_WecFree( vTraces );
912 printf(
"Memory semantics failure trace:\n" );
914 printf(
"%3d: entry %9d : obj %5d with name %16s in frame %d\n", i, Entry, Entry >> 11,
Wlc_ObjName(
p, Entry>>11), (Entry >> 1) & 0x3FF );
918 Wlc_Obj_t * pObj;
int i, k, f, nBits = pCex ? pCex->nRegs : 0;
921 printf(
"The CEX is NULL.\n" );
924 for ( f = 0; f <= pCex->iFrame; f++ )
926 printf(
"Frame%02d ", f );
929 printf(
"PI%d:", i );
931 for ( k = 0; k < Wlc_ObjRange(pObj); k++ )
932 printf(
"%d", Abc_InfoHasBit(pCex->pData, nBits++) );
936 for ( k = 0; nBits < pCex->nPis; k++ )
937 printf(
"%d", Abc_InfoHasBit(pCex->pData, nBits++) );
956 int iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits;
961 Vec_Wec_t * vRefines = Vec_WecAlloc( 100 );
962 Vec_Int_t * vNodeFrames = Vec_IntAlloc( 100 );
965 vRefine = Vec_WecPushLevel(vRefines);
966 Vec_IntPush( vRefine, (11 << 11) | 0 );
967 Vec_IntPush( vRefine, (10 << 11) | 0 );
968 Vec_IntPush( vRefine, ( 8 << 11) | 0 );
969 Vec_IntPush( vRefine, ( 9 << 11) | 0 );
973 pNewFull =
Wlc_NtkAbstractMemory(
p, vMemObjs, NULL, &iFirstMemPi, &iFirstCi, &iFirstMemCi, vRefines, vNodeFrames );
975 Vec_WecFree( vRefines );
976 Vec_IntFree( vNodeFrames );
979 printf(
"iFirstMemPi = %d iFirstCi = %d iFirstMemCi = %d nDcBits = %d\n", iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits );
981 Vec_IntFreeP( &vMemObjs );
982 Vec_IntFreeP( &vMemFanins );
992 Vec_Wec_t * vRefines = Vec_WecAlloc( 100 );
993 Vec_Int_t * vNodeFrames = Vec_IntAlloc( 100 );
994 Vec_Int_t * vMemObjs, * vMemFanins, * vFirstTotal, * vRefine;
995 int RetValue = -1, iFirstMemPi, iFirstCi, iFirstMemCi, nDcBits, nIters;
999 pNewFull =
Wlc_NtkAbstractMemory(
p, vMemObjs, vMemFanins, &iFirstMemPi, &iFirstCi, &iFirstMemCi, NULL, NULL );
1004 assert( Gia_ManPiNum(pAbsFull) == iFirstCi + nDcBits );
1008 for ( nIters = 0; nIters < nIterMax; nIters++ )
1011 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
1013 pPdrPars->fUseAbs = 0;
1014 pPdrPars->fVerbose = fVerbose;
1017 pNew =
Wlc_NtkAbstractMemory(
p, vMemObjs, NULL, &iFirstMemPi, &iFirstCi, &iFirstMemCi, vRefines, vNodeFrames );
1035 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
1039 printf(
"\nITERATIONS %d:\n", nIters );
1046 char * pFileName =
"mem_abs.aig";
1048 printf(
"Iteration %3d: Dumped abstraction in file \"%s\" after finding CEX in frame %d.\n", nIters, pFileName, pCex ? pCex->iFrame : -1 );
1063 Vec_WrdFree( vValues );
1064 if ( vRefine == NULL )
1071 Vec_WecPushLevel( vRefines );
1072 Vec_IntAppend( Vec_WecEntryLast(vRefines), vRefine );
1074 Vec_IntFree( vRefine );
1078 Vec_WecFree( vRefines );
1079 Vec_IntFreeP( &vMemObjs );
1080 Vec_IntFreeP( &vMemFanins );
1081 Vec_IntFreeP( &vFirstTotal );
1082 Vec_IntFreeP( &vNodeFrames );
1087 printf(
"Abstraction " );
1088 if ( RetValue == 0 && pCex )
1089 printf(
"resulted in a real CEX in frame %d", pCex->iFrame );
1090 else if ( RetValue == 1 )
1091 printf(
"is successfully proved" );
1093 printf(
"timed out" );
1094 printf(
" after %d iterations. ", nIters );
1095 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
1114 int k, iFanin, nVisited = 0;
1115 if ( pObj->
Mark == 0 )
1119 Vec_IntPushTwo( vCollect, Wlc_ObjId(
p, pObj), nFrames );
1126 Vec_IntPushTwo( vCollect, Wlc_ObjId(
p, pObj), nFrames );
1127 return nVisited + 1;
1131 Wlc_Obj_t * pObj;
int i, k, Entry, Frame, nVisited;
1132 Vec_Int_t * vCollect = Vec_IntStart( 1000 );
1141 Vec_IntClear( vCollect );
1143 printf(
"Obj %6d : ", Wlc_ObjId(
p, pObj) );
1144 printf(
"Visit = %6d ", nVisited );
1145 printf(
"Pair = %6d ", Vec_IntSize(vCollect)/2 );
1146 if ( Vec_IntSize(vCollect)/2 < 10 )
1148 printf(
"%d(%d) ", Entry, Frame );
1151 Vec_IntFree( vMemObjsClean );
1152 Vec_IntFree( vCollect );
1170 if ( pObj->
Mark == 0 )
1174 Vec_IntPushUnique( vCollect, Wlc_ObjId(
p, pObj) );
1188 Vec_Int_t * vCollect = Vec_IntStart( 1000 );
1197 Vec_IntClear( vCollect );
1199 printf(
"Read port %6d : ", Wlc_ObjId(
p, pObj) );
1200 printf(
"Inputs = %6d ", Vec_IntSize(vCollect) );
1205 Vec_IntFree( vMemObjsClean );
1206 Vec_IntFree( vCollect );
1226 int i, j, k, f, fFanin;
1239 if ( pObj == pObjI )
1243 pObj->
Mark2 |= Wlc_NtkObj(
p, fFanin)->Mark2;
1246 Vec_IntPushThree( vRes, Wlc_ObjId(
p, pObjR), Wlc_ObjId(
p, pObjI), -1 );
1259 for ( k = 0; k < Vec_IntSize(vReachReadCi)/3; k++ )
1261 if ( iRead != Vec_IntEntry( vReachReadCi, 3*k ) )
1263 Vec_IntPush( vRes, Vec_IntEntry( vReachReadCi, 3*k+1 ) );
1264 Vec_IntPush( vRes, Vec_IntEntry( vReachReadCi, 3*k+2 ) );
1273 if ( Wlc_ObjType(pObj) == Type1 || Wlc_ObjType(pObj) == Type2 )
1274 Vec_IntPush( vRes, Wlc_ObjId(
p, pObj) );
1293 Vec_Int_t * vFanins = Vec_IntAlloc( 10 );
1295 int i, k, iObjCi, iObjNew = -1;
1304 Wlc_ObjSetCopy(
p, Wlc_ObjId(
p, pObj), -1 );
1306 Wlc_ObjSetCopy(
p, iObjCi, iObjNew );
1307 Vec_IntFree( vLocalCis );
1311 if ( Wlc_ObjIsRead(pObj) || Wlc_ObjIsCi(pObj) )
1313 Wlc_ObjSetCopy(
p, Wlc_ObjId(
p, pObj), -1 );
1314 if ( Wlc_ObjIsWrite(pObj) )
1316 if ( Wlc_ObjCopy(
p, Wlc_ObjFaninId0(pObj)) == -1 )
1318 if ( Wlc_ObjRange(pObjR) != Wlc_ObjRange(Wlc_ObjFanin2(
p, pObj)) )
1322 Vec_IntFillTwo( vFanins, 2, Wlc_ObjCopy(
p, Wlc_ObjFaninId1(pObjR)), Wlc_ObjCopy(
p, Wlc_ObjFaninId1(pObj)) );
1327 Vec_IntFill( vFanins, 1, Wlc_ObjId(pNew, pCond) );
1328 Vec_IntPush( vFanins, Wlc_ObjCopy(
p, Wlc_ObjFaninId2(pObj)) );
1329 Vec_IntPush( vFanins, Wlc_ObjCopy(
p, Wlc_ObjFaninId0(pObj)) );
1332 else if ( Wlc_ObjIsMux(pObj) )
1334 int iFanin0New = Wlc_ObjCopy(
p, Wlc_ObjFaninId1(pObj));
1335 int iFanin1New = Wlc_ObjCopy(
p, Wlc_ObjFaninId2(pObj));
1336 if ( iFanin0New == -1 || iFanin1New == -1 )
1339 assert( Wlc_ObjRange(pObjR) == Wlc_ObjRange(Wlc_NtkObj(pNew, iFanin0New)) );
1340 assert( Wlc_ObjRange(pObjR) == Wlc_ObjRange(Wlc_NtkObj(pNew, iFanin1New)) );
1342 Vec_IntFill( vFanins, 1, Wlc_ObjCopy(
p, Wlc_ObjFaninId0(pObj)) );
1343 Vec_IntPush( vFanins, iFanin0New );
1344 Vec_IntPush( vFanins, iFanin1New );
1347 else if ( Wlc_ObjIsBuf(pObj) )
1349 iObjNew = Wlc_ObjCopy(
p, Wlc_ObjFaninId0(pObj) );
1350 if ( iObjNew == -1 )
1354 Wlc_ObjSetCopy(
p, Wlc_ObjId(
p, pObj), iObjNew );
1357 iObjNew = Wlc_ObjCopy(
p, Wlc_ObjFaninId0(pObjR) );
1359 Vec_IntFill( vFanins, 1, iObjNew );
1361 iObjNew = Wlc_ObjCopy(
p, Wlc_ObjId(
p, pObjR) );
1366 Wlc_ObjSetCopy(
p, Wlc_ObjId(
p, pObj), -1 );
1367 Vec_IntFree( vFanins );
1368 Vec_IntFree( vReads );
1369 Vec_IntFree( vObjCis );
1390 Vec_Int_t * vFanins = Vec_IntAlloc( 100 );
1391 int i, Po0, Po1, iObjNew;
1401 Wlc_NtkCleanCopy(
p );
1402 pNew =
Wlc_NtkAlloc(
p->pName,
p->nObjsAlloc + Vec_IntSize(vMemObjsClean) * nFrames * 10 );
1407 pNew->
vInits = Vec_IntAlloc( 100 );
1415 assert( Vec_IntSize(vReachReadCi) % 3 == 0 );
1416 for ( i = 0; i < Vec_IntSize(vReachReadCi)/3; i++ )
1418 pObj = Wlc_NtkObj(
p, Vec_IntEntry( vReachReadCi, 3*i ) );
1419 assert( Wlc_ObjIsRead(pObj) );
1421 Vec_IntWriteEntry( vReachReadCi, 3*i+2, iObjNew );
1427 if ( !Wlc_ObjIsPi(pObj) && !pObj->
Mark )
1430 Vec_IntPush( pNew->
vInits, Vec_IntEntry(
p->vInits, i-Wlc_NtkPiNum(
p)) );
1443 if ( !Wlc_ObjIsRead(pObj) )
1446 Wlc_ObjSetCopy(
p, Wlc_ObjId(
p, pObj), iObjNew );
1451 if ( !Wlc_ObjIsCi(pObj) && !pObj->
Mark )
1458 if ( Vec_IntSize(&
p->vPoPairs) )
1463 int iCopy0 = Wlc_ObjCopy(
p, Wlc_ObjId(
p, Wlc_NtkPo(
p, Po0)));
1464 int iCopy1 = Wlc_ObjCopy(
p, Wlc_ObjId(
p, Wlc_NtkPo(
p, Po1)));
1466 Wlc_Obj_t * pObjNew = Wlc_NtkObj( pNew, iObj );
1467 Vec_IntFillTwo( vFanins, 1, iCopy0, iCopy1 );
1471 printf(
"Memory abstraction created %d miter outputs.\n", Wlc_NtkPoNum(pNew) );
1484 if ( !Wlc_ObjIsPo(pObj) && !pObj->
Mark )
1498 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
1499 if ( Wlc_NtkHasNameId(
p) )
1501 Vec_IntFree( vFanins );
1502 Vec_IntFree( vMemObjsAll );
1503 Vec_IntFree( vMemObjsClean );
1504 Vec_IntFree( vReachReadCi );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
#define Gia_ManForEachPi(p, pObj, i)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
void Gia_ManCleanMark0(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned __int64 word
DECLARATIONS ///.
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Aig_Man_t * Saig_ManDupFoldConstrsFunc(Aig_Man_t *pAig, int fCompl, int fVerbose, int fSeqCleanup)
void Abc_CexFreeP(Abc_Cex_t **p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
#define Vec_WecForEachLevelStop(vGlob, vVec, i, LevelStop)
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Vec_Int_t * Wlc_NtkFindReachablePiFo(Wlc_Ntk_t *p, Vec_Int_t *vMemObjsClean, int nFrames)
Vec_Int_t * Wlc_NtkCollectMemSizes(Wlc_Ntk_t *p)
int Wlc_NtkCexResim(Gia_Man_t *pAbs, Abc_Cex_t *p, Vec_Int_t *vFirstTotal, int iBit, Vec_Wrd_t *vRes, int iFrame)
void Wlc_NtkAbsAddToNodeFrames(Vec_Int_t *vNodeFrames, Vec_Int_t *vLevel)
void Wlc_NtkPrintMemory(Wlc_Ntk_t *p)
Vec_Int_t * Wlc_NtkTrace(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int iFrame, Vec_Int_t *vMemObjs, Vec_Wrd_t *vValues)
Vec_Wrd_t * Wlc_NtkConvertCex(Vec_Int_t *vFirstTotal, Gia_Man_t *pAbs, Abc_Cex_t *pCex, int fVerbose)
int Wlc_ObjCheckIsEmpty_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
void Wlc_NtkExploreMem2(Wlc_Ntk_t *p, int nFrames)
Wlc_Ntk_t * Wlc_NtkMemBlast(Wlc_Ntk_t *p)
void Wlc_NtkAbsCreateLogic(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Vec_Int_t *vNodeFrames, Vec_Int_t *vFanins, Vec_Int_t *vNewObjs, Vec_Wec_t *vConstrs, Wlc_Obj_t *pConstrOut)
Wlc_Ntk_t * Wlc_NtkMemAbstractTest(Wlc_Ntk_t *p)
Vec_Int_t * Wlc_NtkExtractCisForThisRead(Vec_Int_t *vReachReadCi, int iRead)
Wlc_Ntk_t * Wlc_NtkAbstractMemory(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Int_t *vMemFanins, int *piFirstMemPi, int *piFirstCi, int *piFirstMemCi, Vec_Wec_t *vConstrs, Vec_Int_t *vNodeFrames)
void Wlc_NtkCreateMemoryConstr(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Vec_Int_t *vMemObjsClean, Vec_Int_t *vReachReadCi)
void Wlc_NtkPrintConflict(Wlc_Ntk_t *p, Vec_Int_t *vTrace)
int Wlc_NtkTraceCheckConfict(Wlc_Ntk_t *p, Vec_Int_t *vTrace, Vec_Int_t *vMemObjs, Vec_Wrd_t *vValues)
void Wlc_NtkExploreMem_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vCollect, int nFrames)
Vec_Int_t * Wlc_NtkCollectMemFanins(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs)
Vec_Int_t * Wlc_NtkFindConflict(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Wrd_t *vValues, int nFrames)
int Wlc_NtkMemAbstract(Wlc_Ntk_t *p, int nIterMax, int fDumpAbs, int fPdrVerbose, int fVerbose)
void Wlc_NtkTrace_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int iFrame, Vec_Int_t *vMemObjs, Vec_Wrd_t *vValues, word ValueA, Vec_Int_t *vRes)
Vec_Int_t * Wlc_NtkCollectMemory(Wlc_Ntk_t *p, int fClean)
void Wlc_NtkExploreMem(Wlc_Ntk_t *p, int nFrames)
void Wlc_NtkPrintCex(Wlc_Ntk_t *p, Wlc_Ntk_t *pAbs, Abc_Cex_t *pCex)
Wlc_Ntk_t * Wlc_NtkAbstractMem(Wlc_Ntk_t *p, int nFrames, int fVerbose)
void Wlc_NtkDupOneBuffer(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int iFanin, Vec_Int_t *vFanins, int fIsFi)
int Wlc_CountDcs(char *pInit)
int Wlc_NtkExploreMem2_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vCollect, int nFrames)
void Wlc_NtkAbsCreateFlopInputs(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Vec_Int_t *vNodeFrames, Vec_Int_t *vFanins, Vec_Int_t *vNewObjs, Wlc_Obj_t *pCounter, int AdderBits)
int Wlc_NtkDupOneObject(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int TypeNew, Vec_Int_t *vFanins)
ABC_NAMESPACE_IMPL_START void Wlc_NtkMemBlast_rec(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
DECLARATIONS ///.
Vec_Int_t * Wlc_NtkAbsCreateFlopOutputs(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Vec_Int_t *vNodeFrames, Vec_Int_t *vFanins)
Vec_Int_t * Wlc_NtkCollectOneType(Wlc_Ntk_t *p, Vec_Int_t *vMemObjsClean, int Type1, int Type2)
Vec_Int_t * Wlc_NtkCleanObjects(Wlc_Ntk_t *p, Vec_Int_t *vObjs)
Vec_Int_t * Wlc_NtkDeriveFirstTotal(Wlc_Ntk_t *p, Vec_Int_t *vMemObjs, Vec_Int_t *vMemFanins, int iFirstMemPi, int iFirstMemCi, int fVerbose)
#define Wlc_NtkForEachPo(p, pPo, i)
void Wlc_NtkTransferNames(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
#define Wlc_NtkForEachCi(p, pCi, i)
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
void Wlc_NtkPrintNodeArray(Wlc_Ntk_t *p, Vec_Int_t *vArray)
Wlc_Ntk_t * Wlc_NtkDupDfs(Wlc_Ntk_t *p, int fMarked, int fSeq)
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
void Wlc_NtkFree(Wlc_Ntk_t *p)
void Wlc_NtkSetRefs(Wlc_Ntk_t *p)
#define Wlc_NtkForEachPi(p, pPi, i)
struct Wlc_Ntk_t_ Wlc_Ntk_t
char * Wlc_PrsConvertInitValues(Wlc_Ntk_t *p)
int Wlc_ObjDup(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
#define Wlc_NtkForEachCo(p, pCo, i)