abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mioUtils.c File Reference
#include <math.h>
#include "mioInt.h"
#include "base/main/main.h"
#include "exp.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Mio_LibraryDelete (Mio_Library_t *pLib)
 DECLARATIONS ///. More...
 
void Mio_GateDelete (Mio_Gate_t *pGate)
 
void Mio_PinDelete (Mio_Pin_t *pPin)
 
Mio_Pin_tMio_PinDup (Mio_Pin_t *pPin)
 
int Mio_CheckPins (Mio_Pin_t *pPin1, Mio_Pin_t *pPin2)
 
int Mio_CheckGates (Mio_Library_t *pLib)
 
void Mio_WritePin (FILE *pFile, Mio_Pin_t *pPin, int NameLen, int fAllPins)
 
void Mio_WriteGate (FILE *pFile, Mio_Gate_t *pGate, int GateLen, int NameLen, int FormLen, int fPrintSops, int fAllPins)
 
void Mio_WriteLibrary (FILE *pFile, Mio_Library_t *pLib, int fPrintSops)
 
int Mio_DelayCompare (Mio_Gate_t **ppG1, Mio_Gate_t **ppG2)
 
Mio_Gate_t ** Mio_CollectRoots (Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
 
int Mio_DelayCompareNew (Mio_Cell_t *pG1, Mio_Cell_t *pG2)
 
void Mio_CollectCopy (Mio_Cell_t *pCell, Mio_Gate_t *pGate)
 
Mio_Cell_tMio_CollectRootsNew (Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
 
Mio_Cell_tMio_CollectRootsNewDefault (int nInputs, int *pnGates, int fVerbose)
 
word Mio_DeriveTruthTable6 (Mio_Gate_t *pGate)
 
void Mio_DeriveTruthTable (Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
 
int Mio_SopGetVarNum (char *pSop)
 
void Mio_DeriveTruthTable2 (Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nTruths, int nInputs, unsigned uTruthRes[])
 
void Mio_DeriveGateDelays (Mio_Gate_t *pGate, float **ptPinDelays, int nPins, int nInputs, float tDelayZero, float *ptDelaysRes, float *ptPinDelayMax)
 
Mio_Gate_tMio_GateCreatePseudo (int nInputs)
 
void Mio_LibraryShiftDelay (Mio_Library_t *pLib, double Shift)
 
void Mio_LibraryMultiArea (Mio_Library_t *pLib, double Multi)
 
void Mio_LibraryMultiDelay (Mio_Library_t *pLib, double Multi)
 
void Mio_LibraryTransferDelays (Mio_Library_t *pLibD, Mio_Library_t *pLibS)
 
void Nf_ManPrepareGate (int nVars, word uTruth, int *pComp, int *pPerm, Vec_Wrd_t *vResult)
 
void Nf_ManPreparePrint (int nVars, int *pComp, int *pPerm, char Line[2 *720 *64][8])
 
void Nf_ManPrepareLibrary (Mio_Library_t *pLib)
 
void Nf_ManPrepareLibraryTest2 ()
 

Function Documentation

int Mio_CheckGates ( Mio_Library_t pLib)

Definition at line 169 of file mioUtils.c.

170 {
171  Mio_Gate_t * pGate;
172  Mio_Pin_t * pPin0 = NULL, * pPin = NULL;
173  Mio_LibraryForEachGate( pLib, pGate )
174  Mio_GateForEachPin( pGate, pPin )
175  if ( Mio_CheckPins( pPin0, pPin ) )
176  pPin0 = pPin;
177  else
178  return 0;
179  return 1;
180 }
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
int Mio_CheckPins(Mio_Pin_t *pPin1, Mio_Pin_t *pPin2)
Definition: mioUtils.c:151
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
int Mio_CheckPins ( Mio_Pin_t pPin1,
Mio_Pin_t pPin2 
)

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

Synopsis [Check if pin characteristics are the same.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file mioUtils.c.

152 {
153  if ( pPin1 == NULL || pPin2 == NULL )
154  return 1;
155  if ( pPin1->dLoadInput != pPin2->dLoadInput )
156  return 0;
157  if ( pPin1->dLoadMax != pPin2->dLoadMax )
158  return 0;
159  if ( pPin1->dDelayBlockRise != pPin2->dDelayBlockRise )
160  return 0;
161  if ( pPin1->dDelayFanoutRise != pPin2->dDelayFanoutRise )
162  return 0;
163  if ( pPin1->dDelayBlockFall != pPin2->dDelayBlockFall )
164  return 0;
165  if ( pPin1->dDelayFanoutFall != pPin2->dDelayFanoutFall )
166  return 0;
167  return 1;
168 }
double dDelayFanoutFall
Definition: mioInt.h:112
double dDelayBlockFall
Definition: mioInt.h:111
double dLoadMax
Definition: mioInt.h:108
double dLoadInput
Definition: mioInt.h:107
double dDelayFanoutRise
Definition: mioInt.h:110
double dDelayBlockRise
Definition: mioInt.h:109
void Mio_CollectCopy ( Mio_Cell_t pCell,
Mio_Gate_t pGate 
)

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

Synopsis [Collects the set of root gates.]

Description [Only collects the gates with unique functionality, which have fewer inputs and shorter delay than the given limits.]

SideEffects []

SeeAlso []

Definition at line 392 of file mioUtils.c.

393 {
394  Mio_Pin_t * pPin;
395  int k;
396  pCell->pName = pGate->pName;
397  pCell->uTruth = pGate->uTruth;
398  pCell->Area = (float)pGate->dArea;
399  pCell->nFanins = pGate->nInputs;
400  for ( k = 0, pPin = pGate->pPins; pPin; pPin = pPin->pNext, k++ )
401  pCell->Delays[k] = (float)(0.5 * pPin->dDelayBlockRise + 0.5 * pPin->dDelayBlockFall);
402 }
char * pName
Definition: mioInt.h:82
Mio_Pin_t * pNext
Definition: mioInt.h:114
char * pName
Definition: mio.h:49
word uTruth
Definition: mio.h:50
for(p=first;p->value< newval;p=p->next)
Mio_Pin_t * pPins
Definition: mioInt.h:85
unsigned nFanins
Definition: mio.h:53
double dDelayBlockFall
Definition: mioInt.h:111
float Area
Definition: mio.h:51
double dArea
Definition: mioInt.h:83
double dDelayBlockRise
Definition: mioInt.h:109
float Delays[6]
Definition: mio.h:54
Mio_Gate_t** Mio_CollectRoots ( Mio_Library_t pLib,
int  nInputs,
float  tDelay,
int  fSkipInv,
int *  pnGates,
int  fVerbose 
)

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

Synopsis [Collects the set of root gates.]

Description [Only collects the gates with unique functionality, which have fewer inputs and shorter delay than the given limits.]

SideEffects []

SeeAlso []

Definition at line 302 of file mioUtils.c.

303 {
304  Mio_Gate_t * pGate;
305  Mio_Gate_t ** ppGates;
306  int i, nGates, iGate;
307  nGates = Mio_LibraryReadGateNum( pLib );
308  ppGates = ABC_ALLOC( Mio_Gate_t *, nGates );
309  iGate = 0;
310  // for each functionality, select gate with the smallest area
311  // if equal areas, select gate with lexicographically smaller name
312  Mio_LibraryForEachGate( pLib, pGate )
313  {
314  if ( pGate->nInputs > nInputs )
315  continue;
316  if ( tDelay > 0.0 && pGate->dDelayMax > (double)tDelay )
317  continue;
318  if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 )
319  continue;
320  if ( pGate->uTruth == ABC_CONST(0xAAAAAAAAAAAAAAAA) )
321  continue;
322  if ( pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA) && fSkipInv )
323  continue;
324  if ( pGate->pTwin ) // skip multi-output gates for now
325  continue;
326  // check if the gate with this functionality already exists
327  for ( i = 0; i < iGate; i++ )
328  if ( ppGates[i]->uTruth == pGate->uTruth )
329  {
330  if ( ppGates[i]->dArea > pGate->dArea ||
331  (ppGates[i]->dArea == pGate->dArea && strcmp(ppGates[i]->pName, pGate->pName) > 0) )
332  ppGates[i] = pGate;
333  break;
334  }
335  if ( i < iGate )
336  continue;
337  assert( iGate < nGates );
338  ppGates[ iGate++ ] = pGate;
339  if ( fVerbose )
340  printf( "Selected gate %3d: %-20s A = %7.2f D = %7.2f %3s = %-s\n",
341  iGate+1, pGate->pName, pGate->dArea, pGate->dDelayMax, pGate->pOutName, pGate->pForm );
342  }
343  // sort by delay
344  if ( iGate > 0 )
345  {
346  qsort( (void *)ppGates, iGate, sizeof(Mio_Gate_t *),
347  (int (*)(const void *, const void *)) Mio_DelayCompare );
348  assert( Mio_DelayCompare( ppGates, ppGates + iGate - 1 ) <= 0 );
349  }
350  if ( pnGates )
351  *pnGates = iGate;
352  return ppGates;
353 }
char * pName
Definition: mioInt.h:82
int Mio_DelayCompare(Mio_Gate_t **ppG1, Mio_Gate_t **ppG2)
Definition: mioUtils.c:281
Mio_Gate_t * pTwin
Definition: mioInt.h:91
char * pOutName
Definition: mioInt.h:86
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int strcmp()
char * pForm
Definition: mioInt.h:84
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
double dDelayMax
Definition: mioInt.h:95
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
double dArea
Definition: mioInt.h:83
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
int Mio_LibraryReadGateNum(Mio_Library_t *pLib)
Definition: mioApi.c:44
Mio_Cell_t* Mio_CollectRootsNew ( Mio_Library_t pLib,
int  nInputs,
int *  pnGates,
int  fVerbose 
)

Definition at line 404 of file mioUtils.c.

405 {
406  Mio_Gate_t * pGate;
407  Mio_Cell_t * ppCells;
408  int i, nGates, iCell = 4;
409  nGates = Mio_LibraryReadGateNum( pLib );
410  ppCells = ABC_CALLOC( Mio_Cell_t, nGates + 4 );
411  // for each functionality, select gate with the smallest area
412  // if equal areas, select gate with lexicographically smaller name
413  Mio_LibraryForEachGate( pLib, pGate )
414  {
415  if ( pGate->nInputs > nInputs || pGate->pTwin ) // skip large and multi-output
416  continue;
417  // check if the gate with this functionality already exists
418  for ( i = 0; i < iCell; i++ )
419  if ( ppCells[i].pName && ppCells[i].uTruth == pGate->uTruth )
420  {
421  if ( ppCells[i].Area > pGate->dArea ||
422  (ppCells[i].Area == pGate->dArea && strcmp(ppCells[i].pName, pGate->pName) > 0) )
423  {
424  Mio_CollectCopy( ppCells + i, pGate );
425  }
426  break;
427  }
428  if ( i < iCell )
429  continue;
430  if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 )
431  {
432  int Idx = (int)(pGate->uTruth == ~(word)0);
433  assert( pGate->nInputs == 0 );
434  Mio_CollectCopy( ppCells + Idx, pGate );
435  continue;
436  }
437  if ( pGate->uTruth == ABC_CONST(0xAAAAAAAAAAAAAAAA) || pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA) )
438  {
439  int Idx = 2 + (int)(pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA));
440  assert( pGate->nInputs == 1 );
441  Mio_CollectCopy( ppCells + Idx, pGate );
442  continue;
443  }
444  Mio_CollectCopy( ppCells + iCell++, pGate );
445  }
446  if ( ppCells[0].pName == NULL )
447  { printf( "Error: Cannot find constant 0 gate in the library.\n" ); return NULL; }
448  if ( ppCells[1].pName == NULL )
449  { printf( "Error: Cannot find constant 1 gate in the library.\n" ); return NULL; }
450  if ( ppCells[2].pName == NULL )
451  { printf( "Error: Cannot find buffer gate in the library.\n" ); return NULL; }
452  if ( ppCells[3].pName == NULL )
453  { printf( "Error: Cannot find inverter gate in the library.\n" ); return NULL; }
454  // sort by delay
455  if ( iCell > 1 )
456  {
457  qsort( (void *)(ppCells + 4), iCell - 4, sizeof(Mio_Cell_t),
458  (int (*)(const void *, const void *)) Mio_DelayCompareNew );
459  assert( Mio_DelayCompareNew( ppCells + 4, ppCells + iCell - 1 ) <= 0 );
460  }
461  // assign IDs
462  for ( i = 0; i < iCell; i++ )
463  ppCells[i].Id = ppCells[i].pName ? i : -1;
464 
465  // report
466  if ( fVerbose )
467  {
468  // count gates
469  int * pCounts = ABC_CALLOC( int, nGates + 4 );
470  Mio_LibraryForEachGate( pLib, pGate )
471  {
472  if ( pGate->nInputs > nInputs || pGate->pTwin ) // skip large and multi-output
473  continue;
474  for ( i = 0; i < iCell; i++ )
475  if ( ppCells[i].pName && ppCells[i].uTruth == pGate->uTruth )
476  {
477  pCounts[i]++;
478  break;
479  }
480  assert( i < iCell );
481  }
482  for ( i = 0; i < iCell; i++ )
483  {
484  Mio_Cell_t * pCell = ppCells + i;
485  printf( "%4d : ", i );
486  if ( pCell->pName == NULL )
487  printf( "None\n" );
488  else
489  printf( "%-20s In = %d N = %3d A = %7.2f D = %7.2f\n",
490  pCell->pName, pCell->nFanins, pCounts[i], pCell->Area, pCell->Delays[0] );
491  }
492  ABC_FREE( pCounts );
493  }
494  if ( pnGates )
495  *pnGates = iCell;
496  return ppCells;
497 }
char * pName
Definition: mioInt.h:82
char * pName
Definition: mio.h:49
Mio_Gate_t * pTwin
Definition: mioInt.h:91
int Mio_DelayCompareNew(Mio_Cell_t *pG1, Mio_Cell_t *pG2)
Definition: mioUtils.c:367
int strcmp()
unsigned nFanins
Definition: mio.h:53
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
float Area
Definition: mio.h:51
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Mio_CollectCopy(Mio_Cell_t *pCell, Mio_Gate_t *pGate)
Definition: mioUtils.c:392
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
double dArea
Definition: mioInt.h:83
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
float Delays[6]
Definition: mio.h:54
int Mio_LibraryReadGateNum(Mio_Library_t *pLib)
Definition: mioApi.c:44
Mio_Cell_t* Mio_CollectRootsNewDefault ( int  nInputs,
int *  pnGates,
int  fVerbose 
)

Definition at line 498 of file mioUtils.c.

499 {
500  return Mio_CollectRootsNew( (Mio_Library_t *)Abc_FrameReadLibGen(), nInputs, pnGates, fVerbose );
501 }
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
Mio_Cell_t * Mio_CollectRootsNew(Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
Definition: mioUtils.c:404
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
int Mio_DelayCompare ( Mio_Gate_t **  ppG1,
Mio_Gate_t **  ppG2 
)

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

Synopsis [Compares the max delay of two gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 281 of file mioUtils.c.

282 {
283  if ( (*ppG1)->dDelayMax < (*ppG2)->dDelayMax )
284  return -1;
285  if ( (*ppG1)->dDelayMax > (*ppG2)->dDelayMax )
286  return 1;
287  return 0;
288 }
int Mio_DelayCompareNew ( Mio_Cell_t pG1,
Mio_Cell_t pG2 
)

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

Synopsis [Compares the max delay of two gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 367 of file mioUtils.c.

368 {
369  if ( (pG1)->nFanins < (pG2)->nFanins )
370  return -1;
371  if ( (pG1)->nFanins > (pG2)->nFanins )
372  return 1;
373  if ( (pG1)->Area < (pG2)->Area )
374  return -1;
375  if ( (pG1)->Area > (pG2)->Area )
376  return 1;
377  return 0;
378 }
void Mio_DeriveGateDelays ( Mio_Gate_t pGate,
float **  ptPinDelays,
int  nPins,
int  nInputs,
float  tDelayZero,
float *  ptDelaysRes,
float *  ptPinDelayMax 
)

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

Synopsis [Derives the area and delay of the root of the gate.]

Description [Array of the resulting delays should be initialized to the (negative) SUPER_NO_VAR value.]

SideEffects []

SeeAlso []

Definition at line 725 of file mioUtils.c.

728 {
729  Mio_Pin_t * pPin;
730  float Delay, DelayMax;
731  int i, k;
732  assert( pGate->nInputs == nPins );
733  // set all the delays to the unused delay
734  for ( i = 0; i < nInputs; i++ )
735  ptDelaysRes[i] = tDelayZero;
736  // compute the delays for each input and the max delay at the same time
737  DelayMax = 0;
738  for ( i = 0; i < nInputs; i++ )
739  {
740  for ( k = 0, pPin = pGate->pPins; pPin; pPin = pPin->pNext, k++ )
741  {
742  if ( ptPinDelays[k][i] < 0 )
743  continue;
744  Delay = ptPinDelays[k][i] + (float)pPin->dDelayBlockMax;
745  if ( ptDelaysRes[i] < Delay )
746  ptDelaysRes[i] = Delay;
747  }
748  if ( k != nPins )
749  {
750  printf ("DEBUG: problem gate is %s\n", Mio_GateReadName( pGate ));
751  }
752  assert( k == nPins );
753  if ( DelayMax < ptDelaysRes[i] )
754  DelayMax = ptDelaysRes[i];
755  }
756  *ptPinDelayMax = DelayMax;
757 }
Mio_Pin_t * pNext
Definition: mioInt.h:114
double dDelayBlockMax
Definition: mioInt.h:113
Mio_Pin_t * pPins
Definition: mioInt.h:85
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
void Mio_DeriveTruthTable ( Mio_Gate_t pGate,
unsigned  uTruthsIn[][2],
int  nSigns,
int  nInputs,
unsigned  uTruthRes[] 
)

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

Synopsis [Derives the truth table of the gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 608 of file mioUtils.c.

609 {
610  word uRes, uFanins[6];
611  int i;
612  assert( pGate->nInputs == nSigns );
613  for ( i = 0; i < nSigns; i++ )
614  uFanins[i] = (((word)uTruthsIn[i][1]) << 32) | (word)uTruthsIn[i][0];
615  uRes = Exp_Truth6( nSigns, pGate->vExpr, (word *)uFanins );
616  uTruthRes[0] = uRes & 0xFFFFFFFF;
617  uTruthRes[1] = uRes >> 32;
618 }
static word Exp_Truth6(int nVars, Vec_Int_t *p, word *puFanins)
Definition: exp.h:183
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Vec_Int_t * vExpr
Definition: mioInt.h:97
#define assert(ex)
Definition: util_old.h:213
void Mio_DeriveTruthTable2 ( Mio_Gate_t pGate,
unsigned  uTruthsIn[][2],
int  nTruths,
int  nInputs,
unsigned  uTruthRes[] 
)

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

Synopsis [Derives the truth table of the root of the gate.]

Description [Given the truth tables of the leaves of the gate, this procedure derives the truth table of the root.]

SideEffects []

SeeAlso []

Definition at line 652 of file mioUtils.c.

653 {
654  unsigned uSignCube[2];
655  int i, nFanins;
656  char * pCube;
657 
658  // make sure that the number of input truth tables in equal to the number of gate inputs
659  assert( pGate->nInputs == nTruths );
660  assert( nInputs < 7 );
661 
662  nFanins = Mio_SopGetVarNum( pGate->pSop );
663  assert( nFanins == nInputs );
664 
665  // clean the resulting truth table
666  uTruthRes[0] = 0;
667  uTruthRes[1] = 0;
668  if ( nInputs < 6 )
669  {
670 // Abc_SopForEachCube( pGate->pSop, nFanins, pCube )
671  for ( pCube = pGate->pSop; *pCube; pCube += (nFanins) + 3 )
672  {
673  // add the clause
674  uSignCube[0] = MIO_FULL;
675  for ( i = 0; i < nFanins; i++ )
676  {
677  if ( pCube[i] == '0' )
678  uSignCube[0] &= ~uTruthsIn[i][0];
679  else if ( pCube[i] == '1' )
680  uSignCube[0] &= uTruthsIn[i][0];
681  }
682  }
683  if ( nInputs < 5 )
684  uTruthRes[0] &= MIO_MASK(1<<nInputs);
685  }
686  else
687  {
688  // consider the case when two unsigneds should be used
689 // Abc_SopForEachCube( pGate->pSop, nFanins, pCube )
690  for ( pCube = pGate->pSop; *pCube; pCube += (nFanins) + 3 )
691  {
692  uSignCube[0] = MIO_FULL;
693  uSignCube[1] = MIO_FULL;
694  for ( i = 0; i < nFanins; i++ )
695  {
696  if ( pCube[i] == '0' )
697  {
698  uSignCube[0] &= ~uTruthsIn[i][0];
699  uSignCube[1] &= ~uTruthsIn[i][1];
700  }
701  else if ( pCube[i] == '1' )
702  {
703  uSignCube[0] &= uTruthsIn[i][0];
704  uSignCube[1] &= uTruthsIn[i][1];
705  }
706  }
707  uTruthRes[0] |= uSignCube[0];
708  uTruthRes[1] |= uSignCube[1];
709  }
710  }
711 }
char * pSop
Definition: mioInt.h:96
#define MIO_FULL
Definition: mioInt.h:55
int Mio_SopGetVarNum(char *pSop)
Definition: mioUtils.c:631
#define MIO_MASK(n)
Definition: mioInt.h:54
#define assert(ex)
Definition: util_old.h:213
word Mio_DeriveTruthTable6 ( Mio_Gate_t pGate)

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

Synopsis [Derives the truth table of the gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file mioUtils.c.

515 {
516  static unsigned uTruths6[6][2] = {
517  { 0xAAAAAAAA, 0xAAAAAAAA },
518  { 0xCCCCCCCC, 0xCCCCCCCC },
519  { 0xF0F0F0F0, 0xF0F0F0F0 },
520  { 0xFF00FF00, 0xFF00FF00 },
521  { 0xFFFF0000, 0xFFFF0000 },
522  { 0x00000000, 0xFFFFFFFF }
523  };
524  union {
525  unsigned u[2];
526  word w;
527  } uTruthRes;
528  assert( pGate->nInputs <= 6 );
529  Mio_DeriveTruthTable( pGate, uTruths6, pGate->nInputs, 6, uTruthRes.u );
530  return uTruthRes.w;
531 }
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
Definition: mioUtils.c:608
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define assert(ex)
Definition: util_old.h:213
Mio_Gate_t* Mio_GateCreatePseudo ( int  nInputs)

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

Synopsis [Creates a pseudo-gate.]

Description [The pseudo-gate is a N-input gate with all info set to 0.]

SideEffects []

SeeAlso []

Definition at line 771 of file mioUtils.c.

772 {
773  Mio_Gate_t * pGate;
774  Mio_Pin_t * pPin;
775  int i;
776  // allocate the gate structure
777  pGate = ABC_ALLOC( Mio_Gate_t, 1 );
778  memset( pGate, 0, sizeof(Mio_Gate_t) );
779  pGate->nInputs = nInputs;
780  // create pins
781  for ( i = 0; i < nInputs; i++ )
782  {
783  pPin = ABC_ALLOC( Mio_Pin_t, 1 );
784  memset( pPin, 0, sizeof(Mio_Pin_t) );
785  pPin->pNext = pGate->pPins;
786  pGate->pPins = pPin;
787  }
788  return pGate;
789 }
char * memset()
Mio_Pin_t * pNext
Definition: mioInt.h:114
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Mio_Pin_t * pPins
Definition: mioInt.h:85
void Mio_GateDelete ( Mio_Gate_t pGate)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file mioUtils.c.

82 {
83  Mio_Pin_t * pPin, * pPin2;
84  if ( pGate->nInputs > 6 )
85  ABC_FREE( pGate->pTruth );
86  Vec_IntFreeP( &pGate->vExpr );
87  ABC_FREE( pGate->pOutName );
88  ABC_FREE( pGate->pName );
89  ABC_FREE( pGate->pForm );
90 // if ( pGate->bFunc )
91 // Cudd_RecursiveDeref( pGate->pLib->dd, pGate->bFunc );
92  Mio_GateForEachPinSafe( pGate, pPin, pPin2 )
93  Mio_PinDelete( pPin );
94  ABC_FREE( pGate );
95 }
char * pName
Definition: mioInt.h:82
void Mio_PinDelete(Mio_Pin_t *pPin)
Definition: mioUtils.c:108
char * pOutName
Definition: mioInt.h:86
char * pForm
Definition: mioInt.h:84
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Mio_GateForEachPinSafe(Gate, Pin, Pin2)
Definition: mio.h:80
Vec_Int_t * vExpr
Definition: mioInt.h:97
#define ABC_FREE(obj)
Definition: abc_global.h:232
word * pTruth
Definition: mioInt.h:99
ABC_NAMESPACE_IMPL_START void Mio_LibraryDelete ( Mio_Library_t pLib)

DECLARATIONS ///.

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

FileName [mioUtils.c]

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

Synopsis [File reading/writing for technology mapping.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mioUtils.c,v 1.6 2004/09/03 18:02:20 satrajit Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file mioUtils.c.

49 {
50  Mio_Gate_t * pGate, * pGate2;
51  if ( pLib == NULL )
52  return;
53  // free the bindings of nodes to gates from this library for all networks
55  // free the library
56  ABC_FREE( pLib->pName );
57  Mio_LibraryForEachGateSafe( pLib, pGate, pGate2 )
58  Mio_GateDelete( pGate );
59  Mem_FlexStop( pLib->pMmFlex, 0 );
60  Vec_StrFree( pLib->vCube );
61  if ( pLib->tName2Gate )
62  st__free_table( pLib->tName2Gate );
63 // if ( pLib->dd )
64 // Cudd_Quit( pLib->dd );
65  ABC_FREE( pLib->ppGates0 );
66  ABC_FREE( pLib->ppGatesName );
67  ABC_FREE( pLib );
68 }
void st__free_table(st__table *table)
Definition: st.c:81
void Mio_GateDelete(Mio_Gate_t *pGate)
Definition: mioUtils.c:81
ABC_DLL void Abc_FrameUnmapAllNetworks(Abc_Frame_t *p)
Definition: mainFrame.c:532
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
void * Abc_FrameGetGlobalFrame()
Definition: mainFrame.c:593
if(last==0)
Definition: sparse_int.h:34
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Mio_LibraryForEachGateSafe(Lib, Gate, Gate2)
Definition: mio.h:69
void Mio_LibraryMultiArea ( Mio_Library_t pLib,
double  Multi 
)

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

Synopsis [Multiply areas/delays by values proportional to fanin count.]

Description []

SideEffects []

SeeAlso []

Definition at line 829 of file mioUtils.c.

830 {
831  Mio_Gate_t * pGate;
832  Mio_LibraryForEachGate( pLib, pGate )
833  {
834  if ( pGate->nInputs < 2 )
835  continue;
836 // printf( "Before %8.3f ", pGate->dArea );
837  pGate->dArea *= pow( pGate->nInputs, Multi );
838 // printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dArea, pGate->nInputs, pow( pGate->nInputs, Multi ) );
839  }
840 }
double dArea
Definition: mioInt.h:83
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
void Mio_LibraryMultiDelay ( Mio_Library_t pLib,
double  Multi 
)

Definition at line 841 of file mioUtils.c.

842 {
843  Mio_Gate_t * pGate;
844  Mio_Pin_t * pPin;
845  Mio_LibraryForEachGate( pLib, pGate )
846  {
847  if ( pGate->nInputs < 2 )
848  continue;
849 // printf( "Before %8.3f ", pGate->dDelayMax );
850  pGate->dDelayMax *= pow( pGate->nInputs, Multi );
851 // printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dDelayMax, pGate->nInputs, pow( pGate->nInputs, Multi ) );
852  Mio_GateForEachPin( pGate, pPin )
853  {
854  pPin->dDelayBlockRise *= pow( pGate->nInputs, Multi );
855  pPin->dDelayBlockFall *= pow( pGate->nInputs, Multi );
856  pPin->dDelayBlockMax *= pow( pGate->nInputs, Multi );
857  }
858  }
859 }
double dDelayBlockMax
Definition: mioInt.h:113
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
double dDelayBlockFall
Definition: mioInt.h:111
double dDelayMax
Definition: mioInt.h:95
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
double dDelayBlockRise
Definition: mioInt.h:109
void Mio_LibraryShiftDelay ( Mio_Library_t pLib,
double  Shift 
)

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

Synopsis [Adds constant value to all delay values.]

Description [The pseudo-gate is a N-input gate with all info set to 0.]

SideEffects []

SeeAlso []

Definition at line 802 of file mioUtils.c.

803 {
804  Mio_Gate_t * pGate;
805  Mio_Pin_t * pPin;
806  Mio_LibraryForEachGate( pLib, pGate )
807  {
808  pGate->dDelayMax += Shift;
809  Mio_GateForEachPin( pGate, pPin )
810  {
811  pPin->dDelayBlockRise += Shift;
812  pPin->dDelayBlockFall += Shift;
813  pPin->dDelayBlockMax += Shift;
814  }
815  }
816 }
double dDelayBlockMax
Definition: mioInt.h:113
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
double dDelayBlockFall
Definition: mioInt.h:111
double dDelayMax
Definition: mioInt.h:95
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
double dDelayBlockRise
Definition: mioInt.h:109
void Mio_LibraryTransferDelays ( Mio_Library_t pLibD,
Mio_Library_t pLibS 
)

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

Synopsis [Transfers delays from the second to the first.]

Description []

SideEffects []

SeeAlso []

Definition at line 872 of file mioUtils.c.

873 {
874  Mio_Gate_t * pGateD, * pGateS;
875  Mio_Pin_t * pPinD, * pPinS;
876  Mio_LibraryForEachGate( pLibS, pGateS )
877  {
878  Mio_LibraryForEachGate( pLibD, pGateD )
879  {
880  if ( pGateD->uTruth != pGateS->uTruth )
881  continue;
882  pPinS = Mio_GateReadPins( pGateS );
883  Mio_GateForEachPin( pGateD, pPinD )
884  {
885  if (pPinS)
886  {
887  pPinD->dDelayBlockRise = pPinS->dDelayBlockRise;
888  pPinD->dDelayBlockFall = pPinS->dDelayBlockFall;
889  pPinD->dDelayBlockMax = pPinS->dDelayBlockMax;
890  pPinS = Mio_PinReadNext(pPinS);
891  }
892  else
893  {
894  pPinD->dDelayBlockRise = 0;
895  pPinD->dDelayBlockFall = 0;
896  pPinD->dDelayBlockMax = 0;
897  }
898  }
899  }
900  }
901 }
double dDelayBlockMax
Definition: mioInt.h:113
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition: mioApi.c:147
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition: mioApi.c:179
double dDelayBlockFall
Definition: mioInt.h:111
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
double dDelayBlockRise
Definition: mioInt.h:109
void Mio_PinDelete ( Mio_Pin_t pPin)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file mioUtils.c.

109 {
110  ABC_FREE( pPin->pName );
111  ABC_FREE( pPin );
112 }
char * pName
Definition: mioInt.h:105
#define ABC_FREE(obj)
Definition: abc_global.h:232
Mio_Pin_t* Mio_PinDup ( Mio_Pin_t pPin)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file mioUtils.c.

126 {
127  Mio_Pin_t * pPinNew;
128 
129  pPinNew = ABC_ALLOC( Mio_Pin_t, 1 );
130  *pPinNew = *pPin;
131  pPinNew->pName = (pPinNew->pName ? Abc_UtilStrsav(pPinNew->pName) : NULL);
132  pPinNew->pNext = NULL;
133 
134  return pPinNew;
135 }
Mio_Pin_t * pNext
Definition: mioInt.h:114
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * pName
Definition: mioInt.h:105
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Mio_SopGetVarNum ( char *  pSop)

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

Synopsis [Reads the number of variables in the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 631 of file mioUtils.c.

632 {
633  char * pCur;
634  for ( pCur = pSop; *pCur != '\n'; pCur++ )
635  if ( *pCur == 0 )
636  return -1;
637  return pCur - pSop - 2;
638 }
void Mio_WriteGate ( FILE *  pFile,
Mio_Gate_t pGate,
int  GateLen,
int  NameLen,
int  FormLen,
int  fPrintSops,
int  fAllPins 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file mioUtils.c.

221 {
222  char Buffer[5000];
223  Mio_Pin_t * pPin;
224  assert( NameLen+FormLen+2 < 5000 );
225  sprintf( Buffer, "%s=%s;", pGate->pOutName, pGate->pForm );
226  fprintf( pFile, "GATE %-*s ", GateLen, pGate->pName );
227  fprintf( pFile, "%8.2f ", pGate->dArea );
228  fprintf( pFile, "%-*s ", Abc_MinInt(NameLen+FormLen+2, 30), Buffer );
229  // print the pins
230  if ( fPrintSops )
231  fprintf( pFile, "%s", pGate->pSop? pGate->pSop : "unspecified\n" );
232  if ( fAllPins && pGate->pPins ) // equal pins
233  Mio_WritePin( pFile, pGate->pPins, NameLen, 1 );
234  else // different pins
235  Mio_GateForEachPin( pGate, pPin )
236  Mio_WritePin( pFile, pPin, NameLen, 0 );
237  fprintf( pFile, "\n" );
238 }
void Mio_WritePin(FILE *pFile, Mio_Pin_t *pPin, int NameLen, int fAllPins)
Definition: mioUtils.c:193
char * pName
Definition: mioInt.h:82
char * pOutName
Definition: mioInt.h:86
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
char * pSop
Definition: mioInt.h:96
Mio_Pin_t * pPins
Definition: mioInt.h:85
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
char * pForm
Definition: mioInt.h:84
char * sprintf()
#define assert(ex)
Definition: util_old.h:213
double dArea
Definition: mioInt.h:83
void Mio_WriteLibrary ( FILE *  pFile,
Mio_Library_t pLib,
int  fPrintSops 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file mioUtils.c.

252 {
253  Mio_Gate_t * pGate;
254  Mio_Pin_t * pPin;
255  int i, GateLen = 0, NameLen = 0, FormLen = 0;
256  int fAllPins = Mio_CheckGates( pLib );
257  Mio_LibraryForEachGate( pLib, pGate )
258  {
259  GateLen = Abc_MaxInt( GateLen, strlen(pGate->pName) );
260  NameLen = Abc_MaxInt( NameLen, strlen(pGate->pOutName) );
261  FormLen = Abc_MaxInt( FormLen, strlen(pGate->pForm) );
262  Mio_GateForEachPin( pGate, pPin )
263  NameLen = Abc_MaxInt( NameLen, strlen(pPin->pName) );
264  }
265  fprintf( pFile, "# The genlib library \"%s\" written by ABC on %s\n\n", pLib->pName, Extra_TimeStamp() );
266  for ( i = 0; i < pLib->nGates; i++ )
267  Mio_WriteGate( pFile, pLib->ppGates0[i], GateLen, NameLen, FormLen, fPrintSops, fAllPins );
268 }
Mio_Gate_t ** ppGates0
Definition: mioInt.h:65
char * pName
Definition: mioInt.h:82
char * pOutName
Definition: mioInt.h:86
#define Mio_GateForEachPin(Gate, Pin)
Definition: mio.h:76
void Mio_WriteGate(FILE *pFile, Mio_Gate_t *pGate, int GateLen, int NameLen, int FormLen, int fPrintSops, int fAllPins)
Definition: mioUtils.c:220
int Mio_CheckGates(Mio_Library_t *pLib)
Definition: mioUtils.c:169
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
char * pForm
Definition: mioInt.h:84
int strlen()
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition: mio.h:65
void Mio_WritePin ( FILE *  pFile,
Mio_Pin_t pPin,
int  NameLen,
int  fAllPins 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 193 of file mioUtils.c.

194 {
195  char * pPhaseNames[10] = { "UNKNOWN", "INV", "NONINV" };
196  if ( fAllPins )
197  fprintf( pFile, "PIN * " );
198  else
199  fprintf( pFile, "\n PIN %*s ", NameLen, pPin->pName );
200  fprintf( pFile, "%7s ", pPhaseNames[pPin->Phase] );
201  fprintf( pFile, "%3d ", (int)pPin->dLoadInput );
202  fprintf( pFile, "%3d ", (int)pPin->dLoadMax );
203  fprintf( pFile, "%6.2f ", pPin->dDelayBlockRise );
204  fprintf( pFile, "%6.2f ", pPin->dDelayFanoutRise );
205  fprintf( pFile, "%6.2f ", pPin->dDelayBlockFall );
206  fprintf( pFile, "%6.2f", pPin->dDelayFanoutFall );
207 }
char * pName
Definition: mioInt.h:105
double dDelayFanoutFall
Definition: mioInt.h:112
double dDelayBlockFall
Definition: mioInt.h:111
Mio_PinPhase_t Phase
Definition: mioInt.h:106
double dLoadMax
Definition: mioInt.h:108
double dLoadInput
Definition: mioInt.h:107
double dDelayFanoutRise
Definition: mioInt.h:110
double dDelayBlockRise
Definition: mioInt.h:109
void Nf_ManPrepareGate ( int  nVars,
word  uTruth,
int *  pComp,
int *  pPerm,
Vec_Wrd_t vResult 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 914 of file mioUtils.c.

915 {
916  int nPerms = Extra_Factorial( nVars );
917  int nMints = (1 << nVars);
918  word tCur, tTemp1, tTemp2;
919  int i, p, c;
920  Vec_WrdClear( vResult );
921  for ( i = 0; i < 2; i++ )
922  {
923  tCur = i ? ~uTruth : uTruth;
924  tTemp1 = tCur;
925  for ( p = 0; p < nPerms; p++ )
926  {
927  tTemp2 = tCur;
928  for ( c = 0; c < nMints; c++ )
929  {
930  Vec_WrdPush( vResult, tCur );
931  tCur = Abc_Tt6Flip( tCur, pComp[c] );
932  }
933  assert( tTemp2 == tCur );
934  tCur = Abc_Tt6SwapAdjacent( tCur, pPerm[p] );
935  }
936  assert( tTemp1 == tCur );
937  }
938 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static word Abc_Tt6SwapAdjacent(word Truth, int iVar)
Definition: utilTruth.h:1186
static void Vec_WrdClear(Vec_Wrd_t *p)
Definition: vecWrd.h:602
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Abc_Tt6Flip(word Truth, int iVar)
Definition: utilTruth.h:1126
static int pPerm[13719]
Definition: rwrTemp.c:32
int Extra_Factorial(int n)
#define assert(ex)
Definition: util_old.h:213
void Nf_ManPrepareLibrary ( Mio_Library_t pLib)

Definition at line 976 of file mioUtils.c.

977 {
978 // char Lines[2*720*64][8];
979 // Nf_ManPreparePrint( 6, pComp, pPerm, Lines );
980  int * pComp[7];
981  int * pPerm[7];
982  Mio_Gate_t ** ppGates;
983  Vec_Wrd_t * vResult;
984  word * pTruths;
985  int * pSizes;
986  int nGates, i, nClasses = 0, nTotal;
987  abctime clk = Abc_Clock();
988 
989  for ( i = 2; i <= 6; i++ )
990  pComp[i] = Extra_GreyCodeSchedule( i );
991  for ( i = 2; i <= 6; i++ )
992  pPerm[i] = Extra_PermSchedule( i );
993 
994  // collect truth tables
995  ppGates = Mio_CollectRoots( pLib, 6, (float)1.0e+20, 1, &nGates, 0 );
996  pSizes = ABC_CALLOC( int, nGates );
997  pTruths = ABC_CALLOC( word, nGates );
998  vResult = Vec_WrdAlloc( 2 * 720 * 64 );
999  for ( i = 0; i < nGates; i++ )
1000  {
1001  pSizes[i] = Mio_GateReadPinNum( ppGates[i] );
1002  assert( pSizes[i] > 1 && pSizes[i] <= 6 );
1003  pTruths[i] = Mio_GateReadTruth( ppGates[i] );
1004 
1005  Nf_ManPrepareGate( pSizes[i], pTruths[i], pComp[pSizes[i]], pPerm[pSizes[i]], vResult );
1006  Vec_WrdUniqify(vResult);
1007  nClasses += Vec_WrdSize(vResult);
1008  nTotal = (1 << (pSizes[i]+1)) * Extra_Factorial(pSizes[i]);
1009 
1010  printf( "%6d : ", i );
1011  printf( "%16s : ", Mio_GateReadName( ppGates[i] ) );
1012  printf( "%48s : ", Mio_GateReadForm( ppGates[i] ) );
1013  printf( "Inputs = %2d ", pSizes[i] );
1014  printf( "Total = %6d ", nTotal );
1015  printf( "Classes = %6d ", Vec_WrdSize(vResult) );
1016  printf( "Configs = %8.2f ", 1.0*nTotal/Vec_WrdSize(vResult) );
1017  printf( "%6.2f %% ", 100.0*Vec_WrdSize(vResult)/nTotal );
1018  Dau_DsdPrintFromTruth( &pTruths[i], pSizes[i] );
1019 // printf( "\n" );
1020  }
1021  Vec_WrdFree( vResult );
1022  ABC_FREE( ppGates );
1023  ABC_FREE( pSizes );
1024  ABC_FREE( pTruths );
1025 
1026  for ( i = 2; i <= 6; i++ )
1027  ABC_FREE( pComp[i] );
1028  for ( i = 2; i <= 6; i++ )
1029  ABC_FREE( pPerm[i] );
1030 
1031  printf( "Classes = %d. ", nClasses );
1032  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1033 }
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
Definition: rwrTemp.c:30
int * Extra_GreyCodeSchedule(int n)
int * Extra_PermSchedule(int n)
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition: dauDsd.c:1968
word Mio_GateReadTruth(Mio_Gate_t *pGate)
Definition: mioApi.c:154
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static void Vec_WrdUniqify(Vec_Wrd_t *p)
Definition: vecWrd.h:1076
char * Mio_GateReadForm(Mio_Gate_t *pGate)
Definition: mioApi.c:146
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition: mioApi.c:151
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static int pPerm[13719]
Definition: rwrTemp.c:32
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
void Nf_ManPrepareGate(int nVars, word uTruth, int *pComp, int *pPerm, Vec_Wrd_t *vResult)
Definition: mioUtils.c:914
Mio_Gate_t ** Mio_CollectRoots(Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
Definition: mioUtils.c:302
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int Extra_Factorial(int n)
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
void Nf_ManPrepareLibraryTest2 ( )

Definition at line 1035 of file mioUtils.c.

1036 {
1038  if ( pLib != NULL )
1039  Nf_ManPrepareLibrary( pLib );
1040  else
1041  printf( "Standard cell library is not available.\n" );
1042 
1043 }
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
void Nf_ManPrepareLibrary(Mio_Library_t *pLib)
Definition: mioUtils.c:976
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
void Nf_ManPreparePrint ( int  nVars,
int *  pComp,
int *  pPerm,
char  Line[2 *720 *64][8] 
)

Definition at line 939 of file mioUtils.c.

940 {
941  int nPerms = Extra_Factorial( nVars );
942  int nMints = (1 << nVars);
943  char * pChar, * pChar2;
944  int i, p, c, n = 0;
945  for ( i = 0; i < nVars; i++ )
946  Line[0][i] = 'A' + nVars - 1 - i;
947  Line[0][nVars] = '+';
948  Line[0][nVars+1] = 0;
949  for ( i = 0; i < 2; i++ )
950  {
951  Line[n][nVars] = i ? '-' : '+';
952  for ( p = 0; p < nPerms; p++ )
953  {
954  for ( c = 0; c < nMints; c++ )
955  {
956  strcpy( Line[n+1], Line[n] ); n++;
957  pChar = &Line[n][pComp[c]];
958  if ( *pChar >= 'A' && *pChar <= 'Z' )
959  *pChar += 'a' - 'A';
960  else if ( *pChar >= 'a' && *pChar <= 'z' )
961  *pChar -= 'a' - 'A';
962  }
963  pChar = &Line[n][pPerm[p]];
964  pChar2 = pChar + 1;
965  ABC_SWAP( char, *pChar, *pChar2 );
966  }
967  }
968  assert( n == 2*nPerms*nMints );
969  n = 0;
970  for ( i = 0; i < 2; i++ )
971  for ( p = 0; p < nPerms; p++ )
972  for ( c = 0; c < nMints; c++ )
973  printf("%8d : %d %3d %2d : %s\n", n, i, p, c, Line[n]), n++;
974 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static int pPerm[13719]
Definition: rwrTemp.c:32
char * strcpy()
int Extra_Factorial(int n)
#define assert(ex)
Definition: util_old.h:213