resolved the event

This commit is contained in:
daniel 2017-04-10 19:43:31 -04:00
commit dfc6064bcd
3 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,11 @@
#include "andGate.h"
using namespace std;
andGate::andGate(wire* wire1 = nullptr, wire* wire2 = nullptr,
wire* wire3 = nullptr) : in1(wire1), in2(wire2), out(wire3) {}
int andGate::evaluate(int evTime) {
int bool1 = in1 -> getValue();
return ( in1 -> getValue(evTime) ) && ( in2 -> getValue(evTime) );
}

View File

@ -3,8 +3,9 @@
class andGate : public gate {
public:
andGate(wire* wire1 = nullptr, wire* wire2 = nullptr, wire* wire3 = nullptr);
int evaluate();
andGate(wire* wire1 = nullptr, wire* wire2 = nullptr,
wire* wire3 = nullptr);
int evaluate(int evTime);
};
#endif // !AND

View File

@ -23,7 +23,7 @@ int main() {
if(parseSuccess) {
// 2. Parse the vector file to initialize the simulation Queue with initial
// Wire state (i.e., value) changes
queue e;
priority_queue< e;
parseSuccess = e.parseVector(fileName);
// 3. Simulate the circuit using Event-driven control