forked from steveicarus/iverilog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsys_table.c
219 lines (174 loc) · 6.34 KB
/
sys_table.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*
* Copyright (c) 1999-2018 Stephen Williams ([email protected])
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
# include "vpi_config.h"
# include "vpi_user.h"
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
extern void sys_convert_register(void);
extern void sys_countdrivers_register(void);
extern void sys_darray_register(void);
extern void sys_fileio_register(void);
extern void sys_finish_register(void);
extern void sys_deposit_register(void);
extern void sys_display_register(void);
extern void sys_plusargs_register(void);
extern void sys_queue_register(void);
extern void sys_random_register(void);
extern void sys_random_mti_register(void);
extern void sys_readmem_register(void);
extern void sys_scanf_register(void);
extern void sys_sdf_register(void);
extern void sys_time_register(void);
extern void sys_vcd_register(void);
extern void sys_vcdoff_register(void);
extern void sys_special_register(void);
extern void table_model_register(void);
extern void vams_simparam_register(void);
#ifdef HAVE_LIBZ
#ifdef HAVE_LIBBZ2
extern void sys_lxt_register(void);
#else
static void sys_lxt_register(void) { fputs("LXT support disabled since libbzip2 not available\n",stderr); exit(1); }
#endif
extern void sys_lxt2_register(void);
extern void sys_fst_register(void);
#else
static void sys_lxt_register(void) { fputs("LXT support disabled since zlib not available\n",stderr); exit(1); }
static void sys_lxt2_register(void) { fputs("LXT2 support disabled since zlib not available\n",stderr); exit(1); }
static void sys_fst_register(void) { fputs("FST support disabled since zlib not available\n",stderr); exit(1); }
#endif
static void sys_lxt_or_vcd_register(void)
{
int idx;
struct t_vpi_vlog_info vlog_info;
const char*dumper;
/* Get the dumper of choice from the IVERILOG_DUMPER
environment variable. */
dumper = getenv("IVERILOG_DUMPER");
if (dumper) {
char*cp = strchr(dumper,'=');
if (cp != 0)
dumper = cp + 1;
} else {
dumper = "vcd";
}
/* Scan the extended arguments, looking for flags that select
major features. This can override the environment variable
settings. */
vpi_get_vlog_info(&vlog_info);
for (idx = 0 ; idx < vlog_info.argc ; idx += 1) {
if (strcmp(vlog_info.argv[idx],"-fst") == 0) {
dumper = "fst";
} else if (strcmp(vlog_info.argv[idx],"-fst-space") == 0) {
dumper = "fst";
} else if (strcmp(vlog_info.argv[idx],"-fst-speed") == 0) {
dumper = "fst";
} else if (strcmp(vlog_info.argv[idx],"-fst-space-speed") == 0) {
dumper = "fst";
} else if (strcmp(vlog_info.argv[idx],"-fst-speed-space") == 0) {
dumper = "fst";
} else if (strcmp(vlog_info.argv[idx],"-fst-none") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-lxt") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-lxt-space") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-lxt-speed") == 0) {
dumper = "lxt";
} else if (strcmp(vlog_info.argv[idx],"-lxt-none") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-lxt2") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lxt2-space") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lxt2-speed") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lxt2-none") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-lx2") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lx2-space") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lx2-speed") == 0) {
dumper = "lxt2";
} else if (strcmp(vlog_info.argv[idx],"-lx2-none") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-vcd") == 0) {
dumper = "vcd";
} else if (strcmp(vlog_info.argv[idx],"-vcd-off") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-vcd-none") == 0) {
dumper = "none";
} else if (strcmp(vlog_info.argv[idx],"-none") == 0) {
dumper = "none";
}
}
if (strcmp(dumper, "vcd") == 0)
sys_vcd_register();
else if (strcmp(dumper, "VCD") == 0)
sys_vcd_register();
else if (strcmp(dumper, "fst") == 0)
sys_fst_register();
else if (strcmp(dumper, "FST") == 0)
sys_fst_register();
else if (strcmp(dumper, "lxt") == 0)
sys_lxt_register();
else if (strcmp(dumper, "LXT") == 0)
sys_lxt_register();
else if (strcmp(dumper, "lxt2") == 0)
sys_lxt2_register();
else if (strcmp(dumper, "LXT2") == 0)
sys_lxt2_register();
else if (strcmp(dumper, "lx2") == 0)
sys_lxt2_register();
else if (strcmp(dumper, "LX2") == 0)
sys_lxt2_register();
else if (strcmp(dumper, "none") == 0)
sys_vcdoff_register();
else if (strcmp(dumper, "NONE") == 0)
sys_vcdoff_register();
else {
vpi_mcd_printf(1, "system.vpi: Unknown dumper format: %s,"
" using VCD instead.\n", dumper);
sys_vcd_register();
}
}
void (*vlog_startup_routines[])(void) = {
sys_convert_register,
sys_countdrivers_register,
sys_darray_register,
sys_fileio_register,
sys_finish_register,
sys_deposit_register,
sys_display_register,
sys_plusargs_register,
sys_queue_register,
sys_random_register,
sys_random_mti_register,
sys_readmem_register,
sys_scanf_register,
sys_time_register,
sys_lxt_or_vcd_register,
sys_sdf_register,
sys_special_register,
table_model_register,
vams_simparam_register,
0
};