ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlcNtk.c File Reference
#include <math.h>
#include "wlc.h"
#include "misc/vec/vecWec.h"
Include dependency graph for wlcNtk.c:

Go to the source code of this file.

Functions

char * Wlc_ObjTypeName (Wlc_Obj_t *p)
 
void Wlc_ManSetDefaultParams (Wlc_Par_t *pPars)
 FUNCTION DEFINITIONS ///.
 
Wlc_Ntk_tWlc_NtkAlloc (char *pName, int nObjsAlloc)
 
void Wlc_ObjSetCi (Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
 
void Wlc_ObjSetCo (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
 
int Wlc_ObjAlloc (Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
 
int Wlc_ObjCreate (Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg, Vec_Int_t *vFanins)
 
char * Wlc_ObjName (Wlc_Ntk_t *p, int iObj)
 
void Wlc_ObjUpdateType (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int Type)
 
void Wlc_ObjAddFanins (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
 
void Wlc_NtkFree (Wlc_Ntk_t *p)
 
int Wlc_NtkMemUsage (Wlc_Ntk_t *p)
 
int Wlc_NtkCreateLevels_ (Wlc_Ntk_t *p)
 
int Wlc_NtkCreateLevelsRev (Wlc_Ntk_t *p)
 
void Wlc_NtkCreateLevels_rec (Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
 
int Wlc_NtkCreateLevels (Wlc_Ntk_t *p)
 
int Wlc_NtkRemapLevels (Wlc_Ntk_t *p, Vec_Int_t *vObjs, int nLevels)
 
void Wlc_NtkCollectStats (Wlc_Ntk_t *p, int nObjs[2][WLC_OBJ_NUMBER])
 
int Wlc_NtkCountRealPis (Wlc_Ntk_t *p)
 
void Wlc_NtkPrintDistribSortOne (Vec_Ptr_t *vTypes, Vec_Ptr_t *vOccurs, int Type)
 
void Wlc_NtkPrintDistrib (Wlc_Ntk_t *p, int fTwoSides, int fVerbose)
 
void Wlc_NtkPrintNode (Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
 
void Wlc_NtkPrintNodeArray (Wlc_Ntk_t *p, Vec_Int_t *vArray)
 
void Wlc_NtkPrintNodes (Wlc_Ntk_t *p, int Type)
 
void Wlc_NtkPrintStats (Wlc_Ntk_t *p, int fDistrib, int fTwoSides, int fVerbose)
 
void Wlc_NtkPrintObjects (Wlc_Ntk_t *p)
 
void Wlc_NtkTransferNames (Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
 
char * Wlc_NtkNewName (Wlc_Ntk_t *p, int iCoId, int fSeq)
 
Vec_Int_tWlc_ReduceMarkedInitVec (Wlc_Ntk_t *p, Vec_Int_t *vInit)
 
char * Wlc_ReduceMarkedInitStr (Wlc_Ntk_t *p, char *pInit)
 
void Wlc_ObjCollectCopyFanins (Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
 
int Wlc_ObjDup (Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
 
void Wlc_NtkDupDfs_rec (Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
 
Wlc_Ntk_tWlc_NtkDupDfsSimple (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_NtkDupDfs (Wlc_Ntk_t *p, int fMarked, int fSeq)
 
Wlc_Ntk_tWlc_NtkDupDfsAbs (Wlc_Ntk_t *p, Vec_Int_t *vPisOld, Vec_Int_t *vPisNew, Vec_Int_t *vFlops)
 
void Wlc_NtkCleanMarks (Wlc_Ntk_t *p)
 
int Wlc_NtkCountMarked (Wlc_Ntk_t *p, int *pnPis, int *pnFos, int *pnAdders, int *pnMults)
 
void Wlc_NtkMarkCone_rec (Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFlops)
 
void Wlc_NtkMarkCone (Wlc_Ntk_t *p, int iCoId, int Range, int fSeq, int fAllPis)
 
void Wlc_NtkProfileCones (Wlc_Ntk_t *p)
 
Wlc_Ntk_tWlc_NtkDupSingleNodes (Wlc_Ntk_t *p)
 
void Wlc_NtkShortNames (Wlc_Ntk_t *p)
 
int Wlc_NtkDcFlopNum (Wlc_Ntk_t *p)
 
void Wlc_NtkSetRefs (Wlc_Ntk_t *p)
 
int Wlc_NtkCountObjBits (Wlc_Ntk_t *p, Vec_Int_t *vPisNew)
 

Function Documentation

◆ Wlc_ManSetDefaultParams()

void Wlc_ManSetDefaultParams ( Wlc_Par_t * pPars)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file wlcNtk.c.

115{
116 memset( pPars, 0, sizeof(Wlc_Par_t) );
117 pPars->nBitsAdd = ABC_INFINITY; // adder bit-width
118 pPars->nBitsMul = ABC_INFINITY; // multiplier bit-widht
119 pPars->nBitsMux = ABC_INFINITY; // MUX bit-width
120 pPars->nBitsFlop = ABC_INFINITY; // flop bit-width
121 pPars->nIterMax = 1000; // the max number of iterations
122 pPars->nLimit = ABC_INFINITY; // the max number of signals
123 pPars->fXorOutput = 1; // XOR outputs of word-level miter
124 pPars->fCheckClauses = 1; // Check clauses in the reloaded trace
125 pPars->fPushClauses = 0; // Push clauses in the reloaded trace
126 pPars->fMFFC = 1; // Refine the entire MFFC of a PPI
127 pPars->fPdra = 0; // Use pdr -nct
128 pPars->fLoadTrace = 1; // Load previous PDR traces
129 pPars->fProofRefine = 0; // Use proof-based refinement
130 pPars->fHybrid = 1; // Use a hybrid of CBR and PBR
131 pPars->fCheckCombUnsat = 0; // Check if ABS becomes comb. unsat
132 pPars->fAbs2 = 0; // Use UFAR style createAbs
133 pPars->fProofUsePPI = 0; // Use PPI values in PBR
134 pPars->fUseBmc3 = 0; // Run BMC3 in parallel
135 pPars->fShrinkAbs = 0; // Shrink Abs with BMC
136 pPars->fShrinkScratch= 0; // Restart pdr from scratch after shrinking
137 pPars->fVerbose = 0; // verbose output`
138 pPars->fPdrVerbose = 0; // show verbose PDR output
139}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
int nBitsAdd
Definition wlc.h:181
int fCheckCombUnsat
Definition wlc.h:195
int fXorOutput
Definition wlc.h:187
int fHybrid
Definition wlc.h:194
int fPdra
Definition wlc.h:191
int fAbs2
Definition wlc.h:196
int fShrinkAbs
Definition wlc.h:199
int fShrinkScratch
Definition wlc.h:200
int nBitsMul
Definition wlc.h:182
int fProofUsePPI
Definition wlc.h:197
int nIterMax
Definition wlc.h:185
int fPdrVerbose
Definition wlc.h:202
int fVerbose
Definition wlc.h:201
int fUseBmc3
Definition wlc.h:198
int nBitsMux
Definition wlc.h:183
int nBitsFlop
Definition wlc.h:184
int fPushClauses
Definition wlc.h:189
int nLimit
Definition wlc.h:186
int fCheckClauses
Definition wlc.h:188
int fLoadTrace
Definition wlc.h:192
int fProofRefine
Definition wlc.h:193
int fMFFC
Definition wlc.h:190
char * memset()
struct Wlc_Par_t_ Wlc_Par_t
Definition wlc.h:178
Here is the call graph for this function:

◆ Wlc_NtkAlloc()

Wlc_Ntk_t * Wlc_NtkAlloc ( char * pName,
int nObjsAlloc )

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

Synopsis [Working with models.]

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file wlcNtk.c.

153{
154 Wlc_Ntk_t * p;
155 p = ABC_CALLOC( Wlc_Ntk_t, 1 );
156 p->pName = pName ? Extra_FileNameGeneric( pName ) : NULL;
157 Vec_IntGrow( &p->vPis, 111 );
158 Vec_IntGrow( &p->vPos, 111 );
159 Vec_IntGrow( &p->vCis, 111 );
160 Vec_IntGrow( &p->vCos, 111 );
161 Vec_IntGrow( &p->vFfs, 111 );
162 p->pMemFanin = Mem_FlexStart();
163 p->nObjsAlloc = nObjsAlloc;
164 p->pObjs = ABC_CALLOC( Wlc_Obj_t, p->nObjsAlloc );
165 p->iObj = 1;
166 return p;
167}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Cube * p
Definition exorList.c:222
char * Extra_FileNameGeneric(char *FileName)
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition wlc.h:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCleanMarks()

void Wlc_NtkCleanMarks ( Wlc_Ntk_t * p)

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

Synopsis [Select the cone of the given output.]

Description []

SideEffects []

SeeAlso []

Definition at line 1135 of file wlcNtk.c.

1136{
1137 Wlc_Obj_t * pObj;
1138 int i;
1139 Wlc_NtkForEachObj( p, pObj, i )
1140 pObj->Mark = 0;
1141}
unsigned Mark
Definition wlc.h:123
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition wlc.h:356
Here is the caller graph for this function:

◆ Wlc_NtkCollectStats()

void Wlc_NtkCollectStats ( Wlc_Ntk_t * p,
int nObjs[2][WLC_OBJ_NUMBER] )

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

Synopsis [Collects statistics for each side of the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 430 of file wlcNtk.c.

431{
432 Wlc_Obj_t * pObj;
433 int n, i;
434 if ( Wlc_NtkPoNum(p) != 2 )
435 return;
436 for ( n = 0; n < 2; n++ )
437 {
438 Wlc_NtkMarkCone( p, n, 1, 1, 0 );
439 Wlc_NtkForEachObj( p, pObj, i )
440 if ( pObj->Mark )
441 nObjs[n][pObj->Type]++;
442 }
444}
unsigned Type
Definition wlc.h:121
void Wlc_NtkCleanMarks(Wlc_Ntk_t *p)
Definition wlcNtk.c:1135
void Wlc_NtkMarkCone(Wlc_Ntk_t *p, int iCoId, int Range, int fSeq, int fAllPis)
Definition wlcNtk.c:1181
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCountMarked()

int Wlc_NtkCountMarked ( Wlc_Ntk_t * p,
int * pnPis,
int * pnFos,
int * pnAdders,
int * pnMults )

Definition at line 1142 of file wlcNtk.c.

1143{
1144 Wlc_Obj_t * pObj;
1145 int i, nNodes = 0;
1146 *pnPis = *pnFos = *pnAdders = *pnMults = 0;
1147 Wlc_NtkForEachObj( p, pObj, i )
1148 {
1149 if ( !pObj->Mark )
1150 continue;
1151 if ( Wlc_ObjIsPi(pObj) )
1152 (*pnPis)++;
1153 else if ( Wlc_ObjIsCi(pObj) )
1154 (*pnFos)++;
1155 else if ( pObj->Mark )
1156 {
1157 nNodes++;
1158 if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB )
1159 (*pnAdders)++;
1160 else if ( pObj->Type == WLC_OBJ_ARI_MULTI )
1161 (*pnMults)++;
1162 }
1163 }
1164 return nNodes;
1165}
@ WLC_OBJ_ARI_MULTI
Definition wlc.h:90
@ WLC_OBJ_ARI_SUB
Definition wlc.h:89
@ WLC_OBJ_ARI_ADD
Definition wlc.h:88
Here is the caller graph for this function:

◆ Wlc_NtkCountObjBits()

int Wlc_NtkCountObjBits ( Wlc_Ntk_t * p,
Vec_Int_t * vPisNew )

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

Synopsis [This procedure simply count the number of PPI bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 1395 of file wlcNtk.c.

1396{
1397 Wlc_Obj_t * pObj;
1398 int i, Count = 0;
1399 Wlc_NtkForEachObjVec( vPisNew, p, pObj, i )
1400 Count += Wlc_ObjRange(pObj);
1401 return Count;
1402}
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition wlc.h:360
Here is the caller graph for this function:

◆ Wlc_NtkCountRealPis()

int Wlc_NtkCountRealPis ( Wlc_Ntk_t * p)

Definition at line 445 of file wlcNtk.c.

446{
447 Wlc_Obj_t * pObj;
448 int i, Count = 0;
449 Wlc_NtkMarkCone( p, -1, -1, 1, 0 );
450 Wlc_NtkForEachPi( p, pObj, i )
451 Count += pObj->Mark;
453 return Count;
454}
#define Wlc_NtkForEachPi(p, pPi, i)
Definition wlc.h:362
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCreateLevels()

int Wlc_NtkCreateLevels ( Wlc_Ntk_t * p)

Definition at line 372 of file wlcNtk.c.

373{
374 Wlc_Obj_t * pObj; int i, LeveMax = 0;
375 Vec_IntFill( &p->vLevels, Wlc_NtkObjNumMax(p), 0 );
376 Wlc_NtkForEachObj( p, pObj, i )
377 Wlc_NtkCreateLevels_rec( p, pObj );
378 Wlc_NtkForEachObj( p, pObj, i )
379 if ( !Wlc_ObjIsCi(pObj) && Wlc_ObjFaninNum(pObj) )
380 Vec_IntAddToEntry( &p->vLevels, i, 1 );
381 LeveMax = Vec_IntFindMax( &p->vLevels );
382 Wlc_NtkForEachFf2( p, pObj, i )
383 Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), LeveMax+1 );
384 //Wlc_NtkPrintObjects( p );
385 return LeveMax+1;
386}
void Wlc_NtkCreateLevels_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:361
#define Wlc_NtkForEachFf2(p, pFf, i)
Definition wlc.h:372
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCreateLevels_()

int Wlc_NtkCreateLevels_ ( Wlc_Ntk_t * p)

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

Synopsis [Assigns object levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file wlcNtk.c.

312{
313 Wlc_Obj_t * pObj;
314 int i, k, iFanin, Level, LevelMax = 0;
315 Vec_IntFill( &p->vLevels, Wlc_NtkObjNumMax(p), 0 );
316 Wlc_NtkForEachObj( p, pObj, i )
317 {
318 Level = 0;
319 Wlc_ObjForEachFanin( pObj, iFanin, k )
320 Level = Abc_MaxInt( Level, Wlc_ObjLevelId(p, iFanin) + 1 );
321 Vec_IntWriteEntry( &p->vLevels, i, Level );
322 LevelMax = Abc_MaxInt( LevelMax, Level );
323 }
324 return LevelMax;
325}
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition wlc.h:375

◆ Wlc_NtkCreateLevels_rec()

void Wlc_NtkCreateLevels_rec ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj )

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

Synopsis [Assigns object levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 361 of file wlcNtk.c.

362{
363 int k, iFanin, Level = 0, iObj = Wlc_ObjId(p, pObj);
364 if ( Wlc_ObjIsCi(pObj) || Wlc_ObjIsFf(p, iObj) || Wlc_ObjFaninNum(pObj) == 0 || Wlc_ObjLevel(p, pObj) > 0 )
365 return;
366 Wlc_ObjForEachFanin( pObj, iFanin, k ) if ( iFanin )
367 Wlc_NtkCreateLevels_rec( p, Wlc_NtkObj(p, iFanin) );
368 Wlc_ObjForEachFanin( pObj, iFanin, k ) if ( iFanin )
369 Level = Abc_MaxInt( Level, Wlc_ObjLevelId(p, iFanin) );
370 Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), Level + 1 );
371}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkCreateLevelsRev()

int Wlc_NtkCreateLevelsRev ( Wlc_Ntk_t * p)

Definition at line 326 of file wlcNtk.c.

327{
328 Wlc_Obj_t * pObj;
329 int i, k, iFanin, Level, LevelMax = 0;
330 Vec_IntFill( &p->vLevels, Wlc_NtkObjNumMax(p), 0 );
331 Wlc_NtkForEachObjReverse( p, pObj, i )
332 {
333 if ( Wlc_ObjIsCi(pObj) )
334 continue;
335 Level = Wlc_ObjLevel(p, pObj) + 1;
336 Wlc_ObjForEachFanin( pObj, iFanin, k )
337 Vec_IntUpdateEntry( &p->vLevels, iFanin, Level );
338 LevelMax = Abc_MaxInt( LevelMax, Level );
339 }
340 // reverse the values
341 Wlc_NtkForEachObj( p, pObj, i )
342 Vec_IntWriteEntry( &p->vLevels, i, LevelMax - Wlc_ObjLevelId(p, i) );
343 Wlc_NtkForEachCi( p, pObj, i )
344 Vec_IntWriteEntry( &p->vLevels, Wlc_ObjId(p, pObj), 0 );
345 //Wlc_NtkForEachObj( p, pObj, i )
346 // printf( "%d -> %d\n", i, Wlc_ObjLevelId(p, i) );
347 return LevelMax;
348}
#define Wlc_NtkForEachObjReverse(p, pObj, i)
Definition wlc.h:358
#define Wlc_NtkForEachCi(p, pCi, i)
Definition wlc.h:366

◆ Wlc_NtkDcFlopNum()

int Wlc_NtkDcFlopNum ( Wlc_Ntk_t * p)

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

Synopsis [Count the number of flops initialized to DC value.]

Description []

SideEffects []

SeeAlso []

Definition at line 1351 of file wlcNtk.c.

1352{
1353 int i, nFlops, Count = 0;
1354 if ( p->pInits == NULL )
1355 return 0;
1356 nFlops = strlen(p->pInits);
1357 for ( i = 0; i < nFlops; i++ )
1358 Count += (p->pInits[i] == 'x' || p->pInits[i] == 'X');
1359 return Count;
1360}
int strlen()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupDfs()

Wlc_Ntk_t * Wlc_NtkDupDfs ( Wlc_Ntk_t * p,
int fMarked,
int fSeq )

Definition at line 986 of file wlcNtk.c.

987{
988 Wlc_Ntk_t * pNew;
989 Wlc_Obj_t * pObj, * pObjNew;
990 Vec_Int_t * vFanins;
991 int i, k, iObj, iFanin;
992 vFanins = Vec_IntAlloc( 100 );
993 Wlc_NtkCleanCopy( p );
994 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
995 pNew->fSmtLib = p->fSmtLib;
996 pNew->fAsyncRst = p->fAsyncRst;
997 pNew->fMemPorts = p->fMemPorts;
998 pNew->fEasyFfs = p->fEasyFfs;
999 Wlc_NtkForEachCi( p, pObj, i )
1000 if ( !fMarked || pObj->Mark )
1001 {
1002 unsigned Type = pObj->Type;
1003 if ( !fSeq ) pObj->Type = WLC_OBJ_PI;
1004 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1005 pObj->Type = Type;
1006 }
1007 Wlc_NtkForEachFf2( p, pObj, i )
1008 {
1009 int iObjNew = Wlc_ObjAlloc( pNew, pObj->Type, Wlc_ObjIsSigned(pObj), pObj->End, pObj->Beg );
1010 Wlc_ObjSetCopy( p, Wlc_ObjId(p, pObj), iObjNew );
1011 Vec_IntPush( &pNew->vFfs2, iObjNew );
1012 }
1013 Wlc_NtkForEachCo( p, pObj, i )
1014 if ( !fMarked || pObj->Mark )
1015 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1016 Wlc_NtkForEachCo( p, pObj, i )
1017 if ( !fMarked || pObj->Mark )
1018 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), fSeq ? pObj->fIsFi : 0 );
1019 Wlc_NtkForEachFf2( p, pObj, i )
1020 {
1021 iObj = Wlc_ObjId(p, pObj);
1022 Wlc_ObjForEachFanin( pObj, iFanin, k )
1023 Wlc_NtkDupDfs_rec( pNew, p, iFanin, vFanins );
1024 Wlc_ObjCollectCopyFanins( p, iObj, vFanins );
1025 pObjNew = Wlc_NtkObj( pNew, Wlc_ObjCopy(p, iObj) );
1026 Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
1027 pObjNew->fXConst = pObj->fXConst;
1028 }
1029 Vec_IntFree( vFanins );
1030 if ( fSeq && p->vInits )
1031 {
1032 if ( fMarked )
1033 {
1034 if ( p->vInits )
1035 pNew->vInits = Wlc_ReduceMarkedInitVec( p, p->vInits );
1036 if ( p->pInits )
1037 pNew->pInits = Wlc_ReduceMarkedInitStr( p, p->pInits );
1038 }
1039 else
1040 {
1041 if ( p->vInits )
1042 pNew->vInits = Vec_IntDup( p->vInits );
1043 if ( p->pInits )
1044 pNew->pInits = Abc_UtilStrsav( p->pInits );
1045 }
1046 }
1047 if ( p->pSpec )
1048 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1049 if ( Wlc_NtkHasNameId(p) )
1050 Wlc_NtkTransferNames( pNew, p );
1051 if ( Vec_IntSize(&p->vPoPairs) )
1052 Vec_IntAppend( &pNew->vPoPairs, &p->vPoPairs );
1053 return pNew;
1054}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int fAsyncRst
Definition wlc.h:152
char * pSpec
Definition wlc.h:139
char * pInits
Definition wlc.h:148
int fSmtLib
Definition wlc.h:151
Vec_Int_t vFfs2
Definition wlc.h:145
int fEasyFfs
Definition wlc.h:154
int fMemPorts
Definition wlc.h:153
Vec_Int_t * vInits
Definition wlc.h:147
Vec_Int_t vPoPairs
Definition wlc.h:175
int End
Definition wlc.h:129
unsigned fIsFi
Definition wlc.h:126
unsigned fXConst
Definition wlc.h:127
int Beg
Definition wlc.h:130
void Wlc_NtkTransferNames(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
Definition wlcNtk.c:830
void Wlc_NtkDupDfs_rec(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:941
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
Definition wlcNtk.c:199
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
Definition wlcNtk.c:188
Vec_Int_t * Wlc_ReduceMarkedInitVec(Wlc_Ntk_t *p, Vec_Int_t *vInit)
Definition wlcNtk.c:865
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
Definition wlcNtk.c:152
int Wlc_ObjDup(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:930
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:240
void Wlc_ObjCollectCopyFanins(Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition wlcNtk.c:904
char * Wlc_ReduceMarkedInitStr(Wlc_Ntk_t *p, char *pInit)
Definition wlcNtk.c:876
@ WLC_OBJ_PI
Definition wlc.h:46
#define Wlc_NtkForEachCo(p, pCo, i)
Definition wlc.h:368
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupDfs_rec()

void Wlc_NtkDupDfs_rec ( Wlc_Ntk_t * pNew,
Wlc_Ntk_t * p,
int iObj,
Vec_Int_t * vFanins )

Definition at line 941 of file wlcNtk.c.

942{
943 Wlc_Obj_t * pObj;
944 int i, iFanin;
945 if ( iObj == 0 )
946 return;
947 if ( Wlc_ObjCopy(p, iObj) )
948 return;
949 pObj = Wlc_NtkObj( p, iObj );
950 //printf( "Visiting node %16s (ID %6d) of type %5s (type ID %2d)\n", Wlc_ObjName(p, iObj), iObj, Wlc_ObjTypeName(pObj), Wlc_NtkObj(p, iObj)->Type );
951 assert( pObj->Type != WLC_OBJ_FF );
952 Wlc_ObjForEachFanin( pObj, iFanin, i )
953 Wlc_NtkDupDfs_rec( pNew, p, iFanin, vFanins );
954 Wlc_ObjDup( pNew, p, iObj, vFanins );
955}
#define assert(ex)
Definition util_old.h:213
@ WLC_OBJ_FF
Definition wlc.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupDfsAbs()

Wlc_Ntk_t * Wlc_NtkDupDfsAbs ( Wlc_Ntk_t * p,
Vec_Int_t * vPisOld,
Vec_Int_t * vPisNew,
Vec_Int_t * vFlops )

Definition at line 1055 of file wlcNtk.c.

1056{
1057 Wlc_Ntk_t * pNew;
1058 Wlc_Obj_t * pObj;
1059 Vec_Int_t * vFanins;
1060 int i;
1061 Wlc_NtkCleanCopy( p );
1062 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
1063 pNew->fSmtLib = p->fSmtLib;
1064 pNew->fAsyncRst = p->fAsyncRst;
1065 pNew->fMemPorts = p->fMemPorts;
1066 pNew->fEasyFfs = p->fEasyFfs;
1067
1068 // duplicate marked PIs
1069 vFanins = Vec_IntAlloc( 100 );
1070 Wlc_NtkForEachObjVec( vPisOld, p, pObj, i )
1071 {
1072 assert( Wlc_ObjIsPi(pObj) );
1073 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1074 }
1075 // duplicate additional PIs
1076 Wlc_NtkForEachObjVec( vPisNew, p, pObj, i )
1077 {
1078 unsigned Type = pObj->Type;
1079 int nFanins = Wlc_ObjFaninNum(pObj);
1080 assert( !Wlc_ObjIsPi(pObj) );
1081 pObj->Type = WLC_OBJ_PI;
1082 pObj->nFanins = 0;
1083 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1084 pObj->Type = Type;
1085 pObj->nFanins = (unsigned)nFanins;
1086 }
1087 // duplicate flop outputs
1088 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1089 {
1090 assert( !Wlc_ObjIsPi(pObj) && Wlc_ObjIsCi(pObj) );
1091 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1092 }
1093
1094 // duplicate logic cones of primary outputs
1095 Wlc_NtkForEachPo( p, pObj, i )
1096 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
1097 // duplidate logic cone of flop inputs
1098 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1099 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, Wlc_ObjFo2Fi(p, pObj)), vFanins );
1100
1101 // duplicate POs
1102 Wlc_NtkForEachPo( p, pObj, i )
1103 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), 0 );
1104 // duplicate flop inputs
1105 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1106 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, Wlc_ObjFo2Fi(p, pObj)), 1 );
1107 Vec_IntFree( vFanins );
1108
1109 // mark flop outputs
1110 Wlc_NtkForEachObjVec( vFlops, p, pObj, i )
1111 pObj->Mark = 1;
1112 if ( p->vInits )
1113 pNew->vInits = Wlc_ReduceMarkedInitVec( p, p->vInits );
1114 if ( p->pInits )
1115 pNew->pInits = Wlc_ReduceMarkedInitStr( p, p->pInits );
1117
1118 if ( p->pSpec )
1119 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1120 //Wlc_NtkTransferNames( pNew, p );
1121 return pNew;
1122}
unsigned nFanins
Definition wlc.h:128
#define Wlc_NtkForEachPo(p, pPo, i)
Definition wlc.h:364
Here is the call graph for this function:

◆ Wlc_NtkDupDfsSimple()

Wlc_Ntk_t * Wlc_NtkDupDfsSimple ( Wlc_Ntk_t * p)

Definition at line 957 of file wlcNtk.c.

958{
959 Wlc_Ntk_t * pNew;
960 Wlc_Obj_t * pObj;
961 Vec_Int_t * vFanins;
962 int i;
963 Wlc_NtkCleanCopy( p );
964 vFanins = Vec_IntAlloc( 100 );
965 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
966 pNew->fSmtLib = p->fSmtLib;
967 pNew->fAsyncRst = p->fAsyncRst;
968 pNew->fMemPorts = p->fMemPorts;
969 pNew->fEasyFfs = p->fEasyFfs;
970 Wlc_NtkForEachCi( p, pObj, i )
971 Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
972 Wlc_NtkForEachCo( p, pObj, i )
973 Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
974 Wlc_NtkForEachCo( p, pObj, i )
975 Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
976 if ( p->vInits )
977 pNew->vInits = Vec_IntDup( p->vInits );
978 if ( p->pInits )
979 pNew->pInits = Abc_UtilStrsav( p->pInits );
980 Vec_IntFree( vFanins );
981 if ( p->pSpec )
982 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
983 return pNew;
984}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkDupSingleNodes()

Wlc_Ntk_t * Wlc_NtkDupSingleNodes ( Wlc_Ntk_t * p)

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

Synopsis [Duplicates the network by copying each node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1232 of file wlcNtk.c.

1233{
1234 Wlc_Ntk_t * pNew;
1235 Vec_Int_t * vFanins;
1236 Wlc_Obj_t * pObj, * pObjNew;
1237 Wlc_Obj_t * pFanin, * pFaninNew;
1238 int i, k, iFanin, iFaninNew, iObjNew, Count = 0;
1239 // count objects
1240 Wlc_NtkForEachObj( p, pObj, i )
1241 if ( !Wlc_ObjIsCi(pObj) )
1242 Count += 1 + Wlc_ObjFaninNum(pObj);
1243 // copy objects
1244 Wlc_NtkCleanCopy( p );
1245 vFanins = Vec_IntAlloc( 100 );
1246 pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
1247 pNew->fSmtLib = p->fSmtLib;
1248 pNew->fAsyncRst = p->fAsyncRst;
1249 pNew->fMemPorts = p->fMemPorts;
1250 pNew->fEasyFfs = p->fEasyFfs;
1251 Wlc_NtkForEachObj( p, pObj, i )
1252 {
1253 if ( Wlc_ObjIsCi(pObj) )
1254 continue;
1255 if ( pObj->Type == WLC_OBJ_ARI_MULTI )
1256 continue;
1257 if ( pObj->Type == WLC_OBJ_MUX && Wlc_ObjFaninNum(pObj) > 3 )
1258 continue;
1259 // create CIs for the fanins
1260 Wlc_ObjForEachFanin( pObj, iFanin, k )
1261 {
1262 pFanin = Wlc_NtkObj(p, iFanin);
1263 iFaninNew = Wlc_ObjAlloc( pNew, WLC_OBJ_PI, pFanin->Signed, pFanin->End, pFanin->Beg );
1264 pFaninNew = Wlc_NtkObj(pNew, iFaninNew);
1265 Wlc_ObjSetCopy( p, iFanin, iFaninNew );
1266 //Wlc_ObjSetCi( pNew, pFaninNew );
1267 }
1268 // create object
1269 iObjNew = Wlc_ObjDup( pNew, p, i, vFanins );
1270 pObjNew = Wlc_NtkObj(pNew, iObjNew);
1271 pObjNew->fIsPo = 1;
1272 Vec_IntPush( &pNew->vPos, iObjNew );
1273 }
1274 Vec_IntFree( vFanins );
1275 Wlc_NtkTransferNames( pNew, p );
1276 if ( p->pSpec )
1277 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1278 return pNew;
1279}
Vec_Int_t vPos
Definition wlc.h:141
unsigned fIsPo
Definition wlc.h:125
unsigned Signed
Definition wlc.h:122
@ WLC_OBJ_MUX
Definition wlc.h:53
Here is the call graph for this function:

◆ Wlc_NtkFree()

void Wlc_NtkFree ( Wlc_Ntk_t * p)

Definition at line 253 of file wlcNtk.c.

254{
255 if ( p->pManName )
256 Abc_NamStop( p->pManName );
257 if ( p->pMemFanin )
258 Mem_FlexStop( p->pMemFanin, 0 );
259 if ( p->pMemTable )
260 Mem_FlexStop( p->pMemTable, 0 );
261 ABC_FREE( p->vPoPairs.pArray );
262 Vec_PtrFreeP( &p->vTables );
263 Vec_WrdFreeP( &p->vLutTruths );
264 ABC_FREE( p->vPis.pArray );
265 ABC_FREE( p->vPos.pArray );
266 ABC_FREE( p->vCis.pArray );
267 ABC_FREE( p->vCos.pArray );
268 ABC_FREE( p->vFfs.pArray );
269 ABC_FREE( p->vFfs2.pArray );
270 Vec_IntFreeP( &p->vInits );
271 Vec_IntFreeP( &p->vArsts );
272 ABC_FREE( p->vTravIds.pArray );
273 ABC_FREE( p->vNameIds.pArray );
274 ABC_FREE( p->vValues.pArray );
275 ABC_FREE( p->vCopies.pArray );
276 ABC_FREE( p->vBits.pArray );
277 ABC_FREE( p->vLevels.pArray );
278 ABC_FREE( p->vRefs.pArray );
279 ABC_FREE( p->pInits );
280 ABC_FREE( p->pObjs );
281 ABC_FREE( p->pName );
282 ABC_FREE( p->pSpec );
283 ABC_FREE( p );
284}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
void Abc_NamStop(Abc_Nam_t *p)
Definition utilNam.c:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkMarkCone()

void Wlc_NtkMarkCone ( Wlc_Ntk_t * p,
int iCoId,
int Range,
int fSeq,
int fAllPis )

Definition at line 1181 of file wlcNtk.c.

1182{
1183 Vec_Int_t * vFlops;
1184 Wlc_Obj_t * pObj;
1185 int i, CiId, CoId;
1187 if ( fAllPis )
1188 Wlc_NtkForEachPi( p, pObj, i )
1189 pObj->Mark = 1;
1190 vFlops = Vec_IntAlloc( 100 );
1191 Wlc_NtkForEachCo( p, pObj, i )
1192 if ( iCoId == -1 || (i >= iCoId && i < iCoId + Range) )
1193 Wlc_NtkMarkCone_rec( p, pObj, vFlops );
1194 if ( fSeq )
1195 Vec_IntForEachEntry( vFlops, CiId, i )
1196 {
1197 CoId = Wlc_NtkPoNum(p) + CiId - Wlc_NtkPiNum(p);
1198 Wlc_NtkMarkCone_rec( p, Wlc_NtkCo(p, CoId), vFlops );
1199 }
1200 Vec_IntFree( vFlops );
1201}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
void Wlc_NtkMarkCone_rec(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFlops)
Definition wlcNtk.c:1166
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkMarkCone_rec()

void Wlc_NtkMarkCone_rec ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
Vec_Int_t * vFlops )

Definition at line 1166 of file wlcNtk.c.

1167{
1168 int i, iFanin;
1169 if ( pObj->Mark )
1170 return;
1171 pObj->Mark = 1;
1172 if ( Wlc_ObjIsCi(pObj) )
1173 {
1174 if ( !Wlc_ObjIsPi(pObj) )
1175 Vec_IntPush( vFlops, Wlc_ObjCiId(pObj) );
1176 return;
1177 }
1178 Wlc_ObjForEachFanin( pObj, iFanin, i ) if ( iFanin )
1179 Wlc_NtkMarkCone_rec( p, Wlc_NtkObj(p, iFanin), vFlops );
1180}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkMemUsage()

int Wlc_NtkMemUsage ( Wlc_Ntk_t * p)

Definition at line 285 of file wlcNtk.c.

286{
287 int Mem = sizeof(Wlc_Ntk_t);
288 Mem += 4 * p->vPis.nCap;
289 Mem += 4 * p->vPos.nCap;
290 Mem += 4 * p->vCis.nCap;
291 Mem += 4 * p->vCos.nCap;
292 Mem += 4 * p->vFfs.nCap;
293 Mem += 4 * p->vFfs2.nCap;
294 Mem += sizeof(Wlc_Obj_t) * p->nObjsAlloc;
295 Mem += Abc_NamMemUsed(p->pManName);
296 Mem += Mem_FlexReadMemUsage(p->pMemFanin);
297 return Mem;
298}
int Mem_FlexReadMemUsage(Mem_Flex_t *p)
Definition mem.c:461
int Abc_NamMemUsed(Abc_Nam_t *p)
Definition utilNam.c:247
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkNewName()

char * Wlc_NtkNewName ( Wlc_Ntk_t * p,
int iCoId,
int fSeq )

Definition at line 847 of file wlcNtk.c.

848{
849 static char pBuffer[1000];
850 sprintf( pBuffer, "%s_o%d_%s", p->pName, iCoId, fSeq ? "seq": "comb" );
851 return pBuffer;
852}
char * sprintf()
Here is the call graph for this function:

◆ Wlc_NtkPrintDistrib()

void Wlc_NtkPrintDistrib ( Wlc_Ntk_t * p,
int fTwoSides,
int fVerbose )

Definition at line 510 of file wlcNtk.c.

511{
512 int nObjs[2][WLC_OBJ_NUMBER] = {{0}}; // counter of objects of each type
513 Wlc_Obj_t * pObj, * pObjRange = NULL; int nCountRange = 0;
514 Vec_Ptr_t * vTypes, * vOccurs;
515 Vec_Int_t * vAnds = Vec_IntStart( WLC_OBJ_NUMBER );
516 word Sign = 0;
517 int i, k, s, s0, s1;
518 if ( Wlc_NtkPoNum(p) != 2 )
519 fTwoSides = 0;
520 if ( fTwoSides )
521 Wlc_NtkCollectStats( p, nObjs );
522 // allocate statistics arrays
523 vTypes = Vec_PtrStart( WLC_OBJ_NUMBER );
524 vOccurs = Vec_PtrStart( WLC_OBJ_NUMBER );
525 for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
526 Vec_PtrWriteEntry( vTypes, i, Vec_WrdAlloc(16) );
527 for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
528 Vec_PtrWriteEntry( vOccurs, i, Vec_WrdAlloc(16) );
529 // add nodes
530 Wlc_NtkForEachObj( p, pObj, i )
531 {
532// char * pName = Wlc_ObjName(p, i);
533 if ( Wlc_ObjSign(pObj) > 0x1FFFFF )
534 printf( "Object %6d has range %d, which is reduced to %d in the statistics.\n",
535 i, Wlc_ObjRange(pObj), Wlc_ObjRange(pObj) & 0xFFFFF );
536 if ( pObj->Beg )
537 {
538 if ( pObjRange == NULL )
539 pObjRange = pObj;
540 nCountRange++;
541 }
542 // 0-input types
543 if ( Wlc_ObjIsCi(pObj) || pObj->Type == WLC_OBJ_CONST || pObj->Type == WLC_OBJ_BIT_CONCAT )
544 Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), 0, 0 );
545 // 1-input types
546 else if ( pObj->Type == WLC_OBJ_BUF || pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE ||
547 pObj->Type == WLC_OBJ_BIT_ZEROPAD || pObj->Type == WLC_OBJ_BIT_SIGNEXT ||
548 pObj->Type == WLC_OBJ_BIT_NOT || pObj->Type == WLC_OBJ_LOGIC_NOT || pObj->Type == WLC_OBJ_ARI_MINUS )
549 Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), Wlc_ObjSign(Wlc_ObjFanin0(p, pObj)), 0 );
550 // 2-input types (including MUX)
551 else if ( Wlc_ObjFaninNum(pObj) == 0 )
552 printf( "Object %d with name \"%s\" has type 0. Looks like it was declared by not defined...\n", i, Wlc_ObjName(p, i) );
553 else if ( Wlc_ObjFaninNum(pObj) == 1 )
554 Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), Wlc_ObjSign(Wlc_ObjFanin0(p, pObj)), 0 );
555 else
556 {
557 assert( Wlc_ObjFaninNum(pObj) >= 2 );
558 Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), Wlc_ObjFaninId(pObj, 0) ? Wlc_ObjSign(Wlc_ObjFanin0(p, pObj)) : 0, Wlc_ObjFaninId(pObj, 1) ? Wlc_ObjSign(Wlc_ObjFanin1(p, pObj)) : 0 );
559 }
560 // add to storage
561 Wlc_NtkPrintDistribAddOne( vTypes, vOccurs, pObj->Type, Sign );
562 // count the number of AIG nodes
563 if ( pObj->Type == WLC_OBJ_MUX )
564 Vec_IntAddToEntry( vAnds, WLC_OBJ_MUX, 3 * Wlc_ObjRange(pObj) * (Wlc_ObjFaninNum(pObj) - 2) );
565 else if ( pObj->Type == WLC_OBJ_SHIFT_R )
566 Vec_IntAddToEntry( vAnds, WLC_OBJ_SHIFT_R, Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
567 else if ( pObj->Type == WLC_OBJ_SHIFT_RA )
568 Vec_IntAddToEntry( vAnds, WLC_OBJ_SHIFT_RA, Wlc_ObjRange(pObj) * Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
569 else if ( pObj->Type == WLC_OBJ_SHIFT_L )
570 Vec_IntAddToEntry( vAnds, WLC_OBJ_SHIFT_L, Wlc_ObjRange(pObj) * Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
571 else if ( pObj->Type == WLC_OBJ_SHIFT_LA )
572 Vec_IntAddToEntry( vAnds, WLC_OBJ_SHIFT_LA, Wlc_ObjRange(pObj) * Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
573 else if ( pObj->Type == WLC_OBJ_ROTATE_R )
574 Vec_IntAddToEntry( vAnds, WLC_OBJ_ROTATE_R, Wlc_ObjRange(pObj) * Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
575 else if ( pObj->Type == WLC_OBJ_ROTATE_L )
576 Vec_IntAddToEntry( vAnds, WLC_OBJ_ROTATE_L, Wlc_ObjRange(pObj) * Abc_MinInt(Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Abc_Base2Log(Wlc_ObjRange(pObj))) * 3 );
577 else if ( pObj->Type == WLC_OBJ_BIT_NOT )
578 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_NOT, 0 );
579 else if ( pObj->Type == WLC_OBJ_BIT_AND )
580 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_AND, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
581 else if ( pObj->Type == WLC_OBJ_BIT_OR )
582 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_OR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
583 else if ( pObj->Type == WLC_OBJ_BIT_XOR )
584 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_XOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
585 else if ( pObj->Type == WLC_OBJ_BIT_NAND )
586 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_NAND, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
587 else if ( pObj->Type == WLC_OBJ_BIT_NOR )
588 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_NOR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
589 else if ( pObj->Type == WLC_OBJ_BIT_NXOR )
590 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_NXOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
591 else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
592 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_SELECT, 0 );
593 else if ( pObj->Type == WLC_OBJ_BIT_CONCAT )
594 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_CONCAT, 0 );
595 else if ( pObj->Type == WLC_OBJ_BIT_ZEROPAD )
596 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_ZEROPAD, 0 );
597 else if ( pObj->Type == WLC_OBJ_BIT_SIGNEXT )
598 Vec_IntAddToEntry( vAnds, WLC_OBJ_BIT_SIGNEXT, 0 );
599 else if ( pObj->Type == WLC_OBJ_LOGIC_NOT )
600 Vec_IntAddToEntry( vAnds, WLC_OBJ_LOGIC_NOT, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
601 else if ( pObj->Type == WLC_OBJ_LOGIC_IMPL )
602 Vec_IntAddToEntry( vAnds, WLC_OBJ_LOGIC_IMPL, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) + Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) - 1 );
603 else if ( pObj->Type == WLC_OBJ_LOGIC_AND )
604 Vec_IntAddToEntry( vAnds, WLC_OBJ_LOGIC_AND, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) + Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) - 1 );
605 else if ( pObj->Type == WLC_OBJ_LOGIC_OR )
606 Vec_IntAddToEntry( vAnds, WLC_OBJ_LOGIC_OR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) + Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) - 1 );
607 else if ( pObj->Type == WLC_OBJ_LOGIC_XOR )
608 Vec_IntAddToEntry( vAnds, WLC_OBJ_LOGIC_XOR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) + Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) + 1 );
609 else if ( pObj->Type == WLC_OBJ_COMP_EQU )
610 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_EQU, 4 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
611 else if ( pObj->Type == WLC_OBJ_COMP_NOTEQU )
612 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_NOTEQU, 4 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
613 else if ( pObj->Type == WLC_OBJ_COMP_LESS )
614 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_LESS, 6 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 6 );
615 else if ( pObj->Type == WLC_OBJ_COMP_MORE )
616 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_MORE, 6 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 6 );
617 else if ( pObj->Type == WLC_OBJ_COMP_LESSEQU )
618 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_LESSEQU, 6 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 6 );
619 else if ( pObj->Type == WLC_OBJ_COMP_MOREEQU )
620 Vec_IntAddToEntry( vAnds, WLC_OBJ_COMP_MOREEQU, 6 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 6 );
621 else if ( pObj->Type == WLC_OBJ_REDUCT_AND )
622 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_AND, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
623 else if ( pObj->Type == WLC_OBJ_REDUCT_OR )
624 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_OR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
625 else if ( pObj->Type == WLC_OBJ_REDUCT_XOR )
626 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_XOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 3 );
627 else if ( pObj->Type == WLC_OBJ_REDUCT_NAND )
628 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_NAND, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
629 else if ( pObj->Type == WLC_OBJ_REDUCT_NOR )
630 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_NOR, Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 1 );
631 else if ( pObj->Type == WLC_OBJ_REDUCT_NXOR )
632 Vec_IntAddToEntry( vAnds, WLC_OBJ_REDUCT_NXOR, 3 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 3 );
633 else if ( pObj->Type == WLC_OBJ_ARI_ADD )
634 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_ADD, 9 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
635 else if ( pObj->Type == WLC_OBJ_ARI_SUB )
636 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_SUB, 9 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
637 else if ( pObj->Type == WLC_OBJ_ARI_MULTI )
638 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_MULTI, 9 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) );
639 else if ( pObj->Type == WLC_OBJ_ARI_DIVIDE )
640 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_DIVIDE, 13 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 19 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) + 10 );
641 else if ( pObj->Type == WLC_OBJ_ARI_REM )
642 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_REM, 13 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 7 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 2 );
643 else if ( pObj->Type == WLC_OBJ_ARI_MODULUS )
644 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_MODULUS, 13 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 7 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) - 2 );
645 else if ( pObj->Type == WLC_OBJ_ARI_POWER )
646 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_POWER, 10 * (int)pow((double)Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)),(double)Wlc_ObjRange(Wlc_ObjFanin0(p, pObj))) );
647 else if ( pObj->Type == WLC_OBJ_ARI_MINUS )
648 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_MINUS, 4 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) );
649 else if ( pObj->Type == WLC_OBJ_ARI_SQRT )
650 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_SQRT, 11 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) / 8 + 5 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) / 2 - 5 );
651 else if ( pObj->Type == WLC_OBJ_ARI_SQUARE )
652 Vec_IntAddToEntry( vAnds, WLC_OBJ_ARI_SQUARE, 5 * Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)) * Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)) );
653 }
654 if ( nCountRange && Vec_IntSize(&p->vNameIds) > 0 )
655 {
656 printf( "Warning: %d objects of the design have non-zero-based ranges.\n", nCountRange );
657 printf( "In particular, object %6d with name \"%s\" has range %d=[%d:%d]\n", Wlc_ObjId(p, pObjRange),
658 Abc_NamStr(p->pManName, Wlc_ObjNameId(p, Wlc_ObjId(p, pObjRange))), Wlc_ObjRange(pObjRange), pObjRange->End, pObjRange->Beg );
659 }
660 // print by occurrence
661 printf( "ID : name occurrence%s and2 (occurrence)<output_range>=<input_range>.<input_range> ...\n", fTwoSides ? " Left Share Right":"" );
662 for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
663 {
664 Vec_Wrd_t * vType = (Vec_Wrd_t *)Vec_PtrEntry( vTypes, i );
665 Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, i );
666 if ( p->nObjs[i] == 0 )
667 continue;
668 printf( "%2d : %-8s %6d", i, Wlc_Names[i], p->nObjs[i] );
669 if ( fTwoSides )
670 {
671 int nTotal = i == WLC_OBJ_PI ? Wlc_NtkCountRealPis(p) : p->nObjs[i];
672 printf( " " );
673 printf( "%6d", nObjs[0][i] );
674 printf( "%6d", nObjs[0][i]+nObjs[1][i]-nTotal );
675 printf( "%6d", nObjs[1][i] );
676 }
677 printf( "%8d ", Vec_IntEntry(vAnds, i) );
678 // sort by occurence
679 Wlc_NtkPrintDistribSortOne( vTypes, vOccurs, i );
680 Vec_WrdForEachEntry( vType, Sign, k )
681 {
682 Wlc_NtkPrintDistribFromSign( Sign, &s, &s0, &s1 );
683 if ( ((k % 6) == 5 && s1) || ((k % 8) == 7 && !s1) )
684 {
685 printf( "\n " );
686 if ( fTwoSides )
687 printf( " " );
688 }
689 printf( "(%d)", (int)Vec_WrdEntry( vOccur, k ) );
690 printf( "%s%d", Abc_LitIsCompl(s)?"-":"", Abc_Lit2Var(s) );
691 if ( s0 )
692 printf( "=%s%d", Abc_LitIsCompl(s0)?"-":"", Abc_Lit2Var(s0) );
693 if ( s1 )
694 printf( ".%s%d", Abc_LitIsCompl(s1)?"-":"", Abc_Lit2Var(s1) );
695 printf( " " );
696 }
697 printf( "\n" );
698 }
699 Vec_VecFree( (Vec_Vec_t *)vTypes );
700 Vec_VecFree( (Vec_Vec_t *)vOccurs );
701 Vec_IntFree( vAnds );
702}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition utilNam.c:555
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecWrd.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
void Wlc_NtkCollectStats(Wlc_Ntk_t *p, int nObjs[2][WLC_OBJ_NUMBER])
Definition wlcNtk.c:430
int Wlc_NtkCountRealPis(Wlc_Ntk_t *p)
Definition wlcNtk.c:445
void Wlc_NtkPrintDistribSortOne(Vec_Ptr_t *vTypes, Vec_Ptr_t *vOccurs, int Type)
Definition wlcNtk.c:502
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition wlcNtk.c:225
@ WLC_OBJ_BIT_SIGNEXT
Definition wlc.h:70
@ WLC_OBJ_COMP_LESSEQU
Definition wlc.h:80
@ WLC_OBJ_LOGIC_XOR
Definition wlc.h:75
@ WLC_OBJ_SHIFT_LA
Definition wlc.h:57
@ WLC_OBJ_BIT_ZEROPAD
Definition wlc.h:69
@ WLC_OBJ_COMP_MOREEQU
Definition wlc.h:81
@ WLC_OBJ_BUF
Definition wlc.h:52
@ WLC_OBJ_COMP_MORE
Definition wlc.h:79
@ WLC_OBJ_REDUCT_AND
Definition wlc.h:82
@ WLC_OBJ_ARI_POWER
Definition wlc.h:94
@ WLC_OBJ_ARI_REM
Definition wlc.h:92
@ WLC_OBJ_LOGIC_OR
Definition wlc.h:74
@ WLC_OBJ_LOGIC_AND
Definition wlc.h:73
@ WLC_OBJ_NUMBER
Definition wlc.h:105
@ WLC_OBJ_COMP_LESS
Definition wlc.h:78
@ WLC_OBJ_ARI_SQUARE
Definition wlc.h:97
@ WLC_OBJ_REDUCT_NOR
Definition wlc.h:86
@ WLC_OBJ_BIT_NOT
Definition wlc.h:60
@ WLC_OBJ_SHIFT_R
Definition wlc.h:54
@ WLC_OBJ_TABLE
Definition wlc.h:98
@ WLC_OBJ_BIT_AND
Definition wlc.h:61
@ WLC_OBJ_CONST
Definition wlc.h:51
@ WLC_OBJ_ARI_DIVIDE
Definition wlc.h:91
@ WLC_OBJ_REDUCT_NAND
Definition wlc.h:85
@ WLC_OBJ_BIT_SELECT
Definition wlc.h:67
@ WLC_OBJ_REDUCT_OR
Definition wlc.h:83
@ WLC_OBJ_BIT_NAND
Definition wlc.h:64
@ WLC_OBJ_LOGIC_NOT
Definition wlc.h:71
@ WLC_OBJ_COMP_NOTEQU
Definition wlc.h:77
@ WLC_OBJ_REDUCT_XOR
Definition wlc.h:84
@ WLC_OBJ_BIT_NOR
Definition wlc.h:65
@ WLC_OBJ_BIT_CONCAT
Definition wlc.h:68
@ WLC_OBJ_BIT_OR
Definition wlc.h:62
@ WLC_OBJ_BIT_XOR
Definition wlc.h:63
@ WLC_OBJ_ARI_MINUS
Definition wlc.h:95
@ WLC_OBJ_ARI_MODULUS
Definition wlc.h:93
@ WLC_OBJ_COMP_EQU
Definition wlc.h:76
@ WLC_OBJ_ARI_SQRT
Definition wlc.h:96
@ WLC_OBJ_LOGIC_IMPL
Definition wlc.h:72
@ WLC_OBJ_SHIFT_L
Definition wlc.h:56
@ WLC_OBJ_REDUCT_NXOR
Definition wlc.h:87
@ WLC_OBJ_BIT_NXOR
Definition wlc.h:66
@ WLC_OBJ_ROTATE_L
Definition wlc.h:59
@ WLC_OBJ_SHIFT_RA
Definition wlc.h:55
@ WLC_OBJ_ROTATE_R
Definition wlc.h:58
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkPrintDistribSortOne()

