abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fsimInt.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [fsimInt.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Fast sequential AIG simulator.]
8 
9  Synopsis [Internal declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: fsimInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__aig__fsim__fsimInt_h
22 #define ABC__aig__fsim__fsimInt_h
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 #include "aig/saig/saig.h"
30 #include "fsim.h"
31 
32 ////////////////////////////////////////////////////////////////////////
33 /// PARAMETERS ///
34 ////////////////////////////////////////////////////////////////////////
35 
36 
37 
39 
40 
41 ////////////////////////////////////////////////////////////////////////
42 /// BASIC TYPES ///
43 ////////////////////////////////////////////////////////////////////////
44 
45 // simulation object
46 typedef struct Fsim_Obj_t_ Fsim_Obj_t;
48 {
49  int iNode; // the node ID
50  int iFan0; // the first fanin
51  int iFan1; // the second fanin
52 };
53 
54 // fast sequential simulation manager
56 {
57  // parameters
58  Aig_Man_t * pAig; // the AIG to be used for simulation
59  int nWords; // the number of simulation words
60  // AIG representation
61  int nPis; // the number of primary inputs
62  int nPos; // the number of primary outputs
63  int nCis; // the number of combinational inputs
64  int nCos; // the number of combinational outputs
65  int nNodes; // the number of internal nodes
66  int nObjs; // nCis + nNodes + nCos + 2
67  int * pFans0; // fanin0 for all objects
68  int * pFans1; // fanin1 for all objects
69  int * pRefs; // reference counter for each node
70  int * pRefsCopy; // reference counter for each node
71  Vec_Int_t * vCis2Ids; // mapping of CIs into their PI ids
72  Vec_Int_t * vLos; // register outputs
73  Vec_Int_t * vLis; // register inputs
74  // cross-cut representation
75  int nCrossCut; // temporary cross-cut variable
76  int nCrossCutMax; // maximum cross-cut variable
77  int nFront; // the size of frontier
78  // derived AIG representation
79  int nDataAig; // the length of allocated data
80  unsigned char * pDataAig; // AIG representation
81  unsigned char * pDataCur; // AIG representation (current position)
82  int iNodePrev; // previous extracted value
83  int iNumber; // the number of the last object
84  Fsim_Obj_t Obj; // current object
85  // temporary AIG representation
86  int * pDataAig2; // temporary representation
87  int * pDataCur2; // AIG representation (current position)
88  // simulation information
89  unsigned * pDataSim; // simulation data
90  unsigned * pDataSimCis; // simulation data for CIs
91  unsigned * pDataSimCos; // simulation data for COs
92  // other information
93  int * pData1;
94  int * pData2;
95 };
96 
97 static inline unsigned * Fsim_SimData( Fsim_Man_t * p, int i ) { return p->pDataSim + i * p->nWords; }
98 static inline unsigned * Fsim_SimDataCi( Fsim_Man_t * p, int i ) { return p->pDataSimCis + i * p->nWords; }
99 static inline unsigned * Fsim_SimDataCo( Fsim_Man_t * p, int i ) { return p->pDataSimCos + i * p->nWords; }
100 
101 ////////////////////////////////////////////////////////////////////////
102 /// MACRO DEFINITIONS ///
103 ////////////////////////////////////////////////////////////////////////
104 
105 static inline int Fsim_Var2Lit( int Var, int fCompl ) { return Var + Var + fCompl; }
106 static inline int Fsim_Lit2Var( int Lit ) { return Lit >> 1; }
107 static inline int Fsim_LitIsCompl( int Lit ) { return Lit & 1; }
108 static inline int Fsim_LitNot( int Lit ) { return Lit ^ 1; }
109 static inline int Fsim_LitNotCond( int Lit, int c ) { return Lit ^ (int)(c > 0); }
110 static inline int Fsim_LitRegular( int Lit ) { return Lit & ~01; }
111 
112 #define Fsim_ManForEachObj( p, pObj, i )\
113  for ( i = 2, p->pDataCur = p->pDataAig, p->iNodePrev = 0, pObj = &p->Obj;\
114  i < p->nObjs && Fsim_ManRestoreObj( p, pObj ); i++ )
115 
116 ////////////////////////////////////////////////////////////////////////
117 /// FUNCTION DECLARATIONS ///
118 ////////////////////////////////////////////////////////////////////////
119 
120 /*=== fsimFront.c ========================================================*/
121 extern void Fsim_ManFront( Fsim_Man_t * p, int fCompressAig );
122 /*=== fsimMan.c ==========================================================*/
123 extern Fsim_Man_t * Fsim_ManCreate( Aig_Man_t * pAig );
124 extern void Fsim_ManDelete( Fsim_Man_t * p );
125 extern void Fsim_ManTest( Aig_Man_t * pAig );
126 
127 
128 
130 
131 
132 
133 #endif
134 
135 ////////////////////////////////////////////////////////////////////////
136 /// END OF FILE ///
137 ////////////////////////////////////////////////////////////////////////
138 
void Fsim_ManFront(Fsim_Man_t *p, int fCompressAig)
FUNCTION DECLARATIONS ///.
Definition: fsimFront.c:245
int nNodes
Definition: fsimInt.h:65
int * pData1
Definition: fsimInt.h:93
int iFan1
Definition: fsimInt.h:51
static int Fsim_LitNot(int Lit)
Definition: fsimInt.h:108
Vec_Int_t * vLos
Definition: fsimInt.h:72
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
int nFront
Definition: fsimInt.h:77
static unsigned * Fsim_SimDataCi(Fsim_Man_t *p, int i)
Definition: fsimInt.h:98
int nCos
Definition: fsimInt.h:64
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Aig_Man_t * pAig
Definition: fsimInt.h:58
int * pFans0
Definition: fsimInt.h:67
int nCis
Definition: fsimInt.h:63
static int Fsim_LitNotCond(int Lit, int c)
Definition: fsimInt.h:109
static unsigned * Fsim_SimData(Fsim_Man_t *p, int i)
Definition: fsimInt.h:97
int * pDataAig2
Definition: fsimInt.h:86
int iNode
Definition: fsimInt.h:49
static int Fsim_LitIsCompl(int Lit)
Definition: fsimInt.h:107
int iNodePrev
Definition: fsimInt.h:82
unsigned char * pDataAig
Definition: fsimInt.h:80
Vec_Int_t * vCis2Ids
Definition: fsimInt.h:71
static int Fsim_Lit2Var(int Lit)
Definition: fsimInt.h:106
static int Fsim_Var2Lit(int Var, int fCompl)
MACRO DEFINITIONS ///.
Definition: fsimInt.h:105
void Fsim_ManTest(Aig_Man_t *pAig)
Definition: fsimMan.c:198
typedefABC_NAMESPACE_HEADER_START struct Fsim_Man_t_ Fsim_Man_t
INCLUDES ///.
Definition: fsim.h:42
typedefABC_NAMESPACE_HEADER_START struct Fsim_Obj_t_ Fsim_Obj_t
INCLUDES ///.
Definition: fsimInt.h:46
int nObjs
Definition: fsimInt.h:66
void Fsim_ManDelete(Fsim_Man_t *p)
Definition: fsimMan.c:169
int * pFans1
Definition: fsimInt.h:68
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
int nPos
Definition: fsimInt.h:62
int iFan0
Definition: fsimInt.h:50
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
int iNumber
Definition: fsimInt.h:83
Vec_Int_t * vLis
Definition: fsimInt.h:73
unsigned * pDataSimCis
Definition: fsimInt.h:90
int * pData2
Definition: fsimInt.h:94
int nWords
Definition: fsimInt.h:59
Fsim_Obj_t Obj
Definition: fsimInt.h:84
int nDataAig
Definition: fsimInt.h:79
Fsim_Man_t * Fsim_ManCreate(Aig_Man_t *pAig)
Definition: fsimMan.c:102
int Var
Definition: SolverTypes.h:42
int * pRefsCopy
Definition: fsimInt.h:70
unsigned * pDataSim
Definition: fsimInt.h:89
static int Fsim_LitRegular(int Lit)
Definition: fsimInt.h:110
unsigned * pDataSimCos
Definition: fsimInt.h:91
int nCrossCut
Definition: fsimInt.h:75
int nPis
Definition: fsimInt.h:61
static unsigned * Fsim_SimDataCo(Fsim_Man_t *p, int i)
Definition: fsimInt.h:99
int * pDataCur2
Definition: fsimInt.h:87
int nCrossCutMax
Definition: fsimInt.h:76
unsigned char * pDataCur
Definition: fsimInt.h:81
int * pRefs
Definition: fsimInt.h:69