#include "abc.h"
#include "sim.h"
Go to the source code of this file.
Functions | |
static void | Sim_NodeSimulate (Abc_Obj_t *pNode, Vec_Ptr_t *vSimInfo, int nSimWords) |
static float | Sim_ComputeSwitching (unsigned *pSimInfo, int nSimWords) |
Vec_Int_t * | Sim_NtkComputeSwitching (Abc_Ntk_t *pNtk, int nPatterns) |
float Sim_ComputeSwitching | ( | unsigned * | pSimInfo, | |
int | nSimWords | |||
) | [static] |
Function*************************************************************
Synopsis [Computes switching activity of one node.]
Description [Uses the formula: Switching = 2 * nOnes * nZeros / (nTotal ^ 2) ]
SideEffects []
SeeAlso []
Definition at line 95 of file simSwitch.c.
00096 { 00097 int nOnes, nTotal; 00098 nTotal = 32 * nSimWords; 00099 nOnes = Sim_UtilCountOnes( pSimInfo, nSimWords ); 00100 return (float)2.0 * nOnes * (nTotal - nOnes) / nTotal / nTotal; 00101 }
CFile****************************************************************
FileName [simSwitch.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Computes switching activity of nodes in the ABC network.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS ///
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 49 of file simSwitch.c.
00050 { 00051 Vec_Int_t * vSwitching; 00052 float * pSwitching; 00053 Vec_Ptr_t * vNodes; 00054 Vec_Ptr_t * vSimInfo; 00055 Abc_Obj_t * pNode; 00056 unsigned * pSimInfo; 00057 int nSimWords, i; 00058 00059 // allocate space for simulation info of all nodes 00060 nSimWords = SIM_NUM_WORDS(nPatterns); 00061 vSimInfo = Sim_UtilInfoAlloc( Abc_NtkObjNumMax(pNtk), nSimWords, 0 ); 00062 // assign the random simulation to the CIs 00063 vSwitching = Vec_IntStart( Abc_NtkObjNumMax(pNtk) ); 00064 pSwitching = (float *)vSwitching->pArray; 00065 Abc_NtkForEachCi( pNtk, pNode, i ) 00066 { 00067 pSimInfo = Vec_PtrEntry(vSimInfo, pNode->Id); 00068 Sim_UtilSetRandom( pSimInfo, nSimWords ); 00069 pSwitching[pNode->Id] = Sim_ComputeSwitching( pSimInfo, nSimWords ); 00070 } 00071 // simulate the internal nodes 00072 vNodes = Abc_AigDfs( pNtk, 1, 0 ); 00073 Vec_PtrForEachEntry( vNodes, pNode, i ) 00074 { 00075 pSimInfo = Vec_PtrEntry(vSimInfo, pNode->Id); 00076 Sim_UtilSimulateNodeOne( pNode, vSimInfo, nSimWords, 0 ); 00077 pSwitching[pNode->Id] = Sim_ComputeSwitching( pSimInfo, nSimWords ); 00078 } 00079 Vec_PtrFree( vNodes ); 00080 Sim_UtilInfoFree( vSimInfo ); 00081 return vSwitching; 00082 }