|
|
@@ -5,6 +5,36 @@
|
|
|
#include "DEVStone.hpp"
|
|
|
|
|
|
|
|
|
+DEVStone::DEVStone(const string& typeIn, int depthIn, int widthIn, int intDelayIn, int extDelayIn, double procTimeIn):
|
|
|
+ adevs::Digraph<int*>()
|
|
|
+{
|
|
|
+ Seeder *seeder = new Seeder(1);
|
|
|
+ add(seeder);
|
|
|
+
|
|
|
+ adevs::Digraph<int*> devstone;
|
|
|
+ if (typeIn == "LI") {
|
|
|
+ LI *li = new LI(depthIn, widthIn, intDelayIn, extDelayIn, procTimeIn);
|
|
|
+ add(li);
|
|
|
+ couple(seeder, seeder->out, li, li->in);
|
|
|
+ } else if (typeIn == "HI") {
|
|
|
+ HI *hi = new HI(depthIn, widthIn, intDelayIn, extDelayIn, procTimeIn);
|
|
|
+ add(hi);
|
|
|
+ couple(seeder, seeder->out, hi, hi->in);
|
|
|
+ } else if (typeIn == "HO") {
|
|
|
+ HO *ho = new HO(depthIn, widthIn, intDelayIn, extDelayIn, procTimeIn);
|
|
|
+ add(ho);
|
|
|
+ couple(seeder, seeder->out, ho, ho->in);
|
|
|
+ } else if (typeIn == "HOmod") {
|
|
|
+ HOmod *homod = new HOmod(depthIn, widthIn, intDelayIn, extDelayIn, procTimeIn);
|
|
|
+ add(homod);
|
|
|
+ couple(seeder, seeder->out, homod, homod->in1);
|
|
|
+ couple(seeder, seeder->out, homod, homod->in2);
|
|
|
+ } else {
|
|
|
+ throw runtime_error("Unable to determine DEVStone model type");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
int main(int argc, char* argv[]) {
|
|
|
auto start = hclock::now();
|
|
|
|
|
|
@@ -12,7 +42,7 @@ int main(int argc, char* argv[]) {
|
|
|
po::options_description desc("Allowed options");
|
|
|
desc.add_options()
|
|
|
("help", "produce help message")
|
|
|
- ("kind", po::value<string>()->required(), "set kind of devstone: LI, HI or HO")
|
|
|
+ ("kind", po::value<string>()->required(), "set kind of devstone: LI, HI, HO, or HOmod")
|
|
|
("width", po::value<int>()->required(), "set width of the DEVStone: integer value")
|
|
|
("depth", po::value<int>()->required(), "set depth of the DEVStone: integer value")
|
|
|
("int-cycles", po::value<int>()->required(), "set the Dhrystone cycles to expend in internal transtions: integer value")
|
|
|
@@ -36,8 +66,8 @@ int main(int argc, char* argv[]) {
|
|
|
}
|
|
|
}
|
|
|
string kind = vm["kind"].as<string>();
|
|
|
- if (kind != "LI" && kind != "HI" && kind != "HO") {
|
|
|
- cout << "The kind needs to be LI, HI or HO and received value was: " << kind;
|
|
|
+ if (kind != "LI" && kind != "HI" && kind != "HO" && kind != "HOmod") {
|
|
|
+ cout << "The kind needs to be LI, HI, HO, or HOmod and received value was: " << kind;
|
|
|
cout << endl;
|
|
|
cout << "for mode information run: " << argv[0] << " --help" << endl;
|
|
|
return 1;
|
|
|
@@ -49,7 +79,25 @@ int main(int argc, char* argv[]) {
|
|
|
int ext_cycles = vm["ext-cycles"].as<int>();
|
|
|
int time_advance = vm["time-advance"].as<int>();
|
|
|
|
|
|
+ auto processed_parameters = hclock::now();
|
|
|
|
|
|
- LI c = LI(2, 1, 0, 0, 0.0);
|
|
|
- return 0;
|
|
|
+ DEVStone *devstone = new DEVStone(kind, depth, width, int_cycles, ext_cycles, time_advance);
|
|
|
+
|
|
|
+ auto model_built = hclock::now();
|
|
|
+
|
|
|
+ cout << endl;
|
|
|
+ cout << "Model creation time: " << chrono::duration_cast<chrono::duration<double, ratio<1>>>( model_built - processed_parameters).count() << endl;
|
|
|
+ adevs::Simulator<IO_Type> sim(devstone);
|
|
|
+
|
|
|
+ auto model_init = hclock::now();
|
|
|
+
|
|
|
+ cout << "Engine setup time: " << chrono::duration_cast<chrono::duration<double, ratio<1>>>( model_init - model_built).count() << endl;
|
|
|
+ while (sim.nextEventTime() < DBL_MAX)
|
|
|
+ {
|
|
|
+ sim.execNextEvent();
|
|
|
+ }
|
|
|
+ /// Done!
|
|
|
+ auto finished_simulation = hclock::now();
|
|
|
+ cout << "Simulation time: " << chrono::duration_cast<chrono::duration<double, ratio<1>>>( finished_simulation - model_init).count() << endl;
|
|
|
+ return 0;
|
|
|
}
|