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

Go to the source code of this file.

Data Structures

struct  Saig_Tsim_t_
 

Macros

#define TSIM_MAX_ROUNDS   10000
 
#define TSIM_ONE_SERIES   3000
 
#define SAIG_XVS0   1
 
#define SAIG_XVS1   2
 
#define SAIG_XVSX   3
 

Typedefs

typedef struct Saig_Tsim_t_ Saig_Tsim_t
 

Functions

static int Saig_XsimConvertValue (int v)
 
static void Saig_ObjSetXsim (Aig_Obj_t *pObj, int Value)
 
static int Saig_ObjGetXsim (Aig_Obj_t *pObj)
 
static int Saig_XsimInv (int Value)
 
static int Saig_XsimAnd (int Value0, int Value1)
 
static int Saig_XsimRand2 ()
 
static int Saig_XsimRand3 ()
 
static int Saig_ObjGetXsimFanin0 (Aig_Obj_t *pObj)
 
static int Saig_ObjGetXsimFanin1 (Aig_Obj_t *pObj)
 
static void Saig_XsimPrint (FILE *pFile, int Value)
 
static unsigned * Saig_TsiNext (unsigned *pState, int nWords)
 
static void Saig_TsiSetNext (unsigned *pState, int nWords, unsigned *pNext)
 
Saig_Tsim_tSaig_TsiStart (Aig_Man_t *pAig)
 DECLARATIONS ///. More...
 
void Saig_TsiStop (Saig_Tsim_t *p)
 
int Saig_TsiStateHash (unsigned *pState, int nWords, int nTableSize)
 
int Saig_TsiCountNonXValuedRegisters (Saig_Tsim_t *p, int nPref)
 
Vec_Int_tSaig_TsiComputeTransient (Saig_Tsim_t *p, int nPref)
 
void Saig_TsiPrintTraces (Saig_Tsim_t *p, int nWords, int nPrefix, int nLoop)
 
int Saig_TsiComputePrefix (Saig_Tsim_t *p, unsigned *pState, int nWords)
 
int Saig_TsiStateLookup (Saig_Tsim_t *p, unsigned *pState, int nWords)
 
void Saig_TsiStateInsert (Saig_Tsim_t *p, unsigned *pState, int nWords)
 
unsigned * Saig_TsiStateNew (Saig_Tsim_t *p)
 
void Saig_TsiStatePrint (Saig_Tsim_t *p, unsigned *pState)
 
int Saig_TsiStateCount (Saig_Tsim_t *p, unsigned *pState)
 
void Saig_TsiStateOrAll (Saig_Tsim_t *pTsi, unsigned *pState)
 
Saig_Tsim_tSaig_ManReachableTernary (Aig_Man_t *p, Vec_Int_t *vInits, int fVerbose)
 
void Saig_ManAnalizeControl (Aig_Man_t *p, int Reg)
 
int Saig_ManFindRegisters (Saig_Tsim_t *pTsi, int nFrames, int fIgnore, int fVerbose)
 
static Aig_Obj_tSaig_ObjFrames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 
static void Saig_ObjSetFrames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
 
