[14] | 1 | /**CHeaderFile***************************************************************** |
---|
| 2 | |
---|
| 3 | FileName [partInt.h] |
---|
| 4 | |
---|
| 5 | PackageName [part] |
---|
| 6 | |
---|
| 7 | Synopsis [Internal data type definitions and macros to handle the |
---|
| 8 | structures of the partition package.] |
---|
| 9 | |
---|
| 10 | Author [Abelardo Pardo] |
---|
| 11 | |
---|
| 12 | Copyright [This file was created at the University of Colorado at |
---|
| 13 | Boulder. The University of Colorado at Boulder makes no warranty |
---|
| 14 | about the suitability of this software for any purpose. It is |
---|
| 15 | presented on an AS IS basis.] |
---|
| 16 | |
---|
| 17 | Revision [$Id: partInt.h,v 1.26 2005/04/16 06:14:54 fabio Exp $] |
---|
| 18 | |
---|
| 19 | ******************************************************************************/ |
---|
| 20 | |
---|
| 21 | #ifndef _PARTINT |
---|
| 22 | #define _PARTINT |
---|
| 23 | |
---|
| 24 | #include <string.h> |
---|
| 25 | #include <time.h> |
---|
| 26 | #include "ntm.h" |
---|
| 27 | #include "ord.h" |
---|
| 28 | #include "cmd.h" |
---|
| 29 | #include "part.h" |
---|
| 30 | #include "img.h" |
---|
| 31 | #include "mc.h" |
---|
| 32 | |
---|
| 33 | /*---------------------------------------------------------------------------*/ |
---|
| 34 | /* Constant declarations */ |
---|
| 35 | /*---------------------------------------------------------------------------*/ |
---|
| 36 | #define PART_SUB_CON_FACTOR 2 |
---|
| 37 | #define PART_SUB_COR_FACTOR 4 |
---|
| 38 | #define PART_SUB_AFF_FACTOR 0.5 |
---|
| 39 | #define BIG_NUMBER 10000 |
---|
| 40 | |
---|
| 41 | /*---------------------------------------------------------------------------*/ |
---|
| 42 | /* Structure declarations */ |
---|
| 43 | /*---------------------------------------------------------------------------*/ |
---|
| 44 | /**Struct********************************************************************** |
---|
| 45 | |
---|
| 46 | Synopsis [Information stored in the graph representing the partition.] |
---|
| 47 | |
---|
| 48 | Description [The information stored in the graph consists of the following |
---|
| 49 | fields. The name of the system from which the partition was obtained. For |
---|
| 50 | example, if the system is of type Ntk_Network_t, the name stored here is a |
---|
| 51 | copy of the network's name. The method used to obtain the partition. The |
---|
| 52 | nameToVertex table provides a associative table to find a vertex in the |
---|
| 53 | partition by giving a name. The mddIdToVertex table is another hash table to |
---|
| 54 | find a vertex in the partition given a mddId..] |
---|
| 55 | |
---|
| 56 | SeeAlso [PartVertexInfo st Part_PartitionMethod] |
---|
| 57 | |
---|
| 58 | ******************************************************************************/ |
---|
| 59 | typedef struct PartPartitionInfo { |
---|
| 60 | char *name; /* Name of the entity from which |
---|
| 61 | * the partition was obtained */ |
---|
| 62 | Part_PartitionMethod method; /* Method used to create the partition */ |
---|
| 63 | |
---|
| 64 | mdd_manager *mddManager; /* manager of mdds for the partition */ |
---|
| 65 | st_table *nameToVertex; /* Table of name to vertex */ |
---|
| 66 | st_table *mddIdToVertex; /* Table of mddId to vertex */ |
---|
| 67 | } PartPartitionInfo_t; |
---|
| 68 | |
---|
| 69 | /**Struct********************************************************************** |
---|
| 70 | |
---|
| 71 | Synopsis [Information stored in every vertex of the graph.] |
---|
| 72 | |
---|
| 73 | Description [There are two types of vertices in a partition: single and |
---|
| 74 | clustered. A single vertex in the partition graph has a name, a multi-valued |
---|
| 75 | function and eventually a MddId. A clustered vertex stores an array of |
---|
| 76 | pointer to single vertices. In general, a vertex does not need to have a |
---|
| 77 | name attached to it. There could be different heuristics for partitioning the |
---|
| 78 | system that could create <em>additional</em> vertices not related to the |
---|
| 79 | system. In these situations this name will be empty.<p> |
---|
| 80 | |
---|
| 81 | The type field stores the type of the vertex, single or clustered. The mvf |
---|
| 82 | field stores the multi-valued function associated with the vertex. The |
---|
| 83 | vertices representing the variables in the support of this function |
---|
| 84 | constitute the fanin of this vertex. The MddId is the identifier assigned to |
---|
| 85 | the variable that this vertex represents (if any). Every vertex with no |
---|
| 86 | fanout, in principle does not have any variable Id attached to it, but if |
---|
| 87 | this information exists in the original system, it may be replicated here |
---|
| 88 | also. The boolean field <tt>isClustered</tt> is used to mark the single nodes |
---|
| 89 | that are already part of some clustered vertices, to avoid a single vertex |
---|
| 90 | being part of more than one cluster.] |
---|
| 91 | |
---|
| 92 | SeeAlso [Part_VertexType PartPartitionInfo] |
---|
| 93 | |
---|
| 94 | ******************************************************************************/ |
---|
| 95 | typedef struct PartVertexInfo { |
---|
| 96 | Part_VertexType type; /* Type of vertex */ |
---|
| 97 | char *name; /* Name of the unit (if the vertex corresponds to |
---|
| 98 | * a unit in the system. If the unit is created by |
---|
| 99 | * the partition package, this pointer is NULL). |
---|
| 100 | */ |
---|
| 101 | union { |
---|
| 102 | Mvf_Function_t *mvf; /* Multi-valued function attached to the vertex */ |
---|
| 103 | array_t *clusterMembers; /* Array of vertex_t * for the clustered vertex */ |
---|
| 104 | } functionality; |
---|
| 105 | int mddId; /* Id of the variable attached to the vertex, if |
---|
| 106 | * any. */ |
---|
| 107 | boolean isClustered; /* Boolean that determines if the vertex is part |
---|
| 108 | * of a clustered vertex.*/ |
---|
| 109 | } PartVertexInfo_t; |
---|
| 110 | |
---|
| 111 | /**Struct********************************************************************** |
---|
| 112 | |
---|
| 113 | Synopsis [Information for cleating the sub-systems] |
---|
| 114 | |
---|
| 115 | SeeAlso [Part_PartitionSubsystemInfoInit |
---|
| 116 | PartBreakingBigConnectedComponent ] |
---|
| 117 | |
---|
| 118 | ******************************************************************************/ |
---|
| 119 | struct PartSubsystemInfo{ |
---|
| 120 | Ntk_Network_t *network; /* network */ |
---|
| 121 | array_t *arrayOfVertex; /* Target vertices to be decomposed into |
---|
| 122 | * sub-systems */ |
---|
| 123 | int numberOfVertex; /* total number of vertices */ |
---|
| 124 | Part_BMethod partBM; /* Breaking method */ |
---|
| 125 | int bound; /* maximum number of vertices in |
---|
| 126 | * a sub-system */ |
---|
| 127 | float threshold; /* threshold value to determine if |
---|
| 128 | * two vertices are connected or not */ |
---|
| 129 | float con_factor; /* weight factor to emphasize the mutual |
---|
| 130 | * over the single dependency between two |
---|
| 131 | * vertices */ |
---|
| 132 | float cor_factor; /* weight factor to lower the value |
---|
| 133 | * of a pair of vertices which are |
---|
| 134 | * only slightly correlated */ |
---|
| 135 | float aff_factor; /* weight factor to emphasize either |
---|
| 136 | * connectivity(aff_factor>0.5) or |
---|
| 137 | * correlation(aff_factor<0.5). */ |
---|
| 138 | int verbosity; |
---|
| 139 | int corMethod; /* method for correlation |
---|
| 140 | * 0 : use BDD correlation (default) |
---|
| 141 | * 1 : use support */ |
---|
| 142 | st_table *dupLatchTable; /* stores |
---|
| 143 | * (latchInputName, array of latchName) */ |
---|
| 144 | st_table *latchNameTable; /* stores (latchInputName, latchName) */ |
---|
| 145 | }; |
---|
| 146 | |
---|
| 147 | /**Struct********************************************************************** |
---|
| 148 | |
---|
| 149 | Synopsis [Structure for each Sub-system] |
---|
| 150 | |
---|
| 151 | SeeAlso [] |
---|
| 152 | |
---|
| 153 | ******************************************************************************/ |
---|
| 154 | struct PartSubsystem{ |
---|
| 155 | st_table *vertexNameTable; /* table containing names of latches in each |
---|
| 156 | sub-system (not a map)*/ |
---|
| 157 | array_t *subsystemFanIn; /* indices of sub-subsystems which are fanin |
---|
| 158 | * of current sub-system */ |
---|
| 159 | array_t *subsystemFanOut; /* indices of sub-subsystems which are fanout |
---|
| 160 | * of current sub-system */ |
---|
| 161 | |
---|
| 162 | }; |
---|
| 163 | |
---|
| 164 | /*---------------------------------------------------------------------------*/ |
---|
| 165 | /* Type declarations */ |
---|
| 166 | /*---------------------------------------------------------------------------*/ |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | /*---------------------------------------------------------------------------*/ |
---|
| 170 | /* Variable declarations */ |
---|
| 171 | /*---------------------------------------------------------------------------*/ |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | /*---------------------------------------------------------------------------*/ |
---|
| 175 | /* Macro declarations */ |
---|
| 176 | /*---------------------------------------------------------------------------*/ |
---|
| 177 | |
---|
| 178 | /**Macro*********************************************************************** |
---|
| 179 | |
---|
| 180 | Synopsis [Internal macro to access the name of the partition.] |
---|
| 181 | |
---|
| 182 | SideEffects [] |
---|
| 183 | |
---|
| 184 | SeeAlso [PartPartitionInfo] |
---|
| 185 | |
---|
| 186 | ******************************************************************************/ |
---|
| 187 | #define PartPartitionReadName( \ |
---|
| 188 | /* graph_t * */ pPtr /* Pointer to a graph structure */ \ |
---|
| 189 | ) \ |
---|
| 190 | ((PartPartitionInfo_t *)(pPtr)->user_data)->name |
---|
| 191 | |
---|
| 192 | /**Macro*********************************************************************** |
---|
| 193 | |
---|
| 194 | Synopsis [Internal macro to access the method used to create the partition.] |
---|
| 195 | |
---|
| 196 | SideEffects [] |
---|
| 197 | |
---|
| 198 | SeeAlso [PartPartitionInfo] |
---|
| 199 | |
---|
| 200 | ******************************************************************************/ |
---|
| 201 | #define PartPartitionReadMethod( \ |
---|
| 202 | /* graph_t * */ pPtr /* Pointer to a graph structure */ \ |
---|
| 203 | ) \ |
---|
| 204 | ((PartPartitionInfo_t *)(pPtr)->user_data)->method |
---|
| 205 | |
---|
| 206 | |
---|
| 207 | /**Macro*********************************************************************** |
---|
| 208 | |
---|
| 209 | Synopsis [Internal macro to access the MDD manager of the partition.] |
---|
| 210 | |
---|
| 211 | SideEffects [] |
---|
| 212 | |
---|
| 213 | SeeAlso [PartPartitionInfo] |
---|
| 214 | |
---|
| 215 | ******************************************************************************/ |
---|
| 216 | #define PartPartitionReadMddManager( \ |
---|
| 217 | /* graph_t * */ pPtr /* Pointer to a graph structure */ \ |
---|
| 218 | ) \ |
---|
| 219 | ((PartPartitionInfo_t *)(pPtr)->user_data)->mddManager |
---|
| 220 | |
---|
| 221 | /**Macro*********************************************************************** |
---|
| 222 | |
---|
| 223 | Synopsis [Internal macro to access the nameToVertex field of the |
---|
| 224 | partition.] |
---|
| 225 | |
---|
| 226 | SideEffects [] |
---|
| 227 | |
---|
| 228 | SeeAlso [PartPartiotionInfo] |
---|
| 229 | |
---|
| 230 | ******************************************************************************/ |
---|
| 231 | #define PartPartitionReadNameToVertex( \ |
---|
| 232 | /* graph_t * */ pPtr /* Pointer to a graph structure */ \ |
---|
| 233 | ) \ |
---|
| 234 | ((PartPartitionInfo_t *)(pPtr)->user_data)->nameToVertex |
---|
| 235 | |
---|
| 236 | /**Macro*********************************************************************** |
---|
| 237 | |
---|
| 238 | Synopsis [Internal macro to access the mddIdToVertex field of the partition.] |
---|
| 239 | |
---|
| 240 | SideEffects [] |
---|
| 241 | |
---|
| 242 | SeeAlso [PartPartitionInfo] |
---|
| 243 | |
---|
| 244 | ******************************************************************************/ |
---|
| 245 | #define PartPartitionReadMddIdToVertex( \ |
---|
| 246 | /* graph_t * */ pPtr /* Pointer to a graph structure */ \ |
---|
| 247 | ) \ |
---|
| 248 | ((PartPartitionInfo_t *)(pPtr)->user_data)->mddIdToVertex |
---|
| 249 | |
---|
| 250 | /**Macro*********************************************************************** |
---|
| 251 | |
---|
| 252 | Synopsis [Internal macro to access the type of a vertex.] |
---|
| 253 | |
---|
| 254 | SideEffects [] |
---|
| 255 | |
---|
| 256 | SeeAlso [PartVertexInfo] |
---|
| 257 | |
---|
| 258 | ******************************************************************************/ |
---|
| 259 | #define PartVertexReadType( \ |
---|
| 260 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 261 | ) \ |
---|
| 262 | ((PartVertexInfo_t *)(vPtr)->user_data)->type |
---|
| 263 | |
---|
| 264 | /**Macro*********************************************************************** |
---|
| 265 | |
---|
| 266 | Synopsis [Internal macro to access the name of a vertex.] |
---|
| 267 | |
---|
| 268 | SideEffects [] |
---|
| 269 | |
---|
| 270 | SeeAlso [PartVertexInfo] |
---|
| 271 | |
---|
| 272 | ******************************************************************************/ |
---|
| 273 | #define PartVertexReadName( \ |
---|
| 274 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 275 | ) \ |
---|
| 276 | ((PartVertexInfo_t *)(vPtr)->user_data)->name |
---|
| 277 | |
---|
| 278 | /**Macro*********************************************************************** |
---|
| 279 | |
---|
| 280 | Synopsis [Internal macro to access the clusterMembers of a vertex.] |
---|
| 281 | |
---|
| 282 | SideEffects [] |
---|
| 283 | |
---|
| 284 | SeeAlso [PartVertexInfo]] |
---|
| 285 | |
---|
| 286 | ******************************************************************************/ |
---|
| 287 | #define PartVertexReadClusterMembers( \ |
---|
| 288 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 289 | ) \ |
---|
| 290 | ((PartVertexInfo_t *)(vPtr)->user_data)->functionality.clusterMembers |
---|
| 291 | |
---|
| 292 | |
---|
| 293 | /**Macro*********************************************************************** |
---|
| 294 | |
---|
| 295 | Synopsis [Internal macro to access the multi-valued function of a |
---|
| 296 | vertex.] |
---|
| 297 | |
---|
| 298 | SideEffects [] |
---|
| 299 | |
---|
| 300 | SeeAlso [PartVertexInfo] |
---|
| 301 | |
---|
| 302 | ******************************************************************************/ |
---|
| 303 | #define PartVertexReadFunction( \ |
---|
| 304 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 305 | ) \ |
---|
| 306 | ((PartVertexInfo_t *)(vPtr)->user_data)->functionality.mvf |
---|
| 307 | |
---|
| 308 | /**Macro*********************************************************************** |
---|
| 309 | |
---|
| 310 | Synopsis [Internal macro to set the multi-valued function of a |
---|
| 311 | vertex.] |
---|
| 312 | |
---|
| 313 | SideEffects [] |
---|
| 314 | |
---|
| 315 | SeeAlso [PartVertexInfo] |
---|
| 316 | |
---|
| 317 | ******************************************************************************/ |
---|
| 318 | #define PartVertexSetFunction( \ |
---|
| 319 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph */, \ |
---|
| 320 | /* Mvf_Function_t * */ function /* Function to store */ \ |
---|
| 321 | ) \ |
---|
| 322 | ((PartVertexInfo_t *)(vPtr)->user_data)->functionality.mvf = (function) |
---|
| 323 | |
---|
| 324 | /**Macro*********************************************************************** |
---|
| 325 | |
---|
| 326 | Synopsis [Internal macro to access the mdd Id of a vertex.] |
---|
| 327 | |
---|
| 328 | SideEffects [] |
---|
| 329 | |
---|
| 330 | SeeAlso [PartVertexInfo] |
---|
| 331 | |
---|
| 332 | ******************************************************************************/ |
---|
| 333 | #define PartVertexReadMddId( \ |
---|
| 334 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 335 | ) \ |
---|
| 336 | ((PartVertexInfo_t *)(vPtr)->user_data)->mddId |
---|
| 337 | |
---|
| 338 | /**Macro*********************************************************************** |
---|
| 339 | |
---|
| 340 | Synopsis [Internal macro to access the isClustered of a vertex.] |
---|
| 341 | |
---|
| 342 | SideEffects [] |
---|
| 343 | |
---|
| 344 | SeeAlso [PartVertexInfo] |
---|
| 345 | |
---|
| 346 | ******************************************************************************/ |
---|
| 347 | #define PartVertexTestIsClustered( \ |
---|
| 348 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph data structure */ \ |
---|
| 349 | ) \ |
---|
| 350 | ((PartVertexInfo_t *)(vPtr)->user_data)->isClustered |
---|
| 351 | |
---|
| 352 | /**Macro*********************************************************************** |
---|
| 353 | |
---|
| 354 | Synopsis [Sets the isClustered field of a vertex.] |
---|
| 355 | |
---|
| 356 | SideEffects [] |
---|
| 357 | |
---|
| 358 | SeeAlso [PartVertexInfo] |
---|
| 359 | |
---|
| 360 | ******************************************************************************/ |
---|
| 361 | #define PartVertexSetIsClustered( \ |
---|
| 362 | /* vertex_t * */ vPtr /* Pointer to vertex in the graph */, \ |
---|
| 363 | /* boolean */ value /* Boolean representing IsClustered ? */ \ |
---|
| 364 | ) \ |
---|
| 365 | ((PartVertexInfo_t *)(vPtr)->user_data)->isClustered = (value) |
---|
| 366 | |
---|
| 367 | /**AutomaticStart*************************************************************/ |
---|
| 368 | |
---|
| 369 | /*---------------------------------------------------------------------------*/ |
---|
| 370 | /* Function prototypes */ |
---|
| 371 | /*---------------------------------------------------------------------------*/ |
---|
| 372 | |
---|
| 373 | EXTERN void partCreateBoundaryNames(Hrc_Node_t *hnode, st_table *tableOfFormalNames); |
---|
| 374 | EXTERN void PartPartitionBoundary(Ntk_Network_t *network, Hrc_Node_t *hnode, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet, int inTermsOfCombInputs); |
---|
| 375 | EXTERN void PartNameFree(lsGeneric name); |
---|
| 376 | EXTERN void PartPartitionFrontier(Ntk_Network_t *network, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet); |
---|
| 377 | EXTERN void PartUpdateFrontier(Ntk_Network_t *network, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet); |
---|
| 378 | EXTERN void PartPrintPartition(graph_t *partition); |
---|
| 379 | EXTERN array_t * PartCreateSubsystem(Part_SubsystemInfo_t *partSubInfo, array_t *arrayOfLatchNames, array_t *arrayOfGroupIndex); |
---|
| 380 | EXTERN void PartPartitionInputsOutputs(Ntk_Network_t *network, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet); |
---|
| 381 | EXTERN int PartPartitionInOutChangeRoots(Ntk_Network_t *network, graph_t *partition, lsList rootList, int verbosity); |
---|
| 382 | EXTERN PartPartitionInfo_t * PartPartitionInfoCreate(char *name, mdd_manager *manager, Part_PartitionMethod method); |
---|
| 383 | EXTERN void PartPartitionInfoFree(gGeneric partitionInfo); |
---|
| 384 | EXTERN PartVertexInfo_t * PartVertexInfoCreateSingle(char *name, Mvf_Function_t *mvf, int mddId); |
---|
| 385 | EXTERN PartVertexInfo_t * PartVertexInfoCreateCluster(char *name, array_t *vertexArray); |
---|
| 386 | EXTERN void PartVertexInfoFree(gGeneric vertexInfo); |
---|
| 387 | EXTERN void PartPartitionSanityCheck(graph_t *partition, int intensity); |
---|
| 388 | EXTERN st_table * PartCreateFunctionSupportTable(Mvf_Function_t *mvf); |
---|
| 389 | EXTERN void PartPartitionCreateVertexFaninEdges(graph_t *partition, vertex_t *vertexPtr); |
---|
| 390 | EXTERN int PartPartitionPrint(FILE *fp, graph_t *partition); |
---|
| 391 | EXTERN int PartGetLatchInputListFromCTL(Ntk_Network_t *network, array_t *ctlArray, array_t *fairArray, lsList latchInputList); |
---|
| 392 | EXTERN int PartGetLatchListFromCtlAndLtl(Ntk_Network_t *network, array_t *ctlArray, array_t *ltlArray, array_t *fairArray, lsList latchInputList, boolean stopAtLatch); |
---|
| 393 | EXTERN int PartGetLatchInputListFromCtlAndLtl(Ntk_Network_t *network, array_t *ctlArray, array_t *ltlArray, array_t *fairArray, lsList latchInputList, boolean stopAtLatch); |
---|
| 394 | EXTERN void PartPartitionPartial(Ntk_Network_t *network, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet, lsList nodeList, int inTermsOfCombInputs); |
---|
| 395 | EXTERN void PartPartitionTotal(Ntk_Network_t *network, graph_t *partition, lsList rootList, lsList leaveList, mdd_t *careSet, int inTermsOfLeaves); |
---|
| 396 | EXTERN void PartInsertBnvs(Ntk_Network_t *network, st_table *coiLatchTable, st_table *coiBnvTable); |
---|
| 397 | EXTERN void PartPartitionWithExistingBnvs(Ntk_Network_t *network, graph_t *partition, st_table *coiBnvTable, st_table *absLatchTable, st_table *absBnvTable); |
---|
| 398 | EXTERN void PartPartitionUpdateWithExistingBnvs(Ntk_Network_t *network, graph_t *partition, st_table *coiBnvTable, st_table *absLatchTable, st_table *absBnvTable); |
---|
| 399 | |
---|
| 400 | /**AutomaticEnd***************************************************************/ |
---|
| 401 | |
---|
| 402 | #endif /* _PARTINT */ |
---|
| 403 | |
---|
| 404 | |
---|
| 405 | |
---|
| 406 | |
---|