diff --git a/Radec/Radec/Radec.vcxproj b/Radec/Radec/Radec.vcxproj
index 1148403..dca0407 100644
--- a/Radec/Radec/Radec.vcxproj
+++ b/Radec/Radec/Radec.vcxproj
@@ -175,6 +175,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Radec/Radec/Radec.vcxproj.filters b/Radec/Radec/Radec.vcxproj.filters
index 9d1cfcc..b4c319d 100644
--- a/Radec/Radec/Radec.vcxproj.filters
+++ b/Radec/Radec/Radec.vcxproj.filters
@@ -98,4 +98,54 @@
Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/Radec/Radec/circuit0.txt b/Radec/Radec/circuit0.txt
new file mode 100644
index 0000000..f34215f
--- /dev/null
+++ b/Radec/Radec/circuit0.txt
@@ -0,0 +1,5 @@
+CIRCUIT SimpleCircuit
+INPUT A 1
+INPUT B 2
+OUTPUT C 3
+AND 2ns 1 2 3
\ No newline at end of file
diff --git a/Radec/Radec/circuit0_v.txt b/Radec/Radec/circuit0_v.txt
new file mode 100644
index 0000000..313a343
--- /dev/null
+++ b/Radec/Radec/circuit0_v.txt
@@ -0,0 +1,5 @@
+VECTOR SimpleCircuit
+INPUT A 0 0
+INPUT B 0 0
+INPUT A 4 1
+INPUT B 5 1
\ No newline at end of file
diff --git a/Radec/Radec/circuit1.txt b/Radec/Radec/circuit1.txt
new file mode 100644
index 0000000..49b7db4
--- /dev/null
+++ b/Radec/Radec/circuit1.txt
@@ -0,0 +1,9 @@
+CIRCUIT Circuit1
+INPUT A 1
+INPUT B 3
+INPUT C 4
+OUTPUT D 5
+OUTPUT E 6
+NOT 2ns 1 2
+AND 3ns 2 3 5
+OR 3ns 4 5 6
diff --git a/Radec/Radec/circuit1_v.txt b/Radec/Radec/circuit1_v.txt
new file mode 100644
index 0000000..934f64a
--- /dev/null
+++ b/Radec/Radec/circuit1_v.txt
@@ -0,0 +1,7 @@
+VECTOR Circuit1
+INPUT A 0 0
+INPUT B 0 1
+INPUT C 0 0
+INPUT C 4 1
+INPUT A 6 1
+INPUT B 9 0
diff --git a/Radec/Radec/circuit2.txt b/Radec/Radec/circuit2.txt
new file mode 100644
index 0000000..879da31
--- /dev/null
+++ b/Radec/Radec/circuit2.txt
@@ -0,0 +1,11 @@
+CIRCUIT Circuit2
+INPUT A 1
+INPUT B 3
+INPUT C 4
+INPUT D 5
+OUTPUT E 9
+NOT 2ns 1 2
+AND 5ns 2 3 6
+AND 5ns 4 5 7
+OR 4ns 6 7 8
+XOR 5ns 8 7 9
diff --git a/Radec/Radec/circuit2_v.txt b/Radec/Radec/circuit2_v.txt
new file mode 100644
index 0000000..305db26
--- /dev/null
+++ b/Radec/Radec/circuit2_v.txt
@@ -0,0 +1,9 @@
+VECTOR Circuit2
+INPUT A 0 0
+INPUT B 0 1
+INPUT C 0 0
+INPUT D 0 1
+INPUT C 4 1
+INPUT A 6 1
+INPUT B 9 0
+INPUT D 12 X
diff --git a/Radec/Radec/circuit3.txt b/Radec/Radec/circuit3.txt
new file mode 100644
index 0000000..e3a19c9
--- /dev/null
+++ b/Radec/Radec/circuit3.txt
@@ -0,0 +1,9 @@
+CIRCUIT Circuit3
+INPUT A 1
+INPUT B 2
+INPUT C 3
+OUTPUT D 5
+OUTPUT E 6
+AND 2ns 1 2 4
+OR 3ns 4 3 5
+NOT 1ns 4 6
diff --git a/Radec/Radec/circuit3_v.txt b/Radec/Radec/circuit3_v.txt
new file mode 100644
index 0000000..c6e2747
--- /dev/null
+++ b/Radec/Radec/circuit3_v.txt
@@ -0,0 +1,6 @@
+VECTOR Circuit3
+INPUT A 1 1
+INPUT B 1 0
+INPUT C 1 0
+INPUT B 7 1
+INPUT A 7 0
diff --git a/Radec/Radec/circuit4.txt b/Radec/Radec/circuit4.txt
new file mode 100644
index 0000000..f2f5a87
--- /dev/null
+++ b/Radec/Radec/circuit4.txt
@@ -0,0 +1,4 @@
+CIRCUIT JacubecCircuit
+INPUT A 1
+OUTPUT C 2
+NAND 2ns 1 2 2
diff --git a/Radec/Radec/circuit4_v.txt b/Radec/Radec/circuit4_v.txt
new file mode 100644
index 0000000..1a0a286
--- /dev/null
+++ b/Radec/Radec/circuit4_v.txt
@@ -0,0 +1,3 @@
+VECTOR JacubecCircuit
+INPUT A 0 0
+INPUT A 1 1
diff --git a/Radec/Radec/circuit5.txt b/Radec/Radec/circuit5.txt
new file mode 100644
index 0000000..7258133
--- /dev/null
+++ b/Radec/Radec/circuit5.txt
@@ -0,0 +1,8 @@
+CIRCUIT SimpleCircuit
+INPUT A 1
+INPUT B 2
+INPUT C 3
+OUTPUT OUT1 4
+OUTPUT OUT2 5
+AND 3ns 1 2 4
+OR 2ns 4 3 5
diff --git a/Radec/Radec/circuit5_v.txt b/Radec/Radec/circuit5_v.txt
new file mode 100644
index 0000000..4f3585c
--- /dev/null
+++ b/Radec/Radec/circuit5_v.txt
@@ -0,0 +1,6 @@
+VECTOR SimpleCircuit
+INPUT A 0 1
+INPUT B 0 1
+INPUT C 0 0
+
+
diff --git a/Radec/Radec/circuit7.txt b/Radec/Radec/circuit7.txt
new file mode 100644
index 0000000..9ebf271
--- /dev/null
+++ b/Radec/Radec/circuit7.txt
@@ -0,0 +1,8 @@
+CIRCUIT DrivesTwo
+INPUT A 1DrivesTwo
+OUTPUT B 3
+OUTPUT C 4
+NOT 2ns 1 3
+NOT 1ns 1 2
+NOT 1ns 2 4
+
diff --git a/Radec/Radec/circuit7_v.txt b/Radec/Radec/circuit7_v.txt
new file mode 100644
index 0000000..abba664
--- /dev/null
+++ b/Radec/Radec/circuit7_v.txt
@@ -0,0 +1,5 @@
+VECTOR DrivesTwo
+INPUT A 0 0
+INPUT A 3 1
+INPUT A 4 0
+
diff --git a/Radec/Radec/circuit8.txt b/Radec/Radec/circuit8.txt
new file mode 100644
index 0000000..aa42271
--- /dev/null
+++ b/Radec/Radec/circuit8.txt
@@ -0,0 +1,7 @@
+CIRCUIT WhiteBoard
+INPUT A 1
+INPUT B 2
+OUTPUT C 3
+AND 2ns 1 2 4
+OR 3ns 2 4 3
+
diff --git a/Radec/Radec/circuit8_v.txt b/Radec/Radec/circuit8_v.txt
new file mode 100644
index 0000000..c23990e
--- /dev/null
+++ b/Radec/Radec/circuit8_v.txt
@@ -0,0 +1,5 @@
+VECTOR WhiteBoard
+INPUT A 0 1
+INPUT B 0 0
+INPUT A 3 0
+
diff --git a/src/Simulation.cpp b/src/Simulation.cpp
index b67ea0f..fa0b7de 100644
--- a/src/Simulation.cpp
+++ b/src/Simulation.cpp
@@ -90,7 +90,7 @@ bool Simulation::parseVector(string fileName) {
string tmpString;
int timeInt, valInt;
- Wire *tmpWire;
+ Wire *tmpWire = nullptr;
// get rid of first line
getline(in, tmpString);
@@ -127,10 +127,15 @@ void Simulation::simulate() {
if(doesChange) {
Gate * tmpGate;
int index = 0;
- do{
+ while(true){
tmpGate = output->getGate(index++);
- e.push(tmpGate->evaluate(tmpEvent.getTime()));
- }while(tmpGate != nullptr);
+ if (tmpGate != nullptr) {
+ e.push(tmpGate->evaluate(tmpEvent.getTime()));
+ }
+ else {
+ break;
+ }
+ }
}
}
}
@@ -149,14 +154,13 @@ void Simulation::print()
// now iterate through wires, printing each of them
for(auto i = wires.begin(); i != wires.end(); ++i) {
(**i).setLast(lastTime);
- cout << *i;
+ cout << **i;
}
int t = 0;
cout << setw(10) << "TIME";
- cout << setw(5);
while(t <= 60 && t <= lastTime) {
- cout << t;
+ cout << setw(5) << t;
t += 5;
}
}
diff --git a/src/Wire.cpp b/src/Wire.cpp
index bd078d2..bb3ccac 100644
--- a/src/Wire.cpp
+++ b/src/Wire.cpp
@@ -57,7 +57,7 @@ void Wire::convertToIO(string newName)
Gate * Wire::getGate(int index)
{
- if (index >= gates.size()) {
+ if (index < gates.size()) {
return gates[index];
}
return nullptr;