1 /* 2 * Copyright (c) 2001 Tony Bybell. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 * DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef L2V_ANALYZER_H 24 #define L2V_ANALYZER_H 25 26 #include <stdio.h> 27 #include <stdlib.h> 28 #include <string.h> 29 #include <ctype.h> 30 #include <fcntl.h> 31 #include <errno.h> 32 #include <sys/types.h> 33 #include <sys/stat.h> 34 #ifdef HAVE_INTTYPES_H 35 #include <inttypes.h> 36 #endif 37 38 #ifndef _AIX 39 #if HAVE_GETOPT_H 40 #include <getopt.h> 41 #endif 42 #endif 43 44 #include "v2l_debug_lxt2.h" 45 46 #ifndef _MSC_VER 47 #include <unistd.h> 48 #endif 49 50 51 #define SYMPRIME 500009 52 #define WAVE_DECOMPRESSOR "gzip -cd " /* zcat alone doesn't cut it for AIX */ 53 54 55 typedef struct Node *nptr; 56 typedef struct HistEnt *hptr; 57 58 59 typedef struct HistEnt 60 { 61 hptr next; /* next transition in history */ 62 TimeType time; /* time of transition */ 63 TimeType previous_width; /* to avoid thrashing */ 64 65 union 66 { 67 unsigned char val; /* value: "0XU1"[val] */ 68 char *vector; /* pointer to a whole vector */ 69 } v; 70 71 } HistEnt; 72 73 74 typedef struct ExtNode 75 { 76 int msi, lsi; 77 } ExtNode; 78 79 struct Node 80 { 81 char *nname; /* ascii name of node */ 82 ExtNode *ext; /* extension to node for vectors */ 83 HistEnt head; /* first entry in transition history */ 84 hptr curr; /* ptr. to current history entry */ 85 86 hptr *harray; /* fill this in when we make a trace.. contains */ 87 /* a ptr to an array of histents for bsearching */ 88 int numhist; /* number of elements in the harray */ 89 char notdead; /* indicates if this node gets a non-x value */ 90 int numtrans; /* number of transitions */ 91 92 struct Node *substnode; /* pointer to substitutions on buses */ 93 struct Node *substhead; /* pointer to substitution head (originator) on buses */ 94 }; 95 96 97 struct symbol 98 { 99 struct symbol *nextinaet;/* for aet node chaining */ 100 struct HistEnt *h; /* points to previous one */ 101 102 struct symbol *next; /* for hash chain */ 103 char *name; 104 char selected; /* for the clist object */ 105 106 struct Node *n; 107 108 }; 109 110 111 struct slist 112 { 113 struct slist *next; 114 char *str; 115 int len; 116 }; 117 118 119 struct vcdsymbol 120 { 121 struct vcdsymbol *next; 122 void *ltsym; 123 char *name; 124 char *id; 125 char *value; 126 struct queuedevent *ev; /* only if vartype==V_EVENT */ 127 struct Node **narray; 128 unsigned int nid; 129 int msi, lsi; 130 int size; 131 unsigned char vartype; 132 }; 133 134 135 struct queuedevent 136 { 137 struct queuedevent *next; 138 struct vcdsymbol *sym; 139 TimeType last_event_time; /* make +1 == 0 if there's not an event there too */ 140 }; 141 142 143 struct symbol *symfind(char *); 144 struct symbol *symadd(char *, int); 145 int hash(char *s); 146 int sigcmp(char *, char *); 147 void quicksort(struct symbol **, int, int); 148 149 TimeType vcd_main(char *fname, char *lxname); 150 void append_vcd_slisthier(char *str); 151 152 #endif 153 154