From c242857c6222fb436a1a3d1d9057366f6e8bc921 Mon Sep 17 00:00:00 2001 From: Makise Kurisu Date: Thu, 9 Apr 2015 17:14:34 +0200 Subject: [PATCH] Added support for dynamic gtkwave save files using the -gtksave "/path/ to/save/dir" --- vsim/main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vsim/main.cpp b/vsim/main.cpp index 5f8618a..06b338c 100644 --- a/vsim/main.cpp +++ b/vsim/main.cpp @@ -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) int main(int argc, char **argv) { - string top = ""; - string work = ""; - string simtime = ""; + string top = ""; + string work = ""; + string simtime = ""; string ghdlargs = ""; - string wvargs = ""; - string gtkargs = ""; + string wvargs = ""; + string gtkargs = ""; + string gtksave = ""; int i; char tempdir[256] = ""; // Compile dir @@ -120,6 +121,9 @@ int main(int argc, char **argv) { else if (GETOPT("-gtkwave")) { gtkargs = argv[i]; } + else if (GETOPT("-gtksave")) { + gtksave = argv[i]; + } else { if (argv[i][0] == '-') { cerr << "INFO: Unknown command line opt: " << argv[i] << endl; @@ -188,6 +192,9 @@ int main(int argc, char **argv) { } else { cout << "==> All done!" << endl; + if (gtksave != "") { + gtkargs += " --save=\"" + gtksave + "/" + top + ".gtkw\""; + } string wv = "gtkwave " + string(tempdir) + "/" + top + ".ghw " + gtkargs + " &"; if (run("pidof gtkwave")) { if (system(wv.c_str())) {