static Aig_Obj_tSaig_ObjChild0Frames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 
static Aig_Obj_tSaig_ObjChild1Frames (Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
 
Aig_Man_tSaig_ManPerformAbstraction (Saig_Tsim_t *pTsi, int nFrames, int fVerbose)
 
int Saig_ManPhaseFrameNum (Aig_Man_t *p, Vec_Int_t *vInits)
 
int Saig_ManPhasePrefixLength (Aig_Man_t *p, int fVerbose, int fVeryVerbose, Vec_Int_t **pvTrans)
 
Aig_Man_tSaig_ManPhaseAbstract (Aig_Man_t *p, Vec_Int_t *vInits, int nFrames, int nPref, int fIgnore, int fPrint, int fVerbose)
 
Aig_Man_tSaig_ManPhaseAbstractAuto (Aig_Man_t *p, int fVerbose)
 
Abc_Cex_tSaig_PhaseTranslateCex (Aig_Man_t *p, Abc_Cex_t *pCex)
 

Macro Definition Documentation

#define SAIG_XVS0   1

Definition at line 36 of file saigPhase.c.

#define SAIG_XVS1   2

Definition at line 37 of file saigPhase.c.

#define SAIG_XVSX   3

Definition at line 38 of file saigPhase.c.

#define TSIM_MAX_ROUNDS   10000

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

FileName [saigPhase.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Sequential AIG package.]

Synopsis [Automated phase abstraction.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 33 of file saigPhase.c.

#define TSIM_ONE_SERIES   3000

Definition at line 34 of file saigPhase.c.

Typedef Documentation

typedef struct Saig_Tsim_t_ Saig_Tsim_t

Definition at line 103 of file saigPhase.c.

Function Documentation

void Saig_ManAnalizeControl ( Aig_Man_t p,
int  Reg 
)

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

Synopsis [Analize initial value of the selected register.]

Description []

SideEffects []

SeeAlso []

Definition at line 612 of file saigPhase.c.

613 {
614  Aig_Obj_t * pObj, * pReg, * pCtrl, * pAnd;
615  int i;
616  pReg = Saig_ManLo( p, Reg );
617  pCtrl = Saig_ManLo( p, Saig_ManRegNum(p)-1 );
618  assert( pReg->Id < pCtrl->Id );
619  // find a node pointing to both
620  pAnd = NULL;
621  Aig_ManForEachNode( p, pObj, i )
622  {
623  if ( Aig_ObjFanin0(pObj) == pReg && Aig_ObjFanin1(pObj) == pCtrl )
624  {
625  pAnd = pObj;
626  break;
627  }
628  }
629  if ( pAnd == NULL )
630  {
631  printf( "Register is not found.\n" );
632  return;
633  }
634  printf( "Clock-like register: \n" );
635  Aig_ObjPrint( p, pReg );
636  printf( "\n" );
637  printf( "Control register: \n" );
638  Aig_ObjPrint( p, pCtrl );
639  printf( "\n" );
640  printf( "Their fanout: \n" );
641  Aig_ObjPrint( p, pAnd );
642  printf( "\n" );
643 
644  // find the fanouts of pAnd
645  printf( "Fanouts of the fanout: \n" );
646  Aig_ManForEachObj( p, pObj, i )
647  if ( Aig_ObjFanin0(pObj) == pAnd || Aig_ObjFanin1(pObj) == pAnd )
648  {
649  Aig_ObjPrint( p, pObj );
650  printf( "\n" );
651  }
652  printf( "\n" );
653 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define assert(ex)
Definition: util_old.h:213
int Id
Definition: aig.h:85
int Saig_ManFindRegisters ( Saig_Tsim_t pTsi,
int  nFrames,
int  fIgnore,
int  fVerbose 
)

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

Synopsis [Finds the registers to phase-abstract.]

Description []

SideEffects []

SeeAlso []

Definition at line 666 of file saigPhase.c.

667 {
668  int Values[257] = {0};
669  unsigned * pState;
670  int r, i, k, Reg, Value;
671  int nTests = pTsi->nPrefix + 2 * pTsi->nCycle;
672  assert( nFrames <= 256 );
673  r = 0;
674  Vec_IntForEachEntry( pTsi->vNonXRegs, Reg, i )
675  {
676  for ( k = 0; k < nTests; k++ )
677  {
678  if ( k < pTsi->nPrefix + pTsi->nCycle )
679  pState = (unsigned *)Vec_PtrEntry( pTsi->vStates, k );
680  else
681  pState = (unsigned *)Vec_PtrEntry( pTsi->vStates, k - pTsi->nCycle );
682  Value = (Abc_InfoHasBit( pState, 2 * Reg + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * Reg );
683  assert( Value == SAIG_XVS0 || Value == SAIG_XVS1 );
684  if ( k < nFrames || (fIgnore && k == nFrames) )
685  Values[k % nFrames] = Value;
686  else if ( Values[k % nFrames] != Value )
687  break;
688  }
689  if ( k < nTests )
690  continue;
691  // skip stuck at
692  if ( fIgnore )
693  {
694  for ( k = 1; k < nFrames; k++ )
695  if ( Values[k] != Values[0] )
696  break;
697  if ( k == nFrames )
698  continue;
699  }
700  // report useful register
701  Vec_IntWriteEntry( pTsi->vNonXRegs, r++, Reg );
702  if ( fVerbose )
703  {
704  printf( "Register %5d has generator: [", Reg );
705  for ( k = 0; k < nFrames; k++ )
706  Saig_XsimPrint( stdout, Values[k] );
707  printf( "]\n" );
708 
709  if ( fVerbose )
710  Saig_ManAnalizeControl( pTsi->pAig, Reg );
711  }
712  }
713  Vec_IntShrink( pTsi->vNonXRegs, r );
714  if ( fVerbose )
715  printf( "Found %3d useful registers.\n", Vec_IntSize(pTsi->vNonXRegs) );
716  return Vec_IntSize(pTsi->vNonXRegs);
717 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
Vec_Int_t * vNonXRegs
Definition: saigPhase.c:114
#define SAIG_XVS1
Definition: saigPhase.c:37
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define SAIG_XVS0
Definition: saigPhase.c:36
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
static void Saig_XsimPrint(FILE *pFile, int Value)
Definition: saigPhase.c:86
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Saig_ManAnalizeControl(Aig_Man_t *p, int Reg)
Definition: saigPhase.c:612
Aig_Man_t* Saig_ManPerformAbstraction ( Saig_Tsim_t pTsi,
int  nFrames,
int  fVerbose 
)

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

Synopsis [Performs phase abstraction by unrolling the circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 748 of file saigPhase.c.

749 {
750  Aig_Man_t * pFrames, * pAig = pTsi->pAig;
751  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pObjNew;
752  Aig_Obj_t ** pObjMap;
753  unsigned * pState;
754  int i, f, Reg, Value;
755 
756  assert( Vec_IntSize(pTsi->vNonXRegs) > 0 );
757 
758  // create mapping for the frames nodes
759  pObjMap = ABC_ALLOC( Aig_Obj_t *, nFrames * Aig_ManObjNumMax(pAig) );
760  memset( pObjMap, 0, sizeof(Aig_Obj_t *) * nFrames * Aig_ManObjNumMax(pAig) );
761 
762  // start the fraig package
763  pFrames = Aig_ManStart( Aig_ManObjNumMax(pAig) * nFrames );
764  pFrames->pName = Abc_UtilStrsav( pAig->pName );
765  pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
766  // map constant nodes
767  for ( f = 0; f < nFrames; f++ )
768  Saig_ObjSetFrames( pObjMap, nFrames, Aig_ManConst1(pAig), f, Aig_ManConst1(pFrames) );
769  // create PI nodes for the frames
770  for ( f = 0; f < nFrames; f++ )
771  Aig_ManForEachPiSeq( pAig, pObj, i )
772  Saig_ObjSetFrames( pObjMap, nFrames, pObj, f, Aig_ObjCreateCi(pFrames) );
773  // create the latches
774  Aig_ManForEachLoSeq( pAig, pObj, i )
775  Saig_ObjSetFrames( pObjMap, nFrames, pObj, 0, Aig_ObjCreateCi(pFrames) );
776 
777  // add timeframes
778  for ( f = 0; f < nFrames; f++ )
779  {
780  // replace abstracted registers by constants
781  Vec_IntForEachEntry( pTsi->vNonXRegs, Reg, i )
782  {
783  pObj = Saig_ManLo( pAig, Reg );
784  pState = (unsigned *)Vec_PtrEntry( pTsi->vStates, f );
785  Value = (Abc_InfoHasBit( pState, 2 * Reg + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * Reg );
786  assert( Value == SAIG_XVS0 || Value == SAIG_XVS1 );
787  pObjNew = (Value == SAIG_XVS1)? Aig_ManConst1(pFrames) : Aig_ManConst0(pFrames);
788  Saig_ObjSetFrames( pObjMap, nFrames, pObj, f, pObjNew );
789  }
790  // add internal nodes of this frame
791  Aig_ManForEachNode( pAig, pObj, i )
792  {
793  pObjNew = Aig_And( pFrames, Saig_ObjChild0Frames(pObjMap,nFrames,pObj,f), Saig_ObjChild1Frames(pObjMap,nFrames,pObj,f) );
794  Saig_ObjSetFrames( pObjMap, nFrames, pObj, f, pObjNew );
795  }
796  // set the latch inputs and copy them into the latch outputs of the next frame
797  Aig_ManForEachLiLoSeq( pAig, pObjLi, pObjLo, i )
798  {
799  pObjNew = Saig_ObjChild0Frames(pObjMap,nFrames,pObjLi,f);
800  if ( f < nFrames - 1 )
801  Saig_ObjSetFrames( pObjMap, nFrames, pObjLo, f+1, pObjNew );
802  }
803  }
804  for ( f = 0; f < nFrames; f++ )
805  {
806  Aig_ManForEachPoSeq( pAig, pObj, i )
807  {
808  pObjNew = Aig_ObjCreateCo( pFrames, Saig_ObjChild0Frames(pObjMap,nFrames,pObj,f) );
809  Saig_ObjSetFrames( pObjMap, nFrames, pObj, f, pObjNew );
810  }
811  }
812  pFrames->nRegs = pAig->nRegs;
813  pFrames->nTruePis = Aig_ManCiNum(pFrames) - Aig_ManRegNum(pFrames);
814  pFrames->nTruePos = Aig_ManCoNum(pFrames) - Aig_ManRegNum(pFrames);
815  Aig_ManForEachLiSeq( pAig, pObj, i )
816  {
817  pObjNew = Aig_ObjCreateCo( pFrames, Saig_ObjChild0Frames(pObjMap,nFrames,pObj,nFrames-1) );
818  Saig_ObjSetFrames( pObjMap, nFrames, pObj, nFrames-1, pObjNew );
819  }
820 //Aig_ManPrintStats( pFrames );
821  Aig_ManSeqCleanup( pFrames );
822 //Aig_ManPrintStats( pFrames );
823 // Aig_ManCiCleanup( pFrames );
824 //Aig_ManPrintStats( pFrames );
825  ABC_FREE( pObjMap );
826  return pFrames;
827 }
char * memset()
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
Aig_Man_t * pAig
Definition: saigPhase.c:106
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
static Aig_Obj_t * Saig_ManLo(Aig_Man_t *p, int i)
Definition: saig.h:79
static void Saig_ObjSetFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i, Aig_Obj_t *pNode)
Definition: saigPhase.c:732
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
Definition: aig.h:263
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Aig_Obj_t * Saig_ObjChild0Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: saigPhase.c:734
for(p=first;p->value< newval;p=p->next)
Vec_Int_t * vNonXRegs
Definition: saigPhase.c:114
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define SAIG_XVS1
Definition: saigPhase.c:37
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
#define SAIG_XVS0
Definition: saigPhase.c:36
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Aig_ManForEachLoSeq(p, pObj, i)
Definition: aig.h:441
static Aig_Obj_t * Saig_ObjChild1Frames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: saigPhase.c:735
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
Aig_Man_t* Saig_ManPhaseAbstract ( Aig_Man_t p,
Vec_Int_t vInits,
int  nFrames,
int  nPref,
int  fIgnore,
int  fPrint,
int  fVerbose 
)

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

Synopsis [Performs automated phase abstraction.]

Description [Takes the AIG manager and the array of initial states.]

SideEffects []

SeeAlso []

Definition at line 911 of file saigPhase.c.

912 {
913  Aig_Man_t * pNew = NULL;
914  Saig_Tsim_t * pTsi;
915  assert( Saig_ManRegNum(p) );
916  assert( Saig_ManPiNum(p) );
917  assert( Saig_ManPoNum(p) );
918  // perform terminary simulation
919  pTsi = Saig_ManReachableTernary( p, vInits, fVerbose );
920  if ( pTsi == NULL )
921  return NULL;
922  // derive information
923  pTsi->nPrefix = Saig_TsiComputePrefix( pTsi, (unsigned *)Vec_PtrEntryLast(pTsi->vStates), pTsi->nWords );
924  pTsi->nCycle = Vec_PtrSize(pTsi->vStates) - 1 - pTsi->nPrefix;
925  pTsi->nNonXRegs = Saig_TsiCountNonXValuedRegisters(pTsi, Abc_MinInt(pTsi->nPrefix,nPref));
926  // print statistics
927  if ( fVerbose )
928  {
929  printf( "Lead = %5d. Loop = %5d. Total flops = %5d. Binary flops = %5d.\n",
930  pTsi->nPrefix, pTsi->nCycle, p->nRegs, pTsi->nNonXRegs );
931  if ( pTsi->nNonXRegs < 100 && Vec_PtrSize(pTsi->vStates) < 80 )
932  Saig_TsiPrintTraces( pTsi, pTsi->nWords, pTsi->nPrefix, pTsi->nCycle );
933  }
934  if ( fPrint )
935  printf( "Print-out finished. Phase assignment is not performed.\n" );
936  else if ( nFrames < 2 )
937  printf( "The number of frames is less than 2. Phase assignment is not performed.\n" );
938  else if ( nFrames > 256 )
939  printf( "The number of frames is more than 256. Phase assignment is not performed.\n" );
940  else if ( pTsi->nCycle == 1 )
941  printf( "The cycle of ternary states is trivial. Phase abstraction cannot be done.\n" );
942  else if ( pTsi->nCycle % nFrames != 0 )
943  printf( "The cycle (%d) is not modulo the number of frames (%d). Phase abstraction cannot be done.\n", pTsi->nCycle, nFrames );
944  else if ( pTsi->nNonXRegs == 0 )
945  printf( "All registers have X-valued states. Phase abstraction cannot be done.\n" );
946  else if ( !Saig_ManFindRegisters( pTsi, nFrames, fIgnore, fVerbose ) )
947  printf( "There is no registers to abstract with %d frames.\n", nFrames );
948  else
949  pNew = Saig_ManPerformAbstraction( pTsi, nFrames, fVerbose );
950  Saig_TsiStop( pTsi );
951  return pNew;
952 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Saig_TsiCountNonXValuedRegisters(Saig_Tsim_t *p, int nPref)
Definition: saigPhase.c:225
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
Aig_Man_t * Saig_ManPerformAbstraction(Saig_Tsim_t *pTsi, int nFrames, int fVerbose)
Definition: saigPhase.c:748
int Saig_TsiComputePrefix(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:365
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
void Saig_TsiPrintTraces(Saig_Tsim_t *p, int nWords, int nPrefix, int nLoop)
Definition: saigPhase.c:305
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Saig_Tsim_t * Saig_ManReachableTernary(Aig_Man_t *p, Vec_Int_t *vInits, int fVerbose)
Definition: saigPhase.c:531
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
void Saig_TsiStop(Saig_Tsim_t *p)
Definition: saigPhase.c:168
int Saig_ManFindRegisters(Saig_Tsim_t *pTsi, int nFrames, int fIgnore, int fVerbose)
Definition: saigPhase.c:666
Aig_Man_t* Saig_ManPhaseAbstractAuto ( Aig_Man_t p,
int  fVerbose 
)

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

Synopsis [Performs automated phase abstraction.]

Description [Takes the AIG manager and the array of initial states.]

SideEffects []

SeeAlso []

Definition at line 965 of file saigPhase.c.

966 {
967  Aig_Man_t * pNew = NULL;
968  Saig_Tsim_t * pTsi;
969  int fPrint = 0;
970  int nFrames;
971  assert( Saig_ManRegNum(p) );
972  assert( Saig_ManPiNum(p) );
973  assert( Saig_ManPoNum(p) );
974  // perform terminary simulation
975  pTsi = Saig_ManReachableTernary( p, NULL, fVerbose );
976  if ( pTsi == NULL )
977  return NULL;
978  // derive information
979  pTsi->nPrefix = Saig_TsiComputePrefix( pTsi, (unsigned *)Vec_PtrEntryLast(pTsi->vStates), pTsi->nWords );
980  pTsi->nCycle = Vec_PtrSize(pTsi->vStates) - 1 - pTsi->nPrefix;
982  // print statistics
983  if ( fVerbose )
984  {
985  printf( "Lead = %5d. Loop = %5d. Total flops = %5d. Binary flops = %5d.\n",
986  pTsi->nPrefix, pTsi->nCycle, p->nRegs, pTsi->nNonXRegs );
987  if ( pTsi->nNonXRegs < 100 && Vec_PtrSize(pTsi->vStates) < 80 )
988  Saig_TsiPrintTraces( pTsi, pTsi->nWords, pTsi->nPrefix, pTsi->nCycle );
989  }
990  nFrames = pTsi->nCycle;
991  if ( fPrint )
992  {
993  printf( "Print-out finished. Phase assignment is not performed.\n" );
994  }
995  else if ( nFrames < 2 )
996  {
997 // printf( "The number of frames is less than 2. Phase assignment is not performed.\n" );
998  }
999  else if ( nFrames > 256 )
1000  {
1001 // printf( "The number of frames is more than 256. Phase assignment is not performed.\n" );
1002  }
1003  else if ( pTsi->nCycle == 1 )
1004  {
1005 // printf( "The cycle of ternary states is trivial. Phase abstraction cannot be done.\n" );
1006  }
1007  else if ( pTsi->nCycle % nFrames != 0 )
1008  {
1009 // printf( "The cycle (%d) is not modulo the number of frames (%d). Phase abstraction cannot be done.\n", pTsi->nCycle, nFrames );
1010  }
1011  else if ( pTsi->nNonXRegs == 0 )
1012  {
1013 // printf( "All registers have X-valued states. Phase abstraction cannot be done.\n" );
1014  }
1015  else if ( !Saig_ManFindRegisters( pTsi, nFrames, 0, fVerbose ) )
1016  {
1017 // printf( "There is no registers to abstract with %d frames.\n", nFrames );
1018  }
1019  else
1020  pNew = Saig_ManPerformAbstraction( pTsi, nFrames, fVerbose );
1021  Saig_TsiStop( pTsi );
1022  if ( pNew == NULL )
1023  pNew = Aig_ManDupSimple( p );
1024  if ( Aig_ManCiNum(pNew) == Aig_ManRegNum(pNew) )
1025  {
1026  Aig_ManStop( pNew);
1027  pNew = Aig_ManDupSimple( p );
1028  }
1029  return pNew;
1030 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Saig_TsiCountNonXValuedRegisters(Saig_Tsim_t *p, int nPref)
Definition: saigPhase.c:225
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Man_t * Saig_ManPerformAbstraction(Saig_Tsim_t *pTsi, int nFrames, int fVerbose)
Definition: saigPhase.c:748
int Saig_TsiComputePrefix(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:365
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
void Saig_TsiPrintTraces(Saig_Tsim_t *p, int nWords, int nPrefix, int nLoop)
Definition: saigPhase.c:305
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Saig_Tsim_t * Saig_ManReachableTernary(Aig_Man_t *p, Vec_Int_t *vInits, int fVerbose)
Definition: saigPhase.c:531
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
void Saig_TsiStop(Saig_Tsim_t *p)
Definition: saigPhase.c:168
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
int Saig_ManFindRegisters(Saig_Tsim_t *pTsi, int nFrames, int fIgnore, int fVerbose)
Definition: saigPhase.c:666
int Saig_ManPhaseFrameNum ( Aig_Man_t p,
Vec_Int_t vInits 
)

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

Synopsis [Performs automated phase abstraction.]

Description [Takes the AIG manager and the array of initial states.]

SideEffects []

SeeAlso []

Definition at line 841 of file saigPhase.c.

842 {
843  Saig_Tsim_t * pTsi;
844  int nFrames, nPrefix;
845  assert( Saig_ManRegNum(p) );
846  assert( Saig_ManPiNum(p) );
847  assert( Saig_ManPoNum(p) );
848  // perform terminary simulation
849  pTsi = Saig_ManReachableTernary( p, vInits, 0 );
850  if ( pTsi == NULL )
851  return 1;
852  // derive information
853  nPrefix = Saig_TsiComputePrefix( pTsi, (unsigned *)Vec_PtrEntryLast(pTsi->vStates), pTsi->nWords );
854  nFrames = Vec_PtrSize(pTsi->vStates) - 1 - nPrefix;
855  Saig_TsiStop( pTsi );
856  // potentially, may need to reduce nFrames if nPrefix is less than nFrames
857  return nFrames;
858 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Saig_TsiComputePrefix(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:365
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Saig_Tsim_t * Saig_ManReachableTernary(Aig_Man_t *p, Vec_Int_t *vInits, int fVerbose)
Definition: saigPhase.c:531
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
void Saig_TsiStop(Saig_Tsim_t *p)
Definition: saigPhase.c:168
int Saig_ManPhasePrefixLength ( Aig_Man_t p,
int  fVerbose,
int  fVeryVerbose,
Vec_Int_t **  pvTrans 
)

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

Synopsis [Performs automated phase abstraction.]

Description [Takes the AIG manager and the array of initial states.]

SideEffects []

SeeAlso []

Definition at line 871 of file saigPhase.c.

872 {
873  Saig_Tsim_t * pTsi;
874  int nFrames, nPrefix, nNonXRegs;
875  assert( Saig_ManRegNum(p) );
876  assert( Saig_ManPiNum(p) );
877  assert( Saig_ManPoNum(p) );
878  // perform terminary simulation
879  pTsi = Saig_ManReachableTernary( p, NULL, 0 );
880  if ( pTsi == NULL )
881  return 0;
882  // derive information
883  nPrefix = Saig_TsiComputePrefix( pTsi, (unsigned *)Vec_PtrEntryLast(pTsi->vStates), pTsi->nWords );
884  nFrames = Vec_PtrSize(pTsi->vStates) - 1 - nPrefix;
885  nNonXRegs = Saig_TsiCountNonXValuedRegisters( pTsi, nPrefix );
886 
887  if ( pvTrans )
888  *pvTrans = Saig_TsiComputeTransient( pTsi, nPrefix );
889 
890  // print statistics
891  if ( fVerbose )
892  printf( "Lead = %5d. Loop = %5d. Total flops = %5d. Binary flops = %5d.\n", nPrefix, nFrames, p->nRegs, nNonXRegs );
893  if ( fVeryVerbose )
894  Saig_TsiPrintTraces( pTsi, pTsi->nWords, nPrefix, nFrames );
895  Saig_TsiStop( pTsi );
896  // potentially, may need to reduce nFrames if nPrefix is less than nFrames
897  return nPrefix;
898 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Saig_TsiCountNonXValuedRegisters(Saig_Tsim_t *p, int nPref)
Definition: saigPhase.c:225
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Saig_TsiComputePrefix(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:365
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
Vec_Int_t * Saig_TsiComputeTransient(Saig_Tsim_t *p, int nPref)
Definition: saigPhase.c:258
void Saig_TsiPrintTraces(Saig_Tsim_t *p, int nWords, int nPrefix, int nLoop)
Definition: saigPhase.c:305
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
Saig_Tsim_t * Saig_ManReachableTernary(Aig_Man_t *p, Vec_Int_t *vInits, int fVerbose)
Definition: saigPhase.c:531
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
void Saig_TsiStop(Saig_Tsim_t *p)
Definition: saigPhase.c:168
Saig_Tsim_t* Saig_ManReachableTernary ( Aig_Man_t p,
Vec_Int_t vInits,
int  fVerbose 
)

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

Synopsis [Cycles the circuit to create a new initial state.]

Description [Simulates the circuit with random input for the given number of timeframes to get a better initial state.]

SideEffects []

SeeAlso []

Definition at line 531 of file saigPhase.c.

532 {
533  Saig_Tsim_t * pTsi;
534  Aig_Obj_t * pObj, * pObjLi, * pObjLo;
535  unsigned * pState;
536  int i, f, Value, nCounter;
537  // allocate the simulation manager
538  pTsi = Saig_TsiStart( p );
539  // initialize the values
541  Saig_ManForEachPi( p, pObj, i )
542  Saig_ObjSetXsim( pObj, SAIG_XVSX );
543  if ( vInits )
544  {
545  Saig_ManForEachLo( p, pObj, i )
547  }
548  else
549  {
550  Saig_ManForEachLo( p, pObj, i )
551  Saig_ObjSetXsim( pObj, SAIG_XVS0 );
552  }
553  // simulate for the given number of timeframes
554  for ( f = 0; f < TSIM_MAX_ROUNDS; f++ )
555  {
556  // collect this state
557  pState = Saig_TsiStateNew( pTsi );
558  Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
559  {
560  Value = Saig_ObjGetXsim(pObjLo);
561  if ( Value & 1 )
562  Abc_InfoSetBit( pState, 2 * i );
563  if ( Value & 2 )
564  Abc_InfoSetBit( pState, 2 * i + 1 );
565  }
566 // printf( "%d ", Saig_TsiStateCount(pTsi, pState) );
567 // Saig_TsiStatePrint( pTsi, pState );
568  // check if this state exists
569  if ( Saig_TsiStateLookup( pTsi, pState, pTsi->nWords ) )
570  {
571  if ( fVerbose )
572  printf( "Ternary simulation converged after %d iterations.\n", f );
573  return pTsi;
574  }
575  // insert this state
576  Saig_TsiStateInsert( pTsi, pState, pTsi->nWords );
577  // simulate internal nodes
578  Aig_ManForEachNode( p, pObj, i )
580  // transfer the latch values
581  Saig_ManForEachLi( p, pObj, i )
582  Saig_ObjSetXsim( pObj, Saig_ObjGetXsimFanin0(pObj) );
583  nCounter = 0;
584  Saig_ManForEachLiLo( p, pObjLi, pObjLo, i )
585  {
586  if ( f < TSIM_ONE_SERIES )
587  Saig_ObjSetXsim( pObjLo, Saig_ObjGetXsim(pObjLi) );
588  else
589  {
590  if ( Saig_ObjGetXsim(pObjLi) != Saig_ObjGetXsim(pObjLo) )
591  Saig_ObjSetXsim( pObjLo, SAIG_XVSX );
592  }
593  nCounter += (Saig_ObjGetXsim(pObjLo) == SAIG_XVS0);
594  }
595  }
596  printf( "Saig_ManReachableTernary(): Did not reach a fixed point after %d iterations (not a bug).\n", TSIM_MAX_ROUNDS );
597  Saig_TsiStop( pTsi );
598  return NULL;
599 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
int Saig_TsiStateLookup(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:395
void Saig_TsiStateInsert(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:417
for(p=first;p->value< newval;p=p->next)
static int Saig_XsimAnd(int Value0, int Value1)
Definition: saigPhase.c:53
Saig_Tsim_t * Saig_TsiStart(Aig_Man_t *pAig)
DECLARATIONS ///.
Definition: saigPhase.c:142
#define SAIG_XVS1
Definition: saigPhase.c:37
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define SAIG_XVSX
Definition: saigPhase.c:38
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Saig_ObjGetXsimFanin1(Aig_Obj_t *pObj)
Definition: saigPhase.c:80
#define SAIG_XVS0
Definition: saigPhase.c:36
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
unsigned * Saig_TsiStateNew(Saig_Tsim_t *p)
Definition: saigPhase.c:436
static int Saig_ObjGetXsimFanin0(Aig_Obj_t *pObj)
Definition: saigPhase.c:74
static void Saig_ObjSetXsim(Aig_Obj_t *pObj, int Value)
Definition: saigPhase.c:42
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define TSIM_ONE_SERIES
Definition: saigPhase.c:34
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Saig_ObjGetXsim(Aig_Obj_t *pObj)
Definition: saigPhase.c:43
void Saig_TsiStop(Saig_Tsim_t *p)
Definition: saigPhase.c:168
static int Saig_XsimConvertValue(int v)
Definition: saigPhase.c:40
#define TSIM_MAX_ROUNDS
Definition: saigPhase.c:33
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
static Aig_Obj_t* Saig_ObjChild0Frames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 734 of file saigPhase.c.

734 { return Aig_ObjFanin0(pObj)? Aig_NotCond(Saig_ObjFrames(pObjMap,nFs,Aig_ObjFanin0(pObj),i), Aig_ObjFaninC0(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Saig_ObjFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: saigPhase.c:731
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Saig_ObjChild1Frames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 735 of file saigPhase.c.

735 { return Aig_ObjFanin1(pObj)? Aig_NotCond(Saig_ObjFrames(pObjMap,nFs,Aig_ObjFanin1(pObj),i), Aig_ObjFaninC1(pObj)) : NULL; }
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static Aig_Obj_t * Saig_ObjFrames(Aig_Obj_t **pObjMap, int nFs, Aig_Obj_t *pObj, int i)
Definition: saigPhase.c:731
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
static Aig_Obj_t* Saig_ObjFrames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i 
)
inlinestatic

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

Synopsis [Mapping of AIG nodes into frames nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 731 of file saigPhase.c.

731 { return pObjMap[nFs*pObj->Id + i]; }
int Id
Definition: aig.h:85
static int Saig_ObjGetXsim ( Aig_Obj_t pObj)
inlinestatic

Definition at line 43 of file saigPhase.c.

43 { return pObj->nCuts; }
unsigned nCuts
Definition: aig.h:83
static int Saig_ObjGetXsimFanin0 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 74 of file saigPhase.c.

75 {
76  int RetValue;
77  RetValue = Saig_ObjGetXsim(Aig_ObjFanin0(pObj));
78  return Aig_ObjFaninC0(pObj)? Saig_XsimInv(RetValue) : RetValue;
79 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static int Saig_XsimInv(int Value)
Definition: saigPhase.c:44
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Saig_ObjGetXsim(Aig_Obj_t *pObj)
Definition: saigPhase.c:43
static int Saig_ObjGetXsimFanin1 ( Aig_Obj_t pObj)
inlinestatic

Definition at line 80 of file saigPhase.c.

81 {
82  int RetValue;
83  RetValue = Saig_ObjGetXsim(Aig_ObjFanin1(pObj));
84  return Aig_ObjFaninC1(pObj)? Saig_XsimInv(RetValue) : RetValue;
85 }
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Saig_XsimInv(int Value)
Definition: saigPhase.c:44
static int Saig_ObjGetXsim(Aig_Obj_t *pObj)
Definition: saigPhase.c:43
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static void Saig_ObjSetFrames ( Aig_Obj_t **  pObjMap,
int  nFs,
Aig_Obj_t pObj,
int  i,
Aig_Obj_t pNode 
)
inlinestatic

Definition at line 732 of file saigPhase.c.

732 { pObjMap[nFs*pObj->Id + i] = pNode; }
int Id
Definition: aig.h:85
static void Saig_ObjSetXsim ( Aig_Obj_t pObj,
int  Value 
)
inlinestatic

Definition at line 42 of file saigPhase.c.

42 { pObj->nCuts = Value; }
unsigned nCuts
Definition: aig.h:83
Abc_Cex_t* Saig_PhaseTranslateCex ( Aig_Man_t p,
Abc_Cex_t pCex 
)

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

Synopsis [Derives CEX for the original AIG from CEX of the unrolled AIG.]

Description [The number of PIs of the given CEX should divide by the number of PIs of the original AIG without a remainder.]

SideEffects []

SeeAlso []

Definition at line 1045 of file saigPhase.c.

1046 {
1047  Abc_Cex_t * pNew;
1048  int i, k, iFrame, nFrames;
1049  // make sure the PI count of the AIG is a multiple of the PI count of the CEX
1050  // if this is not true, the CEX is not derived as the result of unrolling of pAig
1051  // or the unrolled CEX went through transformations that change the PI count
1052  if ( pCex->nPis % Saig_ManPiNum(p) != 0 )
1053  {
1054  printf( "The PI count in the AIG and in the CEX do not match.\n" );
1055  return NULL;
1056  }
1057  // get the number of unrolled frames
1058  nFrames = pCex->nPis / Saig_ManPiNum(p);
1059  // get the frame where it fails
1060  iFrame = pCex->iFrame * nFrames + pCex->iPo / Saig_ManPoNum(p);
1061  // start a new CEX (assigns: p->nRegs, p->nPis, p->nBits)
1062  pNew = Abc_CexAlloc( Saig_ManRegNum(p), Saig_ManPiNum(p), iFrame+1 );
1063  assert( pNew->nBits == pNew->nPis * (iFrame + 1) + pNew->nRegs );
1064  // now assign the failed frame and the failed PO (p->iFrame and p->iPo)
1065  pNew->iFrame = iFrame;
1066  pNew->iPo = pCex->iPo % Saig_ManPoNum(p);
1067  // copy the bit data
1068  for ( i = pCex->nRegs, k = pNew->nRegs; k < pNew->nBits; k++, i++ )
1069  if ( Abc_InfoHasBit( pCex->pData, i ) )
1070  Abc_InfoSetBit( pNew->pData, k );
1071  assert( i <= pCex->nBits );
1072  return pNew;
1073 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
int Saig_TsiComputePrefix ( Saig_Tsim_t p,
unsigned *  pState,
int  nWords 
)

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

Synopsis [Returns the number of the state.]

Description []

SideEffects []

SeeAlso []

Definition at line 365 of file saigPhase.c.

366 {
367  unsigned * pEntry, * pPrev;
368  int Hash, i;
369  Hash = Saig_TsiStateHash( pState, nWords, p->nBins );
370  for ( pEntry = p->pBins[Hash]; pEntry; pEntry = Saig_TsiNext(pEntry, nWords) )
371  if ( !memcmp( pEntry, pState, sizeof(unsigned) * nWords ) )
372  {
373  Vec_PtrForEachEntry( unsigned *, p->vStates, pPrev, i )
374  {
375  if ( pPrev == pEntry )
376  return i;
377  }
378  assert( 0 );
379  return -1;
380  }
381  return -1;
382 }
int Saig_TsiStateHash(unsigned *pState, int nWords, int nTableSize)
Definition: saigPhase.c:189
static unsigned * Saig_TsiNext(unsigned *pState, int nWords)
Definition: saigPhase.c:120
int nWords
Definition: abcNpn.c:127
int memcmp()
unsigned ** pBins
Definition: saigPhase.c:116
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Int_t* Saig_TsiComputeTransient ( Saig_Tsim_t p,
int  nPref 
)

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

Synopsis [Computes flops that are stuck-at constant.]

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file saigPhase.c.

259 {
260  Vec_Int_t * vCounters;
261  unsigned * pState;
262  int ValueThis = -1, ValuePrev = -1, StepPrev = -1;
263  int i, k, nRegs = p->pAig->nRegs;
264  vCounters = Vec_IntStart( nPref );
265  for ( i = 0; i < nRegs; i++ )
266  {
267  Vec_PtrForEachEntry( unsigned *, p->vStates, pState, k )
268  {
269  ValueThis = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
270 //printf( "%s", (ValueThis == 1)? "0" : ((ValueThis == 2)? "1" : "x") );
271  assert( ValueThis != 0 );
272  if ( ValuePrev != ValueThis )
273  {
274  ValuePrev = ValueThis;
275  StepPrev = k;
276  }
277  }
278 //printf( "\n" );
279  if ( ValueThis == SAIG_XVSX )
280  continue;
281  if ( StepPrev >= nPref )
282  continue;
283  Vec_IntAddToEntry( vCounters, StepPrev, 1 );
284  }
285  Vec_IntForEachEntry( vCounters, ValueThis, i )
286  {
287  if ( ValueThis == 0 )
288  continue;
289 // printf( "%3d : %3d\n", i, ValueThis );
290  }
291  return vCounters;
292 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
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 Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define SAIG_XVSX
Definition: saigPhase.c:38
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Saig_TsiCountNonXValuedRegisters ( Saig_Tsim_t p,
int  nPref 
)

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

Synopsis [Count non-X-valued registers in the simulation data.]

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file saigPhase.c.

226 {
227  unsigned * pState;
228  int nRegs = p->pAig->nRegs;
229  int Value, i, k;
230  assert( p->vNonXRegs == NULL );
231  p->vNonXRegs = Vec_IntAlloc( 10 );
232  for ( i = 0; i < nRegs; i++ )
233  {
234  Vec_PtrForEachEntryStart( unsigned *, p->vStates, pState, k, nPref )
235  {
236  Value = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
237  assert( Value != 0 );
238  if ( Value == SAIG_XVSX )
239  break;
240  }
241  if ( k == Vec_PtrSize(p->vStates) )
242  Vec_IntPush( p->vNonXRegs, i );
243  }
244  return Vec_IntSize(p->vNonXRegs);
245 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Int_t * vNonXRegs
Definition: saigPhase.c:114
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define SAIG_XVSX
Definition: saigPhase.c:38
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
static unsigned* Saig_TsiNext ( unsigned *  pState,
int  nWords 
)
inlinestatic

Definition at line 120 of file saigPhase.c.

120 { return *((unsigned **)(pState + nWords)); }
int nWords
Definition: abcNpn.c:127
void Saig_TsiPrintTraces ( Saig_Tsim_t p,
int  nWords,
int  nPrefix,
int  nLoop 
)

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

Synopsis [Count non-X-valued registers in the simulation data.]

Description []

SideEffects []

SeeAlso []

Definition at line 305 of file saigPhase.c.

306 {
307  unsigned * pState;
308  int nRegs = p->pAig->nRegs;
309  int Value, i, k, Counter = 0;
310  printf( "Ternary traces for each flop:\n" );
311  printf( " : " );
312  for ( i = 0; i < Vec_PtrSize(p->vStates) - nLoop - 1; i++ )
313  printf( "%d", i%10 );
314  printf( " " );
315  for ( i = 0; i < nLoop; i++ )
316  printf( "%d", i%10 );
317  printf( "\n" );
318  for ( i = 0; i < nRegs; i++ )
319  {
320 /*
321  Vec_PtrForEachEntry( unsigned *, p->vStates, pState, k )
322  {
323  Value = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
324  if ( Value == SAIG_XVSX )
325  break;
326  }
327  if ( k == Vec_PtrSize(p->vStates) )
328  Counter++;
329  else
330  continue;
331 */
332 
333  // print trace
334 // printf( "%5d : %5d %5d ", Counter, i, Saig_ManLo(p->pAig, i)->Id );
335  printf( "%5d : ", Counter++ );
336  Vec_PtrForEachEntryStop( unsigned *, p->vStates, pState, k, Vec_PtrSize(p->vStates)-1 )
337  {
338  Value = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
339  if ( Value == SAIG_XVS0 )
340  printf( "0" );
341  else if ( Value == SAIG_XVS1 )
342  printf( "1" );
343  else if ( Value == SAIG_XVSX )
344  printf( "x" );
345  else
346  assert( 0 );
347  if ( k == nPrefix - 1 )
348  printf( " " );
349  }
350  printf( "\n" );
351  }
352 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
static int Counter
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
static void Saig_TsiSetNext ( unsigned *  pState,
int  nWords,
unsigned *  pNext 
)
inlinestatic

Definition at line 121 of file saigPhase.c.

121 { *((unsigned **)(pState + nWords)) = pNext; }
int nWords
Definition: abcNpn.c:127
Saig_Tsim_t* Saig_TsiStart ( Aig_Man_t pAig)

DECLARATIONS ///.

FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Allocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file saigPhase.c.

143 {
144  Saig_Tsim_t * p;
145  p = (Saig_Tsim_t *)ABC_ALLOC( char, sizeof(Saig_Tsim_t) );
146  memset( p, 0, sizeof(Saig_Tsim_t) );
147  p->pAig = pAig;
148  p->nWords = Abc_BitWordNum( 2*Aig_ManRegNum(pAig) );
149  p->vStates = Vec_PtrAlloc( 1000 );
150  p->pMem = Aig_MmFixedStart( sizeof(unsigned) * p->nWords + sizeof(unsigned *), 10000 );
152  p->pBins = ABC_ALLOC( unsigned *, p->nBins );
153  memset( p->pBins, 0, sizeof(unsigned *) * p->nBins );
154  return p;
155 }
char * memset()
Aig_Man_t * pAig
Definition: saigPhase.c:106
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition: aigMem.c:96
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Aig_MmFixed_t * pMem
Definition: saigPhase.c:110
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
unsigned ** pBins
Definition: saigPhase.c:116
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
#define TSIM_MAX_ROUNDS
Definition: saigPhase.c:33
int Saig_TsiStateCount ( Saig_Tsim_t p,
unsigned *  pState 
)

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

Synopsis [Count constant values in the state.]

Description []

SideEffects []

SeeAlso []

Definition at line 485 of file saigPhase.c.

486 {
487  Aig_Obj_t * pObjLi, * pObjLo;
488  int i, Value, nCounter = 0;
489  Aig_ManForEachLiLoSeq( p->pAig, pObjLi, pObjLo, i )
490  {
491  Value = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
492  nCounter += (Value == SAIG_XVS0 || Value == SAIG_XVS1);
493  }
494  return nCounter;
495 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define SAIG_XVS1
Definition: saigPhase.c:37
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
#define SAIG_XVS0
Definition: saigPhase.c:36
Definition: aig.h:69
int Saig_TsiStateHash ( unsigned *  pState,
int  nWords,
int  nTableSize 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file saigPhase.c.

190 {
191  static int s_FPrimes[128] = {
192  1009, 1049, 1093, 1151, 1201, 1249, 1297, 1361, 1427, 1459,
193  1499, 1559, 1607, 1657, 1709, 1759, 1823, 1877, 1933, 1997,
194  2039, 2089, 2141, 2213, 2269, 2311, 2371, 2411, 2467, 2543,
195  2609, 2663, 2699, 2741, 2797, 2851, 2909, 2969, 3037, 3089,
196  3169, 3221, 3299, 3331, 3389, 3461, 3517, 3557, 3613, 3671,
197  3719, 3779, 3847, 3907, 3943, 4013, 4073, 4129, 4201, 4243,
198  4289, 4363, 4441, 4493, 4549, 4621, 4663, 4729, 4793, 4871,
199  4933, 4973, 5021, 5087, 5153, 5227, 5281, 5351, 5417, 5471,
200  5519, 5573, 5651, 5693, 5749, 5821, 5861, 5923, 6011, 6073,
201  6131, 6199, 6257, 6301, 6353, 6397, 6481, 6563, 6619, 6689,
202  6737, 6803, 6863, 6917, 6977, 7027, 7109, 7187, 7237, 7309,
203  7393, 7477, 7523, 7561, 7607, 7681, 7727, 7817, 7877, 7933,
204  8011, 8039, 8059, 8081, 8093, 8111, 8123, 8147
205  };
206  unsigned uHash;
207  int i;
208  uHash = 0;
209  for ( i = 0; i < nWords; i++ )
210  uHash ^= pState[i] * s_FPrimes[i & 0x7F];
211  return uHash % nTableSize;
212 }
int nWords
Definition: abcNpn.c:127
void Saig_TsiStateInsert ( Saig_Tsim_t p,
unsigned *  pState,
int  nWords 
)

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 417 of file saigPhase.c.

418 {
419  int Hash = Saig_TsiStateHash( pState, nWords, p->nBins );
420  assert( !Saig_TsiStateLookup( p, pState, nWords ) );
421  Saig_TsiSetNext( pState, nWords, p->pBins[Hash] );
422  p->pBins[Hash] = pState;
423 }
int Saig_TsiStateHash(unsigned *pState, int nWords, int nTableSize)
Definition: saigPhase.c:189
static void Saig_TsiSetNext(unsigned *pState, int nWords, unsigned *pNext)
Definition: saigPhase.c:121
int Saig_TsiStateLookup(Saig_Tsim_t *p, unsigned *pState, int nWords)
Definition: saigPhase.c:395
int nWords
Definition: abcNpn.c:127
unsigned ** pBins
Definition: saigPhase.c:116
#define assert(ex)
Definition: util_old.h:213
int Saig_TsiStateLookup ( Saig_Tsim_t p,
unsigned *  pState,
int  nWords 
)

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

Synopsis [Checks if the value exists in the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 395 of file saigPhase.c.

396 {
397  unsigned * pEntry;
398  int Hash;
399  Hash = Saig_TsiStateHash( pState, nWords, p->nBins );
400  for ( pEntry = p->pBins[Hash]; pEntry; pEntry = Saig_TsiNext(pEntry, nWords) )
401  if ( !memcmp( pEntry, pState, sizeof(unsigned) * nWords ) )
402  return 1;
403  return 0;
404 }
int Saig_TsiStateHash(unsigned *pState, int nWords, int nTableSize)
Definition: saigPhase.c:189
static unsigned * Saig_TsiNext(unsigned *pState, int nWords)
Definition: saigPhase.c:120
int nWords
Definition: abcNpn.c:127
int memcmp()
unsigned ** pBins
Definition: saigPhase.c:116
unsigned* Saig_TsiStateNew ( Saig_Tsim_t p)

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 436 of file saigPhase.c.

437 {
438  unsigned * pState;
439  pState = (unsigned *)Aig_MmFixedEntryFetch( p->pMem );
440  memset( pState, 0, sizeof(unsigned) * p->nWords );
441  Vec_PtrPush( p->vStates, pState );
442  return pState;
443 }
char * memset()
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition: aigMem.c:161
Aig_MmFixed_t * pMem
Definition: saigPhase.c:110
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
void Saig_TsiStateOrAll ( Saig_Tsim_t pTsi,
unsigned *  pState 
)

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

Synopsis [Count constant values in the state.]

Description []

SideEffects []

SeeAlso []

Definition at line 508 of file saigPhase.c.

509 {
510  unsigned * pPrev;
511  int i, k;
512  Vec_PtrForEachEntry( unsigned *, pTsi->vStates, pPrev, i )
513  {
514  for ( k = 0; k < pTsi->nWords; k++ )
515  pState[k] |= pPrev[k];
516  }
517 }
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Saig_TsiStatePrint ( Saig_Tsim_t p,
unsigned *  pState 
)

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

Synopsis [Inserts value into the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 456 of file saigPhase.c.

457 {
458  int i, Value, nZeros = 0, nOnes = 0, nDcs = 0;
459  for ( i = 0; i < Aig_ManRegNum(p->pAig); i++ )
460  {
461  Value = (Abc_InfoHasBit( pState, 2 * i + 1 ) << 1) | Abc_InfoHasBit( pState, 2 * i );
462  if ( Value == SAIG_XVS0 )
463  printf( "0" ), nZeros++;
464  else if ( Value == SAIG_XVS1 )
465  printf( "1" ), nOnes++;
466  else if ( Value == SAIG_XVSX )
467  printf( "x" ), nDcs++;
468  else
469  assert( 0 );
470  }
471  printf( " (0=%5d, 1=%5d, x=%5d)\n", nZeros, nOnes, nDcs );
472 }
Aig_Man_t * pAig
Definition: saigPhase.c:106
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define assert(ex)
Definition: util_old.h:213
void Saig_TsiStop ( Saig_Tsim_t p)

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

Synopsis [Deallocates simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file saigPhase.c.

169 {
170  if ( p->vNonXRegs )
171  Vec_IntFree( p->vNonXRegs );
172  Aig_MmFixedStop( p->pMem, 0 );
173  Vec_PtrFree( p->vStates );
174  ABC_FREE( p->pBins );
175  ABC_FREE( p );
176 }
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition: aigMem.c:132
Vec_Int_t * vNonXRegs
Definition: saigPhase.c:114
Aig_MmFixed_t * pMem
Definition: saigPhase.c:110
#define ABC_FREE(obj)
Definition: abc_global.h:232
unsigned ** pBins
Definition: saigPhase.c:116
Vec_Ptr_t * vStates
Definition: saigPhase.c:109
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Saig_XsimAnd ( int  Value0,
int  Value1 
)
inlinestatic

Definition at line 53 of file saigPhase.c.

54 {
55  if ( Value0 == SAIG_XVS0 || Value1 == SAIG_XVS0 )
56  return SAIG_XVS0;
57  if ( Value0 == SAIG_XVSX || Value1 == SAIG_XVSX )
58  return SAIG_XVSX;
59  assert( Value0 == SAIG_XVS1 && Value1 == SAIG_XVS1 );
60  return SAIG_XVS1;
61 }
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
#define assert(ex)
Definition: util_old.h:213
static int Saig_XsimConvertValue ( int  v)
inlinestatic

Definition at line 40 of file saigPhase.c.

40 { return v == 0? SAIG_XVS0 : (v == 1? SAIG_XVS1 : (v == 2? SAIG_XVSX : -1)); }
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
static int Saig_XsimInv ( int  Value)
inlinestatic

Definition at line 44 of file saigPhase.c.

45 {
46  if ( Value == SAIG_XVS0 )
47  return SAIG_XVS1;
48  if ( Value == SAIG_XVS1 )
49  return SAIG_XVS0;
50  assert( Value == SAIG_XVSX );
51  return SAIG_XVSX;
52 }
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
#define assert(ex)
Definition: util_old.h:213
static void Saig_XsimPrint ( FILE *  pFile,
int  Value 
)
inlinestatic

Definition at line 86 of file saigPhase.c.

87 {
88  if ( Value == SAIG_XVS0 )
89  {
90  fprintf( pFile, "0" );
91  return;
92  }
93  if ( Value == SAIG_XVS1 )
94  {
95  fprintf( pFile, "1" );
96  return;
97  }
98  assert( Value == SAIG_XVSX );
99  fprintf( pFile, "x" );
100 }
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVSX
Definition: saigPhase.c:38
#define SAIG_XVS0
Definition: saigPhase.c:36
#define assert(ex)
Definition: util_old.h:213
static int Saig_XsimRand2 ( )
inlinestatic

Definition at line 62 of file saigPhase.c.

63 {
64  return (Aig_ManRandom(0) & 1) ? SAIG_XVS1 : SAIG_XVS0;
65 }
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157
#define SAIG_XVS1
Definition: saigPhase.c:37
#define SAIG_XVS0
Definition: saigPhase.c:36
static int Saig_XsimRand3 ( )
inlinestatic

Definition at line 66 of file saigPhase.c.

67 {
68  int RetValue;
69  do {
70  RetValue = Aig_ManRandom(0) & 3;
71  } while ( RetValue == 0 );
72  return RetValue;
73 }
unsigned Aig_ManRandom(int fReset)
Definition: aigUtil.c:1157