mirror of
https://github.com/cclassic/model-ghdl
synced 2024-11-21 08:25:05 +01:00
Changed default compilation method to compile-on-vcom. See README.MD on how to revert to syntax-check-only behavior.
This commit is contained in:
parent
b3171fbbb7
commit
d0c20c6e01
@ -24,6 +24,7 @@ VCOM
|
|||||||
|
|
||||||
### Additional commands
|
### Additional commands
|
||||||
* -ghdl *param*: Supply these arguments directly to GHDL (can be used multiple times)
|
* -ghdl *param*: Supply these arguments directly to GHDL (can be used multiple times)
|
||||||
|
* -no-precompile: Compile the files not until calling vsim. (Faster syntax check, but longer wait time for the simulation to start.)
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
* *cwd* is expected to be the compile directory
|
* *cwd* is expected to be the compile directory
|
||||||
|
18
main.c
18
main.c
@ -247,7 +247,7 @@ int vsim(int argc, char **argv)
|
|||||||
char *simExt = NULL;
|
char *simExt = NULL;
|
||||||
char *outFileType = NULL;
|
char *outFileType = NULL;
|
||||||
char vhdlver[16] = "";
|
char vhdlver[16] = "";
|
||||||
|
int precompiled = 1;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
append_string(¶ms,"");
|
append_string(¶ms,"");
|
||||||
@ -271,6 +271,9 @@ int vsim(int argc, char **argv)
|
|||||||
|
|
||||||
fp = fopen("/tmp/model-ghdl-vcom","r");
|
fp = fopen("/tmp/model-ghdl-vcom","r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
fgets(workdir, sizeof(workdir), fp); // (ab)use workdir variable as temp
|
||||||
|
if (!strcmp(workdir,"nopre\n"))
|
||||||
|
precompiled = 0;
|
||||||
fgets(workdir, sizeof(workdir), fp);
|
fgets(workdir, sizeof(workdir), fp);
|
||||||
workdir[strlen(workdir)-1] = 0;
|
workdir[strlen(workdir)-1] = 0;
|
||||||
fgets(vhdlver, sizeof(vhdlver), fp);
|
fgets(vhdlver, sizeof(vhdlver), fp);
|
||||||
@ -344,7 +347,7 @@ int vsim(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("[I] Compiling...\n");
|
printf("[I] Compiling...\n");
|
||||||
if (run_ghdl("ghdl -m %s --work=%s --workdir=\"%s\" %s %s", vhdlver, work, workdir, params, toplevel)) {
|
if (run_ghdl("ghdl -%c %s --work=%s --workdir=\"%s\" %s %s", (precompiled ? 'e' : 'm'), vhdlver, work, workdir, params, toplevel)) {
|
||||||
fprintf(stderr, "[E] Compilation failed!");
|
fprintf(stderr, "[E] Compilation failed!");
|
||||||
showMessage(MESSAGE_ERROR, "Error! Compilation failed.", NULL, NULL);
|
showMessage(MESSAGE_ERROR, "Error! Compilation failed.", NULL, NULL);
|
||||||
}
|
}
|
||||||
@ -390,6 +393,7 @@ int vcom(int argc, char **argv)
|
|||||||
char *files = NULL;
|
char *files = NULL;
|
||||||
char vhdlver[16] = "";
|
char vhdlver[16] = "";
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
|
int precompile = 1;
|
||||||
|
|
||||||
printf ("[I] Emulating vcom.\n");
|
printf ("[I] Emulating vcom.\n");
|
||||||
|
|
||||||
@ -423,6 +427,9 @@ int vcom(int argc, char **argv)
|
|||||||
else if (ISOPT("-2008")) {
|
else if (ISOPT("-2008")) {
|
||||||
strcpy(vhdlver, "--std=08");
|
strcpy(vhdlver, "--std=08");
|
||||||
}
|
}
|
||||||
|
else if (ISOPT("-no-precompile")) {
|
||||||
|
precompile = 0;
|
||||||
|
}
|
||||||
else if (GETOPT("-ghdl")) {
|
else if (GETOPT("-ghdl")) {
|
||||||
append_string(¶ms, " ");
|
append_string(¶ms, " ");
|
||||||
append_string(¶ms, argv[i]);
|
append_string(¶ms, argv[i]);
|
||||||
@ -448,7 +455,7 @@ int vcom(int argc, char **argv)
|
|||||||
// Info for vsim later on
|
// Info for vsim later on
|
||||||
fp = fopen("/tmp/model-ghdl-vcom","w");
|
fp = fopen("/tmp/model-ghdl-vcom","w");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fprintf(fp, "%s\n%s", workdir, vhdlver);
|
fprintf(fp, "%s\n%s\n%s", (precompile ? "pre" : "nopre"), workdir, vhdlver);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -457,9 +464,8 @@ int vcom(int argc, char **argv)
|
|||||||
|
|
||||||
run_ghdl("ghdl -i --work=%s --workdir=%s %s %s %s 2>&1",
|
run_ghdl("ghdl -i --work=%s --workdir=%s %s %s %s 2>&1",
|
||||||
work, workdir, vhdlver, params, files);
|
work, workdir, vhdlver, params, files);
|
||||||
run_ghdl("ghdl -s --work=%s --workdir=%s %s %s %s 2>&1",
|
run_ghdl("ghdl -%c --work=%s --workdir=%s %s %s %s 2>&1",
|
||||||
work, workdir, vhdlver, params, files);
|
(precompile ? 'a' : 's'), work, workdir, vhdlver, params, files);
|
||||||
|
|
||||||
|
|
||||||
free(files);
|
free(files);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user