mirror of
				https://github.com/cclassic/model-ghdl
				synced 2025-11-04 02:49:33 +01:00 
			
		
		
		
	Changed startup behavior of GtkWave to improve usability
This commit is contained in:
		@@ -2,6 +2,7 @@
 | 
				
			|||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
#include <fstream>
 | 
					#include <fstream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -150,22 +151,36 @@ int main(int argc, char **argv) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    string cargs = "cd " + string(tempdir) + "; ghdl -m --ieee=synopsys --warn-no-vital-generic --workdir=" + string(tempdir) + " --work=" + work + " " + top;
 | 
					    //bool ex = false;
 | 
				
			||||||
    if (run(cargs)) {
 | 
					    //while (!ex) {
 | 
				
			||||||
        cerr << "Error: Compilation failed." << endl;
 | 
					        string cargs = "cd " + string(tempdir) + "; ghdl -m --ieee=synopsys --warn-no-vital-generic --workdir=" + string(tempdir) + " --work=" + work + " " + top;
 | 
				
			||||||
    }
 | 
					        if (run(cargs)) {
 | 
				
			||||||
    else {
 | 
					            cerr << "Error: Compilation failed." << endl;
 | 
				
			||||||
        cargs = "";
 | 
					            run("zenity --error --text \"Compilation failed.\"");
 | 
				
			||||||
        if (run("cd " + string(tempdir) + "; ./" + top + " --stop-time=" + getSimulationTime() + " --vcd=" + top + ".vcd")) {
 | 
					 | 
				
			||||||
            cerr << "Error: Simulation failed." << endl;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            if (run("gtkwave " +  string(tempdir) + "/" + top + ".vcd")) {
 | 
					            cargs = "";
 | 
				
			||||||
                cerr << "Error: GtkWave failed.";
 | 
					            string st = getSimulationTime();
 | 
				
			||||||
 | 
					            if (st != "") {
 | 
				
			||||||
 | 
					                if (run("cd " + string(tempdir) + "; ./" + top + " --stop-time=" + st + " --vcd=" + top + ".vcd")) {
 | 
				
			||||||
 | 
					                    cerr << "Error: Simulation failed." << endl;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                else {
 | 
				
			||||||
 | 
					                    string wv = "gtkwave " + string(tempdir) + "/" + top + ".vcd &";
 | 
				
			||||||
 | 
					                    if (run("pidof gtkwave")) {
 | 
				
			||||||
 | 
					                        if (system(wv.c_str())) {
 | 
				
			||||||
 | 
					                            cerr << "Error: GtkWave failed.";
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else {
 | 
				
			||||||
 | 
					                            cout << "GtkWave started." << endl;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //cout << "Simulation ended." << endl;
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user