mirror of
https://github.com/cclassic/model-ghdl
synced 2024-11-29 09:13:28 +01:00
Added support for multiple wave file types
This commit is contained in:
parent
5bb82eb499
commit
710ad3cb01
@ -37,6 +37,7 @@ VSIM
|
|||||||
### 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)
|
||||||
* -gtkwprefix *prefix*: Prefix for the .gtkw save file. Path will be $cwd/$prefix$toplevel.gtkw
|
* -gtkwprefix *prefix*: Prefix for the .gtkw save file. Path will be $cwd/$prefix$toplevel.gtkw
|
||||||
|
* -type *extension*: Set simulation output file type. Can be: ghw (default), vcd or fst
|
||||||
|
|
||||||
### Notes
|
### Notes
|
||||||
* *cwd* is expected to be the source directory (used for .gtkw save path)
|
* *cwd* is expected to be the source directory (used for .gtkw save path)
|
||||||
|
27
main.c
27
main.c
@ -241,6 +241,8 @@ int vsim(int argc, char **argv)
|
|||||||
char sourcedir[1 K];
|
char sourcedir[1 K];
|
||||||
char *params = NULL;
|
char *params = NULL;
|
||||||
char *simtime = NULL;
|
char *simtime = NULL;
|
||||||
|
char *simExt = NULL;
|
||||||
|
char *outFileType = NULL;
|
||||||
char vhdlver[16] = "";
|
char vhdlver[16] = "";
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -299,6 +301,9 @@ int vsim(int argc, char **argv)
|
|||||||
// free(ptr); DO NOT FREE, we still need it.
|
// free(ptr); DO NOT FREE, we still need it.
|
||||||
// ptr = NULL;
|
// ptr = NULL;
|
||||||
}
|
}
|
||||||
|
else if (GETOPT("-type")) {
|
||||||
|
append_string(&simExt, argv[i]);
|
||||||
|
}
|
||||||
else if (GETOPT("-ghdl")) {
|
else if (GETOPT("-ghdl")) {
|
||||||
append_string(¶ms, " ");
|
append_string(¶ms, " ");
|
||||||
append_string(¶ms, argv[i]);
|
append_string(¶ms, argv[i]);
|
||||||
@ -311,6 +316,24 @@ int vsim(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (simExt == NULL)
|
||||||
|
append_string(&simExt, "ghw");
|
||||||
|
|
||||||
|
if (!strcmp(simExt,"ghw")) {
|
||||||
|
append_string(&outFileType, "wave");
|
||||||
|
}
|
||||||
|
else if (!strcmp(simExt,"vcd")) {
|
||||||
|
append_string(&outFileType, "vcd");
|
||||||
|
}
|
||||||
|
else if (!strcmp(simExt,"fst")) {
|
||||||
|
append_string(&outFileType, "fst");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "[E] Unknown output file type!");
|
||||||
|
showMessage(MESSAGE_ERROR, "Error! Unknown output file type.", NULL, NULL);
|
||||||
|
return 127;
|
||||||
|
}
|
||||||
|
|
||||||
chdir(workdir);
|
chdir(workdir);
|
||||||
|
|
||||||
if (gtkwPrefix == NULL) {
|
if (gtkwPrefix == NULL) {
|
||||||
@ -334,12 +357,12 @@ int vsim(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("[I] Simulating...\n");
|
printf("[I] Simulating...\n");
|
||||||
if (run_simulation("%s/%s --stop-time=%s --wave=%s.ghw", workdir, toplevel, simtime, toplevel)) {
|
if (run_simulation("%s/%s --stop-time=%s --%s=%s.%s", workdir, toplevel, simtime, outFileType, toplevel, simExt)) {
|
||||||
fprintf(stderr, "[E] Simulation failed!");
|
fprintf(stderr, "[E] Simulation failed!");
|
||||||
showMessage(MESSAGE_ERROR, "Error! Simulation failed.", NULL, NULL);
|
showMessage(MESSAGE_ERROR, "Error! Simulation failed.", NULL, NULL);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (run_gtkwave(toplevel, "gtkwave %s/%s.ghw --save=\"%s/%s%s.gtkw\"", workdir, toplevel, sourcedir, gtkwPrefix, toplevel)) { // TODO: PATH FOR Savefile
|
if (run_gtkwave(toplevel, "gtkwave %s/%s.%s --save=\"%s/%s%s.gtkw\"", workdir, toplevel, simExt, sourcedir, gtkwPrefix, toplevel)) {
|
||||||
fprintf(stderr, "[E] Could not open GtkWave!");
|
fprintf(stderr, "[E] Could not open GtkWave!");
|
||||||
showMessage(MESSAGE_ERROR, "Error! Could not open GtkWave!", NULL, NULL);
|
showMessage(MESSAGE_ERROR, "Error! Could not open GtkWave!", NULL, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user