#include "base/abc/abc.h"
#include "resInt.h"
Go to the source code of this file.
|
ABC_NAMESPACE_IMPL_START
Res_Sim_t * | Res_SimAlloc (int nWords) |
| DECLARATIONS ///. More...
|
|
void | Res_SimAdjust (Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis) |
|
void | Res_SimFree (Res_Sim_t *p) |
|
void | Abc_InfoRandomBytes (unsigned *p, int nWords) |
|
void | Res_SimSetRandomBytes (Res_Sim_t *p) |
|
void | Res_SimSetDerivedBytes (Res_Sim_t *p, int fUseWalk) |
|
void | Res_SimSetGiven (Res_Sim_t *p, Vec_Ptr_t *vInfo) |
|
void | Res_SimPerformOne (Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords) |
|
void | Res_SimTransferOne (Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords) |
|
void | Res_SimPerformRound (Res_Sim_t *p, int nWords) |
|
void | Res_SimPadSimInfo (Vec_Ptr_t *vPats, int nPats, int nWords) |
|
void | Res_SimDeriveInfoReplicate (Res_Sim_t *p) |
|
void | Res_SimDeriveInfoComplement (Res_Sim_t *p) |
|
void | Res_SimPrintOutPatterns (Res_Sim_t *p, Abc_Ntk_t *pAig) |
|
void | Res_SimPrintNodePatterns (Res_Sim_t *p, Abc_Ntk_t *pAig) |
|
void | Res_SimCountResults (Res_Sim_t *p, int *pnDcs, int *pnOnes, int *pnZeros, int fVerbose) |
|
void | Res_SimCollectPatterns (Res_Sim_t *p, int fVerbose) |
|
int | Res_SimVerifyValue (Res_Sim_t *p, int fOnSet) |
|
int | Res_SimPrepare (Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis, int fVerbose) |
|
void Abc_InfoRandomBytes |
( |
unsigned * |
p, |
|
|
int |
nWords |
|
) |
| |
Function*************************************************************
Synopsis [Sets random PI simulation info.]
Description []
SideEffects []
SeeAlso []
Definition at line 149 of file resSim.c.
152 for ( i =
nWords - 1; i >= 0; i-- )
155 p[i] = (Num & 1)? 0xff : 0;
156 p[i] = (
p[i] << 8) | ((Num & 2)? 0xff : 0);
157 p[i] = (
p[i] << 8) | ((Num & 4)? 0xff : 0);
158 p[i] = (
p[i] << 8) | ((Num & 8)? 0xff : 0);
Function*************************************************************
Synopsis [Allocate simulation engine.]
Description []
SideEffects []
SeeAlso []
Definition at line 80 of file resSim.c.
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Abc_InfoClear(unsigned *p, int nWords)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
static void Vec_PtrFree(Vec_Ptr_t *p)
DECLARATIONS ///.
CFile****************************************************************
FileName [resSim.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Resynthesis package.]
Synopsis [Simulation engine.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - January 15, 2007.]
Revision [
- Id:
- resSim.c,v 1.00 2007/01/15 00:00:00 alanmi Exp
]FUNCTION DEFINITIONS /// Function*************************************************************
Synopsis [Allocate simulation engine.]
Description []
SideEffects []
SeeAlso []
Definition at line 46 of file resSim.c.
#define ABC_ALLOC(type, num)
static Vec_Vec_t * Vec_VecStart(int nSize)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
void Res_SimCollectPatterns |
( |
Res_Sim_t * |
p, |
|
|
int |
fVerbose |
|
) |
| |
Function*************************************************************
Synopsis [Counts the number of patters of different type.]
Description []
SideEffects []
SeeAlso []
Definition at line 624 of file resSim.c.
627 unsigned char * pInfoCare, * pInfoNode, * pInfo;
637 assert( pInfoNode[i] == 0 || pInfoNode[i] == 0xff );
647 assert( pInfo[i] == 0 || pInfo[i] == 0xff );
662 assert( pInfo[i] == 0 || pInfo[i] == 0xff );
674 printf(
"On = %3d ", p->
nPats1 );
675 printf(
"Off = %3d ", p->
nPats0 );
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
#define Abc_NtkForEachPi(pNtk, pPi, i)
void Res_SimCountResults |
( |
Res_Sim_t * |
p, |
|
|
int * |
pnDcs, |
|
|
int * |
pnOnes, |
|
|
int * |
pnZeros, |
|
|
int |
fVerbose |
|
) |
| |
Function*************************************************************
Synopsis [Counts the number of patters of different type.]
Description []
SideEffects []
SeeAlso []
Definition at line 587 of file resSim.c.
589 unsigned char * pInfoCare, * pInfoNode;
597 else if ( !pInfoNode[i] )
607 printf(
"Dc = %7.2f %% ", 100.0*(*pnDcs) /nTotal );
608 printf(
"On = %7.2f %% ", 100.0*(*pnOnes) /nTotal );
609 printf(
"Off = %7.2f %% ", 100.0*(*pnZeros)/nTotal );
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
int nTotal
DECLARATIONS ///.
void Res_SimDeriveInfoComplement |
( |
Res_Sim_t * |
p | ) |
|
Function*************************************************************
Synopsis [Complement the simulation info if necessary.]
Description []
SideEffects []
SeeAlso []
Definition at line 517 of file resSim.c.
519 unsigned * pInfo, * pInfo2;
526 for ( j = 0; j < p->
nPats; j++, pInfo2 += p->
nWords )
528 for ( w = 0; w < p->
nWords; w++ )
529 pInfo2[w] = ~pInfo2[w];
static int Abc_InfoHasBit(unsigned *p, int i)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachPo(pNtk, pPo, i)
void Res_SimDeriveInfoReplicate |
( |
Res_Sim_t * |
p | ) |
|
Function*************************************************************
Synopsis [Duplicates the simulation info to fill the space.]
Description []
SideEffects []
SeeAlso []
Definition at line 491 of file resSim.c.
493 unsigned * pInfo, * pInfo2;
500 for ( j = 0; j < p->
nPats; j++ )
501 for ( w = 0; w < p->
nWords; w++ )
502 *pInfo2++ = pInfo[w];
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachPo(pNtk, pPo, i)
Function*************************************************************
Synopsis [Free simulation engine.]
Description []
SideEffects []
SeeAlso []
Definition at line 127 of file resSim.c.
static void Vec_VecFree(Vec_Vec_t *p)
static void Vec_PtrFree(Vec_Ptr_t *p)
void Res_SimPadSimInfo |
( |
Vec_Ptr_t * |
vPats, |
|
|
int |
nPats, |
|
|
int |
nWords |
|
) |
| |
Function*************************************************************
Synopsis [Pads the extra space with duplicated simulation info.]
Description []
SideEffects []
SeeAlso []
Definition at line 458 of file resSim.c.
462 assert( nPats > 0 && nPats <
nWords * 8 * (
int)
sizeof(
unsigned) );
464 if ( nPats < 8 *
sizeof(
unsigned) )
468 pInfo[0] |= ((~0) << nPats);
469 nPats = 8 * sizeof(
unsigned);
472 iWords = nPats / (8 * sizeof(
unsigned));
475 for ( w = iWords; w <
nWords; w++ )
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Function*************************************************************
Synopsis [Simulates one node.]
Description []
SideEffects []
SeeAlso []
Definition at line 371 of file resSim.c.
373 unsigned * pInfo, * pInfo1, * pInfo2;
374 int k, fComp1, fComp2;
382 if ( fComp1 && fComp2 )
383 for ( k = 0; k < nSimWords; k++ )
384 pInfo[k] = ~pInfo1[k] & ~pInfo2[k];
385 else if ( fComp1 && !fComp2 )
386 for ( k = 0; k < nSimWords; k++ )
387 pInfo[k] = ~pInfo1[k] & pInfo2[k];
388 else if ( !fComp1 && fComp2 )
389 for ( k = 0; k < nSimWords; k++ )
390 pInfo[k] = pInfo1[k] & ~pInfo2[k];
392 for ( k = 0; k < nSimWords; k++ )
393 pInfo[k] = pInfo1[k] & pInfo2[k];
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
void Res_SimPerformRound |
( |
Res_Sim_t * |
p, |
|
|
int |
nWords |
|
) |
| |
Function*************************************************************
Synopsis [Performs one round of simulation.]
Description []
SideEffects []
SeeAlso []
Definition at line 435 of file resSim.c.
static void Abc_InfoFill(unsigned *p, int nWords)
void Res_SimPerformOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords)
#define Abc_AigForEachAnd(pNtk, pNode, i)
void Res_SimTransferOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachPo(pNtk, pPo, i)
Function*************************************************************
Synopsis [Prepares simulation info for candidate filtering.]
Description []
SideEffects []
SeeAlso []
Definition at line 731 of file resSim.c.
733 int i, nOnes = 0, nZeros = 0, nDcs = 0;
760 for ( i = 0; i < 2; i++ )
void Res_SimSetGiven(Res_Sim_t *p, Vec_Ptr_t *vInfo)
void Res_SimAdjust(Res_Sim_t *p, Abc_Ntk_t *pAig, int nTruePis)
void Res_SimCountResults(Res_Sim_t *p, int *pnDcs, int *pnOnes, int *pnZeros, int fVerbose)
void Res_SimSetRandomBytes(Res_Sim_t *p)
void Res_SimCollectPatterns(Res_Sim_t *p, int fVerbose)
int Res_SatSimulate(Res_Sim_t *p, int nPats, int fOnSet)
void Res_SimSetDerivedBytes(Res_Sim_t *p, int fUseWalk)
void Res_SimDeriveInfoReplicate(Res_Sim_t *p)
void Res_SimDeriveInfoComplement(Res_Sim_t *p)
void Res_SimPerformRound(Res_Sim_t *p, int nWords)
void Res_SimPadSimInfo(Vec_Ptr_t *vPats, int nPats, int nWords)
Function*************************************************************
Synopsis [Prints output patterns.]
Description []
SideEffects []
SeeAlso []
Definition at line 568 of file resSim.c.
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
Function*************************************************************
Synopsis [Prints output patterns.]
Description []
SideEffects []
SeeAlso []
Definition at line 544 of file resSim.c.
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
#define Abc_NtkForEachPo(pNtk, pPo, i)
void Res_SimSetDerivedBytes |
( |
Res_Sim_t * |
p, |
|
|
int |
fUseWalk |
|
) |
| |
Function*************************************************************
Synopsis [Sets random PI simulation info.]
Description []
SideEffects []
SeeAlso []
Definition at line 211 of file resSim.c.
216 unsigned char * pInfo;
217 int i, k, z, s, nPats;
232 for ( z = 0; z < 2; z++ )
240 pInfo[nPats] = z ? 0xff : 0;
252 pInfo[nPats] = ((i == k) ^ z) ? 0xff : 0;
263 nPatsSource[0] = p->
nPats0;
264 vPatsSource[0] = p->
vPats0;
265 nPatsSource[1] = p->
nPats1;
266 vPatsSource[1] = p->
vPats1;
270 nPatsSource[0] = p->
nPats1;
271 vPatsSource[0] = p->
vPats1;
272 nPatsSource[1] = p->
nPats0;
273 vPatsSource[1] = p->
vPats0;
275 for ( z = 0; z < 2; z++ )
277 for ( s = nPatsSource[z] - 1; s >= 0; s-- )
310 for ( z = nPats; z < p->
nBytesIn; z++ )
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_InfoHasBit(unsigned *p, int i)
void Abc_InfoRandomBytes(unsigned *p, int nWords)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachPi(pNtk, pPi, i)
Function*************************************************************
Synopsis [Sets given PI simulation info.]
Description []
SideEffects []
SeeAlso []
Definition at line 344 of file resSim.c.
347 unsigned * pInfo, * pInfo2;
355 for ( w = 0; w < p->
nWords; w++ )
356 pInfo[w] = pInfo2[w];
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
#define Abc_NtkForEachPi(pNtk, pPi, i)
Function*************************************************************
Synopsis [Sets random PI simulation info.]
Description []
SideEffects []
SeeAlso []
Definition at line 174 of file resSim.c.
182 if ( i < p->nTruePis )
void Abc_InfoRandomBytes(unsigned *p, int nWords)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoRandom(unsigned *p, int nWords)
#define Abc_NtkForEachPi(pNtk, pPi, i)
Function*************************************************************
Synopsis [Simulates one CO node.]
Description []
SideEffects []
SeeAlso []
Definition at line 407 of file resSim.c.
409 unsigned * pInfo, * pInfo1;
417 for ( k = 0; k < nSimWords; k++ )
418 pInfo[k] = ~pInfo1[k];
420 for ( k = 0; k < nSimWords; k++ )
421 pInfo[k] = pInfo1[k];
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
int Res_SimVerifyValue |
( |
Res_Sim_t * |
p, |
|
|
int |
fOnSet |
|
) |
| |
Function*************************************************************
Synopsis [Verifies the last pattern.]
Description []
SideEffects []
SeeAlso []
Definition at line 691 of file resSim.c.
694 unsigned * pInfo, * pInfo2;
711 pInfo[0] = value ? ~0 : 0;
716 assert( pInfo[0] == 0 || pInfo[0] == ~0 );
static int Abc_InfoHasBit(unsigned *p, int i)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
void Res_SimPerformRound(Res_Sim_t *p, int nWords)
#define Abc_NtkForEachPi(pNtk, pPi, i)