1 /**CFile****************************************************************
2 
3   FileName    [mioInt.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: mioInt.h,v 1.4 2004/06/28 14:20:25 alanmi Exp $]
16 
17 ***********************************************************************/
18 
19 #ifndef ABC__map__mio__mioInt_h
20 #define ABC__map__mio__mioInt_h
21 
22 
23 ////////////////////////////////////////////////////////////////////////
24 ///                          INCLUDES                                ///
25 ////////////////////////////////////////////////////////////////////////
26 
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <assert.h>
31 #include "misc/vec/vec.h"
32 #include "misc/mem/mem.h"
33 #include "misc/st/st.h"
34 #include "mio.h"
35 
36 ABC_NAMESPACE_HEADER_START
37 
38 
39 ////////////////////////////////////////////////////////////////////////
40 ///                         PARAMETERS                               ///
41 ////////////////////////////////////////////////////////////////////////
42 
43 #define    MIO_STRING_GATE       "GATE"
44 #define    MIO_STRING_LATCH      "LATCH"
45 #define    MIO_STRING_PIN        "PIN"
46 #define    MIO_STRING_NONINV     "NONINV"
47 #define    MIO_STRING_INV        "INV"
48 #define    MIO_STRING_UNKNOWN    "UNKNOWN"
49 
50 #define    MIO_STRING_CONST0     "CONST0"
51 #define    MIO_STRING_CONST1     "CONST1"
52 
53 // the bit masks
54 #define    MIO_MASK(n)         ((~((unsigned)0)) >> (32-(n)))
55 #define    MIO_FULL             (~((unsigned)0))
56 
57 ////////////////////////////////////////////////////////////////////////
58 ///                    STRUCTURE DEFINITIONS                         ///
59 ////////////////////////////////////////////////////////////////////////
60 
61 struct  Mio_LibraryStruct_t_
62 {
63     char *             pName;       // the name of the library
64     int                nGates;      // the number of the gates
65     Mio_Gate_t **      ppGates0;    // the array of gates in the original order
66     Mio_Gate_t **      ppGatesName; // the array of gates sorted by name
67     Mio_Gate_t *       pGates;      // the linked list of all gates in no particular order
68     Mio_Gate_t *       pGate0;      // the constant zero gate
69     Mio_Gate_t *       pGate1;      // the constant one gate
70     Mio_Gate_t *       pGateBuf;    // the buffer
71     Mio_Gate_t *       pGateInv;    // the inverter
72     Mio_Gate_t *       pGateNand2;  // the NAND2 gate
73     Mio_Gate_t *       pGateAnd2;   // the AND2 gate
74     Mio_Gate_t *       pGateNor2;   // the NOR2 gate
75     Mio_Gate_t *       pGateOr2;    // the OR2 gate
76     st__table *         tName2Gate;  // the mapping of gate names into their pointer
77     Mem_Flex_t *       pMmFlex;     // the memory manaqer for SOPs
78     Vec_Str_t *        vCube;       // temporary cube
79     // matching
80     int                fPinFilter;  // pin filtering
81     int                fPinPerm;    // pin permutation
82     int                fPinQuick;   // pin permutation
83     Vec_Mem_t *        vTtMem;      // truth tables
84     Vec_Wec_t *        vTt2Match;   // matches for truth tables
85     Mio_Cell2_t *      pCells;      // library gates
86     int                nCells;      // library gate count
87     Vec_Ptr_t *        vNames;
88     Vec_Wrd_t *        vTruths;
89     Vec_Int_t *        vTt2Match4;
90     Vec_Int_t *        vConfigs;
91     Vec_Mem_t *        vTtMem2[3];
92     Vec_Int_t *        vTt2Match2[3];
93 };
94 
95 struct  Mio_GateStruct_t_
96 {
97     // information derived from the genlib file
98     char *             pName;       // the name of the gate
99     double             dArea;       // the area of the gate
100     char *             pForm;       // the formula describing functionality of the gate
101     Mio_Pin_t *        pPins;       // the linked list of all pins (one pin if info is the same)
102     char *             pOutName;    // the name of the output pin
103     // the library to which this gate belongs
104     Mio_Library_t *    pLib;
105     // the next gate in the list
106     Mio_Gate_t *       pNext;
107     Mio_Gate_t *       pTwin;
108 
109     // the derived information
110     int                Cell;        // cell id
111     int                nInputs;     // the number of inputs
112     int                Profile;     // the number of occurrences
113     int                Profile2;    // the number of occurrences
114     double             dDelayMax;   // the maximum delay
115     char *             pSop;        // sum-of-products
116     Vec_Int_t *        vExpr;       // boolean expression
117     union { word       uTruth;      // truth table
118     word *             pTruth; };   // pointer to the truth table
119     int                Value;       // user's information
120 };
121 
122 struct  Mio_PinStruct_t_
123 {
124     char *             pName;
125     Mio_PinPhase_t     Phase;
126     double             dLoadInput;
127     double             dLoadMax;
128     double             dDelayBlockRise;
129     double             dDelayFanoutRise;
130     double             dDelayBlockFall;
131     double             dDelayFanoutFall;
132     double             dDelayBlockMax;
133     Mio_Pin_t *        pNext;
134 };
135 
136 
137 ////////////////////////////////////////////////////////////////////////
138 ///                       GLOBAL VARIABLES                           ///
139 ////////////////////////////////////////////////////////////////////////
140 
141 ////////////////////////////////////////////////////////////////////////
142 ///                       MACRO DEFINITIONS                          ///
143 ////////////////////////////////////////////////////////////////////////
144 
145 ////////////////////////////////////////////////////////////////////////
146 ///                     FUNCTION DEFINITIONS                         ///
147 ////////////////////////////////////////////////////////////////////////
148 
149 /*=== mio.c =============================================================*/
150 /*=== mioRead.c =============================================================*/
151 /*=== mioUtils.c =============================================================*/
152 
153 
154 ABC_NAMESPACE_HEADER_END
155 
156 #endif
157 
158 ////////////////////////////////////////////////////////////////////////
159 ///                       END OF FILE                                ///
160 ////////////////////////////////////////////////////////////////////////
161