ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcPrint.c
Go to the documentation of this file.
1
20
21#include <math.h>
22#include "base/abc/abc.h"
23#include "bool/dec/dec.h"
24#include "base/main/main.h"
25#include "map/mio/mio.h"
26#include "aig/aig/aig.h"
27#include "map/if/if.h"
28
29#ifdef ABC_USE_CUDD
30#include "bdd/extrab/extraBdd.h"
31#endif
32
33#ifdef WIN32
34#include <windows.h>
35#endif
36
38
39
43
44//extern int s_TotalNodes = 0;
45//extern int s_TotalChanges = 0;
46
49//abctime s_ResubTime = 0;
51
55
70{
71 extern void Io_Write( Abc_Ntk_t * pNtk, char * pFileName, Io_FileType_t FileType );
72 static struct ParStruct {
73 char * pName; // name of the best saved network
74 int Depth; // depth of the best saved network
75 int Flops; // flops in the best saved network
76 int Nodes; // nodes in the best saved network
77 int Edges; // edges in the best saved network
78 int nPis; // the number of primary inputs
79 int nPos; // the number of primary outputs
80 } ParsNew, ParsBest = { 0 };
81 char * pFileNameOut;
82 // free storage for the name
83 if ( pNtk == NULL )
84 {
85 ABC_FREE( ParsBest.pName );
86 return 0;
87 }
88 // quit if not a logic network
89 if ( !Abc_NtkIsLogic(pNtk) )
90 return 0;
91 // get the parameters
92 ParsNew.Depth = Abc_NtkLevel( pNtk );
93 ParsNew.Flops = Abc_NtkLatchNum( pNtk );
94 ParsNew.Nodes = Abc_NtkNodeNum( pNtk );
95 ParsNew.Edges = Abc_NtkGetTotalFanins( pNtk );
96 ParsNew.nPis = Abc_NtkPiNum( pNtk );
97 ParsNew.nPos = Abc_NtkPoNum( pNtk );
98 // reset the parameters if the network has the same name
99 if ( ParsBest.pName == NULL ||
100 strcmp(ParsBest.pName, pNtk->pName) ||
101 ParsBest.Depth > ParsNew.Depth ||
102 (ParsBest.Depth == ParsNew.Depth && ParsBest.Flops > ParsNew.Flops) ||
103 (ParsBest.Depth == ParsNew.Depth && ParsBest.Flops == ParsNew.Flops && ParsBest.Edges > ParsNew.Edges) )
104 {
105 ABC_FREE( ParsBest.pName );
106 ParsBest.pName = Extra_UtilStrsav( pNtk->pName );
107 ParsBest.Depth = ParsNew.Depth;
108 ParsBest.Flops = ParsNew.Flops;
109 ParsBest.Nodes = ParsNew.Nodes;
110 ParsBest.Edges = ParsNew.Edges;
111 ParsBest.nPis = ParsNew.nPis;
112 ParsBest.nPos = ParsNew.nPos;
113 // writ the network
114 if ( strcmp(pNtk->pSpec + strlen(pNtk->pSpec) - strlen("_best.blif"), "_best.blif") )
115 pFileNameOut = Extra_FileNameGenericAppend( pNtk->pSpec, "_best.blif" );
116 else
117 pFileNameOut = pNtk->pSpec;
118 Io_Write( pNtk, pFileNameOut, IO_FILE_BLIF );
119 return 1;
120 }
121 return 0;
122}
123
136{
137 Abc_Obj_t * pObj; int i;
138 double Memory = sizeof(Abc_Ntk_t);
139 Memory += sizeof(Abc_Obj_t) * Abc_NtkObjNum(p);
140 Memory += Vec_PtrMemory(p->vPis);
141 Memory += Vec_PtrMemory(p->vPos);
142 Memory += Vec_PtrMemory(p->vCis);
143 Memory += Vec_PtrMemory(p->vCos);
144 Memory += Vec_PtrMemory(p->vObjs);
145 Memory += Vec_IntMemory(&p->vTravIds);
146 Memory += Vec_IntMemory(p->vLevelsR);
147 Abc_NtkForEachObj( p, pObj, i )
148 Memory += sizeof(int) * (Vec_IntCap(&pObj->vFanins) + Vec_IntCap(&pObj->vFanouts));
149 return Memory;
150}
151
164{
165 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
166 extern Vec_Int_t * Saig_ManComputeSwitchProbs( Aig_Man_t * p, int nFrames, int nPref, int fProbOne );
167 Vec_Int_t * vSwitching;
168 float * pSwitching;
169 Abc_Ntk_t * pNtkStr;
170 Aig_Man_t * pAig;
171 Aig_Obj_t * pObjAig;
172 Abc_Obj_t * pObjAbc, * pObjAbc2;
173 float Result = (float)0;
174 int i;
175 // strash the network
176 pNtkStr = Abc_NtkStrash( pNtk, 0, 1, 0 );
177 Abc_NtkForEachObj( pNtk, pObjAbc, i )
178 if ( (pObjAbc->pTemp && Abc_ObjRegular((Abc_Obj_t *)pObjAbc->pTemp)->Type == ABC_FUNC_NONE) || (!Abc_ObjIsCi(pObjAbc) && !Abc_ObjIsNode(pObjAbc)) )
179 pObjAbc->pTemp = NULL;
180 // map network into an AIG
181 pAig = Abc_NtkToDar( pNtkStr, 0, (int)(Abc_NtkLatchNum(pNtk) > 0) );
182 vSwitching = Saig_ManComputeSwitchProbs( pAig, 48, 16, 0 );
183 pSwitching = (float *)vSwitching->pArray;
184 Abc_NtkForEachObj( pNtk, pObjAbc, i )
185 {
186 if ( (pObjAbc2 = Abc_ObjRegular((Abc_Obj_t *)pObjAbc->pTemp)) && (pObjAig = Aig_Regular((Aig_Obj_t *)pObjAbc2->pTemp)) )
187 {
188 Result += Abc_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id];
189// Abc_ObjPrint( stdout, pObjAbc );
190// printf( "%d = %.2f\n", i, Abc_ObjFanoutNum(pObjAbc) * pSwitching[pObjAig->Id] );
191 }
192 }
193 Vec_IntFree( vSwitching );
194 Aig_ManStop( pAig );
195 Abc_NtkDelete( pNtkStr );
196 return Result;
197}
198
211{
212 If_LibLut_t * pLutLib;
213 Abc_Obj_t * pObj;
214 float Counter = 0.0;
215 int i;
216 assert( Abc_NtkIsLogic(pNtk) );
217 // get the library
218 pLutLib = (If_LibLut_t *)Abc_FrameReadLibLut();
219 if ( pLutLib && pLutLib->LutMax >= Abc_NtkGetFaninMax(pNtk) )
220 {
221 Abc_NtkForEachNode( pNtk, pObj, i )
222 Counter += pLutLib->pLutAreas[Abc_ObjFaninNum(pObj)];
223 }
224 return Counter;
225}
226
239{
240 Abc_Obj_t * pObj; int i, Count = 0;
241 Abc_NtkForEachNode( pNtk, pObj, i )
242 if ( !strncmp( Mio_GateReadName((Mio_Gate_t*)pObj->pData), "mm", 2 ) )
243 Count++;
244 return 1.0*Count/Abc_NtkNodeNum(pNtk);
245}
247{
248 Abc_Obj_t * pObj; int i;
249 float Count = 0, CountAll = 0;
250 Abc_NtkForEachNode( pNtk, pObj, i ) {
251 if ( !strncmp( Mio_GateReadName((Mio_Gate_t*)pObj->pData), "mm", 2 ) )
252 Count += Mio_GateReadArea((Mio_Gate_t*)pObj->pData);
253 CountAll += Mio_GateReadArea((Mio_Gate_t*)pObj->pData);
254 }
255 return 1.0*Count/CountAll;
256}
257
269void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fSkipSmall, int fPrintMem )
270{
271 int nSingles = fSkipBuf ? Abc_NtkGetBufNum(pNtk) : 0;
272 if ( fPrintMuxes && Abc_NtkIsStrash(pNtk) )
273 {
274 extern int Abc_NtkCountMuxes( Abc_Ntk_t * pNtk );
275 int nXors = Abc_NtkGetExorNum(pNtk);
276 int nMuxs = Abc_NtkCountMuxes(pNtk) - nXors;
277 int nAnds = Abc_NtkNodeNum(pNtk) - (nMuxs + nXors) * 3 - nSingles;
278 Abc_Print( 1, "XMA stats: " );
279 Abc_Print( 1,"Xor =%7d (%6.2f %%) ", nXors, 300.0 * nXors / Abc_NtkNodeNum(pNtk) );
280 Abc_Print( 1,"Mux =%7d (%6.2f %%) ", nMuxs, 300.0 * nMuxs / Abc_NtkNodeNum(pNtk) );
281 Abc_Print( 1,"And =%7d (%6.2f %%) ", nAnds, 100.0 * nAnds / Abc_NtkNodeNum(pNtk) );
282 Abc_Print( 1,"Total =%7d", nAnds + nXors + nMuxs );
283 Abc_Print( 1,"\n" );
284 return;
285 }
286 if ( fSaveBest )
288/*
289 if ( fDumpResult )
290 {
291 char Buffer[1000] = {0};
292 const char * pNameGen = pNtk->pSpec? Extra_FileNameGeneric( pNtk->pSpec ) : "nameless_";
293 sprintf( Buffer, "%s_dump.blif", pNameGen );
294 Io_Write( pNtk, Buffer, IO_FILE_BLIF );
295 if ( pNtk->pSpec ) ABC_FREE( pNameGen );
296 }
297*/
298
299// if ( Abc_NtkIsStrash(pNtk) )
300// Abc_AigCountNext( pNtk->pManFunc );
301
302#ifdef WIN32
303 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15 ); // bright
304 Abc_Print( 1,"%-30s:", pNtk->pName );
305 SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
306#else
307 Abc_Print( 1,"%s%-30s:%s", "\033[1;37m", pNtk->pName, "\033[0m" ); // bright
308#endif
309 Abc_Print( 1," i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
310 if ( Abc_NtkConstrNum(pNtk) )
311 Abc_Print( 1,"(c=%d)", Abc_NtkConstrNum(pNtk) );
312 Abc_Print( 1," lat =%5d", Abc_NtkLatchNum(pNtk) );
313 if ( pNtk->nBarBufs )
314 Abc_Print( 1,"(b=%d)", pNtk->nBarBufs );
315 if ( Abc_NtkIsNetlist(pNtk) )
316 {
317 Abc_Print( 1," net =%5d", Abc_NtkNetNum(pNtk) );
318 Abc_Print( 1," nd =%5d", fSkipSmall ? Abc_NtkGetLargeNodeNum(pNtk) : Abc_NtkNodeNum(pNtk) - nSingles );
319 Abc_Print( 1," wbox =%3d", Abc_NtkWhiteboxNum(pNtk) );
320 Abc_Print( 1," bbox =%3d", Abc_NtkBlackboxNum(pNtk) );
321 }
322 else if ( Abc_NtkIsStrash(pNtk) )
323 {
324 Abc_Print( 1," and =%7d", Abc_NtkNodeNum(pNtk) );
325 if ( Abc_NtkGetChoiceNum(pNtk) )
326 Abc_Print( 1," (choice = %d)", Abc_NtkGetChoiceNum(pNtk) );
327 }
328 else
329 {
330 Abc_Print( 1," nd =%6d", fSkipSmall ? Abc_NtkGetLargeNodeNum(pNtk) : Abc_NtkNodeNum(pNtk) - nSingles );
331 Abc_Print( 1," edge =%7d", Abc_NtkGetTotalFanins(pNtk) - nSingles );
332 }
333
334 if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) )
335 {
336 }
337 else if ( Abc_NtkHasSop(pNtk) )
338 {
339
340 Abc_Print( 1," cube =%6d", Abc_NtkGetCubeNum(pNtk) - nSingles );
341 if ( fFactored )
342 Abc_Print( 1," lit(sop) =%6d", Abc_NtkGetLitNum(pNtk) - nSingles );
343 if ( fFactored )
344 Abc_Print( 1," lit(fac) =%6d", Abc_NtkGetLitFactNum(pNtk) - nSingles );
345 }
346 else if ( Abc_NtkHasAig(pNtk) )
347 Abc_Print( 1," aig =%6d", Abc_NtkGetAigNodeNum(pNtk) - nSingles );
348 else if ( Abc_NtkHasBdd(pNtk) )
349 Abc_Print( 1," bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) - nSingles );
350 else if ( Abc_NtkHasMapping(pNtk) )
351 {
352 int fHasTimeMan = (int)(pNtk->pManTime != NULL);
353 assert( pNtk->pManFunc == Abc_FrameReadLibGen() );
354 Abc_Print( 1," area =%5.2f", Abc_NtkGetMappedArea(pNtk) );
355 Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTrace(pNtk, NULL, NULL, 0) );
356 if ( !fHasTimeMan && pNtk->pManTime )
357 {
358 Abc_ManTimeStop( pNtk->pManTime );
359 pNtk->pManTime = NULL;
360 }
361 }
362 else if ( !Abc_NtkHasBlackbox(pNtk) )
363 {
364 assert( 0 );
365 }
366
367 if ( Abc_NtkIsStrash(pNtk) )
368 {
369 extern int Abc_NtkGetMultiRefNum( Abc_Ntk_t * pNtk );
370 Abc_Print( 1," lev =%3d", Abc_AigLevel(pNtk) );
371// Abc_Print( 1," ff = %5d", Abc_NtkNodeNum(pNtk) + 2 * (Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk)) );
372// Abc_Print( 1," var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) );
373 }
374 else
375 Abc_Print( 1," lev = %d", Abc_NtkLevel(pNtk) );
376 if ( pNtk->nBarBufs2 )
377 Abc_Print( 1," buf = %d", pNtk->nBarBufs2 );
378 if ( fUseLutLib && Abc_FrameReadLibLut() )
379 Abc_Print( 1," delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) );
380 if ( fUseLutLib && Abc_FrameReadLibLut() )
381 Abc_Print( 1," area =%5.2f", Abc_NtkGetArea(pNtk) );
382 if ( fPower )
383 Abc_Print( 1," power =%7.2f", Abc_NtkMfsTotalSwitching(pNtk) );
384 if ( fGlitch )
385 {
386 if ( Abc_NtkIsLogic(pNtk) && Abc_NtkGetFaninMax(pNtk) <= 6 )
387 Abc_Print( 1," glitch =%7.2f %%", Abc_NtkMfsTotalGlitching(pNtk, 4000, 8, 0) );
388 else
389 printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." );
390 }
391 if ( fPrintMem )
392 Abc_Print( 1," mem =%5.2f MB", Abc_NtkMemory(pNtk)/(1<<20) );
393 Abc_Print( 1,"\n" );
394/*
395 // print the statistic into a file
396 if ( fDumpResult )
397 {
398 FILE * pTable = fopen( "abcstats.txt", "a+" );
399 fprintf( pTable, "%s ", pNtk->pName );
400 fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
401 fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
402 fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
403 fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
404 fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
405 fprintf( pTable, "\n" );
406 fclose( pTable );
407 }
408*/
409
410/*
411 {
412 FILE * pTable;
413 pTable = fopen( "ibm/seq_stats.txt", "a+" );
414// fprintf( pTable, "%s ", pNtk->pName );
415// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
416// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
417 fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
418 fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
419 fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
420 fprintf( pTable, "\n" );
421 fclose( pTable );
422 }
423*/
424
425/*
426 // print the statistic into a file
427 {
428 FILE * pTable;
429 pTable = fopen( "x/stats_new.txt", "a+" );
430 fprintf( pTable, "%s ", pNtk->pName );
431// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
432// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
433// fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
434// fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
435// fprintf( pTable, "%d ", Abc_NtkGetTotalFanins(pNtk) );
436// fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
437// fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
438 fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
439// fprintf( pTable, "%.2f", (float)(s_ResynTime)/(float)(CLOCKS_PER_SEC) );
440 fprintf( pTable, "\n" );
441 fclose( pTable );
442
443 s_ResynTime = 0;
444 }
445*/
446
447/*
448 // print the statistic into a file
449 {
450 static int Counter = 0;
451 extern int timeRetime;
452 FILE * pTable;
453 Counter++;
454 pTable = fopen( "d/stats.txt", "a+" );
455 fprintf( pTable, "%s ", pNtk->pName );
456// fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
457// fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
458// fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
459 fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
460 fprintf( pTable, "%.2f ", (float)(timeRetime)/(float)(CLOCKS_PER_SEC) );
461 fprintf( pTable, "\n" );
462 fclose( pTable );
463 }
464
465
466 s_TotalNodes += Abc_NtkNodeNum(pNtk);
467 printf( "Total nodes = %6d %6.2f MB Changes = %6d.\n",
468 s_TotalNodes, s_TotalNodes * 20.0 / (1<<20), s_TotalChanges );
469*/
470
471// if ( Abc_NtkHasSop(pNtk) )
472// printf( "The total number of cube pairs = %d.\n", Abc_NtkGetCubePairNum(pNtk) );
473
474 if ( 0 )
475 {
476 FILE * pTable = fopen( "stats.txt", "a+" );
477 if ( Abc_NtkIsStrash(pNtk) )
478 fprintf( pTable, "%s ", pNtk->pName );
479 fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
480 fclose( pTable );
481 }
482
483 fflush( stdout );
484 if ( pNtk->pExdc )
485 Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fSkipSmall, fPrintMem );
486}
487
499void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk, int fPrintFlops )
500{
501 Abc_Obj_t * pObj;
502 int i;
503
504 fprintf( pFile, "Primary inputs (%d): ", Abc_NtkPiNum(pNtk) );
505 Abc_NtkForEachPi( pNtk, pObj, i )
506 fprintf( pFile, " %d=%s", i, Abc_ObjName(pObj) );
507// fprintf( pFile, " %s(%d)", Abc_ObjName(pObj), Abc_ObjFanoutNum(pObj) );
508 fprintf( pFile, "\n" );
509
510 fprintf( pFile, "Primary outputs (%d):", Abc_NtkPoNum(pNtk) );
511 Abc_NtkForEachPo( pNtk, pObj, i )
512 fprintf( pFile, " %d=%s", i, Abc_ObjName(pObj) );
513 fprintf( pFile, "\n" );
514
515 if ( !fPrintFlops )
516 return;
517
518 fprintf( pFile, "Latches (%d): ", Abc_NtkLatchNum(pNtk) );
519 Abc_NtkForEachLatch( pNtk, pObj, i )
520 fprintf( pFile, " %s(%s=%s)", Abc_ObjName(pObj),
521 Abc_ObjName(Abc_ObjFanout0(pObj)), Abc_ObjName(Abc_ObjFanin0(pObj)) );
522 fprintf( pFile, "\n" );
523}
524
536void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk )
537{
538 Abc_Obj_t * pLatch, * pFanin;
539 int i, Counter0, Counter1, Counter2;
540 int InitNums[4], Init;
541
542 assert( !Abc_NtkIsNetlist(pNtk) );
543 if ( Abc_NtkLatchNum(pNtk) == 0 )
544 {
545 fprintf( pFile, "The network is combinational.\n" );
546 return;
547 }
548
549 for ( i = 0; i < 4; i++ )
550 InitNums[i] = 0;
551 Counter0 = Counter1 = Counter2 = 0;
552 Abc_NtkForEachLatch( pNtk, pLatch, i )
553 {
554 Init = Abc_LatchInit( pLatch );
555 assert( Init < 4 );
556 InitNums[Init]++;
557
558 pFanin = Abc_ObjFanin0(Abc_ObjFanin0(pLatch));
559 if ( Abc_NtkIsLogic(pNtk) )
560 {
561 if ( !Abc_NodeIsConst(pFanin) )
562 continue;
563 }
564 else if ( Abc_NtkIsStrash(pNtk) )
565 {
566 if ( !Abc_AigNodeIsConst(pFanin) )
567 continue;
568 }
569 else
570 assert( 0 );
571
572 // the latch input is a constant node
573 Counter0++;
574 if ( Abc_LatchIsInitDc(pLatch) )
575 {
576 Counter1++;
577 continue;
578 }
579 // count the number of cases when the constant is equal to the initial value
580 if ( Abc_NtkIsStrash(pNtk) )
581 {
582 if ( Abc_LatchIsInit1(pLatch) == !Abc_ObjFaninC0(pLatch) )
583 Counter2++;
584 }
585 else
586 {
587 if ( Abc_LatchIsInit1(pLatch) == Abc_NodeIsConst1(Abc_ObjFanin0(Abc_ObjFanin0(pLatch))) )
588 Counter2++;
589 }
590 }
591// fprintf( pFile, "%-15s: ", pNtk->pName );
592 fprintf( pFile, "Total latches = %5d. Init0 = %d. Init1 = %d. InitDC = %d. Const data = %d.\n",
593 Abc_NtkLatchNum(pNtk), InitNums[1], InitNums[2], InitNums[3], Counter0 );
594// fprintf( pFile, "Const fanin = %3d. DC init = %3d. Matching init = %3d. ", Counter0, Counter1, Counter2 );
595// fprintf( pFile, "Self-feed latches = %2d.\n", -1 ); //Abc_NtkCountSelfFeedLatches(pNtk) );
596}
597
609void Abc_NtkFaninFanoutCounters( Abc_Ntk_t * pNtk, Vec_Int_t * vFan, Vec_Int_t * vFon, Vec_Int_t * vFanR, Vec_Int_t * vFonR )
610{
611 Abc_Obj_t * pNode;
612 int i, nFanins, nFanouts;
613 int nFaninsMax = 0, nFanoutsMax = 0;
614 Abc_NtkForEachObj( pNtk, pNode, i )
615 {
616 nFaninsMax = Abc_MaxInt( nFaninsMax, Abc_ObjFaninNum(pNode) );
617 nFanoutsMax = Abc_MaxInt( nFanoutsMax, Abc_ObjFanoutNum(pNode) );
618 }
619 Vec_IntFill( vFan, nFaninsMax + 1, 0 );
620 Vec_IntFill( vFon, nFanoutsMax + 1, 0 );
621 Vec_IntFill( vFanR, nFaninsMax + 1, 0 );
622 Vec_IntFill( vFonR, nFanoutsMax + 1, 0 );
623 Abc_NtkForEachObjReverse( pNtk, pNode, i )
624 {
625 nFanins = Abc_ObjFaninNum( pNode );
626 nFanouts = Abc_ObjFanoutNum( pNode );
627 Vec_IntAddToEntry( vFan, nFanins, 1 );
628 Vec_IntAddToEntry( vFon, nFanouts, 1 );
629 Vec_IntWriteEntry( vFanR, nFanins, i );
630 Vec_IntWriteEntry( vFonR, nFanouts, i );
631 }
632}
633void Abc_NtkInputOutputCounters( Abc_Ntk_t * pNtk, Vec_Int_t * vFan, Vec_Int_t * vFon, Vec_Int_t * vFanR, Vec_Int_t * vFonR )
634{
635 Abc_Obj_t * pNode;
636 int i, nFanins, nFanouts;
637 int nFaninsMax = 0, nFanoutsMax = 0;
638 Abc_NtkForEachCi( pNtk, pNode, i )
639 nFanoutsMax = Abc_MaxInt( nFanoutsMax, Abc_ObjFanoutNum(pNode) );
640 Abc_NtkForEachCo( pNtk, pNode, i )
641 nFaninsMax = Abc_MaxInt( nFaninsMax, Abc_ObjFaninNum(Abc_ObjFanin0(pNode)) );
642 Vec_IntFill( vFan, nFaninsMax + 1, 0 );
643 Vec_IntFill( vFon, nFanoutsMax + 1, 0 );
644 Vec_IntFill( vFanR, nFaninsMax + 1, 0 );
645 Vec_IntFill( vFonR, nFanoutsMax + 1, 0 );
646 Abc_NtkForEachCi( pNtk, pNode, i )
647 {
648 nFanouts = Abc_ObjFanoutNum( pNode );
649 Vec_IntAddToEntry( vFon, nFanouts, 1 );
650 Vec_IntWriteEntry( vFonR, nFanouts, Abc_ObjId(pNode) );
651 }
652 Abc_NtkForEachCo( pNtk, pNode, i )
653 {
654 nFanins = Abc_ObjFaninNum( Abc_ObjFanin0(pNode) );
655 Vec_IntAddToEntry( vFan, nFanins, 1 );
656 Vec_IntWriteEntry( vFanR, nFanins, Abc_ObjId(pNode) );
657 }
658}
660{
661 abctime clk = Abc_Clock();
662 Abc_Obj_t * pNode; int i, k;
663 Vec_Ptr_t * vNodes = Abc_NtkDfs( pNtk, 0 );
664 Vec_Int_t * vFanin, * vFanout, * vTemp = Vec_IntAlloc( 0 );
665 Vec_Int_t * vSuppsCo = Vec_IntAlloc( Abc_NtkCoNum(pNtk) );
666 Vec_Wec_t * vSupps = Vec_WecStart( Abc_NtkObjNumMax(pNtk) );
667 Abc_NtkForEachCi( pNtk, pNode, i )
668 Vec_IntPush( Vec_WecEntry(vSupps, Abc_ObjId(pNode)), i );
669 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
670 {
671 vFanout = Vec_WecEntry(vSupps, Abc_ObjId(pNode));
672 for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
673 {
674 vFanin = Vec_WecEntry(vSupps, Abc_ObjFaninId(pNode, k));
675 Vec_IntTwoMerge2( vFanout, vFanin, vTemp );
676 ABC_SWAP( Vec_Int_t, *vFanout, *vTemp );
677 }
678 }
679 Abc_NtkForEachCo( pNtk, pNode, i )
680 Vec_IntPush( vSuppsCo, Vec_IntSize(Vec_WecEntry(vSupps, Abc_ObjFaninId0(pNode))) );
681 Vec_WecFree( vSupps );
682 Vec_PtrFree( vNodes );
683 Vec_IntFree( vTemp );
684 if ( fVerbose )
685 Abc_PrintTime( 1, "Input support computation", Abc_Clock() - clk );
686 //Vec_IntPrint( vSuppsCo );
687 return vSuppsCo;
688}
690{
691 abctime clk = Abc_Clock();
692 Abc_Obj_t * pNode; int i, k;
693 Vec_Ptr_t * vNodes = Abc_NtkDfs( pNtk, 0 );
694 Vec_Int_t * vFanin, * vFanout, * vTemp = Vec_IntAlloc( 0 );
695 Vec_Int_t * vSuppsCi = Vec_IntAlloc( Abc_NtkCiNum(pNtk) );
696 Vec_Wec_t * vSupps = Vec_WecStart( Abc_NtkObjNumMax(pNtk) );
697 Abc_NtkForEachCo( pNtk, pNode, i )
698 {
699 vFanout = Vec_WecEntry(vSupps, Abc_ObjId(pNode));
700 vFanin = Vec_WecEntry(vSupps, Abc_ObjFaninId0(pNode));
701 Vec_IntPush( vFanout, i );
702 Vec_IntTwoMerge2( vFanin, vFanout, vTemp );
703 ABC_SWAP( Vec_Int_t, *vFanin, *vTemp );
704 }
705 Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pNode, i )
706 {
707 vFanout = Vec_WecEntry(vSupps, Abc_ObjId(pNode));
708 for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
709 {
710 vFanin = Vec_WecEntry(vSupps, Abc_ObjFaninId(pNode, k));
711 Vec_IntTwoMerge2( vFanin, vFanout, vTemp );
712 ABC_SWAP( Vec_Int_t, *vFanin, *vTemp );
713 }
714 }
715 Abc_NtkForEachCi( pNtk, pNode, i )
716 Vec_IntPush( vSuppsCi, Vec_IntSize(Vec_WecEntry(vSupps, Abc_ObjId(pNode))) );
717 Vec_WecFree( vSupps );
718 Vec_PtrFree( vNodes );
719 Vec_IntFree( vTemp );
720 if ( fVerbose )
721 Abc_PrintTime( 1, "Output support computation", Abc_Clock() - clk );
722 //Vec_IntPrint( vSuppsCi );
723 return vSuppsCi;
724}
725void Abc_NtkInOutSupportCounters( Abc_Ntk_t * pNtk, Vec_Int_t * vFan, Vec_Int_t * vFon, Vec_Int_t * vFanR, Vec_Int_t * vFonR )
726{
727 Abc_Obj_t * pNode;
728 Vec_Int_t * vSuppsCo = Abc_NtkCollectCoSupps( pNtk, 1 );
729 Vec_Int_t * vSuppsCi = Abc_NtkCollectCiSupps( pNtk, 1 );
730 int i, nFanins, nFanouts;
731 int nFaninsMax = Vec_IntFindMax( vSuppsCo );
732 int nFanoutsMax = Vec_IntFindMax( vSuppsCi );
733 Vec_IntFill( vFan, nFaninsMax + 1, 0 );
734 Vec_IntFill( vFon, nFanoutsMax + 1, 0 );
735 Vec_IntFill( vFanR, nFaninsMax + 1, 0 );
736 Vec_IntFill( vFonR, nFanoutsMax + 1, 0 );
737 Abc_NtkForEachCo( pNtk, pNode, i )
738 {
739 nFanins = Vec_IntEntry( vSuppsCo, i );
740 Vec_IntAddToEntry( vFan, nFanins, 1 );
741 Vec_IntWriteEntry( vFanR, nFanins, Abc_ObjId(pNode) );
742 }
743 Abc_NtkForEachCi( pNtk, pNode, i )
744 {
745 nFanouts = Vec_IntEntry( vSuppsCi, i );
746 Vec_IntAddToEntry( vFon, nFanouts, 1 );
747 Vec_IntWriteEntry( vFonR, nFanouts, Abc_ObjId(pNode) );
748 }
749 Vec_IntFree( vSuppsCo );
750 Vec_IntFree( vSuppsCi );
751}
752
754{
755 abctime clk = Abc_Clock();
756 Abc_Obj_t * pNode; int i, k;
757 Vec_Ptr_t * vNodes = Abc_NtkDfs( pNtk, 0 );
758 Vec_Int_t * vFanin, * vFanout, * vTemp = Vec_IntAlloc( 0 );
759 Vec_Int_t * vSuppsCo = Vec_IntAlloc( Abc_NtkCoNum(pNtk) );
760 Vec_Wec_t * vSupps = Vec_WecStart( Abc_NtkObjNumMax(pNtk) );
761 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
762 {
763 vFanout = Vec_WecEntry(vSupps, Abc_ObjId(pNode));
764 for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
765 {
766 vFanin = Vec_WecEntry(vSupps, Abc_ObjFaninId(pNode, k));
767 Vec_IntTwoMerge2( vFanout, vFanin, vTemp );
768 ABC_SWAP( Vec_Int_t, *vFanout, *vTemp );
769 }
770 Vec_IntPush( vFanout, i );
771 }
772 Abc_NtkForEachCo( pNtk, pNode, i )
773 Vec_IntPush( vSuppsCo, Vec_IntSize(Vec_WecEntry(vSupps, Abc_ObjFaninId0(pNode))) );
774 Vec_WecFree( vSupps );
775 Vec_PtrFree( vNodes );
776 Vec_IntFree( vTemp );
777 if ( fVerbose )
778 Abc_PrintTime( 1, "Input cone computation", Abc_Clock() - clk );
779 //Vec_IntPrint( vSuppsCo );
780 return vSuppsCo;
781}
783{
784 abctime clk = Abc_Clock();
785 Abc_Obj_t * pNode; int i, k;
786 Vec_Ptr_t * vNodes = Abc_NtkDfs( pNtk, 0 );
787 Vec_Int_t * vFanin, * vFanout, * vTemp = Vec_IntAlloc( 0 );
788 Vec_Int_t * vSuppsCi = Vec_IntAlloc( Abc_NtkCiNum(pNtk) );
789 Vec_Wec_t * vSupps = Vec_WecStart( Abc_NtkObjNumMax(pNtk) );
790 Vec_PtrForEachEntryReverse( Abc_Obj_t *, vNodes, pNode, i )
791 {
792 vFanout = Vec_WecEntry(vSupps, Abc_ObjId(pNode));
793 Vec_IntPush( vFanout, i );
794 for ( k = 0; k < Abc_ObjFaninNum(pNode); k++ )
795 {
796 vFanin = Vec_WecEntry(vSupps, Abc_ObjFaninId(pNode, k));
797 Vec_IntTwoMerge2( vFanin, vFanout, vTemp );
798 ABC_SWAP( Vec_Int_t, *vFanin, *vTemp );
799 }
800 }
801 Abc_NtkForEachCi( pNtk, pNode, i )
802 Vec_IntPush( vSuppsCi, Vec_IntSize(Vec_WecEntry(vSupps, Abc_ObjId(pNode))) );
803 Vec_WecFree( vSupps );
804 Vec_PtrFree( vNodes );
805 Vec_IntFree( vTemp );
806 if ( fVerbose )
807 Abc_PrintTime( 1, "Output cone computation", Abc_Clock() - clk );
808 //Vec_IntPrint( vSuppsCi );
809 return vSuppsCi;
810}
811void Abc_NtkInOutConeCounters( Abc_Ntk_t * pNtk, Vec_Int_t * vFan, Vec_Int_t * vFon, Vec_Int_t * vFanR, Vec_Int_t * vFonR )
812{
813 Abc_Obj_t * pNode;
814 Vec_Int_t * vSuppsCo = Abc_NtkCollectCoCones( pNtk, 1 );
815 Vec_Int_t * vSuppsCi = Abc_NtkCollectCiCones( pNtk, 1 );
816 int i, nFanins, nFanouts;
817 int nFaninsMax = Vec_IntFindMax( vSuppsCo );
818 int nFanoutsMax = Vec_IntFindMax( vSuppsCi );
819 Vec_IntFill( vFan, nFaninsMax + 1, 0 );
820 Vec_IntFill( vFon, nFanoutsMax + 1, 0 );
821 Vec_IntFill( vFanR, nFaninsMax + 1, 0 );
822 Vec_IntFill( vFonR, nFanoutsMax + 1, 0 );
823 Abc_NtkForEachCo( pNtk, pNode, i )
824 {
825 nFanins = Vec_IntEntry( vSuppsCo, i );
826 Vec_IntAddToEntry( vFan, nFanins, 1 );
827 Vec_IntWriteEntry( vFanR, nFanins, Abc_ObjId(pNode) );
828 }
829 Abc_NtkForEachCi( pNtk, pNode, i )
830 {
831 nFanouts = Vec_IntEntry( vSuppsCi, i );
832 Vec_IntAddToEntry( vFon, nFanouts, 1 );
833 Vec_IntWriteEntry( vFonR, nFanouts, Abc_ObjId(pNode) );
834 }
835 Vec_IntFree( vSuppsCo );
836 Vec_IntFree( vSuppsCi );
837}
838
839void Abc_NtkPrintDistribInternal( FILE * pFile, Abc_Ntk_t * pNtk, char * pFanins, char * pFanouts, char * pNode, char * pFanin, char * pFanout,
840 Vec_Int_t * vFan, Vec_Int_t * vFon, Vec_Int_t * vFanR, Vec_Int_t * vFonR )
841{
842 int k, nSizeMax = Abc_MaxInt( Vec_IntSize(vFan), Vec_IntSize(vFon) );
843 fprintf( pFile, "The distribution of %s and %s in the network:\n", pFanins, pFanouts );
844 fprintf( pFile, " Number %s with %s %s with %s Repr1 Repr2\n", pNode, pFanin, pNode, pFanout );
845 for ( k = 0; k < nSizeMax; k++ )
846 {
847 int EntryFan = k < Vec_IntSize(vFan) ? Vec_IntEntry(vFan, k) : 0;
848 int EntryFon = k < Vec_IntSize(vFon) ? Vec_IntEntry(vFon, k) : 0;
849 if ( EntryFan == 0 && EntryFon == 0 )
850 continue;
851
852 fprintf( pFile, "%5d : ", k );
853 if ( EntryFan == 0 )
854 fprintf( pFile, " " );
855 else
856 fprintf( pFile, "%12d ", EntryFan );
857 fprintf( pFile, " " );
858 if ( EntryFon == 0 )
859 fprintf( pFile, " " );
860 else
861 fprintf( pFile, "%12d ", EntryFon );
862
863 fprintf( pFile, " " );
864 if ( EntryFan == 0 )
865 fprintf( pFile, " " );
866 else
867 fprintf( pFile, "%12s ", Abc_ObjName(Abc_NtkObj(pNtk, Vec_IntEntry(vFanR, k))) );
868 fprintf( pFile, " " );
869 if ( EntryFon == 0 )
870 fprintf( pFile, " " );
871 else
872 fprintf( pFile, "%12s ", Abc_ObjName(Abc_NtkObj(pNtk, Vec_IntEntry(vFonR, k))) );
873 fprintf( pFile, "\n" );
874 }
875}
876void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk, int fUseFanio, int fUsePio, int fUseSupp, int fUseCone )
877{
878 Vec_Int_t * vFan = Vec_IntAlloc( 0 );
879 Vec_Int_t * vFon = Vec_IntAlloc( 0 );
880 Vec_Int_t * vFanR = Vec_IntAlloc( 0 );
881 Vec_Int_t * vFonR = Vec_IntAlloc( 0 );
882 assert( fUseFanio + fUsePio + fUseSupp + fUseCone == 1 );
883 if ( fUseFanio )
884 {
885 Abc_NtkFaninFanoutCounters( pNtk, vFan, vFon, vFanR, vFonR );
886 Abc_NtkPrintDistribInternal( pFile, pNtk, "fanins", "fanouts", "Nodes", "fanin", "fanout", vFan, vFon, vFanR, vFonR );
887 }
888 else if ( fUsePio )
889 {
890 Abc_NtkInputOutputCounters( pNtk, vFan, vFon, vFanR, vFonR );
891 Abc_NtkPrintDistribInternal( pFile, pNtk, "fanins", "fanouts", "I/O", "fanin", "fanout", vFan, vFon, vFanR, vFonR );
892 }
893 else if ( fUseSupp )
894 {
895 Abc_NtkInOutSupportCounters( pNtk, vFan, vFon, vFanR, vFonR );
896 Abc_NtkPrintDistribInternal( pFile, pNtk, "input supports", "output supports", "I/O", "in-supp", "out-supp", vFan, vFon, vFanR, vFonR );
897 }
898 else if ( fUseCone )
899 {
900 Abc_NtkInOutConeCounters( pNtk, vFan, vFon, vFanR, vFonR );
901 Abc_NtkPrintDistribInternal( pFile, pNtk, "input cones", "output cones", "I/O", "in-cone", "out-cone", vFan, vFon, vFanR, vFonR );
902 }
903 Vec_IntFree( vFan );
904 Vec_IntFree( vFon );
905 Vec_IntFree( vFanR );
906 Vec_IntFree( vFonR );
907}
908
909
921void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk, int fMffc )
922{
923 char Buffer[100];
924 Abc_Obj_t * pNode;
925 Vec_Int_t * vFanins, * vFanouts;
926 int nFanins, nFanouts, nFaninsMax, nFanoutsMax, nFaninsAll, nFanoutsAll;
927 int i, k, nSizeMax;
928
929 // determine the largest fanin and fanout
930 nFaninsMax = nFanoutsMax = 0;
931 nFaninsAll = nFanoutsAll = 0;
932 Abc_NtkForEachNode( pNtk, pNode, i )
933 {
934 if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 )
935 continue;
936 nFanins = Abc_ObjFaninNum(pNode);
937 if ( Abc_NtkIsNetlist(pNtk) )
938 nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
939 else if ( fMffc )
940 nFanouts = Abc_NodeMffcSize(pNode);
941 else
942 nFanouts = Abc_ObjFanoutNum(pNode);
943 nFaninsAll += nFanins;
944 nFanoutsAll += nFanouts;
945 nFaninsMax = Abc_MaxInt( nFaninsMax, nFanins );
946 nFanoutsMax = Abc_MaxInt( nFanoutsMax, nFanouts );
947 }
948
949 // allocate storage for fanin/fanout numbers
950 nSizeMax = Abc_MaxInt( 10 * (Abc_Base10Log(nFaninsMax) + 1), 10 * (Abc_Base10Log(nFanoutsMax) + 1) );
951 vFanins = Vec_IntStart( nSizeMax );
952 vFanouts = Vec_IntStart( nSizeMax );
953
954 // count the number of fanins and fanouts
955 Abc_NtkForEachNode( pNtk, pNode, i )
956 {
957 if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 )
958 continue;
959 nFanins = Abc_ObjFaninNum(pNode);
960 if ( Abc_NtkIsNetlist(pNtk) )
961 nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) );
962 else if ( fMffc )
963 nFanouts = Abc_NodeMffcSize(pNode);
964 else
965 nFanouts = Abc_ObjFanoutNum(pNode);
966
967 if ( nFanins < 10 )
968 Vec_IntAddToEntry( vFanins, nFanins, 1 );
969 else if ( nFanins < 100 )
970 Vec_IntAddToEntry( vFanins, 10 + nFanins/10, 1 );
971 else if ( nFanins < 1000 )
972 Vec_IntAddToEntry( vFanins, 20 + nFanins/100, 1 );
973 else if ( nFanins < 10000 )
974 Vec_IntAddToEntry( vFanins, 30 + nFanins/1000, 1 );
975 else if ( nFanins < 100000 )
976 Vec_IntAddToEntry( vFanins, 40 + nFanins/10000, 1 );
977 else if ( nFanins < 1000000 )
978 Vec_IntAddToEntry( vFanins, 50 + nFanins/100000, 1 );
979 else if ( nFanins < 10000000 )
980 Vec_IntAddToEntry( vFanins, 60 + nFanins/1000000, 1 );
981
982 if ( nFanouts < 10 )
983 Vec_IntAddToEntry( vFanouts, nFanouts, 1 );
984 else if ( nFanouts < 100 )
985 Vec_IntAddToEntry( vFanouts, 10 + nFanouts/10, 1 );
986 else if ( nFanouts < 1000 )
987 Vec_IntAddToEntry( vFanouts, 20 + nFanouts/100, 1 );
988 else if ( nFanouts < 10000 )
989 Vec_IntAddToEntry( vFanouts, 30 + nFanouts/1000, 1 );
990 else if ( nFanouts < 100000 )
991 Vec_IntAddToEntry( vFanouts, 40 + nFanouts/10000, 1 );
992 else if ( nFanouts < 1000000 )
993 Vec_IntAddToEntry( vFanouts, 50 + nFanouts/100000, 1 );
994 else if ( nFanouts < 10000000 )
995 Vec_IntAddToEntry( vFanouts, 60 + nFanouts/1000000, 1 );
996 }
997
998 fprintf( pFile, "The distribution of fanins and fanouts in the network:\n" );
999 fprintf( pFile, " Number Nodes with fanin Nodes with fanout\n" );
1000 for ( k = 0; k < nSizeMax; k++ )
1001 {
1002 if ( vFanins->pArray[k] == 0 && vFanouts->pArray[k] == 0 )
1003 continue;
1004 if ( k < 10 )
1005 fprintf( pFile, "%15d : ", k );
1006 else
1007 {
1008 sprintf( Buffer, "%d - %d", (int)pow((double)10, k/10) * (k%10), (int)pow((double)10, k/10) * (k%10+1) - 1 );
1009 fprintf( pFile, "%15s : ", Buffer );
1010 }
1011 if ( vFanins->pArray[k] == 0 )
1012 fprintf( pFile, " " );
1013 else
1014 fprintf( pFile, "%12d ", vFanins->pArray[k] );
1015 fprintf( pFile, " " );
1016 if ( vFanouts->pArray[k] == 0 )
1017 fprintf( pFile, " " );
1018 else
1019 fprintf( pFile, "%12d ", vFanouts->pArray[k] );
1020 fprintf( pFile, "\n" );
1021 }
1022 Vec_IntFree( vFanins );
1023 Vec_IntFree( vFanouts );
1024
1025 fprintf( pFile, "Fanins: Max = %d. Ave = %.2f. Fanouts: Max = %d. Ave = %.2f.\n",
1026 nFaninsMax, 1.0*nFaninsAll/Abc_NtkNodeNum(pNtk),
1027 nFanoutsMax, 1.0*nFanoutsAll/Abc_NtkNodeNum(pNtk) );
1028/*
1029 Abc_NtkForEachCi( pNtk, pNode, i )
1030 {
1031 printf( "%d ", Abc_ObjFanoutNum(pNode) );
1032 }
1033 printf( "\n" );
1034*/
1035}
1036
1048void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode )
1049{
1050 Abc_Obj_t * pNode2;
1051 int i;
1052 if ( Abc_ObjIsPo(pNode) )
1053 pNode = Abc_ObjFanin0(pNode);
1054
1055 fprintf( pFile, "Node %s", Abc_ObjName(pNode) );
1056 fprintf( pFile, "\n" );
1057
1058 fprintf( pFile, "Fanins (%d): ", Abc_ObjFaninNum(pNode) );
1059 Abc_ObjForEachFanin( pNode, pNode2, i )
1060 fprintf( pFile, " %s", Abc_ObjName(pNode2) );
1061 fprintf( pFile, "\n" );
1062
1063 fprintf( pFile, "Fanouts (%d): ", Abc_ObjFaninNum(pNode) );
1064 Abc_ObjForEachFanout( pNode, pNode2, i )
1065 fprintf( pFile, " %s", Abc_ObjName(pNode2) );
1066 fprintf( pFile, "\n" );
1067}
1068
1080void Abc_NtkPrintMffc( FILE * pFile, Abc_Ntk_t * pNtk )
1081{
1082 Abc_Obj_t * pNode;
1083 int i;
1084 extern void Abc_NodeMffcConeSuppPrint( Abc_Obj_t * pNode );
1085 Abc_NtkForEachNode( pNtk, pNode, i )
1086 if ( Abc_ObjFanoutNum(pNode) > 1 || (Abc_ObjFanoutNum(pNode) == 1 && Abc_ObjIsCo(Abc_ObjFanout0(pNode))))
1088}
1089
1101void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames )
1102{
1103 Dec_Graph_t * pGraph;
1104 Vec_Ptr_t * vNamesIn;
1105 if ( Abc_ObjIsCo(pNode) )
1106 pNode = Abc_ObjFanin0(pNode);
1107 if ( Abc_ObjIsPi(pNode) )
1108 {
1109 fprintf( pFile, "Skipping the PI node.\n" );
1110 return;
1111 }
1112 if ( Abc_ObjIsLatch(pNode) )
1113 {
1114 fprintf( pFile, "Skipping the latch.\n" );
1115 return;
1116 }
1117 assert( Abc_ObjIsNode(pNode) );
1118 pGraph = Dec_Factor( (char *)pNode->pData );
1119 if ( fUseRealNames )
1120 {
1121 vNamesIn = Abc_NodeGetFaninNames(pNode);
1122 Dec_GraphPrint( stdout, pGraph, (char **)vNamesIn->pArray, Abc_ObjName(pNode) );
1123 Abc_NodeFreeNames( vNamesIn );
1124 }
1125 else
1126 Dec_GraphPrint( stdout, pGraph, (char **)NULL, Abc_ObjName(pNode) );
1127 Dec_GraphFree( pGraph );
1128}
1129void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames )
1130{
1131 Abc_Obj_t * pNode;
1132 int i;
1133 assert( Abc_NtkIsSopLogic(pNtk) );
1134 Abc_NtkForEachNode( pNtk, pNode, i )
1135 Abc_NodePrintFactor( pFile, pNode, fUseRealNames );
1136}
1137
1149void Abc_NodePrintSop( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames )
1150{
1151 Vec_Ptr_t * vNamesIn = NULL;
1152 char * pCube, * pCur, * pSop; int nVars;
1153 if ( Abc_ObjIsCo(pNode) )
1154 pNode = Abc_ObjFanin0(pNode);
1155 if ( Abc_ObjIsPi(pNode) )
1156 {
1157 fprintf( pFile, "Skipping the PI node.\n" );
1158 return;
1159 }
1160 if ( Abc_ObjIsLatch(pNode) )
1161 {
1162 fprintf( pFile, "Skipping the latch.\n" );
1163 return;
1164 }
1165 assert( Abc_ObjIsNode(pNode) );
1166 pSop = (char *)pNode->pData;
1167 nVars = Abc_SopGetVarNum( pSop );
1168 if ( nVars == 0 )
1169 {
1170 fprintf( pFile, "%s = ", Abc_ObjName(pNode) );
1171 fprintf( pFile, "Constant %d", Abc_SopGetPhase(pSop) );
1172 return;
1173 }
1174 if ( !Abc_SopGetPhase(pSop) )
1175 fprintf( pFile, "!" );
1176 fprintf( pFile, "%s = ", Abc_ObjName(pNode) );
1177 if ( fUseRealNames )
1178 vNamesIn = Abc_NodeGetFaninNames(pNode);
1179 Abc_SopForEachCube( pSop, nVars, pCube )
1180 {
1181 if ( pCube != pSop )
1182 fprintf( pFile, " +" );
1183 if ( vNamesIn )
1184 {
1185 for ( pCur = pCube; *pCur != ' '; pCur++ )
1186 if ( *pCur != '-' )
1187 fprintf( pFile, " %s%s", *pCur == '0' ? "!" : "", (char *)Vec_PtrEntry(vNamesIn, pCur-pCube) );
1188 }
1189 else
1190 {
1191 for ( pCur = pCube; *pCur != ' '; pCur++ )
1192 if ( *pCur != '-' )
1193 fprintf( pFile, " %s%c", *pCur == '0' ? "!" : "", (char)('a' + pCur-pCube) );
1194 }
1195 }
1196 fprintf( pFile, "\n" );
1197 if ( vNamesIn )
1198 Abc_NodeFreeNames( vNamesIn );
1199}
1200void Abc_NtkPrintSop( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames )
1201{
1202 Abc_Obj_t * pNode;
1203 int i;
1204 assert( Abc_NtkIsSopLogic(pNtk) );
1205 Abc_NtkForEachNode( pNtk, pNode, i )
1206 Abc_NodePrintSop( pFile, pNode, fUseRealNames );
1207}
1208
1221{
1222 Abc_Obj_t * pFan, * pFanout = NULL; int k, nPos = 0;
1223 if ( !Abc_ObjIsNode(pObj) )
1224 return Abc_ObjName(pObj);
1225 Abc_ObjForEachFanout( pObj, pFan, k ) {
1226 if ( Abc_ObjIsPo(pFan) )
1227 pFanout = pFan, nPos++;
1228 }
1229 return Abc_ObjName(nPos == 1 ? pFanout : pObj);
1230}
1231void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListNodes, int fOutputs, int fVerbose )
1232{
1233 Abc_Obj_t * pNode;
1234 int i, k, Length;
1235 if ( fOutputs )
1236 {
1237 Abc_NtkLevel(pNtk);
1238 printf( "Outputs by level: " );
1239 Abc_NtkForEachCo( pNtk, pNode, k )
1240 printf( "%d=%d ", k, Abc_ObjFanin0(pNode)->Level );
1241 printf( "\n" );
1242 return;
1243 }
1244 if ( fListNodes )
1245 {
1246 int nLevels;
1247 nLevels = Abc_NtkLevel(pNtk);
1248 printf( "Nodes by level:\n" );
1249 for ( i = 0; i <= nLevels; i++ )
1250 {
1251 printf( "%2d : ", i );
1252 Abc_NtkForEachNode( pNtk, pNode, k )
1253 if ( (int)pNode->Level == i )
1254 printf( " %s", Abc_NodeGetPrintName(pNode) );
1255 printf( "\n" );
1256 }
1257 return;
1258 }
1259
1260 // print the delay profile
1261 if ( fProfile && Abc_NtkHasMapping(pNtk) )
1262 {
1263 int nIntervals = 12;
1264 float DelayMax, DelayCur, DelayDelta;
1265 int * pLevelCounts;
1266 int DelayInt, nOutsSum, nOutsTotal;
1267
1268 // get the max delay and delta
1269 DelayMax = Abc_NtkDelayTrace( pNtk, NULL, NULL, 0 );
1270 DelayDelta = DelayMax/nIntervals;
1271 // collect outputs by delay
1272 pLevelCounts = ABC_ALLOC( int, nIntervals );
1273 memset( pLevelCounts, 0, sizeof(int) * nIntervals );
1274 Abc_NtkForEachCo( pNtk, pNode, i )
1275 {
1276 if ( Abc_ObjIsNode(Abc_ObjFanin0(pNode)) && Abc_ObjFaninNum(Abc_ObjFanin0(pNode)) == 0 )
1277 DelayInt = 0;
1278 else
1279 {
1280 DelayCur = Abc_NodeReadArrivalWorst( Abc_ObjFanin0(pNode) );
1281 DelayInt = (int)(DelayCur / DelayDelta);
1282 if ( DelayInt >= nIntervals )
1283 DelayInt = nIntervals - 1;
1284 }
1285 pLevelCounts[DelayInt]++;
1286 }
1287
1288 nOutsSum = 0;
1289 nOutsTotal = Abc_NtkCoNum(pNtk);
1290 for ( i = 0; i < nIntervals; i++ )
1291 {
1292 nOutsSum += pLevelCounts[i];
1293 printf( "[%8.2f - %8.2f] : COs = %4d. %5.1f %%\n",
1294 DelayDelta * i, DelayDelta * (i+1), pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
1295 }
1296 ABC_FREE( pLevelCounts );
1297 return;
1298 }
1299 else if ( fProfile )
1300 {
1301 int LevelMax, * pLevelCounts;
1302 int nOutsSum, nOutsTotal;
1303
1304 if ( !Abc_NtkIsStrash(pNtk) )
1305 Abc_NtkLevel(pNtk);
1306
1307 LevelMax = 0;
1308 Abc_NtkForEachCo( pNtk, pNode, i )
1309 if ( LevelMax < (int)Abc_ObjFanin0(pNode)->Level )
1310 LevelMax = Abc_ObjFanin0(pNode)->Level;
1311 pLevelCounts = ABC_ALLOC( int, LevelMax + 1 );
1312 memset( pLevelCounts, 0, sizeof(int) * (LevelMax + 1) );
1313 Abc_NtkForEachCo( pNtk, pNode, i )
1314 pLevelCounts[Abc_ObjFanin0(pNode)->Level]++;
1315
1316 nOutsSum = 0;
1317 nOutsTotal = Abc_NtkCoNum(pNtk);
1318 for ( i = 0; i <= LevelMax; i++ )
1319 if ( pLevelCounts[i] )
1320 {
1321 nOutsSum += pLevelCounts[i];
1322 printf( "Level = %4d. COs = %4d. %5.1f %%\n", i, pLevelCounts[i], 100.0 * nOutsSum/nOutsTotal );
1323 }
1324 ABC_FREE( pLevelCounts );
1325 return;
1326 }
1327 assert( Abc_NtkIsStrash(pNtk) );
1328
1329 if ( fVerbose )
1330 {
1331 // find the longest name
1332 Length = 0;
1333 Abc_NtkForEachCo( pNtk, pNode, i )
1334 if ( Length < (int)strlen(Abc_ObjName(pNode)) )
1335 Length = strlen(Abc_ObjName(pNode));
1336 if ( Length < 5 )
1337 Length = 5;
1338 // print stats for each output
1339 Abc_NtkForEachCo( pNtk, pNode, i )
1340 {
1341 fprintf( pFile, "CO %4d : %*s ", i, Length, Abc_ObjName(pNode) );
1342 Abc_NodePrintLevel( pFile, pNode );
1343 }
1344 }
1345}
1346
1358void Abc_NodePrintLevel( FILE * pFile, Abc_Obj_t * pNode )
1359{
1360 Abc_Obj_t * pDriver;
1361 Vec_Ptr_t * vNodes;
1362
1363 pDriver = Abc_ObjIsCo(pNode)? Abc_ObjFanin0(pNode) : pNode;
1364 if ( Abc_ObjIsPi(pDriver) )
1365 {
1366 fprintf( pFile, "Primary input.\n" );
1367 return;
1368 }
1369 if ( Abc_ObjIsLatch(pDriver) )
1370 {
1371 fprintf( pFile, "Latch.\n" );
1372 return;
1373 }
1374 if ( Abc_NodeIsConst(pDriver) )
1375 {
1376 fprintf( pFile, "Constant %d.\n", !Abc_ObjFaninC0(pNode) );
1377 return;
1378 }
1379 // print the level
1380 fprintf( pFile, "Level = %3d. ", pDriver->Level );
1381 // print the size of MFFC
1382 fprintf( pFile, "Mffc = %5d. ", Abc_NodeMffcSize(pDriver) );
1383 // print the size of the shole cone
1384 vNodes = Abc_NtkDfsNodes( pNode->pNtk, &pDriver, 1 );
1385 fprintf( pFile, "Cone = %5d. ", Vec_PtrSize(vNodes) );
1386 Vec_PtrFree( vNodes );
1387 fprintf( pFile, "\n" );
1388}
1389
1401void Abc_NodePrintKMap( Abc_Obj_t * pNode, int fUseRealNames )
1402{
1403#ifdef ABC_USE_CUDD
1404 Vec_Ptr_t * vNamesIn;
1405 if ( fUseRealNames )
1406 {
1407 vNamesIn = Abc_NodeGetFaninNames(pNode);
1408 Extra_PrintKMap( stdout, (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData, Cudd_Not(pNode->pData),
1409 Abc_ObjFaninNum(pNode), NULL, 0, (char **)vNamesIn->pArray );
1410 Abc_NodeFreeNames( vNamesIn );
1411 }
1412 else
1413 Extra_PrintKMap( stdout, (DdManager *)pNode->pNtk->pManFunc, (DdNode *)pNode->pData, Cudd_Not(pNode->pData),
1414 Abc_ObjFaninNum(pNode), NULL, 0, NULL );
1415#endif
1416}
1417
1429void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary, int fUpdateProfile )
1430{
1431 Abc_Obj_t * pObj;
1432 int fHasBdds, i;
1433 int CountConst, CountBuf, CountInv, CountAnd, CountOr, CountOther, CounterTotal, TotalDiff = 0;
1434 char * pSop;
1435
1436 if ( fUseLibrary && Abc_NtkHasMapping(pNtk) )
1437 {
1438 Mio_Gate_t ** ppGates;
1439 double Area, AreaTotal;
1440 int Counter, nGates, i, nGateNameLen;
1441
1442 // clean value of all gates
1443 nGates = Mio_LibraryReadGateNum( (Mio_Library_t *)pNtk->pManFunc );
1444 ppGates = Mio_LibraryReadGateArray( (Mio_Library_t *)pNtk->pManFunc );
1445 for ( i = 0; i < nGates; i++ )
1446 {
1447 Mio_GateSetValue( ppGates[i], 0 );
1448 if ( fUpdateProfile )
1449 Mio_GateSetProfile2( ppGates[i], 0 );
1450 }
1451
1452 // count the gates by name
1453 CounterTotal = 0;
1454 Abc_NtkForEachNodeNotBarBuf( pNtk, pObj, i )
1455 {
1456 if ( i == 0 ) continue;
1458 if ( fUpdateProfile )
1460 CounterTotal++;
1461 // assuming that twin gates follow each other
1462 if ( Abc_NtkFetchTwinNode(pObj) )
1463 i++;
1464 }
1465
1466 // determine the longest gate name
1467 nGateNameLen = 5;
1468 for ( i = 0; i < nGates; i++ )
1469 {
1470 Counter = Mio_GateReadValue( ppGates[i] );
1471 if ( Counter == 0 )
1472 continue;
1473 nGateNameLen = Abc_MaxInt( nGateNameLen, strlen(Mio_GateReadName(ppGates[i])) );
1474 }
1475
1476 // print the gates
1477 AreaTotal = Abc_NtkGetMappedArea(pNtk);
1478 for ( i = 0; i < nGates; i++ )
1479 {
1480 Counter = Mio_GateReadValue( ppGates[i] );
1481 if ( Counter == 0 && Mio_GateReadProfile(ppGates[i]) == 0 )
1482 continue;
1483 if ( Mio_GateReadPinNum(ppGates[i]) > 1 )
1484 TotalDiff += Abc_AbsInt( Mio_GateReadProfile(ppGates[i]) - Mio_GateReadProfile2(ppGates[i]) );
1485 Area = Counter * Mio_GateReadArea( ppGates[i] );
1486 printf( "%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %% %8d %8d %s\n",
1487 nGateNameLen, Mio_GateReadName( ppGates[i] ),
1488 Mio_GateReadPinNum( ppGates[i] ),
1489 Counter, Area, 100.0 * Area / AreaTotal,
1490 Mio_GateReadProfile(ppGates[i]),
1491 Mio_GateReadProfile2(ppGates[i]),
1492 Mio_GateReadForm(ppGates[i]) );
1493 }
1494 printf( "%-*s Instance = %8d Area = %10.2f %6.2f %% AbsDiff = %d\n",
1495 nGateNameLen, "TOTAL",
1496 CounterTotal, AreaTotal, 100.0, TotalDiff );
1497 return;
1498 }
1499
1500 if ( Abc_NtkIsAigLogic(pNtk) )
1501 return;
1502
1503 // transform logic functions from BDD to SOP
1504 if ( (fHasBdds = Abc_NtkIsBddLogic(pNtk)) )
1505 {
1506 if ( !Abc_NtkBddToSop(pNtk, -1, ABC_INFINITY, 1) )
1507 {
1508 printf( "Abc_NtkPrintGates(): Converting to SOPs has failed.\n" );
1509 return;
1510 }
1511 }
1512
1513 // get hold of the SOP of the node
1514 CountConst = CountBuf = CountInv = CountAnd = CountOr = CountOther = CounterTotal = 0;
1515 Abc_NtkForEachNodeNotBarBuf( pNtk, pObj, i )
1516 {
1517 if ( i == 0 ) continue;
1518 if ( Abc_NtkHasMapping(pNtk) )
1519 pSop = Mio_GateReadSop((Mio_Gate_t *)pObj->pData);
1520 else
1521 pSop = (char *)pObj->pData;
1522 // collect the stats
1523 if ( Abc_SopIsConst0(pSop) || Abc_SopIsConst1(pSop) )
1524 CountConst++;
1525 else if ( Abc_SopIsBuf(pSop) )
1526 CountBuf++;
1527 else if ( Abc_SopIsInv(pSop) )
1528 CountInv++;
1529 else if ( (!Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop)) ||
1530 ( Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop)) )
1531 CountAnd++;
1532 else if ( ( Abc_SopIsComplement(pSop) && Abc_SopIsAndType(pSop)) ||
1533 (!Abc_SopIsComplement(pSop) && Abc_SopIsOrType(pSop)) )
1534 CountOr++;
1535 else
1536 CountOther++;
1537 CounterTotal++;
1538 }
1539 printf( "Const = %8d %6.2f %%\n", CountConst , 100.0 * CountConst / CounterTotal );
1540 printf( "Buffer = %8d %6.2f %%\n", CountBuf , 100.0 * CountBuf / CounterTotal );
1541 printf( "Inverter = %8d %6.2f %%\n", CountInv , 100.0 * CountInv / CounterTotal );
1542 printf( "And = %8d %6.2f %%\n", CountAnd , 100.0 * CountAnd / CounterTotal );
1543 printf( "Or = %8d %6.2f %%\n", CountOr , 100.0 * CountOr / CounterTotal );
1544 printf( "Other = %8d %6.2f %%\n", CountOther , 100.0 * CountOther / CounterTotal );
1545 printf( "TOTAL = %8d %6.2f %%\n", CounterTotal, 100.0 * CounterTotal / CounterTotal );
1546
1547 // convert the network back into BDDs if this is how it was
1548 if ( fHasBdds )
1549 Abc_NtkSopToBdd(pNtk);
1550}
1551
1564{
1565 Vec_Ptr_t * vNodes1, * vNodes2;
1566 Abc_Obj_t * pObj1, * pObj2, * pNode1, * pNode2;
1567 int i, k, m, n, Counter;
1568
1569 // print the template
1570 printf( "Statistics about sharing of logic nodes among the CO pairs.\n" );
1571 printf( "(CO1,CO2)=NumShared : " );
1572 // go though the CO pairs
1573 Abc_NtkForEachCo( pNtk, pObj1, i )
1574 {
1575 vNodes1 = Abc_NtkDfsNodes( pNtk, &pObj1, 1 );
1576 // mark the nodes
1577 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode1, m )
1578 pNode1->fMarkA = 1;
1579 // go through the second COs
1580 Abc_NtkForEachCo( pNtk, pObj2, k )
1581 {
1582 if ( i >= k )
1583 continue;
1584 vNodes2 = Abc_NtkDfsNodes( pNtk, &pObj2, 1 );
1585 // count the number of marked
1586 Counter = 0;
1587 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes2, pNode2, n )
1588 Counter += pNode2->fMarkA;
1589 // print
1590 printf( "(%d,%d)=%d ", i, k, Counter );
1591 Vec_PtrFree( vNodes2 );
1592 }
1593 // unmark the nodes
1594 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes1, pNode1, m )
1595 pNode1->fMarkA = 0;
1596 Vec_PtrFree( vNodes1 );
1597 }
1598 printf( "\n" );
1599}
1600
1613{
1614 Abc_Obj_t * pObj;
1615 int i, Counter = 0;
1616 Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
1617 Counter += Abc_ObjIsPi(pObj);
1618 return Counter;
1619}
1620void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk, int fMatrix )
1621{
1622 Vec_Ptr_t * vSupp, * vNodes;
1623 Abc_Obj_t * pObj;
1624 int i, k, nPis;
1625 printf( "Structural support info:\n" );
1626 Abc_NtkForEachCo( pNtk, pObj, i )
1627 {
1628 vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
1629 vNodes = Abc_NtkDfsNodes( pNtk, &pObj, 1 );
1630 nPis = Abc_NtkCountPis( vSupp );
1631 printf( "%5d %20s : Cone = %5d. Supp = %5d. (PIs = %5d. FFs = %5d.)\n",
1632 i, Abc_ObjName(pObj), vNodes->nSize, vSupp->nSize, nPis, vSupp->nSize - nPis );
1633 Vec_PtrFree( vNodes );
1634 Vec_PtrFree( vSupp );
1635 }
1636 if ( !fMatrix )
1637 {
1638 Abc_NtkCleanMarkA( pNtk );
1639 return;
1640 }
1641
1642 Abc_NtkForEachCi( pNtk, pObj, k )
1643 pObj->fMarkA = 0;
1644
1645 printf( "Actual support info:\n" );
1646 Abc_NtkForEachCo( pNtk, pObj, i )
1647 {
1648 vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
1649 Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, k )
1650 pObj->fMarkA = 1;
1651 Vec_PtrFree( vSupp );
1652
1653 Abc_NtkForEachCi( pNtk, pObj, k )
1654 printf( "%d", pObj->fMarkA );
1655 printf( "\n" );
1656
1657 Abc_NtkForEachCi( pNtk, pObj, k )
1658 pObj->fMarkA = 0;
1659 }
1660 Abc_NtkCleanMarkA( pNtk );
1661}
1662
1674void Abc_ObjPrint( FILE * pFile, Abc_Obj_t * pObj )
1675{
1676 Abc_Obj_t * pFanin;
1677 int i;
1678 fprintf( pFile, "Object %5d : ", pObj->Id );
1679 switch ( pObj->Type )
1680 {
1681 case ABC_OBJ_NONE:
1682 fprintf( pFile, "NONE " );
1683 break;
1684 case ABC_OBJ_CONST1:
1685 fprintf( pFile, "Const1 " );
1686 break;
1687 case ABC_OBJ_PI:
1688 fprintf( pFile, "PI " );
1689 break;
1690 case ABC_OBJ_PO:
1691 fprintf( pFile, "PO " );
1692 break;
1693 case ABC_OBJ_BI:
1694 fprintf( pFile, "BI " );
1695 break;
1696 case ABC_OBJ_BO:
1697 fprintf( pFile, "BO " );
1698 break;
1699 case ABC_OBJ_NET:
1700 fprintf( pFile, "Net " );
1701 break;
1702 case ABC_OBJ_NODE:
1703 fprintf( pFile, "Node " );
1704 break;
1705 case ABC_OBJ_LATCH:
1706 fprintf( pFile, "Latch " );
1707 break;
1708 case ABC_OBJ_WHITEBOX:
1709 fprintf( pFile, "Whitebox" );
1710 break;
1711 case ABC_OBJ_BLACKBOX:
1712 fprintf( pFile, "Blackbox" );
1713 break;
1714 default:
1715 assert(0);
1716 break;
1717 }
1718 // print the fanins
1719 fprintf( pFile, " Fanins ( " );
1720 Abc_ObjForEachFanin( pObj, pFanin, i )
1721 fprintf( pFile, "%d ", pFanin->Id );
1722 fprintf( pFile, ") " );
1723/*
1724 fprintf( pFile, " Fanouts ( " );
1725 Abc_ObjForEachFanout( pObj, pFanin, i )
1726 fprintf( pFile, "%d(%c) ", pFanin->Id, Abc_NodeIsTravIdCurrent(pFanin)? '+' : '-' );
1727 fprintf( pFile, ") " );
1728*/
1729 // print the logic function
1730 if ( Abc_ObjIsNode(pObj) && Abc_NtkIsSopLogic(pObj->pNtk) )
1731 fprintf( pFile, " %s", (char*)pObj->pData );
1732 else if ( Abc_ObjIsNode(pObj) && Abc_NtkIsMappedLogic(pObj->pNtk) )
1733 fprintf( pFile, " %s\n", Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
1734 else
1735 fprintf( pFile, "\n" );
1736}
1737
1738
1751{
1752 Abc_Obj_t * pObj, * pChild, * pConst1 = Abc_AigConst1(pNtk);
1753 int i, iOut = -1;
1754 abctime Time = Abc_Clock();
1755 int nUnsat = 0;
1756 int nSat = 0;
1757 int nUndec = 0;
1758 int nPis = 0;
1759 Abc_NtkForEachPi( pNtk, pObj, i )
1760 nPis += (int)( Abc_ObjFanoutNum(pObj) > 0 );
1761 Abc_NtkForEachPo( pNtk, pObj, i )
1762 {
1763 pChild = Abc_ObjChild0(pObj);
1764 // check if the output is constant 0
1765 if ( pChild == Abc_ObjNot(pConst1) )
1766 nUnsat++;
1767 // check if the output is constant 1
1768 else if ( pChild == pConst1 )
1769 {
1770 nSat++;
1771 if ( iOut == -1 )
1772 iOut = i;
1773 }
1774 // check if the output is a primary input
1775 else if ( Abc_ObjIsPi(Abc_ObjRegular(pChild)) )
1776 {
1777 nSat++;
1778 if ( iOut == -1 )
1779 iOut = i;
1780 }
1781 // check if the output is 1 for the 0000 pattern
1782 else if ( Abc_ObjRegular(pChild)->fPhase != (unsigned)Abc_ObjIsComplement(pChild) )
1783 {
1784 nSat++;
1785 if ( iOut == -1 )
1786 iOut = i;
1787 }
1788 else
1789 nUndec++;
1790 }
1791 printf( "Miter: I =%6d", nPis );
1792 printf( " N =%7d", Abc_NtkNodeNum(pNtk) );
1793 printf( " ? =%7d", nUndec );
1794 printf( " U =%6d", nUnsat );
1795 printf( " S =%6d", nSat );
1796 Time = Abc_Clock() - Time;
1797 printf(" %7.2f sec\n", (float)(Time)/(float)(CLOCKS_PER_SEC));
1798 if ( iOut >= 0 )
1799 printf( "The first satisfiable output is number %d (%s).\n", iOut, Abc_ObjName( Abc_NtkPo(pNtk, iOut) ) );
1800}
1801
1814{
1815 Abc_Obj_t * pObj, * pDriver, * pRepr; int i, iRepr;
1816 Vec_Int_t * vMap = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
1817 Abc_NtkForEachPo( pNtk, pObj, i )
1818 {
1819 pDriver = Abc_ObjFanin0(pObj);
1820 if ( Abc_NtkIsStrash(pNtk) && pDriver == Abc_AigConst1(pNtk) )
1821 {
1822 printf( "%s = Const%d\n", Abc_ObjName(pObj), !Abc_ObjFaninC0(pObj) );
1823 continue;
1824 }
1825 else if ( !Abc_NtkIsStrash(pNtk) && Abc_NodeIsConst(pDriver) )
1826 {
1827 printf( "%s = Const%d\n", Abc_ObjName(pObj), Abc_NodeIsConst1(pDriver) );
1828 continue;
1829 }
1830 iRepr = Vec_IntEntry( vMap, Abc_ObjId(pDriver) );
1831 if ( iRepr == -1 )
1832 {
1833 Vec_IntWriteEntry( vMap, Abc_ObjId(pDriver), i );
1834 continue;
1835 }
1836 pRepr = Abc_NtkCo(pNtk, iRepr);
1837 printf( "%s = %s%s\n", Abc_ObjName(pObj), Abc_ObjFaninC0(pRepr) == Abc_ObjFaninC0(pObj) ? "" : "!", Abc_ObjName(pRepr) );
1838 }
1839 Vec_IntFree( vMap );
1840}
1841
1842
1843
1844
1845typedef struct Gli_Man_t_ Gli_Man_t;
1846
1847extern Gli_Man_t * Gli_ManAlloc( int nObjs, int nRegs, int nFanioPairs );
1848extern void Gli_ManStop( Gli_Man_t * p );
1849extern int Gli_ManCreateCi( Gli_Man_t * p, int nFanouts );
1850extern int Gli_ManCreateCo( Gli_Man_t * p, int iFanin );
1851extern int Gli_ManCreateNode( Gli_Man_t * p, Vec_Int_t * vFanins, int nFanouts, word * pGateTruth );
1852
1853extern void Gli_ManSwitchesAndGlitches( Gli_Man_t * p, int nPatterns, float PiTransProb, int fVerbose );
1854extern int Gli_ObjNumSwitches( Gli_Man_t * p, int iNode );
1855extern int Gli_ObjNumGlitches( Gli_Man_t * p, int iNode );
1856
1868float Abc_NtkMfsTotalGlitchingLut( Abc_Ntk_t * pNtk, int nPats, int Prob, int fVerbose )
1869{
1870 int nSwitches, nGlitches;
1871 Gli_Man_t * p;
1872 Vec_Ptr_t * vNodes;
1873 Vec_Int_t * vFanins, * vTruth;
1874 Abc_Obj_t * pObj, * pFanin;
1875 Vec_Wrd_t * vTruths; word * pTruth;
1876 unsigned * puTruth;
1877 int i, k;
1878 assert( Abc_NtkIsLogic(pNtk) );
1879 assert( Abc_NtkGetFaninMax(pNtk) <= 6 );
1880 if ( Abc_NtkGetFaninMax(pNtk) > 6 )
1881 {
1882 printf( "Abc_NtkMfsTotalGlitching() This procedure works only for mapped networks with LUTs size up to 6 inputs.\n" );
1883 return -1.0;
1884 }
1885 Abc_NtkToAig( pNtk );
1886 vNodes = Abc_NtkDfs( pNtk, 0 );
1887 vFanins = Vec_IntAlloc( 6 );
1888 vTruth = Vec_IntAlloc( 1 << 12 );
1889 vTruths = Vec_WrdStart( Abc_NtkObjNumMax(pNtk) );
1890
1891 // derive network for glitch computation
1892 p = Gli_ManAlloc( Vec_PtrSize(vNodes) + Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk),
1893 Abc_NtkLatchNum(pNtk), Abc_NtkGetTotalFanins(pNtk) + Abc_NtkCoNum(pNtk) );
1894 Abc_NtkForEachObj( pNtk, pObj, i )
1895 pObj->iTemp = -1;
1896 Abc_NtkForEachCi( pNtk, pObj, i )
1897 pObj->iTemp = Gli_ManCreateCi( p, Abc_ObjFanoutNum(pObj) );
1898 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1899 {
1900 Vec_IntClear( vFanins );
1901 Abc_ObjForEachFanin( pObj, pFanin, k )
1902 Vec_IntPush( vFanins, pFanin->iTemp );
1903 puTruth = Hop_ManConvertAigToTruth( (Hop_Man_t *)pNtk->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj), vTruth, 0 );
1904 pTruth = Vec_WrdEntryP( vTruths, Abc_ObjId(pObj) );
1905 *pTruth = ((word)puTruth[Abc_ObjFaninNum(pObj) == 6] << 32) | (word)puTruth[0];
1906 pObj->iTemp = Gli_ManCreateNode( p, vFanins, Abc_ObjFanoutNum(pObj), pTruth );
1907 }
1908 Abc_NtkForEachCo( pNtk, pObj, i )
1909 Gli_ManCreateCo( p, Abc_ObjFanin0(pObj)->iTemp );
1910
1911 // compute glitching
1912 Gli_ManSwitchesAndGlitches( p, 4000, 1.0/8.0, 0 );
1913
1914 // compute the ratio
1915 nSwitches = nGlitches = 0;
1916 Abc_NtkForEachObj( pNtk, pObj, i )
1917 if ( pObj->iTemp >= 0 )
1918 {
1919 nSwitches += Abc_ObjFanoutNum(pObj) * Gli_ObjNumSwitches(p, pObj->iTemp);
1920 nGlitches += Abc_ObjFanoutNum(pObj) * Gli_ObjNumGlitches(p, pObj->iTemp);
1921 }
1922
1923 Gli_ManStop( p );
1924 Vec_PtrFree( vNodes );
1925 Vec_IntFree( vTruth );
1926 Vec_IntFree( vFanins );
1927 Vec_WrdFree( vTruths );
1928 return nSwitches ? 100.0*(nGlitches-nSwitches)/nSwitches : 0.0;
1929}
1930
1942float Abc_NtkMfsTotalGlitching( Abc_Ntk_t * pNtk, int nPats, int Prob, int fVerbose )
1943{
1944 int nSwitches, nGlitches;
1945 Gli_Man_t * p;
1946 Vec_Ptr_t * vNodes;
1947 Vec_Int_t * vFanins;
1948 Abc_Obj_t * pObj, * pFanin;
1949 int i, k, nFaninMax = Abc_NtkGetFaninMax(pNtk);
1950 if ( !Abc_NtkIsMappedLogic(pNtk) )
1951 return Abc_NtkMfsTotalGlitchingLut( pNtk, nPats, Prob, fVerbose );
1952 assert( Abc_NtkIsMappedLogic(pNtk) );
1953 if ( nFaninMax > 16 )
1954 {
1955 printf( "Abc_NtkMfsTotalGlitching() This procedure works only for mapped networks with LUTs size up to 6 inputs.\n" );
1956 return -1.0;
1957 }
1958 vNodes = Abc_NtkDfs( pNtk, 0 );
1959 vFanins = Vec_IntAlloc( 6 );
1960
1961 // derive network for glitch computation
1962 p = Gli_ManAlloc( Vec_PtrSize(vNodes) + Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk),
1963 Abc_NtkLatchNum(pNtk), Abc_NtkGetTotalFanins(pNtk) + Abc_NtkCoNum(pNtk) );
1964 Abc_NtkForEachObj( pNtk, pObj, i )
1965 pObj->iTemp = -1;
1966 Abc_NtkForEachCi( pNtk, pObj, i )
1967 pObj->iTemp = Gli_ManCreateCi( p, Abc_ObjFanoutNum(pObj) );
1968 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1969 {
1970 Vec_IntClear( vFanins );
1971 Abc_ObjForEachFanin( pObj, pFanin, k )
1972 Vec_IntPush( vFanins, pFanin->iTemp );
1973 pObj->iTemp = Gli_ManCreateNode( p, vFanins, Abc_ObjFanoutNum(pObj), Mio_GateReadTruthP((Mio_Gate_t *)pObj->pData) );
1974 }
1975 Abc_NtkForEachCo( pNtk, pObj, i )
1976 Gli_ManCreateCo( p, Abc_ObjFanin0(pObj)->iTemp );
1977
1978 // compute glitching
1979 Gli_ManSwitchesAndGlitches( p, nPats, 1.0/Prob, fVerbose );
1980
1981 // compute the ratio
1982 nSwitches = nGlitches = 0;
1983 Abc_NtkForEachObj( pNtk, pObj, i )
1984 if ( pObj->iTemp >= 0 )
1985 {
1986 nSwitches += Abc_ObjFanoutNum(pObj) * Gli_ObjNumSwitches(p, pObj->iTemp);
1987 nGlitches += Abc_ObjFanoutNum(pObj) * Gli_ObjNumGlitches(p, pObj->iTemp);
1988 }
1989
1990 Gli_ManStop( p );
1991 Vec_PtrFree( vNodes );
1992 Vec_IntFree( vFanins );
1993 return nSwitches ? 100.0*(nGlitches-nSwitches)/nSwitches : 0.0;
1994}
1995
2008{
2009 // order of cells in the Karnaugh map
2010// int Cells[8] = { 0, 1, 3, 2, 6, 7, 5, 4 };
2011 int Cells[8] = { 0, 4, 6, 2, 3, 7, 5, 1 };
2012 // intermediate variables
2013 int s; // symbol counter
2014 int h; // horizontal coordinate;
2015 int v; // vertical coordinate;
2016 assert( (F0 & F1) == 0 );
2017
2018 // output minterms above
2019 for ( s = 0; s < 4; s++ )
2020 printf( " " );
2021 printf( " " );
2022 for ( h = 0; h < 8; h++ )
2023 {
2024 for ( s = 0; s < 3; s++ )
2025 printf( "%d", ((Cells[h] >> (2-s)) & 1) );
2026 printf( " " );
2027 }
2028 printf( "\n" );
2029
2030 // output horizontal line above
2031 for ( s = 0; s < 4; s++ )
2032 printf( " " );
2033 printf( "+" );
2034 for ( h = 0; h < 8; h++ )
2035 {
2036 for ( s = 0; s < 3; s++ )
2037 printf( "-" );
2038 printf( "+" );
2039 }
2040 printf( "\n" );
2041
2042 // output lines with function values
2043 for ( v = 0; v < 8; v++ )
2044 {
2045 for ( s = 0; s < 3; s++ )
2046 printf( "%d", ((Cells[v] >> (2-s)) & 1) );
2047 printf( " |" );
2048
2049 for ( h = 0; h < 8; h++ )
2050 {
2051 printf( " " );
2052 if ( ((F0 >> ((Cells[v]*8)+Cells[h])) & 1) )
2053 printf( "0" );
2054 else if ( ((F1 >> ((Cells[v]*8)+Cells[h])) & 1) )
2055 printf( "1" );
2056 else
2057 printf( " " );
2058 printf( " |" );
2059 }
2060 printf( "\n" );
2061
2062 // output horizontal line above
2063 for ( s = 0; s < 4; s++ )
2064 printf( " " );
2065// printf( "%c", v == 7 ? '+' : '|' );
2066 printf( "+" );
2067 for ( h = 0; h < 8; h++ )
2068 {
2069 for ( s = 0; s < 3; s++ )
2070 printf( "-" );
2071// printf( "%c", v == 7 ? '+' : '|' );
2072 printf( "%c", (v == 7 || h == 7) ? '+' : '|' );
2073 }
2074 printf( "\n" );
2075 }
2076}
2077
2089void Abc_NtkShow6VarFunc( char * pF0, char * pF1 )
2090{
2091 word F0, F1;
2092 if ( strlen(pF0) != 16 )
2093 {
2094 printf( "Wrong length (%d) of 6-var truth table.\n", (int)strlen(pF0) );
2095 return;
2096 }
2097 if ( strlen(pF1) != 16 )
2098 {
2099 printf( "Wrong length (%d) of 6-var truth table.\n", (int)strlen(pF1) );
2100 return;
2101 }
2102 Extra_ReadHexadecimal( (unsigned *)&F0, pF0, 6 );
2103 Extra_ReadHexadecimal( (unsigned *)&F1, pF1, 6 );
2104 Abc_Show6VarFunc( F0, F1 );
2105}
2106
2107
2111
2112
void Abc_NtkPrintFanioNew(FILE *pFile, Abc_Ntk_t *pNtk, int fMffc)
Definition abcPrint.c:921
int Gli_ObjNumGlitches(Gli_Man_t *p, int iNode)
Definition giaGlitch.c:409
int Gli_ManCreateNode(Gli_Man_t *p, Vec_Int_t *vFanins, int nFanouts, word *pGateTruth)
Definition giaGlitch.c:369
void Abc_NtkPrintLevel(FILE *pFile, Abc_Ntk_t *pNtk, int fProfile, int fListNodes, int fOutputs, int fVerbose)
Definition abcPrint.c:1231
void Abc_NtkInputOutputCounters(Abc_Ntk_t *pNtk, Vec_Int_t *vFan, Vec_Int_t *vFon, Vec_Int_t *vFanR, Vec_Int_t *vFonR)
Definition abcPrint.c:633
double Abc_NtkMemory(Abc_Ntk_t *p)
Definition abcPrint.c:135
void Abc_NtkPrintGates(Abc_Ntk_t *pNtk, int fUseLibrary, int fUpdateProfile)
Definition abcPrint.c:1429
int Abc_NtkCountPis(Vec_Ptr_t *vSupp)
Definition abcPrint.c:1612
Vec_Int_t * Abc_NtkCollectCoSupps(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcPrint.c:659
Vec_Int_t * Abc_NtkCollectCiCones(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcPrint.c:782
void Abc_NtkPrintDistribInternal(FILE *pFile, Abc_Ntk_t *pNtk, char *pFanins, char *pFanouts, char *pNode, char *pFanin, char *pFanout, Vec_Int_t *vFan, Vec_Int_t *vFon, Vec_Int_t *vFanR, Vec_Int_t *vFonR)
Definition abcPrint.c:839
Vec_Int_t * Abc_NtkCollectCoCones(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcPrint.c:753
void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition abcPrint.c:1674
Gli_Man_t * Gli_ManAlloc(int nObjs, int nRegs, int nFanioPairs)
FUNCTION DEFINITIONS ///.
Definition giaGlitch.c:144
abctime s_ResynTime
Definition abcPrint.c:50
float Abc_NtkGetArea(Abc_Ntk_t *pNtk)
Definition abcPrint.c:210
int Abc_NtkCompareAndSaveBest(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcPrint.c:69
Vec_Int_t * Abc_NtkCollectCiSupps(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcPrint.c:689
void Abc_NtkPrintMffc(FILE *pFile, Abc_Ntk_t *pNtk)
Definition abcPrint.c:1080
void Abc_NtkShow6VarFunc(char *pF0, char *pF1)
Definition abcPrint.c:2089
void Abc_NtkPrintStats(Abc_Ntk_t *pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fSkipSmall, int fPrintMem)
Definition abcPrint.c:269
int Gli_ManCreateCo(Gli_Man_t *p, int iFanin)
Definition giaGlitch.c:308
void Abc_NtkPrintFactor(FILE *pFile, Abc_Ntk_t *pNtk, int fUseRealNames)
Definition abcPrint.c:1129
void Abc_NodePrintKMap(Abc_Obj_t *pNode, int fUseRealNames)
Definition abcPrint.c:1401
void Abc_NodePrintFanio(FILE *pFile, Abc_Obj_t *pNode)
Definition abcPrint.c:1048
float Abc_NtkMfsTotalGlitchingLut(Abc_Ntk_t *pNtk, int nPats, int Prob, int fVerbose)
Definition abcPrint.c:1868
void Abc_NtkFaninFanoutCounters(Abc_Ntk_t *pNtk, Vec_Int_t *vFan, Vec_Int_t *vFon, Vec_Int_t *vFanR, Vec_Int_t *vFonR)
Definition abcPrint.c:609
float Abc_NtkGetAreaSpecial2(Abc_Ntk_t *pNtk)
Definition abcPrint.c:246
float Abc_NtkMfsTotalGlitching(Abc_Ntk_t *pNtk, int nPats, int Prob, int fVerbose)
Definition abcPrint.c:1942
void Abc_NtkInOutConeCounters(Abc_Ntk_t *pNtk, Vec_Int_t *vFan, Vec_Int_t *vFon, Vec_Int_t *vFanR, Vec_Int_t *vFonR)
Definition abcPrint.c:811
void Abc_NtkPrintLatch(FILE *pFile, Abc_Ntk_t *pNtk)
Definition abcPrint.c:536
int Gli_ManCreateCi(Gli_Man_t *p, int nFanouts)
Definition giaGlitch.c:288
void Abc_NtkInOutSupportCounters(Abc_Ntk_t *pNtk, Vec_Int_t *vFan, Vec_Int_t *vFon, Vec_Int_t *vFanR, Vec_Int_t *vFonR)
Definition abcPrint.c:725
void Abc_NodePrintLevel(FILE *pFile, Abc_Obj_t *pNode)
Definition abcPrint.c:1358
void Abc_Show6VarFunc(word F0, word F1)
Definition abcPrint.c:2007
void Abc_NtkPrintStrSupports(Abc_Ntk_t *pNtk, int fMatrix)
Definition abcPrint.c:1620
void Abc_NtkPrintSharing(Abc_Ntk_t *pNtk)
Definition abcPrint.c:1563
char * Abc_NodeGetPrintName(Abc_Obj_t *pObj)
Definition abcPrint.c:1220
void Gli_ManStop(Gli_Man_t *p)
Definition giaGlitch.c:170
void Abc_NtkPrintFanio(FILE *pFile, Abc_Ntk_t *pNtk, int fUseFanio, int fUsePio, int fUseSupp, int fUseCone)
Definition abcPrint.c:876
void Abc_NtkPrintIo(FILE *pFile, Abc_Ntk_t *pNtk, int fPrintFlops)
Definition abcPrint.c:499
void Abc_NodePrintFactor(FILE *pFile, Abc_Obj_t *pNode, int fUseRealNames)
Definition abcPrint.c:1101
float Abc_NtkMfsTotalSwitching(Abc_Ntk_t *pNtk)
Definition abcPrint.c:163
void Abc_NodePrintSop(FILE *pFile, Abc_Obj_t *pNode, int fUseRealNames)
Definition abcPrint.c:1149
void Abc_NtkPrintMiter(Abc_Ntk_t *pNtk)
Definition abcPrint.c:1750
void Gli_ManSwitchesAndGlitches(Gli_Man_t *p, int nPatterns, float PiTransProb, int fVerbose)
Definition giaGlitch.c:740
float Abc_NtkGetAreaSpecial(Abc_Ntk_t *pNtk)
Definition abcPrint.c:238
void Abc_NtkPrintPoEquivs(Abc_Ntk_t *pNtk)
Definition abcPrint.c:1813
int Gli_ObjNumSwitches(Gli_Man_t *p, int iNode)
Definition giaGlitch.c:393
void Abc_NtkPrintSop(FILE *pFile, Abc_Ntk_t *pNtk, int fUseRealNames)
Definition abcPrint.c:1200
void Abc_NodeMffcConeSuppPrint(Abc_Obj_t *pNode)
Definition abcRefs.c:321
int Abc_NtkCountMuxes(Abc_Ntk_t *pNtk)
Definition abcUtil.c:1377
int Abc_NtkGetMultiRefNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:225
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
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 int Abc_NtkGetBufNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:423
ABC_DLL int Abc_NtkGetLitNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:172
ABC_DLL int Abc_NtkGetLitFactNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:196
ABC_DLL int Abc_NtkGetFaninMax(Abc_Ntk_t *pNtk)
Definition abcUtil.c:486
ABC_DLL float Abc_NtkDelayTrace(Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
Definition abcTiming.c:1031
ABC_DLL Vec_Ptr_t * Abc_NodeGetFaninNames(Abc_Obj_t *pNode)
Definition abcNames.c:206
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition abcSop.c:724
ABC_DLL int Abc_NodeMffcSize(Abc_Obj_t *pNode)
FUNCTION DEFINITIONS ///.
Definition abcRefs.c:48
#define Abc_NtkForEachNodeNotBarBuf(pNtk, pNode, i)
Definition abc.h:467
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
Definition abcMap.c:804
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
Definition abcFunc.c:865
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition abcNames.c:264
ABC_DLL double Abc_NtkGetMappedArea(Abc_Ntk_t *pNtk)
Definition abcUtil.c:347
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
@ ABC_OBJ_NET
Definition abc.h:93
@ ABC_OBJ_NONE
Definition abc.h:87
@ ABC_OBJ_NODE
Definition abc.h:94
@ ABC_OBJ_BLACKBOX
Definition abc.h:97
@ ABC_OBJ_BI
Definition abc.h:91
@ ABC_OBJ_BO
Definition abc.h:92
@ ABC_OBJ_WHITEBOX
Definition abc.h:96
@ ABC_OBJ_PI
Definition abc.h:89
@ ABC_OBJ_LATCH
Definition abc.h:95
@ ABC_OBJ_PO
Definition abc.h:90
@ ABC_OBJ_CONST1
Definition abc.h:88
ABC_DLL int Abc_SopGetPhase(char *pSop)
Definition abcSop.c:604
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
ABC_DLL int Abc_NtkGetExorNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:383
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL Vec_Ptr_t * Abc_NtkNodeSupport(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition abcDfs.c:890
ABC_DLL float Abc_NtkDelayTraceLut(Abc_Ntk_t *pNtk, int fUseLutLib)
Definition abcSpeedup.c:100
ABC_DLL int Abc_NodeIsConst(Abc_Obj_t *pNode)
Definition abcObj.c:867
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL int Abc_NtkGetBddNodeNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:247
#define Abc_NtkForEachObjReverse(pNtk, pNode, i)
Definition abc.h:452
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:1333
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition abc.h:538
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_DLL int Abc_SopIsInv(char *pSop)
Definition abcSop.c:776
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_AigLevel(Abc_Ntk_t *pNtk)
Definition abcAig.c:292
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
ABC_DLL int Abc_NtkGetAigNodeNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:276
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
Definition abcDfs.c:151
ABC_DLL int Abc_SopIsComplement(char *pSop)
Definition abcSop.c:703
ABC_DLL int Abc_SopIsAndType(char *pSop)
Definition abcSop.c:796
ABC_DLL int Abc_NtkGetLargeNodeNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:443
@ ABC_FUNC_NONE
Definition abc.h:64
ABC_DLL int Abc_SopIsBuf(char *pSop)
Definition abcSop.c:756
ABC_DLL int Abc_SopIsConst1(char *pSop)
Definition abcSop.c:740
ABC_DLL int Abc_NtkGetCubeNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:117
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit, int fCubeSort)
Definition abcFunc.c:866
ABC_DLL void Abc_ManTimeStop(Abc_ManTime_t *p)
Definition abcTiming.c:547
ABC_DLL float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition abcTiming.c:111
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
Definition abcObj.c:916
ABC_DLL int Abc_SopIsOrType(char *pSop)
Definition abcSop.c:820
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition abcUtil.c:520
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
ABC_DLL void * Abc_FrameReadLibLut()
Definition mainFrame.c:57
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Dec_GraphPrint(FILE *pFile, Dec_Graph_t *pGraph, char *pNamesIn[], char *pNameOut)
FUNCTION DEFINITIONS ///.
Definition decPrint.c:49
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
Definition decFactor.c:58
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
Cube * p
Definition exorList.c:222
void Extra_PrintKMap(FILE *pFile, DdManager *dd, DdNode *OnSet, DdNode *OffSet, int nVars, DdNode **XVars, int fSuppType, char **pVarNames)
char * Extra_UtilStrsav(const char *s)
int Extra_ReadHexadecimal(unsigned Sign[], char *pString, int nVars)
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
struct Gli_Man_t_ Gli_Man_t
Definition giaGlitch.c:55
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:711
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition hopTruth.c:143
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
Io_FileType_t
INCLUDES ///.
Definition ioAbc.h:47
@ IO_FILE_BLIF
Definition ioAbc.h:52
void Io_Write(Abc_Ntk_t *pNtk, char *pFileName, Io_FileType_t FileType)
Definition ioUtil.c:320
abctime s_MappingTime
DECLARATIONS ///.
Definition abcPrint.c:47
int s_MappingMem
Definition abcPrint.c:48
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition mioApi.c:177
double Mio_GateReadArea(Mio_Gate_t *pGate)
Definition mioApi.c:171
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition mioApi.c:179
int Mio_GateReadProfile(Mio_Gate_t *pGate)
Definition mioApi.c:185
int Mio_GateReadProfile2(Mio_Gate_t *pGate)
Definition mioApi.c:186
Mio_Gate_t ** Mio_LibraryReadGateArray(Mio_Library_t *pLib)
Definition mioApi.c:47
int Mio_GateReadValue(Mio_Gate_t *pGate)
Definition mioApi.c:183
void Mio_GateSetValue(Mio_Gate_t *pGate, int Value)
Definition mioApi.c:187
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
int Mio_LibraryReadGateNum(Mio_Library_t *pLib)
Definition mioApi.c:45
void Mio_GateIncProfile2(Mio_Gate_t *pGate)
Definition mioApi.c:191
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
void Mio_GateSetProfile2(Mio_Gate_t *pGate, int Prof)
Definition mioApi.c:190
char * Mio_GateReadForm(Mio_Gate_t *pGate)
Definition mioApi.c:172
word * Mio_GateReadTruthP(Mio_Gate_t *pGate)
Definition mioApi.c:182
char * pName
Definition abc.h:158
int nBarBufs
Definition abc.h:174
Abc_Ntk_t * pExdc
Definition abc.h:201
void * pManFunc
Definition abc.h:191
Abc_ManTime_t * pManTime
Definition abc.h:192
char * pSpec
Definition abc.h:159
int nBarBufs2
Definition abc.h:175
void * pData
Definition abc.h:145
Vec_Int_t vFanins
Definition abc.h:143
Abc_Ntk_t * pNtk
Definition abc.h:130
int Id
Definition abc.h:132
int iTemp
Definition abc.h:149
Vec_Int_t vFanouts
Definition abc.h:144
unsigned fMarkA
Definition abc.h:134
unsigned Type
Definition abc.h:133
void * pTemp
Definition abc.h:147
unsigned Level
Definition abc.h:142
int Id
Definition aig.h:85
int LutMax
Definition if.h:190
float pLutAreas[IF_MAX_LUTSIZE+1]
Definition if.h:192
#define assert(ex)
Definition util_old.h:213
int strncmp()
char * memset()
int strlen()
int strcmp()
char * sprintf()
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition vecPtr.h:63
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
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42