1
0
mirror of https://github.com/cclassic/model-ghdl synced 2024-11-21 08:25:05 +01:00

Added support for dynamic gtkwave save files using the -gtksave "/path/

to/save/dir"
This commit is contained in:
Markus Koch 2015-04-09 17:14:34 +02:00
parent e3b8e2b090
commit c242857c62

View File

@ -90,12 +90,13 @@ string getSimulationTime() { // Very crude but works (for a proof-of-concept any
#define GETOPT(cmd) (string(argv[i]) == cmd) && (++i < argc) #define GETOPT(cmd) (string(argv[i]) == cmd) && (++i < argc)
int main(int argc, char **argv) { int main(int argc, char **argv) {
string top = ""; string top = "";
string work = ""; string work = "";
string simtime = ""; string simtime = "";
string ghdlargs = ""; string ghdlargs = "";
string wvargs = ""; string wvargs = "";
string gtkargs = ""; string gtkargs = "";
string gtksave = "";
int i; int i;
char tempdir[256] = ""; // Compile dir char tempdir[256] = ""; // Compile dir
@ -120,6 +121,9 @@ int main(int argc, char **argv) {
else if (GETOPT("-gtkwave")) { else if (GETOPT("-gtkwave")) {
gtkargs = argv[i]; gtkargs = argv[i];
} }
else if (GETOPT("-gtksave")) {
gtksave = argv[i];
}
else { else {
if (argv[i][0] == '-') { if (argv[i][0] == '-') {
cerr << "INFO: Unknown command line opt: " << argv[i] << endl; cerr << "INFO: Unknown command line opt: " << argv[i] << endl;
@ -188,6 +192,9 @@ int main(int argc, char **argv) {
} }
else { else {
cout << "==> All done!" << endl; cout << "==> All done!" << endl;
if (gtksave != "") {
gtkargs += " --save=\"" + gtksave + "/" + top + ".gtkw\"";
}
string wv = "gtkwave " + string(tempdir) + "/" + top + ".ghw " + gtkargs + " &"; string wv = "gtkwave " + string(tempdir) + "/" + top + ".ghw " + gtkargs + " &";
if (run("pidof gtkwave")) { if (run("pidof gtkwave")) {
if (system(wv.c_str())) { if (system(wv.c_str())) {