abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mio.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [mio.h]
4 
5  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]
6 
7  Synopsis [File reading/writing for technology mapping.]
8 
9  Author [MVSIS Group]
10 
11  Affiliation [UC Berkeley]
12 
13  Date [Ver. 1.0. Started - September 8, 2003.]
14 
15  Revision [$Id: mio.h,v 1.6 2004/08/09 22:16:31 satrajit Exp $]
16 
17 ***********************************************************************/
18 
19 #ifndef ABC__map__mio__mio_h
20 #define ABC__map__mio__mio_h
21 
22 
23 ////////////////////////////////////////////////////////////////////////
24 /// INCLUDES ///
25 ////////////////////////////////////////////////////////////////////////
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// PARAMETERS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 
32 
34 
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// STRUCTURE DEFINITIONS ///
38 ////////////////////////////////////////////////////////////////////////
39 
41 
44 typedef struct Mio_PinStruct_t_ Mio_Pin_t;
45 
46 typedef struct Mio_Cell_t_ Mio_Cell_t;
48 {
49  char * pName; // name
50  word uTruth; // truth table
51  float Area; // area
52  unsigned Id : 28; // gate ID
53  unsigned nFanins : 4; // gate fanins
54  float Delays[6]; // delay
55 };
56 
57 ////////////////////////////////////////////////////////////////////////
58 /// GLOBAL VARIABLES ///
59 ////////////////////////////////////////////////////////////////////////
60 
61 ////////////////////////////////////////////////////////////////////////
62 /// MACRO DEFINITIONS ///
63 ////////////////////////////////////////////////////////////////////////
64 
65 #define Mio_LibraryForEachGate( Lib, Gate ) \
66  for ( Gate = Mio_LibraryReadGates(Lib); \
67  Gate; \
68  Gate = Mio_GateReadNext(Gate) )
69 #define Mio_LibraryForEachGateSafe( Lib, Gate, Gate2 ) \
70  for ( Gate = Mio_LibraryReadGates(Lib), \
71  Gate2 = (Gate? Mio_GateReadNext(Gate): NULL); \
72  Gate; \
73  Gate = Gate2, \
74  Gate2 = (Gate? Mio_GateReadNext(Gate): NULL) )
75 
76 #define Mio_GateForEachPin( Gate, Pin ) \
77  for ( Pin = Mio_GateReadPins(Gate); \
78  Pin; \
79  Pin = Mio_PinReadNext(Pin) )
80 #define Mio_GateForEachPinSafe( Gate, Pin, Pin2 ) \
81  for ( Pin = Mio_GateReadPins(Gate), \
82  Pin2 = (Pin? Mio_PinReadNext(Pin): NULL); \
83  Pin; \
84  Pin = Pin2, \
85  Pin2 = (Pin? Mio_PinReadNext(Pin): NULL) )
86 
87 ////////////////////////////////////////////////////////////////////////
88 /// FUNCTION DEFINITIONS ///
89 ////////////////////////////////////////////////////////////////////////
90 
91 /*=== mio.c =============================================================*/
92 extern void Mio_UpdateGenlib( Mio_Library_t * pLib );
93 extern int Mio_UpdateGenlib2( Vec_Str_t * vStr, Vec_Str_t * vStr2, char * pFileName, int fVerbose );
94 /*=== mioApi.c =============================================================*/
95 extern char * Mio_LibraryReadName ( Mio_Library_t * pLib );
96 extern int Mio_LibraryReadGateNum ( Mio_Library_t * pLib );
99 extern Mio_Gate_t * Mio_LibraryReadGateByName ( Mio_Library_t * pLib, char * pName, char * pOutName );
100 extern char * Mio_LibraryReadSopByName ( Mio_Library_t * pLib, char * pName );
103 extern Mio_Gate_t * Mio_LibraryReadNand2 ( Mio_Library_t * pLib );
104 extern Mio_Gate_t * Mio_LibraryReadAnd2 ( Mio_Library_t * pLib );
105 extern Mio_Gate_t * Mio_LibraryReadBuf ( Mio_Library_t * pLib );
106 extern Mio_Gate_t * Mio_LibraryReadInv ( Mio_Library_t * pLib );
107 extern float Mio_LibraryReadDelayInvRise( Mio_Library_t * pLib );
108 extern float Mio_LibraryReadDelayInvFall( Mio_Library_t * pLib );
109 extern float Mio_LibraryReadDelayInvMax( Mio_Library_t * pLib );
110 extern float Mio_LibraryReadDelayNand2Rise( Mio_Library_t * pLib );
111 extern float Mio_LibraryReadDelayNand2Fall( Mio_Library_t * pLib );
112 extern float Mio_LibraryReadDelayNand2Max( Mio_Library_t * pLib );
113 extern float Mio_LibraryReadDelayAnd2Max( Mio_Library_t * pLib );
114 extern float Mio_LibraryReadAreaInv ( Mio_Library_t * pLib );
115 extern float Mio_LibraryReadAreaBuf ( Mio_Library_t * pLib );
116 extern float Mio_LibraryReadAreaNand2 ( Mio_Library_t * pLib );
117 extern int Mio_LibraryReadGateNameMax( Mio_Library_t * pLib );
118 extern char * Mio_GateReadName ( Mio_Gate_t * pGate );
119 extern char * Mio_GateReadOutName ( Mio_Gate_t * pGate );
120 extern double Mio_GateReadArea ( Mio_Gate_t * pGate );
121 extern char * Mio_GateReadForm ( Mio_Gate_t * pGate );
122 extern Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate );
123 extern Mio_Library_t * Mio_GateReadLib ( Mio_Gate_t * pGate );
124 extern Mio_Gate_t * Mio_GateReadNext ( Mio_Gate_t * pGate );
125 extern Mio_Gate_t * Mio_GateReadTwin ( Mio_Gate_t * pGate );
126 extern int Mio_GateReadPinNum ( Mio_Gate_t * pGate );
127 extern double Mio_GateReadDelayMax ( Mio_Gate_t * pGate );
128 extern char * Mio_GateReadSop ( Mio_Gate_t * pGate );
129 extern word Mio_GateReadTruth ( Mio_Gate_t * pGate );
130 extern int Mio_GateReadValue ( Mio_Gate_t * pGate );
131 extern char * Mio_GateReadPinName ( Mio_Gate_t * pGate, int iPin );
132 extern float Mio_GateReadPinDelay ( Mio_Gate_t * pGate, int iPin );
133 extern void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value );
134 extern char * Mio_PinReadName ( Mio_Pin_t * pPin );
135 extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin );
136 extern double Mio_PinReadInputLoad ( Mio_Pin_t * pPin );
137 extern double Mio_PinReadMaxLoad ( Mio_Pin_t * pPin );
138 extern double Mio_PinReadDelayBlockRise ( Mio_Pin_t * pPin );
139 extern double Mio_PinReadDelayFanoutRise( Mio_Pin_t * pPin );
140 extern double Mio_PinReadDelayBlockFall ( Mio_Pin_t * pPin );
141 extern double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin );
142 extern double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin );
143 extern Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin );
144 /*=== mioRead.c =============================================================*/
145 extern char * Mio_ReadFile( char * FileName, int fAddEnd );
146 extern Mio_Library_t * Mio_LibraryRead( char * FileName, char * pBuffer, char * ExcludeFile, int fVerbose );
147 extern int Mio_LibraryReadExclude( char * ExcludeFile, st__table * tExcludeGate );
148 /*=== mioFunc.c =============================================================*/
149 extern int Mio_LibraryParseFormulas( Mio_Library_t * pLib );
150 /*=== mioParse.c =============================================================*/
151 extern Vec_Int_t * Mio_ParseFormula( char * pFormInit, char ** ppVarNames, int nVars );
152 extern Vec_Wrd_t * Mio_ParseFormulaTruth( char * pFormInit, char ** ppVarNames, int nVars );
153 extern int Mio_ParseCheckFormula( Mio_Gate_t * pGate, char * pForm );
154 /*=== mioSop.c =============================================================*/
155 extern char * Mio_LibDeriveSop( int nVars, Vec_Int_t * vExpr, Vec_Str_t * vStr );
156 /*=== mioUtils.c =============================================================*/
157 extern void Mio_LibraryDelete( Mio_Library_t * pLib );
158 extern void Mio_GateDelete( Mio_Gate_t * pGate );
159 extern void Mio_PinDelete( Mio_Pin_t * pPin );
160 extern Mio_Pin_t * Mio_PinDup( Mio_Pin_t * pPin );
161 extern void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops );
162 extern Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, int fSkipInv, int * pnGates, int fVerbose );
163 extern Mio_Cell_t * Mio_CollectRootsNew( Mio_Library_t * pLib, int nInputs, int * pnGates, int fVerbose );
164 extern Mio_Cell_t * Mio_CollectRootsNewDefault( int nInputs, int * pnGates, int fVerbose );
165 extern word Mio_DeriveTruthTable6( Mio_Gate_t * pGate );
166 extern void Mio_DeriveTruthTable( Mio_Gate_t * pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[] );
167 extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate,
168  float ** ptPinDelays, int nPins, int nInputs, float tDelayZero,
169  float * ptDelaysRes, float * ptPinDelayMax );
170 extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs );
171 extern void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift );
172 extern void Mio_LibraryMultiArea( Mio_Library_t * pLib, double Multi );
173 extern void Mio_LibraryMultiDelay( Mio_Library_t * pLib, double Multi );
174 extern void Mio_LibraryTransferDelays( Mio_Library_t * pLibD, Mio_Library_t * pLibS );
175 
176 /*=== sclUtil.c =========================================================*/
177 extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl );
178 extern Mio_Library_t * Abc_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin, int fVerbose );
179 extern int Abc_SclHasDelayInfo( void * pScl );
180 
182 
183 #endif
184 
185 ////////////////////////////////////////////////////////////////////////
186 /// END OF FILE ///
187 ////////////////////////////////////////////////////////////////////////
188 
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
int Mio_LibraryParseFormulas(Mio_Library_t *pLib)
FUNCTION DEFINITIONS ///.
Definition: mioForm.c:58
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition: mioApi.c:99
int Mio_UpdateGenlib2(Vec_Str_t *vStr, Vec_Str_t *vStr2, char *pFileName, int fVerbose)
Definition: mio.c:141
Vec_Int_t * Mio_ParseFormula(char *pFormInit, char **ppVarNames, int nVars)
Definition: mioParse.c:105
char * pName
Definition: mio.h:49
int Mio_ParseCheckFormula(Mio_Gate_t *pGate, char *pForm)
Definition: mioParse.c:444
char * Mio_LibDeriveSop(int nVars, Vec_Int_t *vExpr, Vec_Str_t *vStr)
Definition: mioSop.c:257
float Mio_LibraryReadAreaBuf(Mio_Library_t *pLib)
Definition: mioApi.c:61
Mio_Library_t * Mio_LibraryRead(char *FileName, char *pBuffer, char *ExcludeFile, int fVerbose)
Definition: mioRead.c:54
void Mio_LibraryMultiDelay(Mio_Library_t *pLib, double Multi)
Definition: mioUtils.c:841
Mio_Gate_t * Mio_LibraryReadGates(Mio_Library_t *pLib)
Definition: mioApi.c:45
void Mio_LibraryDelete(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition: mioUtils.c:48
float Mio_GateReadPinDelay(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:201
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Mio_Library_t * Mio_GateReadLib(Mio_Gate_t *pGate)
Definition: mioApi.c:148
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition: mioApi.c:147
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
void Mio_LibraryShiftDelay(Mio_Library_t *pLib, double Shift)
Definition: mioUtils.c:802
char * Mio_GateReadPinName(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:192
double Mio_PinReadDelayBlockFall(Mio_Pin_t *pPin)
Definition: mioApi.c:176
double Mio_PinReadInputLoad(Mio_Pin_t *pPin)
Definition: mioApi.c:172
Mio_PinPhase_t
INCLUDES ///.
Definition: mio.h:40
Vec_Wrd_t * Mio_ParseFormulaTruth(char *pFormInit, char **ppVarNames, int nVars)
Definition: mioParse.c:396
double Mio_PinReadMaxLoad(Mio_Pin_t *pPin)
Definition: mioApi.c:173
Mio_Gate_t * Mio_GateCreatePseudo(int nInputs)
Definition: mioUtils.c:771
char * Mio_GateReadOutName(Mio_Gate_t *pGate)
Definition: mioApi.c:144
float Mio_LibraryReadDelayNand2Max(Mio_Library_t *pLib)
Definition: mioApi.c:58
char * Mio_PinReadName(Mio_Pin_t *pPin)
Definition: mioApi.c:170
Mio_Gate_t * Mio_LibraryReadAnd2(Mio_Library_t *pLib)
Definition: mioApi.c:52
void Mio_UpdateGenlib(Mio_Library_t *pLib)
FUNCTION DEFINITIONS ///.
Definition: mio.c:124
float Mio_LibraryReadAreaInv(Mio_Library_t *pLib)
Definition: mioApi.c:60
int Mio_GateReadValue(Mio_Gate_t *pGate)
Definition: mioApi.c:156
word Mio_GateReadTruth(Mio_Gate_t *pGate)
Definition: mioApi.c:154
float Mio_LibraryReadDelayInvFall(Mio_Library_t *pLib)
Definition: mioApi.c:54
word uTruth
Definition: mio.h:50
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition: mioApi.c:179
word Mio_DeriveTruthTable6(Mio_Gate_t *pGate)
Definition: mioUtils.c:514
float Mio_LibraryReadDelayNand2Fall(Mio_Library_t *pLib)
Definition: mioApi.c:57
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition: mioApi.c:43
void Mio_GateDelete(Mio_Gate_t *pGate)
Definition: mioUtils.c:81
char * Mio_GateReadForm(Mio_Gate_t *pGate)
Definition: mioApi.c:146
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition: mioApi.c:50
Mio_Gate_t * Mio_LibraryReadNand2(Mio_Library_t *pLib)
Definition: mioApi.c:51
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition: mioApi.c:151
void Mio_PinDelete(Mio_Pin_t *pPin)
Definition: mioUtils.c:108
Mio_Library_t * Abc_SclDeriveGenlib(void *pScl, float Slew, float Gain, int nGatesMin, int fVerbose)
Definition: sclLibUtil.c:818
unsigned nFanins
Definition: mio.h:53
void Mio_GateSetValue(Mio_Gate_t *pGate, int Value)
Definition: mioApi.c:157
unsigned Id
Definition: mio.h:52
Definition: st.h:52
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Mio_Pin_t * Mio_PinDup(Mio_Pin_t *pPin)
Definition: mioUtils.c:125
void Mio_LibraryMultiArea(Mio_Library_t *pLib, double Multi)
Definition: mioUtils.c:829
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
float Mio_LibraryReadDelayAnd2Max(Mio_Library_t *pLib)
Definition: mioApi.c:59
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
Definition: mioUtils.c:608
float Mio_LibraryReadDelayInvRise(Mio_Library_t *pLib)
Definition: mioApi.c:53
void Mio_WriteLibrary(FILE *pFile, Mio_Library_t *pLib, int fPrintSops)
Definition: mioUtils.c:251
void Mio_LibraryTransferDelays(Mio_Library_t *pLibD, Mio_Library_t *pLibS)
Definition: mioUtils.c:872
double Mio_GateReadArea(Mio_Gate_t *pGate)
Definition: mioApi.c:145
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
Definition: mioApi.c:150
char * Mio_LibraryReadSopByName(Mio_Library_t *pLib, char *pName)
Definition: mioApi.c:124
Mio_Gate_t ** Mio_LibraryReadGateArray(Mio_Library_t *pLib)
Definition: mioApi.c:46
float Mio_LibraryReadDelayInvMax(Mio_Library_t *pLib)
Definition: mioApi.c:55
float Area
Definition: mio.h:51
double Mio_GateReadDelayMax(Mio_Gate_t *pGate)
Definition: mioApi.c:152
Mio_Library_t * Abc_SclDeriveGenlibSimple(void *pScl)
Definition: sclLibUtil.c:710
double Mio_PinReadDelayFanoutFall(Mio_Pin_t *pPin)
Definition: mioApi.c:177
char * Mio_ReadFile(char *FileName, int fAddEnd)
Definition: mioRead.c:111
float Mio_LibraryReadDelayNand2Rise(Mio_Library_t *pLib)
Definition: mioApi.c:56
double Mio_PinReadDelayBlockMax(Mio_Pin_t *pPin)
Definition: mioApi.c:178
Mio_Gate_t ** Mio_CollectRoots(Mio_Library_t *pLib, int nInputs, float tDelay, int fSkipInv, int *pnGates, int fVerbose)
Definition: mioUtils.c:302
Mio_Cell_t * Mio_CollectRootsNew(Mio_Library_t *pLib, int nInputs, int *pnGates, int fVerbose)
Definition: mioUtils.c:404
Mio_PinPhase_t Mio_PinReadPhase(Mio_Pin_t *pPin)
Definition: mioApi.c:171
double Mio_PinReadDelayBlockRise(Mio_Pin_t *pPin)
Definition: mioApi.c:174
Mio_Cell_t * Mio_CollectRootsNewDefault(int nInputs, int *pnGates, int fVerbose)
Definition: mioUtils.c:498
float Mio_LibraryReadAreaNand2(Mio_Library_t *pLib)
Definition: mioApi.c:62
Mio_Gate_t * Mio_GateReadNext(Mio_Gate_t *pGate)
Definition: mioApi.c:149
void Mio_DeriveGateDelays(Mio_Gate_t *pGate, float **ptPinDelays, int nPins, int nInputs, float tDelayZero, float *ptDelaysRes, float *ptPinDelayMax)
Definition: mioUtils.c:725
int Mio_LibraryReadGateNameMax(Mio_Library_t *pLib)
Definition: mioApi.c:75
int Mio_LibraryReadExclude(char *ExcludeFile, st__table *tExcludeGate)
Definition: mioRead.c:654
double Mio_PinReadDelayFanoutRise(Mio_Pin_t *pPin)
Definition: mioApi.c:175
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition: mioApi.c:49
float Delays[6]
Definition: mio.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition: mioApi.c:153
int Mio_LibraryReadGateNum(Mio_Library_t *pLib)
Definition: mioApi.c:44