source: vis_dev/vis-2.3/src/sim/sim.h @ 86

Last change on this file since 86 was 14, checked in by cecile, 13 years ago

vis2.3

File size: 6.7 KB
RevLine 
[14]1/**CHeaderFile*****************************************************************
2
3  FileName    [sim.h]
4
5  PackageName [sim]
6
7  Synopsis    [Simulation of a flattened network.]
8
9  Description [The sim package provides functions for simulation. It also
10  provides the "simulate" command in the VIS environment. The simulate command
11  performs a simulation of a network or a part of a network.
12  <p>
13  sim conceives simulation through three operations:
14  <p>
15  1- Build simulation vectors.
16  <p>
17  2- Simulate.
18  <p>
19  3- Print the result.
20  <p>
21  Exported functions make it possible to build an internal data-structure, and
22  perform the three operations given above. Simulation vectors may be provided
23  by the user. Using exported functions, it is also possible to generate
24  simulation vectors randomly or reading it from a file. Low level functions
25  are also available that evaluate, for example, a network node using a
26  simulation vector. An example of a simulation vectors file may be generated
27  using the simulate command with random-vectors-generation option, in VIS.
28  <p>
29  WARNING : In order to improve the speed of simulation, it is assumed that
30  each combinational output function is completely specified, and that each
31  simulation vector specifies a minterm over the combinational inputs this
32  assumption is not checked. Incorrect results may be produced if this
33  assumption is violated.]
34
35  Author      [Shaker Sarwary and Tom Shiple]
36
37  Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California.
38  All rights reserved.
39
40  Permission is hereby granted, without written agreement and without license
41  or royalty fees, to use, copy, modify, and distribute this software and its
42  documentation for any purpose, provided that the above copyright notice and
43  the following two paragraphs appear in all copies of this software.
44
45  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
46  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
47  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
48  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49
50  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
51  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
52  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
53  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
54  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.]
55
56  Revision    [$Id: sim.h,v 1.5 2002/09/08 23:33:35 fabio Exp $]
57
58******************************************************************************/
59
60#ifndef _SIM
61#define _SIM
62
63/*---------------------------------------------------------------------------*/
64/* Nested includes                                                           */
65/*---------------------------------------------------------------------------*/
66#include "ntk.h"
67
68/*---------------------------------------------------------------------------*/
69/* Type declarations                                                         */
70/*---------------------------------------------------------------------------*/
71
72/* Sim main Data structure type */
73
74typedef struct SimSimStruct Sim_Sim_t;
75
76/**Enum************************************************************************
77
78  Synopsis    [Pseudo-inputs source.]
79
80  Description [Pseudo-inputs source. There are 4 possible source :
81  ---> undefined : If input vectors are read from a file, then user must
82  specify the pseudo-inputs. If vectors are generated randomly, then
83  pseudo-inputs are chosen randomly.
84  ---> user : Pseudo-inputs are specified in the input vectors file.
85  ---> random : Pseudo-inputs are generated randomly. If vectors are read from
86  a file, this option cannot be used.
87  ---> first : The first value of pseudo-input in the array of value of the
88  variable is chosen. If vectors are read from a file, this option cannot be used.
89
90******************************************************************************/
91typedef enum {
92  Sim_Undef_c,
93  Sim_User_c,
94  Sim_Random_c,
95  Sim_First_c
96} Sim_PseudoSrc;
97
98
99/**AutomaticStart*************************************************************/
100
101/*---------------------------------------------------------------------------*/
102/* Function prototypes                                                       */
103/*---------------------------------------------------------------------------*/
104
105EXTERN void Sim_SimPrint(Sim_Sim_t * sim, FILE * of, boolean printMode, int printInputsFlag, int printOutputsFlag, int printPseudoInputsFlag, int printStatesFlag);
106EXTERN Sim_Sim_t * Sim_FileParseDeclaration(Ntk_Network_t * network, FILE * fp, char * inputFile, boolean verbose);
107EXTERN int Sim_FileParseVectors(FILE * fp, Sim_Sim_t * sim, int num);
108EXTERN void Sim_Init(void);
109EXTERN void Sim_End(void);
110EXTERN Sim_Sim_t * Sim_SimCreate(Ntk_Network_t * network, st_table * nodeToMvfTable, char * inputFile, int lineNumber, array_t * nodesArray, int currentStateHead, int internalPartitionHead, int nextStateHead, int outputHead, array_t * initState, array_t * vectorArray, boolean verbose);
111EXTERN void Sim_SimReset(Sim_Sim_t * sim);
112EXTERN void Sim_SimFree(Sim_Sim_t * sim);
113EXTERN array_t * Sim_NetworkCreateNodesArray(Ntk_Network_t * network, int * currentStateHead, int * internalPartitionHead, int * nextStateHead, int * outputHead);
114EXTERN void Sim_SimGenerateRandomVectors(Sim_Sim_t * sim, int numberVector, Sim_PseudoSrc pseudoInputSource);
115EXTERN void Sim_SimGenerateRandomInitState(Sim_Sim_t * sim);
116EXTERN void Sim_SimSimulate(Sim_Sim_t * sim);
117EXTERN int Sim_nodeToMvfTableEvaluateNode(st_table * nodeToMvfTable, Ntk_Node_t * node, mdd_t * vectorMdd);
118EXTERN array_t * Sim_nodeToMvfTableEvaluateNodesArray(st_table * nodeToMvfTable, array_t * nodesArray, mdd_t * vectorMdd);
119EXTERN mdd_t * Sim_RandomSimulate(Ntk_Network_t * network, int num, boolean verbose);
120EXTERN Ntk_Network_t * Sim_SimReadNetwork(Sim_Sim_t * sim);
121EXTERN st_table * Sim_SimReadNodeToMvfTable(Sim_Sim_t * sim);
122EXTERN char * Sim_SimReadInputFile(Sim_Sim_t * sim);
123EXTERN int Sim_SimReadLineNumber(Sim_Sim_t * sim);
124EXTERN array_t * Sim_SimReadNodesArray(Sim_Sim_t * sim);
125EXTERN int Sim_SimReadCurrentStateHead(Sim_Sim_t * sim);
126EXTERN int Sim_SimReadNextStateHead(Sim_Sim_t * sim);
127EXTERN int Sim_SimReadOutputHead(Sim_Sim_t * sim);
128EXTERN array_t * Sim_SimReadInitState(Sim_Sim_t * sim);
129EXTERN array_t * Sim_SimReadVectorArray(Sim_Sim_t * sim);
130EXTERN boolean Sim_SimTestIsVerbose(Sim_Sim_t * sim);
131EXTERN st_table * Sim_NetworkBuildNodeToMvfTable(Ntk_Network_t *network, array_t *nodesArray, int internalPartitionHead, int nextStateHead);
132
133/**AutomaticEnd***************************************************************/
134
135#endif /* _SIM */
136
137
Note: See TracBrowser for help on using the repository browser.