2017-04-20 12:41:43 -04:00
|
|
|
#ifndef SIMULATION
|
|
|
|
#define SIMULATION
|
|
|
|
|
|
|
|
#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"
|
|
|
|
#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-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
|