void Wlc_NtkPrintDistribSortOne ( Vec_Ptr_t * vTypes,
Vec_Ptr_t * vOccurs,
int Type )

Definition at line 502 of file wlcNtk.c.

503{
504 Vec_Wrd_t * vType = (Vec_Wrd_t *)Vec_PtrEntry( vTypes, Type );
505 Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, Type );
506 Vec_WrdSelectSortCost2( Vec_WrdArray(vType), Vec_WrdSize(vType), Vec_WrdArray(vOccur) );
507 Vec_WrdReverseOrder( vType );
508 Vec_WrdReverseOrder( vOccur );
509}
Here is the caller graph for this function:

◆ Wlc_NtkPrintNode()

void Wlc_NtkPrintNode ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj )

Definition at line 703 of file wlcNtk.c.

704{
705 printf( "%8d : ", Wlc_ObjId(p, pObj) );
706 if ( Vec_IntSize(&p->vLevels) )
707 printf( "Lev = %2d ", Vec_IntEntry(&p->vLevels, Wlc_ObjId(p,pObj)) );
708 printf( "%6d%s = ", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s" : " " );
709 if ( pObj->Type == WLC_OBJ_PI )
710 {
711 printf( " PI : %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
712 return;
713 }
714 if ( pObj->Type == WLC_OBJ_FO )
715 {
716 printf( " FO : %-12s = %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)), Wlc_ObjName(p, Wlc_ObjId(p, Wlc_ObjFo2Fi(p, pObj))) );
717 return;
718 }
719 if ( pObj->Type != WLC_OBJ_CONST && Wlc_ObjFaninNum(pObj) == 0 )
720 {
721 printf( "Unknown object without fanins : %-12s\n", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
722 return;
723 }
724 if ( pObj->Type != WLC_OBJ_CONST )
725 {
726 printf( "%6d%s %5s ", Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin0(p, pObj)) ? "s" : " ", Wlc_Names[(int)pObj->Type] );
727 if ( Wlc_ObjFaninNum(pObj) > 1 )
728 printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin1(p, pObj)) ? "s" : " " );
729 else
730 printf( " " );
731 if ( Wlc_ObjFaninNum(pObj) > 2 )
732 printf( "%6d%s ", Wlc_ObjRange(Wlc_ObjFanin2(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin2(p, pObj)) ? "s" : " " );
733 else
734 printf( " " );
735 }
736 else
737 printf( " " );
738 printf( " : " );
739 printf( "%-12s", Wlc_ObjName(p, Wlc_ObjId(p, pObj)) );
740 if ( pObj->Type == WLC_OBJ_CONST )
741 {
742 printf( " = %d\'%sh", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s":"" );
743 if ( pObj->fXConst )
744 {
745 int k;
746 for ( k = 0; k < (Wlc_ObjRange(pObj) + 3) / 4; k++ )
747 printf( "x" );
748 }
749 else
750 Abc_TtPrintHexArrayRev( stdout, (word *)Wlc_ObjConstValue(pObj), (Wlc_ObjRange(pObj) + 3) / 4 );
751 }
752 else
753 {
754 printf( " = %-12s %5s ", Wlc_ObjName(p, Wlc_ObjFaninId0(pObj)), Wlc_Names[(int)pObj->Type] );
755 if ( Wlc_ObjFaninNum(pObj) > 1 )
756 printf( "%-12s ", Wlc_ObjName(p, Wlc_ObjFaninId1(pObj)) );
757 else
758 printf( " " );
759 if ( Wlc_ObjFaninNum(pObj) > 2 )
760 printf( "%-12s ", Wlc_ObjName(p, Wlc_ObjFaninId2(pObj)) );
761 }
762 printf( "\n" );
763}
@ WLC_OBJ_FO
Definition wlc.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkPrintNodeArray()

void Wlc_NtkPrintNodeArray ( Wlc_Ntk_t * p,
Vec_Int_t * vArray )

Definition at line 764 of file wlcNtk.c.

765{
766 Wlc_Obj_t * pObj;
767 int i;
768 Wlc_NtkForEachObjVec( vArray, p, pObj, i )
769 Wlc_NtkPrintNode( p, pObj );
770}
void Wlc_NtkPrintNode(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:703
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_NtkPrintNodes()

void Wlc_NtkPrintNodes ( Wlc_Ntk_t * p,
int Type )

Definition at line 771 of file wlcNtk.c.

772{
773 Wlc_Obj_t * pObj;
774 int i, Counter = 0;
775 printf( "Operation %s\n", Wlc_Names[Type] );
776 Wlc_NtkForEachObj( p, pObj, i )
777 {
778 if ( (int)pObj->Type != Type )
779 continue;
780 printf( "%8d :", Counter++ );
781 Wlc_NtkPrintNode( p, pObj );
782 }
783}
Here is the call graph for this function:

◆ Wlc_NtkPrintObjects()

void Wlc_NtkPrintObjects ( Wlc_Ntk_t * p)

Definition at line 812 of file wlcNtk.c.

813{
814 Wlc_Obj_t * pObj; int i;
815 Wlc_NtkForEachObj( p, pObj, i )
816 Wlc_NtkPrintNode( p, pObj );
817}
Here is the call graph for this function:

◆ Wlc_NtkPrintStats()

void Wlc_NtkPrintStats ( Wlc_Ntk_t * p,
int fDistrib,
int fTwoSides,
int fVerbose )

Definition at line 784 of file wlcNtk.c.

785{
786 int i;
787 printf( "%-20s : ", p->pName );
788 printf( "PI = %4d ", Wlc_NtkCountRealPis(p) ); //Wlc_NtkPiNum(p) );
789 printf( "PO = %4d ", Wlc_NtkPoNum(p) );
790 printf( "FF = %4d ", Wlc_NtkFfNum(p) );
791 printf( "Obj = %6d ", Wlc_NtkObjNum(p) - Wlc_NtkPiNum(p) - Wlc_NtkPoNum(p) - Wlc_NtkFfNum(p) );
792 printf( "Mem = %.3f MB", 1.0*Wlc_NtkMemUsage(p)/(1<<20) );
793 printf( "\n" );
794 if ( fDistrib )
795 {
796 Wlc_NtkPrintDistrib( p, fTwoSides, fVerbose );
797 return;
798 }
799 if ( !fVerbose )
800 return;
801 printf( "Node type statistics:\n" );
802 for ( i = 1; i < WLC_OBJ_NUMBER; i++ )
803 {
804 if ( !p->nObjs[i] )
805 continue;
806 if ( p->nAnds[0] && p->nAnds[i] )
807 printf( "%2d : %-8s %6d %7.2f %%\n", i, Wlc_Names[i], p->nObjs[i], 100.0*p->nAnds[i]/p->nAnds[0] );
808 else
809 printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] );
810 }
811}
int Wlc_NtkMemUsage(Wlc_Ntk_t *p)
Definition wlcNtk.c:285
void Wlc_NtkPrintDistrib(Wlc_Ntk_t *p, int fTwoSides, int fVerbose)
Definition wlcNtk.c:510
Here is the call graph for this function:

◆ Wlc_NtkProfileCones()

void Wlc_NtkProfileCones ( Wlc_Ntk_t * p)

Definition at line 1202 of file wlcNtk.c.

1203{
1204 Wlc_Obj_t * pObj;
1205 int i, nPis, nFos, nNodes, nAdders, nMults;
1206 Wlc_NtkForEachCo( p, pObj, i )
1207 {
1208 Wlc_NtkMarkCone( p, i, 1, 0, 0 );
1209 nNodes = Wlc_NtkCountMarked( p, &nPis, &nFos, &nAdders, &nMults );
1210 printf( "Cone %5d : ", i );
1211 printf( "PI = %4d ", nPis );
1212 printf( "FO = %4d ", nFos );
1213 printf( "Node = %6d ", nNodes );
1214 printf( "Add/Sub = %4d ", nAdders );
1215 printf( "Mult = %4d ", nMults );
1216 printf( "\n" );
1217 }
1219}
int Wlc_NtkCountMarked(Wlc_Ntk_t *p, int *pnPis, int *pnFos, int *pnAdders, int *pnMults)
Definition wlcNtk.c:1142
Here is the call graph for this function:

◆ Wlc_NtkRemapLevels()

int Wlc_NtkRemapLevels ( Wlc_Ntk_t * p,
Vec_Int_t * vObjs,
int nLevels )

Definition at line 387 of file wlcNtk.c.

388{
389 int i, k, iFanin, iObj, Entry, Level = 0, Res = nLevels;
390 Vec_Int_t * vMap = Vec_IntStart( nLevels+1 );
391 Vec_Int_t * vUsed = Vec_IntStart( nLevels+1 );
392 // mark used levels
393 Vec_IntWriteEntry( vUsed, nLevels, 1 );
394 Vec_IntForEachEntry( vObjs, iObj, i )
395 {
396 Vec_IntWriteEntry( vUsed, Wlc_ObjLevelId(p, iObj), 1 );
397 Wlc_ObjForEachFanin( Wlc_NtkObj(p, iObj), iFanin, k ) if ( iFanin )
398 Vec_IntWriteEntry( vUsed, Wlc_ObjLevelId(p, iFanin), 1 );
399 }
400 // create level map
401 Vec_IntForEachEntry( vUsed, Entry, i )
402 if ( Entry )
403 Vec_IntWriteEntry( vMap, i, Level++ );
404 //printf( "Total used levels %d -> %d\n", nLevels, Level );
405 // remap levels
406 Vec_IntForEachEntry( &p->vLevels, Level, i )
407 {
408 if ( Vec_IntEntry(vUsed, Level) )
409 Vec_IntWriteEntry( &p->vLevels, i, Vec_IntEntry(vMap, Level) );
410 else
411 Vec_IntWriteEntry( &p->vLevels, i, -1 );
412 }
413 Res = Vec_IntEntry( vMap, nLevels );
414 Vec_IntFree( vUsed );
415 Vec_IntFree( vMap );
416 return Res;
417}
Here is the caller graph for this function:

◆ Wlc_NtkSetRefs()

void Wlc_NtkSetRefs ( Wlc_Ntk_t * p)

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

Synopsis [Create references.]

Description []

SideEffects []

SeeAlso []

Definition at line 1373 of file wlcNtk.c.

1374{
1375 Wlc_Obj_t * pObj; int i, k, Fanin;
1376 Vec_IntFill( &p->vRefs, Wlc_NtkObjNumMax(p), 0 );
1377 Wlc_NtkForEachObj( p, pObj, i )
1378 Wlc_ObjForEachFanin( pObj, Fanin, k )
1379 Vec_IntAddToEntry( &p->vRefs, Fanin, 1 );
1380 Wlc_NtkForEachCo( p, pObj, i )
1381 Vec_IntAddToEntry( &p->vRefs, Wlc_ObjId(p, pObj), 1 );
1382}
Here is the caller graph for this function:

◆ Wlc_NtkShortNames()

void Wlc_NtkShortNames ( Wlc_Ntk_t * p)

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

Synopsis [Creates short names for all objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 1292 of file wlcNtk.c.

1293{
1294 Wlc_Obj_t * pObj;
1295 char pBuffer[1000];
1296 int NameId, fFound, i;
1297 int nFlops = Wlc_NtkCoNum(p) - Wlc_NtkPoNum(p);
1298 unsigned char nDigits = (unsigned char)Abc_Base10Log( nFlops );
1299 Wlc_NtkForEachCo( p, pObj, i )
1300 {
1301 if ( Wlc_ObjIsPo(pObj) )
1302 continue;
1303 sprintf( pBuffer, "%s%0*d", "fi", nDigits, i - Wlc_NtkPoNum(p) );
1304 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1305 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1306 }
1307 Wlc_NtkForEachCi( p, pObj, i )
1308 {
1309 if ( Wlc_ObjIsPi(pObj) )
1310 continue;
1311 sprintf( pBuffer, "%s%0*d", "fo", nDigits, i - Wlc_NtkPiNum(p) );
1312 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1313 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1314 }
1315 nDigits = Abc_Base10Log( Wlc_NtkPoNum(p) );
1316 Wlc_NtkForEachPo( p, pObj, i )
1317 {
1318 sprintf( pBuffer, "%s%0*d", "po", nDigits, i );
1319 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1320 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1321 }
1322 nDigits = Abc_Base10Log( Wlc_NtkPiNum(p) );
1323 Wlc_NtkForEachPi( p, pObj, i )
1324 {
1325 sprintf( pBuffer, "%s%0*d", "pi", nDigits, i );
1326 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1327 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1328 }
1329 nDigits = Abc_Base10Log( Wlc_NtkObjNum(p) );
1330 Wlc_NtkForEachObj( p, pObj, i )
1331 {
1332 if ( Wlc_ObjIsCi(pObj) || Wlc_ObjIsCo(pObj) )
1333 continue;
1334 sprintf( pBuffer, "%s%0*d", "n", nDigits, i );
1335 NameId = Abc_NamStrFindOrAdd( p->pManName, pBuffer, &fFound );
1336 Wlc_ObjSetNameId( p, Wlc_ObjId(p, pObj), NameId );
1337 }
1338}
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
Here is the call graph for this function:

◆ Wlc_NtkTransferNames()

void Wlc_NtkTransferNames ( Wlc_Ntk_t * pNew,
Wlc_Ntk_t * p )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 830 of file wlcNtk.c.

831{
832 int i;
833 assert( !Wlc_NtkHasCopy(pNew) && Wlc_NtkHasCopy(p) );
834 assert( !Wlc_NtkHasNameId(pNew) && Wlc_NtkHasNameId(p) );
835 assert( pNew->pManName == NULL && p->pManName != NULL );
836 Wlc_NtkCleanNameId( pNew );
837 for ( i = 0; i < p->nObjsAlloc; i++ )
838 if ( Wlc_ObjCopy(p, i) > 0 && i < Vec_IntSize(&p->vNameIds) && Wlc_ObjNameId(p, i) )
839 Wlc_ObjSetNameId( pNew, Wlc_ObjCopy(p, i), Wlc_ObjNameId(p, i) );
840 pNew->pManName = p->pManName;
841 p->pManName = NULL;
842 Vec_IntErase( &p->vNameIds );
843 // transfer table
844 pNew->pMemTable = p->pMemTable; p->pMemTable = NULL;
845 pNew->vTables = p->vTables; p->vTables = NULL;
846}
Mem_Flex_t * pMemTable
Definition wlc.h:161
Abc_Nam_t * pManName
Definition wlc.h:165
Vec_Ptr_t * vTables
Definition wlc.h:162
Here is the caller graph for this function:

◆ Wlc_ObjAddFanins()

void Wlc_ObjAddFanins ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
Vec_Int_t * vFanins )

Definition at line 240 of file wlcNtk.c.

241{
242 assert( pObj->nFanins == 0 );
243 pObj->nFanins = Vec_IntSize(vFanins);
244 // special treatment of CONST, SELECT and TABLE
245 if ( pObj->Type == WLC_OBJ_CONST )
246 pObj->nFanins = 0;
247 else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
248 pObj->nFanins = 1;
249 if ( Wlc_ObjHasArray(pObj) )
250 pObj->pFanins[0] = (int *)Mem_FlexEntryFetch( p->pMemFanin, Vec_IntSize(vFanins) * sizeof(int) );
251 memcpy( Wlc_ObjFanins(pObj), Vec_IntArray(vFanins), sizeof(int) * Vec_IntSize(vFanins) );
252}
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition mem.c:388
int * pFanins[1]
Definition wlc.h:132
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjAlloc()

int Wlc_ObjAlloc ( Wlc_Ntk_t * p,
int Type,
int Signed,
int End,
int Beg )

Definition at line 199 of file wlcNtk.c.

200{
201 Wlc_Obj_t * pObj;
202 assert( Type != WLC_OBJ_PO && Type != WLC_OBJ_FI );
203 if ( p->iObj == p->nObjsAlloc )
204 {
205 p->pObjs = ABC_REALLOC( Wlc_Obj_t, p->pObjs, 2 * p->nObjsAlloc );
206 memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Wlc_Obj_t) * p->nObjsAlloc );
207 p->nObjsAlloc *= 2;
208 }
209 pObj = Wlc_NtkObj( p, p->iObj );
210 pObj->Type = Type;
211 pObj->Signed = Signed;
212 pObj->End = End;
213 pObj->Beg = Beg;
214 if ( Wlc_ObjIsCi(pObj) )
215 Wlc_ObjSetCi( p, pObj );
216 p->nObjs[Type]++;
217 return p->iObj++;
218}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
void Wlc_ObjSetCi(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition wlcNtk.c:168
@ WLC_OBJ_PO
Definition wlc.h:47
@ WLC_OBJ_FI
Definition wlc.h:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjCollectCopyFanins()

void Wlc_ObjCollectCopyFanins ( Wlc_Ntk_t * p,
int iObj,
Vec_Int_t * vFanins )

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

Synopsis [Duplicates the network in a topological order.]

Description []

SideEffects []

SeeAlso []

Definition at line 904 of file wlcNtk.c.

905{
906 int i, iFanin;
907 Wlc_Obj_t * pObj = Wlc_NtkObj( p, iObj );
908 Vec_IntClear( vFanins );
909 Wlc_ObjForEachFanin( pObj, iFanin, i )
910 Vec_IntPush( vFanins, Wlc_ObjCopy(p, iFanin) );
911 // special treatment of CONST and SELECT
912 if ( pObj->Type == WLC_OBJ_CONST )
913 {
914 int * pInts = Wlc_ObjConstValue( pObj );
915 int nInts = Abc_BitWordNum( Wlc_ObjRange(pObj) );
916 for ( i = 0; i < nInts; i++ )
917 Vec_IntPush( vFanins, pInts[i] );
918 }
919 else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
920 {
921 assert( Vec_IntSize(vFanins) == 1 );
922 Vec_IntPushTwo( vFanins, Wlc_ObjRangeEnd(pObj), Wlc_ObjRangeBeg(pObj) );
923 }
924 else if ( pObj->Type == WLC_OBJ_TABLE )
925 {
926 assert( Vec_IntSize(vFanins) == 1 );
927 Vec_IntPush( vFanins, pObj->Fanins[1] );
928 }
929}
int Fanins[2]
Definition wlc.h:131
Here is the caller graph for this function:

◆ Wlc_ObjCreate()

int Wlc_ObjCreate ( Wlc_Ntk_t * p,
int Type,
int Signed,
int End,
int Beg,
Vec_Int_t * vFanins )

Definition at line 219 of file wlcNtk.c.

220{
221 int iFaninNew = Wlc_ObjAlloc( p, Type, Signed, End, Beg );
222 Wlc_ObjAddFanins( p, Wlc_NtkObj(p, iFaninNew), vFanins );
223 return iFaninNew;
224}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjDup()

int Wlc_ObjDup ( Wlc_Ntk_t * pNew,
Wlc_Ntk_t * p,
int iObj,
Vec_Int_t * vFanins )

Definition at line 930 of file wlcNtk.c.

931{
932 Wlc_Obj_t * pObj = Wlc_NtkObj( p, iObj );
933 int iFaninNew = Wlc_ObjAlloc( pNew, pObj->Type, Wlc_ObjIsSigned(pObj), pObj->End, pObj->Beg );
934 Wlc_Obj_t * pObjNew = Wlc_NtkObj(pNew, iFaninNew);
935 Wlc_ObjCollectCopyFanins( p, iObj, vFanins );
936 Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
937 Wlc_ObjSetCopy( p, iObj, iFaninNew );
938 pObjNew->fXConst = pObj->fXConst;
939 return iFaninNew;
940}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjName()

char * Wlc_ObjName ( Wlc_Ntk_t * p,
int iObj )

Definition at line 225 of file wlcNtk.c.

226{
227 static char Buffer[100];
228 if ( Wlc_NtkHasNameId(p) && Wlc_ObjNameId(p, iObj) )
229 return Abc_NamStr( p->pManName, Wlc_ObjNameId(p, iObj) );
230 sprintf( Buffer, "n%d", iObj );
231 return Buffer;
232}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ObjSetCi()

void Wlc_ObjSetCi ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj )

