Qucs-core  0.0.19
check_vcd.h
Go to the documentation of this file.
00001 /*
00002  * check_vcd.h - checker definitions for a vcd file
00003  *
00004  * Copyright (C) 2005 Raimund Jacob <raimi@lkcc.org>
00005  * Copyright (C) 2005, 2006, 2008 Stefan Jahn <stefan@lkcc.org>
00006  *
00007  * This is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * This software is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this package; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00020  * Boston, MA 02110-1301, USA.  
00021  *
00022  * $Id$
00023  *
00024  */
00025 
00026 #ifndef __CHECK_VCD_H__
00027 #define __CHECK_VCD_H__
00028 
00029 /* Externalize variables used by the scanner and parser. */
00030 extern int vcd_lineno;
00031 extern FILE * vcd_in;
00032 
00033 /* Useful defines. */
00034 #define VCD_NOSCOPE "noscope"
00035 #define VCD_FAST 1
00036 
00037 __BEGIN_DECLS
00038 
00039 /* Externalize variables used by the scanner, parser, checker and producer. */
00040 extern struct vcd_file * vcd;
00041 extern struct dataset_variable * dataset_root;
00042 extern int vcd_correct;
00043 
00044 /* Available functions of the checker. */
00045 int  vcd_checker (void);
00046 int  vcd_parse (void);
00047 int  vcd_error (const char *);
00048 int  vcd_lex (void);
00049 int  vcd_lex_destroy (void);
00050 void vcd_destroy (void);
00051 void vcd_init (void);
00052 
00053 __END_DECLS
00054 
00055 /* Declaration of VCD data structures. */
00056 
00057 // Types of VCD variables.
00058 enum vcd_vartypes {
00059   VAR_EVENT,
00060   VAR_INTEGER,
00061   VAR_PARAMETER,
00062   VAR_REAL,
00063   VAR_REG,
00064   VAR_SUPPLY0,
00065   VAR_SUPPLY1,
00066   VAR_TIME,
00067   VAR_TRI,
00068   VAR_TRIAND,
00069   VAR_TRIOR,
00070   VAR_TRIREG,
00071   VAR_TRI0,
00072   VAR_TRI1,
00073   VAR_WAND,
00074   VAR_WIRE,
00075   VAR_WOR
00076 };
00077 
00078 // Range definition.
00079 struct vcd_range {
00080   int l;
00081   int h;
00082 };
00083 
00084 // Variable definition.
00085 struct vcd_vardef {
00086   enum vcd_vartypes type;   // type
00087   int size;                 // size in bits
00088   char * code;              // identifier code, used to reference 'ident'
00089   char * ident;             // variable identifier
00090   struct vcd_range * range; // range, e.g. [0] or [3:15]
00091   struct vcd_scope * scope; // scope of variable
00092   struct vcd_vardef * next;
00093 };
00094 
00095 // Types of VCD scopes.
00096 enum vcd_scopes {
00097   SCOPE_MODULE,
00098   SCOPE_TASK,
00099   SCOPE_FUNCTION,
00100   SCOPE_BEGIN,
00101   SCOPE_FORK
00102 };
00103 
00104 // Scope definition.
00105 struct vcd_scope {
00106   enum vcd_scopes type;        // type
00107   char * ident;                // scope identifier
00108   struct vcd_vardef * vardefs; // variable definitions
00109   struct vcd_scope * scopes;   // sub-scopes
00110   struct vcd_scope * parent;   // parent scope
00111   struct vcd_scope * next;
00112 };
00113 
00114 // Value change definition.
00115 struct vcd_change {
00116   char * value;            // the value
00117   char * code;             // identifier code, references 'var'
00118   int isreal;              // indicates type of value
00119   struct vcd_vardef * var; // pointer to variable
00120   struct vcd_change * next;
00121 };
00122 
00123 // A full set of VCD value changes.
00124 struct vcd_changeset {
00125   double t;                    // time stamp
00126   struct vcd_change * changes; // list of VCD changes 
00127 #ifndef VCD_FAST
00128   int done;                    // flag for the checker
00129 #endif
00130   struct vcd_changeset * next;
00131 };
00132 
00133 // Representation of a VCD file.
00134 struct vcd_file {
00135   int t;                             // time scale (1, 10 or 100)
00136   double scale;                      // time unit factor
00137   struct vcd_scope * scopes;         // scopes
00138   struct vcd_scope * currentscope;   // the current scope
00139   struct vcd_changeset * changesets; // change sets
00140 };
00141 
00142 /* Checker specific data structures. */
00143 
00144 // A VCD variable.
00145 struct vcd_variable {
00146   char * code;  // identifier code, references 'var'
00147   char * ident; // variable identifer
00148   char * value; // the value
00149   int isreal;   // indicates type of value
00150   int type;     // variable type
00151   struct vcd_variable * next;
00152 };
00153 
00154 // A VCD change set.
00155 struct vcd_set {
00156   double t;                        // time stamp
00157   struct vcd_variable * variables; // list of VCD variables
00158   struct vcd_set * next;
00159 };
00160 
00161 /* Qucs dataset specific data structures. */
00162 
00163 // Dataset value structure.
00164 struct dataset_value {
00165   char * value; // the value
00166   struct dataset_value * next;
00167 };
00168 
00169 // Types of dataset variables.
00170 enum dataset_vartypes {
00171   DATA_UNKNOWN,
00172   DATA_DEPENDENT,
00173   DATA_INDEPENDENT
00174 };
00175 
00176 // The dataset vector representation.
00177 struct dataset_variable {
00178   enum dataset_vartypes type;    // type of variable
00179   int output;                    // should it be exported?
00180   int size;                      // length of the vector
00181   char * ident;                  // variable identifier
00182   char * dependencies;           // variable dependencies (if dependent)
00183   int isreal;                    // indicates type of values
00184   struct dataset_value * values; // list of values
00185   struct dataset_variable * next;
00186 };
00187 
00188 #endif /* __CHECK_VCD_H__ */