Careful not to lose bits parameter add expression
[iverilog.git] / vpi / sys_table.c
blob44142d391fbef81a59802f4fc8583deca46a5f4b
1 /*
2 * Copyright (c) 1999 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: sys_table.c,v 1.26 2006/08/03 05:06:04 steve Exp $"
21 #endif
23 # include "vpi_config.h"
24 # include "vpi_user.h"
25 # include <stdio.h>
26 # include <stdlib.h>
27 # include <string.h>
29 extern void sys_convert_register();
30 extern void sys_fileio_register();
31 extern void sys_finish_register();
32 extern void sys_deposit_register();
33 extern void sys_display_register();
34 extern void sys_plusargs_register();
35 extern void sys_random_register();
36 extern void sys_random_mti_register();
37 extern void sys_readmem_register();
38 extern void sys_scanf_register();
39 extern void sys_time_register();
40 extern void sys_vcd_register();
41 extern void sys_vcdoff_register();
43 #ifdef HAVE_LIBZ
44 extern void sys_lxt_register();
45 extern void sys_lxt2_register();
46 #else
47 static void sys_lxt_register() { fputs("LXT support disabled since zlib not available\n",stderr); exit(1); }
48 static void sys_lxt2_register() { fputs("LXT2 support disabled since zlib not available\n",stderr); exit(1); }
49 #endif
51 static void sys_lxt_or_vcd_register()
53 int idx;
54 struct t_vpi_vlog_info vlog_info;
56 char*dumper;
58 /* Get the dumper of choice from the IVERILOG_DUMPER
59 environment variable. */
60 dumper = getenv("IVERILOG_DUMPER");
61 if (dumper) {
62 char*cp = strchr(dumper,'=');
63 if (cp != 0)
64 dumper = cp + 1;
66 } else {
67 dumper = "vcd";
70 /* Scan the extended arguments, looking for flags that select
71 major features. This can override the environment variable
72 settings. */
73 vpi_get_vlog_info(&vlog_info);
75 for (idx = 0 ; idx < vlog_info.argc ; idx += 1) {
77 if (strcmp(vlog_info.argv[idx],"-lxt") == 0) {
78 dumper = "lxt";
80 } else if (strcmp(vlog_info.argv[idx],"-lxt-space") == 0) {
81 dumper = "lxt";
83 } else if (strcmp(vlog_info.argv[idx],"-lxt-speed") == 0) {
84 dumper = "lxt";
86 } else if (strcmp(vlog_info.argv[idx],"-lxt-none") == 0) {
87 dumper = "none";
89 } else if (strcmp(vlog_info.argv[idx],"-lxt2") == 0) {
90 dumper = "lxt2";
92 } else if (strcmp(vlog_info.argv[idx],"-lxt2-space") == 0) {
93 dumper = "lxt2";
95 } else if (strcmp(vlog_info.argv[idx],"-lxt2-speed") == 0) {
96 dumper = "lxt2";
98 } else if (strcmp(vlog_info.argv[idx],"-lxt2-none") == 0) {
99 dumper = "none";
101 } else if (strcmp(vlog_info.argv[idx],"-vcd") == 0) {
102 dumper = "vcd";
104 } else if (strcmp(vlog_info.argv[idx],"-vcd-off") == 0) {
105 dumper = "none";
107 } else if (strcmp(vlog_info.argv[idx],"-vcd-none") == 0) {
108 dumper = "none";
113 if (strcmp(dumper, "vcd") == 0)
114 sys_vcd_register();
116 else if (strcmp(dumper, "VCD") == 0)
117 sys_vcd_register();
119 else if (strcmp(dumper, "lxt") == 0)
120 sys_lxt_register();
122 else if (strcmp(dumper, "LXT") == 0)
123 sys_lxt_register();
125 else if (strcmp(dumper, "lxt2") == 0)
126 sys_lxt2_register();
128 else if (strcmp(dumper, "LXT2") == 0)
129 sys_lxt2_register();
131 else if (strcmp(dumper, "none") == 0)
132 sys_vcdoff_register();
134 else if (strcmp(dumper, "NONE") == 0)
135 sys_vcdoff_register();
137 else {
138 fprintf(stderr, "system.vpi: Unknown dumper format: %s\n",
139 dumper);
140 sys_vcd_register();
144 void (*vlog_startup_routines[])() = {
145 sys_convert_register,
146 sys_fileio_register,
147 sys_finish_register,
148 sys_deposit_register,
149 sys_display_register,
150 sys_plusargs_register,
151 sys_random_register,
152 sys_random_mti_register,
153 sys_readmem_register,
154 sys_scanf_register,
155 sys_time_register,
156 sys_lxt_or_vcd_register,
162 * $Log: sys_table.c,v $
163 * Revision 1.26 2006/08/03 05:06:04 steve
164 * Add the scanf functions.
166 * Revision 1.25 2004/06/09 22:14:10 steve
167 * Move Mersenne Twister to $mti_random, and make
168 * the standard $random standard. Also, add $dist_poisson.
170 * Revision 1.24 2004/01/21 01:22:53 steve
171 * Give the vip directory its own configure and vpi_config.h
173 * Revision 1.23 2003/10/30 04:52:54 steve
174 * Call register for fileio functions.
176 * Revision 1.22 2003/09/13 01:28:47 steve
177 * Disable lxt when zlib is missing.
179 * Revision 1.21 2003/09/01 04:04:03 steve
180 * Add lxt2 support.
182 * Revision 1.20 2003/03/07 02:44:34 steve
183 * Implement $realtobits.
185 * Revision 1.19 2003/03/06 20:04:42 steve
186 * Add means to suppress wveform output
188 * Revision 1.18 2003/02/20 00:50:06 steve
189 * Update lxt_write implementation, and add compression control flags.
191 * Revision 1.17 2002/08/12 01:35:05 steve
192 * conditional ident string using autoconfig.
194 * Revision 1.16 2002/04/07 04:37:53 steve
195 * Add $plusargs system functions.
197 * Revision 1.15 2002/04/06 21:33:29 steve
198 * allow runtime selection of VCD vs LXT.
200 * Revision 1.14 2002/03/09 21:54:49 steve
201 * Add LXT dumper support. (Anthony Bybell)
203 * Revision 1.13 2001/09/30 16:45:10 steve
204 * Fix some Cygwin DLL handling. (Venkat Iyer)
206 * Revision 1.12 2001/07/25 03:10:50 steve
207 * Create a config.h.in file to hold all the config
208 * junk, and support gcc 3.0. (Stephan Boettcher)