Add the -I and -D switches to iverilog.

This commit is contained in:
steve 2000-05-05 01:07:42 +00:00
parent f847b9cfeb
commit 43643ba98f
2 changed files with 57 additions and 9 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: iverilog.c,v 1.10 2000/05/04 20:08:20 steve Exp $"
#ident "$Id: iverilog.c,v 1.11 2000/05/05 01:07:42 steve Exp $"
#endif
#include <stdio.h>
@ -36,6 +36,9 @@ const char*start = 0;
char warning_flags[16] = "";
char*inc_list = 0;
char*def_list = 0;
char*f_list = 0;
int synth_flag = 0;
@ -210,12 +213,25 @@ int main(int argc, char **argv)
int opt, idx;
char*cp;
while ((opt = getopt(argc, argv, "B:Ef:o:Ss:t:vW:")) != EOF) {
while ((opt = getopt(argc, argv, "B:D:Ef:I:o:Ss:t:vW:")) != EOF) {
switch (opt) {
case 'B':
base = optarg;
break;
case 'D':
if (def_list == 0) {
def_list = malloc(strlen(" -D")+strlen(optarg)+1);
strcpy(def_list, " -D");
strcat(def_list, optarg);
} else {
def_list = realloc(def_list, strlen(def_list)
+ strlen(" -D")
+ strlen(optarg) + 1);
strcat(def_list, " -D");
strcat(def_list, optarg);
}
break;
case 'E':
e_flag = 1;
break;
@ -232,6 +248,19 @@ int main(int argc, char **argv)
strcat(f_list, optarg);
}
break;
case 'I':
if (inc_list == 0) {
inc_list = malloc(strlen(" -I")+strlen(optarg)+1);
strcpy(inc_list, " -I");
strcat(inc_list, optarg);
} else {
inc_list = realloc(inc_list, strlen(inc_list)
+ strlen(" -I")
+ strlen(optarg) + 1);
strcat(inc_list, " -I");
strcat(inc_list, optarg);
}
break;
case 'o':
opath = optarg;
break;
@ -271,6 +300,18 @@ int main(int argc, char **argv)
cmd = malloc(ncmd + 1);
strcpy(cmd, tmp);
if (inc_list) {
cmd = realloc(cmd, ncmd + strlen(inc_list) + 1);
strcat(cmd, inc_list);
ncmd += strlen(inc_list);
}
if (def_list) {
cmd = realloc(cmd, ncmd + strlen(def_list) + 1);
strcat(cmd, def_list);
ncmd += strlen(def_list);
}
/* Add all the verilog source files to the preprocess command line. */
for (idx = optind ; idx < argc ; idx += 1) {
@ -314,6 +355,9 @@ int main(int argc, char **argv)
/*
* $Log: iverilog.c,v $
* Revision 1.11 2000/05/05 01:07:42 steve
* Add the -I and -D switches to iverilog.
*
* Revision 1.10 2000/05/04 20:08:20 steve
* Tell ivlpp to generate line number directives.
*

View File

@ -1,4 +1,4 @@
.TH iverilog 1 "April, 2000" Version 19990913
.TH iverilog 1 "$Date: 2000/05/05 01:07:42 $" Version "$Date: 2000/05/05 01:07:42 $"
.SH NAME
iverilog - Icarus Verilog compiler
@ -26,10 +26,12 @@ switch allows the user to select a different set of programs. The path
given is used to locate \fIivlpp\fP, \fIivl\fP and the VPI modules.
.TP 8
.B -D\fImacro\fP
Defines macro \fImacro\fP with the string `1' as its definition. (NOT IMPLEMENTED)
Defines macro \fImacro\fP with the string `1' as its definition. This
form is normally only used to trigger ifdef conditionals in the
Verilog source.
.TP 8
.B -D\fImacro=defn\fP
Defines macro \fImacro\fP as \fIdefn\fP. (NOT IMPLEMENTED)
Defines macro \fImacro\fP as \fIdefn\fP.
.TP 8
.B -E
Preprocess the Verilog source, but do not compile it. The output file
@ -43,9 +45,11 @@ used as often as necessary to specify all the desired flags. The flags
that are used depend on the target that is selected, and are described
in target specific documentation. Flags that are not used are ignored.
.TP 8
.B -I\fIincludepath\fP
Append path \fIincludepath\fP to list of paths searched for Verilog
include files. (NOT IMPLEMENTED)
.B -I\fIincludedir\fP
Append directory \fIincludepdir\fP to list of directoriess searched
for Verilog include files. The \fB-I\fP switch may be used many times
to specify several directories to search, the directories are searched
in the order they appear on the command line.
.TP 8
.B -m\fImodule\fP
Add this module to the list of VPI modules to be loaded by the
@ -57,7 +61,7 @@ specified, \fIiverilog\fP uses the default name \fBa.out\fP.
.TP 8
.B -S
Synthesize. Normally, if the target can accept behavioral
descriptions, the compiler will leave processes in behavioral
descriptions the compiler will leave processes in behavioral
form. The \fB-S\fP switch causes the compiler to perform synthesis
even if it is not necessary for the target. If the target type is a
netlist format, the \fB-S\fP switch is unnecessary and has no effect.