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

Go to the source code of this file.

Classes

struct  Gia_ManTer_t_
 

Typedefs

typedef struct Gia_ManTer_t_ Gia_ManTer_t
 

Functions

Gia_ManTer_tGia_ManTerCreate (Gia_Man_t *pAig)
 FUNCTION DEFINITIONS ///.
 
void Gia_ManTerStatesFree (Vec_Ptr_t *vStates)
 
void Gia_ManTerDelete (Gia_ManTer_t *p)
 
int Gia_ManTerStateHash (unsigned *pState, int nWords, int nTableSize)
 
unsigned * Gia_ManTerStateLookup (unsigned *pState, int nWords, unsigned **pBins, int nBins)
 
void Gia_ManTerStateInsert (unsigned *pState, int nWords, unsigned **pBins, int nBins)
 
unsigned * Gia_ManTerStateAlloc (int nWords)
 
unsigned * Gia_ManTerStateCreate (Gia_ManTer_t *p)
 
int Gia_ManTerRetire2 (Gia_ManTer_t *p, unsigned *pState)
 
int Gia_ManTerRetire (Gia_ManTer_t *p, unsigned *pThis, unsigned *pPrev)
 
void Gia_ManTerStatePrint (unsigned *pState, int nRegs, int iNum)
 
void Gia_ManTerAnalyze2 (Vec_Ptr_t *vStates, int nRegs)
 
void Gia_ManTerAnalyze (Gia_ManTer_t *p)
 
Vec_Ptr_tGia_ManTerTranspose (Gia_ManTer_t *p)
 
int Gia_ManFindEqualFlop (Vec_Ptr_t *vFlops, int iFlop, int nFlopWords)
 
int * Gia_ManTerCreateMap (Gia_ManTer_t *p, int fVerbose)
 
Gia_ManTer_tGia_ManTerSimulate (Gia_Man_t *pAig, int fVerbose)
 
Gia_Man_tGia_ManReduceConst (Gia_Man_t *pAig, int fVerbose)
 

Typedef Documentation

◆ Gia_ManTer_t

typedef struct Gia_ManTer_t_ Gia_ManTer_t

Definition at line 45 of file giaTsim.c.

Function Documentation

◆ Gia_ManFindEqualFlop()

int Gia_ManFindEqualFlop ( Vec_Ptr_t * vFlops,
int iFlop,
int nFlopWords )

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

