2017-04-20 12:41:43 -04:00
|
|
|
#ifndef SIMULATION
|
|
|
|
#define SIMULATION
|
|
|
|
|
2017-04-23 20:15:12 -04:00
|
|
|
#include "Wire.h"
|
|
|
|
#include "Event.h"
|
|
|
|
#include "Gate.h"
|
|
|
|
#include "AndGate.h"
|
|
|
|
#include "NandGate.h"
|
|
|
|
#include "OrGate.h"
|
|
|
|
#include "NorGate.h"
|
|
|
|
#include "XnorGate.h"
|
|
|
|
#include "XorGate.h"
|
|
|
|
#include "NotGate.h"
|
2017-04-20 12:41:43 -04:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Simulation {
|
|
|
|
public:
|
2017-04-20 13:01:04 -04:00
|
|
|
bool parseCircuit(string fileName);
|
2017-04-23 20:15:12 -04:00
|
|
|
bool parseVector(string fileName);
|
2017-04-20 12:41:43 -04:00
|
|
|
void simulate();
|
|
|
|
void print();
|
|
|
|
private:
|
2017-04-23 19:29:29 -04:00
|
|
|
Wire* findWire(int n);
|
2017-04-20 13:01:04 -04:00
|
|
|
int getDelay(string d);
|
|
|
|
|
2017-04-23 19:29:29 -04:00
|
|
|
priority_queue<Event> e;
|
|
|
|
vector<Gate*> gates;
|
|
|
|
vector<Wire*> wires;
|
2017-04-20 12:41:43 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // !SIMULATION
|