Definition at line 168 of file wlcNtk.c.

169{
170 assert( Wlc_ObjIsCi(pObj) );
171 assert( Wlc_ObjFaninNum(pObj) == 0 );
172 if ( Wlc_NtkPiNum(p) == Wlc_NtkCiNum(p) || pObj->Type != WLC_OBJ_PI )
173 {
174 pObj->Fanins[1] = Vec_IntSize(&p->vCis);
175 Vec_IntPush( &p->vCis, Wlc_ObjId(p, pObj) );
176 }
177 else // insert in the array of CI at the end of PIs
178 {
179 Wlc_Obj_t * pTemp; int i;
180 Vec_IntInsert( &p->vCis, Wlc_NtkPiNum(p), Wlc_ObjId(p, pObj) );
181 // other CI IDs are invalidated... naive fix!
182 Wlc_NtkForEachCi( p, pTemp, i )
183 pTemp->Fanins[1] = i;
184 }
185 if ( pObj->Type == WLC_OBJ_PI )
186 Vec_IntPush( &p->vPis, Wlc_ObjId(p, pObj) );
187}
Here is the caller graph for this function:

◆ Wlc_ObjSetCo()

void Wlc_ObjSetCo ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
int fFlopInput )

Definition at line 188 of file wlcNtk.c.

