abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sscSim.c File Reference
#include "sscInt.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START word 
Ssc_Random ()
 DECLARATIONS ///. More...
 
static word Ssc_Random1 (int Bit)
 
static word Ssc_Random2 ()
 
static void Ssc_SimAnd (word *pSim, word *pSim0, word *pSim1, int nWords, int fComp0, int fComp1)
 
static void Ssc_SimDup (word *pSim, word *pSim0, int nWords, int fComp0)
 
static void Ssc_SimConst (word *pSim, int nWords, int fComp0)
 
static void Ssc_SimOr (word *pSim, word *pSim0, int nWords, int fComp0)
 
static int Ssc_SimFindBitWord (word t)
 
static int Ssc_SimFindBit (word *pSim, int nWords)
 
static int Ssc_SimCountBitsWord (word x)
 
static int Ssc_SimCountBits (word *pSim, int nWords)
 
void Vec_WrdDoubleSimInfo (Vec_Wrd_t *p, int nObjs)
 FUNCTION DEFINITIONS ///. More...
 
void Ssc_GiaResetPiPattern (Gia_Man_t *p, int nWords)
 
void Ssc_GiaSavePiPattern (Gia_Man_t *p, Vec_Int_t *vPat)
 
void Ssc_GiaRandomPiPattern (Gia_Man_t *p, int nWords, Vec_Int_t *vPivot)
 
void Ssc_GiaPrintPiPatterns (Gia_Man_t *p)
 
int Ssc_GiaTransferPiPattern (Gia_Man_t *pAig, Gia_Man_t *pCare, Vec_Int_t *vPivot)
 
void Ssc_GiaResetSimInfo (Gia_Man_t *p)
 
void Ssc_GiaSimRound (Gia_Man_t *p)
 
wordSsc_GiaGetCareMask (Gia_Man_t *p)
 
Vec_Int_tSsc_GiaGetOneSim (Gia_Man_t *p)
 
Vec_Int_tSsc_GiaFindPivotSim (Gia_Man_t *p)
 
int Ssc_GiaCountCaresSim (Gia_Man_t *p)
 
int Ssc_GiaEstimateCare (Gia_Man_t *p, int nWords)
 

Function Documentation

int Ssc_GiaCountCaresSim ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 343 of file sscSim.c.

344 {
345  word * pRes = Ssc_GiaGetCareMask( p );
346  int nWords = Gia_ObjSimWords( p );
347  int Count = Ssc_SimCountBits( pRes, nWords );
348  ABC_FREE( pRes );
349  return Count;
350 }
word * Ssc_GiaGetCareMask(Gia_Man_t *p)
Definition: sscSim.c:299
int nWords
Definition: abcNpn.c:127
static int Ssc_SimCountBits(word *pSim, int nWords)
Definition: sscSim.c:95
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
int Ssc_GiaEstimateCare ( Gia_Man_t p,
int  nWords 
)

Definition at line 351 of file sscSim.c.

352 {
353  Ssc_GiaRandomPiPattern( p, nWords, NULL );
354  Ssc_GiaSimRound( p );
355  return Ssc_GiaCountCaresSim( p );
356 }
int Ssc_GiaCountCaresSim(Gia_Man_t *p)
Definition: sscSim.c:343
void Ssc_GiaSimRound(Gia_Man_t *p)
Definition: sscSim.c:247
int nWords
Definition: abcNpn.c:127
void Ssc_GiaRandomPiPattern(Gia_Man_t *p, int nWords, Vec_Int_t *vPivot)
Definition: sscSim.c:163
Vec_Int_t* Ssc_GiaFindPivotSim ( Gia_Man_t p)

Definition at line 323 of file sscSim.c.