Synopsis [Transposes state vector for non-ternary registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 605 of file giaTsim.c.

606{
607 unsigned * pFlop, * pTemp;
608 int i;
609 pFlop = (unsigned *)Vec_PtrEntry( vFlops, iFlop );
610 Vec_PtrForEachEntryStop( unsigned *, vFlops, pTemp, i, iFlop )
611 if ( !memcmp( pTemp, pFlop, sizeof(unsigned) * nFlopWords ) )
612 return i;
613 return -1;
614}
int memcmp()
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition vecPtr.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManReduceConst()

Gia_Man_t * Gia_ManReduceConst ( Gia_Man_t * pAig,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 737 of file giaTsim.c.

738{
739 Gia_ManTer_t * p;
740 Gia_Man_t * pNew = NULL;
741 int * pCi2Lit;
742 p = Gia_ManTerSimulate( pAig, fVerbose );
744 pCi2Lit = Gia_ManTerCreateMap( p, fVerbose );
746 pNew = Gia_ManDupDfsCiMap( pAig, pCi2Lit, NULL );
747 ABC_FREE( pCi2Lit );
748 return pNew;
749}
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
Gia_ManTer_t * Gia_ManTerSimulate(Gia_Man_t *pAig, int fVerbose)
Definition giaTsim.c:668
struct Gia_ManTer_t_ Gia_ManTer_t
Definition giaTsim.c:45
void Gia_ManTerDelete(Gia_ManTer_t *p)
Definition giaTsim.c:133
int * Gia_ManTerCreateMap(Gia_ManTer_t *p, int fVerbose)
Definition giaTsim.c:627
void Gia_ManTerAnalyze(Gia_ManTer_t *p)
Definition giaTsim.c:547
Gia_Man_t * Gia_ManDupDfsCiMap(Gia_Man_t *p, int *pCi2Lit, Vec_Int_t *vLits)
Definition giaDup.c:2708
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerAnalyze()

void Gia_ManTerAnalyze ( Gia_ManTer_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 547 of file giaTsim.c.

548{
549 int i, nZeros = 0, nConsts = 0;
550 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
551 if ( p->pCount0[i] == Vec_PtrSize(p->vStates) )
552 nZeros++;
553 else if ( p->pCountX[i] == 0 )
554 nConsts++;
555// printf( "Found %d constant registers.\n", nZeros );
556// printf( "Found %d non-ternary registers.\n", nConsts );
557}
Here is the caller graph for this function:

◆ Gia_ManTerAnalyze2()

void Gia_ManTerAnalyze2 ( Vec_Ptr_t * vStates,
int nRegs )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 505 of file giaTsim.c.

506{
507 unsigned * pTemp, * pStates = (unsigned *)Vec_PtrPop( vStates );
508 int i, w, nZeros, nConsts, nStateWords;
509 // detect constant zero registers
510 nStateWords = Abc_BitWordNum( 2*nRegs );
511 memset( pStates, 0, sizeof(int) * nStateWords );
512 Vec_PtrForEachEntry( unsigned *, vStates, pTemp, i )
513 for ( w = 0; w < nStateWords; w++ )
514 pStates[w] |= pTemp[w];
515 // count the number of zeros
516 nZeros = 0;
517 for ( i = 0; i < nRegs; i++ )
518 if ( Gia_ManTerSimInfoGet(pStates, i) == GIA_ZER )
519 nZeros++;
520 printf( "Found %d constant registers.\n", nZeros );
521 // detect non-ternary registers
522 memset( pStates, 0, sizeof(int) * nStateWords );
523 Vec_PtrForEachEntry( unsigned *, vStates, pTemp, i )
524 for ( w = 0; w < nStateWords; w++ )
525 pStates[w] |= (~(pTemp[w] ^ (pTemp[w] >> 1)) & 0x55555555);
526 // count the nonternary registers
527 nConsts = 0;
528 for ( i = 0; i < nRegs; i++ )
529 if ( Gia_ManTerSimInfoGet(pStates, i) == 0 )
530 nConsts++;
531 printf( "Found %d non-ternary registers.\n", nConsts );
532 // return the state back
533 Vec_PtrPush( vStates, pStates );
534}
#define GIA_ZER
Definition gia.h:921
char * memset()
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Gia_ManTerCreate()

Gia_ManTer_t * Gia_ManTerCreate ( Gia_Man_t * pAig)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file giaTsim.c.

82{
85 p->pAig = Gia_ManFront( pAig );
86 p->nIters = 300;
87 p->pDataSim = ABC_ALLOC( unsigned, Abc_BitWordNum(2*p->pAig->nFront) );
88 p->pDataSimCis = ABC_ALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCiNum(p->pAig)) );
89 p->pDataSimCos = ABC_ALLOC( unsigned, Abc_BitWordNum(2*Gia_ManCoNum(p->pAig)) );
90 // allocate storage for terminary states
91 p->nStateWords = Abc_BitWordNum( 2*Gia_ManRegNum(pAig) );
92 p->vStates = Vec_PtrAlloc( 1000 );
93 p->pCount0 = ABC_CALLOC( int, Gia_ManRegNum(pAig) );
94 p->pCountX = ABC_CALLOC( int, Gia_ManRegNum(pAig) );
95 p->nBins = Abc_PrimeCudd( 500 );
96 p->pBins = ABC_CALLOC( unsigned *, p->nBins );
97 p->vRetired = Vec_IntAlloc( 100 );
98 p->pRetired = ABC_CALLOC( char, Gia_ManRegNum(pAig) );
99 return p;
100}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Gia_Man_t * Gia_ManFront(Gia_Man_t *p)
Definition giaFront.c:147
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerCreateMap()

int * Gia_ManTerCreateMap ( Gia_ManTer_t * p,
int fVerbose )

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

Synopsis [Creates map of registers to replace.]

Description []

SideEffects []

SeeAlso []

Definition at line 627 of file giaTsim.c.

628{
629 int * pCi2Lit;
630 Gia_Obj_t * pObj;
631 Vec_Int_t * vMapKtoI;
632 int i, iRepr, nFlopWords, Counter0 = 0, CounterE = 0;
633 nFlopWords = Abc_BitWordNum( 2*Vec_PtrSize(p->vStates) );
634 p->vFlops = Gia_ManTerTranspose( p );
635 pCi2Lit = ABC_FALLOC( int, Gia_ManCiNum(p->pAig) );
636 vMapKtoI = Vec_IntAlloc( 100 );
637 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
638 if ( p->pCount0[i] == Vec_PtrSize(p->vStates) )
639 pCi2Lit[Gia_ManPiNum(p->pAig)+i] = 0, Counter0++;
640 else if ( p->pCountX[i] == 0 )
641 {
642 iRepr = Gia_ManFindEqualFlop( p->vFlops, Vec_IntSize(vMapKtoI), nFlopWords );
643 Vec_IntPush( vMapKtoI, i );
644 if ( iRepr < 0 )
645 continue;
646 pObj = Gia_ManCi( p->pAig, Gia_ManPiNum(p->pAig)+Vec_IntEntry(vMapKtoI, iRepr) );
647 pCi2Lit[Gia_ManPiNum(p->pAig)+i] = Abc_Var2Lit( Gia_ObjId( p->pAig, pObj ), 0 );
648 CounterE++;
649 }
650 Vec_IntFree( vMapKtoI );
651 if ( fVerbose )
652 printf( "Transforming %d const and %d equiv registers.\n", Counter0, CounterE );
653 return pCi2Lit;
654}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int Gia_ManFindEqualFlop(Vec_Ptr_t *vFlops, int iFlop, int nFlopWords)
Definition giaTsim.c:605
Vec_Ptr_t * Gia_ManTerTranspose(Gia_ManTer_t *p)
Definition giaTsim.c:572
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerDelete()

void Gia_ManTerDelete ( Gia_ManTer_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file giaTsim.c.

134{
135 if ( p->vStates )
136 Gia_ManTerStatesFree( p->vStates );
137 if ( p->vFlops )
138 Gia_ManTerStatesFree( p->vFlops );
139 Gia_ManStop( p->pAig );
140 Vec_IntFree( p->vRetired );
141 ABC_FREE( p->pRetired );
142 ABC_FREE( p->pCount0 );
143 ABC_FREE( p->pCountX );
144 ABC_FREE( p->pBins );
145 ABC_FREE( p->pDataSim );
146 ABC_FREE( p->pDataSimCis );
147 ABC_FREE( p->pDataSimCos );
148 ABC_FREE( p );
149}
void Gia_ManTerStatesFree(Vec_Ptr_t *vStates)
Definition giaTsim.c:113
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerRetire()

int Gia_ManTerRetire ( Gia_ManTer_t * p,
unsigned * pThis,
unsigned * pPrev )

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

Synopsis [Retires a set of registers to speed up convergence.]

Description [Retire all non-ternary registers which has max number of ternary values so far.]

SideEffects []

SeeAlso []

Definition at line 451 of file giaTsim.c.

452{
453 int i, Entry;
454 // find registers whose value has changed
455 Vec_IntClear( p->vRetired );
456 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
457 if ( Gia_ManTerSimInfoGet( pThis, i ) != Gia_ManTerSimInfoGet( pPrev, i ) )
458 Vec_IntPush( p->vRetired, i );
459 // set all of them to zero
460 Vec_IntForEachEntry( p->vRetired, Entry, i )
461 Gia_ManTerSimInfoSet( p->pDataSimCis, Gia_ManPiNum(p->pAig)+Entry, GIA_UND );
462 return Vec_IntSize(p->vRetired);
463}
#define GIA_UND
Definition gia.h:923
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Gia_ManTerRetire2()

int Gia_ManTerRetire2 ( Gia_ManTer_t * p,
unsigned * pState )

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

Synopsis [Retires a set of registers to speed up convergence.]

Description [Retire all non-ternary registers which has max number of ternary values so far.]

SideEffects []

SeeAlso []

Definition at line 415 of file giaTsim.c.

416{
417 int i, Entry, iMaxTerValue = -1;
418 // find non-retired register with this value
419 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
420 if ( Gia_ManTerSimInfoGet( pState, i ) != GIA_UND && !p->pRetired[i] && iMaxTerValue < p->pCountX[i] )
421 iMaxTerValue = p->pCountX[i];
422 assert( iMaxTerValue >= 0 );
423 // retire the first registers with this value
424 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
425 if ( Gia_ManTerSimInfoGet( pState, i ) != GIA_UND && !p->pRetired[i] && iMaxTerValue == p->pCountX[i] )
426 {
427 assert( p->pRetired[i] == 0 );
428 p->pRetired[i] = 1;
429 Vec_IntPush( p->vRetired, i );
430 if ( iMaxTerValue == 0 )
431 break;
432 }
433 // update all the retired registers
434 Vec_IntForEachEntry( p->vRetired, Entry, i )
435 Gia_ManTerSimInfoSet( p->pDataSimCis, Gia_ManPiNum(p->pAig)+Entry, GIA_UND );
436 return Vec_IntSize(p->vRetired);
437}
#define assert(ex)
Definition util_old.h:213

◆ Gia_ManTerSimulate()

Gia_ManTer_t * Gia_ManTerSimulate ( Gia_Man_t * pAig,
int fVerbose )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 668 of file giaTsim.c.

669{
670 Gia_ManTer_t * p;
671 unsigned * pState, * pPrev, * pLoop;
672 int i, Counter;
673 abctime clk, clkTotal = Abc_Clock();
674 assert( Gia_ManRegNum(pAig) > 0 );
675 // create manager
676 clk = Abc_Clock();
677 p = Gia_ManTerCreate( pAig );
678 if ( 0 )
679 {
680 printf( "Obj = %8d (%8d). F = %6d. ",
681 pAig->nObjs, Gia_ManCiNum(pAig) + Gia_ManAndNum(pAig), p->pAig->nFront );
682 printf( "AIG = %7.2f MB. F-mem = %7.2f MB. Other = %7.2f MB. ",
683 12.0*Gia_ManObjNum(p->pAig)/(1<<20),
684 4.0*Abc_BitWordNum(2 * p->pAig->nFront)/(1<<20),
685 4.0*Abc_BitWordNum(2 * (Gia_ManCiNum(pAig) + Gia_ManCoNum(pAig)))/(1<<20) );
686 ABC_PRT( "Time", Abc_Clock() - clk );
687 }
688 // perform simulation
689 Gia_ManTerSimInfoInit( p );
690 // hash the first state
691 pState = Gia_ManTerStateCreate( p );
692 Gia_ManTerStateInsert( pState, p->nStateWords, p->pBins, p->nBins );
693//Gia_ManTerStatePrint( pState, Gia_ManRegNum(pAig), 0 );
694 // perform simuluation till convergence
695 pPrev = NULL;
696 for ( i = 0; ; i++ )
697 {
698 Gia_ManTerSimulateRound( p );
699 Gia_ManTerSimInfoTransfer( p );
700 pState = Gia_ManTerStateCreate( p );
701//Gia_ManTerStatePrint( pState, Gia_ManRegNum(pAig), i+1 );
702 if ( (pLoop = Gia_ManTerStateLookup(pState, p->nStateWords, p->pBins, p->nBins)) )
703 {
704 pAig->nTerStates = Vec_PtrSize( p->vStates );
705 pAig->nTerLoop = Vec_PtrFind( p->vStates, pLoop );
706 break;
707 }
708 Gia_ManTerStateInsert( pState, p->nStateWords, p->pBins, p->nBins );
709 if ( i >= p->nIters && i % 10 == 0 )
710 {
711 Counter = Gia_ManTerRetire( p, pState, pPrev );
712// Counter = Gia_ManTerRetire2( p, pState );
713// if ( fVerbose )
714// printf( "Retired %d registers.\n", Counter );
715 }
716 pPrev = pState;
717 }
718 if ( fVerbose )
719 {
720 printf( "Ternary simulation saturated after %d iterations. ", i+1 );
721 ABC_PRT( "Time", Abc_Clock() - clkTotal );
722 }
723 return p;
724}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
unsigned * Gia_ManTerStateCreate(Gia_ManTer_t *p)
Definition giaTsim.c:346
unsigned * Gia_ManTerStateLookup(unsigned *pState, int nWords, unsigned **pBins, int nBins)
Definition giaTsim.c:290
void Gia_ManTerStateInsert(unsigned *pState, int nWords, unsigned **pBins, int nBins)
Definition giaTsim.c:311
int Gia_ManTerRetire(Gia_ManTer_t *p, unsigned *pThis, unsigned *pPrev)
Definition giaTsim.c:451
Gia_ManTer_t * Gia_ManTerCreate(Gia_Man_t *pAig)
FUNCTION DEFINITIONS ///.
Definition giaTsim.c:81
int nTerStates
Definition gia.h:131
int nTerLoop
Definition gia.h:130
int nObjs
Definition gia.h:103
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerStateAlloc()

unsigned * Gia_ManTerStateAlloc ( int nWords)

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

Synopsis [Allocs new ternary state.]

Description []

SideEffects []

SeeAlso []

Definition at line 330 of file giaTsim.c.

331{
332 return (unsigned *)ABC_CALLOC( char, sizeof(unsigned) * nWords + sizeof(unsigned *) );
333}
int nWords
Definition abcNpn.c:127
Here is the caller graph for this function:

◆ Gia_ManTerStateCreate()

unsigned * Gia_ManTerStateCreate ( Gia_ManTer_t * p)

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

Synopsis [Creates new ternary state.]

Description []

SideEffects []

SeeAlso []

Definition at line 346 of file giaTsim.c.

347{
348 int i, Value, nPis = Gia_ManPiNum(p->pAig);
349 unsigned * pRes = Gia_ManTerStateAlloc( p->nStateWords );
350 for ( i = nPis; i < Gia_ManCiNum(p->pAig); i++ )
351 {
352 Value = Gia_ManTerSimInfoGet( p->pDataSimCis, i );
353 Gia_ManTerSimInfoSet( pRes, i-nPis, Value );
354 if ( Value == GIA_ZER )
355 p->pCount0[i-nPis]++;
356 if ( Value == GIA_UND )
357 p->pCountX[i-nPis]++;
358 }
359 Vec_PtrPush( p->vStates, pRes );
360 return pRes;
361}
unsigned * Gia_ManTerStateAlloc(int nWords)
Definition giaTsim.c:330
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerStateHash()

int Gia_ManTerStateHash ( unsigned * pState,
int nWords,
int nTableSize )

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

Synopsis [Computes hash value of the node using its simulation info.]

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file giaTsim.c.

255{
256 static int s_FPrimes[128] = {
257 1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
258 1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
259 2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
260 2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
261 3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
262 3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
263 4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
264 4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
265 5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
266 6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
267 6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
268 7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
269 8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
270 };
271 unsigned uHash;
272 int i;
273 uHash = 0;
274 for ( i = 0; i < nWords; i++ )
275 uHash ^= pState[i] * s_FPrimes[i & 0x7F];
276 return uHash % nTableSize;
277}
Here is the caller graph for this function:

◆ Gia_ManTerStateInsert()

void Gia_ManTerStateInsert ( unsigned * pState,
int nWords,
unsigned ** pBins,
int nBins )

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file giaTsim.c.

312{
313 int Hash = Gia_ManTerStateHash( pState, nWords, nBins );
314 assert( !Gia_ManTerStateLookup( pState, nWords, pBins, nBins ) );
315 Gia_ManTerStateSetNext( pState, nWords, pBins[Hash] );
316 pBins[Hash] = pState;
317}
int Gia_ManTerStateHash(unsigned *pState, int nWords, int nTableSize)
Definition giaTsim.c:254
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerStateLookup()

unsigned * Gia_ManTerStateLookup ( unsigned * pState,
int nWords,
unsigned ** pBins,
int nBins )

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file giaTsim.c.

291{
292 unsigned * pEntry;
293 int Hash = Gia_ManTerStateHash( pState, nWords, nBins );
294 for ( pEntry = pBins[Hash]; pEntry; pEntry = Gia_ManTerStateNext(pEntry, nWords) )
295 if ( !memcmp( pEntry, pState, sizeof(unsigned) * nWords ) )
296 return pEntry;
297 return NULL;
298}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTerStatePrint()

void Gia_ManTerStatePrint ( unsigned * pState,
int nRegs,
int iNum )

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 476 of file giaTsim.c.

477{
478 int i, nZeros = 0, nOnes = 0, nDcs = 0;
479 printf( " %4d : ", iNum );
480 for ( i = 0; i < nRegs; i++ )
481 {
482 if ( Gia_ManTerSimInfoGet(pState, i) == GIA_ZER )
483 printf( "0" ), nZeros++;
484 else if ( Gia_ManTerSimInfoGet(pState, i) == GIA_ONE )
485 printf( "1" ), nOnes++;
486 else if ( Gia_ManTerSimInfoGet(pState, i) == GIA_UND )
487 printf( "x" ), nDcs++;
488 else
489 assert( 0 );
490 }
491 printf( " (0=%4d, 1=%4d, x=%4d)\n", nZeros, nOnes, nDcs );
492}
#define GIA_ONE
Definition gia.h:922

◆ Gia_ManTerStatesFree()

void Gia_ManTerStatesFree ( Vec_Ptr_t * vStates)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file giaTsim.c.

114{
115 unsigned * pTemp;
116 int i;
117 Vec_PtrForEachEntry( unsigned *, vStates, pTemp, i )
118 ABC_FREE( pTemp );
119 Vec_PtrFree( vStates );
120}
Here is the caller graph for this function:

◆ Gia_ManTerTranspose()

Vec_Ptr_t * Gia_ManTerTranspose ( Gia_ManTer_t * p)

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

Synopsis [Transposes state vector for non-ternary registers.]

Description []

SideEffects []

SeeAlso []

Definition at line 572 of file giaTsim.c.

573{
574 Vec_Ptr_t * vFlops;
575 unsigned * pState, * pFlop;
576 int i, k, nFlopWords;
577 vFlops = Vec_PtrAlloc( 100 );
578 nFlopWords = Abc_BitWordNum( 2*Vec_PtrSize(p->vStates) );
579 for ( i = 0; i < Gia_ManRegNum(p->pAig); i++ )
580 {
581 if ( p->pCount0[i] == Vec_PtrSize(p->vStates) )
582 continue;
583 if ( p->pCountX[i] > 0 )
584 continue;
585 pFlop = Gia_ManTerStateAlloc( nFlopWords );
586 Vec_PtrPush( vFlops, pFlop );
587 Vec_PtrForEachEntry( unsigned *, p->vStates, pState, k )
588 Gia_ManTerSimInfoSet( pFlop, k, Gia_ManTerSimInfoGet(pState, i) );
589//Gia_ManTerStatePrint( pFlop, Vec_PtrSize(p->vStates), i );
590 }
591 return vFlops;
592}
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function: