source: vis_dev/vis-2.3/src/io/ioInt.h @ 99

Last change on this file since 99 was 14, checked in by cecile, 13 years ago

vis2.3

File size: 12.3 KB
Line 
1/**CHeaderFile*****************************************************************
2
3  FileName    [ioInt.h]
4
5  PackageName [io]
6
7  Synopsis    [Internal declarations of the I/O package.]
8
9  Description []
10
11  SeeAlso     []
12
13  Author      [Yuji Kukimoto, Sunil P. Khatri, Rajeev Ranjan, Huey-Yih Wang]
14
15  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
16  All rights reserved.
17
18  Permission is hereby granted, without written agreement and without license
19  or royalty fees, to use, copy, modify, and distribute this software and its
20  documentation for any purpose, provided that the above copyright notice and
21  the following two paragraphs appear in all copies of this software.
22
23  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
24  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
25  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
26  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
29  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
30  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
31  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
32  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
33
34  Revision    [$Id: ioInt.h,v 1.10 2004/07/16 00:05:26 wangc Exp $]
35
36******************************************************************************/
37
38#ifndef _IOINT
39#define _IOINT
40
41#include "var.h"
42#include "tbl.h"
43#include "io.h"
44#include "cmd.h"
45#include "ord.h"
46#include "ntk.h"
47#include "ntm.h"
48#include <string.h>
49
50/*---------------------------------------------------------------------------*/
51/* Constant declarations                                                     */
52/*---------------------------------------------------------------------------*/
53
54/*---------------------------------------------------------------------------*/
55/* Type declarations                                                         */
56/*---------------------------------------------------------------------------*/
57
58typedef struct IoSymValueStruct IoSymValue_t;
59typedef struct IoParsedTableStruct IoPTable_t;
60typedef struct IoSubcktStruct IoSubckt_t;
61typedef struct IoBlifInfoStruct IoBlifInfo_t;
62typedef struct IoVarEncEntryStruct IoVarEncEntry_t;
63typedef struct IoBinRangeEntryStruct IoBinRangeEntry_t;
64
65/*---------------------------------------------------------------------------*/
66/* Stucture declarations                                                     */
67/*---------------------------------------------------------------------------*/
68
69/**Enum************************************************************************
70
71  Synopsis    [Types of a node in the tree data structure for a table.]
72
73  Description []
74
75  SeeAlso     []
76
77******************************************************************************/
78typedef enum {
79  IoLeaf_c,
80  IoRange_c,
81  IoComplement_c,
82  IoList_c,
83  IoAssign_c,
84  IoUniverse_c
85} IoSymValueType;
86
87
88/**Struct**********************************************************************
89
90  Synopsis    [A tree representation of a table. This structure is used
91  to represent a node in the tree. The parser translates
92  tables represented in IoParsedTable_t to this data structure so that
93  it is easy to construct the table data structure Tbl_Table_t
94  corresponding to the table.]
95
96  Description []
97
98  SeeAlso     []
99
100******************************************************************************/
101struct IoSymValueStruct {
102  IoSymValueType flag;
103  struct IoSymValueStruct *left;
104  struct IoSymValueStruct *right;
105  array_t *elements;    /* array_t of SymValueStruct * */
106};
107
108/**Struct**********************************************************************
109
110  Synopsis    [A temporary data structure to keep the textual information
111  on tables. Only used in the parser. ]
112
113  Description []
114
115  SeeAlso     []
116
117******************************************************************************/
118struct IoParsedTableStruct {
119  array_t *inputs;  /* array of table input names */
120  array_t *outputs;  /* array of table output names */
121  array_t *cubes; /* array of array_t *, each array_t is a symCube */
122  array_t *defaultOutput; /* this field is a single symCube */
123};
124
125
126/**Struct**********************************************************************
127
128  Synopsis    [A temporary data structure to keep the textual information
129  on subcircuits. Only used in the parser.]
130
131  Description []
132
133  SeeAlso     []
134
135******************************************************************************/
136struct IoSubcktStruct {
137  char *modelName;
138  char *instanceName;
139  array_t *formalNameArray;
140  array_t *actualNameArray;
141};
142
143/**Struct**********************************************************************
144
145  Synopsis    [info for write blif]
146
147  Description []
148
149  SeeAlso     []
150
151******************************************************************************/
152struct IoBlifInfoStruct {
153  Tbl_Table_t *blifmvTable;
154  Tbl_Table_t *binTable;
155  array_t *inputEncTblArray;
156  array_t *outputEncTblArray;
157  array_t *varArray;
158  array_t *binTblArray;
159  array_t *dcTblArray;
160  int verbosity;
161  boolean pseudoinputFlag;
162  FILE *EncFp;
163  FILE *BlifFp;
164};
165
166/**Struct**********************************************************************
167
168  Synopsis    [Binary ranges structure, for binary entries compaction
169               in write_blif ]
170
171  Description []
172
173  SeeAlso     []
174
175******************************************************************************/
176struct IoBinRangeEntryStruct {
177    int startValue;
178    int runLength;
179    int skipLength;
180};
181
182/**Struct**********************************************************************
183
184  Synopsis    [info for encoding variablen]
185
186  Description []
187
188  SeeAlso     []
189
190******************************************************************************/
191struct IoVarEncEntryStruct {
192    Var_Variable_t *variable;
193    int index;
194    int numEncBits;
195};
196
197/*---------------------------------------------------------------------------*/
198/* Variable declarations                                                     */
199/*---------------------------------------------------------------------------*/
200
201extern int globalLineNumber;
202extern Hrc_Manager_t *globalYaccHmgr;
203extern Hrc_Model_t *globalModel;
204extern Hrc_Node_t *globalHnode;
205extern Hrc_Model_t *globalFirstModel;
206extern Hrc_Model_t *globalRootModel;
207extern char *globalRootInstanceName;
208extern array_t *globalMvNameArray;
209extern array_t *globalSymValueArray;
210extern array_t *globalTableInputArray;
211extern array_t *globalTableOutputArray;
212extern array_t *globalTableDefaultArray;
213extern array_t *globalTableSymCubeArray;
214extern array_t *globalFormalNameArray;
215extern array_t *globalActualNameArray;
216extern array_t *globalSubcktArray;
217extern array_t *globalResetArray;
218extern array_t *globalNewModelArray;
219extern st_table *globalParserResetInfo;
220extern st_table *globalParserSubcktInfo;
221
222
223/*---------------------------------------------------------------------------*/
224/* Macro declarations                                                        */
225/*---------------------------------------------------------------------------*/
226
227
228/**AutomaticStart*************************************************************/
229
230/*---------------------------------------------------------------------------*/
231/* Function prototypes                                                       */
232/*---------------------------------------------------------------------------*/
233
234EXTERN boolean IoNetworkTestConsistency(Hrc_Manager_t *hmgr, array_t *modelArray, st_table *parserSubcktInfo, st_table *parserResetInfo, boolean isVerbose);
235EXTERN Var_Variable_t * IoVariableFindOrAllocByName(Hrc_Node_t *hnode, char *name);
236EXTERN int IoAtoi(char *string);
237EXTERN void IoStringArrayFree(array_t *array);
238EXTERN void IoNameInsertInArray(array_t **arrayPtrPtr, char *name);
239EXTERN void IoSymValueInsertInArray(array_t **arrayPtrPtr, IoSymValue_t *value);
240EXTERN void IoSymCubeInsertInArray(array_t **arrayPtrPtr, array_t *symCube);
241EXTERN boolean IoInputProcess(Hrc_Node_t *hnode, char *name);
242EXTERN boolean IoOutputProcess(Hrc_Node_t *hnode, char *name);
243EXTERN boolean IoMvProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, array_t *varNames, int range, array_t *symValues);
244EXTERN boolean IoLatchProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, char *latchInput, char *latchOutput);
245EXTERN boolean IoTableProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, array_t *inputArray, array_t *outputArray, array_t *defaultArray, array_t *symCubeArray);
246EXTERN boolean IoResetProcess(array_t **resetArray, Hrc_Model_t *model, Hrc_Node_t *hnode, array_t *inputArray, array_t *outputArray, array_t *defaultArray, array_t *symCubeArray);
247EXTERN boolean IoSubcktProcess(array_t **subcktArray, Hrc_Model_t *model, Hrc_Node_t *hnode, char *modelName, char *instanceName, array_t *formalNameArray, array_t *actualNameArray);
248EXTERN void IoError(void);
249EXTERN boolean _IoNodeTestCompatibility(Hrc_Manager_t *hmgr, Hrc_Node_t *hnode1, Hrc_Node_t *hnode2);
250EXTERN Tbl_Table_t * IoPTableTransformToTable(Hrc_Model_t *model, Hrc_Node_t *hnode, IoPTable_t *pTable);
251EXTERN IoSymValue_t * IoSymValueAlloc(void);
252EXTERN void IoSymValueArrayFree(array_t *valueArray);
253EXTERN void IoBlifMvWrite(FILE *fp, Hrc_Manager_t *hmgr);
254EXTERN void IoMvPrint(FILE *fp, Var_Variable_t *var);
255EXTERN void IoMvPrintSpecial(FILE *fp, Var_Variable_t *var);
256EXTERN void IoSmvWrite(FILE *fp, Hrc_Manager_t *hmgr);
257EXTERN void IoSmvPrint(FILE *fp, Var_Variable_t *var);
258EXTERN void IoSmvPrintSpecial(FILE *fp, Var_Variable_t *var);
259EXTERN IoVarEncEntry_t *IoFindSmallestCode(IoBlifInfo_t *blifInfo);
260EXTERN array_t *IoMakeBinaryRangesArray(Tbl_Entry_t *entry, int colnum, IoBlifInfo_t *blifInfo);
261EXTERN Tbl_Table_t *IoMakeSingleOutputTable(Tbl_Table_t *table, int i);
262EXTERN int IoBlifWriteInputs(Hrc_Node_t *hnode, FILE *fp, st_table *blifInputsStTable, int combinationalOnly, int makeLatchIOsPOs);
263EXTERN int IoBlifWriteOutputs(Hrc_Node_t *hnode, FILE *fp, st_table *blifOutputsStTable, int combinationalOnly, int makeLatchIOsPOs);
264EXTERN void IoChangeBlifmvTableRows(IoBlifInfo_t *blifInfo, IoVarEncEntry_t *varEnc, int row1, int row2);
265EXTERN void IoChangeBlifmvTableEntries(IoBlifInfo_t *blifInfo, int rownum, int numValues, IoVarEncEntry_t *varEnc, array_t *MvOutputArray);
266EXTERN void IoChangeEncTableEntries(IoBlifInfo_t *blifInfo, st_table *blifInputsStTable, IoVarEncEntry_t *varEnc, int numValues);
267EXTERN void IoEncWriteBinToMvTables(Hrc_Node_t *hnode, FILE *encFp, st_table *encOutputsStTable, st_table *encInputsStTable, int combinationalOnly, int makeLatchIOsPOs);
268EXTERN void IoEncWriteMvToBinTables(Hrc_Node_t *hnode, FILE *encFp, st_table *encOutputsStTable, st_table *encInputsStTable, int combinationalOnly);
269EXTERN void IoEncodeVariable(IoBlifInfo_t *blifInfo, Var_Variable_t *var, int varNum, int output);
270EXTERN void IoFreeBlifInfo(IoBlifInfo_t *blifInfo);
271EXTERN void IoIncreaseCodeSize(IoVarEncEntry_t *varEnc, int numValues, int verbosity);
272EXTERN void IoInitBlifInfo(IoBlifInfo_t *blifInfo, Tbl_Table_t *origBlifmvTable, FILE *fp, FILE *encFp, int verbosity);
273EXTERN void IoInvertBinTableOutput(IoBlifInfo_t * blifInfo, int colnumToInvert);
274EXTERN int IoLog(int n);
275EXTERN void IoMvCheckPrint(FILE *fp, Var_Variable_t *var, st_table *printedMvsStTable);
276EXTERN void IoMvCheckPrintSpecial(FILE *fp, Var_Variable_t *var, st_table *printedMvsStTable);
277EXTERN int IoNumBinVars(int colnum, array_t *encTblArray);
278EXTERN int IoNumDigits(int n);
279EXTERN int IoNumEncBits(int n);
280EXTERN int IoNumValuesFromBinRangesArray(int colnum, array_t *binRangesArray);
281EXTERN boolean IoOutputExpansionRequired(Tbl_Table_t *table);
282EXTERN boolean IoVarIsHnodePIO(Hrc_Node_t *hnode, Var_Variable_t *var);
283EXTERN void IoWriteBinTablesToFile(IoBlifInfo_t *blifInfo);
284EXTERN int IoWriteExpandedValueToBinTable(Tbl_Table_t *binTable, int rootRow, int rootCol, IoBinRangeEntry_t *binRangeEntry, int entryRepetitionCount, int numBits, int output);
285EXTERN void IoWriteLatches(Hrc_Node_t *hnode, FILE *fp, FILE *encFp, st_table *printedMvsStTable, st_table *blifOutputsStTable, st_table *blifInputsStTable, st_table *encOutputsStTable, st_table *encInputsStTable, int combinationalOnly, int makeLatchIOsPOs, int verbosity);
286
287
288/**AutomaticEnd***************************************************************/
289
290EXTERN int IoYyparse(void);
291EXTERN void IoYyrestart(FILE *);
292
293#endif /* _ */
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
Note: See TracBrowser for help on using the repository browser.