VIS

src/spfd/spfdAPI.c

Go to the documentation of this file.
00001 
00023 #include "spfdInt.h"
00024 
00025 /*---------------------------------------------------------------------------*/
00026 /* Constant declarations                                                     */
00027 /*---------------------------------------------------------------------------*/
00028 
00029 
00030 /*---------------------------------------------------------------------------*/
00031 /* Type declarations                                                         */
00032 /*---------------------------------------------------------------------------*/
00033 
00034 
00035 /*---------------------------------------------------------------------------*/
00036 /* Structure declarations                                                    */
00037 /*---------------------------------------------------------------------------*/
00038 
00039 
00040 /*---------------------------------------------------------------------------*/
00041 /* Variable declarations                                                     */
00042 /*---------------------------------------------------------------------------*/
00043 
00044 extern int sfpdVerbose; 
00045 extern float alpha; 
00046 
00047 /*---------------------------------------------------------------------------*/
00048 /* Macro declarations                                                        */
00049 /*---------------------------------------------------------------------------*/
00050 
00051 
00054 /*---------------------------------------------------------------------------*/
00055 /* Static function prototypes                                                */
00056 /*---------------------------------------------------------------------------*/
00057 
00058 
00062 /*---------------------------------------------------------------------------*/
00063 /* Definition of exported functions                                          */
00064 /*---------------------------------------------------------------------------*/
00065 
00066 /*---------------------------------------------------------------------------*/
00067 /* Definition of internal functions                                          */
00068 /*---------------------------------------------------------------------------*/
00069 
00077 boolean
00078 SpfdNodeReadLocked(
00079   SpfdApplData_t *applData,
00080   Ntk_Node_t *node)
00081 {
00082   st_table *nodeToData = applData->nodeToData;
00083   SpfdNodeData_t *nodeData;
00084 
00085   st_lookup(nodeToData,(char *)node,&nodeData);
00086   
00087   return nodeData->locked;
00088   
00089 } /* End of SpfdNodeReadLocked */
00090 
00091 
00099 int
00100 SpfdNodeReadAuxId(
00101   SpfdApplData_t *applData,
00102   Ntk_Node_t *node)
00103 {
00104   st_table *nodeToData = applData->nodeToData;
00105   SpfdNodeData_t *nodeData;
00106 
00107   st_lookup(nodeToData,(char *)node,&nodeData);
00108   
00109   return nodeData->auxId;
00110   
00111 } /* End of SpfdNodeReadAuxId */
00112 
00113 
00121 void
00122 SpfdNodeSetAuxId(
00123   SpfdApplData_t *applData,
00124   Ntk_Node_t *node,
00125   int auxId)
00126 {
00127   st_table *nodeToData = applData->nodeToData;
00128   SpfdNodeData_t *nodeData;
00129 
00130   st_lookup(nodeToData,(char *)node,&nodeData);
00131   nodeData->auxId = auxId;
00132 
00133 } /* End of SpfdNodeSetAuxId */
00134 
00135 
00143 bdd_node *
00144 SpfdNodeReadSpfd(
00145   SpfdApplData_t *applData,
00146   Ntk_Node_t *node)
00147 {
00148   st_table *nodeToData = applData->nodeToData;
00149   SpfdNodeData_t *nodeData;
00150 
00151   st_lookup(nodeToData,(char *)node,&nodeData);
00152   
00153   return nodeData->spfd;
00154   
00155 } /* End of SpfdNodeReadSpfd */
00156 
00157 
00165 void
00166 SpfdNodeDeleteSpfd(
00167   SpfdApplData_t *applData,
00168   Ntk_Node_t *node)
00169 {
00170   st_table *nodeToData = applData->nodeToData;
00171   SpfdNodeData_t *nodeData;
00172 
00173   st_lookup(nodeToData,(char *)node,&nodeData);
00174 
00175   if (nodeData->spfd)
00176     bdd_recursive_deref(applData->ddManager,nodeData->spfd);
00177   nodeData->spfd = NIL(bdd_node);
00178   
00179   return;
00180   
00181 } /* End of SpfdNodeDeleteSpfd */
00182 
00183 
00191 void
00192 SpfdNodeSetSpfd(
00193   SpfdApplData_t *applData,
00194   Ntk_Node_t *node,
00195   bdd_node *spfd)
00196 {
00197   st_table *nodeToData = applData->nodeToData;
00198   SpfdNodeData_t *nodeData;
00199 
00200   st_lookup(nodeToData,(char *)node,&nodeData);
00201 
00202   if (nodeData->spfd) {
00203     (void) fprintf(vis_stdout,
00204                    "** spfd warning: <%s: set spfd> Possible memory leak.\n",
00205                    Ntk_NodeReadName(node));
00206   }
00207   nodeData->spfd = spfd;
00208   
00209 } /* End of SpfdNodeSetSpfd */
00210 
00211 
00220 bdd_node **
00221 SpfdNodeReadParameters(
00222   SpfdApplData_t *applData,
00223   Ntk_Node_t *node)
00224 {
00225   st_table *nodeToData = applData->nodeToData;
00226   SpfdNodeData_t *nodeData;
00227 
00228   st_lookup(nodeToData,(char *)node,&nodeData);
00229 
00230   return nodeData->parameters;
00231   
00232 } /* End of SpfdNodeReadParameters */
00233 
00234 
00243 void
00244 SpfdNodeDeleteParameters(
00245   SpfdApplData_t *applData,
00246   Ntk_Node_t *node)
00247 {
00248   st_table *nodeToData = applData->nodeToData;
00249   SpfdNodeData_t *nodeData;
00250 
00251   st_lookup(nodeToData,(char *)node,&nodeData);
00252 
00253   if (nodeData->parameters)
00254     FREE(nodeData->parameters);
00255 
00256   nodeData->parameters = NIL(bdd_node *);
00257   nodeData->numParams = 0;
00258   
00259   return;
00260   
00261 } /* End of SpfdNodeDeleteParameters */
00262 
00263 
00272 void
00273 SpfdNodeSetParameters(
00274   SpfdApplData_t *applData,
00275   Ntk_Node_t *node,
00276   bdd_node **parameters,
00277   int numParams)
00278 {
00279   st_table *nodeToData = applData->nodeToData;
00280   SpfdNodeData_t *nodeData;
00281 
00282   st_lookup(nodeToData,(char *)node,&nodeData);
00283 
00284   if (nodeData->parameters) {
00285     (void) fprintf(vis_stdout,
00286                    "** spfd warning: <%s: set parameters> Possible memory leak.\n",
00287                    Ntk_NodeReadName(node));
00288   }
00289 
00290   nodeData->parameters = parameters;
00291   nodeData->numParams = numParams;
00292   
00293 } /* End of SpfdNodeSetParameters */
00294 
00295 
00303 array_t *
00304 SpfdNodeReadFaninOrder(
00305   SpfdApplData_t *applData,
00306   Ntk_Node_t *node)
00307 {
00308   st_table *nodeToData = applData->nodeToData;
00309   SpfdNodeData_t *nodeData;
00310 
00311   st_lookup(nodeToData,(char *)node,&nodeData);
00312   
00313   return nodeData->faninOrder;
00314   
00315 } /* End of SpfdNodeReadFaninOrder */
00316 
00317 
00325 void
00326 SpfdNodeDeleteFaninOrder(
00327   SpfdApplData_t *applData,
00328   Ntk_Node_t *node)
00329 {
00330   st_table *nodeToData = applData->nodeToData;
00331   SpfdNodeData_t *nodeData;
00332 
00333   st_lookup(nodeToData,(char *)node,&nodeData);
00334 
00335   if (nodeData->faninOrder)
00336     array_free(nodeData->faninOrder);
00337 
00338   nodeData->faninOrder = NIL(array_t);
00339   
00340   return;
00341   
00342 } /* End of SpfdNodeDeleteFaninOrder */
00343 
00344 
00352 void
00353 SpfdNodeSetFaninOrder(
00354   SpfdApplData_t *applData,
00355   Ntk_Node_t *node,
00356   array_t *faninOrder)
00357 {
00358   st_table *nodeToData = applData->nodeToData;
00359   SpfdNodeData_t *nodeData;
00360 
00361   st_lookup(nodeToData,(char *)node,&nodeData);
00362   if (nodeData->faninOrder) {
00363     (void) fprintf(vis_stdout,
00364                    "** spfd warning: <%s: set fanin order> Possible memory leak.\n",
00365                    Ntk_NodeReadName(node));
00366   }
00367   nodeData->faninOrder = faninOrder;
00368 
00369 } /* End of SpfdNodeSetFaninOrder */
00370 
00379 bdd_node *
00380 SpfdNodeReadGlobalAlternative(
00381   SpfdApplData_t *applData,
00382   Ntk_Node_t *node)
00383 {
00384   st_table *nodeToData = applData->nodeToData;
00385   SpfdNodeData_t *nodeData;
00386 
00387   st_lookup(nodeToData,(char *)node,&nodeData);
00388   
00389   return nodeData->alternative;
00390   
00391 } /* End of SpfdNodeReadGlobalAlternative */
00392 
00393 
00404 void
00405 SpfdNodeDeleteGlobalAlternative(
00406   SpfdApplData_t *applData,
00407   Ntk_Node_t *node)
00408 {
00409   st_table *nodeToData = applData->nodeToData;
00410   SpfdNodeData_t *nodeData;
00411 
00412   st_lookup(nodeToData,(char *)node,&nodeData);
00413 
00414   if (nodeData->alternative)
00415     bdd_recursive_deref(applData->ddManager,nodeData->alternative);
00416 
00417   nodeData->alternative = NIL(bdd_node);
00418   
00419   return;
00420   
00421 } /* End of SpfdNodeDeleteGlobalAlternative */
00422 
00423 
00431 void
00432 SpfdNodeSetGlobalAlternative(
00433   SpfdApplData_t *applData,
00434   Ntk_Node_t *node,
00435   bdd_node *alternative)
00436 {
00437   st_table *nodeToData = applData->nodeToData;
00438   SpfdNodeData_t *nodeData;
00439 
00440   st_lookup(nodeToData,(char *)node,&nodeData);
00441   if (nodeData->alternative) {
00442     (void) fprintf(vis_stdout,
00443                    "** spfd warning: <%s: set global alternative>"
00444                    " Possible memory leak.\n",
00445                    Ntk_NodeReadName(node));
00446   }
00447   nodeData->alternative = alternative;
00448   
00449 } /* End of SpfdNodeSetGlobalAlternative */
00450 
00451 
00460 bdd_node *
00461 SpfdNodeReadLocalAlt(
00462   SpfdApplData_t *applData,
00463   Ntk_Node_t *node)
00464 {
00465   st_table *nodeToData = applData->nodeToData;
00466   SpfdNodeData_t *nodeData;
00467 
00468   st_lookup(nodeToData,(char *)node,&nodeData);
00469 
00470   return nodeData->localAlt;
00471   
00472 } /* End of SpfdNodeReadLocalAlt */
00473 
00474 
00483 void
00484 SpfdNodeDeleteLocalAlt(
00485   SpfdApplData_t *applData,
00486   Ntk_Node_t *node)
00487 {
00488   st_table *nodeToData = applData->nodeToData;
00489   SpfdNodeData_t *nodeData;
00490 
00491   st_lookup(nodeToData,(char *)node,&nodeData);
00492 
00493   if (nodeData->localAlt)
00494     bdd_recursive_deref(applData->ddManager,nodeData->localAlt);
00495 
00496   nodeData->localAlt = NIL(bdd_node);
00497   
00498   return;
00499   
00500 } /* End of SpfdNodeDeleteLocalAlt */
00501 
00502  
00511 void
00512 SpfdNodeSetLocalAlt(
00513   SpfdApplData_t *applData,
00514   Ntk_Node_t *node,
00515   bdd_node *localAlt)
00516 {
00517   st_table *nodeToData = applData->nodeToData;
00518   SpfdNodeData_t *nodeData;
00519 
00520   st_lookup(nodeToData,(char *)node,&nodeData);
00521   if (nodeData->localAlt) {
00522     (void) fprintf(vis_stdout,
00523                    "** spfd warning: <%s: set local alt> Possible memory leak.\n",
00524                    Ntk_NodeReadName(node));
00525   }
00526   nodeData->localAlt = localAlt;
00527   
00528 } /* End of SpfdNodeSetLocalAlt */
00529   
00530 
00538 void
00539 SpfdNodeSetLocked(
00540   SpfdApplData_t *applData,
00541   Ntk_Node_t *node,
00542   boolean locked)
00543 {
00544   st_table *nodeToData = applData->nodeToData;
00545   SpfdNodeData_t *nodeData;
00546 
00547   st_lookup(nodeToData,(char *)node,&nodeData);
00548 
00549   nodeData->locked = locked;
00550   
00551 } /* End of SpfdNodeSetLocked */
00552 
00553 
00562 int
00563 SpfdNodeReadNumParams(
00564   SpfdApplData_t *applData,
00565   Ntk_Node_t *node)
00566 {
00567   st_table *nodeToData = applData->nodeToData;
00568   SpfdNodeData_t *nodeData;
00569 
00570   st_lookup(nodeToData,(char *)node,&nodeData);
00571 
00572   return nodeData->numParams;
00573   
00574 } /* End of SpfdNodeReadNumParams */
00575 
00584 int
00585 SpfdNodeReadNetIndex(
00586   SpfdApplData_t *applData,
00587   Ntk_Node_t *node)
00588 {
00589   SpfdPlaceData_t *placeData;
00590   int index = -1;
00591   
00592   placeData = applData->placeData;
00593   st_lookup(placeData->nodeToNetIndex,(char *)node,&index);
00594 
00595   return index;
00596   
00597 } /* End of SpfdNodeReadNetIndex */
00598 
00599 /*---------------------------------------------------------------------------*/
00600 /* Definition of static functions                                            */
00601 /*---------------------------------------------------------------------------*/
00602 
00603