[14] | 1 | /**CFile*********************************************************************** |
---|
| 2 | |
---|
| 3 | FileName [simSim.c] |
---|
| 4 | |
---|
| 5 | PackageName [sim] |
---|
| 6 | |
---|
| 7 | Synopsis [Routines to manipulate simstructure.] |
---|
| 8 | |
---|
| 9 | Author [Shaker Sarwary and Tom Shiple] |
---|
| 10 | |
---|
| 11 | Copyright [Copyright (c) 1994-1996 The Regents of the Univ. of California. |
---|
| 12 | All rights reserved. |
---|
| 13 | |
---|
| 14 | Permission is hereby granted, without written agreement and without license |
---|
| 15 | or royalty fees, to use, copy, modify, and distribute this software and its |
---|
| 16 | documentation for any purpose, provided that the above copyright notice and |
---|
| 17 | the following two paragraphs appear in all copies of this software. |
---|
| 18 | |
---|
| 19 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR |
---|
| 20 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT |
---|
| 21 | OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF |
---|
| 22 | CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 23 | |
---|
| 24 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, |
---|
| 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
---|
| 26 | FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN |
---|
| 27 | "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE |
---|
| 28 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] |
---|
| 29 | |
---|
| 30 | ******************************************************************************/ |
---|
| 31 | #include "simInt.h" |
---|
| 32 | |
---|
| 33 | static char rcsid[] UNUSED = "$Id: simSim.c,v 1.2 1997/02/12 23:03:57 hsv Exp $"; |
---|
| 34 | |
---|
| 35 | /*---------------------------------------------------------------------------*/ |
---|
| 36 | /* Constant declarations */ |
---|
| 37 | /*---------------------------------------------------------------------------*/ |
---|
| 38 | |
---|
| 39 | /**AutomaticStart*************************************************************/ |
---|
| 40 | |
---|
| 41 | /*---------------------------------------------------------------------------*/ |
---|
| 42 | /* Static function prototypes */ |
---|
| 43 | /*---------------------------------------------------------------------------*/ |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | /**AutomaticEnd***************************************************************/ |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | /*---------------------------------------------------------------------------*/ |
---|
| 50 | /* Definition of exported functions */ |
---|
| 51 | /*---------------------------------------------------------------------------*/ |
---|
| 52 | |
---|
| 53 | /**Function******************************************************************** |
---|
| 54 | |
---|
| 55 | Synopsis [Returns the network pointed by the sim structure.] |
---|
| 56 | |
---|
| 57 | Description [Returns the network pointed by the sim structure. It is an |
---|
| 58 | error to call this function with a NULL or a wrong sim structure. The user |
---|
| 59 | should not free the returned network.] |
---|
| 60 | |
---|
| 61 | SideEffects [] |
---|
| 62 | |
---|
| 63 | ******************************************************************************/ |
---|
| 64 | Ntk_Network_t * |
---|
| 65 | Sim_SimReadNetwork( |
---|
| 66 | Sim_Sim_t * sim) |
---|
| 67 | { |
---|
| 68 | return (sim->network); |
---|
| 69 | } |
---|
| 70 | /**Function******************************************************************** |
---|
| 71 | |
---|
| 72 | Synopsis [Returns nodeToMvfTable of the sim structure.] |
---|
| 73 | |
---|
| 74 | Description [Returns nodeToMvfTable of the sim structure. It is an error to |
---|
| 75 | call this function with a NULL or wrong sim structure. The user should not |
---|
| 76 | change or free the returned structure.] |
---|
| 77 | |
---|
| 78 | SideEffects [] |
---|
| 79 | |
---|
| 80 | ******************************************************************************/ |
---|
| 81 | st_table * |
---|
| 82 | Sim_SimReadNodeToMvfTable( |
---|
| 83 | Sim_Sim_t * sim) |
---|
| 84 | { |
---|
| 85 | return (sim->nodeToMvfTable); |
---|
| 86 | } |
---|
| 87 | /**Function******************************************************************** |
---|
| 88 | |
---|
| 89 | Synopsis [Returns the name of the input file of a sim.] |
---|
| 90 | |
---|
| 91 | Description [Returns the name of the input file of a sim. It is an error to |
---|
| 92 | call this function with a NULL or wrong sim structure. The user should not free |
---|
| 93 | the returned string.] |
---|
| 94 | |
---|
| 95 | SideEffects [] |
---|
| 96 | |
---|
| 97 | ******************************************************************************/ |
---|
| 98 | char * |
---|
| 99 | Sim_SimReadInputFile( |
---|
| 100 | Sim_Sim_t * sim) |
---|
| 101 | { |
---|
| 102 | return (sim->inputFile); |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /**Function******************************************************************** |
---|
| 106 | |
---|
| 107 | Synopsis [Returns the number of line already read by the parser in input file.] |
---|
| 108 | |
---|
| 109 | Description [Returns the number of line already read by the parser in input |
---|
| 110 | file. It is an error to call this function with a NULL or wrong sim structure.] |
---|
| 111 | |
---|
| 112 | SideEffects [] |
---|
| 113 | |
---|
| 114 | ******************************************************************************/ |
---|
| 115 | int |
---|
| 116 | Sim_SimReadLineNumber( |
---|
| 117 | Sim_Sim_t * sim) |
---|
| 118 | { |
---|
| 119 | return (sim->lineNumber); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | /**Function******************************************************************** |
---|
| 123 | |
---|
| 124 | Synopsis [Returns nodesArray of the sim structure.] |
---|
| 125 | |
---|
| 126 | Description [Returns nodesArray of the sim structure. It is an error to call |
---|
| 127 | this function with a NULL or wrong sim structure.] |
---|
| 128 | |
---|
| 129 | SideEffects [] |
---|
| 130 | |
---|
| 131 | ******************************************************************************/ |
---|
| 132 | array_t * |
---|
| 133 | Sim_SimReadNodesArray( |
---|
| 134 | Sim_Sim_t * sim) |
---|
| 135 | { |
---|
| 136 | return (sim->nodesArray); |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | /**Function******************************************************************** |
---|
| 140 | |
---|
| 141 | Synopsis [Returns the index of the first current-state in nodesArray of |
---|
| 142 | the sim structure.] |
---|
| 143 | |
---|
| 144 | Description [Returns the index of the first current-state in nodesArray of |
---|
| 145 | the sim structure. It is an error to call this function with a NULL or wrong |
---|
| 146 | sim structure.] |
---|
| 147 | |
---|
| 148 | SideEffects [] |
---|
| 149 | |
---|
| 150 | ******************************************************************************/ |
---|
| 151 | int |
---|
| 152 | Sim_SimReadCurrentStateHead( |
---|
| 153 | Sim_Sim_t * sim) |
---|
| 154 | { |
---|
| 155 | return (sim->currentStateHead); |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | /**Function******************************************************************** |
---|
| 159 | |
---|
| 160 | Synopsis [Returns the index of the first next-state in nodesArray of |
---|
| 161 | the sim structure.] |
---|
| 162 | |
---|
| 163 | Description [Returns the index of the first next-state in nodesArray of |
---|
| 164 | the sim structure. It is an error to call this function with a NULL or wrong |
---|
| 165 | sim structure.] |
---|
| 166 | |
---|
| 167 | SideEffects [] |
---|
| 168 | |
---|
| 169 | ******************************************************************************/ |
---|
| 170 | int |
---|
| 171 | Sim_SimReadNextStateHead( |
---|
| 172 | Sim_Sim_t * sim) |
---|
| 173 | { |
---|
| 174 | return (sim->nextStateHead); |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | /**Function******************************************************************** |
---|
| 178 | |
---|
| 179 | Synopsis [Returns the index of the first output in nodesArray of the sim |
---|
| 180 | structure.] |
---|
| 181 | |
---|
| 182 | Description [Returns the index of the first output in nodesArray of the sim |
---|
| 183 | structure. It is an error to call this function with a NULL or wrong sim |
---|
| 184 | structure.] |
---|
| 185 | |
---|
| 186 | SideEffects [] |
---|
| 187 | |
---|
| 188 | ******************************************************************************/ |
---|
| 189 | int |
---|
| 190 | Sim_SimReadOutputHead( |
---|
| 191 | Sim_Sim_t * sim) |
---|
| 192 | { |
---|
| 193 | return (sim->outputHead); |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | /**Function******************************************************************** |
---|
| 197 | |
---|
| 198 | Synopsis [Returns the initial state of the sim structure.] |
---|
| 199 | |
---|
| 200 | Description [Returns the initial state of the sim structure. It is an error |
---|
| 201 | to call this function with a NULL or wrong sim structure.] |
---|
| 202 | |
---|
| 203 | SideEffects [] |
---|
| 204 | |
---|
| 205 | ******************************************************************************/ |
---|
| 206 | array_t * |
---|
| 207 | Sim_SimReadInitState( |
---|
| 208 | Sim_Sim_t * sim) |
---|
| 209 | { |
---|
| 210 | return (sim->initState); |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | /**Function******************************************************************** |
---|
| 214 | |
---|
| 215 | Synopsis [Returns the array of simulation vectors of the sim structure.] |
---|
| 216 | |
---|
| 217 | Description [Returns the array of simulation vectors of the sim |
---|
| 218 | structure. It is an error to call this function with a NULL or wrong sim |
---|
| 219 | structure. The user should not free this array.] |
---|
| 220 | |
---|
| 221 | SideEffects [] |
---|
| 222 | |
---|
| 223 | ******************************************************************************/ |
---|
| 224 | array_t * |
---|
| 225 | Sim_SimReadVectorArray( |
---|
| 226 | Sim_Sim_t * sim) |
---|
| 227 | { |
---|
| 228 | return (sim->vectorArray); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | /**Function******************************************************************** |
---|
| 232 | |
---|
| 233 | Synopsis [Returns 1 if verbose status of the sim structure is true.] |
---|
| 234 | |
---|
| 235 | Description [Returns 1 if verbose status of the sim structure is true. It is |
---|
| 236 | an error to call this function with a NULL or wrong sim structure.] |
---|
| 237 | |
---|
| 238 | SideEffects [] |
---|
| 239 | |
---|
| 240 | ******************************************************************************/ |
---|
| 241 | boolean |
---|
| 242 | Sim_SimTestIsVerbose( |
---|
| 243 | Sim_Sim_t * sim) |
---|
| 244 | { |
---|
| 245 | return (sim->verbose); |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | |
---|
| 251 | |
---|
| 252 | |
---|
| 253 | |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | |
---|
| 266 | |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | |
---|
| 270 | |
---|
| 271 | |
---|