Iverilog driver tells ivlpp how to find vhdlpp.

This commit is contained in:
Stephen Williams 2010-12-22 09:57:10 +02:00
parent 05122d3e2c
commit 1f6bf09984
1 changed files with 24 additions and 13 deletions

View File

@ -106,7 +106,8 @@ const char sep = '/';
extern void cfreset(FILE*fd, const char*path); extern void cfreset(FILE*fd, const char*path);
const char*base = 0; const char*base = 0;
const char*pbase = 0; const char*ivlpp_dir = 0;
const char*vhdlpp_dir= 0;
const char*mtm = 0; const char*mtm = 0;
const char*opath = "a.out"; const char*opath = "a.out";
const char*npath = 0; const char*npath = 0;
@ -304,7 +305,7 @@ static int t_version_only(void)
free(source_path); free(source_path);
fflush(0); fflush(0);
snprintf(tmp, sizeof tmp, "%s%civlpp -V", pbase, sep); snprintf(tmp, sizeof tmp, "%s%civlpp -V", ivlpp_dir, sep);
rc = system(tmp); rc = system(tmp);
if (rc != 0) { if (rc != 0) {
fprintf(stderr, "Unable to get version from \"%s\"\n", tmp); fprintf(stderr, "Unable to get version from \"%s\"\n", tmp);
@ -333,7 +334,7 @@ static int t_version_only(void)
static void build_preprocess_command(int e_flag) static void build_preprocess_command(int e_flag)
{ {
snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F\"%s\" -f\"%s\" -p\"%s\" ", snprintf(tmp, sizeof tmp, "%s%civlpp %s%s -F\"%s\" -f\"%s\" -p\"%s\" ",
pbase, sep, verbose_flag?" -v":"", ivlpp_dir, sep, verbose_flag?" -v":"",
e_flag?"":" -L", defines_path, source_path, e_flag?"":" -L", defines_path, source_path,
compiled_defines_path); compiled_defines_path);
} }
@ -875,14 +876,20 @@ int main(int argc, char **argv)
switch (opt) { switch (opt) {
case 'B': case 'B':
/* Undocumented feature: The preprocessor itself /* The individual components can be located by a
may be located at a different location. If the single base, or by individual bases. The first
base starts with a 'P', set this special base character of the path indicates which path the
instead of the main base. */ user is specifying. */
if (optarg[0] == 'P') { switch (optarg[0]) {
pbase = optarg+1; case 'P': /* Path for the ivlpp preprocessor */
} else { ivlpp_dir = optarg+1;
break;
case 'V': /* Path for the vhdlpp VHDL processor */
vhdlpp_dir = optarg+1;
break;
default: /* Otherwise, this is a default base. */
base=optarg; base=optarg;
break;
} }
break; break;
case 'c': case 'c':
@ -995,8 +1002,10 @@ int main(int argc, char **argv)
} }
} }
if (pbase == 0) if (ivlpp_dir == 0)
pbase = base; ivlpp_dir = base;
if (vhdlpp_dir == 0)
vhdlpp_dir = base;
if (version_flag || verbose_flag) { if (version_flag || verbose_flag) {
printf("Icarus Verilog version " VERSION " (" VERSION_TAG ")\n\n"); printf("Icarus Verilog version " VERSION " (" VERSION_TAG ")\n\n");
@ -1017,6 +1026,8 @@ int main(int argc, char **argv)
snprintf(iconfig_common_path, sizeof iconfig_common_path, "%s%c%s%s.conf", snprintf(iconfig_common_path, sizeof iconfig_common_path, "%s%c%s%s.conf",
base, sep, targ, synth_flag? "-s" : ""); base, sep, targ, synth_flag? "-s" : "");
fprintf(defines_file, "vhdlpp:%s%cvhdlpp\n", vhdlpp_dir, sep);
/* Write values to the iconfig file. */ /* Write values to the iconfig file. */
fprintf(iconfig_file, "basedir:%s\n", base); fprintf(iconfig_file, "basedir:%s\n", base);
@ -1143,7 +1154,7 @@ int main(int argc, char **argv)
single file. This may be used to preprocess library single file. This may be used to preprocess library
files. */ files. */
fprintf(iconfig_file, "ivlpp:%s%civlpp -L -F\"%s\" -P\"%s\"\n", fprintf(iconfig_file, "ivlpp:%s%civlpp -L -F\"%s\" -P\"%s\"\n",
pbase, sep, defines_path, compiled_defines_path); ivlpp_dir, sep, defines_path, compiled_defines_path);
/* Done writing to the iconfig file. Close it now. */ /* Done writing to the iconfig file. Close it now. */
fclose(iconfig_file); fclose(iconfig_file);