#include "abc.h"
Go to the source code of this file.
Defines | |
#define | XVS0 ABC_INIT_ZERO |
#define | XVS1 ABC_INIT_ONE |
#define | XVSX ABC_INIT_DC |
Functions | |
static void | Abc_ObjSetXsim (Abc_Obj_t *pObj, int Value) |
static int | Abc_ObjGetXsim (Abc_Obj_t *pObj) |
static int | Abc_XsimInv (int Value) |
static int | Abc_XsimAnd (int Value0, int Value1) |
static int | Abc_XsimRand2 () |
static int | Abc_XsimRand3 () |
static int | Abc_ObjGetXsimFanin0 (Abc_Obj_t *pObj) |
static int | Abc_ObjGetXsimFanin1 (Abc_Obj_t *pObj) |
static void | Abc_XsimPrint (FILE *pFile, int Value) |
void | Abc_NtkXValueSimulate (Abc_Ntk_t *pNtk, int nFrames, int fXInputs, int fXState, int fVerbose) |
void | Abc_NtkCycleInitState (Abc_Ntk_t *pNtk, int nFrames, int fVerbose) |
#define XVS0 ABC_INIT_ZERO |
CFile****************************************************************
FileName [abcXsim.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Using X-valued simulation.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS ///
void Abc_NtkCycleInitState | ( | Abc_Ntk_t * | pNtk, | |
int | nFrames, | |||
int | fVerbose | |||
) |
Function*************************************************************
Synopsis [Cycles the circuit to create a new initial state.]
Description [Simulates the circuit with random input for the given number of timeframes to get a better initial state.]
SideEffects []
SeeAlso []
Definition at line 192 of file abcXsim.c.
00193 { 00194 Abc_Obj_t * pObj; 00195 int i, f; 00196 assert( Abc_NtkIsStrash(pNtk) ); 00197 srand( 0x12341234 ); 00198 // initialize the values 00199 Abc_ObjSetXsim( Abc_AigConst1(pNtk), XVS1 ); 00200 Abc_NtkForEachPi( pNtk, pObj, i ) 00201 Abc_ObjSetXsim( pObj, Abc_XsimRand2() ); 00202 Abc_NtkForEachLatch( pNtk, pObj, i ) 00203 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_LatchIsInit1(pObj)? XVS1 : XVS0 ); 00204 // simulate for the given number of timeframes 00205 for ( f = 0; f < nFrames; f++ ) 00206 { 00207 Abc_AigForEachAnd( pNtk, pObj, i ) 00208 Abc_ObjSetXsim( pObj, Abc_XsimAnd(Abc_ObjGetXsimFanin0(pObj), Abc_ObjGetXsimFanin1(pObj)) ); 00209 Abc_NtkForEachCo( pNtk, pObj, i ) 00210 Abc_ObjSetXsim( pObj, Abc_ObjGetXsimFanin0(pObj) ); 00211 // assign input values 00212 Abc_NtkForEachPi( pNtk, pObj, i ) 00213 Abc_ObjSetXsim( pObj, Abc_XsimRand2() ); 00214 // transfer the latch values 00215 Abc_NtkForEachLatch( pNtk, pObj, i ) 00216 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_ObjGetXsim(Abc_ObjFanin0(pObj)) ); 00217 } 00218 // set the final values 00219 Abc_NtkForEachLatch( pNtk, pObj, i ) 00220 pObj->pData = (void *)Abc_ObjGetXsim(Abc_ObjFanout0(pObj)); 00221 }
void Abc_NtkXValueSimulate | ( | Abc_Ntk_t * | pNtk, | |
int | nFrames, | |||
int | fXInputs, | |||
int | fXState, | |||
int | fVerbose | |||
) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Performs X-valued simulation of the sequential network.]
Description []
SideEffects []
SeeAlso []
Definition at line 106 of file abcXsim.c.
00107 { 00108 Abc_Obj_t * pObj; 00109 int i, f; 00110 assert( Abc_NtkIsStrash(pNtk) ); 00111 srand( 0x12341234 ); 00112 // start simulation 00113 Abc_ObjSetXsim( Abc_AigConst1(pNtk), XVS1 ); 00114 if ( fXInputs ) 00115 { 00116 Abc_NtkForEachPi( pNtk, pObj, i ) 00117 Abc_ObjSetXsim( pObj, XVSX ); 00118 } 00119 else 00120 { 00121 Abc_NtkForEachPi( pNtk, pObj, i ) 00122 Abc_ObjSetXsim( pObj, Abc_XsimRand2() ); 00123 } 00124 if ( fXState ) 00125 { 00126 Abc_NtkForEachLatch( pNtk, pObj, i ) 00127 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), XVSX ); 00128 } 00129 else 00130 { 00131 Abc_NtkForEachLatch( pNtk, pObj, i ) 00132 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_LatchInit(pObj) ); 00133 } 00134 // simulate and print the result 00135 fprintf( stdout, "Frame : Inputs : Latches : Outputs\n" ); 00136 for ( f = 0; f < nFrames; f++ ) 00137 { 00138 Abc_AigForEachAnd( pNtk, pObj, i ) 00139 Abc_ObjSetXsim( pObj, Abc_XsimAnd(Abc_ObjGetXsimFanin0(pObj), Abc_ObjGetXsimFanin1(pObj)) ); 00140 Abc_NtkForEachCo( pNtk, pObj, i ) 00141 Abc_ObjSetXsim( pObj, Abc_ObjGetXsimFanin0(pObj) ); 00142 // print out 00143 fprintf( stdout, "%2d : ", f ); 00144 Abc_NtkForEachPi( pNtk, pObj, i ) 00145 Abc_XsimPrint( stdout, Abc_ObjGetXsim(pObj) ); 00146 fprintf( stdout, " : " ); 00147 Abc_NtkForEachLatch( pNtk, pObj, i ) 00148 { 00149 // if ( Abc_ObjGetXsim(Abc_ObjFanout0(pObj)) != XVSX ) 00150 // printf( " %s=", Abc_ObjName(pObj) ); 00151 Abc_XsimPrint( stdout, Abc_ObjGetXsim(Abc_ObjFanout0(pObj)) ); 00152 } 00153 fprintf( stdout, " : " ); 00154 Abc_NtkForEachPo( pNtk, pObj, i ) 00155 Abc_XsimPrint( stdout, Abc_ObjGetXsim(pObj) ); 00156 if ( Abc_NtkAssertNum(pNtk) ) 00157 { 00158 fprintf( stdout, " : " ); 00159 Abc_NtkForEachAssert( pNtk, pObj, i ) 00160 Abc_XsimPrint( stdout, Abc_ObjGetXsim(pObj) ); 00161 } 00162 fprintf( stdout, "\n" ); 00163 // assign input values 00164 if ( fXInputs ) 00165 { 00166 Abc_NtkForEachPi( pNtk, pObj, i ) 00167 Abc_ObjSetXsim( pObj, XVSX ); 00168 } 00169 else 00170 { 00171 Abc_NtkForEachPi( pNtk, pObj, i ) 00172 Abc_ObjSetXsim( pObj, Abc_XsimRand2() ); 00173 } 00174 // transfer the latch values 00175 Abc_NtkForEachLatch( pNtk, pObj, i ) 00176 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_ObjGetXsim(Abc_ObjFanin0(pObj)) ); 00177 } 00178 }
static int Abc_ObjGetXsim | ( | Abc_Obj_t * | pObj | ) | [inline, static] |
static int Abc_ObjGetXsimFanin0 | ( | Abc_Obj_t * | pObj | ) | [inline, static] |
Definition at line 63 of file abcXsim.c.
00064 { 00065 int RetValue; 00066 RetValue = Abc_ObjGetXsim(Abc_ObjFanin0(pObj)); 00067 return Abc_ObjFaninC0(pObj)? Abc_XsimInv(RetValue) : RetValue; 00068 }
static int Abc_ObjGetXsimFanin1 | ( | Abc_Obj_t * | pObj | ) | [inline, static] |
Definition at line 69 of file abcXsim.c.
00070 { 00071 int RetValue; 00072 RetValue = Abc_ObjGetXsim(Abc_ObjFanin1(pObj)); 00073 return Abc_ObjFaninC1(pObj)? Abc_XsimInv(RetValue) : RetValue; 00074 }
static void Abc_ObjSetXsim | ( | Abc_Obj_t * | pObj, | |
int | Value | |||
) | [inline, static] |
static int Abc_XsimAnd | ( | int | Value0, | |
int | Value1 | |||
) | [inline, static] |
static int Abc_XsimInv | ( | int | Value | ) | [inline, static] |
static void Abc_XsimPrint | ( | FILE * | pFile, | |
int | Value | |||
) | [inline, static] |
static int Abc_XsimRand2 | ( | ) | [inline, static] |