ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
simSwitch.c File Reference
#include "base/abc/abc.h"
#include "sim.h"
Include dependency graph for simSwitch.c:

Go to the source code of this file.

Functions

Vec_Int_tSim_NtkComputeSwitching (Abc_Ntk_t *pNtk, int nPatterns)
 FUNCTION DEFINITIONS ///.
 

Function Documentation

◆ Sim_NtkComputeSwitching()

Vec_Int_t * Sim_NtkComputeSwitching ( Abc_Ntk_t * pNtk,
int nPatterns )

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes switching activity using simulation.]

Description [Computes switching activity, which is understood as the probability of switching under random simulation. Assigns the random simulation information at the CI and propagates it through the internal nodes of the AIG.]

SideEffects []

SeeAlso []

Definition at line 52 of file simSwitch.c.

53{
54 Vec_Int_t * vSwitching;
55 float * pSwitching;
56 Vec_Ptr_t * vNodes;
57 Vec_Ptr_t * vSimInfo;
58 Abc_Obj_t * pNode;
59 unsigned * pSimInfo;
60 int nSimWords, i;
61
62 // allocate space for simulation info of all nodes
63 nSimWords = SIM_NUM_WORDS(nPatterns);
64 vSimInfo = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), nSimWords, 0 );
65 // assign the random simulation to the CIs
66 vSwitching = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
67 pSwitching = (float *)vSwitching->pArray;
68 Abc_NtkForEachCi( pNtk, pNode, i )
69 {
70 pSimInfo = (unsigned *)Vec_PtrEntry(vSimInfo, pNode->Id);
71 Sim_UtilSetRandom( pSimInfo, nSimWords );
72 pSwitching[pNode->Id] = Sim_ComputeSwitching( pSimInfo, nSimWords );
73 }
74 // simulate the internal nodes
75 vNodes = Abc_AigDfs( pNtk, 1, 0 );
76 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
77 {
78 pSimInfo = (unsigned *)Vec_PtrEntry(vSimInfo, pNode->Id);
79 Sim_UtilSimulateNodeOne( pNode, vSimInfo, nSimWords, 0 );
80 pSwitching[pNode->Id] = Sim_ComputeSwitching( pSimInfo, nSimWords );
81 }
82 Vec_PtrFree( vNodes );
83 Sim_UtilInfoFree( vSimInfo );
84 return vSwitching;
85}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition abcDfs.c:1198
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Sim_UtilInfoFree(Vec_Ptr_t *p)
Definition simUtils.c:84
void Sim_UtilSetRandom(unsigned *pPatRand, int nSimWords)
Definition simUtils.c:448
Vec_Ptr_t * Sim_UtilInfoAlloc(int nSize, int nWords, int fClean)
FUNCTION DEFINITIONS ///.
Definition simUtils.c:57
void Sim_UtilSimulateNodeOne(Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords, int nOffset)
Definition simUtils.c:303
#define SIM_NUM_WORDS(n)
MACRO DEFINITIONS ///.
Definition sim.h:148
int Id
Definition abc.h:132
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function: