ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mio.h File Reference

Go to the source code of this file.

Classes

struct  Mio_Cell_t_
 
struct  Mio_Cell2_t_
 

Macros

#define Mio_LibraryForEachGate(Lib, Gate)
 GLOBAL VARIABLES ///.
 
#define Mio_LibraryForEachGateSafe(Lib, Gate, Gate2)
 
#define Mio_GateForEachPin(Gate, Pin)
 
#define Mio_GateForEachPinSafe(Gate, Pin, Pin2)
 

Typedefs

typedef struct Mio_LibraryStruct_t_ Mio_Library_t
 
typedef struct Mio_GateStruct_t_ Mio_Gate_t
 
typedef struct Mio_PinStruct_t_ Mio_Pin_t
 
typedef struct Mio_Cell_t_ Mio_Cell_t
 
typedef struct Mio_Cell2_t_ Mio_Cell2_t
 

Enumerations

enum  Mio_PinPhase_t { MIO_PHASE_UNKNOWN , MIO_PHASE_INV , MIO_PHASE_NONINV }
 INCLUDES ///. More...
 

Functions

void Mio_UpdateGenlib (Mio_Library_t *pLib)
 FUNCTION DEFINITIONS ///.
 
int Mio_UpdateGenlib2 (Vec_Str_t *vStr, Vec_Str_t *vStr2, char *pFileName, int fVerbose)
 
char * Mio_LibraryReadName (Mio_Library_t *pLib)
 DECLARATIONS ///.
 
char * Mio_LibraryReadFileName (Mio_Library_t *pLib)
 
int Mio_LibraryReadGateNum (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadGates (Mio_Library_t *pLib)
 
Mio_Gate_t ** Mio_LibraryReadGateArray (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadGateById (Mio_Library_t *pLib, int iD)
 
Mio_Gate_tMio_LibraryReadGateByName (Mio_Library_t *pLib, char *pName, char *pOutName)
 
char * Mio_LibraryReadSopByName (Mio_Library_t *pLib, char *pName)
 
Mio_Gate_tMio_LibraryReadGateByTruth (Mio_Library_t *pLib, word t)
 
Mio_Gate_tMio_LibraryReadConst0 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadConst1 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadNand2 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadAnd2 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadNor2 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadOr2 (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadBuf (Mio_Library_t *pLib)
 
Mio_Gate_tMio_LibraryReadInv (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayInvRise (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayInvFall (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayInvMax (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayNand2Rise (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayNand2Fall (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayNand2Max (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayAnd2Max (Mio_Library_t *pLib)
 
float Mio_LibraryReadDelayAigNode (Mio_Library_t *pLib)
 
float Mio_LibraryReadAreaInv (Mio_Library_t *pLib)
 
float Mio_LibraryReadAreaBuf (Mio_Library_t *pLib)
 
float Mio_LibraryReadAreaNand2 (Mio_Library_t *pLib)
 
int Mio_LibraryReadGateNameMax (Mio_Library_t *pLib)
 
void Mio_LibrarySetName (Mio_Library_t *pLib, char *pName)
 
char * Mio_GateReadName (Mio_Gate_t *pGate)
 
char * Mio_GateReadOutName (Mio_Gate_t *pGate)
 
double Mio_GateReadArea (Mio_Gate_t *pGate)
 
char * Mio_GateReadForm (Mio_Gate_t *pGate)
 
Mio_Pin_tMio_GateReadPins (Mio_Gate_t *pGate)
 
Mio_Library_tMio_GateReadLib (Mio_Gate_t *pGate)
 
Mio_Gate_tMio_GateReadNext (Mio_Gate_t *pGate)
 
Mio_Gate_tMio_GateReadTwin (Mio_Gate_t *pGate)
 
int Mio_GateReadPinNum (Mio_Gate_t *pGate)
 
double Mio_GateReadDelayMax (Mio_Gate_t *pGate)
 
char * Mio_GateReadSop (Mio_Gate_t *pGate)
 
Vec_Int_tMio_GateReadExpr (Mio_Gate_t *pGate)
 
word Mio_GateReadTruth (Mio_Gate_t *pGate)
 
wordMio_GateReadTruthP (Mio_Gate_t *pGate)
 
int Mio_GateReadValue (Mio_Gate_t *pGate)
 
int Mio_GateReadCell (Mio_Gate_t *pGate)
 
int Mio_GateReadProfile (Mio_Gate_t *pGate)
 
int Mio_GateReadProfile2 (Mio_Gate_t *pGate)
 
char * Mio_GateReadPinName (Mio_Gate_t *pGate, int iPin)
 
float Mio_GateReadPinDelay (Mio_Gate_t *pGate, int iPin)
 
void Mio_GateSetValue (Mio_Gate_t *pGate, int Value)
 
void Mio_GateSetCell (Mio_Gate_t *pGate, int Cell)
 
void Mio_GateSetProfile (Mio_Gate_t *pGate, int Prof)
 
void Mio_GateSetProfile2 (Mio_Gate_t *pGate, int Prof)
 
void Mio_GateIncProfile2 (Mio_Gate_t *pGate)
 
void Mio_GateDecProfile2 (Mio_Gate_t *pGate)
 
void Mio_GateAddToProfile (Mio_Gate_t *pGate, int Prof)
 
void Mio_GateAddToProfile2 (Mio_Gate_t *pGate, int Prof)
 
int Mio_GateIsInv (Mio_Gate_t *pGate)
 
char * Mio_PinReadName (Mio_Pin_t *pPin)
 
Mio_PinPhase_t Mio_PinReadPhase (Mio_Pin_t *pPin)
 
double Mio_PinReadInputLoad (Mio_Pin_t *pPin)
 
double Mio_PinReadMaxLoad (Mio_Pin_t *pPin)
 
double Mio_PinReadDelayBlockRise (Mio_Pin_t *pPin)
 
double Mio_PinReadDelayFanoutRise (Mio_Pin_t *pPin)
 
double Mio_PinReadDelayBlockFall (Mio_Pin_t *pPin)
 
double Mio_PinReadDelayFanoutFall (Mio_Pin_t *pPin)
 
double Mio_PinReadDelayBlockMax (Mio_Pin_t *pPin)
 
Mio_Pin_tMio_PinReadNext (Mio_Pin_t *pPin)
 
char * Mio_ReadFile (char *FileName, int fAddEnd)
 
Mio_Library_tMio_LibraryRead (char *FileName, char *pBuffer, char *ExcludeFile, int nFaninLimit, int fVerbose)
 
int Mio_LibraryReadExclude (char *ExcludeFile, st__table *tExcludeGate)
 
int Mio_LibraryParseFormulas (Mio_Library_t *pLib)
 FUNCTION DEFINITIONS ///.
 
Vec_Int_tMio_ParseFormula (char *pFormInit, char **ppVarNames, int nVars)
 
Vec_Wrd_tMio_ParseFormulaTruth (char *pFormInit, char **ppVarNames, int nVars)
 
int Mio_ParseCheckFormula (Mio_Gate_t *pGate, char *pForm)
 
char * Mio_LibDeriveSop (int nVars, Vec_Int_t *vExpr, Vec_Str_t *vStr)
 
void Mio_LibraryDelete (Mio_Library_t *pLib)
 DECLARATIONS ///.
 
void Mio_GateDelete (Mio_Gate_t *pGate)
 
void Mio_PinDelete (Mio_Pin_t *pPin)
 
Mio_Pin_tMio_PinDup (Mio_Pin_t *pPin)
 
void Mio_WriteLibrary (FILE *pFile, Mio_Library_t *pLib, int fPrintSops, int fShort, int fSelected)
 
void Mio_WriteLibraryVerilog (FILE *pFile, Mio_Library_t *pLib, int fPrintSops, int fShort, int fSelected)
 
Mio_Gate_t ** Mio_CollectRoots (Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
 
Mio_Cell_tMio_CollectRootsNew (Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
 
Mio_Cell_tMio_CollectRootsNewDefault (int nInputs, int *pnGates, int fVerbose)
 
Mio_Cell2_tMio_CollectRootsNewDefault2 (int nInputs, int *pnGates, int fVerbose)
 
int Mio_CollectRootsNewDefault3 (int nInputs, Vec_Ptr_t **pvNames, Vec_Wrd_t **pvTruths)
 
word Mio_DeriveTruthTable6 (Mio_Gate_t *pGate)
 
void Mio_DeriveTruthTable (Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, 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 Mio_LibraryTransferCellIds ()
 
void Mio_LibraryReadProfile (FILE *pFile, Mio_Library_t *pLib)
 
void Mio_LibraryWriteProfile (FILE *pFile, Mio_Library_t *pLib)
 
void Mio_LibraryTransferProfile (Mio_Library_t *pLibDst, Mio_Library_t *pLibSrc)
 
void Mio_LibraryTransferProfile2 (Mio_Library_t *pLibDst, Mio_Library_t *pLibSrc)
 
int Mio_LibraryHasProfile (Mio_Library_t *pLib)
 
void Mio_LibraryCleanProfile2 (Mio_Library_t *pLib)
 
void Mio_LibraryShortNames (Mio_Library_t *pLib)
 
void Mio_LibraryMatchesStop (Mio_Library_t *pLib)
 
void Mio_LibraryMatchesStart (Mio_Library_t *pLib, int fPinFilter, int fPinPerm, int fPinQuick)
 
void Mio_LibraryMatchesFetch (Mio_Library_t *pLib, Vec_Mem_t **pvTtMem, Vec_Wec_t **pvTt2Match, Mio_Cell2_t **ppCells, int *pnCells, int fPinFilter, int fPinPerm, int fPinQuick)
 
void Mio_LibraryMatches2Stop (Mio_Library_t *pLib)
 
void Mio_LibraryMatches2Start (Mio_Library_t *pLib)
 
void Mio_LibraryMatches2Fetch (Mio_Library_t *pLib, Vec_Ptr_t **pvNames, Vec_Wrd_t **pvTruths, Vec_Int_t **pvTt2Match4, Vec_Int_t **pvConfigs, Vec_Mem_t *pvTtMem2[3], Vec_Int_t *pvTt2Match2[3])
 
Mio_Library_tAbc_SclDeriveGenlibSimple (void *pScl)
 
Mio_Library_tAbc_SclDeriveGenlib (void *pScl, void *pMio, float Slew, float Gain, int nGatesMin, int fVerbose)
 

Macro Definition Documentation

◆ Mio_GateForEachPin

#define Mio_GateForEachPin ( Gate,
Pin )
Value:
for ( Pin = Mio_GateReadPins(Gate); \
Pin; \
Pin = Mio_PinReadNext(Pin) )
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition mioApi.c:173
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition mioApi.c:217

Definition at line 92 of file mio.h.

92#define Mio_GateForEachPin( Gate, Pin ) \
93 for ( Pin = Mio_GateReadPins(Gate); \
94 Pin; \
95 Pin = Mio_PinReadNext(Pin) )

◆ Mio_GateForEachPinSafe

#define Mio_GateForEachPinSafe ( Gate,
Pin,
Pin2 )
Value:
for ( Pin = Mio_GateReadPins(Gate), \
Pin2 = (Pin? Mio_PinReadNext(Pin): NULL); \
Pin; \
Pin = Pin2, \
Pin2 = (Pin? Mio_PinReadNext(Pin): NULL) )

Definition at line 96 of file mio.h.

96#define Mio_GateForEachPinSafe( Gate, Pin, Pin2 ) \
97 for ( Pin = Mio_GateReadPins(Gate), \
98 Pin2 = (Pin? Mio_PinReadNext(Pin): NULL); \
99 Pin; \
100 Pin = Pin2, \
101 Pin2 = (Pin? Mio_PinReadNext(Pin): NULL) )

◆ Mio_LibraryForEachGate

#define Mio_LibraryForEachGate ( Lib,
Gate )
Value:
for ( Gate = Mio_LibraryReadGates(Lib); \
Gate; \
Gate = Mio_GateReadNext(Gate) )
Mio_Gate_t * Mio_LibraryReadGates(Mio_Library_t *pLib)
Definition mioApi.c:46
Mio_Gate_t * Mio_GateReadNext(Mio_Gate_t *pGate)
Definition mioApi.c:175

GLOBAL VARIABLES ///.

MACRO DEFINITIONS ///

Definition at line 81 of file mio.h.

81#define Mio_LibraryForEachGate( Lib, Gate ) \
82 for ( Gate = Mio_LibraryReadGates(Lib); \
83 Gate; \
84 Gate = Mio_GateReadNext(Gate) )

◆ Mio_LibraryForEachGateSafe

#define Mio_LibraryForEachGateSafe ( Lib,
Gate,
Gate2 )
Value:
for ( Gate = Mio_LibraryReadGates(Lib), \
Gate2 = (Gate? Mio_GateReadNext(Gate): NULL); \
Gate; \
Gate = Gate2, \
Gate2 = (Gate? Mio_GateReadNext(Gate): NULL) )

Definition at line 85 of file mio.h.

85#define Mio_LibraryForEachGateSafe( Lib, Gate, Gate2 ) \
86 for ( Gate = Mio_LibraryReadGates(Lib), \
87 Gate2 = (Gate? Mio_GateReadNext(Gate): NULL); \
88 Gate; \
89 Gate = Gate2, \
90 Gate2 = (Gate? Mio_GateReadNext(Gate): NULL) )

Typedef Documentation

◆ Mio_Cell2_t

typedef struct Mio_Cell2_t_ Mio_Cell2_t

Definition at line 57 of file mio.h.

◆ Mio_Cell_t

typedef struct Mio_Cell_t_ Mio_Cell_t

Definition at line 46 of file mio.h.

◆ Mio_Gate_t

typedef struct Mio_GateStruct_t_ Mio_Gate_t

Definition at line 43 of file mio.h.

◆ Mio_Library_t

Definition at line 42 of file mio.h.

◆ Mio_Pin_t

typedef struct Mio_PinStruct_t_ Mio_Pin_t

Definition at line 44 of file mio.h.

Enumeration Type Documentation

◆ Mio_PinPhase_t

INCLUDES ///.

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

FileName [mio.h]

PackageName [MVSIS 2.0: 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
mio.h,v 1.6 2004/08/09 22:16:31 satrajit Exp

] PARAMETERS /// STRUCTURE DEFINITIONS ///

Enumerator
MIO_PHASE_UNKNOWN 
MIO_PHASE_INV 
MIO_PHASE_NONINV 

Definition at line 40 of file mio.h.

Mio_PinPhase_t
INCLUDES ///.
Definition mio.h:40
@ MIO_PHASE_INV
Definition mio.h:40
@ MIO_PHASE_NONINV
Definition mio.h:40
@ MIO_PHASE_UNKNOWN
Definition mio.h:40

Function Documentation

◆ Abc_SclDeriveGenlib()

Mio_Library_t * Abc_SclDeriveGenlib ( void * pScl,
void * pMio,
float Slew,
float Gain,
int nGatesMin,
int fVerbose )
extern

Definition at line 1078 of file sclLibUtil.c.

1079{
1080 int nCellCount = 0;
1081 SC_Lib * p = (SC_Lib *)pScl;
1082 float Slew = (SlewInit == 0) ? Abc_SclComputeAverageSlew(p) : SlewInit;
1083 Vec_Str_t * vStr;
1084 Mio_Library_t * pLib;
1085 if ( pMio == NULL )
1086 vStr = Abc_SclProduceGenlibStr( p, Slew, Gain, nGatesMin, 0, &nCellCount );
1087 else
1088 vStr = Abc_SclProduceGenlibStrProfile( p, (Mio_Library_t *)pMio, Slew, Gain, nGatesMin, &nCellCount );
1089 pLib = Mio_LibraryRead( p->pFileName, Vec_StrArray(vStr), NULL, 0, 0 );
1090 Vec_StrFree( vStr );
1091 if ( !pLib )
1092 printf( "Reading library has filed.\n" );
1093 else if ( fVerbose )
1094 printf( "Derived GENLIB library \"%s\" with %d gates using slew %.2f ps and gain %.2f.\n", p->pName, nCellCount, Slew, Gain );
1095 return pLib;
1096}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
Cube * p
Definition exorList.c:222
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
Mio_Library_t * Mio_LibraryRead(char *FileName, char *pBuffer, char *ExcludeFile, int nFaninLimit, int fVerbose)
Definition mioRead.c:54
Vec_Str_t * Abc_SclProduceGenlibStr(SC_Lib *p, float Slew, float Gain, int nGatesMin, int fUseAll, int *pnCellCount)
Definition sclLibUtil.c:870
float Abc_SclComputeAverageSlew(SC_Lib *p)
Definition sclLibUtil.c:452
Vec_Str_t * Abc_SclProduceGenlibStrProfile(SC_Lib *p, Mio_Library_t *pLib, float Slew, float Gain, int nGatesMin, int *pnCellCount)
Definition sclLibUtil.c:987
struct SC_Lib_ SC_Lib
Definition sclLib.h:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclDeriveGenlibSimple()

Mio_Library_t * Abc_SclDeriveGenlibSimple ( void * pScl)
extern

Definition at line 845 of file sclLibUtil.c.

846{
847 SC_Lib * p = (SC_Lib *)pScl;
849 Mio_Library_t * pLib = Mio_LibraryRead( p->pFileName, Vec_StrArray(vStr), NULL, 0, 0 );
850 Vec_StrFree( vStr );
851 if ( pLib )
852 printf( "Derived GENLIB library \"%s\" with %d gates.\n", p->pName, SC_LibCellNum(p) );
853 else
854 printf( "Reading library has filed.\n" );
855 return pLib;
856}
Vec_Str_t * Abc_SclProduceGenlibStrSimple(SC_Lib *p)
Definition sclLibUtil.c:798
Here is the call graph for this function:

◆ Mio_CollectRoots()

Mio_Gate_t ** Mio_CollectRoots ( Mio_Library_t * pLib,
int nInputs,
float tDelay,
int fSkipInv,
int * pnGates,
int fVerbose )
extern

Definition at line 515 of file mioUtils.c.

516{
517 Mio_Gate_t * pGate;
518 Mio_Gate_t ** ppGates;
519 int i, nGates, iGate, fProfile;
520 nGates = Mio_LibraryReadGateNum( pLib );
521 ppGates = ABC_ALLOC( Mio_Gate_t *, nGates );
522 iGate = 0;
523 // check if profile is entered
524 fProfile = Mio_LibraryHasProfile( pLib );
525 if ( fProfile )
526 printf( "Mio_CollectRoots(): Using gate profile to select gates for mapping.\n" );
527 // for each functionality, select gate with the smallest area
528 // if equal areas, select gate with lexicographically smaller name
529 Mio_LibraryForEachGate( pLib, pGate )
530 {
531 if ( pGate->nInputs > nInputs )
532 continue;
533 if ( fProfile && Mio_GateReadProfile(pGate) == 0 && pGate->nInputs > 1 )
534 continue;
535 if ( tDelay > 0.0 && pGate->dDelayMax > (double)tDelay )
536 continue;
537 if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 )
538 continue;
539 if ( pGate->uTruth == ABC_CONST(0xAAAAAAAAAAAAAAAA) )
540 continue;
541 if ( pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA) && fSkipInv )
542 continue;
543 if ( pGate->pTwin ) // skip multi-output gates for now
544 continue;
545 // check if the gate with this functionality already exists
546 for ( i = 0; i < iGate; i++ )
547 if ( ppGates[i]->uTruth == pGate->uTruth )
548 {
549 if ( Mio_CompareTwoGates(ppGates[i], pGate) )
550 ppGates[i] = pGate;
551 break;
552 }
553 if ( i < iGate )
554 continue;
555 assert( iGate < nGates );
556 ppGates[ iGate++ ] = pGate;
557 if ( fVerbose )
558 printf( "Selected gate %3d: %-20s A = %7.2f D = %7.2f %3s = %-s\n",
559 iGate+1, pGate->pName, pGate->dArea, pGate->dDelayMax, pGate->pOutName, pGate->pForm );
560 }
561 // sort by delay
562 if ( iGate > 0 )
563 {
564 qsort( (void *)ppGates, (size_t)iGate, sizeof(Mio_Gate_t *),
565 (int (*)(const void *, const void *)) Mio_DelayCompare );
566 assert( Mio_DelayCompare( ppGates, ppGates + iGate - 1 ) <= 0 );
567 }
568 if ( pnGates )
569 *pnGates = iGate;
570 return ppGates;
571}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
int Mio_LibraryHasProfile(Mio_Library_t *pLib)
Definition mioUtils.c:1555
int Mio_DelayCompare(Mio_Gate_t **ppG1, Mio_Gate_t **ppG2)
Definition mioUtils.c:399
int Mio_GateReadProfile(Mio_Gate_t *pGate)
Definition mioApi.c:185
#define Mio_LibraryForEachGate(Lib, Gate)
GLOBAL VARIABLES ///.
Definition mio.h:81
int Mio_LibraryReadGateNum(Mio_Library_t *pLib)
Definition mioApi.c:45
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
char * pOutName
Definition mioInt.h:103
double dDelayMax
Definition mioInt.h:115
Mio_Gate_t * pTwin
Definition mioInt.h:108
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_CollectRootsNew()

Mio_Cell_t * Mio_CollectRootsNew ( Mio_Library_t * pLib,
int nInputs,
int * pnGates,
int fVerbose )
extern

Definition at line 623 of file mioUtils.c.

624{
625 Mio_Gate_t * pGate;
626 Mio_Cell_t * ppCells;
627 int i, nGates, iCell = 4;
628 nGates = Mio_LibraryReadGateNum( pLib );
629 ppCells = ABC_CALLOC( Mio_Cell_t, nGates + 4 );
630 // for each functionality, select gate with the smallest area
631 // if equal areas, select gate with smaller average pin delay
632 // if these are also equal, select lexicographically smaller name
633 Mio_LibraryForEachGate( pLib, pGate )
634 {
635 if ( pGate->nInputs > nInputs || pGate->pTwin ) // skip large and multi-output
636 continue;
637 // check if the gate with this functionality already exists
638 for ( i = 0; i < iCell; i++ )
639 if ( ppCells[i].pName && ppCells[i].uTruth == pGate->uTruth )
640 {
641 if ( Mio_CompareTwo( ppCells + i, pGate ) )
642 Mio_CollectCopy( ppCells + i, pGate );
643 break;
644 }
645 if ( i < iCell )
646 continue;
647 if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 )
648 {
649 int Idx = (int)(pGate->uTruth == ~(word)0);
650 assert( pGate->nInputs == 0 );
651 Mio_CollectCopy( ppCells + Idx, pGate );
652 continue;
653 }
654 if ( pGate->uTruth == ABC_CONST(0xAAAAAAAAAAAAAAAA) || pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA) )
655 {
656 int Idx = 2 + (int)(pGate->uTruth == ~ABC_CONST(0xAAAAAAAAAAAAAAAA));
657 assert( pGate->nInputs == 1 );
658 Mio_CollectCopy( ppCells + Idx, pGate );
659 continue;
660 }
661 Mio_CollectCopy( ppCells + iCell++, pGate );
662 }
663 if ( ppCells[0].pName == NULL )
664 { printf( "Error: Cannot find constant 0 gate in the library.\n" ); return NULL; }
665 if ( ppCells[1].pName == NULL )
666 { printf( "Error: Cannot find constant 1 gate in the library.\n" ); return NULL; }
667 if ( ppCells[2].pName == NULL )
668 { printf( "Error: Cannot find buffer gate in the library.\n" ); return NULL; }
669 if ( ppCells[3].pName == NULL )
670 { printf( "Error: Cannot find inverter gate in the library.\n" ); return NULL; }
671 // sort by delay
672 if ( iCell > 5 )
673 {
674 qsort( (void *)(ppCells + 4), (size_t)(iCell - 4), sizeof(Mio_Cell_t),
675 (int (*)(const void *, const void *)) Mio_AreaCompare );
676 assert( Mio_AreaCompare( ppCells + 4, ppCells + iCell - 1 ) <= 0 );
677 }
678 // assign IDs
679 for ( i = 0; i < iCell; i++ )
680 ppCells[i].Id = ppCells[i].pName ? i : -1;
681
682 // report
683 if ( fVerbose )
684 {
685 // count gates
686 int * pCounts = ABC_CALLOC( int, nGates + 4 );
687 Mio_LibraryForEachGate( pLib, pGate )
688 {
689 if ( pGate->nInputs > nInputs || pGate->pTwin ) // skip large and multi-output
690 continue;
691 for ( i = 0; i < iCell; i++ )
692 if ( ppCells[i].pName && ppCells[i].uTruth == pGate->uTruth )
693 {
694 pCounts[i]++;
695 break;
696 }
697 assert( i < iCell );
698 }
699 for ( i = 0; i < iCell; i++ )
700 {
701 Mio_Cell_t * pCell = ppCells + i;
702 printf( "%4d : ", i );
703 if ( pCell->pName == NULL )
704 printf( "None\n" );
705 else
706 printf( "%-20s In = %d N = %3d A = %12.6f D = %12.6f\n",
707 pCell->pName, pCell->nFanins, pCounts[i], pCell->Area, Mio_CellDelayAve(pCell) );
708 }
709 ABC_FREE( pCounts );
710 }
711 if ( pnGates )
712 *pnGates = iCell;
713 return ppCells;
714}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
int Mio_AreaCompare(Mio_Cell_t *pG1, Mio_Cell_t *pG2)
Definition mioUtils.c:416
struct Mio_Cell_t_ Mio_Cell_t
Definition mio.h:46
unsigned nFanins
Definition mio.h:51
float Area
Definition mio.h:52
char * pName
Definition mio.h:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_CollectRootsNewDefault()

Mio_Cell_t * Mio_CollectRootsNewDefault ( int nInputs,
int * pnGates,
int fVerbose )
extern

Definition at line 715 of file mioUtils.c.

716{
717 return Mio_CollectRootsNew( (Mio_Library_t *)Abc_FrameReadLibGen(), nInputs, pnGates, fVerbose );
718}
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
Mio_Cell_t * Mio_CollectRootsNew(Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:623
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_CollectRootsNewDefault2()

Mio_Cell2_t * Mio_CollectRootsNewDefault2 ( int nInputs,
int * pnGates,
int fVerbose )
extern

Definition at line 877 of file mioUtils.c.

878{
879 return Mio_CollectRootsNew2( (Mio_Library_t *)Abc_FrameReadLibGen(), nInputs, pnGates, fVerbose );
880}
Mio_Cell2_t * Mio_CollectRootsNew2(Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:774
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_CollectRootsNewDefault3()

int Mio_CollectRootsNewDefault3 ( int nInputs,
Vec_Ptr_t ** pvNames,
Vec_Wrd_t ** pvTruths )
extern

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

Synopsis [Derives the truth table of the gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 893 of file mioUtils.c.

894{
896 int i, iGate = 0, nGates = pLib ? Mio_LibraryReadGateNum( pLib ) : 0;
897 Mio_Gate_t * pGate0, ** ppGates; word * pTruth;
898 if ( pLib == NULL )
899 return 0;
900 ppGates = ABC_CALLOC( Mio_Gate_t *, nGates );
901 Mio_LibraryForEachGate( pLib, pGate0 )
902 ppGates[pGate0->Cell] = pGate0;
903 *pvNames = Vec_PtrAlloc( nGates );
904 *pvTruths = Vec_WrdStart( nGates * 4 );
905 for ( i = 0; i < nGates; i++ )
906 {
907 pGate0 = ppGates[i];
908 if ( pGate0->nInputs > nInputs || pGate0->pTwin ) // skip large and multi-output
909 continue;
910 Vec_PtrPush( *pvNames, pGate0->pName );
911 pTruth = Vec_WrdEntryP( *pvTruths, iGate++*4 );
912 if ( pGate0->nInputs <= 6 )
913 pTruth[0] = pTruth[1] = pTruth[2] = pTruth[3] = pGate0->uTruth;
914 else if ( pGate0->nInputs == 7 )
915 {
916 pTruth[0] = pTruth[2] = pGate0->pTruth[0];
917 pTruth[1] = pTruth[3] = pGate0->pTruth[1];
918 }
919 else if ( pGate0->nInputs == 8 )
920 memcpy( pTruth, pGate0->pTruth, (size_t)(4*sizeof(word)) );
921 }
922 assert( iGate == nGates );
923 assert( Vec_WrdEntry(*pvTruths, 0) == 0 );
924 assert( Vec_WrdEntry(*pvTruths, 4) == ~(word)0 );
925 assert( Vec_WrdEntry(*pvTruths, 8) == s_Truths6[0] );
926 assert( Vec_WrdEntry(*pvTruths, 12) == ~s_Truths6[0] );
927 ABC_FREE( ppGates );
928 return nGates;
929}
char * memcpy()
Here is the call graph for this function:

◆ Mio_DeriveGateDelays()

void Mio_DeriveGateDelays ( Mio_Gate_t * pGate,
float ** ptPinDelays,
int nPins,
int nInputs,
float tDelayZero,
float * ptDelaysRes,
float * ptPinDelayMax )
extern

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 1153 of file mioUtils.c.

1156{
1157 Mio_Pin_t * pPin;
1158 float Delay, DelayMax;
1159 int i, k;
1160 assert( pGate->nInputs == nPins );
1161 // set all the delays to the unused delay
1162 for ( i = 0; i < nInputs; i++ )
1163 ptDelaysRes[i] = tDelayZero;
1164 // compute the delays for each input and the max delay at the same time
1165 DelayMax = 0;
1166 for ( i = 0; i < nInputs; i++ )
1167 {
1168 for ( k = 0, pPin = pGate->pPins; pPin; pPin = pPin->pNext, k++ )
1169 {
1170 if ( ptPinDelays[k][i] < 0 )
1171 continue;
1172 Delay = ptPinDelays[k][i] + (float)pPin->dDelayBlockMax;
1173 if ( ptDelaysRes[i] < Delay )
1174 ptDelaysRes[i] = Delay;
1175 }
1176 if ( k != nPins )
1177 {
1178 printf ("DEBUG: problem gate is %s\n", Mio_GateReadName( pGate ));
1179 }
1180 assert( k == nPins );
1181 if ( DelayMax < ptDelaysRes[i] )
1182 DelayMax = ptDelaysRes[i];
1183 }
1184 *ptPinDelayMax = DelayMax;
1185}
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
struct Mio_PinStruct_t_ Mio_Pin_t
Definition mio.h:44
Mio_Pin_t * pPins
Definition mioInt.h:102
double dDelayBlockMax
Definition mioInt.h:133
Mio_Pin_t * pNext
Definition mioInt.h:134
Here is the call graph for this function:

◆ Mio_DeriveTruthTable()

void Mio_DeriveTruthTable ( Mio_Gate_t * pGate,
unsigned uTruthsIn[][2],
int nSigns,
int nInputs,
unsigned uTruthRes[] )
extern

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

Synopsis [Derives the truth table of the gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 1036 of file mioUtils.c.

1037{
1038 word uRes, uFanins[6];
1039 int i;
1040 assert( pGate->nInputs == nSigns );
1041 for ( i = 0; i < nSigns; i++ )
1042 uFanins[i] = (((word)uTruthsIn[i][1]) << 32) | (word)uTruthsIn[i][0];
1043 uRes = Exp_Truth6( nSigns, pGate->vExpr, (word *)uFanins );
1044 uTruthRes[0] = uRes & 0xFFFFFFFF;
1045 uTruthRes[1] = uRes >> 32;
1046}
Vec_Int_t * vExpr
Definition mioInt.h:117
Here is the caller graph for this function:

◆ Mio_DeriveTruthTable6()

word Mio_DeriveTruthTable6 ( Mio_Gate_t * pGate)
extern

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

Synopsis [Derives the truth table of the gate.]

Description []

SideEffects []

SeeAlso []

Definition at line 942 of file mioUtils.c.

943{
944 static unsigned uTruths6[6][2] = {
945 { 0xAAAAAAAA, 0xAAAAAAAA },
946 { 0xCCCCCCCC, 0xCCCCCCCC },
947 { 0xF0F0F0F0, 0xF0F0F0F0 },
948 { 0xFF00FF00, 0xFF00FF00 },
949 { 0xFFFF0000, 0xFFFF0000 },
950 { 0x00000000, 0xFFFFFFFF }
951 };
952 union {
953 unsigned u[2];
954 word w;
955 } uTruthRes;
956 assert( pGate->nInputs <= 6 );
957 Mio_DeriveTruthTable( pGate, uTruths6, pGate->nInputs, 6, uTruthRes.u );
958 return uTruthRes.w;
959}
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
Definition mioUtils.c:1036
Here is the call graph for this function:

◆ Mio_GateAddToProfile()

void Mio_GateAddToProfile ( Mio_Gate_t * pGate,
int Prof )
extern

Definition at line 193 of file mioApi.c.

193{ pGate->Profile += Prof; }
Here is the caller graph for this function:

◆ Mio_GateAddToProfile2()

void Mio_GateAddToProfile2 ( Mio_Gate_t * pGate,
int Prof )
extern

Definition at line 194 of file mioApi.c.

194{ pGate->Profile2 += Prof; }
Here is the caller graph for this function:

◆ Mio_GateCreatePseudo()

Mio_Gate_t * Mio_GateCreatePseudo ( int nInputs)
extern

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 1199 of file mioUtils.c.

1200{
1201 Mio_Gate_t * pGate;
1202 Mio_Pin_t * pPin;
1203 int i;
1204 // allocate the gate structure
1205 pGate = ABC_ALLOC( Mio_Gate_t, 1 );
1206 memset( pGate, 0, sizeof(Mio_Gate_t) );
1207 pGate->nInputs = nInputs;
1208 // create pins
1209 for ( i = 0; i < nInputs; i++ )
1210 {
1211 pPin = ABC_ALLOC( Mio_Pin_t, 1 );
1212 memset( pPin, 0, sizeof(Mio_Pin_t) );
1213 pPin->pNext = pGate->pPins;
1214 pGate->pPins = pPin;
1215 }
1216 return pGate;
1217}
char * memset()
Here is the call graph for this function:

◆ Mio_GateDecProfile2()

void Mio_GateDecProfile2 ( Mio_Gate_t * pGate)
extern

Definition at line 192 of file mioApi.c.

192{ pGate->Profile2--; }
Here is the caller graph for this function:

◆ Mio_GateDelete()

void Mio_GateDelete ( Mio_Gate_t * pGate)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file mioUtils.c.

88{
89 Mio_Pin_t * pPin, * pPin2;
90 if ( pGate->nInputs > 6 )
91 ABC_FREE( pGate->pTruth );
92 Vec_IntFreeP( &pGate->vExpr );
93 ABC_FREE( pGate->pOutName );
94 ABC_FREE( pGate->pName );
95 ABC_FREE( pGate->pForm );
96// if ( pGate->bFunc )
97// Cudd_RecursiveDeref( pGate->pLib->dd, pGate->bFunc );
98 Mio_GateForEachPinSafe( pGate, pPin, pPin2 )
99 Mio_PinDelete( pPin );
100 ABC_FREE( pGate );
101}
void Mio_PinDelete(Mio_Pin_t *pPin)
Definition mioUtils.c:114
#define Mio_GateForEachPinSafe(Gate, Pin, Pin2)
Definition mio.h:96
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_GateIncProfile2()

void Mio_GateIncProfile2 ( Mio_Gate_t * pGate)
extern

Definition at line 191 of file mioApi.c.

191{ pGate->Profile2++; }
Here is the caller graph for this function:

◆ Mio_GateIsInv()

int Mio_GateIsInv ( Mio_Gate_t * pGate)
extern

Definition at line 195 of file mioApi.c.

195{ return pGate->uTruth == ABC_CONST(0x5555555555555555); }
Here is the caller graph for this function:

◆ Mio_GateReadArea()

double Mio_GateReadArea ( Mio_Gate_t * pGate)
extern

Definition at line 171 of file mioApi.c.

171{ return pGate->dArea; }
Here is the caller graph for this function:

◆ Mio_GateReadCell()

int Mio_GateReadCell ( Mio_Gate_t * pGate)
extern

Definition at line 184 of file mioApi.c.

184{ return pGate->Cell; }
Here is the caller graph for this function:

◆ Mio_GateReadDelayMax()

double Mio_GateReadDelayMax ( Mio_Gate_t * pGate)
extern

Definition at line 178 of file mioApi.c.

178{ return pGate->dDelayMax; }
Here is the caller graph for this function:

◆ Mio_GateReadExpr()

Vec_Int_t * Mio_GateReadExpr ( Mio_Gate_t * pGate)
extern

Definition at line 180 of file mioApi.c.

180{ return pGate->vExpr; }
Here is the caller graph for this function:

◆ Mio_GateReadForm()

char * Mio_GateReadForm ( Mio_Gate_t * pGate)
extern

Definition at line 172 of file mioApi.c.

172{ return pGate->pForm; }
Here is the caller graph for this function:

◆ Mio_GateReadLib()

Mio_Library_t * Mio_GateReadLib ( Mio_Gate_t * pGate)
extern

Definition at line 174 of file mioApi.c.

174{ return pGate->pLib; }
Mio_Library_t * pLib
Definition mioInt.h:105

◆ Mio_GateReadName()

char * Mio_GateReadName ( Mio_Gate_t * pGate)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file mioApi.c.

169{ return pGate->pName; }
Here is the caller graph for this function:

◆ Mio_GateReadNext()

Mio_Gate_t * Mio_GateReadNext ( Mio_Gate_t * pGate)
extern

Definition at line 175 of file mioApi.c.

175{ return pGate->pNext; }
Mio_Gate_t * pNext
Definition mioInt.h:107

◆ Mio_GateReadOutName()

char * Mio_GateReadOutName ( Mio_Gate_t * pGate)
extern

Definition at line 170 of file mioApi.c.

170{ return pGate->pOutName; }
Here is the caller graph for this function:

◆ Mio_GateReadPinDelay()

float Mio_GateReadPinDelay ( Mio_Gate_t * pGate,
int iPin )
extern

Definition at line 239 of file mioApi.c.

240{
241 Mio_Pin_t * pPin;
242 int i = 0;
243 Mio_GateForEachPin( pGate, pPin )
244 if ( i++ == iPin )
245 return 0.5 * pPin->dDelayBlockRise + 0.5 * pPin->dDelayBlockFall;
246 return ABC_INFINITY;
247}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define Mio_GateForEachPin(Gate, Pin)
Definition mio.h:92
double dDelayBlockFall
Definition mioInt.h:131
double dDelayBlockRise
Definition mioInt.h:129
Here is the caller graph for this function:

◆ Mio_GateReadPinName()

char * Mio_GateReadPinName ( Mio_Gate_t * pGate,
int iPin )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file mioApi.c.

231{
232 Mio_Pin_t * pPin;
233 int i = 0;
234 Mio_GateForEachPin( pGate, pPin )
235 if ( i++ == iPin )
236 return Mio_PinReadName(pPin);
237 return NULL;
238}
char * Mio_PinReadName(Mio_Pin_t *pPin)
Definition mioApi.c:208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_GateReadPinNum()

int Mio_GateReadPinNum ( Mio_Gate_t * pGate)
extern

Definition at line 177 of file mioApi.c.

177{ return pGate->nInputs; }
Here is the caller graph for this function:

◆ Mio_GateReadPins()

Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate)
extern

Definition at line 173 of file mioApi.c.

173{ return pGate->pPins; }
Here is the caller graph for this function:

◆ Mio_GateReadProfile()

int Mio_GateReadProfile ( Mio_Gate_t * pGate)
extern

Definition at line 185 of file mioApi.c.

185{ return pGate->Profile; }
Here is the caller graph for this function:

◆ Mio_GateReadProfile2()

int Mio_GateReadProfile2 ( Mio_Gate_t * pGate)
extern

Definition at line 186 of file mioApi.c.

186{ return pGate->Profile2; }
Here is the caller graph for this function:

◆ Mio_GateReadSop()

char * Mio_GateReadSop ( Mio_Gate_t * pGate)
extern

Definition at line 179 of file mioApi.c.

179{ return pGate->pSop; }
Here is the caller graph for this function:

◆ Mio_GateReadTruth()

word Mio_GateReadTruth ( Mio_Gate_t * pGate)
extern

Definition at line 181 of file mioApi.c.

181{ return pGate->nInputs <= 6 ? pGate->uTruth : 0; }
Here is the caller graph for this function:

◆ Mio_GateReadTruthP()

word * Mio_GateReadTruthP ( Mio_Gate_t * pGate)
extern

Definition at line 182 of file mioApi.c.

182{ return pGate->nInputs <= 6 ? &pGate->uTruth: pGate->pTruth; }
Here is the caller graph for this function:

◆ Mio_GateReadTwin()

Mio_Gate_t * Mio_GateReadTwin ( Mio_Gate_t * pGate)
extern

Definition at line 176 of file mioApi.c.

176{ return pGate->pTwin; }
Here is the caller graph for this function:

◆ Mio_GateReadValue()

int Mio_GateReadValue ( Mio_Gate_t * pGate)
extern

Definition at line 183 of file mioApi.c.

183{ return pGate->Value; }
Here is the caller graph for this function:

◆ Mio_GateSetCell()

void Mio_GateSetCell ( Mio_Gate_t * pGate,
int Cell )
extern

Definition at line 188 of file mioApi.c.

188{ pGate->Cell = Cell; }
Here is the caller graph for this function:

◆ Mio_GateSetProfile()

void Mio_GateSetProfile ( Mio_Gate_t * pGate,
int Prof )
extern

Definition at line 189 of file mioApi.c.

189{ pGate->Profile = Prof; }
Here is the caller graph for this function:

◆ Mio_GateSetProfile2()

void Mio_GateSetProfile2 ( Mio_Gate_t * pGate,
int Prof )
extern

Definition at line 190 of file mioApi.c.

190{ pGate->Profile2 = Prof; }
Here is the caller graph for this function:

◆ Mio_GateSetValue()

void Mio_GateSetValue ( Mio_Gate_t * pGate,
int Value )
extern

Definition at line 187 of file mioApi.c.

187{ pGate->Value = Value; }
Here is the caller graph for this function:

◆ Mio_LibDeriveSop()

char * Mio_LibDeriveSop ( int nVars,
Vec_Int_t * vExpr,
Vec_Str_t * vStr )
extern

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

Synopsis [Derives SOP representation.]

Description [The SOP is guaranteed to be SCC-free but not minimal.]

SideEffects []

SeeAlso []

Definition at line 257 of file mioSop.c.

258{
259 Vec_Int_t * vSop;
260 Vec_Ptr_t * vSops0, * vSops1, * vTemp;
261 int i, Index0, Index1, fCompl0, fCompl1;
262 Vec_StrClear( vStr );
263 if ( Exp_IsConst0(vExpr) )
264 {
265 Vec_StrPrintStr( vStr, " 0\n" );
266 Vec_StrPush( vStr, '\0' );
267 return Vec_StrArray( vStr );
268 }
269 if ( Exp_IsConst1(vExpr) )
270 {
271 Vec_StrPrintStr( vStr, " 1\n" );
272 Vec_StrPush( vStr, '\0' );
273 return Vec_StrArray( vStr );
274 }
275 if ( Exp_IsLit(vExpr) )
276 {
277 for ( i = 0; i < nVars; i++ )
278 Vec_StrPush( vStr, '-' );
279 Vec_StrPrintStr( vStr, " 1\n" );
280 Vec_StrPush( vStr, '\0' );
281 assert( (Vec_IntEntry(vExpr,0) >> 1) < nVars );
282 Vec_StrWriteEntry( vStr, Vec_IntEntry(vExpr,0) >> 1, (char)('1' - (Vec_IntEntry(vExpr,0) & 1)) );
283 return Vec_StrArray( vStr );
284 }
285 vSops0 = Vec_PtrAlloc( nVars + Exp_NodeNum(vExpr) );
286 vSops1 = Vec_PtrAlloc( nVars + Exp_NodeNum(vExpr) );
287 for ( i = 0; i < nVars; i++ )
288 {
289 Vec_PtrPush( vSops0, Mio_SopVar0(i) );
290 Vec_PtrPush( vSops1, Mio_SopVar1(i) );
291 }
292 for ( i = 0; i < Exp_NodeNum(vExpr); i++ )
293 {
294 Index0 = Vec_IntEntry( vExpr, 2*i+0 ) >> 1;
295 Index1 = Vec_IntEntry( vExpr, 2*i+1 ) >> 1;
296 fCompl0 = Vec_IntEntry( vExpr, 2*i+0 ) & 1;
297 fCompl1 = Vec_IntEntry( vExpr, 2*i+1 ) & 1;
298 // positive polarity
299 vSop = Mio_SopCoverAnd( fCompl0 ? (Vec_Int_t *)Vec_PtrEntry(vSops0, Index0) : (Vec_Int_t *)Vec_PtrEntry(vSops1, Index0),
300 fCompl1 ? (Vec_Int_t *)Vec_PtrEntry(vSops0, Index1) : (Vec_Int_t *)Vec_PtrEntry(vSops1, Index1) );
301 Vec_PtrPush( vSops1, vSop );
302 // negative polarity
303 vSop = Mio_SopCoverOr( fCompl0 ? (Vec_Int_t *)Vec_PtrEntry(vSops1, Index0) : (Vec_Int_t *)Vec_PtrEntry(vSops0, Index0),
304 fCompl1 ? (Vec_Int_t *)Vec_PtrEntry(vSops1, Index1) : (Vec_Int_t *)Vec_PtrEntry(vSops0, Index1) );
305 Vec_PtrPush( vSops0, vSop );
306 }
307 // complement
308 if ( Vec_IntEntryLast(vExpr) & 1 )
309 {
310 vTemp = vSops0;
311 vSops0 = vSops1;
312 vSops1 = vTemp;
313 }
314 // select the best polarity
315 if ( Vec_IntSize( (Vec_Int_t *)Vec_PtrEntryLast(vSops0) ) < Vec_IntSize( (Vec_Int_t *)Vec_PtrEntryLast(vSops1) ) )
316 vSop = (Vec_Int_t *)Vec_PtrEntryLast(vSops0);
317 else
318 vSop = (Vec_Int_t *)Vec_PtrEntryLast(vSops1);
319 // convert positive polarity into SOP
320 Mio_SopDeriveFromArray( vSop, nVars, vStr, (vSop == Vec_PtrEntryLast(vSops1)) );
321 Vec_VecFree( (Vec_Vec_t *)vSops0 );
322 Vec_VecFree( (Vec_Vec_t *)vSops1 );
323 return Vec_StrArray( vStr );
324}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Vec_Int_t * Mio_SopVar0(int i)
Definition mioSop.c:130
Vec_Int_t * Mio_SopVar1(int i)
Definition mioSop.c:149
char * Mio_SopDeriveFromArray(Vec_Int_t *vSop, int nVars, Vec_Str_t *vStr, int fPolarity)
Definition mioSop.c:205
Vec_Int_t * Mio_SopCoverOr(Vec_Int_t *p, Vec_Int_t *q)
Definition mioSop.c:82
Vec_Int_t * Mio_SopCoverAnd(Vec_Int_t *p, Vec_Int_t *q)
Definition mioSop.c:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryCleanProfile2()

void Mio_LibraryCleanProfile2 ( Mio_Library_t * pLib)
extern

Definition at line 1616 of file mioUtils.c.

1617{
1618 Mio_Gate_t * pGate;
1619 Mio_LibraryForEachGate( pLib, pGate )
1620 Mio_GateSetProfile2( pGate, 0 );
1621}
void Mio_GateSetProfile2(Mio_Gate_t *pGate, int Prof)
Definition mioApi.c:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryDelete()

void Mio_LibraryDelete ( Mio_Library_t * pLib)
extern

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 51 of file mioUtils.c.

52{
53 Mio_Gate_t * pGate, * pGate2;
54 if ( pLib == NULL )
55 return;
58 // free the bindings of nodes to gates from this library for all networks
60 // free the library
61 ABC_FREE( pLib->pName );
62 Mio_LibraryForEachGateSafe( pLib, pGate, pGate2 )
63 Mio_GateDelete( pGate );
64 Mem_FlexStop( pLib->pMmFlex, 0 );
65 Vec_StrFree( pLib->vCube );
66 if ( pLib->tName2Gate )
68// if ( pLib->dd )
69// Cudd_Quit( pLib->dd );
70 ABC_FREE( pLib->ppGates0 );
71 ABC_FREE( pLib->ppGatesName );
72 ABC_FREE( pLib->pFileName );
73 ABC_FREE( pLib );
74}
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL void Abc_FrameUnmapAllNetworks(Abc_Frame_t *p)
Definition mainFrame.c:577
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
void Mio_LibraryMatchesStop(Mio_Library_t *pLib)
Definition mioUtils.c:1759
void Mio_LibraryMatches2Stop(Mio_Library_t *pLib)
Definition mioUtils.c:1805
void Mio_GateDelete(Mio_Gate_t *pGate)
Definition mioUtils.c:87
#define Mio_LibraryForEachGateSafe(Lib, Gate, Gate2)
Definition mio.h:85
void st__free_table(st__table *table)
Definition st.c:81
Mio_Gate_t ** ppGates0
Definition mioInt.h:66
Mio_Gate_t ** ppGatesName
Definition mioInt.h:67
st__table * tName2Gate
Definition mioInt.h:77
Vec_Str_t * vCube
Definition mioInt.h:79
Mem_Flex_t * pMmFlex
Definition mioInt.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryHasProfile()

int Mio_LibraryHasProfile ( Mio_Library_t * pLib)
extern

Definition at line 1555 of file mioUtils.c.

1556{
1557 Mio_Gate_t * pGate;
1558 Mio_LibraryForEachGate( pLib, pGate )
1559 if ( Mio_GateReadProfile(pGate) > 0 )
1560 return 1;
1561 return 0;
1562}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryMatches2Fetch()

void Mio_LibraryMatches2Fetch ( Mio_Library_t * pLib,
Vec_Ptr_t ** pvNames,
Vec_Wrd_t ** pvTruths,
Vec_Int_t ** pvTt2Match4,
Vec_Int_t ** pvConfigs,
Vec_Mem_t * pvTtMem2[3],
Vec_Int_t * pvTt2Match2[3] )
extern

Definition at line 1830 of file mioUtils.c.

1831{
1832 int i;
1834 *pvNames = pLib->vNames;
1835 *pvTruths = pLib->vTruths;
1836 *pvTt2Match4 = pLib->vTt2Match4;
1837 *pvConfigs = pLib->vConfigs;
1838 for ( i = 0; i < 3; i++ )
1839 {
1840 pvTtMem2[i] = pLib->vTtMem2[i];
1841 pvTt2Match2[i] = pLib->vTt2Match2[i];
1842 }
1843}
void Mio_LibraryMatches2Start(Mio_Library_t *pLib)
Definition mioUtils.c:1821
Vec_Mem_t * vTtMem2[3]
Definition mioInt.h:92
Vec_Int_t * vConfigs
Definition mioInt.h:91
Vec_Int_t * vTt2Match4
Definition mioInt.h:90
Vec_Wrd_t * vTruths
Definition mioInt.h:89
Vec_Int_t * vTt2Match2[3]
Definition mioInt.h:93
Vec_Ptr_t * vNames
Definition mioInt.h:88
Here is the call graph for this function:

◆ Mio_LibraryMatches2Start()

void Mio_LibraryMatches2Start ( Mio_Library_t * pLib)
extern

Definition at line 1821 of file mioUtils.c.

1822{
1823 extern int Gia_ManDeriveMatches( Vec_Ptr_t ** pvNames, Vec_Wrd_t ** pvTruths, Vec_Int_t ** pvTt2Match4, Vec_Int_t ** pvConfigs, Vec_Mem_t * pvTtMem2[3], Vec_Int_t * pvTt2Match2[3] );
1824 if ( pLib->vNames )
1825 return;
1826 if ( pLib->vTtMem )
1828 Gia_ManDeriveMatches( &pLib->vNames, &pLib->vTruths, &pLib->vTt2Match4, &pLib->vConfigs, pLib->vTtMem2, pLib->vTt2Match2 );
1829}
ABC_NAMESPACE_IMPL_START int Gia_ManDeriveMatches(Vec_Ptr_t **pvNames, Vec_Wrd_t **pvTruths, Vec_Int_t **pvTt2Match4, Vec_Int_t **pvConfigs, Vec_Mem_t *pvTtMem2[3], Vec_Int_t *pvTt2Match2[3])
DECLARATIONS ///.
Definition giaIiff.c:47
Vec_Mem_t * vTtMem
Definition mioInt.h:84
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Definition utilMem.c:35
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryMatches2Stop()

void Mio_LibraryMatches2Stop ( Mio_Library_t * pLib)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1805 of file mioUtils.c.

1806{
1807 int i;
1808 if ( !pLib->vNames )
1809 return;
1810 Vec_PtrFree( pLib->vNames );
1811 Vec_WrdFree( pLib->vTruths );
1812 Vec_IntFree( pLib->vTt2Match4 );
1813 Vec_IntFree( pLib->vConfigs );
1814 for ( i = 0; i < 3; i++ )
1815 {
1816 Vec_MemHashFree( pLib->vTtMem2[i] );
1817 Vec_MemFree( pLib->vTtMem2[i] );
1818 Vec_IntFree( pLib->vTt2Match2[i] );
1819 }
1820}
Here is the caller graph for this function:

◆ Mio_LibraryMatchesFetch()

void Mio_LibraryMatchesFetch ( Mio_Library_t * pLib,
Vec_Mem_t ** pvTtMem,
Vec_Wec_t ** pvTt2Match,
Mio_Cell2_t ** ppCells,
int * pnCells,
int fPinFilter,
int fPinPerm,
int fPinQuick )
extern

Definition at line 1785 of file mioUtils.c.

1786{
1787 Mio_LibraryMatchesStart( pLib, fPinFilter, fPinPerm, fPinQuick );
1788 *pvTtMem = pLib->vTtMem; // truth tables
1789 *pvTt2Match = pLib->vTt2Match; // matches for truth tables
1790 *ppCells = pLib->pCells; // library gates
1791 *pnCells = pLib->nCells; // library gate count
1792}
void Mio_LibraryMatchesStart(Mio_Library_t *pLib, int fPinFilter, int fPinPerm, int fPinQuick)
Definition mioUtils.c:1768
Mio_Cell2_t * pCells
Definition mioInt.h:86
Vec_Wec_t * vTt2Match
Definition mioInt.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryMatchesStart()

void Mio_LibraryMatchesStart ( Mio_Library_t * pLib,
int fPinFilter,
int fPinPerm,
int fPinQuick )
extern

Definition at line 1768 of file mioUtils.c.

1769{
1770 extern Mio_Cell2_t * Nf_StoDeriveMatches( Vec_Mem_t * vTtMem, Vec_Wec_t * vTt2Match, int * pnCells, int fPinFilter, int fPinPerm, int fPinQuick );
1771 if ( pLib->vTtMem && pLib->fPinFilter == fPinFilter && pLib->fPinPerm == fPinPerm && pLib->fPinQuick == fPinQuick )
1772 return;
1773 if ( pLib->vTtMem )
1774 Mio_LibraryMatchesStop( pLib );
1775 pLib->fPinFilter = fPinFilter; // pin filtering
1776 pLib->fPinPerm = fPinPerm; // pin permutation
1777 pLib->fPinQuick = fPinQuick; // pin permutation
1778 pLib->vTtMem = Vec_MemAllocForTT( 6, 0 );
1779 pLib->vTt2Match = Vec_WecAlloc( 1000 );
1780 Vec_WecPushLevel( pLib->vTt2Match );
1781 Vec_WecPushLevel( pLib->vTt2Match );
1782 assert( Vec_WecSize(pLib->vTt2Match) == Vec_MemEntryNum(pLib->vTtMem) );
1783 pLib->pCells = Nf_StoDeriveMatches( pLib->vTtMem, pLib->vTt2Match, &pLib->nCells, fPinFilter, fPinPerm, fPinQuick );
1784}
Mio_Cell2_t * Nf_StoDeriveMatches(Vec_Mem_t *vTtMem, Vec_Wec_t *vTt2Match, int *pnCells, int fPinFilter, int fPinPerm, int fPinQuick)
Definition giaNf.c:288
struct Mio_Cell2_t_ Mio_Cell2_t
Definition mio.h:57
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryMatchesStop()

void Mio_LibraryMatchesStop ( Mio_Library_t * pLib)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1759 of file mioUtils.c.

1760{
1761 if ( !pLib->vTtMem )
1762 return;
1763 Vec_WecFree( pLib->vTt2Match );
1764 Vec_MemHashFree( pLib->vTtMem );
1765 Vec_MemFree( pLib->vTtMem );
1766 ABC_FREE( pLib->pCells );
1767}
Here is the caller graph for this function:

◆ Mio_LibraryMultiArea()

void Mio_LibraryMultiArea ( Mio_Library_t * pLib,
double Multi )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1257 of file mioUtils.c.

1258{
1259 Mio_Gate_t * pGate;
1260 Mio_LibraryForEachGate( pLib, pGate )
1261 {
1262 if ( pGate->nInputs < 2 )
1263 continue;
1264// printf( "Before %8.3f ", pGate->dArea );
1265 pGate->dArea *= pow( pGate->nInputs, Multi );
1266// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dArea, pGate->nInputs, pow( pGate->nInputs, Multi ) );
1267 }
1268}
Here is the caller graph for this function:

◆ Mio_LibraryMultiDelay()

void Mio_LibraryMultiDelay ( Mio_Library_t * pLib,
double Multi )
extern

Definition at line 1269 of file mioUtils.c.

1270{
1271 Mio_Gate_t * pGate;
1272 Mio_Pin_t * pPin;
1273 Mio_LibraryForEachGate( pLib, pGate )
1274 {
1275 if ( pGate->nInputs < 2 )
1276 continue;
1277// printf( "Before %8.3f ", pGate->dDelayMax );
1278 pGate->dDelayMax *= pow( pGate->nInputs, Multi );
1279// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dDelayMax, pGate->nInputs, pow( pGate->nInputs, Multi ) );
1280 Mio_GateForEachPin( pGate, pPin )
1281 {
1282 pPin->dDelayBlockRise *= pow( pGate->nInputs, Multi );
1283 pPin->dDelayBlockFall *= pow( pGate->nInputs, Multi );
1284 pPin->dDelayBlockMax *= pow( pGate->nInputs, Multi );
1285 }
1286 }
1287}
Here is the caller graph for this function:

◆ Mio_LibraryParseFormulas()

int Mio_LibraryParseFormulas ( Mio_Library_t * pLib)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Deriving the functionality of the gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file mioForm.c.

59{
60 Mio_Gate_t * pGate;
61
62 // count the gates
63 pLib->nGates = 0;
64 Mio_LibraryForEachGate( pLib, pGate )
65 pLib->nGates++;
66
67 // start a temporary BDD manager
68 pLib->dd = Cudd_Init( 20, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
69 // introduce ZDD variables
70 Cudd_zddVarsFromBddVars( pLib->dd, 2 );
71
72 // for each gate, derive its function
73 Mio_LibraryForEachGate( pLib, pGate )
74 if ( Mio_GateParseFormula( pGate ) )
75 return 1;
76 return 0;
77}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryRead()

Mio_Library_t * Mio_LibraryRead ( char * FileName,
char * pBuffer,
char * ExcludeFile,
int nFaninLimit,
int fVerbose )
extern

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

Synopsis [Read the genlib type of library.]

Description []

SideEffects []

SeeAlso []

Definition at line 54 of file mioRead.c.

55{
56 Mio_Library_t * pLib;
57 int num;
58 char * pBufferCopy;
59
60 st__table * tExcludeGate = 0;
61
62 if ( ExcludeFile )
63 {
64 tExcludeGate = st__init_table(strcmp, st__strhash);
65 if ( (num = Mio_LibraryReadExclude( ExcludeFile, tExcludeGate )) == -1 )
66 {
67 st__free_table( tExcludeGate );
68 tExcludeGate = 0;
69 return 0;
70 }
71 fprintf ( stdout, "Read %d gates from exclude file\n", num );
72 }
73
74 pBufferCopy = Abc_UtilStrsav(pBuffer);
75 if ( pBuffer == NULL )
76 pLib = Mio_LibraryReadOne( FileName, 0, tExcludeGate, nFaninLimit, fVerbose ); // try normal format first ..
77 else
78 {
79 pLib = Mio_LibraryReadBuffer( pBuffer, 0, tExcludeGate, nFaninLimit, fVerbose ); // try normal format first ..
80 if ( pLib )
81 pLib->pName = Abc_UtilStrsav( Extra_FileNameGenericAppend(FileName, ".genlib") );
82 }
83 if ( pLib == NULL )
84 {
85 if ( pBuffer == NULL )
86 pLib = Mio_LibraryReadOne( FileName, 1, tExcludeGate, nFaninLimit, fVerbose ); // try normal format first ..
87 else
88 {
89 pLib = Mio_LibraryReadBuffer( pBufferCopy, 1, tExcludeGate, nFaninLimit, fVerbose ); // try normal format first ..
90 if ( pLib )
91 pLib->pName = Abc_UtilStrsav( Extra_FileNameGenericAppend(FileName, ".genlib") );
92 }
93 if ( pLib != NULL )
94 printf ( "Warning: Read extended genlib format but ignoring extensions\n" );
95 }
96 ABC_FREE( pBufferCopy );
97 if ( tExcludeGate )
98 st__free_table( tExcludeGate );
99
100 pLib->pFileName = Abc_UtilStrsav( FileName );
101 return pLib;
102}
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Mio_Library_t * Mio_LibraryReadBuffer(char *pBuffer, int fExtendedFormat, st__table *tExcludeGate, int nFaninLimit, int fVerbose)
Definition mioRead.c:156
int Mio_LibraryReadExclude(char *ExcludeFile, st__table *tExcludeGate)
Definition mioRead.c:699
int st__strhash(const char *string, int modulus)
Definition st.c:449
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition st.c:72
Definition st.h:52
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryReadAnd2()

Mio_Gate_t * Mio_LibraryReadAnd2 ( Mio_Library_t * pLib)
extern

Definition at line 54 of file mioApi.c.

54{ return pLib->pGateAnd2; }
Mio_Gate_t * pGateAnd2
Definition mioInt.h:74

◆ Mio_LibraryReadAreaBuf()

float Mio_LibraryReadAreaBuf ( Mio_Library_t * pLib)
extern

Definition at line 66 of file mioApi.c.

66{ return (float)(pLib->pGateBuf? pLib->pGateBuf->dArea : 0.0); }
Mio_Gate_t * pGateBuf
Definition mioInt.h:71
Here is the caller graph for this function:

◆ Mio_LibraryReadAreaInv()

float Mio_LibraryReadAreaInv ( Mio_Library_t * pLib)
extern

Definition at line 65 of file mioApi.c.

65{ return (float)(pLib->pGateInv? pLib->pGateInv->dArea : 0.0); }
Mio_Gate_t * pGateInv
Definition mioInt.h:72
Here is the caller graph for this function:

◆ Mio_LibraryReadAreaNand2()

float Mio_LibraryReadAreaNand2 ( Mio_Library_t * pLib)
extern

Definition at line 67 of file mioApi.c.

67{ return (float)(pLib->pGateNand2? pLib->pGateNand2->dArea : 0.0); }
Mio_Gate_t * pGateNand2
Definition mioInt.h:73

◆ Mio_LibraryReadBuf()

Mio_Gate_t * Mio_LibraryReadBuf ( Mio_Library_t * pLib)
extern

Definition at line 49 of file mioApi.c.

49{ return pLib->pGateBuf; }
Here is the caller graph for this function:

◆ Mio_LibraryReadConst0()

Mio_Gate_t * Mio_LibraryReadConst0 ( Mio_Library_t * pLib)
extern

Definition at line 51 of file mioApi.c.

51{ return pLib->pGate0; }
Mio_Gate_t * pGate0
Definition mioInt.h:69
Here is the caller graph for this function:

◆ Mio_LibraryReadConst1()

Mio_Gate_t * Mio_LibraryReadConst1 ( Mio_Library_t * pLib)
extern

Definition at line 52 of file mioApi.c.

52{ return pLib->pGate1; }
Mio_Gate_t * pGate1
Definition mioInt.h:70
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayAigNode()

float Mio_LibraryReadDelayAigNode ( Mio_Library_t * pLib)
extern

Definition at line 64 of file mioApi.c.

64{ return pLib->pGateAnd2 ? Mio_LibraryReadDelayAnd2Max(pLib) : Mio_LibraryReadDelayNand2Max(pLib); } // approximate delay of the AIG node
float Mio_LibraryReadDelayAnd2Max(Mio_Library_t *pLib)
Definition mioApi.c:63
float Mio_LibraryReadDelayNand2Max(Mio_Library_t *pLib)
Definition mioApi.c:62
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayAnd2Max()

float Mio_LibraryReadDelayAnd2Max ( Mio_Library_t * pLib)
extern

Definition at line 63 of file mioApi.c.

63{ return (float)(pLib->pGateAnd2? pLib->pGateAnd2->pPins->dDelayBlockMax : 0.0); }
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayInvFall()

float Mio_LibraryReadDelayInvFall ( Mio_Library_t * pLib)
extern

Definition at line 58 of file mioApi.c.

58{ return (float)(pLib->pGateInv? pLib->pGateInv->pPins->dDelayBlockFall : 0.0); }
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayInvMax()

float Mio_LibraryReadDelayInvMax ( Mio_Library_t * pLib)
extern

Definition at line 59 of file mioApi.c.

59{ return (float)(pLib->pGateInv? pLib->pGateInv->pPins->dDelayBlockMax : 0.0); }
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayInvRise()

float Mio_LibraryReadDelayInvRise ( Mio_Library_t * pLib)
extern

Definition at line 57 of file mioApi.c.

57{ return (float)(pLib->pGateInv? pLib->pGateInv->pPins->dDelayBlockRise : 0.0); }
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayNand2Fall()

float Mio_LibraryReadDelayNand2Fall ( Mio_Library_t * pLib)
extern

Definition at line 61 of file mioApi.c.

61{ return (float)(pLib->pGateNand2? pLib->pGateNand2->pPins->dDelayBlockFall : 0.0); }

◆ Mio_LibraryReadDelayNand2Max()

float Mio_LibraryReadDelayNand2Max ( Mio_Library_t * pLib)
extern

Definition at line 62 of file mioApi.c.

62{ return (float)(pLib->pGateNand2? pLib->pGateNand2->pPins->dDelayBlockMax : 0.0); }
Here is the caller graph for this function:

◆ Mio_LibraryReadDelayNand2Rise()

float Mio_LibraryReadDelayNand2Rise ( Mio_Library_t * pLib)
extern

Definition at line 60 of file mioApi.c.

60{ return (float)(pLib->pGateNand2? pLib->pGateNand2->pPins->dDelayBlockRise : 0.0); }

◆ Mio_LibraryReadExclude()

int Mio_LibraryReadExclude ( char * ExcludeFile,
st__table * tExcludeGate )
extern

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

Synopsis [populate hash table of gates to be exlcuded from genlib]

Description []

SideEffects []

SeeAlso []

Definition at line 699 of file mioRead.c.

700{
701 int nDel = 0;
702 FILE *pEx;
703 char buffer[128];
704
705 assert ( tExcludeGate );
706
707 if ( ExcludeFile )
708 {
709 pEx = fopen( ExcludeFile, "r" );
710
711 if ( pEx == NULL )
712 {
713 fprintf ( stdout, "Error: Could not open exclude file %s. Stop.\n", ExcludeFile );
714 return -1;
715 }
716
717 while (1 == fscanf( pEx, "%127s", buffer ))
718 {
719 //printf ("Read: '%s'\n", buffer );
720 st__insert( tExcludeGate, Abc_UtilStrsav( buffer ), (char *)0 );
721 nDel++;
722 }
723
724 fclose( pEx );
725 }
726
727 return nDel;
728}
int st__insert(st__table *table, const char *key, char *value)
Definition st.c:171
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryReadFileName()

char * Mio_LibraryReadFileName ( Mio_Library_t * pLib)
extern

Definition at line 44 of file mioApi.c.

44{ return pLib->pFileName; }
Here is the caller graph for this function:

◆ Mio_LibraryReadGateArray()

Mio_Gate_t ** Mio_LibraryReadGateArray ( Mio_Library_t * pLib)
extern

Definition at line 47 of file mioApi.c.

47{ return pLib->ppGatesName;}
Here is the caller graph for this function:

◆ Mio_LibraryReadGateById()

Mio_Gate_t * Mio_LibraryReadGateById ( Mio_Library_t * pLib,
int iD )
extern

Definition at line 48 of file mioApi.c.

48{ assert( pLib->ppGates0[Id]->Cell == Id ); return pLib->ppGates0[Id];}
Here is the caller graph for this function:

◆ Mio_LibraryReadGateByName()

Mio_Gate_t * Mio_LibraryReadGateByName ( Mio_Library_t * pLib,
char * pName,
char * pOutName )
extern

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

Synopsis [Read Mvc of the gate by name.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file mioApi.c.

106{
107 Mio_Gate_t * pGate;
108 if ( ! st__lookup( pLib->tName2Gate, pName, (char **)&pGate ) )
109 return NULL;
110 if ( pOutName == NULL )
111 return pGate;
112 if ( !strcmp(pGate->pOutName, pOutName) )
113 return pGate;
114 if ( pGate->pTwin && !strcmp(pGate->pTwin->pOutName, pOutName) )
115 return pGate->pTwin;
116 return NULL;
117}
int st__lookup(st__table *table, const char *key, char **value)
Definition st.c:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryReadGateByTruth()

Mio_Gate_t * Mio_LibraryReadGateByTruth ( Mio_Library_t * pLib,
word t )
extern

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

Synopsis [Returns the first gate in the library with the given TT.]

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file mioApi.c.

131{
132 Mio_Gate_t * pGate;
133 Mio_LibraryForEachGate( pLib, pGate )
134 if ( pGate->nInputs <= 6 && pGate->uTruth == t )
135 return pGate;
136 return NULL;
137}
Here is the caller graph for this function:

◆ Mio_LibraryReadGateNameMax()

int Mio_LibraryReadGateNameMax ( Mio_Library_t * pLib)
extern

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

Synopsis [Returns the longest gate name.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file mioApi.c.

82{
83 Mio_Gate_t * pGate;
84 int LenMax = 0, LenCur;
85 Mio_LibraryForEachGate( pLib, pGate )
86 {
87 LenCur = strlen( Mio_GateReadName(pGate) );
88 if ( LenMax < LenCur )
89 LenMax = LenCur;
90 }
91 return LenMax;
92}
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
int strlen()
Here is the call graph for this function:

◆ Mio_LibraryReadGateNum()

int Mio_LibraryReadGateNum ( Mio_Library_t * pLib)
extern

Definition at line 45 of file mioApi.c.

45{ return pLib->nGates; }
Here is the caller graph for this function:

◆ Mio_LibraryReadGates()

Mio_Gate_t * Mio_LibraryReadGates ( Mio_Library_t * pLib)
extern

Definition at line 46 of file mioApi.c.

46{ return pLib->pGates; }
Mio_Gate_t * pGates
Definition mioInt.h:68

◆ Mio_LibraryReadInv()

Mio_Gate_t * Mio_LibraryReadInv ( Mio_Library_t * pLib)
extern

Definition at line 50 of file mioApi.c.

50{ return pLib->pGateInv; }
Here is the caller graph for this function:

◆ Mio_LibraryReadName()

char * Mio_LibraryReadName ( Mio_Library_t * pLib)
extern

DECLARATIONS ///.

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

FileName [mioApi.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
mioApi.c,v 1.4 2004/06/28 14:20:25 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mioApi.c.

43{ return pLib->pName; }
Here is the caller graph for this function:

◆ Mio_LibraryReadNand2()

Mio_Gate_t * Mio_LibraryReadNand2 ( Mio_Library_t * pLib)
extern

Definition at line 53 of file mioApi.c.

53{ return pLib->pGateNand2; }
Here is the caller graph for this function:

◆ Mio_LibraryReadNor2()

Mio_Gate_t * Mio_LibraryReadNor2 ( Mio_Library_t * pLib)
extern

Definition at line 55 of file mioApi.c.

55{ return pLib->pGateNor2; }
Mio_Gate_t * pGateNor2
Definition mioInt.h:75

◆ Mio_LibraryReadOr2()

Mio_Gate_t * Mio_LibraryReadOr2 ( Mio_Library_t * pLib)
extern

Definition at line 56 of file mioApi.c.

56{ return pLib->pGateOr2; }
Mio_Gate_t * pGateOr2
Definition mioInt.h:76

◆ Mio_LibraryReadProfile()

void Mio_LibraryReadProfile ( FILE * pFile,
Mio_Library_t * pLib )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1523 of file mioUtils.c.

1524{
1525 Mio_Gate_t * pGate;
1526 char pBuffer[1000];
1527 while ( fgets( pBuffer, 1000, pFile ) != NULL )
1528 {
1529 char * pToken = strtok( pBuffer, " \t\n" );
1530 if ( pToken == NULL )
1531 continue;
1532 if ( pToken[0] == '#' )
1533 continue;
1534 // read gate
1535 pGate = Mio_LibraryReadGateByName( pLib, pToken, NULL );
1536 if ( pGate == NULL )
1537 {
1538 printf( "Cannot find gate \"%s\" in library \"%s\".\n", pToken, Mio_LibraryReadName(pLib) );
1539 continue;
1540 }
1541 // read profile
1542 pToken = strtok( NULL, " \t\n" );
1543 Mio_GateSetProfile( pGate, atoi(pToken) );
1544 }
1545}
void Mio_GateSetProfile(Mio_Gate_t *pGate, int Prof)
Definition mioApi.c:189
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition mioApi.c:43
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
char * strtok()
Here is the call graph for this function:

◆ Mio_LibraryReadSopByName()

char * Mio_LibraryReadSopByName ( Mio_Library_t * pLib,
char * pName )
extern

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

Synopsis [Read Mvc of the gate by name.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file mioApi.c.

151{
152 Mio_Gate_t * pGate;
153 if ( st__lookup( pLib->tName2Gate, pName, (char **)&pGate ) )
154 return pGate->pSop;
155 return NULL;
156}
Here is the call graph for this function:

◆ Mio_LibrarySetName()

void Mio_LibrarySetName ( Mio_Library_t * pLib,
char * pName )
extern

Definition at line 68 of file mioApi.c.

68{ ABC_FREE(pLib->pName); pLib->pName = pName; }
Here is the caller graph for this function:

◆ Mio_LibraryShiftDelay()

void Mio_LibraryShiftDelay ( Mio_Library_t * pLib,
double Shift )
extern

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 1230 of file mioUtils.c.

1231{
1232 Mio_Gate_t * pGate;
1233 Mio_Pin_t * pPin;
1234 Mio_LibraryForEachGate( pLib, pGate )
1235 {
1236 pGate->dDelayMax += Shift;
1237 Mio_GateForEachPin( pGate, pPin )
1238 {
1239 pPin->dDelayBlockRise += Shift;
1240 pPin->dDelayBlockFall += Shift;
1241 pPin->dDelayBlockMax += Shift;
1242 }
1243 }
1244}

◆ Mio_LibraryShortNames()

void Mio_LibraryShortNames ( Mio_Library_t * pLib)
extern

Definition at line 1711 of file mioUtils.c.

1712{
1713 char Buffer[10000];
1714 Mio_Gate_t * pGate; Mio_Pin_t * pPin;
1715 int c = 0, i; unsigned char nDigits = (unsigned char)Abc_Base10Log( Mio_LibraryReadGateNum(pLib) );
1716 // itereate through classes
1717 Mio_LibraryForEachGate( pLib, pGate )
1718 {
1719 ABC_FREE( pGate->pName );
1720 sprintf( Buffer, "g%0*d", nDigits, ++c );
1721 pGate->pName = Abc_UtilStrsav( Buffer );
1722 // update formula
1723 Mio_LibraryShortFormula( pGate, pGate->pForm, Buffer );
1724 ABC_FREE( pGate->pForm );
1725 pGate->pForm = Abc_UtilStrsav( Buffer );
1726 // pin names
1727 i = 0;
1728 Mio_GateForEachPin( pGate, pPin )
1729 {
1730 ABC_FREE( pPin->pName );
1731 sprintf( Buffer, "%c", 'a'+i );
1732 pPin->pName = Abc_UtilStrsav( Buffer );
1733 i++;
1734 }
1735 // output pin
1736 ABC_FREE( pGate->pOutName );
1737 sprintf( Buffer, "z" );
1738 pGate->pOutName = Abc_UtilStrsav( Buffer );
1739 }
1740 Mio_LibraryHashGates( pLib );
1741 // update library name
1742 printf( "Renaming library \"%s\" into \"%s%d\".\n", pLib->pName, "lib", Mio_LibraryReadGateNum(pLib) );
1743 ABC_FREE( pLib->pName );
1744 sprintf( Buffer, "lib%d", Mio_LibraryReadGateNum(pLib) );
1745 pLib->pName = Abc_UtilStrsav( Buffer );
1746}
void Mio_LibraryShortFormula(Mio_Gate_t *pCell, char *pForm, char *pBuffer)
Definition mioUtils.c:1680
void Mio_LibraryHashGates(Mio_Library_t *pLib)
Definition mioUtils.c:1634
char * sprintf()
Here is the call graph for this function:

◆ Mio_LibraryTransferCellIds()

void Mio_LibraryTransferCellIds ( )
extern

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

Synopsis [Install library.]

Description []

SideEffects []

SeeAlso []

Definition at line 1484 of file mioUtils.c.

1485{
1486 Mio_Gate_t * pGate;
1488 SC_Lib * pScl = (SC_Lib *)Abc_FrameReadLibScl();
1489 int CellId;
1490 if ( pScl == NULL )
1491 {
1492 printf( "SC library cannot be found.\n" );
1493 return;
1494 }
1495 if ( pLib == NULL )
1496 {
1497 printf( "Genlib library cannot be found.\n" );
1498 return;
1499 }
1500 Mio_LibraryForEachGate( pLib, pGate )
1501 {
1502 if ( Mio_GateReadPinNum(pGate) == 0 )
1503 continue;
1504 CellId = Abc_SclCellFind( pScl, Mio_GateReadName(pGate) );
1505 if ( CellId < 0 )
1506 printf( "Cannot find cell ID of gate %s.\n", Mio_GateReadName(pGate) );
1507 else
1508 Mio_GateSetCell( pGate, CellId );
1509 }
1510}
ABC_DLL void * Abc_FrameReadLibScl()
Definition mainFrame.c:62
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition mioApi.c:177
void Mio_GateSetCell(Mio_Gate_t *pGate, int Cell)
Definition mioApi.c:188
int Abc_SclCellFind(SC_Lib *p, char *pName)
Definition sclLibUtil.c:81
Here is the call graph for this function:

◆ Mio_LibraryTransferDelays()

void Mio_LibraryTransferDelays ( Mio_Library_t * pLibD,
Mio_Library_t * pLibS )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 1300 of file mioUtils.c.

1301{
1302 Mio_Gate_t * pGateD, * pGateS;
1303 Mio_Pin_t * pPinD, * pPinS;
1304 Mio_LibraryForEachGate( pLibS, pGateS )
1305 {
1306 Mio_LibraryForEachGate( pLibD, pGateD )
1307 {
1308 if ( pGateD->uTruth != pGateS->uTruth )
1309 continue;
1310 pPinS = Mio_GateReadPins( pGateS );
1311 Mio_GateForEachPin( pGateD, pPinD )
1312 {
1313 if (pPinS)
1314 {
1315 pPinD->dDelayBlockRise = pPinS->dDelayBlockRise;
1316 pPinD->dDelayBlockFall = pPinS->dDelayBlockFall;
1317 pPinD->dDelayBlockMax = pPinS->dDelayBlockMax;
1318 pPinS = Mio_PinReadNext(pPinS);
1319 }
1320 else
1321 {
1322 pPinD->dDelayBlockRise = 0;
1323 pPinD->dDelayBlockFall = 0;
1324 pPinD->dDelayBlockMax = 0;
1325 }
1326 }
1327 }
1328 }
1329}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryTransferProfile()

void Mio_LibraryTransferProfile ( Mio_Library_t * pLibDst,
Mio_Library_t * pLibSrc )
extern

Definition at line 1565 of file mioUtils.c.

1566{
1567 Mio_Gate_t * pGateSrc, * pGateDst;
1568 Mio_LibraryForEachGate( pLibDst, pGateDst )
1569 Mio_GateSetProfile( pGateDst, 0 );
1570 Mio_LibraryForEachGate( pLibSrc, pGateSrc )
1571 if ( Mio_GateReadProfile(pGateSrc) > 0 )
1572 {
1573 // find gate by name
1574 pGateDst = Mio_LibraryReadGateByName( pLibDst, Mio_GateReadName(pGateSrc), NULL );
1575 if ( pGateDst == NULL )
1576 {
1577 // find gate by function
1578 Mio_LibraryForEachGate( pLibDst, pGateDst )
1579 if ( pGateDst->uTruth == pGateSrc->uTruth )
1580 break;
1581 if ( pGateDst == NULL )
1582 {
1583 printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGateSrc), Mio_LibraryReadName(pLibDst) );
1584 continue;
1585 }
1586 }
1587 Mio_GateAddToProfile( pGateDst, Mio_GateReadProfile(pGateSrc) );
1588 }
1589}
void Mio_GateAddToProfile(Mio_Gate_t *pGate, int Prof)
Definition mioApi.c:193
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryTransferProfile2()

void Mio_LibraryTransferProfile2 ( Mio_Library_t * pLibDst,
Mio_Library_t * pLibSrc )
extern

Definition at line 1590 of file mioUtils.c.

1591{
1592 Mio_Gate_t * pGateSrc, * pGateDst;
1593 Mio_LibraryForEachGate( pLibDst, pGateDst )
1594 Mio_GateSetProfile2( pGateDst, 0 );
1595 Mio_LibraryForEachGate( pLibSrc, pGateSrc )
1596 if ( Mio_GateReadProfile2(pGateSrc) > 0 )
1597 {
1598 // find gate by name
1599 pGateDst = Mio_LibraryReadGateByName( pLibDst, Mio_GateReadName(pGateSrc), NULL );
1600 if ( pGateDst == NULL )
1601 {
1602 // find gate by function
1603 Mio_LibraryForEachGate( pLibDst, pGateDst )
1604 if ( pGateDst->uTruth == pGateSrc->uTruth )
1605 break;
1606 if ( pGateDst == NULL )
1607 {
1608 printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGateSrc), Mio_LibraryReadName(pLibDst) );
1609 continue;
1610 }
1611 }
1612 Mio_GateAddToProfile2( pGateDst, Mio_GateReadProfile2(pGateSrc) );
1613 }
1614}
void Mio_GateAddToProfile2(Mio_Gate_t *pGate, int Prof)
Definition mioApi.c:194
int Mio_GateReadProfile2(Mio_Gate_t *pGate)
Definition mioApi.c:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_LibraryWriteProfile()

void Mio_LibraryWriteProfile ( FILE * pFile,
Mio_Library_t * pLib )
extern

Definition at line 1547 of file mioUtils.c.

1548{
1549 Mio_Gate_t * pGate;
1550 Mio_LibraryForEachGate( pLib, pGate )
1551 if ( Mio_GateReadProfile(pGate) > 0 )
1552 fprintf( pFile, "%-24s %6d\n", Mio_GateReadName(pGate), Mio_GateReadProfile(pGate) );
1553}
Here is the call graph for this function:

◆ Mio_ParseCheckFormula()

int Mio_ParseCheckFormula ( Mio_Gate_t * pGate,
char * pForm )
extern

Definition at line 444 of file mioParse.c.

445{
446 Mio_Pin_t * pPin;
447 char * pStr;
448 int i, iPin, fVisit[32] = {0};
449 if ( Mio_GateReadPins(pGate) == NULL || !strcmp(Mio_PinReadName(Mio_GateReadPins(pGate)), "*") )
450 return 1;
451/*
452 // find the equality sign
453 pForm = strstr( pForm, "=" );
454 if ( pForm == NULL )
455 {
456 printf( "Skipping gate \"%s\" because formula \"%s\" has not equality sign (=).\n", pGate->pName, pForm );
457 return 0;
458 }
459*/
460//printf( "Checking gate %s\n", pGate->pName );
461
462 for ( pStr = pForm; *pStr; pStr++ )
463 {
464 if ( *pStr == ' ' ||
465 *pStr == MIO_EQN_SYM_OPEN ||
466 *pStr == MIO_EQN_SYM_CLOSE ||
467 *pStr == MIO_EQN_SYM_CONST0 ||
468 *pStr == MIO_EQN_SYM_CONST1 ||
469 *pStr == MIO_EQN_SYM_NEG ||
470 *pStr == MIO_EQN_SYM_NEGAFT ||
471 *pStr == MIO_EQN_SYM_AND ||
472 *pStr == MIO_EQN_SYM_AND2 ||
473 *pStr == MIO_EQN_SYM_XOR ||
474 *pStr == MIO_EQN_SYM_OR ||
475 *pStr == MIO_EQN_SYM_OR2
476 )
477 continue;
478 // return the number of the pin which has this name
479 iPin = Mio_ParseCheckName( pGate, &pStr );
480 if ( iPin == -1 )
481 {
482 printf( "Skipping gate \"%s\" because substring \"%s\" does not match with a pin name.\n", pGate->pName, pStr );
483 return 0;
484 }
485 assert( iPin < 32 );
486 fVisit[iPin] = 1;
487 }
488 // check that all pins are used
489 for ( pPin = Mio_GateReadPins(pGate), i = 0; pPin; pPin = Mio_PinReadNext(pPin), i++ )
490 if ( fVisit[i] == 0 )
491 {
492// printf( "Skipping gate \"%s\" because pin \"%s\" does not appear in the formula \"%s\".\n", pGate->pName, Mio_PinReadName(pPin), pForm );
493 return 0;
494 }
495 return 1;
496}
#define MIO_EQN_SYM_XOR
Definition mioParse.c:38
#define MIO_EQN_SYM_AND2
Definition mioParse.c:37
int Mio_ParseCheckName(Mio_Gate_t *pGate, char **ppStr)
Definition mioParse.c:429
#define MIO_EQN_SYM_CONST1
Definition mioParse.c:33
#define MIO_EQN_SYM_CONST0
Definition mioParse.c:32
#define MIO_EQN_SYM_AND
Definition mioParse.c:36
#define MIO_EQN_SYM_NEG
Definition mioParse.c:34
#define MIO_EQN_SYM_OR2
Definition mioParse.c:40
#define MIO_EQN_SYM_OPEN
DECLARATIONS ///.
Definition mioParse.c:30
#define MIO_EQN_SYM_NEGAFT
Definition mioParse.c:35
#define MIO_EQN_SYM_OR
Definition mioParse.c:39
#define MIO_EQN_SYM_CLOSE
Definition mioParse.c:31
char * Mio_PinReadName(Mio_Pin_t *pPin)
Definition mioApi.c:208
Here is the call graph for this function:

◆ Mio_ParseFormula()

Vec_Int_t * Mio_ParseFormula ( char * pFormInit,
char ** ppVarNames,
int nVars )
extern

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

Synopsis [Derives the AIG corresponding to the equation.]

Description [Takes the stream to output messages, the formula, the vector of variable names and the AIG manager.]

SideEffects []

SeeAlso []

Definition at line 105 of file mioParse.c.

106{
107 char * pFormula;
108 int Man = nVars, * pMan = &Man;
109 Vec_Ptr_t * pStackFn;
110 Vec_Int_t * pStackOp;
111 Vec_Int_t * gFunc;
112 char * pTemp, * pName;
113 int nParans, fFound, Flag;
114 int Oper, Oper1, Oper2;
115 int i, v;
116
117 // make sure that the number of opening and closing parentheses is the same
118 nParans = 0;
119 for ( pTemp = pFormInit; *pTemp; pTemp++ )
120 if ( *pTemp == '(' )
121 nParans++;
122 else if ( *pTemp == ')' )
123 nParans--;
124 if ( nParans != 0 )
125 {
126 fprintf( stdout, "Mio_ParseFormula(): Different number of opening and closing parentheses ().\n" );
127 return NULL;
128 }
129
130 // copy the formula
131 pFormula = ABC_ALLOC( char, strlen(pFormInit) + 3 );
132 sprintf( pFormula, "(%s)", pFormInit );
133
134 // start the stacks
135 pStackFn = Vec_PtrAlloc( 100 );
136 pStackOp = Vec_IntAlloc( 100 );
137
138 Flag = MIO_EQN_FLAG_START;
139 for ( pTemp = pFormula; *pTemp; pTemp++ )
140 {
141 switch ( *pTemp )
142 {
143 // skip all spaces, tabs, and end-of-lines
144 case ' ':
145 case '\t':
146 case '\r':
147 case '\n':
148 continue;
150 Vec_PtrPush( pStackFn, Exp_Const0() ); // Cudd_Ref( b0 );
151 if ( Flag == MIO_EQN_FLAG_VAR )
152 {
153 fprintf( stdout, "Mio_ParseFormula(): No operation symbol before constant 0.\n" );
154 Flag = MIO_EQN_FLAG_ERROR;
155 break;
156 }
157 Flag = MIO_EQN_FLAG_VAR;
158 break;
160 Vec_PtrPush( pStackFn, Exp_Const1() ); // Cudd_Ref( b1 );
161 if ( Flag == MIO_EQN_FLAG_VAR )
162 {
163 fprintf( stdout, "Mio_ParseFormula(): No operation symbol before constant 1.\n" );
164 Flag = MIO_EQN_FLAG_ERROR;
165 break;
166 }
167 Flag = MIO_EQN_FLAG_VAR;
168 break;
169 case MIO_EQN_SYM_NEG:
170 if ( Flag == MIO_EQN_FLAG_VAR )
171 {// if NEGBEF follows a variable, AND is assumed
172 Vec_IntPush( pStackOp, MIO_EQN_OPER_AND );
173 Flag = MIO_EQN_FLAG_OPER;
174 }
175 Vec_IntPush( pStackOp, MIO_EQN_OPER_NEG );
176 break;
178 if ( Flag != MIO_EQN_FLAG_VAR )
179 {// if there is no variable before NEGAFT, it is an error
180 fprintf( stdout, "Mio_ParseFormula(): No variable is specified before the negation suffix.\n" );
181 Flag = MIO_EQN_FLAG_ERROR;
182 break;
183 }
184 else // if ( Flag == PARSE_FLAG_VAR )
185 Vec_PtrPush( pStackFn, Exp_Not( (Vec_Int_t *)Vec_PtrPop(pStackFn) ) );
186 break;
187 case MIO_EQN_SYM_AND:
188 case MIO_EQN_SYM_AND2:
189 case MIO_EQN_SYM_OR:
190 case MIO_EQN_SYM_OR2:
191 case MIO_EQN_SYM_XOR:
192 if ( Flag != MIO_EQN_FLAG_VAR )
193 {
194 fprintf( stdout, "Mio_ParseFormula(): There is no variable before AND, EXOR, or OR.\n" );
195 Flag = MIO_EQN_FLAG_ERROR;
196 break;
197 }
198 if ( *pTemp == MIO_EQN_SYM_AND || *pTemp == MIO_EQN_SYM_AND2 )
199 Vec_IntPush( pStackOp, MIO_EQN_OPER_AND );
200 else if ( *pTemp == MIO_EQN_SYM_OR || *pTemp == MIO_EQN_SYM_OR2 )
201 Vec_IntPush( pStackOp, MIO_EQN_OPER_OR );
202 else //if ( *pTemp == MIO_EQN_SYM_XOR )
203 Vec_IntPush( pStackOp, MIO_EQN_OPER_XOR );
204 Flag = MIO_EQN_FLAG_OPER;
205 break;
206 case MIO_EQN_SYM_OPEN:
207 if ( Flag == MIO_EQN_FLAG_VAR )
208 {
209 Vec_IntPush( pStackOp, MIO_EQN_OPER_AND );
210// fprintf( stdout, "Mio_ParseFormula(): An opening parenthesis follows a var without operation sign.\n" );
211// Flag = MIO_EQN_FLAG_ERROR;
212// break;
213 }
214 Vec_IntPush( pStackOp, MIO_EQN_OPER_MARK );
215 // after an opening bracket, it feels like starting over again
216 Flag = MIO_EQN_FLAG_START;
217 break;
219 if ( Vec_IntSize( pStackOp ) != 0 )
220 {
221 while ( 1 )
222 {
223 if ( Vec_IntSize( pStackOp ) == 0 )
224 {
225 fprintf( stdout, "Mio_ParseFormula(): There is no opening parenthesis\n" );
226 Flag = MIO_EQN_FLAG_ERROR;
227 break;
228 }
229 Oper = Vec_IntPop( pStackOp );
230 if ( Oper == MIO_EQN_OPER_MARK )
231 break;
232
233 // perform the given operation
234 if ( Mio_ParseFormulaOper( pMan, nVars, pStackFn, Oper ) == NULL )
235 {
236 fprintf( stdout, "Mio_ParseFormula(): Unknown operation\n" );
237 ABC_FREE( pFormula );
238 Vec_PtrFreeP( &pStackFn );
239 Vec_IntFreeP( &pStackOp );
240 return NULL;
241 }
242 }
243 }
244 else
245 {
246 fprintf( stdout, "Mio_ParseFormula(): There is no opening parenthesis\n" );
247 Flag = MIO_EQN_FLAG_ERROR;
248 break;
249 }
250 if ( Flag != MIO_EQN_FLAG_ERROR )
251 Flag = MIO_EQN_FLAG_VAR;
252 break;
253
254
255 default:
256 // scan the next name
257 for ( i = 0; pTemp[i] &&
258 pTemp[i] != ' ' && pTemp[i] != '\t' && pTemp[i] != '\r' && pTemp[i] != '\n' &&
259 pTemp[i] != MIO_EQN_SYM_AND && pTemp[i] != MIO_EQN_SYM_AND2 && pTemp[i] != MIO_EQN_SYM_OR && pTemp[i] != MIO_EQN_SYM_OR2 &&
260 pTemp[i] != MIO_EQN_SYM_XOR && pTemp[i] != MIO_EQN_SYM_NEGAFT && pTemp[i] != MIO_EQN_SYM_CLOSE;
261 i++ )
262 {
263 if ( pTemp[i] == MIO_EQN_SYM_NEG || pTemp[i] == MIO_EQN_SYM_OPEN )
264 {
265 fprintf( stdout, "Mio_ParseFormula(): The negation sign or an opening parenthesis inside the variable name.\n" );
266 Flag = MIO_EQN_FLAG_ERROR;
267 break;
268 }
269 }
270 // variable name is found
271 fFound = 0;
272// Vec_PtrForEachEntry( char *, vVarNames, pName, v )
273 for ( v = 0; v < nVars; v++ )
274 {
275 pName = ppVarNames[v];
276 if ( strncmp(pTemp, pName, i) == 0 && strlen(pName) == (unsigned)i )
277 {
278 pTemp += i-1;
279 fFound = 1;
280 break;
281 }
282 }
283 if ( !fFound )
284 {
285 fprintf( stdout, "Mio_ParseFormula(): The parser cannot find var \"%s\" in the input var list.\n", pTemp );
286 Flag = MIO_EQN_FLAG_ERROR;
287 break;
288 }
289/*
290 if ( Flag == MIO_EQN_FLAG_VAR )
291 {
292 fprintf( stdout, "Mio_ParseFormula(): The variable name \"%s\" follows another var without operation sign.\n", pTemp );
293 Flag = MIO_EQN_FLAG_ERROR;
294 break;
295 }
296*/
297 if ( Flag == MIO_EQN_FLAG_VAR )
298 Vec_IntPush( pStackOp, MIO_EQN_OPER_AND );
299
300 Vec_PtrPush( pStackFn, Exp_Var(v) ); // Cudd_Ref( pbVars[v] );
301 Flag = MIO_EQN_FLAG_VAR;
302 break;
303 }
304
305 if ( Flag == MIO_EQN_FLAG_ERROR )
306 break; // error exit
307 else if ( Flag == MIO_EQN_FLAG_START )
308 continue; // go on parsing
309 else if ( Flag == MIO_EQN_FLAG_VAR )
310 while ( 1 )
311 { // check if there are negations in the OpStack
312 if ( Vec_IntSize( pStackOp ) == 0 )
313 break;
314 Oper = Vec_IntPop( pStackOp );
315 if ( Oper != MIO_EQN_OPER_NEG )
316 {
317 Vec_IntPush( pStackOp, Oper );
318 break;
319 }
320 else
321 {
322 Vec_PtrPush( pStackFn, Exp_Not((Vec_Int_t *)Vec_PtrPop(pStackFn)) );
323 }
324 }
325 else // if ( Flag == MIO_EQN_FLAG_OPER )
326 while ( 1 )
327 { // execute all the operations in the OpStack
328 // with precedence higher or equal than the last one
329 Oper1 = Vec_IntPop( pStackOp ); // the last operation
330 if ( Vec_IntSize( pStackOp ) == 0 )
331 { // if it is the only operation, push it back
332 Vec_IntPush( pStackOp, Oper1 );
333 break;
334 }
335 Oper2 = Vec_IntPop( pStackOp ); // the operation before the last one
336 if ( Oper2 >= Oper1 )
337 { // if Oper2 precedence is higher or equal, execute it
338 if ( Mio_ParseFormulaOper( pMan, nVars, pStackFn, Oper2 ) == NULL )
339 {
340 fprintf( stdout, "Mio_ParseFormula(): Unknown operation\n" );
341 ABC_FREE( pFormula );
342 Vec_PtrFreeP( &pStackFn );
343 Vec_IntFreeP( &pStackOp );
344 return NULL;
345 }
346 Vec_IntPush( pStackOp, Oper1 ); // push the last operation back
347 }
348 else
349 { // if Oper2 precedence is lower, push them back and done
350 Vec_IntPush( pStackOp, Oper2 );
351 Vec_IntPush( pStackOp, Oper1 );
352 break;
353 }
354 }
355 }
356
357 if ( Flag != MIO_EQN_FLAG_ERROR )
358 {
359 if ( Vec_PtrSize(pStackFn) != 0 )
360 {
361 gFunc = (Vec_Int_t *)Vec_PtrPop(pStackFn);
362 if ( Vec_PtrSize(pStackFn) == 0 )
363 if ( Vec_IntSize( pStackOp ) == 0 )
364 {
365// Cudd_Deref( gFunc );
366 ABC_FREE( pFormula );
367 Vec_PtrFreeP( &pStackFn );
368 Vec_IntFreeP( &pStackOp );
369 return Exp_Reverse(gFunc);
370 }
371 else
372 fprintf( stdout, "Mio_ParseFormula(): Something is left in the operation stack\n" );
373 else
374 fprintf( stdout, "Mio_ParseFormula(): Something is left in the function stack\n" );
375 }
376 else
377 fprintf( stdout, "Mio_ParseFormula(): The input string is empty\n" );
378 }
379 ABC_FREE( pFormula );
380 Vec_PtrFreeP( &pStackFn );
381 Vec_IntFreeP( &pStackOp );
382 return NULL;
383}
#define MIO_EQN_OPER_NEG
Definition mioParse.c:43
#define MIO_EQN_FLAG_ERROR
Definition mioParse.c:53
#define MIO_EQN_OPER_XOR
Definition mioParse.c:45
#define MIO_EQN_OPER_OR
Definition mioParse.c:46
#define MIO_EQN_FLAG_OPER
Definition mioParse.c:52
#define MIO_EQN_OPER_MARK
Definition mioParse.c:47
Vec_Int_t * Mio_ParseFormulaOper(int *pMan, int nVars, Vec_Ptr_t *pStackFn, int Oper)
FUNCTION DEFINITIONS ///.
Definition mioParse.c:70
#define MIO_EQN_FLAG_START
Definition mioParse.c:50
#define MIO_EQN_OPER_AND
Definition mioParse.c:44
#define MIO_EQN_FLAG_VAR
Definition mioParse.c:51
int strncmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_ParseFormulaTruth()

Vec_Wrd_t * Mio_ParseFormulaTruth ( char * pFormInit,
char ** ppVarNames,
int nVars )
extern

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

Synopsis [Derives the TT corresponding to the equation.]

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file mioParse.c.

397{
398 Vec_Int_t * vExpr;
399 Vec_Wrd_t * vTruth;
400 // derive expression
401 vExpr = Mio_ParseFormula( pFormInit, ppVarNames, nVars );
402 if ( vExpr == NULL )
403 return NULL;
404 // convert it into a truth table
405 vTruth = Vec_WrdStart( Abc_Truth6WordNum(nVars) );
406 Exp_Truth( nVars, vExpr, Vec_WrdArray(vTruth) );
407 Vec_IntFree( vExpr );
408 return vTruth;
409}
Vec_Int_t * Mio_ParseFormula(char *pFormInit, char **ppVarNames, int nVars)
Definition mioParse.c:105
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_PinDelete()

void Mio_PinDelete ( Mio_Pin_t * pPin)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file mioUtils.c.

115{
116 ABC_FREE( pPin->pName );
117 ABC_FREE( pPin );
118}
Here is the caller graph for this function:

◆ Mio_PinDup()

Mio_Pin_t * Mio_PinDup ( Mio_Pin_t * pPin)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file mioUtils.c.

132{
133 Mio_Pin_t * pPinNew;
134
135 pPinNew = ABC_ALLOC( Mio_Pin_t, 1 );
136 *pPinNew = *pPin;
137 pPinNew->pName = (pPinNew->pName ? Abc_UtilStrsav(pPinNew->pName) : NULL);
138 pPinNew->pNext = NULL;
139
140 return pPinNew;
141}
Here is the caller graph for this function:

◆ Mio_PinReadDelayBlockFall()

double Mio_PinReadDelayBlockFall ( Mio_Pin_t * pPin)
extern

Definition at line 214 of file mioApi.c.

214{ return pPin->dDelayBlockFall; }
Here is the caller graph for this function:

◆ Mio_PinReadDelayBlockMax()

double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin)
extern

Definition at line 216 of file mioApi.c.

216{ return pPin->dDelayBlockMax; }

◆ Mio_PinReadDelayBlockRise()

double Mio_PinReadDelayBlockRise ( Mio_Pin_t * pPin)
extern

Definition at line 212 of file mioApi.c.

212{ return pPin->dDelayBlockRise; }
Here is the caller graph for this function:

◆ Mio_PinReadDelayFanoutFall()

double Mio_PinReadDelayFanoutFall ( Mio_Pin_t * pPin)
extern

Definition at line 215 of file mioApi.c.

215{ return pPin->dDelayFanoutFall;}
double dDelayFanoutFall
Definition mioInt.h:132

◆ Mio_PinReadDelayFanoutRise()

double Mio_PinReadDelayFanoutRise ( Mio_Pin_t * pPin)
extern

Definition at line 213 of file mioApi.c.

213{ return pPin->dDelayFanoutRise;}
double dDelayFanoutRise
Definition mioInt.h:130

◆ Mio_PinReadInputLoad()

double Mio_PinReadInputLoad ( Mio_Pin_t * pPin)
extern

Definition at line 210 of file mioApi.c.

210{ return pPin->dLoadInput; }
double dLoadInput
Definition mioInt.h:127

◆ Mio_PinReadMaxLoad()

double Mio_PinReadMaxLoad ( Mio_Pin_t * pPin)
extern

Definition at line 211 of file mioApi.c.

211{ return pPin->dLoadMax; }
double dLoadMax
Definition mioInt.h:128

◆ Mio_PinReadName()

char * Mio_PinReadName ( Mio_Pin_t * pPin)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file mioApi.c.

208{ return pPin->pName; }
Here is the caller graph for this function:

◆ Mio_PinReadNext()

Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin)
extern

Definition at line 217 of file mioApi.c.

217{ return pPin->pNext; }
Here is the caller graph for this function:

◆ Mio_PinReadPhase()

Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin)
extern

Definition at line 209 of file mioApi.c.

209{ return pPin->Phase; }
Mio_PinPhase_t Phase
Definition mioInt.h:126
Here is the caller graph for this function:

◆ Mio_ReadFile()

char * Mio_ReadFile ( char * FileName,
int fAddEnd )
extern

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

Synopsis [Read contents of the file.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file mioRead.c.

116{
117 char * pBuffer;
118 FILE * pFile;
119 int nFileSize;
120 int RetValue;
121
122 // open the BLIF file for binary reading
123 pFile = Io_FileOpen( FileName, "open_path", "rb", 1 );
124// pFile = fopen( FileName, "rb" );
125 // if we got this far, file should be okay otherwise would
126 // have been detected by caller
127 assert ( pFile != NULL );
128 // get the file size, in bytes
129 fseek( pFile, 0, SEEK_END );
130 nFileSize = ftell( pFile );
131 // move the file current reading position to the beginning
132 rewind( pFile );
133 // load the contents of the file into memory
134 pBuffer = ABC_ALLOC( char, nFileSize + 10 );
135 RetValue = fread( pBuffer, nFileSize, 1, pFile );
136 // terminate the string with '\0'
137 pBuffer[ nFileSize ] = '\0';
138 if ( fAddEnd )
139 strcat( pBuffer, "\n.end\n" );
140 // close file
141 fclose( pFile );
142 return pBuffer;
143}
FILE * Io_FileOpen(const char *FileName, const char *PathVar, const char *Mode, int fVerbose)
Definition ioUtil.c:828
VOID_HACK rewind()
char * strcat()
#define SEEK_END
Definition zconf.h:392
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_UpdateGenlib()

void Mio_UpdateGenlib ( Mio_Library_t * pLib)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 243 of file mio.c.

244{
245 // free the current superlib because it depends on the old Mio library
246 if ( Abc_FrameReadLibSuper() )
247 {
249 Abc_FrameSetLibSuper( NULL );
250 }
251
252 // replace the current library
254 Abc_FrameSetLibGen( pLib );
255
256 // replace the current library
258 Abc_FrameSetLibGen2( NULL );
259}
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
Definition amap.h:42
void Amap_LibFree(Amap_Lib_t *p)
Definition amapLib.c:67
ABC_DLL void Abc_FrameSetLibGen(void *pLib)
Definition mainFrame.c:95
ABC_DLL void Abc_FrameSetLibSuper(void *pLib)
Definition mainFrame.c:97
ABC_DLL void Abc_FrameSetLibGen2(void *pLib)
Definition mainFrame.c:96
ABC_DLL void * Abc_FrameReadLibGen2()
Definition mainFrame.c:60
ABC_DLL void * Abc_FrameReadLibSuper()
Definition mainFrame.c:61
struct Map_SuperLibStruct_t_ Map_SuperLib_t
Definition mapper.h:46
void Map_SuperLibFree(Map_SuperLib_t *p)
Definition mapperLib.c:170
void Mio_LibraryDelete(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition mioUtils.c:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_UpdateGenlib2()

int Mio_UpdateGenlib2 ( Vec_Str_t * vStr,
Vec_Str_t * vStr2,
char * pFileName,
int fVerbose )
extern

Definition at line 260 of file mio.c.

261{
262 Mio_Library_t * pLib;
263 // set the new network
264 pLib = Mio_LibraryRead( pFileName, Vec_StrArray(vStr), NULL, 0, fVerbose );
265 if ( pLib == NULL )
266 return 0;
267
268 // free the current superlib because it depends on the old Mio library
269 if ( Abc_FrameReadLibSuper() )
270 {
272 Abc_FrameSetLibSuper( NULL );
273 }
274
275 // replace the current library
277 Abc_FrameSetLibGen( pLib );
278
279 // set the new network
280 pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( pFileName, Vec_StrArray(vStr2), 0, 0 );
281 if ( pLib == NULL )
282 return 0;
283
284 // replace the current library
286 Abc_FrameSetLibGen2( pLib );
287 return 1;
288}
Amap_Lib_t * Amap_LibReadAndPrepare(char *pFileName, char *pBuffer, int fVerbose, int fVeryVerbose)
Definition amapLib.c:332
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mio_WriteLibrary()

void Mio_WriteLibrary ( FILE * pFile,
Mio_Library_t * pLib,
int fPrintSops,
int fShort,
int fSelected )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 262 of file mioUtils.c.

263{
264 Mio_Gate_t * pGate;
265 Mio_Pin_t * pPin;
266 Vec_Ptr_t * vGates = Vec_PtrAlloc( 1000 );
267 int i, nCells, GateLen = 0, NameLen = 0, FormLen = 0;
268 int fAllPins = fShort || Mio_CheckGates( pLib );
269 if ( fSelected )
270 {
271 Mio_Cell2_t * pCells = Mio_CollectRootsNewDefault2( 6, &nCells, 0 );
272 for ( i = 0; i < nCells; i++ )
273 Vec_PtrPush( vGates, pCells[i].pMioGate );
274 ABC_FREE( pCells );
275 }
276 else
277 {
278 for ( i = 0; i < pLib->nGates; i++ )
279 Vec_PtrPush( vGates, pLib->ppGates0[i] );
280 }
281 Vec_PtrForEachEntry( Mio_Gate_t *, vGates, pGate, i )
282 {
283 GateLen = Abc_MaxInt( GateLen, strlen(pGate->pName) );
284 NameLen = Abc_MaxInt( NameLen, strlen(pGate->pOutName) );
285 FormLen = Abc_MaxInt( FormLen, strlen(pGate->pForm) );
286 Mio_GateForEachPin( pGate, pPin )
287 NameLen = Abc_MaxInt( NameLen, strlen(pPin->pName) );
288 }
289 fprintf( pFile, "# The genlib library \"%s\" with %d gates written by ABC on %s\n", pLib->pName, Vec_PtrSize(vGates), Extra_TimeStamp() );
290 Vec_PtrForEachEntry( Mio_Gate_t *, vGates, pGate, i )
291 Mio_WriteGate( pFile, pGate, GateLen, NameLen, FormLen, fPrintSops, fAllPins );
292 Vec_PtrFree( vGates );
293}
char * Extra_TimeStamp()
void Mio_WriteGate(FILE *pFile, Mio_Gate_t *pGate, int GateLen, int NameLen, int FormLen, int fPrintSops, int fAllPins)
Definition mioUtils.c:226
Mio_Cell2_t * Mio_CollectRootsNewDefault2(int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:877
int Mio_CheckGates(Mio_Library_t *pLib)
Definition mioUtils.c:175
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Mio_WriteLibraryVerilog()

void Mio_WriteLibraryVerilog ( FILE * pFile,
Mio_Library_t * pLib,
int fPrintSops,
int fShort,
int fSelected )
extern

Definition at line 357 of file mioUtils.c.

358{
359 Mio_Gate_t * pGate;
360 Mio_Pin_t * pPin;
361 Vec_Ptr_t * vGates = Vec_PtrAlloc( 1000 );
362 Vec_Ptr_t * vNames = Vec_PtrAlloc( 100 );
363 int i, nCells;
364 if ( fSelected )
365 {
366 Mio_Cell2_t * pCells = Mio_CollectRootsNewDefault2( 6, &nCells, 0 );
367 for ( i = 0; i < nCells; i++ )
368 Vec_PtrPush( vGates, pCells[i].pMioGate );
369 ABC_FREE( pCells );
370 }
371 else
372 {
373 for ( i = 0; i < pLib->nGates; i++ )
374 Vec_PtrPush( vGates, pLib->ppGates0[i] );
375 }
376 fprintf( pFile, "// Verilog for genlib library \"%s\" with %d gates written by ABC on %s\n\n", pLib->pName, Vec_PtrSize(vGates), Extra_TimeStamp() );
377 Vec_PtrForEachEntry( Mio_Gate_t *, vGates, pGate, i )
378 {
379 Vec_PtrClear( vNames );
380 Mio_GateForEachPin( pGate, pPin )
381 Vec_PtrPush( vNames, pPin->pName );
382 Mio_WriteGateVerilog( pFile, pGate, vNames );
383 }
384 Vec_PtrFree( vNames );
385 Vec_PtrFree( vGates );
386}
void Mio_WriteGateVerilog(FILE *pFile, Mio_Gate_t *pGate, Vec_Ptr_t *vNames)
Definition mioUtils.c:336
Here is the call graph for this function: