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

Added memory for time sim length

This commit is contained in:
Markus Koch 2015-01-19 19:35:33 +01:00
parent 6d3c712bec
commit 05a5172537

View File

@ -41,6 +41,14 @@ string getSimulationTime() { // Very crude but works (for a proof-of-concept any
vector < string > result;
string defaultValue = "100ns";
ifstream myfile;
char fileTemp[128];
myfile.open ("/tmp/ghdl-simtime");
myfile.getline(fileTemp, sizeof(fileTemp));
myfile.close();
if (string(fileTemp) != "")
defaultValue = string(fileTemp);
string temp = "zenity --entry --text \"Enter the duration:\" --title \"Simulation time\" --entry-text=\"" + defaultValue + "\"";
proc = popen(temp.c_str(), "r");
@ -65,8 +73,14 @@ string getSimulationTime() { // Very crude but works (for a proof-of-concept any
if (pclose(proc)) {
defaultValue = "";
}
else {
ofstream myfile;
myfile.open ("/tmp/ghdl-simtime");
myfile << defaultValue;
myfile.flush();
myfile.close();
}
cout << "TIM=" << defaultValue << endl;
return defaultValue;
}