abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
super.h File Reference

Go to the source code of this file.

Functions

ABC_NAMESPACE_HEADER_START void Super2_Precompute (int nInputs, int nLevels, int fVerbose)
 INCLUDES ///. More...
 
Vec_Str_tSuper_PrecomputeStr (Mio_Library_t *pLibGen, int nVarsMax, int nLevels, int nGatesMax, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fVerbose)
 
void Super_Precompute (Mio_Library_t *pLibGen, int nVarsMax, int nLevels, int nGatesMax, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fVerbose, char *pFileName)
 FUNCTION DEFINITIONS ///. More...
 

Function Documentation

ABC_NAMESPACE_HEADER_START void Super2_Precompute ( int  nInputs,
int  nLevels,
int  fVerbose 
)

INCLUDES ///.

CFile****************************************************************

FileName [super.h]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Pre-computation of supergates (delay-limited gate combinations).]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 8, 2003.]

Revision [

Id:
super.h,v 1.3 2004/06/28 14:20:25 alanmi Exp

]PARAMETERS ///STRUCTURE DEFINITIONS ///GLOBAL VARIABLES ///MACRO DEFINITIONS ///FUNCTION DEFINITIONS ///

INCLUDES ///.

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

Synopsis [Precomputes the library of AND2 gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file superAnd.c.

114 {
115  Super2_Man_t * pMan;
116  Super2_Lib_t * pLibCur, * pLibNext;
117  int Level;
118  abctime clk;
119 
120  assert( nInputs < 6 );
121 
122  // start the manager
123  pMan = Super2_ManStart();
124 
125  // get the starting supergates
126  pLibCur = Super2_LibFirst( pMan, nInputs );
127 
128  // perform the computation of supergates
129 printf( "Computing supergates for %d inputs and %d levels:\n", nInputs, nLevels );
130  for ( Level = 1; Level <= nLevels; Level++ )
131  {
132 clk = Abc_Clock();
133  pLibNext = Super2_LibCompute( pMan, pLibCur );
134  pLibNext->nLevels = Level;
135  Super2_LibStop( pLibCur );
136  pLibCur = pLibNext;
137 printf( "Level %d: Tried = %7d. Computed = %7d. ", Level, pMan->nTried, pLibCur->nGates );
138 ABC_PRT( "Runtime", Abc_Clock() - clk );
139 fflush( stdout );
140  }
141 
142 printf( "Writing the output file...\n" );
143 fflush( stdout );
144  // write them into a file
145  Super2_LibWrite( pLibCur );
146  Super2_LibStop( pLibCur );
147 
148  // stop the manager
149  Super2_ManStop( pMan );
150 }
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Super2_LibWrite(Super2_Lib_t *pLib)
Definition: superAnd.c:461
static Super2_Lib_t * Super2_LibCompute(Super2_Man_t *pMan, Super2_Lib_t *pLib)
Definition: superAnd.c:334
static Super2_Man_t * Super2_ManStart()
Definition: superAnd.c:166
static void Super2_LibStop(Super2_Lib_t *pLib)
Definition: superAnd.c:271
static Super2_Lib_t * Super2_LibFirst(Super2_Man_t *pMan, int nInputs)
Definition: superAnd.c:288
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static void Super2_ManStop(Super2_Man_t *pMan)
Definition: superAnd.c:187
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Super_Precompute ( Mio_Library_t pLibGen,
int  nVarsMax,
int  nLevels,
int  nGatesMax,
float  tDelayMax,
float  tAreaMax,
int  TimeLimit,
int  fSkipInv,
int  fVerbose,
char *  pFileName 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Precomputes the library of supergates.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file superGate.c.

141 {
142  Vec_Str_t * vStr;
143  FILE * pFile = fopen( pFileName, "wb" );
144  if ( pFile == NULL )
145  {
146  printf( "Cannot open output file \"%s\".\n", pFileName );
147  return;
148  }
149  vStr = Super_PrecomputeStr( pLibGen, nVarsMax, nLevels, nGatesMax, tDelayMax, tAreaMax, TimeLimit, fSkipInv, fVerbose );
150  fwrite( Vec_StrArray(vStr), 1, Vec_StrSize(vStr), pFile );
151  fclose( pFile );
152  Vec_StrFree( vStr );
153  // report the result of writing
154  if ( fVerbose )
155  {
156  printf( "The supergates are written using new format \"%s\" ", pFileName );
157  printf( "(%0.3f MB).\n", ((double)Extra_FileSize(pFileName))/(1<<20) );
158  }
159 }
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
int Extra_FileSize(char *pFileName)
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
Vec_Str_t * Super_PrecomputeStr(Mio_Library_t *pLibGen, int nVarsMax, int nLevels, int nGatesMax, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fVerbose)
Definition: superGate.c:172
Vec_Str_t* Super_PrecomputeStr ( Mio_Library_t pLibGen,
int  nVarsMax,
int  nLevels,
int  nGatesMax,
float  tDelayMax,
float  tAreaMax,
int  TimeLimit,
int  fSkipInv,
int  fVerbose 
)

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

Synopsis [Precomputes the library of supergates.]

Description []

SideEffects []

SeeAlso []

Definition at line 172 of file superGate.c.

173 {
174  Vec_Str_t * vStr;
175  Super_Man_t * pMan;
176  Mio_Gate_t ** ppGates;
177  int nGates, Level;
178  abctime clk, clockStart;
179 
180  assert( nVarsMax < 7 );
181  if ( nGatesMax && nGatesMax < nVarsMax )
182  {
183  fprintf( stderr, "Erro! The number of supergates requested (%d) in less than the number of variables (%d).\n", nGatesMax, nVarsMax );
184  fprintf( stderr, "The library cannot be computed.\n" );
185  return NULL;
186  }
187 
188  // get the root gates
189  ppGates = Mio_CollectRoots( pLibGen, nVarsMax, tDelayMax, 0, &nGates, fVerbose );
190  if ( nGatesMax && nGates >= nGatesMax )
191  {
192  fprintf( stdout, "Warning! Genlib library contains more gates than can be computed.\n");
193  fprintf( stdout, "Only one-gate supergates are included in the supergate library.\n" );
194  }
195 
196  // start the manager
197  pMan = Super_ManStart();
198  pMan->pName = Mio_LibraryReadName(pLibGen);
199  pMan->nGatesMax = nGatesMax;
200  pMan->fSkipInv = fSkipInv;
201  pMan->tDelayMax = tDelayMax;
202  pMan->tAreaMax = tAreaMax;
203  pMan->TimeLimit = TimeLimit; // in seconds
204  pMan->TimeStop = TimeLimit ? TimeLimit * CLOCKS_PER_SEC + Abc_Clock() : 0; // in CPU ticks
205  pMan->fVerbose = fVerbose;
206 
207  if ( nGates == 0 )
208  {
209  fprintf( stderr, "Error: No genlib gates satisfy the limits criteria. Stop.\n");
210  fprintf( stderr, "Limits: max delay = %.2f, max area = %.2f, time limit = %d sec.\n",
211  pMan->tDelayMax, pMan->tAreaMax, pMan->TimeLimit );
212 
213  // stop the manager
214  Super_ManStop( pMan );
215  ABC_FREE( ppGates );
216 
217  return NULL;
218  }
219 
220  // get the starting supergates
221  Super_First( pMan, nVarsMax );
222 
223  // perform the computation of supergates
224  clockStart = Abc_Clock();
225 if ( fVerbose )
226 {
227  printf( "Computing supergates with %d inputs, %d levels, and %d max gates.\n",
228  pMan->nVarsMax, nLevels, nGatesMax );
229  printf( "Limits: max delay = %.2f, max area = %.2f, time limit = %d sec.\n",
230  pMan->tDelayMax, pMan->tAreaMax, pMan->TimeLimit );
231 }
232 
233  for ( Level = 1; Level <= nLevels; Level++ )
234  {
235  if ( pMan->TimeStop && Abc_Clock() > pMan->TimeStop )
236  break;
237 clk = Abc_Clock();
238  Super_Compute( pMan, ppGates, nGates, nGatesMax, fSkipInv );
239  pMan->nLevels = Level;
240 if ( fVerbose )
241 {
242  printf( "Lev %d: Try =%12d. Add =%6d. Rem =%5d. Save =%6d. Lookups =%12d. Aliases =%12d. ",
243  Level, pMan->nTried, pMan->nAdded, pMan->nRemoved, pMan->nAdded - pMan->nRemoved, pMan->nLookups, pMan->nAliases );
244 ABC_PRT( "Time", Abc_Clock() - clk );
245 fflush( stdout );
246 }
247  }
248  pMan->Time = Abc_Clock() - clockStart;
249 
250 if ( fVerbose )
251 {
252 printf( "Writing the output file...\n" );
253 fflush( stdout );
254 }
255  // write them into a file
256  vStr = Super_Write( pMan );
257 
258  // stop the manager
259  Super_ManStop( pMan );
260  ABC_FREE( ppGates );
261  return vStr;
262 }
static void Super_ManStop(Super_Man_t *pMan)
Definition: superGate.c:956
static Vec_Str_t * Super_Write(Super_Man_t *pMan)
Definition: superGate.c:979
abctime TimeStop
Definition: superGate.c:76
static abctime Abc_Clock()
Definition: abc_global.h:279
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition: mioApi.c:43
static void Super_First(Super_Man_t *pMan, int nVarsMax)
Definition: superGate.c:276
static Super_Man_t * Super_Compute(Super_Man_t *pMan, Mio_Gate_t **ppGates, int nGates, int nGatesMax, int fSkipInv)
Definition: superGate.c:343
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Mio_Gate_t ** Mio_CollectRoots(Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
Definition: mioUtils.c:302
static Super_Man_t * Super_ManStart()
Definition: superGate.c:936
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278