189{
190// pObj->Fanins[1] = Vec_IntSize(&p->vCos);
191 Vec_IntPush( &p->vCos, Wlc_ObjId(p, pObj) );
192 if ( !fFlopInput )
193 Vec_IntPush( &p->vPos, Wlc_ObjId(p, pObj) );
194 if ( fFlopInput )
195 pObj->fIsFi = 1;
196 else
197 pObj->fIsPo = 1;
198}
Here is the caller graph for this function:

◆ Wlc_ObjTypeName()

char * Wlc_ObjTypeName ( Wlc_Obj_t * p)

Definition at line 97 of file wlcNtk.c.

97{ return p ? (p->Type < WLC_OBJ_NUMBER ? Wlc_Names[p->Type] : (char *)"out_of_bound") : (char *)"no_obj"; }
Here is the caller graph for this function:

◆ Wlc_ObjUpdateType()

void Wlc_ObjUpdateType ( Wlc_Ntk_t * p,
Wlc_Obj_t * pObj,
int Type )

Definition at line 233 of file wlcNtk.c.

234{
235 assert( pObj->Type == WLC_OBJ_NONE );
236 p->nObjs[pObj->Type]--;
237 pObj->Type = Type;
238 p->nObjs[pObj->Type]++;
239}
@ WLC_OBJ_NONE
Definition wlc.h:45
Here is the caller graph for this function:

