[14] | 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 | |
---|
| 58 | typedef struct IoSymValueStruct IoSymValue_t; |
---|
| 59 | typedef struct IoParsedTableStruct IoPTable_t; |
---|
| 60 | typedef struct IoSubcktStruct IoSubckt_t; |
---|
| 61 | typedef struct IoBlifInfoStruct IoBlifInfo_t; |
---|
| 62 | typedef struct IoVarEncEntryStruct IoVarEncEntry_t; |
---|
| 63 | typedef 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 | ******************************************************************************/ |
---|
| 78 | typedef 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 | ******************************************************************************/ |
---|
| 101 | struct 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 | ******************************************************************************/ |
---|
| 118 | struct 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 | ******************************************************************************/ |
---|
| 136 | struct 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 | ******************************************************************************/ |
---|
| 152 | struct 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 | ******************************************************************************/ |
---|
| 176 | struct 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 | ******************************************************************************/ |
---|
| 191 | struct IoVarEncEntryStruct { |
---|
| 192 | Var_Variable_t *variable; |
---|
| 193 | int index; |
---|
| 194 | int numEncBits; |
---|
| 195 | }; |
---|
| 196 | |
---|
| 197 | /*---------------------------------------------------------------------------*/ |
---|
| 198 | /* Variable declarations */ |
---|
| 199 | /*---------------------------------------------------------------------------*/ |
---|
| 200 | |
---|
| 201 | extern int globalLineNumber; |
---|
| 202 | extern Hrc_Manager_t *globalYaccHmgr; |
---|
| 203 | extern Hrc_Model_t *globalModel; |
---|
| 204 | extern Hrc_Node_t *globalHnode; |
---|
| 205 | extern Hrc_Model_t *globalFirstModel; |
---|
| 206 | extern Hrc_Model_t *globalRootModel; |
---|
| 207 | extern char *globalRootInstanceName; |
---|
| 208 | extern array_t *globalMvNameArray; |
---|
| 209 | extern array_t *globalSymValueArray; |
---|
| 210 | extern array_t *globalTableInputArray; |
---|
| 211 | extern array_t *globalTableOutputArray; |
---|
| 212 | extern array_t *globalTableDefaultArray; |
---|
| 213 | extern array_t *globalTableSymCubeArray; |
---|
| 214 | extern array_t *globalFormalNameArray; |
---|
| 215 | extern array_t *globalActualNameArray; |
---|
| 216 | extern array_t *globalSubcktArray; |
---|
| 217 | extern array_t *globalResetArray; |
---|
| 218 | extern array_t *globalNewModelArray; |
---|
| 219 | extern st_table *globalParserResetInfo; |
---|
| 220 | extern st_table *globalParserSubcktInfo; |
---|
| 221 | |
---|
| 222 | |
---|
| 223 | /*---------------------------------------------------------------------------*/ |
---|
| 224 | /* Macro declarations */ |
---|
| 225 | /*---------------------------------------------------------------------------*/ |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | /**AutomaticStart*************************************************************/ |
---|
| 229 | |
---|
| 230 | /*---------------------------------------------------------------------------*/ |
---|
| 231 | /* Function prototypes */ |
---|
| 232 | /*---------------------------------------------------------------------------*/ |
---|
| 233 | |
---|
| 234 | EXTERN boolean IoNetworkTestConsistency(Hrc_Manager_t *hmgr, array_t *modelArray, st_table *parserSubcktInfo, st_table *parserResetInfo, boolean isVerbose); |
---|
| 235 | EXTERN Var_Variable_t * IoVariableFindOrAllocByName(Hrc_Node_t *hnode, char *name); |
---|
| 236 | EXTERN int IoAtoi(char *string); |
---|
| 237 | EXTERN void IoStringArrayFree(array_t *array); |
---|
| 238 | EXTERN void IoNameInsertInArray(array_t **arrayPtrPtr, char *name); |
---|
| 239 | EXTERN void IoSymValueInsertInArray(array_t **arrayPtrPtr, IoSymValue_t *value); |
---|
| 240 | EXTERN void IoSymCubeInsertInArray(array_t **arrayPtrPtr, array_t *symCube); |
---|
| 241 | EXTERN boolean IoInputProcess(Hrc_Node_t *hnode, char *name); |
---|
| 242 | EXTERN boolean IoOutputProcess(Hrc_Node_t *hnode, char *name); |
---|
| 243 | EXTERN boolean IoMvProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, array_t *varNames, int range, array_t *symValues); |
---|
| 244 | EXTERN boolean IoLatchProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, char *latchInput, char *latchOutput); |
---|
| 245 | EXTERN boolean IoTableProcess(Hrc_Model_t *model, Hrc_Node_t *hnode, array_t *inputArray, array_t *outputArray, array_t *defaultArray, array_t *symCubeArray); |
---|
| 246 | EXTERN 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); |
---|
| 247 | EXTERN boolean IoSubcktProcess(array_t **subcktArray, Hrc_Model_t *model, Hrc_Node_t *hnode, char *modelName, char *instanceName, array_t *formalNameArray, array_t *actualNameArray); |
---|
| 248 | EXTERN void IoError(void); |
---|
| 249 | EXTERN boolean _IoNodeTestCompatibility(Hrc_Manager_t *hmgr, Hrc_Node_t *hnode1, Hrc_Node_t *hnode2); |
---|
| 250 | EXTERN Tbl_Table_t * IoPTableTransformToTable(Hrc_Model_t *model, Hrc_Node_t *hnode, IoPTable_t *pTable); |
---|
| 251 | EXTERN IoSymValue_t * IoSymValueAlloc(void); |
---|
| 252 | EXTERN void IoSymValueArrayFree(array_t *valueArray); |
---|
| 253 | EXTERN void IoBlifMvWrite(FILE *fp, Hrc_Manager_t *hmgr); |
---|
| 254 | EXTERN void IoMvPrint(FILE *fp, Var_Variable_t *var); |
---|
| 255 | EXTERN void IoMvPrintSpecial(FILE *fp, Var_Variable_t *var); |
---|
| 256 | EXTERN void IoSmvWrite(FILE *fp, Hrc_Manager_t *hmgr); |
---|
| 257 | EXTERN void IoSmvPrint(FILE *fp, Var_Variable_t *var); |
---|
| 258 | EXTERN void IoSmvPrintSpecial(FILE *fp, Var_Variable_t *var); |
---|
| 259 | EXTERN IoVarEncEntry_t *IoFindSmallestCode(IoBlifInfo_t *blifInfo); |
---|
| 260 | EXTERN array_t *IoMakeBinaryRangesArray(Tbl_Entry_t *entry, int colnum, IoBlifInfo_t *blifInfo); |
---|
| 261 | EXTERN Tbl_Table_t *IoMakeSingleOutputTable(Tbl_Table_t *table, int i); |
---|
| 262 | EXTERN int IoBlifWriteInputs(Hrc_Node_t *hnode, FILE *fp, st_table *blifInputsStTable, int combinationalOnly, int makeLatchIOsPOs); |
---|
| 263 | EXTERN int IoBlifWriteOutputs(Hrc_Node_t *hnode, FILE *fp, st_table *blifOutputsStTable, int combinationalOnly, int makeLatchIOsPOs); |
---|
| 264 | EXTERN void IoChangeBlifmvTableRows(IoBlifInfo_t *blifInfo, IoVarEncEntry_t *varEnc, int row1, int row2); |
---|
| 265 | EXTERN void IoChangeBlifmvTableEntries(IoBlifInfo_t *blifInfo, int rownum, int numValues, IoVarEncEntry_t *varEnc, array_t *MvOutputArray); |
---|
| 266 | EXTERN void IoChangeEncTableEntries(IoBlifInfo_t *blifInfo, st_table *blifInputsStTable, IoVarEncEntry_t *varEnc, int numValues); |
---|
| 267 | EXTERN void IoEncWriteBinToMvTables(Hrc_Node_t *hnode, FILE *encFp, st_table *encOutputsStTable, st_table *encInputsStTable, int combinationalOnly, int makeLatchIOsPOs); |
---|
| 268 | EXTERN void IoEncWriteMvToBinTables(Hrc_Node_t *hnode, FILE *encFp, st_table *encOutputsStTable, st_table *encInputsStTable, int combinationalOnly); |
---|
| 269 | EXTERN void IoEncodeVariable(IoBlifInfo_t *blifInfo, Var_Variable_t *var, int varNum, int output); |
---|
| 270 | EXTERN void IoFreeBlifInfo(IoBlifInfo_t *blifInfo); |
---|
| 271 | EXTERN void IoIncreaseCodeSize(IoVarEncEntry_t *varEnc, int numValues, int verbosity); |
---|
| 272 | EXTERN void IoInitBlifInfo(IoBlifInfo_t *blifInfo, Tbl_Table_t *origBlifmvTable, FILE *fp, FILE *encFp, int verbosity); |
---|
| 273 | EXTERN void IoInvertBinTableOutput(IoBlifInfo_t * blifInfo, int colnumToInvert); |
---|
| 274 | EXTERN int IoLog(int n); |
---|
| 275 | EXTERN void IoMvCheckPrint(FILE *fp, Var_Variable_t *var, st_table *printedMvsStTable); |
---|
| 276 | EXTERN void IoMvCheckPrintSpecial(FILE *fp, Var_Variable_t *var, st_table *printedMvsStTable); |
---|
| 277 | EXTERN int IoNumBinVars(int colnum, array_t *encTblArray); |
---|
| 278 | EXTERN int IoNumDigits(int n); |
---|
| 279 | EXTERN int IoNumEncBits(int n); |
---|
| 280 | EXTERN int IoNumValuesFromBinRangesArray(int colnum, array_t *binRangesArray); |
---|
| 281 | EXTERN boolean IoOutputExpansionRequired(Tbl_Table_t *table); |
---|
| 282 | EXTERN boolean IoVarIsHnodePIO(Hrc_Node_t *hnode, Var_Variable_t *var); |
---|
| 283 | EXTERN void IoWriteBinTablesToFile(IoBlifInfo_t *blifInfo); |
---|
| 284 | EXTERN int IoWriteExpandedValueToBinTable(Tbl_Table_t *binTable, int rootRow, int rootCol, IoBinRangeEntry_t *binRangeEntry, int entryRepetitionCount, int numBits, int output); |
---|
| 285 | EXTERN 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 | |
---|
| 290 | EXTERN int IoYyparse(void); |
---|
| 291 | EXTERN 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 | |
---|