ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fsimInt.h File Reference
#include "aig/saig/saig.h"
#include "fsim.h"
Include dependency graph for fsimInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Fsim_Obj_t_
 
struct  Fsim_Man_t_
 

Macros

#define Fsim_ManForEachObj(p, pObj, i)
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Fsim_Obj_t_ Fsim_Obj_t
 INCLUDES ///.
 

Functions

void Fsim_ManFront (Fsim_Man_t *p, int fCompressAig)
 FUNCTION DECLARATIONS ///.
 
Fsim_Man_tFsim_ManCreate (Aig_Man_t *pAig)
 
void Fsim_ManDelete (Fsim_Man_t *p)
 
void Fsim_ManTest (Aig_Man_t *pAig)
 

Macro Definition Documentation

◆ Fsim_ManForEachObj

#define Fsim_ManForEachObj ( p,
pObj,
i )
Value:
for ( i = 2, p->pDataCur = p->pDataAig, p->iNodePrev = 0, pObj = &p->Obj;\
i < p->nObjs && Fsim_ManRestoreObj( p, pObj ); i++ )
Cube * p
Definition exorList.c:222

Definition at line 112 of file fsimInt.h.

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++ )

Typedef Documentation

◆ Fsim_Obj_t

typedef typedefABC_NAMESPACE_HEADER_START struct Fsim_Obj_t_ Fsim_Obj_t

INCLUDES ///.

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

FileName [fsimInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Fast sequential AIG simulator.]

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
fsimInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 46 of file fsimInt.h.

Function Documentation

◆ Fsim_ManCreate()

Fsim_Man_t * Fsim_ManCreate ( Aig_Man_t * pAig)
extern

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