◆ Wlc_ReduceMarkedInitStr()

char * Wlc_ReduceMarkedInitStr ( Wlc_Ntk_t * p,
char * pInit )

Definition at line 876 of file wlcNtk.c.

877{
878 char * pInitNew = Abc_UtilStrsav( pInit );
879 Wlc_Obj_t * pObj; int i, b, nBits = 0, k = 0;
880 Wlc_NtkForEachCi( p, pObj, i )
881 {
882 if ( !Wlc_ObjIsPi(pObj) && pObj->Mark )
883 for ( b = 0; b < Wlc_ObjRange(pObj); b++ )
884 pInitNew[k++] = pInitNew[nBits+b];
885 if ( !Wlc_ObjIsPi(pObj) )
886 nBits += Wlc_ObjRange(pObj);
887 }
888 pInitNew[k] = '\0';
889 assert( nBits == (int)strlen(pInit) );
890 return pInitNew;
891}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Wlc_ReduceMarkedInitVec()

Vec_Int_t * Wlc_ReduceMarkedInitVec ( Wlc_Ntk_t * p,
Vec_Int_t * vInit )

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

Synopsis [Reduce init vector.]

Description []

SideEffects []

SeeAlso []

Definition at line 865 of file wlcNtk.c.

866{
867 Vec_Int_t * vInitNew = Vec_IntDup( vInit );
868 Wlc_Obj_t * pObj; int i, k = 0;
869 assert( Vec_IntSize(vInit) == Wlc_NtkCiNum(p) - Wlc_NtkPiNum(p) );
870 Wlc_NtkForEachCi( p, pObj, i )
871 if ( !Wlc_ObjIsPi(pObj) && pObj->Mark )
872 Vec_IntWriteEntry( vInitNew, k++, Vec_IntEntry(vInit, i - Wlc_NtkPiNum(p)) );
873 Vec_IntShrink( vInitNew, k );
874 return vInitNew;
875}
Here is the caller graph for this function: