ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcOdc.c File Reference
#include "base/abc/abc.h"
Include dependency graph for abcOdc.c:

Go to the source code of this file.

Classes

struct  Odc_Obj_t_
 
struct  Odc_Man_t_
 

Macros

#define ABC_DC_MAX_NODES   (1<<15)
 DECLARATIONS ///.
 
#define Odc_ForEachPi(p, Lit, i)
 
#define Odc_ForEachAnd(p, pObj, i)
 

Typedefs

typedef unsigned short Odc_Lit_t
 
typedef struct Odc_Obj_t_ Odc_Obj_t
 

Functions

Odc_Man_tAbc_NtkDontCareAlloc (int nVarsMax, int nLevels, int fVerbose, int fVeryVerbose)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkDontCareClear (Odc_Man_t *p)
 
void Abc_NtkDontCareFree (Odc_Man_t *p)
 
void Abc_NtkDontCareWinSweepLeafTfo_rec (Abc_Obj_t *pObj, int nLevelLimit, Abc_Obj_t *pNode)
 
void Abc_NtkDontCareWinSweepLeafTfo (Odc_Man_t *p)
 
void Abc_NtkDontCareWinCollectRoots_rec (Abc_Obj_t *pObj, Vec_Ptr_t *vRoots)
 
void Abc_NtkDontCareWinCollectRoots (Odc_Man_t *p)
 
int Abc_NtkDontCareWinAddMissing_rec (Odc_Man_t *p, Abc_Obj_t *pObj)
 
int Abc_NtkDontCareWinAddMissing (Odc_Man_t *p)
 
int Abc_NtkDontCareWindow (Odc_Man_t *p)
 
void * Abc_NtkDontCareTransfer_rec (Odc_Man_t *p, Abc_Obj_t *pNode, Abc_Obj_t *pPivot)
 
int Abc_NtkDontCareTransfer (Odc_Man_t *p)
 
unsigned Abc_NtkDontCareCofactors_rec (Odc_Man_t *p, Odc_Lit_t Lit, unsigned uMask)
 
int Abc_NtkDontCareQuantify (Odc_Man_t *p)
 
void Abc_NtkDontCareSimulateSetElem2 (Odc_Man_t *p)
 
void Abc_NtkDontCareSimulateSetElem (Odc_Man_t *p)
 
void Abc_NtkDontCareSimulateSetRand (Odc_Man_t *p)
 
int Abc_NtkDontCareCountMintsWord (Odc_Man_t *p, unsigned *puTruth)
 
void Abc_NtkDontCareTruthOne (Odc_Man_t *p, Odc_Lit_t Lit)
 
void Abc_NtkDontCareSimulate_rec (Odc_Man_t *p, Odc_Lit_t Lit)
 
int Abc_NtkDontCareSimulate (Odc_Man_t *p, unsigned *puTruth)
 
int Abc_NtkDontCareSimulateBefore (Odc_Man_t *p, unsigned *puTruth)
 
int Abc_NtkDontCareCompute (Odc_Man_t *p, Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, unsigned *puTruth)
 

Macro Definition Documentation

◆ ABC_DC_MAX_NODES

#define ABC_DC_MAX_NODES   (1<<15)

DECLARATIONS ///.

CFile****************************************************************

FileName [abcOdc.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Scalable computation of observability don't-cares.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
abcOdc.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 30 of file abcOdc.c.

◆ Odc_ForEachAnd

#define Odc_ForEachAnd ( p,
pObj,
i )
Value:
for ( i = 1 + Odc_CiNum(p); (i < Odc_ObjNum(p)) && ((pObj) = (p)->pObjs + i); i++ )
Cube * p
Definition exorList.c:222

Definition at line 143 of file abcOdc.c.

143#define Odc_ForEachAnd( p, pObj, i ) \
144 for ( i = 1 + Odc_CiNum(p); (i < Odc_ObjNum(p)) && ((pObj) = (p)->pObjs + i); i++ )

◆ Odc_ForEachPi

#define Odc_ForEachPi ( p,
Lit,
i )
Value:
for ( i = 0; (i < Odc_PiNum(p)) && (((Lit) = Odc_Var(p, i)), 1); i++ )

Definition at line 141 of file abcOdc.c.

141#define Odc_ForEachPi( p, Lit, i ) \
142 for ( i = 0; (i < Odc_PiNum(p)) && (((Lit) = Odc_Var(p, i)), 1); i++ )

Typedef Documentation

◆ Odc_Lit_t

typedef unsigned short Odc_Lit_t

Definition at line 32 of file abcOdc.c.

◆ Odc_Obj_t

typedef struct Odc_Obj_t_ Odc_Obj_t

Definition at line 34 of file abcOdc.c.

Function Documentation

◆ Abc_NtkDontCareAlloc()

Odc_Man_t * Abc_NtkDontCareAlloc ( int nVarsMax,
int nLevels,
int fVerbose,
int fVeryVerbose )

