resolved the event
This commit is contained in:
commit
dfc6064bcd
@ -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) );
|
||||||
|
}
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
class andGate : public gate {
|
class andGate : public gate {
|
||||||
public:
|
public:
|
||||||
andGate(wire* wire1 = nullptr, wire* wire2 = nullptr, wire* wire3 = nullptr);
|
andGate(wire* wire1 = nullptr, wire* wire2 = nullptr,
|
||||||
int evaluate();
|
wire* wire3 = nullptr);
|
||||||
|
int evaluate(int evTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !AND
|
#endif // !AND
|
||||||
|
@ -23,7 +23,7 @@ int main() {
|
|||||||
if(parseSuccess) {
|
if(parseSuccess) {
|
||||||
// 2. Parse the vector file to initialize the simulation Queue with initial
|
// 2. Parse the vector file to initialize the simulation Queue with initial
|
||||||
// Wire state (i.e., value) changes
|
// Wire state (i.e., value) changes
|
||||||
queue e;
|
priority_queue< e;
|
||||||
parseSuccess = e.parseVector(fileName);
|
parseSuccess = e.parseVector(fileName);
|
||||||
|
|
||||||
// 3. Simulate the circuit using Event-driven control
|
// 3. Simulate the circuit using Event-driven control
|
||||||
|
Loading…
Reference in New Issue
Block a user