Fix for pr1833776.
[iverilog.git] / compiler.h
blobf8e791b60c99e433b04da2f5aafeb986d14a5525
1 #ifndef __compiler_H
2 #define __compiler_H
3 /*
4 * Copyright (c) 1999-2004 Stephen Williams (steve@icarus.com)
6 * This source code is free software; you can redistribute it
7 * and/or modify it in source code form under the terms of the GNU
8 * General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 # include <list>
23 # include <map>
24 # include "netlist.h"
25 # include "StringHeap.h"
28 * This defines constants and defaults for the compiler in general.
33 * The integer_width is the width of integer variables. This is also
34 * the minimum width of unsized integers when they are found in
35 * self-determined contexts.
37 extern unsigned integer_width;
39 /* The TIME_WIDTH is the width of time variables. */
40 #ifndef TIME_WIDTH
41 # define TIME_WIDTH 64
42 #endif
45 * When doing dynamic linking, we need a uniform way to identify the
46 * symbol. Some compilers put leading _, some trailing _. The
47 * configure script figures out which is the local convention and
48 * defines NEED_LU and NEED_TU as required.
50 #ifdef NEED_LU
51 #define LU "_"
52 #else
53 #define LU ""
54 #endif
56 #ifdef NEED_TU
57 #define TU "_"
58 #else
59 #define TU ""
60 #endif
64 * These are flags to enable various sorts of warnings. By default all
65 * the warnings are off, the -W<list> parameter arranges for each to be
66 * enabled.
69 /* Implicit definitions of wires. */
70 extern bool warn_implicit;
71 extern bool error_implicit;
73 /* inherit timescales across files. */
74 extern bool warn_timescale;
76 /* Warn about legal but questionable module port bindings. */
77 extern bool warn_portbinding;
79 /* This is true if verbose output is requested. */
80 extern bool verbose_flag;
82 extern bool debug_scopes;
83 extern bool debug_eval_tree;
84 extern bool debug_elaborate;
85 extern bool debug_synth2;
87 /* Path to a directory useful for finding subcomponents. */
88 extern const char*basedir;
90 /* This is an ordered list of library suffixes to search. */
91 extern list<const char*>library_suff;
92 extern int build_library_index(const char*path, bool key_case_sensitive);
94 /* This is the generation of Verilog that the compiler is asked to
95 support. Then there are also more detailed controls for more
96 specific language features. */
97 enum generation_t {
98 GN_VER1995 = 1,
99 GN_VER2001 = 2,
100 GN_VER2001X = 3,
101 GN_DEFAULT = 3
104 extern generation_t generation_flag;
106 extern bool gn_cadence_types_flag;
108 /* These functions test that specific features are enabled. */
109 inline bool gn_cadence_types_enabled()
110 { return gn_cadence_types_flag && generation_flag==GN_VER2001X; }
112 /* If this flag is true, then elaborate specify blocks. If this flag
113 is false, then skip elaboration of specify behavior. */
114 extern bool gn_specify_blocks_flag;
116 /* If this flag is false a warning is printed when the port declaration
117 is scalar and the net/register definition is vectored. */
118 extern bool gn_io_range_error_flag;
120 /* This is the string to use to invoke the preprocessor. */
121 extern char*ivlpp_string;
123 extern map<perm_string,unsigned> missing_modules;
125 /* Files that are library files are in this map. The lexor compares
126 file names as it processes `line directives, and if the file name
127 matches an entry in this table, it will turn on the
128 library_active_flag so that modules know that they are in a
129 library. */
130 extern map<string,bool> library_file_map;
133 * the lex_strings are perm_strings made up of tokens from the source
134 * file. Identifiers are so likely to be used many times that it makes
135 * much sense to use a StringHeapLex to hold them.
137 extern StringHeapLex lex_strings;
138 extern StringHeap misc_strings;
141 * system task/function listings.
144 * This table describes all the return values of various system
145 * functions. This table is used to elaborate expressions that are
146 * system function calls.
148 struct sfunc_return_type {
149 const char* name;
150 ivl_variable_type_t type;
151 unsigned wid;
152 int signed_flag;
155 extern const struct sfunc_return_type* lookup_sys_func(const char*name);
156 extern int load_sys_func_table(const char*path);
158 #endif