| [14] | 1 | /**CHeaderFile***************************************************************** | 
|---|
|  | 2 |  | 
|---|
|  | 3 | FileName    [hrcInt.h] | 
|---|
|  | 4 |  | 
|---|
|  | 5 | PackageName [hrc] | 
|---|
|  | 6 |  | 
|---|
|  | 7 | Synopsis    [The internal declarations needed for the hierarchy] | 
|---|
|  | 8 |  | 
|---|
|  | 9 | Description [This file contains the definitions of important structures | 
|---|
|  | 10 | needed for defining the hierarchy.] | 
|---|
|  | 11 |  | 
|---|
|  | 12 | SeeAlso     [hrc.h] | 
|---|
|  | 13 |  | 
|---|
|  | 14 | Author      [Yuji Kukimoto, Shaz Qadeer] | 
|---|
|  | 15 |  | 
|---|
|  | 16 | Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California. | 
|---|
|  | 17 | All rights reserved. | 
|---|
|  | 18 |  | 
|---|
|  | 19 | Permission is hereby granted, without written agreement and without license | 
|---|
|  | 20 | or royalty fees, to use, copy, modify, and distribute this software and its | 
|---|
|  | 21 | documentation for any purpose, provided that the above copyright notice and | 
|---|
|  | 22 | the following two paragraphs appear in all copies of this software. | 
|---|
|  | 23 |  | 
|---|
|  | 24 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR | 
|---|
|  | 25 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | 
|---|
|  | 26 | OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF | 
|---|
|  | 27 | CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|---|
|  | 28 |  | 
|---|
|  | 29 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, | 
|---|
|  | 30 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 
|---|
|  | 31 | FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN | 
|---|
|  | 32 | "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE | 
|---|
|  | 33 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] | 
|---|
|  | 34 |  | 
|---|
|  | 35 | Revision    [$Id: hrcInt.h,v 1.2 2001/03/12 22:28:29 jinh Exp $] | 
|---|
|  | 36 |  | 
|---|
|  | 37 | ******************************************************************************/ | 
|---|
|  | 38 |  | 
|---|
|  | 39 | #ifndef _HRCINT | 
|---|
|  | 40 | #define _HRCINT | 
|---|
|  | 41 |  | 
|---|
|  | 42 | #include "hrc.h" | 
|---|
|  | 43 | #include "cmd.h" | 
|---|
|  | 44 | #include <string.h> | 
|---|
|  | 45 |  | 
|---|
|  | 46 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 47 | /* Constant declarations                                                     */ | 
|---|
|  | 48 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 49 |  | 
|---|
|  | 50 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 51 | /* Type declarations                                                         */ | 
|---|
|  | 52 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 53 |  | 
|---|
|  | 54 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 55 | /* Stucture declarations                                                     */ | 
|---|
|  | 56 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 57 |  | 
|---|
|  | 58 | /**Enum************************************************************************ | 
|---|
|  | 59 |  | 
|---|
|  | 60 | Synopsis    [Types of components present in a circuit.] | 
|---|
|  | 61 |  | 
|---|
|  | 62 | ******************************************************************************/ | 
|---|
|  | 63 | typedef enum { | 
|---|
|  | 64 | HrcLatch_c,             /* component is a latch */ | 
|---|
|  | 65 | HrcSubckt_c,            /* component is a subckt */ | 
|---|
|  | 66 | HrcUndef_c              /* component is an arbitrary gate */ | 
|---|
|  | 67 | } HrcCktComponentType; | 
|---|
|  | 68 |  | 
|---|
|  | 69 | /**Struct********************************************************************** | 
|---|
|  | 70 |  | 
|---|
|  | 71 | Synopsis    [Structure to store uninterpreted application info.] | 
|---|
|  | 72 |  | 
|---|
|  | 73 | SeeAlso     [Hrc_NodeAddApplInfo()] | 
|---|
|  | 74 |  | 
|---|
|  | 75 | ******************************************************************************/ | 
|---|
|  | 76 | typedef struct ApplInfoStruct { | 
|---|
|  | 77 | Hrc_ApplInfoFreeFn  freeFn;  /* application function to free data */ | 
|---|
|  | 78 | Hrc_ApplInfoChangeFn changeFn; /* application function to change data */ | 
|---|
|  | 79 | void               *data;    /* application data */ | 
|---|
|  | 80 | } ApplInfo_t; | 
|---|
|  | 81 |  | 
|---|
|  | 82 | /**Struct********************************************************************** | 
|---|
|  | 83 |  | 
|---|
|  | 84 | Synopsis    [Definition of a hierarchy manager] | 
|---|
|  | 85 |  | 
|---|
|  | 86 | Description [rootNode is a pointer to the root node of the hierarchy tree. | 
|---|
|  | 87 | It corresponds to the instantiation of the root model in a | 
|---|
|  | 88 | blifmv file. currentNode points to the current position in | 
|---|
|  | 89 | the hierarchy. This pointer is initialized to root node. Its | 
|---|
|  | 90 | value changes whenever the cd command for changing the | 
|---|
|  | 91 | hierarchical level is used. modelTable contains all the | 
|---|
|  | 92 | defined models.] | 
|---|
|  | 93 |  | 
|---|
|  | 94 | SeeAlso     [] | 
|---|
|  | 95 |  | 
|---|
|  | 96 | ******************************************************************************/ | 
|---|
|  | 97 | struct HrcManagerStruct { | 
|---|
|  | 98 | Hrc_Node_t *rootNode;   /* pointer to root Hrc_Node_t */ | 
|---|
|  | 99 | Hrc_Node_t *currentNode;/* pointer to current Hrc_Node_t */ | 
|---|
|  | 100 | st_table *modelTable;   /* hash table from model name(char *) | 
|---|
|  | 101 | * to model (Hrc_Model_t *) */ | 
|---|
|  | 102 | }; | 
|---|
|  | 103 |  | 
|---|
|  | 104 | /**Struct********************************************************************** | 
|---|
|  | 105 |  | 
|---|
|  | 106 | Synopsis    [Definition of a model] | 
|---|
|  | 107 |  | 
|---|
|  | 108 | Description [hrcNode is a pointer to a the master node of the model. The | 
|---|
|  | 109 | master node contains information about all the elements in | 
|---|
|  | 110 | the model. subcktTable contains all information about the | 
|---|
|  | 111 | various instantiations of other models from within the model.] | 
|---|
|  | 112 |  | 
|---|
|  | 113 | SeeAlso     [HrcNodeStruct, HrcSubcktStruct] | 
|---|
|  | 114 |  | 
|---|
|  | 115 | ******************************************************************************/ | 
|---|
|  | 116 | struct HrcModelStruct { | 
|---|
|  | 117 | char *modelName;           /* unique model name */ | 
|---|
|  | 118 | Hrc_Node_t *masterNode;       /* pointer to the master hrcNode of a model */ | 
|---|
|  | 119 | st_table *subcktTable;     /* hash table from instance name (char *) of | 
|---|
|  | 120 | * model being called to subckt (Hrc_Subckt_t *)*/ | 
|---|
|  | 121 | }; | 
|---|
|  | 122 |  | 
|---|
|  | 123 | /**Struct********************************************************************** | 
|---|
|  | 124 |  | 
|---|
|  | 125 | Synopsis    [Definition of a sub-circuit] | 
|---|
|  | 126 |  | 
|---|
|  | 127 | Description [A subckt is created whenever a model instantiates another. The | 
|---|
|  | 128 | two arrays actualInputVars and actualOutputVars map contain | 
|---|
|  | 129 | the variables used to refer to the I/O pins of the instantiated | 
|---|
|  | 130 | model.] | 
|---|
|  | 131 |  | 
|---|
|  | 132 | SeeAlso     [HrcModelStruct] | 
|---|
|  | 133 |  | 
|---|
|  | 134 | ******************************************************************************/ | 
|---|
|  | 135 | struct HrcSubcktStruct { | 
|---|
|  | 136 | Hrc_Model_t *model;       /* the subckt resulted from an instantiation of | 
|---|
|  | 137 | * this model */ | 
|---|
|  | 138 | char *instanceName;       /* name by which the instantiation took place */ | 
|---|
|  | 139 | array_t *actualInputVars; /* array of actual input variable pointers | 
|---|
|  | 140 | * Var_Variable_t *'s */ | 
|---|
|  | 141 | array_t *actualOutputVars;/* array of actual output variable pointers | 
|---|
|  | 142 | * Var_Variable_t *'s */ | 
|---|
|  | 143 | }; | 
|---|
|  | 144 |  | 
|---|
|  | 145 | /**Struct********************************************************************** | 
|---|
|  | 146 |  | 
|---|
|  | 147 | Synopsis    [Definition of a node in the hierarchy tree] | 
|---|
|  | 148 |  | 
|---|
|  | 149 | Description [This structure forms the basic unit of the hierarchy tree. | 
|---|
|  | 150 | Note that the elements of arrays formalInputs and actualInputs, | 
|---|
|  | 151 | and formalOutputs and actualOutputs are in one to one | 
|---|
|  | 152 | correspondence.] | 
|---|
|  | 153 |  | 
|---|
|  | 154 | SeeAlso     [HrcModelStruct] | 
|---|
|  | 155 |  | 
|---|
|  | 156 | ******************************************************************************/ | 
|---|
|  | 157 | struct HrcNodeStruct { | 
|---|
|  | 158 | Hrc_Manager_t *manager;    /* manager to which this node belongs */ | 
|---|
|  | 159 | char *modelName;           /* corresponding model name */ | 
|---|
|  | 160 | char *instanceName;        /* instance name */ | 
|---|
|  | 161 | Hrc_Node_t *parentNode;    /* pointer to the unique parent node */ | 
|---|
|  | 162 | array_t *formalInputs;     /* formal input symbolic variables | 
|---|
|  | 163 | * (Var_Variable_t *) */ | 
|---|
|  | 164 | array_t *formalOutputs;    /* formal output symbolic variables | 
|---|
|  | 165 | * (Var_Variable_t *) */ | 
|---|
|  | 166 | array_t *actualInputs;     /* actual connections (Var_Variable_t *) with | 
|---|
|  | 167 | * the inputs of parent node */ | 
|---|
|  | 168 | array_t *actualOutputs;    /* actual connections (Var_Variable_t *) with | 
|---|
|  | 169 | * the outputs of parent node */ | 
|---|
|  | 170 | array_t *nameTables;       /* array of Tbl_Table_t *'s corresponding | 
|---|
|  | 171 | * to .names in the blifmv file */ | 
|---|
|  | 172 | st_table *childTable;      /* hash table from child instance name (char *) | 
|---|
|  | 173 | * to child (Hrc_Node_t *) */ | 
|---|
|  | 174 | st_table *latchTable;      /* hash table from name of output of latch | 
|---|
|  | 175 | * (char *)  to latch (Hrc_Latch_t *) */ | 
|---|
|  | 176 | st_table *varTable;        /* hash table from symbolic variable name | 
|---|
|  | 177 | * (char *) to (Var_Variable_t *) */ | 
|---|
|  | 178 | st_table *applInfoTable;   /* hash table for application specific | 
|---|
|  | 179 | information from (char *) to (ApplInfo_t *) */ | 
|---|
|  | 180 | void *undef;               /* for programmer's use */ | 
|---|
|  | 181 | }; | 
|---|
|  | 182 |  | 
|---|
|  | 183 | /**Struct********************************************************************** | 
|---|
|  | 184 |  | 
|---|
|  | 185 | Synopsis    [Definition of a latch] | 
|---|
|  | 186 |  | 
|---|
|  | 187 | Description [] | 
|---|
|  | 188 |  | 
|---|
|  | 189 | SeeAlso     [] | 
|---|
|  | 190 |  | 
|---|
|  | 191 | ******************************************************************************/ | 
|---|
|  | 192 | struct HrcLatchStruct { | 
|---|
|  | 193 | Var_Variable_t *latchInput;  /* input of the latch (next state) */ | 
|---|
|  | 194 | Var_Variable_t *latchOutput; /* output of the latch (present state) */ | 
|---|
|  | 195 | Tbl_Table_t *resetTable;     /* pointer to reset table for this latch */ | 
|---|
|  | 196 | void *undef;                 /* for programmer's use */ | 
|---|
|  | 197 | }; | 
|---|
|  | 198 |  | 
|---|
|  | 199 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 200 | /* Variable declarations                                                     */ | 
|---|
|  | 201 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 202 |  | 
|---|
|  | 203 |  | 
|---|
|  | 204 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 205 | /* Macro declarations                                                        */ | 
|---|
|  | 206 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 207 |  | 
|---|
|  | 208 |  | 
|---|
|  | 209 | /**AutomaticStart*************************************************************/ | 
|---|
|  | 210 |  | 
|---|
|  | 211 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 212 | /* Function prototypes                                                       */ | 
|---|
|  | 213 | /*---------------------------------------------------------------------------*/ | 
|---|
|  | 214 |  | 
|---|
|  | 215 | EXTERN void HrcNodeFreeRecursively(Hrc_Node_t *node); | 
|---|
|  | 216 | EXTERN void HrcNodeFreeInternalMemory(Hrc_Node_t *node); | 
|---|
|  | 217 | EXTERN Hrc_Node_t * HrcNodeDeleteChild(Hrc_Node_t *node, char *childName); | 
|---|
|  | 218 |  | 
|---|
|  | 219 | /**AutomaticEnd***************************************************************/ | 
|---|
|  | 220 |  | 
|---|
|  | 221 | #endif /* _HRCINT */ | 
|---|
|  | 222 |  | 
|---|
|  | 223 |  | 
|---|
|  | 224 |  | 
|---|
|  | 225 |  | 
|---|
|  | 226 |  | 
|---|
|  | 227 |  | 
|---|
|  | 228 |  | 
|---|
|  | 229 |  | 
|---|
|  | 230 |  | 
|---|
|  | 231 |  | 
|---|
|  | 232 |  | 
|---|
|  | 233 |  | 
|---|
|  | 234 |  | 
|---|
|  | 235 |  | 
|---|
|  | 236 |  | 
|---|
|  | 237 |  | 
|---|
|  | 238 |  | 
|---|
|  | 239 |  | 
|---|
|  | 240 |  | 
|---|
|  | 241 |  | 
|---|
|  | 242 |  | 
|---|