resolved the event
This commit is contained in:
		@@ -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 {
 | 
			
		||||
	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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user