FUNCTION DEFINITIONS ///.

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

Synopsis [Allocates the don't-care manager.]

Description [The parameters are the max number of cut variables, the number of fanout levels used for the ODC computation, and verbosiness.]

SideEffects []

SeeAlso []

Definition at line 163 of file abcOdc.c.

164{
165 Odc_Man_t * p;
166 unsigned * pData;
167 int i, k;
168 p = ABC_ALLOC( Odc_Man_t, 1 );
169 memset( p, 0, sizeof(Odc_Man_t) );
170 assert( nVarsMax > 4 && nVarsMax < 16 );
171 assert( nLevels > 0 && nLevels < 10 );
172
173 srand( 0xABC );
174
175 // dont'-care parameters
176 p->nVarsMax = nVarsMax;
177 p->nLevels = nLevels;
178 p->fVerbose = fVerbose;
179 p->fVeryVerbose = fVeryVerbose;
180 p->nPercCutoff = 10;
181 p->skipQuant = 0;
182
183 // windowing
184 p->vRoots = Vec_PtrAlloc( 128 );
185 p->vBranches = Vec_PtrAlloc( 128 );
186
187 // internal AIG package
188 // allocate room for objects
189 p->nObjsAlloc = ABC_DC_MAX_NODES;
190 p->pObjs = ABC_ALLOC( Odc_Obj_t, p->nObjsAlloc * sizeof(Odc_Obj_t) );
191 p->nPis = nVarsMax + 32;
192 p->nObjs = 1 + p->nPis;
193 memset( p->pObjs, 0, p->nObjs * sizeof(Odc_Obj_t) );
194 // set the PI masks
195 for ( i = 0; i < 32; i++ )
196 p->pObjs[1 + p->nVarsMax + i].uMask = (1 << i);
197 // allocate hash table
198 p->nTableSize = p->nObjsAlloc/3 + 1;
199 p->pTable = ABC_ALLOC( Odc_Lit_t, p->nTableSize * sizeof(Odc_Lit_t) );
200 memset( p->pTable, 0, p->nTableSize * sizeof(Odc_Lit_t) );
201 p->vUsedSpots = Vec_IntAlloc( 1000 );
202
203 // truth tables
204 p->nWords = Abc_TruthWordNum( p->nVarsMax );
205 p->nBits = p->nWords * 8 * sizeof(unsigned);
206 p->vTruths = Vec_PtrAllocSimInfo( p->nObjsAlloc, p->nWords );
207 p->vTruthsElem = Vec_PtrAllocSimInfo( p->nVarsMax, p->nWords );
208
209 // set elementary truth tables
210 Abc_InfoFill( (unsigned *)Vec_PtrEntry(p->vTruths, 0), p->nWords );
211 for ( k = 0; k < p->nVarsMax; k++ )
212 {
213// pData = Odc_ObjTruth( p, Odc_Var(p, k) );
214 pData = (unsigned *)Vec_PtrEntry( p->vTruthsElem, k );
215 Abc_InfoClear( pData, p->nWords );
216 for ( i = 0; i < p->nBits; i++ )
217 if ( i & (1 << k) )
218 pData[i>>5] |= (1 << (i&31));
219 }
220
221 // set random truth table for the additional inputs
222 for ( k = p->nVarsMax; k < p->nPis; k++ )
223 {
224 pData = Odc_ObjTruth( p, Odc_Var(p, k) );
225 Abc_InfoRandom( pData, p->nWords );
226 }
227
228 // set the miter to the unused value
229 p->iRoot = 0xffff;
230 return p;
231}
unsigned short Odc_Lit_t
Definition abcOdc.c:32
#define ABC_DC_MAX_NODES
DECLARATIONS ///.
Definition abcOdc.c:30
struct Odc_Obj_t_ Odc_Obj_t
Definition abcOdc.c:34
struct Odc_Man_t_ Odc_Man_t
Definition abc.h:832
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareClear()

void Abc_NtkDontCareClear ( Odc_Man_t * p)

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

Synopsis [Clears the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file abcOdc.c.

245{
246 abctime clk = Abc_Clock();
247 // clean the structural hashing table
248 if ( Vec_IntSize(p->vUsedSpots) > p->nTableSize/3 ) // more than one third
249 memset( p->pTable, 0, sizeof(Odc_Lit_t) * p->nTableSize );
250 else
251 {
252 int iSpot, i;
253 Vec_IntForEachEntry( p->vUsedSpots, iSpot, i )
254 p->pTable[iSpot] = 0;
255 }
256 Vec_IntClear( p->vUsedSpots );
257 // reset the number of nodes
258 p->nObjs = 1 + p->nPis;
259 // reset the root node
260 p->iRoot = 0xffff;
261
262p->timeClean += Abc_Clock() - clk;
263}
ABC_INT64_T abctime
Definition abc_global.h:332
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareCofactors_rec()

unsigned Abc_NtkDontCareCofactors_rec ( Odc_Man_t * p,
Odc_Lit_t Lit,
unsigned uMask )

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

Synopsis [Recursively computes the pair of cofactors.]

Description []

SideEffects []

SeeAlso []

Definition at line 740 of file abcOdc.c.

741{
742 Odc_Obj_t * pObj;
743 unsigned uData0, uData1;
744 Odc_Lit_t uLit0, uLit1, uRes0, uRes1;
745 assert( !Odc_IsComplement(Lit) );
746 // skip visited objects
747 pObj = Odc_Lit2Obj( p, Lit );
748 if ( Odc_ObjIsTravIdCurrent(p, pObj) )
749 {
750 p->skipQuant = 1;
751 return pObj->uData;
752 }
753 Odc_ObjSetTravIdCurrent(p, pObj);
754 // skip objects out of the cone
755 if ( (pObj->uMask & uMask) == 0 )
756 return pObj->uData = ((Lit << 16) | Lit);
757 // consider the case when the node is the var
758 if ( pObj->uMask == uMask && Odc_IsTerm(p, Lit) )
759 return pObj->uData = ((Odc_Const1() << 16) | Odc_Const0());
760 // compute the cofactors
761 uData0 = Abc_NtkDontCareCofactors_rec( p, Odc_ObjFanin0(pObj), uMask );
762 uData1 = Abc_NtkDontCareCofactors_rec( p, Odc_ObjFanin1(pObj), uMask );
763 // find the 0-cofactor
764 uLit0 = Odc_NotCond( (Odc_Lit_t)(uData0 & 0xffff), Odc_ObjFaninC0(pObj) );
765 uLit1 = Odc_NotCond( (Odc_Lit_t)(uData1 & 0xffff), Odc_ObjFaninC1(pObj) );
766 uRes0 = Odc_And( p, uLit0, uLit1 );
767 // find the 1-cofactor
768 uLit0 = Odc_NotCond( (Odc_Lit_t)(uData0 >> 16), Odc_ObjFaninC0(pObj) );
769 uLit1 = Odc_NotCond( (Odc_Lit_t)(uData1 >> 16), Odc_ObjFaninC1(pObj) );
770 uRes1 = Odc_And( p, uLit0, uLit1 );
771 // find the result
772 p->skipQuant = 0;
773 return pObj->uData = ((uRes1 << 16) | uRes0);
774}
unsigned Abc_NtkDontCareCofactors_rec(Odc_Man_t *p, Odc_Lit_t Lit, unsigned uMask)
Definition abcOdc.c:740
unsigned uData
Definition abcOdc.c:41
unsigned uMask
Definition abcOdc.c:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareCompute()

int Abc_NtkDontCareCompute ( Odc_Man_t * p,
Abc_Obj_t * pNode,
Vec_Ptr_t * vLeaves,
unsigned * puTruth )

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

Synopsis [Computes ODCs for the node in terms of the cut variables.]

Description [Returns the number of don't care minterms in the truth table. In particular, this procedure returns 0 if there is no don't-cares.]

SideEffects []

SeeAlso []

Definition at line 1042 of file abcOdc.c.

1043{
1044 int nMints, RetValue;
1045 abctime clk, clkTotal = Abc_Clock();
1046
1047 p->nWins++;
1048
1049 // set the parameters
1050 assert( !Abc_ObjIsComplement(pNode) );
1051 assert( Abc_ObjIsNode(pNode) );
1052 assert( Vec_PtrSize(vLeaves) <= p->nVarsMax );
1053 p->vLeaves = vLeaves;
1054 p->pNode = pNode;
1055
1056 // compute the window
1057clk = Abc_Clock();
1058 RetValue = Abc_NtkDontCareWindow( p );
1059p->timeWin += Abc_Clock() - clk;
1060 if ( !RetValue )
1061 {
1062p->timeAbort += Abc_Clock() - clkTotal;
1063 Abc_InfoFill( puTruth, p->nWords );
1064 p->nWinsEmpty++;
1065 return 0;
1066 }
1067
1068 if ( p->fVeryVerbose )
1069 {
1070 printf( " %5d : ", pNode->Id );
1071 printf( "Leaf = %2d ", Vec_PtrSize(p->vLeaves) );
1072 printf( "Root = %2d ", Vec_PtrSize(p->vRoots) );
1073 printf( "Bran = %2d ", Vec_PtrSize(p->vBranches) );
1074 printf( " | " );
1075 }
1076
1077 // transfer the window into the AIG package
1078clk = Abc_Clock();
1080p->timeMiter += Abc_Clock() - clk;
1081
1082 // simulate to estimate the amount of don't-cares
1083clk = Abc_Clock();
1084 nMints = Abc_NtkDontCareSimulateBefore( p, puTruth );
1085p->timeSim += Abc_Clock() - clk;
1086 if ( p->fVeryVerbose )
1087 {
1088 printf( "AIG = %5d ", Odc_NodeNum(p) );
1089 printf( "%6.2f %% ", 100.0 * (p->nBits - nMints) / p->nBits );
1090 }
1091
1092 // if there is less then the given percentage of don't-cares, skip
1093 if ( 100.0 * (p->nBits - nMints) / p->nBits < 1.0 * p->nPercCutoff )
1094 {
1095p->timeAbort += Abc_Clock() - clkTotal;
1096 if ( p->fVeryVerbose )
1097 printf( "Simulation cutoff.\n" );
1098 Abc_InfoFill( puTruth, p->nWords );
1099 p->nSimsEmpty++;
1100 return 0;
1101 }
1102
1103 // quantify external variables
1104clk = Abc_Clock();
1105 RetValue = Abc_NtkDontCareQuantify( p );
1106p->timeQuant += Abc_Clock() - clk;
1107 if ( !RetValue )
1108 {
1109p->timeAbort += Abc_Clock() - clkTotal;
1110 if ( p->fVeryVerbose )
1111 printf( "=== Overflow! ===\n" );
1112 Abc_InfoFill( puTruth, p->nWords );
1113 p->nQuantsOver++;
1114 return 0;
1115 }
1116
1117 // get the truth table
1118clk = Abc_Clock();
1120 nMints = Abc_NtkDontCareSimulate( p, puTruth );
1121p->timeTruth += Abc_Clock() - clk;
1122 if ( p->fVeryVerbose )
1123 {
1124 printf( "AIG = %5d ", Odc_NodeNum(p) );
1125 printf( "%6.2f %% ", 100.0 * (p->nBits - nMints) / p->nBits );
1126 printf( "\n" );
1127 }
1128p->timeTotal += Abc_Clock() - clkTotal;
1129 p->nWinsFinish++;
1130 p->nTotalDcs += (int)(100.0 * (p->nBits - nMints) / p->nBits);
1131 return nMints;
1132}
int Abc_NtkDontCareTransfer(Odc_Man_t *p)
Definition abcOdc.c:690
int Abc_NtkDontCareQuantify(Odc_Man_t *p)
Definition abcOdc.c:787
int Abc_NtkDontCareWindow(Odc_Man_t *p)
Definition abcOdc.c:479
int Abc_NtkDontCareSimulateBefore(Odc_Man_t *p, unsigned *puTruth)
Definition abcOdc.c:1012
int Abc_NtkDontCareSimulate(Odc_Man_t *p, unsigned *puTruth)
Definition abcOdc.c:991
void Abc_NtkDontCareSimulateSetElem(Odc_Man_t *p)
Definition abcOdc.c:852
int Id
Definition abc.h:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareCountMintsWord()

int Abc_NtkDontCareCountMintsWord ( Odc_Man_t * p,
unsigned * puTruth )

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

Synopsis [Set random simulation words for PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 901 of file abcOdc.c.

902{
903 int w, Counter = 0;
904 for ( w = 0; w < p->nWords; w++ )
905 if ( puTruth[w] )
906 Counter++;
907 return Counter;
908}
Here is the caller graph for this function:

◆ Abc_NtkDontCareFree()

void Abc_NtkDontCareFree ( Odc_Man_t * p)

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

Synopsis [Frees the don't-care manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 276 of file abcOdc.c.

277{
278 if ( p->fVerbose )
279 {
280 printf( "Wins = %5d. Empty = %5d. SimsEmpty = %5d. QuantOver = %5d. WinsFinish = %5d.\n",
281 p->nWins, p->nWinsEmpty, p->nSimsEmpty, p->nQuantsOver, p->nWinsFinish );
282 printf( "Ave DCs per window = %6.2f %%. Ave DCs per finished window = %6.2f %%.\n",
283 1.0*p->nTotalDcs/p->nWins, 1.0*p->nTotalDcs/p->nWinsFinish );
284 printf( "Runtime stats of the ODC manager:\n" );
285 ABC_PRT( "Cleaning ", p->timeClean );
286 ABC_PRT( "Windowing ", p->timeWin );
287 ABC_PRT( "Miter ", p->timeMiter );
288 ABC_PRT( "Simulation ", p->timeSim );
289 ABC_PRT( "Quantifying ", p->timeQuant );
290 ABC_PRT( "Truth table ", p->timeTruth );
291 ABC_PRT( "TOTAL ", p->timeTotal );
292 ABC_PRT( "Aborted ", p->timeAbort );
293 }
294 Vec_PtrFree( p->vRoots );
295 Vec_PtrFree( p->vBranches );
296 Vec_PtrFree( p->vTruths );
297 Vec_PtrFree( p->vTruthsElem );
298 Vec_IntFree( p->vUsedSpots );
299 ABC_FREE( p->pObjs );
300 ABC_FREE( p->pTable );
301 ABC_FREE( p );
302}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Abc_NtkDontCareQuantify()

int Abc_NtkDontCareQuantify ( Odc_Man_t * p)

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

Synopsis [Quantifies the branch variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 787 of file abcOdc.c.

788{
789 Odc_Lit_t uRes0, uRes1;
790 unsigned uData;
791 int i;
792 p->skipQuant = 0;
793 assert( p->iRoot < 0xffff );
794 assert( Vec_PtrSize(p->vBranches) <= 32 ); // the mask size
795 for ( i = 0; i < Vec_PtrSize(p->vBranches); i++ )
796 {
797 // compute the cofactors w.r.t. this variable
798 Odc_ManIncrementTravId( p );
799 uData = Abc_NtkDontCareCofactors_rec( p, Odc_Regular(p->iRoot), (1 << i) );
800 if ( p->skipQuant )
801 continue;
802 uRes0 = Odc_NotCond( (Odc_Lit_t)(uData & 0xffff), Odc_IsComplement(p->iRoot) );
803 uRes1 = Odc_NotCond( (Odc_Lit_t)(uData >> 16), Odc_IsComplement(p->iRoot) );
804 // quantify this variable existentially
805 p->iRoot = Odc_Or( p, uRes0, uRes1 );
806 // check the limit
807 if ( Odc_ObjNum(p) > ABC_DC_MAX_NODES/2 )
808 return 0;
809 }
810 assert( p->nObjs <= p->nObjsAlloc );
811 return 1;
812}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareSimulate()

int Abc_NtkDontCareSimulate ( Odc_Man_t * p,
unsigned * puTruth )

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

Synopsis [Computes the truth table of the care set.]

Description [Returns the number of ones in the simulation info.]

SideEffects []

SeeAlso []

Definition at line 991 of file abcOdc.c.

992{
993 Odc_ManIncrementTravId( p );
994 Abc_NtkDontCareSimulate_rec( p, Odc_Regular(p->iRoot) );
995 Abc_InfoCopy( puTruth, Odc_ObjTruth(p, Odc_Regular(p->iRoot)), p->nWords );
996 if ( Odc_IsComplement(p->iRoot) )
997 Abc_InfoNot( puTruth, p->nWords );
998 return Extra_TruthCountOnes( puTruth, p->nVarsMax );
999}
void Abc_NtkDontCareSimulate_rec(Odc_Man_t *p, Odc_Lit_t Lit)
Definition abcOdc.c:961
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareSimulate_rec()

void Abc_NtkDontCareSimulate_rec ( Odc_Man_t * p,
Odc_Lit_t Lit )

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

Synopsis [Computes the truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 961 of file abcOdc.c.

962{
963 Odc_Obj_t * pObj;
964 assert( !Odc_IsComplement(Lit) );
965 // skip terminals
966 if ( Odc_IsTerm(p, Lit) )
967 return;
968 // skip visited objects
969 pObj = Odc_Lit2Obj( p, Lit );
970 if ( Odc_ObjIsTravIdCurrent(p, pObj) )
971 return;
972 Odc_ObjSetTravIdCurrent(p, pObj);
973 // call recursively
974 Abc_NtkDontCareSimulate_rec( p, Odc_ObjFanin0(pObj) );
975 Abc_NtkDontCareSimulate_rec( p, Odc_ObjFanin1(pObj) );
976 // construct the truth table
978}
void Abc_NtkDontCareTruthOne(Odc_Man_t *p, Odc_Lit_t Lit)
Definition abcOdc.c:921
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareSimulateBefore()

int Abc_NtkDontCareSimulateBefore ( Odc_Man_t * p,
unsigned * puTruth )

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

Synopsis [Computes the truth table of the care set.]

Description [Returns the number of ones in the simulation info.]

SideEffects []

SeeAlso []

Definition at line 1012 of file abcOdc.c.

1013{
1014 int nIters = 2;
1015 int nRounds, Counter, r;
1016 // decide how many rounds to simulate
1017 nRounds = p->nBits / p->nWords;
1018 Counter = 0;
1019 for ( r = 0; r < nIters; r++ )
1020 {
1022 Abc_NtkDontCareSimulate( p, puTruth );
1023 Counter += Abc_NtkDontCareCountMintsWord( p, puTruth );
1024 }
1025 // normalize
1026 Counter = Counter * nRounds / nIters;
1027 return Counter;
1028}
int Abc_NtkDontCareCountMintsWord(Odc_Man_t *p, unsigned *puTruth)
Definition abcOdc.c:901
void Abc_NtkDontCareSimulateSetRand(Odc_Man_t *p)
Definition abcOdc.c:875
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareSimulateSetElem()

void Abc_NtkDontCareSimulateSetElem ( Odc_Man_t * p)

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

Synopsis [Set elementary truth tables for PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 852 of file abcOdc.c.

853{
854 unsigned * pData, * pData2;
855 int k;
856 for ( k = 0; k < p->nVarsMax; k++ )
857 {
858 pData = Odc_ObjTruth( p, Odc_Var(p, k) );
859 pData2 = (unsigned *)Vec_PtrEntry( p->vTruthsElem, k );
860 Abc_InfoCopy( pData, pData2, p->nWords );
861 }
862}
Here is the caller graph for this function:

◆ Abc_NtkDontCareSimulateSetElem2()

void Abc_NtkDontCareSimulateSetElem2 ( Odc_Man_t * p)

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

Synopsis [Set elementary truth tables for PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 827 of file abcOdc.c.

828{
829 unsigned * pData;
830 int i, k;
831 for ( k = 0; k < p->nVarsMax; k++ )
832 {
833 pData = Odc_ObjTruth( p, Odc_Var(p, k) );
834 Abc_InfoClear( pData, p->nWords );
835 for ( i = 0; i < p->nBits; i++ )
836 if ( i & (1 << k) )
837 pData[i>>5] |= (1 << (i&31));
838 }
839}

◆ Abc_NtkDontCareSimulateSetRand()

void Abc_NtkDontCareSimulateSetRand ( Odc_Man_t * p)

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

Synopsis [Set random simulation words for PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 875 of file abcOdc.c.

876{
877 unsigned * pData;
878 int w, k, Number;
879 for ( w = 0; w < p->nWords; w++ )
880 {
881 Number = rand();
882 for ( k = 0; k < p->nVarsMax; k++ )
883 {
884 pData = Odc_ObjTruth( p, Odc_Var(p, k) );
885 pData[w] = (Number & (1<<k)) ? ~0 : 0;
886 }
887 }
888}
Here is the caller graph for this function:

◆ Abc_NtkDontCareTransfer()

int Abc_NtkDontCareTransfer ( Odc_Man_t * p)

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

Synopsis [Transfers the window into the AIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 690 of file abcOdc.c.

691{
692 Abc_Obj_t * pObj;
693 Odc_Lit_t uRes0, uRes1;
694 Odc_Lit_t uLit;
695 unsigned uData;
696 int i;
697 Abc_NtkIncrementTravId( p->pNode->pNtk );
698 // set elementary variables at the leaves
699 Vec_PtrForEachEntry( Abc_Obj_t *, p->vLeaves, pObj, i )
700 {
701 uLit = Odc_Var( p, i );
702 pObj->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)((uLit << 16) | uLit);
703 Abc_NodeSetTravIdCurrent(pObj);
704 }
705 // set elementary variables at the branched
706 Vec_PtrForEachEntry( Abc_Obj_t *, p->vBranches, pObj, i )
707 {
708 uLit = Odc_Var( p, i+p->nVarsMax );
709 pObj->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)((uLit << 16) | uLit);
710 Abc_NodeSetTravIdCurrent(pObj);
711 }
712 // compute the AIG for the window
713 p->iRoot = Odc_Const0();
714 Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
715 {
716 uData = (unsigned)(ABC_PTRUINT_T)Abc_NtkDontCareTransfer_rec( p, pObj, p->pNode );
717 // get the cofactors
718 uRes0 = uData & 0xffff;
719 uRes1 = uData >> 16;
720 // compute the miter
721// assert( uRes0 != uRes1 ); // may be false if the node is redundant w.r.t. this root
722 uLit = Odc_Xor( p, uRes0, uRes1 );
723 p->iRoot = Odc_Or( p, p->iRoot, uLit );
724 }
725 return 1;
726}
void * Abc_NtkDontCareTransfer_rec(Odc_Man_t *p, Abc_Obj_t *pNode, Abc_Obj_t *pPivot)
Definition abcOdc.c:651
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
Abc_Obj_t * pCopy
Definition abc.h:148
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareTransfer_rec()

void * Abc_NtkDontCareTransfer_rec ( Odc_Man_t * p,
Abc_Obj_t * pNode,
Abc_Obj_t * pPivot )

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

Synopsis [Transfers the window into the AIG package.]

Description []

SideEffects []

SeeAlso []

Definition at line 651 of file abcOdc.c.

652{
653 unsigned uData0, uData1;
654 Odc_Lit_t uLit0, uLit1, uRes0, uRes1;
655 assert( !Abc_ObjIsComplement(pNode) );
656 // skip visited objects
657 if ( Abc_NodeIsTravIdCurrent(pNode) )
658 return pNode->pCopy;
659 Abc_NodeSetTravIdCurrent(pNode);
660 assert( Abc_ObjIsNode(pNode) );
661 // consider the case when the node is the pivot
662 if ( pNode == pPivot )
663 return pNode->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)((Odc_Const1() << 16) | Odc_Const0());
664 // compute the cofactors
665 uData0 = (unsigned)(ABC_PTRUINT_T)Abc_NtkDontCareTransfer_rec( p, Abc_ObjFanin0(pNode), pPivot );
666 uData1 = (unsigned)(ABC_PTRUINT_T)Abc_NtkDontCareTransfer_rec( p, Abc_ObjFanin1(pNode), pPivot );
667 // find the 0-cofactor
668 uLit0 = Odc_NotCond( (Odc_Lit_t)(uData0 & 0xffff), Abc_ObjFaninC0(pNode) );
669 uLit1 = Odc_NotCond( (Odc_Lit_t)(uData1 & 0xffff), Abc_ObjFaninC1(pNode) );
670 uRes0 = Odc_And( p, uLit0, uLit1 );
671 // find the 1-cofactor
672 uLit0 = Odc_NotCond( (Odc_Lit_t)(uData0 >> 16), Abc_ObjFaninC0(pNode) );
673 uLit1 = Odc_NotCond( (Odc_Lit_t)(uData1 >> 16), Abc_ObjFaninC1(pNode) );
674 uRes1 = Odc_And( p, uLit0, uLit1 );
675 // find the result
676 return pNode->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)((uRes1 << 16) | uRes0);
677}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareTruthOne()

void Abc_NtkDontCareTruthOne ( Odc_Man_t * p,
Odc_Lit_t Lit )

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

Synopsis [Simulates one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 921 of file abcOdc.c.

922{
923 Odc_Obj_t * pObj;
924 unsigned * pInfo, * pInfo1, * pInfo2;
925 int k, fComp1, fComp2;
926 assert( !Odc_IsComplement( Lit ) );
927 assert( !Odc_IsTerm( p, Lit ) );
928 // get the truth tables
929 pObj = Odc_Lit2Obj( p, Lit );
930 pInfo = Odc_ObjTruth( p, Lit );
931 pInfo1 = Odc_ObjTruth( p, Odc_ObjFanin0(pObj) );
932 pInfo2 = Odc_ObjTruth( p, Odc_ObjFanin1(pObj) );
933 fComp1 = Odc_ObjFaninC0( pObj );
934 fComp2 = Odc_ObjFaninC1( pObj );
935 // simulate
936 if ( fComp1 && fComp2 )
937 for ( k = 0; k < p->nWords; k++ )
938 pInfo[k] = ~pInfo1[k] & ~pInfo2[k];
939 else if ( fComp1 && !fComp2 )
940 for ( k = 0; k < p->nWords; k++ )
941 pInfo[k] = ~pInfo1[k] & pInfo2[k];
942 else if ( !fComp1 && fComp2 )
943 for ( k = 0; k < p->nWords; k++ )
944 pInfo[k] = pInfo1[k] & ~pInfo2[k];
945 else // if ( fComp1 && fComp2 )
946 for ( k = 0; k < p->nWords; k++ )
947 pInfo[k] = pInfo1[k] & pInfo2[k];
948}
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinAddMissing()

int Abc_NtkDontCareWinAddMissing ( Odc_Man_t * p)

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

Synopsis [Adds to the window nodes and leaves in the TFI of the roots.]

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file abcOdc.c.

453{
454 Abc_Obj_t * pObj;
455 int i;
456 // set the leaves
457 Abc_NtkIncrementTravId( p->pNode->pNtk );
458 Vec_PtrForEachEntry( Abc_Obj_t *, p->vLeaves, pObj, i )
459 Abc_NodeSetTravIdCurrent( pObj );
460 // explore from the roots
461 Vec_PtrClear( p->vBranches );
462 Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
463 if ( !Abc_NtkDontCareWinAddMissing_rec( p, pObj ) )
464 return 0;
465 return 1;
466}
int Abc_NtkDontCareWinAddMissing_rec(Odc_Man_t *p, Abc_Obj_t *pObj)
Definition abcOdc.c:420
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinAddMissing_rec()

int Abc_NtkDontCareWinAddMissing_rec ( Odc_Man_t * p,
Abc_Obj_t * pObj )

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

Synopsis [Recursively adds missing nodes and leaves.]

Description []

SideEffects []

SeeAlso []

Definition at line 420 of file abcOdc.c.

421{
422 Abc_Obj_t * pFanin;
423 int i;
424 // skip the already collected leaves and branches
425 if ( Abc_NodeIsTravIdCurrent(pObj) )
426 return 1;
427 // if this is not an internal node - make it a new branch
428 if ( !Abc_NodeIsTravIdPrevious(pObj) || Abc_ObjIsCi(pObj) ) //|| (int)pObj->Level <= p->nLevLeaves )
429 {
430 Abc_NodeSetTravIdCurrent( pObj );
431 Vec_PtrPush( p->vBranches, pObj );
432 return Vec_PtrSize(p->vBranches) <= 32;
433 }
434 // visit the fanins of the node
435 Abc_ObjForEachFanin( pObj, pFanin, i )
436 if ( !Abc_NtkDontCareWinAddMissing_rec( p, pFanin ) )
437 return 0;
438 return 1;
439}
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinCollectRoots()

void Abc_NtkDontCareWinCollectRoots ( Odc_Man_t * p)

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

Synopsis [Collects the roots of the window.]

Description [Roots of the window are the nodes that have at least one fanout that it not in the TFO of the leaves.]

SideEffects []

SeeAlso []

Definition at line 399 of file abcOdc.c.

400{
401 assert( !Abc_NodeIsTravIdCurrent(p->pNode) );
402 // mark the node with the old traversal ID
403 Abc_NodeSetTravIdCurrent( p->pNode );
404 // collect the roots
405 Vec_PtrClear( p->vRoots );
406 Abc_NtkDontCareWinCollectRoots_rec( p->pNode, p->vRoots );
407}
void Abc_NtkDontCareWinCollectRoots_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vRoots)
Definition abcOdc.c:366
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinCollectRoots_rec()

void Abc_NtkDontCareWinCollectRoots_rec ( Abc_Obj_t * pObj,
Vec_Ptr_t * vRoots )

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

Synopsis [Recursively collects the roots.]

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file abcOdc.c.

367{
368 Abc_Obj_t * pFanout;
369 int i;
370 assert( Abc_ObjIsNode(pObj) );
371 assert( Abc_NodeIsTravIdCurrent(pObj) );
372 // check if the node has all fanouts marked
373 Abc_ObjForEachFanout( pObj, pFanout, i )
374 if ( !Abc_NodeIsTravIdCurrent(pFanout) )
375 break;
376 // if some of the fanouts are unmarked, add the node to the root
377 if ( i < Abc_ObjFanoutNum(pObj) )
378 {
379 Vec_PtrPushUnique( vRoots, pObj );
380 return;
381 }
382 // otherwise, call recursively
383 Abc_ObjForEachFanout( pObj, pFanout, i )
384 Abc_NtkDontCareWinCollectRoots_rec( pFanout, vRoots );
385}
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWindow()

int Abc_NtkDontCareWindow ( Odc_Man_t * p)

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

Synopsis [Computes window for the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 479 of file abcOdc.c.

480{
481 // mark the TFO of the collected nodes up to the given level (p->pNode->Level + p->nWinTfoMax)
483 // find the roots of the window
485 if ( Vec_PtrSize(p->vRoots) == 1 && Vec_PtrEntry(p->vRoots, 0) == p->pNode )
486 {
487// printf( "Empty window\n" );
488 return 0;
489 }
490 // add the nodes in the TFI of the roots that are not yet in the window
492 {
493// printf( "Too many branches (%d)\n", Vec_PtrSize(p->vBranches) );
494 return 0;
495 }
496 return 1;
497}
void Abc_NtkDontCareWinSweepLeafTfo(Odc_Man_t *p)
Definition abcOdc.c:346
void Abc_NtkDontCareWinCollectRoots(Odc_Man_t *p)
Definition abcOdc.c:399
int Abc_NtkDontCareWinAddMissing(Odc_Man_t *p)
Definition abcOdc.c:452
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinSweepLeafTfo()

void Abc_NtkDontCareWinSweepLeafTfo ( Odc_Man_t * p)

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

Synopsis [Marks the TFO of the collected nodes up to the given level.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file abcOdc.c.

347{
348 Abc_Obj_t * pObj;
349 int i;
350 Abc_NtkIncrementTravId( p->pNode->pNtk );
351 Vec_PtrForEachEntry( Abc_Obj_t *, p->vLeaves, pObj, i )
352 Abc_NtkDontCareWinSweepLeafTfo_rec( pObj, p->pNode->Level + p->nLevels, p->pNode );
353}
void Abc_NtkDontCareWinSweepLeafTfo_rec(Abc_Obj_t *pObj, int nLevelLimit, Abc_Obj_t *pNode)
Definition abcOdc.c:317
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDontCareWinSweepLeafTfo_rec()

void Abc_NtkDontCareWinSweepLeafTfo_rec ( Abc_Obj_t * pObj,
int nLevelLimit,
Abc_Obj_t * pNode )

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

Synopsis [Marks the TFO of the collected nodes up to the given level.]

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file abcOdc.c.

318{
319 Abc_Obj_t * pFanout;
320 int i;
321 if ( Abc_ObjIsCo(pObj) || (int)pObj->Level > nLevelLimit || pObj == pNode )
322 return;
323 if ( Abc_NodeIsTravIdCurrent(pObj) )
324 return;
325 Abc_NodeSetTravIdCurrent( pObj );
327 // try to reduce the runtime
328 if ( Abc_ObjFanoutNum(pObj) > 100 )
329 return;
331 Abc_ObjForEachFanout( pObj, pFanout, i )
332 Abc_NtkDontCareWinSweepLeafTfo_rec( pFanout, nLevelLimit, pNode );
333}
unsigned Level
Definition abc.h:142
Here is the call graph for this function:
Here is the caller graph for this function: