From 0d106c16fd79e743ee4009f825a614ab7d01424a Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Sun, 23 Apr 2017 19:27:31 -0400 Subject: [PATCH] rewrite Radec.cpp to use new Simulation class --- src/Radec.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/Radec.cpp diff --git a/src/Radec.cpp b/src/Radec.cpp new file mode 100644 index 0000000..cd3477e --- /dev/null +++ b/src/Radec.cpp @@ -0,0 +1,26 @@ +#include "Simulation.h" + +using namespace std; + +int main() { + // 1. Parse circuit file to create in-memory data structure of Gates and Wires + // to simulate + string fileName; + getline(cin, fileName); + Simulation e; + e.parseCircuit(fileName); + + // 2. Parse the vector file to initialize the simulation Queue with initial + // Wire state (i.e., value) changes + e.parseVector(fileName); + + // 3. Simulate the circuit using Event-driven control + // first, remove the top Event e in the Queue + // second, determine if e causes a future Wire state change + // third, create and queue any future Wire state changes as new Events + // fourth, apply e's effects + e.simulate(); + + // 4. Print the results of the simulation + e.print(); +}