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

Go to the source code of this file.

Macros

#define XVS0   ABC_INIT_ZERO
 DECLARATIONS ///.
 
#define XVS1   ABC_INIT_ONE
 
#define XVSX   ABC_INIT_DC
 

Functions

void Abc_NtkXValueSimulate (Abc_Ntk_t *pNtk, int nFrames, int fXInputs, int fXState, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkCycleInitState (Abc_Ntk_t *pNtk, int nFrames, int fUseXval, int fVerbose)
 

Macro Definition Documentation

◆ XVS0

#define XVS0   ABC_INIT_ZERO

DECLARATIONS ///.

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 [

Id
abcXsim.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 30 of file abcXsim.c.

◆ XVS1

#define XVS1   ABC_INIT_ONE

Definition at line 31 of file abcXsim.c.

◆ XVSX

#define XVSX   ABC_INIT_DC

Definition at line 32 of file abcXsim.c.

Function Documentation

◆ Abc_NtkCycleInitState()

void Abc_NtkCycleInitState ( Abc_Ntk_t * pNtk,
int nFrames,
int fUseXval,
int fVerbose )

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

Synopsis [Cycles the circuit to create a new initial state.]

Description [Simulates the circuit with random (or ternary) input for the given number of timeframes to get a better initial state.]

SideEffects []

SeeAlso []

Definition at line 192 of file abcXsim.c.

193{
194 Abc_Obj_t * pObj;
195 int i, f;
196 assert( Abc_NtkIsStrash(pNtk) );
197// srand( 0x12341234 );
198 Gia_ManRandom( 1 );
199 // initialize the values
200 Abc_ObjSetXsim( Abc_AigConst1(pNtk), XVS1 );
201 Abc_NtkForEachLatch( pNtk, pObj, i )
202 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_LatchInit(pObj) );
203 // simulate for the given number of timeframes
204 for ( f = 0; f < nFrames; f++ )
205 {
206 Abc_NtkForEachPi( pNtk, pObj, i )
207 Abc_ObjSetXsim( pObj, fUseXval? ABC_INIT_DC : Abc_XsimRand2() );
208// Abc_ObjSetXsim( pObj, ABC_INIT_ONE );
209 Abc_AigForEachAnd( pNtk, pObj, i )
210 Abc_ObjSetXsim( pObj, Abc_XsimAnd(Abc_ObjGetXsimFanin0(pObj), Abc_ObjGetXsimFanin1(pObj)) );
211 Abc_NtkForEachCo( pNtk, pObj, i )
212 Abc_ObjSetXsim( pObj, Abc_ObjGetXsimFanin0(pObj) );
213 Abc_NtkForEachLatch( pNtk, pObj, i )
214 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_ObjGetXsim(Abc_ObjFanin0(pObj)) );
215 }
216 // set the final values
217 Abc_NtkForEachLatch( pNtk, pObj, i )
218 {
219 pObj->pData = (void *)(ABC_PTRINT_T)Abc_ObjGetXsim(Abc_ObjFanout0(pObj));
220// printf( "%d", Abc_LatchIsInit1(pObj) );
221 }
222// printf( "\n" );
223}
#define XVS1
Definition abcXsim.c:31
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition abc.h:488
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
@ ABC_INIT_DC
Definition abc.h:106
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition giaUtil.c:49
void * pData
Definition abc.h:145
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Abc_NtkXValueSimulate()

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 111 of file abcXsim.c.

112{
113 Abc_Obj_t * pObj;
114 int i, f;
115 assert( Abc_NtkIsStrash(pNtk) );
116// srand( 0x12341234 );
117 Gia_ManRandom( 1 );
118 // start simulation
119 Abc_ObjSetXsim( Abc_AigConst1(pNtk), XVS1 );
120 if ( fXInputs )
121 {
122 Abc_NtkForEachPi( pNtk, pObj, i )
123 Abc_ObjSetXsim( pObj, XVSX );
124 }
125 else
126 {
127 Abc_NtkForEachPi( pNtk, pObj, i )
128 Abc_ObjSetXsim( pObj, Abc_XsimRand2() );
129 }
130 if ( fXState )
131 {
132 Abc_NtkForEachLatch( pNtk, pObj, i )
133 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), XVSX );
134 }
135 else
136 {
137 Abc_NtkForEachLatch( pNtk, pObj, i )
138 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_LatchInit(pObj) );
139 }
140 // simulate and print the result
141 fprintf( stdout, "Frame : Inputs : Latches : Outputs\n" );
142 for ( f = 0; f < nFrames; f++ )
143 {
144 Abc_AigForEachAnd( pNtk, pObj, i )
145 Abc_ObjSetXsim( pObj, Abc_XsimAnd(Abc_ObjGetXsimFanin0(pObj), Abc_ObjGetXsimFanin1(pObj)) );
146 Abc_NtkForEachCo( pNtk, pObj, i )
147 Abc_ObjSetXsim( pObj, Abc_ObjGetXsimFanin0(pObj) );
148 // print out
149 fprintf( stdout, "%2d : ", f );
150 Abc_NtkForEachPi( pNtk, pObj, i )
151 Abc_XsimPrint( stdout, Abc_ObjGetXsim(pObj) );
152 fprintf( stdout, " : " );
153 Abc_NtkForEachLatch( pNtk, pObj, i )
154 {
155// if ( Abc_ObjGetXsim(Abc_ObjFanout0(pObj)) != XVSX )
156// printf( " %s=", Abc_ObjName(pObj) );
157 Abc_XsimPrint( stdout, Abc_ObjGetXsim(Abc_ObjFanout0(pObj)) );
158 }
159 fprintf( stdout, " : " );
160 Abc_NtkForEachPo( pNtk, pObj, i )
161 Abc_XsimPrint( stdout, Abc_ObjGetXsim(pObj) );
162 fprintf( stdout, "\n" );
163 // assign input values
164 if ( fXInputs )
165 {
166 Abc_NtkForEachPi( pNtk, pObj, i )
167 Abc_ObjSetXsim( pObj, XVSX );
168 }
169 else
170 {
171 Abc_NtkForEachPi( pNtk, pObj, i )
172 Abc_ObjSetXsim( pObj, Abc_XsimRand2() );
173 }
174 // transfer the latch values
175 Abc_NtkForEachLatch( pNtk, pObj, i )
176 Abc_ObjSetXsim( Abc_ObjFanout0(pObj), Abc_ObjGetXsim(Abc_ObjFanin0(pObj)) );
177 }
178}
#define XVSX
Definition abcXsim.c:32
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
Here is the call graph for this function: