34#define TIM_TEST_BOX_RATIO 200
37static inline int Abc_NodeIsWhiteBox(
Abc_Obj_t * pObj ) {
assert( Abc_ObjIsNode(pObj) );
return Abc_ObjId(pObj) %
TIM_TEST_BOX_RATIO == 0 && Abc_ObjFaninNum(pObj) > 0 && Abc_ObjFaninNum(pObj) < 10; }
56 assert( !Hop_IsComplement(pObj) );
57 if ( !Hop_ObjIsNode(pObj) || Hop_ObjIsMarkA(pObj) )
62 assert( !Hop_ObjIsMarkA(pObj) );
63 Hop_ObjSetMarkA( pObj );
71 assert( Abc_ObjIsNode(pNode) );
77 if (
Abc_NodeIsConst(pNode) || Hop_Regular(pRoot) == Hop_ManConst1(pMan) )
78 return !Hop_IsComplement(pRoot);
86 return Abc_LitNotCond( Hop_Regular(pRoot)->iData, Hop_IsComplement(pRoot) );
103Gia_Man_t * Abc_NtkTestPinDeriveGia(
Abc_Ntk_t * pNtk,
int fWhiteBoxOnly,
int fVerbose )
109 int i, k, iPinLit = 0;
111 assert( Abc_NtkIsLogic(pNtk) );
119 pObj->
iTemp = Gia_ManAppendCi(pGia);
125 if ( !fWhiteBoxOnly || Abc_NodeIsWhiteBox(pObj) )
128 iPinLit = Gia_ManAppendPinType( pGia, 1 );
131 pFanin->
iTemp = Gia_ManAppendAnd( pGia, pFanin->
iTemp, iPinLit );
136 if ( !fWhiteBoxOnly || Abc_NodeIsWhiteBox(pObj) )
139 iPinLit = Gia_ManAppendPinType( pGia, 1 );
141 pObj->
iTemp = Gia_ManAppendAnd( pGia, pObj->
iTemp, iPinLit );
144 Vec_PtrFree( vNodes );
147 pObj->
iTemp = Gia_ManAppendCo( pGia, Abc_ObjFanin0(pObj)->iTemp );
168void Abc_NtkTestPinGia(
Abc_Ntk_t * pNtk,
int fWhiteBoxOnly,
int fVerbose )
171 char * pFileName =
"testpin.aig";
172 pGia = Abc_NtkTestPinDeriveGia( pNtk, fWhiteBoxOnly, fVerbose );
175 printf(
"AIG with pins derived from mapped network \"%s\" was written into file \"%s\".\n",
176 Abc_NtkName(pNtk), pFileName );
196 if ( Abc_NodeIsTravIdCurrent( pObj ) )
198 Abc_NodeSetTravIdCurrent( pObj );
199 if ( Abc_ObjIsCi(pObj) )
201 assert( Abc_ObjIsNode( pObj ) );
204 Vec_PtrPush( vNodes, pObj );
208 Vec_Ptr_t * vCone = Vec_PtrAlloc( 1000 );
212 assert( Abc_ObjIsNode(pObj) );
213 assert( !Abc_NodeIsTravIdCurrent( pObj ) );
245 p = Vec_FltAlloc( nInputs );
246 for ( i = 0; i < nInputs; i++ )
247 Vec_FltPush(
p, 1.0*(i % 10) );
254 p = Vec_FltAlloc( nOutputs );
255 for ( i = 0; i < nOutputs; i++ )
256 Vec_FltPush(
p, 100.0 + 1.0*i );
280 int i, k, Entry, curPi, curPo, BoxUniqueId;
281 int nBoxFaninMax = 0;
286 curPi = Abc_NtkCiNum(pNtk);
287 curPo = Abc_NtkCoNum(pNtk);
290 pObj->
fMarkA = Abc_NodeIsWhiteBox( pObj );
293 nBoxFaninMax = Abc_MaxInt( nBoxFaninMax, Abc_ObjFaninNum(pObj) );
295 curPo += Abc_ObjFaninNum(pObj);
297 printf(
"Selecting node %6d as white boxes with %d inputs and %d output.\n", i, Abc_ObjFaninNum(pObj), 1 );
303 for ( i = 0; i < curPi; i++ )
304 Gia_ManAppendCi(pGia);
305 for ( i = 0; i < nBoxFaninMax; i++ )
306 Gia_ManAppendCi(pHoles);
317 pObj->
iTemp = Abc_Var2Lit( Gia_ObjId(pGia, Gia_ManCi(pGia, curPi++)), 0 );
319 vGiaCoLits = Vec_IntAlloc( 1000 );
320 vGiaCoLits2 = Vec_IntAlloc( 1000 );
329 BoxUniqueId = Abc_ObjFaninNum(pObj);
330 Tim_ManCreateBox( pTim, curPo, Abc_ObjFaninNum(pObj), curPi, 1, BoxUniqueId, 0 );
331 curPo += Abc_ObjFaninNum(pObj);
337 Vec_IntPush( vGiaCoLits, pFanin->
iTemp );
339 pFanin->
iTemp = Abc_Var2Lit( Gia_ObjId(pHoles, Gia_ManCi(pHoles, k)), 0 );
347 Vec_IntPush( vGiaCoLits2, pObj->
iTemp );
350 pObj->
iTemp = Abc_Var2Lit( Gia_ObjId(pGia, Gia_ManCi(pGia, curPi++)), 0 );
355 Gia_ManAppendCo( pGia, Abc_ObjFanin0(pObj)->iTemp );
357 Gia_ManAppendCo( pGia, Entry );
358 Vec_IntFree( vGiaCoLits );
361 Gia_ManAppendCo( pHoles, Entry );
362 Vec_IntFree( vGiaCoLits2 );
364 curPo += Abc_NtkPoNum( pNtk );
365 assert( curPi == Gia_ManPiNum(pGia) );
366 assert( curPo == Gia_ManPoNum(pGia) );
391 Vec_FltFree( vArrTimes );
392 Vec_FltFree( vReqTimes );
446 int i, iRepr, iNode, fProb = 0;
454 if ( Gia_ObjIsHead(
p, iNode) )
455 printf(
"Member %d of choice class %d is a representative.\n", iNode, iRepr ), fProb = 1;
456 if ( Gia_ManObj(
p, iNode )->fMark0 == 1 )
457 printf(
"Node %d participates in more than one choice node.\n", iNode ), fProb = 1;
458 Gia_ManObj(
p, iNode )->fMark0 = 1;
464 if ( Gia_ObjIsAnd(pObj) )
466 if ( Gia_ObjHasRepr(
p, Gia_ObjFaninId0(pObj, i)) )
467 printf(
"Fanin 0 of AND node %d has a repr.\n", i ), fProb = 1;
468 if ( Gia_ObjHasRepr(
p, Gia_ObjFaninId1(pObj, i)) )
469 printf(
"Fanin 1 of AND node %d has a repr.\n", i ), fProb = 1;
471 else if ( Gia_ObjIsCo(pObj) )
473 if ( Gia_ObjHasRepr(
p, Gia_ObjFaninId0(pObj, i)) )
474 printf(
"Fanin 0 of CO node %d has a repr.\n", i ), fProb = 1;
496 int i, k, iRepr, iNode, iPrev;
498 vCollected = Vec_IntAlloc( 100 );
500 Vec_IntPush( vCollected, iRepr );
502 vClass = Vec_IntAlloc( 100 );
505 Vec_IntClear( vClass );
506 Vec_IntPush( vClass, iRepr );
509 if ( fNowIncreasing )
513 Vec_IntPush( vClass, iNode );
519 iRepr = Vec_IntEntryLast( vClass );
522 if ( fNowIncreasing )
523 Gia_ObjSetReprRev(
p, iNode, iNode == iRepr ?
GIA_VOID : iRepr );
525 Gia_ObjSetRepr(
p, iNode, iNode == iRepr ?
GIA_VOID : iRepr );
526 Gia_ObjSetNext(
p, iNode, iPrev );
530 Vec_IntFree( vCollected );
531 Vec_IntFree( vClass );
535 if ( fNowIncreasing )
536 assert( Gia_ObjRepr(
p, iNode) == iRepr && iRepr > iNode );
538 assert( Gia_ObjRepr(
p, iNode) == iRepr && iRepr < iNode );
557 if ( Gia_ManHasChoices(pGia) )
565 if ( Gia_ManHasChoices(pGia) )
572 if ( Gia_ManHasChoices(pGia2) )
580 printf(
"Verification suceessful.\n" );
602 assert( Abc_NtkIsLogic(pNtk) );
void Gia_ManReverseClasses(Gia_Man_t *p, int fNowIncreasing)
Vec_Ptr_t * Abc_NtkTestTimCollectCone(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
void Abc_NtkTestTimByWritingFile(Gia_Man_t *pGia, char *pFileName)
Gia_Man_t * Abc_NtkTestTimDeriveGia(Abc_Ntk_t *pNtk, int fVerbose)
int Abc_NtkTestTimNodeStrash(Gia_Man_t *pGia, Abc_Obj_t *pNode)
void Abc_NtkTestTimCollectCone_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
void Abc_NtkTestTim(Abc_Ntk_t *pNtk, int fVerbose)
void Abc_NtkTestTimNodeStrash_rec(Gia_Man_t *pGia, Hop_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Gia_Man_t * Abc_NtkTestTimPerformSynthesis(Gia_Man_t *p, int fChoices)
Vec_Flt_t * Abc_NtkTestCreateArrivals(int nInputs)
#define TIM_TEST_BOX_RATIO
DECLARATIONS ///.
Vec_Flt_t * Abc_NtkTestCreateRequired(int nOutputs)
void Gia_ManVerifyChoices(Gia_Man_t *p)
struct Abc_Obj_t_ Abc_Obj_t
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL int Abc_NtkIsTopo(Abc_Ntk_t *pNtk)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachCi(pNtk, pCi, i)
ABC_DLL void Abc_NtkFillTemp(Abc_Ntk_t *pNtk)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#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 ///.
ABC_DLL void * Abc_FrameReadLibBox()
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Aig_Man_t * Dar_ManChoiceNew(Aig_Man_t *pAig, Dch_Pars_t *pPars)
Aig_Man_t * Dar_ManCompress2(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
void Dch_ManSetDefaultParams(Dch_Pars_t *p)
DECLARATIONS ///.
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_AigerRead(char *pFileName, int fGiaSimple, int fSkipStrash, int fCheck)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
void Gia_ManHashAlloc(Gia_Man_t *p)
#define Gia_ClassForEachObj1(p, i, iObj)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ManCompare(Gia_Man_t *p1, Gia_Man_t *p2)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachClass(p, i)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
void Gia_ManCleanMark0(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
void Gia_ManHashStop(Gia_Man_t *p)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
struct Hop_Obj_t_ Hop_Obj_t
int Tim_ManBoxNum(Tim_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack)
ITERATORS ///.
void Tim_ManCreate(Tim_Man_t *p, void *pLib, Vec_Flt_t *vInArrs, Vec_Flt_t *vOutReqs)
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
void Tim_ManPrint(Tim_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.