Fix base initialization for and, not , and xor
This commit is contained in:
parent
2be1e257c3
commit
7574ffc9a4
@ -3,11 +3,16 @@
|
||||
using namespace std;
|
||||
|
||||
andGate::andGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2,
|
||||
wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2), out(wire3) {}
|
||||
|
||||
wire* wire3) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
in2 = wire2;
|
||||
out = wire3;
|
||||
}
|
||||
int andGate::evaluate(int evTime) {
|
||||
int val1 = in1->getValue();
|
||||
int val2 = in2->getValue();
|
||||
int val1 = in1->getValue(evTime);
|
||||
int val2 = in2->getValue(evTime);
|
||||
if(val1 != -1 && val2 != -1) {
|
||||
return val1 && val2;
|
||||
}
|
||||
|
@ -2,8 +2,13 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
notGate::notGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2)
|
||||
: e(eQueue), delay(gateDelay), in1(wire1), out(wire2) {}
|
||||
notGate::notGate(priority_queue<event> *eQueue, int d, wire* wire1, wire* wire2) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
out = wire2;
|
||||
|
||||
}
|
||||
|
||||
void notGate::evaluate(int evTime) {
|
||||
int val = in1->getValue();
|
||||
|
@ -3,8 +3,13 @@
|
||||
using namespace std;
|
||||
|
||||
xorGate::xorGate(priority_queue<event> *eQueue, int d, wire* wire1,
|
||||
wire* wire2, wire* wire3) : e(eQueue), delay(d), in1(wire1), in2(wire2),
|
||||
out(wire3);
|
||||
wire* wire2, wire* wire3) {
|
||||
e = eQueue;
|
||||
delay = d;
|
||||
in1 = wire1;
|
||||
in2 = wire2;
|
||||
out = wire3;
|
||||
}
|
||||
|
||||
void xorGate::evaluate(int evTime) {
|
||||
//TODO
|
||||
|
Loading…
Reference in New Issue
Block a user