From 05a517253727db5b3b691f06512440f83163ffb4 Mon Sep 17 00:00:00 2001 From: Makise Kurisu Date: Mon, 19 Jan 2015 19:35:33 +0100 Subject: [PATCH] Added memory for time sim length --- vsim/main.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vsim/main.cpp b/vsim/main.cpp index 009b33e..e9dceda 100644 --- a/vsim/main.cpp +++ b/vsim/main.cpp @@ -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; }