-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.js
More file actions
159 lines (130 loc) · 5.31 KB
/
UI.js
File metadata and controls
159 lines (130 loc) · 5.31 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
function addAnd() {
var a = new AndGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addPower() {
var p = new Power(200, 150);
}
function addGround() {
var g = new Ground(200, 150);
}
function addOr() {
var or = new OrGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addNot() {
var a = new NotGate(200, 150, globalScope, "RIGHT");
}
function addNor() {
var a = new NorGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addTriState() {
var a = new TriState(200, 150, globalScope, "RIGHT");
}
function addControlledInverter() {
var a = new ControlledInverter(200, 150, globalScope, "RIGHT");
}
function addInput() {
// console.log("hello?");
var a = new Input(200, 150, globalScope, "RIGHT");
}
function addOutput() {
var a = new Output(200, 150, globalScope, "LEFT");
}
function addFlipflop() {
var a = new FlipFlop(200, 150, globalScope, "RIGHT");
}
function addTTY() {
var a = new TTY(200, 150, globalScope, "RIGHT");
}
function addKeyboard() {
var a = new Keyboard(200, 150, globalScope, "RIGHT");
}
function addMultiplexer() {
var a = new Multiplexer(200, 150, globalScope, "RIGHT");
}
function addClock() {
var a = new Clock(200, 150, globalScope, "RIGHT");
}
function addSevenSeg() {
var a = new SevenSegDisplay(400, 150);
}
function addHexDis() {
var a = new HexDisplay(400, 150);
}
function addAdder() {
var a = new Adder(400, 150, globalScope, "RIGHT");
}
function addRam() {
var a = new Ram(400, 150, globalScope, "RIGHT");
}
function addSubCircuit() {
var a = new SubCircuit(400, 150);
}
function addSplitter() {
var a = new Splitter(400, 400, globalScope, "RIGHT");
}
function addBitSelector() {
var a = new BitSelector(400, 300, globalScope, "RIGHT", bitWidth = undefined, selectorBitWidth = undefined)
}
function addConstantVal() {
var a = new ConstantVal(200, 150, globalScope, "RIGHT");
}
function addNand() {
var a = new NandGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addXor() {
var a = new XorGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addXnor() {
var a = new XnorGate(200, 150, globalScope, "RIGHT", prompt("No of inputs:"));
}
function addDigitalLed(){
var a = new DigitalLed(200, 150, globalScope, "UP");
}
function addVariableLed(){
var a = new VariableLed(200, 150, globalScope, "UP");
}
function addRGBLed(){
var or = new RGBLed(200, 150, globalScope, "UP");
}
function addStepper(){
var a = new Stepper(200, 150, globalScope,"RIGHT");
}
function addButton(){
var a = new Button(200, 150, globalScope, "RIGHT");
}
function addDemultiplexer() {
var a = new Demultiplexer(200, 150, globalScope, "RIGHT");
}
document.getElementById("powerButton").addEventListener("click", addPower);
document.getElementById("bitSelectorButton").addEventListener("click", addBitSelector);
document.getElementById("groundButton").addEventListener("click", addGround);
document.getElementById("andButton").addEventListener("click", addAnd);
document.getElementById("multiplexerButton").addEventListener("click", addMultiplexer);
document.getElementById("orButton").addEventListener("click", addOr);
document.getElementById("notButton").addEventListener("click", addNot);
document.getElementById("ControlledInverterButton").addEventListener("click", addControlledInverter);
document.getElementById("triStateButton").addEventListener("click", addTriState);
document.getElementById("inputButton").addEventListener("click", addInput);
document.getElementById("outputButton").addEventListener("click", addOutput);
document.getElementById("adderButton").addEventListener("click", addAdder);
document.getElementById("ramButton").addEventListener("click", addRam);
document.getElementById("clockButton").addEventListener("click", addClock);
document.getElementById("flipflopButton").addEventListener("click", addFlipflop);
document.getElementById("TTYButton").addEventListener("click", addTTY);
document.getElementById("sevenSegButton").addEventListener("click", addSevenSeg);
document.getElementById("hexButton").addEventListener("click", addHexDis);
document.getElementById("subCircuitButton").addEventListener("click", addSubCircuit);
document.getElementById("saveButton").addEventListener("click", Save);
document.getElementById("splitterButton").addEventListener("click", addSplitter);
document.getElementById("constantValButton").addEventListener("click", addConstantVal);
document.getElementById("NAND").addEventListener("click", addNand);
document.getElementById("xorButton").addEventListener("click", addXor);
document.getElementById("xnorButton").addEventListener("click", addXnor);
document.getElementById("keyboardButton").addEventListener("click", addKeyboard);
document.getElementById("norButton").addEventListener("click", addNor);
document.getElementById("digitalledButton").addEventListener("click", addDigitalLed);
document.getElementById("variableledButton").addEventListener("click", addVariableLed);
document.getElementById("stepperButton").addEventListener("click", addStepper);
document.getElementById("buttonButton").addEventListener("click", addButton);
document.getElementById("rgbledButton").addEventListener("click", addRGBLed);
document.getElementById("demultiplexerButton").addEventListener("click", addDemultiplexer);