add simple evaluation to andGate
This commit is contained in:
parent
c1c31af8e6
commit
190d227a97
@ -6,6 +6,9 @@ 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) );
|
||||
int val1 = in1->getValue();
|
||||
int val2 = in2->getValue();
|
||||
if(val1 != -1 && val2 != -1) {
|
||||
return val1 && val2;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user