Synopsis [Creates fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file fsimMan.c.

103{
104 Fsim_Man_t * p;
105 Aig_Obj_t * pObj;
106 int i, nObjs;
107 Aig_ManCleanData( pAig );
108 p = (Fsim_Man_t *)ABC_ALLOC( Fsim_Man_t, 1 );
109 memset( p, 0, sizeof(Fsim_Man_t) );
110 p->pAig = pAig;
111 p->nPis = Saig_ManPiNum(pAig);
112 p->nPos = Saig_ManPoNum(pAig);
113 p->nCis = Aig_ManPiNum(pAig);
114 p->nCos = Aig_ManPoNum(pAig);
115 p->nNodes = Aig_ManNodeNum(pAig);
116 nObjs = p->nCis + p->nCos + p->nNodes + 2;
117 p->pFans0 = ABC_ALLOC( int, nObjs );
118 p->pFans1 = ABC_ALLOC( int, nObjs );
119 p->pRefs = ABC_ALLOC( int, nObjs );
120 p->vCis2Ids = Vec_IntAlloc( Aig_ManPiNum(pAig) );
121 // add objects (0=unused; 1=const1)
122 p->pFans0[0] = p->pFans1[0] = 0;
123 p->pFans0[1] = p->pFans1[1] = 0;
124 p->pRefs[0] = 0;
125 p->nObjs = 2;
126 pObj = Aig_ManConst1( pAig );
127 pObj->iData = 1;
128 p->pRefs[1] = Aig_ObjRefs(pObj);
129 if ( p->pRefs[1] )
130 p->nCrossCut = 1;
131 Aig_ManForEachPi( pAig, pObj, i )
132 if ( Aig_ObjRefs(pObj) == 0 )
133 Fsim_ManCreate_rec( p, pObj );
134 Aig_ManForEachPo( pAig, pObj, i )
135 Fsim_ManCreate_rec( p, pObj );
136 assert( Vec_IntSize(p->vCis2Ids) == Aig_ManPiNum(pAig) );
137 assert( p->nObjs == nObjs );
138 // check references
139 assert( p->nCrossCut == 0 );
140 Aig_ManForEachObj( pAig, pObj, i )
141 {
142 assert( p->pRefs[pObj->iData] == 0 );
143 p->pRefs[pObj->iData] = Aig_ObjRefs(pObj);
144 }
145 // collect flop outputs
146 p->vLos = Vec_IntAlloc( Aig_ManRegNum(pAig) );
147 Saig_ManForEachLo( pAig, pObj, i )
148 Vec_IntPush( p->vLos, pObj->iData );
149 // collect flop inputs
150 p->vLis = Vec_IntAlloc( Aig_ManRegNum(pAig) );
151 Saig_ManForEachLi( pAig, pObj, i )
152 Vec_IntPush( p->vLis, pObj->iData );
153 // determine the frontier size
154 p->nFront = 1 + (int)(1.1 * p->nCrossCutMax);
155 return p;
156}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
void Aig_ManCleanData(Aig_Man_t *p)
Definition aigUtil.c:205
ABC_NAMESPACE_IMPL_START int Fsim_ManCreate_rec(Fsim_Man_t *p, Aig_Obj_t *pObj)
DECLARATIONS ///.
Definition fsimMan.c:45
typedefABC_NAMESPACE_HEADER_START struct Fsim_Man_t_ Fsim_Man_t
INCLUDES ///.
Definition fsim.h:42
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
int iData
Definition aig.h:88
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fsim_ManDelete()

void Fsim_ManDelete ( Fsim_Man_t * p)
extern

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

Synopsis [Deletes fast simulation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file fsimMan.c.

170{
171 Vec_IntFree( p->vCis2Ids );
172 Vec_IntFree( p->vLos );
173 Vec_IntFree( p->vLis );
174 ABC_FREE( p->pDataAig2 );
175 ABC_FREE( p->pDataAig );
176 ABC_FREE( p->pFans0 );
177 ABC_FREE( p->pFans1 );
178 ABC_FREE( p->pRefs );
179 ABC_FREE( p->pDataSim );
180 ABC_FREE( p->pDataSimCis );
181 ABC_FREE( p->pDataSimCos );
182 ABC_FREE( p->pData1 );
183 ABC_FREE( p->pData2 );
184 ABC_FREE( p );
185}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Fsim_ManFront()

void Fsim_ManFront ( Fsim_Man_t * p,
int fCompressAig )
extern

FUNCTION DECLARATIONS ///.

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

Synopsis [Determine the frontier.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file fsimFront.c.

246{
247 Fsim_Obj_t Obj, * pObj = &Obj;
248 char * pFront; // places used for the frontier
249 int * pIdToFront; // mapping of nodes into frontier places
250 int i, iVar0, iVar1, nCrossCut = 0, nCrossCutMax = 0;
251 // start the frontier
252 pFront = ABC_CALLOC( char, p->nFront );
253 pIdToFront = ABC_ALLOC( int, p->nObjs );
254 pIdToFront[0] = -1;
255 pIdToFront[1] = -1;
256 // add constant node
257 p->iNumber = 1;
258 if ( p->pRefs[1] )
259 {
260 pIdToFront[1] = Fsim_ManFrontFindNext( p, pFront );
261 nCrossCut = 1;
262 }
263 // allocate room for data
264 if ( fCompressAig )
265 {
266 p->nDataAig = p->nObjs * 6;
267 p->pDataAig = ABC_ALLOC( unsigned char, p->nDataAig );
268 p->pDataCur = p->pDataAig;
269 p->iNodePrev = 0;
270 }
271 else
272 {
273 p->pDataAig2 = ABC_ALLOC( int, 3 * p->nObjs );
274 p->pDataCur2 = p->pDataAig2 + 6;
275 }
276 // iterate through the objects
277 for ( i = 2; i < p->nObjs; i++ )
278 {
279 if ( p->pFans0[i] == 0 ) // ci
280 {
281 // store node
282 pIdToFront[i] = Fsim_ManFrontFindNext( p, pFront );
283 pObj->iNode = pIdToFront[i];
284 pObj->iFan0 = 0;
285 pObj->iFan1 = 0;
286 Fsim_ManStoreObj( p, pObj );
287 // handle CIs without fanout
288 if ( p->pRefs[i] == 0 )
289 {
290 pFront[pIdToFront[i] % p->nFront] = 0;
291 pIdToFront[i] = -1;
292 }
293 }
294 else if ( p->pFans1[i] == 0 ) // co
295 {
296 assert( p->pRefs[i] == 0 );
297 // get the fanin
298 iVar0 = Fsim_Lit2Var(p->pFans0[i]);
299 assert( pIdToFront[iVar0] > 0 );
300 // store node
301 pObj->iNode = 0;
302 pObj->iFan0 = Fsim_Var2Lit(pIdToFront[iVar0], Fsim_LitIsCompl(p->pFans0[i]));
303 pObj->iFan1 = 0;
304 Fsim_ManStoreObj( p, pObj );
305 // deref the fanin
306 if ( --p->pRefs[iVar0] == 0 )
307 {
308 pFront[pIdToFront[iVar0] % p->nFront] = 0;
309 pIdToFront[iVar0] = -1;
310 nCrossCut--;
311 }
312 }
313 else
314 {
315 // get the fanins
316 iVar0 = Fsim_Lit2Var(p->pFans0[i]);
317 assert( pIdToFront[iVar0] > 0 );
318 iVar1 = Fsim_Lit2Var(p->pFans1[i]);
319 assert( pIdToFront[iVar1] > 0 );
320 // store node
321 pIdToFront[i] = Fsim_ManFrontFindNext( p, pFront );
322 pObj->iNode = pIdToFront[i];
323 pObj->iFan0 = Fsim_Var2Lit(pIdToFront[iVar0], Fsim_LitIsCompl(p->pFans0[i]));
324 pObj->iFan1 = Fsim_Var2Lit(pIdToFront[iVar1], Fsim_LitIsCompl(p->pFans1[i]));
325 Fsim_ManStoreObj( p, pObj );
326 // deref the fanins
327 if ( --p->pRefs[iVar0] == 0 )
328 {
329 pFront[pIdToFront[iVar0] % p->nFront] = 0;
330 pIdToFront[iVar0] = -1;
331 nCrossCut--;
332 }
333 if ( --p->pRefs[iVar1] == 0 )
334 {
335 pFront[pIdToFront[iVar1] % p->nFront] = 0;
336 pIdToFront[iVar1] = -1;
337 nCrossCut--;
338 }
339 // handle nodes without fanout (choice nodes)
340 if ( p->pRefs[i] == 0 )
341 {
342 pFront[pIdToFront[i] % p->nFront] = 0;
343 pIdToFront[i] = -1;
344 }
345 }
346 if ( p->pRefs[i] )
347 if ( nCrossCutMax < ++nCrossCut )
348 nCrossCutMax = nCrossCut;
349 }
350 assert( p->pDataAig2 == NULL || p->pDataCur2 - p->pDataAig2 == (3 * p->nObjs) );
351 assert( nCrossCut == 0 );
352 assert( nCrossCutMax == p->nCrossCutMax );
353 for ( i = 0; i < p->nFront; i++ )
354 assert( pFront[i] == 0 );
355 ABC_FREE( pFront );
356 ABC_FREE( pIdToFront );
357// Fsim_ManVerifyFront( p );
358 ABC_FREE( p->pFans0 );
359 ABC_FREE( p->pFans1 );
360 ABC_FREE( p->pRefs );
361}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
typedefABC_NAMESPACE_HEADER_START struct Fsim_Obj_t_ Fsim_Obj_t
INCLUDES ///.
Definition fsimInt.h:46
Here is the caller graph for this function:

◆ Fsim_ManTest()

void Fsim_ManTest ( Aig_Man_t * pAig)
extern

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

Synopsis [Testing procedure.]

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file fsimMan.c.

199{
200 Fsim_Man_t * p;
201 p = Fsim_ManCreate( pAig );
202 Fsim_ManFront( p, 0 );
203 Fsim_ManDelete( p );
204}
void Fsim_ManFront(Fsim_Man_t *p, int fCompressAig)
FUNCTION DECLARATIONS ///.
Definition fsimFront.c:245
void Fsim_ManDelete(Fsim_Man_t *p)
Definition fsimMan.c:169
Fsim_Man_t * Fsim_ManCreate(Aig_Man_t *pAig)
Definition fsimMan.c:102
Here is the call graph for this function: