blob: 032a812ac9d1809b10b5739bee8bb40f67e9dc33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include <iostream>
#include <fstream>
#include "Parser.h"
#include "Circuit.h"
using std::cout;
using std::endl;
using std::ifstream;
#include "Node.h"
#include "GateAnd.h"
int main() {
// Observer ob();
Net n, n1, o;
Node *g = new GateAnd;
try {
g->addInput(&n);
g->addInput(&n1);
g->setOutput(&o);
// o.setLevel(UNDEFINED);
n.setLevel(HIGH);
n1.setLevel(HIGH);
int level = 22;
level = o.getLevel();
printf("hello world! %d\n", level);
} catch(Exception& e) {
std::cerr << e.what() << '\n';
}
return 0;
}
/*
int main(int argc, char** argv) {
Parser main_parser;
Circuit circuit;
main_parser.set_circuit(circuit);
ifstream file("circuits/and-test.txt");
try {
file >> main_parser;
// main_parser << file;
} catch (ParserException & e) {
cout << "Parser error: " << e.what() << endl;
return EXIT_FAILURE;
}
try {
circuit.sim();
} catch (CircuitException & e) {
cout << "Circuit error: " << e.what() << endl;
return EXIT_FAILURE;
}
// cout << "Circuit output: " << circuit.getOutput() << endl;
return EXIT_SUCCESS;
}
*/
|