324 {
325  Vec_Int_t * vInit;
326  Ssc_GiaRandomPiPattern( p, 1, NULL );
327  Ssc_GiaSimRound( p );
328  vInit = Ssc_GiaGetOneSim( p );
329  return vInit;
330 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Ssc_GiaSimRound(Gia_Man_t *p)
Definition: sscSim.c:247
Vec_Int_t * Ssc_GiaGetOneSim(Gia_Man_t *p)
Definition: sscSim.c:308
void Ssc_GiaRandomPiPattern(Gia_Man_t *p, int nWords, Vec_Int_t *vPivot)
Definition: sscSim.c:163
word* Ssc_GiaGetCareMask ( Gia_Man_t p)

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

Synopsis [Returns one SAT assignment of the PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 299 of file sscSim.c.

300 {
301  Gia_Obj_t * pObj;
302  int i, nWords = Gia_ObjSimWords( p );
303  word * pRes = ABC_FALLOC( word, nWords );
304  Gia_ManForEachPo( p, pObj, i )
305  Ssc_SimAnd( pRes, pRes, Gia_ObjSimObj(p, pObj), nWords, 0, 0 );
306  return pRes;
307 }
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Ssc_SimAnd(word *pSim, word *pSim0, word *pSim1, int nWords, int fComp0, int fComp1)
Definition: sscSim.c:34
static word * Gia_ObjSimObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:557
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
Vec_Int_t* Ssc_GiaGetOneSim ( Gia_Man_t p)

Definition at line 308 of file sscSim.c.

309 {
310  Vec_Int_t * vInit;
311  Gia_Obj_t * pObj;
312  int i, iBit, nWords = Gia_ObjSimWords( p );
313  word * pRes = Ssc_GiaGetCareMask( p );
314  iBit = Ssc_SimFindBit( pRes, nWords );
315  ABC_FREE( pRes );
316  if ( iBit == -1 )
317  return NULL;
318  vInit = Vec_IntAlloc( 100 );
319  Gia_ManForEachCi( p, pObj, i )
320  Vec_IntPush( vInit, Abc_InfoHasBit((unsigned *)Gia_ObjSimObj(p, pObj), iBit) );
321  return vInit;
322 }
word * Ssc_GiaGetCareMask(Gia_Man_t *p)
Definition: sscSim.c:299
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Ssc_SimFindBit(word *pSim, int nWords)
Definition: sscSim.c:76
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static word * Gia_ObjSimObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:557
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
void Ssc_GiaPrintPiPatterns ( Gia_Man_t p)

Definition at line 178 of file sscSim.c.

179 {
180  Gia_Obj_t * pObj;
181  word * pSimAig;
182  int i;//, nWords = Gia_ObjSimWords( p );
183  Gia_ManForEachCi( p, pObj, i )
184  {
185  pSimAig = Gia_ObjSimObj( p, pObj );
186 // Extra_PrintBinary( stdout, pSimAig, 64 * nWords );
187  }
188 }
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word * Gia_ObjSimObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:557
void Ssc_GiaRandomPiPattern ( Gia_Man_t p,
int  nWords,
Vec_Int_t vPivot 
)

Definition at line 163 of file sscSim.c.

164 {
165  word * pSimPi;
166  int i, w;
168  pSimPi = Gia_ObjSimPi( p, 0 );
169  for ( i = 0; i < Gia_ManPiNum(p); i++, pSimPi += nWords )
170  {
171  pSimPi[0] = vPivot ? Ssc_Random1(Vec_IntEntry(vPivot, i)) : Ssc_Random2();
172  for ( w = 1; w < nWords; w++ )
173  pSimPi[w] = Ssc_Random();
174 // if ( i < 10 )
175 // Extra_PrintBinary( stdout, (unsigned *)pSimPi, 64 ), printf( "\n" );
176  }
177 }
static word Ssc_Random1(int Bit)
Definition: sscSim.c:31
static word Ssc_Random2()
Definition: sscSim.c:32
void Ssc_GiaResetPiPattern(Gia_Man_t *p, int nWords)
Definition: sscSim.c:141
int nWords
Definition: abcNpn.c:127
static word * Gia_ObjSimPi(Gia_Man_t *p, int PiId)
Definition: gia.h:555
static ABC_NAMESPACE_IMPL_START word Ssc_Random()
DECLARATIONS ///.
Definition: sscSim.c:30
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
void Ssc_GiaResetPiPattern ( Gia_Man_t p,
int  nWords 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 141 of file sscSim.c.

142 {
143  p->iPatsPi = 0;
144  if ( p->vSimsPi == NULL )
145  p->vSimsPi = Vec_WrdStart(0);
146  Vec_WrdFill( p->vSimsPi, nWords * Gia_ManCiNum(p), 0 );
147  assert( nWords == Gia_ObjSimWords( p ) );
148 }
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
int nWords
Definition: abcNpn.c:127
int iPatsPi
Definition: gia.h:176
static void Vec_WrdFill(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:489
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
void Ssc_GiaResetSimInfo ( Gia_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 240 of file sscSim.c.

241 {
242  assert( Vec_WrdSize(p->vSimsPi) % Gia_ManCiNum(p) == 0 );
243  if ( p->vSims == NULL )
244  p->vSims = Vec_WrdAlloc(0);
246 }
Vec_Wrd_t * vSims
Definition: gia.h:177
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static void Vec_WrdFill(Vec_Wrd_t *p, int nSize, word Fill)
Definition: vecWrd.h:489
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Ssc_GiaSavePiPattern ( Gia_Man_t p,
Vec_Int_t vPat 
)

Definition at line 149 of file sscSim.c.

150 {
151  word * pSimPi;
152  int i;
153  assert( Vec_IntSize(vPat) == Gia_ManCiNum(p) );
154  if ( p->iPatsPi == 64 * Gia_ObjSimWords(p) )
156  assert( p->iPatsPi < 64 * Gia_ObjSimWords(p) );
157  pSimPi = Gia_ObjSimPi( p, 0 );
158  for ( i = 0; i < Gia_ManCiNum(p); i++, pSimPi += Gia_ObjSimWords(p) )
159  if ( Vec_IntEntry(vPat, i) )
160  Abc_InfoSetBit( (unsigned *)pSimPi, p->iPatsPi );
161  p->iPatsPi++;
162 }
Vec_Wrd_t * vSimsPi
Definition: gia.h:178
static word * Gia_ObjSimPi(Gia_Man_t *p, int PiId)
Definition: gia.h:555
int iPatsPi
Definition: gia.h:176
void Vec_WrdDoubleSimInfo(Vec_Wrd_t *p, int nObjs)
FUNCTION DEFINITIONS ///.
Definition: sscSim.c:119
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
void Ssc_GiaSimRound ( Gia_Man_t p)

Definition at line 247 of file sscSim.c.

248 {
249  Gia_Obj_t * pObj;
250  word * pSim, * pSim0, * pSim1;
251  int i, nWords = Gia_ObjSimWords(p);
252  Ssc_GiaResetSimInfo( p );
253  assert( nWords == Vec_WrdSize(p->vSims) / Gia_ManObjNum(p) );
254  // constant node
255  Ssc_SimConst( Gia_ObjSim(p, 0), nWords, 0 );
256  // primary inputs
257  pSim = Gia_ObjSim( p, 1 );
258  pSim0 = Gia_ObjSimPi( p, 0 );
259  Gia_ManForEachCi( p, pObj, i )
260  {
261  assert( pSim == Gia_ObjSimObj( p, pObj ) );
262  Ssc_SimDup( pSim, pSim0, nWords, 0 );
263  pSim += nWords;
264  pSim0 += nWords;
265  }
266  // intermediate nodes
267  pSim = Gia_ObjSim( p, 1+Gia_ManCiNum(p) );
268  Gia_ManForEachAnd( p, pObj, i )
269  {
270  assert( pSim == Gia_ObjSim( p, i ) );
271  pSim0 = pSim - pObj->iDiff0 * nWords;
272  pSim1 = pSim - pObj->iDiff1 * nWords;
273  Ssc_SimAnd( pSim, pSim0, pSim1, nWords, Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj) );
274  pSim += nWords;
275  }
276  // primary outputs
277  pSim = Gia_ObjSim( p, Gia_ManObjNum(p) - Gia_ManPoNum(p) );
278  Gia_ManForEachPo( p, pObj, i )
279  {
280  assert( pSim == Gia_ObjSimObj( p, pObj ) );
281  pSim0 = pSim - pObj->iDiff0 * nWords;
282  Ssc_SimDup( pSim, pSim0, nWords, Gia_ObjFaninC0(pObj) );
283 // Extra_PrintBinary( stdout, pSim, 64 ), printf( "\n" );
284  pSim += nWords;
285  }
286 }
unsigned iDiff0
Definition: gia.h:77
Vec_Wrd_t * vSims
Definition: gia.h:177
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
Definition: gia.h:452
static void Ssc_SimDup(word *pSim, word *pSim0, int nWords, int fComp0)
Definition: sscSim.c:43
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
static word * Gia_ObjSimPi(Gia_Man_t *p, int PiId)
Definition: gia.h:555
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static void Ssc_SimConst(word *pSim, int nWords, int fComp0)
Definition: sscSim.c:50
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Ssc_SimAnd(word *pSim, word *pSim0, word *pSim1, int nWords, int fComp0, int fComp1)
Definition: sscSim.c:34
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
void Ssc_GiaResetSimInfo(Gia_Man_t *p)
Definition: sscSim.c:240
static word * Gia_ObjSimObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:557
#define assert(ex)
Definition: util_old.h:213
static word * Gia_ObjSim(Gia_Man_t *p, int Id)
Definition: gia.h:556
unsigned iDiff1
Definition: gia.h:82
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
#define Gia_ManForEachPo(p, pObj, i)
Definition: gia.h:1036
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
int Ssc_GiaTransferPiPattern ( Gia_Man_t pAig,
Gia_Man_t pCare,
Vec_Int_t vPivot 
)

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

Synopsis [Transfer the simulation pattern from pCare to pAig.]

Description []

SideEffects []

SeeAlso []

Definition at line 201 of file sscSim.c.

202 {
203  extern word * Ssc_GiaGetCareMask( Gia_Man_t * p );
204  Gia_Obj_t * pObj;
205  int i, w, nWords = Gia_ObjSimWords( pCare );
206  word * pCareMask = Ssc_GiaGetCareMask( pCare );
207  int Count = Ssc_SimCountBits( pCareMask, nWords );
208  word * pSimPiCare, * pSimPiAig;
209  if ( Count == 0 )
210  {
211  ABC_FREE( pCareMask );
212  return 0;
213  }
214  Ssc_GiaResetPiPattern( pAig, nWords );
215  Gia_ManForEachCi( pCare, pObj, i )
216  {
217  pSimPiAig = Gia_ObjSimPi( pAig, i );
218  pSimPiCare = Gia_ObjSimObj( pCare, pObj );
219  for ( w = 0; w < nWords; w++ )
220  if ( Vec_IntEntry(vPivot, i) )
221  pSimPiAig[w] = pSimPiCare[w] | ~pCareMask[w];
222  else
223  pSimPiAig[w] = pSimPiCare[w] & pCareMask[w];
224  }
225  ABC_FREE( pCareMask );
226  return Count;
227 }
word * Ssc_GiaGetCareMask(Gia_Man_t *p)
Definition: sscSim.c:299
void Ssc_GiaResetPiPattern(Gia_Man_t *p, int nWords)
Definition: sscSim.c:141
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
Definition: gia.h:75
static word * Gia_ObjSimPi(Gia_Man_t *p, int PiId)
Definition: gia.h:555
static int Ssc_SimCountBits(word *pSim, int nWords)
Definition: sscSim.c:95
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word * Gia_ObjSimObj(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:557
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
static int Gia_ObjSimWords(Gia_Man_t *p)
Definition: gia.h:554
static ABC_NAMESPACE_IMPL_START word Ssc_Random ( )
inlinestatic

DECLARATIONS ///.

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

FileName [sscSim.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT sweeping under constraints.]

Synopsis [Simulation procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 29, 2008.]

Revision [

Id:
sscSim.c,v 1.00 2008/07/29 00:00:00 alanmi Exp

]

Definition at line 30 of file sscSim.c.

30 { return ((word)Gia_ManRandom(0) << 32) | ((word)Gia_ManRandom(0) << 0); }
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Ssc_Random1 ( int  Bit)
inlinestatic

Definition at line 31 of file sscSim.c.

31 { return ((word)Gia_ManRandom(0) << 32) | ((word)Gia_ManRandom(0) << 1) | (word)Bit; }
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Ssc_Random2 ( )
inlinestatic

Definition at line 32 of file sscSim.c.

32 { return ((word)Gia_ManRandom(0) << 32) | ((word)Gia_ManRandom(0) << 2) | (word)2; }
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Ssc_SimAnd ( word pSim,
word pSim0,
word pSim1,
int  nWords,
int  fComp0,
int  fComp1 
)
inlinestatic

Definition at line 34 of file sscSim.c.

35 {
36  int w;
37  if ( fComp0 && fComp1 ) for ( w = 0; w < nWords; w++ ) pSim[w] = ~(pSim0[w] | pSim1[w]);
38  else if ( fComp0 ) for ( w = 0; w < nWords; w++ ) pSim[w] = ~pSim0[w] & pSim1[w];
39  else if ( fComp1 ) for ( w = 0; w < nWords; w++ ) pSim[w] = pSim0[w] &~pSim1[w];
40  else for ( w = 0; w < nWords; w++ ) pSim[w] = pSim0[w] & pSim1[w];
41 }
int nWords
Definition: abcNpn.c:127
static void Ssc_SimConst ( word pSim,
int  nWords,
int  fComp0 
)
inlinestatic

Definition at line 50 of file sscSim.c.

51 {
52  int w;
53  if ( fComp0 ) for ( w = 0; w < nWords; w++ ) pSim[w] = ~(word)0;
54  else for ( w = 0; w < nWords; w++ ) pSim[w] = 0;
55 }
int nWords
Definition: abcNpn.c:127
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Ssc_SimCountBits ( word pSim,
int  nWords 
)
inlinestatic

Definition at line 95 of file sscSim.c.

96 {
97  int w, Counter = 0;
98  for ( w = 0; w < nWords; w++ )
99  Counter += Ssc_SimCountBitsWord(pSim[w]);
100  return Counter;
101 }
int nWords
Definition: abcNpn.c:127
static int Ssc_SimCountBitsWord(word x)
Definition: sscSim.c:85
static int Counter
static int Ssc_SimCountBitsWord ( word  x)
inlinestatic

Definition at line 85 of file sscSim.c.

86 {
87  x = x - ((x >> 1) & ABC_CONST(0x5555555555555555));
88  x = (x & ABC_CONST(0x3333333333333333)) + ((x >> 2) & ABC_CONST(0x3333333333333333));
89  x = (x + (x >> 4)) & ABC_CONST(0x0F0F0F0F0F0F0F0F);
90  x = x + (x >> 8);
91  x = x + (x >> 16);
92  x = x + (x >> 32);
93  return (int)(x & 0xFF);
94 }
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
static void Ssc_SimDup ( word pSim,
word pSim0,
int  nWords,
int  fComp0 
)
inlinestatic

Definition at line 43 of file sscSim.c.

44 {
45  int w;
46  if ( fComp0 ) for ( w = 0; w < nWords; w++ ) pSim[w] = ~pSim0[w];
47  else for ( w = 0; w < nWords; w++ ) pSim[w] = pSim0[w];
48 }
int nWords
Definition: abcNpn.c:127
static int Ssc_SimFindBit ( word pSim,
int  nWords 
)
inlinestatic

Definition at line 76 of file sscSim.c.

77 {
78  int w;
79  for ( w = 0; w < nWords; w++ )
80  if ( pSim[w] )
81  return 64*w + Ssc_SimFindBitWord(pSim[w]);
82  return -1;
83 }
int nWords
Definition: abcNpn.c:127
static int Ssc_SimFindBitWord(word t)
Definition: sscSim.c:64
static int Ssc_SimFindBitWord ( word  t)
inlinestatic

Definition at line 64 of file sscSim.c.

65 {
66  int n = 0;
67  if ( t == 0 ) return -1;
68  if ( (t & 0x00000000FFFFFFFF) == 0 ) { n += 32; t >>= 32; }
69  if ( (t & 0x000000000000FFFF) == 0 ) { n += 16; t >>= 16; }
70  if ( (t & 0x00000000000000FF) == 0 ) { n += 8; t >>= 8; }
71  if ( (t & 0x000000000000000F) == 0 ) { n += 4; t >>= 4; }
72  if ( (t & 0x0000000000000003) == 0 ) { n += 2; t >>= 2; }
73  if ( (t & 0x0000000000000001) == 0 ) { n++; }
74  return n;
75 }
static void Ssc_SimOr ( word pSim,
word pSim0,
int  nWords,
int  fComp0 
)
inlinestatic

Definition at line 57 of file sscSim.c.

58 {
59  int w;
60  if ( fComp0 ) for ( w = 0; w < nWords; w++ ) pSim[w] |= ~pSim0[w];
61  else for ( w = 0; w < nWords; w++ ) pSim[w] |= pSim0[w];
62 }
int nWords
Definition: abcNpn.c:127
void Vec_WrdDoubleSimInfo ( Vec_Wrd_t p,
int  nObjs 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 119 of file sscSim.c.

120 {
121  word * pArray = ABC_CALLOC( word, 2 * Vec_WrdSize(p) );
122  int i, nWords = Vec_WrdSize(p) / nObjs;
123  assert( Vec_WrdSize(p) % nObjs == 0 );
124  for ( i = 0; i < nObjs; i++ )
125  memcpy( pArray + 2*i*nWords, p->pArray + i*nWords, sizeof(word) * nWords );
126  ABC_FREE( p->pArray ); p->pArray = pArray;
127  p->nSize = p->nCap = 2*nWords*nObjs;
128 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * memcpy()
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
int nWords
Definition: abcNpn.c:127
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213