simple-circuit-engine 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +7 -5
- package/README.md +8 -8
- package/dist/core/index.js +110 -85
- package/dist/core/setup.d.ts +10 -0
- package/dist/core/simulation/behaviors/index.d.ts +10 -0
- package/dist/core/simulation/behaviors/interface/EightInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/EightLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/FourInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/FourLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/InputBehaviorMixin.d.ts +37 -0
- package/dist/core/simulation/behaviors/interface/LightBehaviorMixin.d.ts +60 -0
- package/dist/core/simulation/behaviors/interface/OneInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/OneLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/TwoInputBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/TwoLightBehavior.d.ts +9 -0
- package/dist/core/simulation/behaviors/interface/index.d.ts +0 -0
- package/dist/core/simulation/states/index.d.ts +10 -0
- package/dist/core/simulation/states/interface/EightInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/EightLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/FourInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/FourLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/InputState.d.ts +45 -0
- package/dist/core/simulation/states/interface/LightState.d.ts +54 -0
- package/dist/core/simulation/states/interface/OneInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/OneLightState.d.ts +6 -0
- package/dist/core/simulation/states/interface/TwoInputState.d.ts +6 -0
- package/dist/core/simulation/states/interface/TwoLightState.d.ts +6 -0
- package/dist/core/simulation/types.d.ts +9 -1
- package/dist/core/topology/Component.d.ts +4 -0
- package/dist/core/topology/ENode.d.ts +7 -2
- package/dist/core/topology/index.d.ts +2 -0
- package/dist/core/topology/networkTraversal.d.ts +50 -0
- package/dist/core/topology/types.d.ts +13 -2
- package/dist/{core-b6Q8w2sn.js → core-HH6iRWtB.js} +1850 -739
- package/dist/core-HH6iRWtB.js.map +1 -0
- package/dist/i18n/index.d.ts +276 -0
- package/dist/i18n/locales/en.json.d.ts +98 -0
- package/dist/i18n/locales/fr.json.d.ts +98 -0
- package/dist/index.js +172 -135
- package/dist/scene/CircuitEngine.d.ts +36 -4
- package/dist/scene/index.d.ts +6 -2
- package/dist/scene/index.js +62 -50
- package/dist/scene/setup.d.ts +10 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +5 -3
- package/dist/scene/shared/HoverManager.d.ts +15 -0
- package/dist/scene/shared/components/index.d.ts +10 -0
- package/dist/scene/shared/components/interface/EightInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/EightLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/FourInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/FourLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/InputVisualFactoryBase.d.ts +50 -0
- package/dist/scene/shared/components/interface/LightVisualFactoryBase.d.ts +46 -0
- package/dist/scene/shared/components/interface/OneInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/OneLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/TwoInputVisualFactory.d.ts +15 -0
- package/dist/scene/shared/components/interface/TwoLightVisualFactory.d.ts +15 -0
- package/dist/scene/shared/types.d.ts +34 -2
- package/dist/scene/shared/utils/ControlsUtils.d.ts +1 -1
- package/dist/scene/shared/utils/GeometryUtils.d.ts +35 -0
- package/dist/scene/static/CircuitController.d.ts +12 -1
- package/dist/scene/static/tools/BuildTool.d.ts +77 -0
- package/dist/scene/static/tools/MultiWiringPlacement.d.ts +40 -0
- package/dist/scene/widgets/HelpWidget.d.ts +13 -0
- package/dist/scene/widgets/ModeWidget.d.ts +16 -0
- package/dist/scene/widgets/MultiWiringWidget.d.ts +21 -0
- package/dist/scene/{static → widgets}/PinTooltipWidget.d.ts +2 -1
- package/dist/scene/widgets/SimulationPlayerWidget.d.ts +62 -0
- package/dist/scene/widgets/ToolsWidget.d.ts +18 -0
- package/dist/scene/widgets/WidgetsManager.d.ts +65 -0
- package/dist/scene/widgets/assets/icons.d.ts +20 -0
- package/dist/scene/widgets/index.d.ts +9 -0
- package/dist/scene/widgets/styles.d.ts +33 -0
- package/dist/{scene-D4QcWeiq.js → scene-C1xhdw_B.js} +3311 -1478
- package/dist/scene-C1xhdw_B.js.map +1 -0
- package/package.json +2 -2
- package/dist/core-b6Q8w2sn.js.map +0 -1
- package/dist/scene-D4QcWeiq.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function
|
|
1
|
+
function yt(e) {
|
|
2
2
|
let t, n, i;
|
|
3
3
|
return typeof e == "object" ? (t = e.hashFunction, n = e.expiring, i = e.tags) : t = e, (s, r, a) => {
|
|
4
|
-
if (a.value != null) a.value =
|
|
5
|
-
else if (a.get != null) a.get =
|
|
4
|
+
if (a.value != null) a.value = X(a.value, t, n, i);
|
|
5
|
+
else if (a.get != null) a.get = X(a.get, t, n, i);
|
|
6
6
|
else throw "Only put a Memoize() decorator on a method or get accessor.";
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function _e(e, t) {
|
|
10
|
+
return yt({
|
|
11
11
|
expiring: e,
|
|
12
12
|
hashFunction: t
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
15
|
+
var _ = /* @__PURE__ */ new Map();
|
|
16
|
+
function X(e, t, n = 0, i) {
|
|
17
17
|
const s = /* @__PURE__ */ Symbol("__memoized_map__");
|
|
18
18
|
return function(...r) {
|
|
19
19
|
let a;
|
|
@@ -24,26 +24,26 @@ function W(e, t, n = 0, i) {
|
|
|
24
24
|
value: /* @__PURE__ */ new Map()
|
|
25
25
|
});
|
|
26
26
|
let o = this[s];
|
|
27
|
-
if (Array.isArray(i)) for (const
|
|
27
|
+
if (Array.isArray(i)) for (const u of i) _.has(u) ? _.get(u).push(o) : _.set(u, [o]);
|
|
28
28
|
if (t || r.length > 0 || n > 0) {
|
|
29
|
-
let
|
|
30
|
-
t === !0 ?
|
|
31
|
-
const
|
|
32
|
-
let
|
|
33
|
-
if (n > 0) if (!o.has(
|
|
29
|
+
let u;
|
|
30
|
+
t === !0 ? u = r.map((d) => d.toString()).join("!") : t ? u = t.apply(this, r) : u = r[0];
|
|
31
|
+
const l = `${u}__timestamp`;
|
|
32
|
+
let p = !1;
|
|
33
|
+
if (n > 0) if (!o.has(l)) p = !0;
|
|
34
34
|
else {
|
|
35
|
-
let d = o.get(
|
|
36
|
-
|
|
35
|
+
let d = o.get(l);
|
|
36
|
+
p = Date.now() - d > n;
|
|
37
37
|
}
|
|
38
|
-
o.has(
|
|
38
|
+
o.has(u) && !p ? a = o.get(u) : (a = e.apply(this, r), o.set(u, a), n > 0 && o.set(l, Date.now()));
|
|
39
39
|
} else {
|
|
40
|
-
const
|
|
41
|
-
o.has(
|
|
40
|
+
const u = this;
|
|
41
|
+
o.has(u) ? a = o.get(u) : (a = e.apply(this, r), o.set(u, a));
|
|
42
42
|
}
|
|
43
43
|
return a;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
var
|
|
46
|
+
var D = class j {
|
|
47
47
|
constructor(t, n, i) {
|
|
48
48
|
this.x = t, this.y = n, this.z = i;
|
|
49
49
|
}
|
|
@@ -58,13 +58,13 @@ var O = class X {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
static fromJSON(t) {
|
|
61
|
-
return new
|
|
61
|
+
return new j(t.x, t.y, t.z);
|
|
62
62
|
}
|
|
63
63
|
toString() {
|
|
64
64
|
return `Position(${this.x}, ${this.y}, ${this.z})`;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
67
|
-
constructor(t = new
|
|
66
|
+
}, tt = class et {
|
|
67
|
+
constructor(t = new D(0, 15, 15), n = new D(0, 0, 0), i = 75, s = 0.1, r = 1e3) {
|
|
68
68
|
this.position = t, this.lookAtPosition = n, this.fov = i, this.near = s, this.far = r;
|
|
69
69
|
}
|
|
70
70
|
toJSON() {
|
|
@@ -77,12 +77,12 @@ var O = class X {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
static fromJSON(t) {
|
|
80
|
-
return new
|
|
80
|
+
return new et(D.fromJSON(t.position), D.fromJSON(t.lookAtPosition), t.fov, t.near, t.far);
|
|
81
81
|
}
|
|
82
82
|
toString() {
|
|
83
83
|
return `CameraOptions(position: ${this.position.toString()}, lookAt: ${this.lookAtPosition.toString()}, fov: ${this.fov}, near: ${this.near}, far: ${this.far})`;
|
|
84
84
|
}
|
|
85
|
-
},
|
|
85
|
+
}, H = class it {
|
|
86
86
|
constructor(t, n) {
|
|
87
87
|
if (this.x = t, this.y = n, !Number.isInteger(t) || !Number.isInteger(n)) throw new TypeError(`Position coordinates must be integers (got x=${t}, y=${n})`);
|
|
88
88
|
}
|
|
@@ -96,42 +96,42 @@ var O = class X {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
static fromJSON(t) {
|
|
99
|
-
return new
|
|
99
|
+
return new it(t.x, t.y);
|
|
100
100
|
}
|
|
101
101
|
toString() {
|
|
102
102
|
return `Position(${this.x}, ${this.y})`;
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
|
-
function
|
|
105
|
+
function vt(e, t, n = 1 / 0) {
|
|
106
106
|
if (e.length === 0) return 0;
|
|
107
107
|
if (e.length === 1) return 1;
|
|
108
108
|
let i = 1;
|
|
109
109
|
for (let s = 0; s < e.length - 1; s++) {
|
|
110
|
-
const r = e[s], a = e[s + 1], o =
|
|
110
|
+
const r = e[s], a = e[s + 1], o = St(t, r, a);
|
|
111
111
|
o < n && (n = o, i = s + 1);
|
|
112
112
|
}
|
|
113
113
|
return i;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function St(e, t, n) {
|
|
116
116
|
const i = n.x - t.x, s = n.y - t.y, r = i * i + s * s;
|
|
117
117
|
if (r === 0) return Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
|
|
118
|
-
const a = Math.max(0, Math.min(1, ((e.x - t.x) * i + (e.y - t.y) * s) / r)), o = t.x + a * i,
|
|
119
|
-
return Math.sqrt((e.x - o) ** 2 + (e.y -
|
|
118
|
+
const a = Math.max(0, Math.min(1, ((e.x - t.x) * i + (e.y - t.y) * s) / r)), o = t.x + a * i, u = t.y + a * s;
|
|
119
|
+
return Math.sqrt((e.x - o) ** 2 + (e.y - u) ** 2);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function V(e, t = 5) {
|
|
122
122
|
if (e.length <= 2) return [...e];
|
|
123
123
|
const n = [e[0]];
|
|
124
124
|
for (let i = 1; i < e.length - 1; i++) {
|
|
125
125
|
const s = n[n.length - 1], r = e[i], a = e[i + 1];
|
|
126
|
-
|
|
126
|
+
wt(s, r, a, t) || n.push(r);
|
|
127
127
|
}
|
|
128
128
|
return n.push(e[e.length - 1]), n;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function wt(e, t, n, i = 5) {
|
|
131
131
|
const s = (t.x - e.x) * (n.y - e.y) - (t.y - e.y) * (n.x - e.x);
|
|
132
132
|
return Math.abs(s) <= i;
|
|
133
133
|
}
|
|
134
|
-
var
|
|
134
|
+
var mt = class nt {
|
|
135
135
|
constructor(t) {
|
|
136
136
|
if (this.angle = t, !Number.isInteger(t)) throw new TypeError(`Rotation angle must be an integer (got ${t})`);
|
|
137
137
|
}
|
|
@@ -139,7 +139,7 @@ var yt = class Y {
|
|
|
139
139
|
return this.angle;
|
|
140
140
|
}
|
|
141
141
|
static fromJSON(t) {
|
|
142
|
-
return new
|
|
142
|
+
return new nt(t);
|
|
143
143
|
}
|
|
144
144
|
equals(t) {
|
|
145
145
|
return this.angle === t.angle;
|
|
@@ -148,7 +148,7 @@ var yt = class Y {
|
|
|
148
148
|
return `Rotation(${this.angle}°)`;
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
function
|
|
151
|
+
function J() {
|
|
152
152
|
if (typeof crypto < "u" && crypto.randomUUID) return crypto.randomUUID();
|
|
153
153
|
const e = "0123456789abcdef", t = [
|
|
154
154
|
8,
|
|
@@ -168,19 +168,19 @@ function $() {
|
|
|
168
168
|
const i = n.join("-").split("");
|
|
169
169
|
return i[14] = "4", i[19] = e[parseInt(i[19] ?? "0", 16) & 3 | 8] ?? "0", i.join("");
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var st = "0.0.14", h = /* @__PURE__ */ (function(e) {
|
|
172
172
|
return e.Voltage = "Voltage", e.Current = "Current", e;
|
|
173
|
-
})({}),
|
|
173
|
+
})({}), w = /* @__PURE__ */ (function(e) {
|
|
174
174
|
return e.Pin = "Pin", e.BranchingPoint = "BranchingPoint", e;
|
|
175
|
-
})({}),
|
|
175
|
+
})({}), Ve = [
|
|
176
176
|
"CMOS1",
|
|
177
177
|
"TTL1",
|
|
178
178
|
"Sandbox"
|
|
179
|
-
],
|
|
180
|
-
return e.Cube = "cube", e.Label = "label", e.Battery = "battery", e.Switch = "switch", e.DoubleThrowSwitch = "doubleThrowSwitch", e.Lightbulb = "lightbulb", e.Relay = "relay", e.SmallLED = "smallLED", e.RectangleLED = "rectangleLED", e.Clock = "clock", e.Inverter = "inverter", e.NandGate = "nandGate", e.Nand4Gate = "nand4Gate", e.Nand8Gate = "nand8Gate", e.NorGate = "norGate", e.Nor4Gate = "nor4Gate", e.Nor8Gate = "nor8Gate", e.XorGate = "xorGate", e.Xor4Gate = "xor4Gate", e.Xor8Gate = "xor8Gate", e.HalfAdder = "halfAdder", e.Adder = "adder", e.EightBitAdder = "eightBitAdder", e.EightBitOnesComplement = "eightBitOnesComplement", e;
|
|
179
|
+
], rt = "CMOS1", c = /* @__PURE__ */ (function(e) {
|
|
180
|
+
return e.Cube = "cube", e.Label = "label", e.Battery = "battery", e.Switch = "switch", e.DoubleThrowSwitch = "doubleThrowSwitch", e.Lightbulb = "lightbulb", e.Relay = "relay", e.SmallLED = "smallLED", e.RectangleLED = "rectangleLED", e.Clock = "clock", e.Inverter = "inverter", e.NandGate = "nandGate", e.Nand4Gate = "nand4Gate", e.Nand8Gate = "nand8Gate", e.NorGate = "norGate", e.Nor4Gate = "nor4Gate", e.Nor8Gate = "nor8Gate", e.XorGate = "xorGate", e.Xor4Gate = "xor4Gate", e.Xor8Gate = "xor8Gate", e.HalfAdder = "halfAdder", e.Adder = "adder", e.EightBitAdder = "eightBitAdder", e.EightBitOnesComplement = "eightBitOnesComplement", e.OneInput = "oneInput", e.TwoInput = "twoInput", e.FourInput = "fourInput", e.EightInput = "eightInput", e.OneLight = "oneLight", e.TwoLight = "twoLight", e.FourLight = "fourLight", e.EightLight = "eightLight", e;
|
|
181
181
|
})({}), I = {
|
|
182
|
-
[
|
|
183
|
-
id:
|
|
182
|
+
[c.Switch]: {
|
|
183
|
+
id: c.Switch,
|
|
184
184
|
pins: /* @__PURE__ */ new Map([["input", { subtype: "free" }], ["output", { subtype: "free" }]]),
|
|
185
185
|
config: /* @__PURE__ */ new Map([
|
|
186
186
|
["initialState", "open"],
|
|
@@ -188,8 +188,8 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
188
188
|
["size", "1"]
|
|
189
189
|
])
|
|
190
190
|
},
|
|
191
|
-
[
|
|
192
|
-
id:
|
|
191
|
+
[c.DoubleThrowSwitch]: {
|
|
192
|
+
id: c.DoubleThrowSwitch,
|
|
193
193
|
pins: /* @__PURE__ */ new Map([
|
|
194
194
|
["input1", { subtype: "free" }],
|
|
195
195
|
["input2", { subtype: "free" }],
|
|
@@ -201,24 +201,24 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
201
201
|
["size", "1"]
|
|
202
202
|
])
|
|
203
203
|
},
|
|
204
|
-
[
|
|
205
|
-
id:
|
|
204
|
+
[c.Battery]: {
|
|
205
|
+
id: c.Battery,
|
|
206
206
|
pins: /* @__PURE__ */ new Map([["cathode", {
|
|
207
207
|
subtype: "mainVcc",
|
|
208
|
-
sourceType:
|
|
208
|
+
sourceType: h.Voltage
|
|
209
209
|
}], ["anode", {
|
|
210
210
|
subtype: "mainGnd",
|
|
211
|
-
sourceType:
|
|
211
|
+
sourceType: h.Current
|
|
212
212
|
}]]),
|
|
213
213
|
config: /* @__PURE__ */ new Map([])
|
|
214
214
|
},
|
|
215
|
-
[
|
|
216
|
-
id:
|
|
215
|
+
[c.Lightbulb]: {
|
|
216
|
+
id: c.Lightbulb,
|
|
217
217
|
pins: /* @__PURE__ */ new Map([["pin1", { subtype: "free" }], ["pin2", { subtype: "free" }]]),
|
|
218
218
|
config: /* @__PURE__ */ new Map([["transitionSpan", "1"], ["size", "1"]])
|
|
219
219
|
},
|
|
220
|
-
[
|
|
221
|
-
id:
|
|
220
|
+
[c.Relay]: {
|
|
221
|
+
id: c.Relay,
|
|
222
222
|
pins: /* @__PURE__ */ new Map([
|
|
223
223
|
["cmd_in", { subtype: "free" }],
|
|
224
224
|
["cmd_out", { subtype: "free" }],
|
|
@@ -231,8 +231,8 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
231
231
|
["initializationOrder", ""]
|
|
232
232
|
])
|
|
233
233
|
},
|
|
234
|
-
[
|
|
235
|
-
id:
|
|
234
|
+
[c.SmallLED]: {
|
|
235
|
+
id: c.SmallLED,
|
|
236
236
|
pins: /* @__PURE__ */ new Map([["pin1", { subtype: "free" }], ["pin2", { subtype: "free" }]]),
|
|
237
237
|
config: /* @__PURE__ */ new Map([
|
|
238
238
|
["transitionSpan", "1"],
|
|
@@ -242,8 +242,8 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
242
242
|
["ywRatio", "1"]
|
|
243
243
|
])
|
|
244
244
|
},
|
|
245
|
-
[
|
|
246
|
-
id:
|
|
245
|
+
[c.RectangleLED]: {
|
|
246
|
+
id: c.RectangleLED,
|
|
247
247
|
pins: /* @__PURE__ */ new Map([["pin1", { subtype: "free" }], ["pin2", { subtype: "free" }]]),
|
|
248
248
|
config: /* @__PURE__ */ new Map([
|
|
249
249
|
["transitionSpan", "1"],
|
|
@@ -254,61 +254,64 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
254
254
|
["ywRatio", "1"]
|
|
255
255
|
])
|
|
256
256
|
},
|
|
257
|
-
[
|
|
258
|
-
id:
|
|
257
|
+
[c.Cube]: {
|
|
258
|
+
id: c.Cube,
|
|
259
259
|
pins: /* @__PURE__ */ new Map([]),
|
|
260
260
|
config: /* @__PURE__ */ new Map([["color", "red"]])
|
|
261
261
|
},
|
|
262
|
-
[
|
|
263
|
-
id:
|
|
262
|
+
[c.Label]: {
|
|
263
|
+
id: c.Label,
|
|
264
264
|
pins: /* @__PURE__ */ new Map([]),
|
|
265
265
|
config: /* @__PURE__ */ new Map([["text", "Label"], ["size", "1"]])
|
|
266
266
|
},
|
|
267
|
-
[
|
|
268
|
-
id:
|
|
267
|
+
[c.Clock]: {
|
|
268
|
+
id: c.Clock,
|
|
269
269
|
pins: /* @__PURE__ */ new Map([
|
|
270
270
|
["vcc", {
|
|
271
271
|
subtype: "vcc",
|
|
272
|
-
sourceType:
|
|
272
|
+
sourceType: h.Voltage
|
|
273
273
|
}],
|
|
274
274
|
["output", {
|
|
275
275
|
subtype: "logicOutput",
|
|
276
276
|
logicPinData: {
|
|
277
277
|
interface: "output",
|
|
278
|
-
index: 0
|
|
278
|
+
index: 0,
|
|
279
|
+
size: 1
|
|
279
280
|
}
|
|
280
281
|
}],
|
|
281
282
|
["gnd", {
|
|
282
283
|
subtype: "gnd",
|
|
283
|
-
sourceType:
|
|
284
|
+
sourceType: h.Current
|
|
284
285
|
}]
|
|
285
286
|
]),
|
|
286
287
|
config: /* @__PURE__ */ new Map([["startHigh", "true"], ["halfPeriod", "2"]])
|
|
287
288
|
},
|
|
288
|
-
[
|
|
289
|
-
id:
|
|
289
|
+
[c.Inverter]: {
|
|
290
|
+
id: c.Inverter,
|
|
290
291
|
pins: /* @__PURE__ */ new Map([
|
|
291
292
|
["vcc", {
|
|
292
293
|
subtype: "vcc",
|
|
293
|
-
sourceType:
|
|
294
|
+
sourceType: h.Voltage
|
|
294
295
|
}],
|
|
295
296
|
["input", {
|
|
296
297
|
subtype: "logicInput",
|
|
297
298
|
logicPinData: {
|
|
298
299
|
interface: "input",
|
|
299
|
-
index: 0
|
|
300
|
+
index: 0,
|
|
301
|
+
size: 1
|
|
300
302
|
}
|
|
301
303
|
}],
|
|
302
304
|
["output", {
|
|
303
305
|
subtype: "logicOutput",
|
|
304
306
|
logicPinData: {
|
|
305
307
|
interface: "output",
|
|
306
|
-
index: 0
|
|
308
|
+
index: 0,
|
|
309
|
+
size: 1
|
|
307
310
|
}
|
|
308
311
|
}],
|
|
309
312
|
["gnd", {
|
|
310
313
|
subtype: "gnd",
|
|
311
|
-
sourceType:
|
|
314
|
+
sourceType: h.Current
|
|
312
315
|
}]
|
|
313
316
|
]),
|
|
314
317
|
config: /* @__PURE__ */ new Map([
|
|
@@ -318,37 +321,40 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
318
321
|
["initializationOrder", ""]
|
|
319
322
|
])
|
|
320
323
|
},
|
|
321
|
-
[
|
|
322
|
-
id:
|
|
324
|
+
[c.NandGate]: {
|
|
325
|
+
id: c.NandGate,
|
|
323
326
|
pins: /* @__PURE__ */ new Map([
|
|
324
327
|
["vcc", {
|
|
325
328
|
subtype: "vcc",
|
|
326
|
-
sourceType:
|
|
329
|
+
sourceType: h.Voltage
|
|
327
330
|
}],
|
|
328
|
-
["
|
|
331
|
+
["input-0", {
|
|
329
332
|
subtype: "logicInput",
|
|
330
333
|
logicPinData: {
|
|
331
334
|
interface: "input",
|
|
332
|
-
index: 0
|
|
335
|
+
index: 0,
|
|
336
|
+
size: 2
|
|
333
337
|
}
|
|
334
338
|
}],
|
|
335
|
-
["
|
|
339
|
+
["input-1", {
|
|
336
340
|
subtype: "logicInput",
|
|
337
341
|
logicPinData: {
|
|
338
342
|
interface: "input",
|
|
339
|
-
index: 1
|
|
343
|
+
index: 1,
|
|
344
|
+
size: 2
|
|
340
345
|
}
|
|
341
346
|
}],
|
|
342
347
|
["output", {
|
|
343
348
|
subtype: "logicOutput",
|
|
344
349
|
logicPinData: {
|
|
345
350
|
interface: "output",
|
|
346
|
-
index: 0
|
|
351
|
+
index: 0,
|
|
352
|
+
size: 1
|
|
347
353
|
}
|
|
348
354
|
}],
|
|
349
355
|
["gnd", {
|
|
350
356
|
subtype: "gnd",
|
|
351
|
-
sourceType:
|
|
357
|
+
sourceType: h.Current
|
|
352
358
|
}]
|
|
353
359
|
]),
|
|
354
360
|
config: /* @__PURE__ */ new Map([
|
|
@@ -358,51 +364,56 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
358
364
|
["initializationOrder", ""]
|
|
359
365
|
])
|
|
360
366
|
},
|
|
361
|
-
[
|
|
362
|
-
id:
|
|
367
|
+
[c.Nand4Gate]: {
|
|
368
|
+
id: c.Nand4Gate,
|
|
363
369
|
pins: /* @__PURE__ */ new Map([
|
|
364
370
|
["vcc", {
|
|
365
371
|
subtype: "vcc",
|
|
366
|
-
sourceType:
|
|
372
|
+
sourceType: h.Voltage
|
|
367
373
|
}],
|
|
368
|
-
["
|
|
374
|
+
["input-0", {
|
|
369
375
|
subtype: "logicInput",
|
|
370
376
|
logicPinData: {
|
|
371
377
|
interface: "input",
|
|
372
|
-
index: 0
|
|
378
|
+
index: 0,
|
|
379
|
+
size: 4
|
|
373
380
|
}
|
|
374
381
|
}],
|
|
375
|
-
["
|
|
382
|
+
["input-1", {
|
|
376
383
|
subtype: "logicInput",
|
|
377
384
|
logicPinData: {
|
|
378
385
|
interface: "input",
|
|
379
|
-
index: 1
|
|
386
|
+
index: 1,
|
|
387
|
+
size: 4
|
|
380
388
|
}
|
|
381
389
|
}],
|
|
382
|
-
["
|
|
390
|
+
["input-2", {
|
|
383
391
|
subtype: "logicInput",
|
|
384
392
|
logicPinData: {
|
|
385
393
|
interface: "input",
|
|
386
|
-
index: 2
|
|
394
|
+
index: 2,
|
|
395
|
+
size: 4
|
|
387
396
|
}
|
|
388
397
|
}],
|
|
389
|
-
["
|
|
398
|
+
["input-3", {
|
|
390
399
|
subtype: "logicInput",
|
|
391
400
|
logicPinData: {
|
|
392
401
|
interface: "input",
|
|
393
|
-
index: 3
|
|
402
|
+
index: 3,
|
|
403
|
+
size: 4
|
|
394
404
|
}
|
|
395
405
|
}],
|
|
396
406
|
["output", {
|
|
397
407
|
subtype: "logicOutput",
|
|
398
408
|
logicPinData: {
|
|
399
409
|
interface: "output",
|
|
400
|
-
index: 0
|
|
410
|
+
index: 0,
|
|
411
|
+
size: 1
|
|
401
412
|
}
|
|
402
413
|
}],
|
|
403
414
|
["gnd", {
|
|
404
415
|
subtype: "gnd",
|
|
405
|
-
sourceType:
|
|
416
|
+
sourceType: h.Current
|
|
406
417
|
}]
|
|
407
418
|
]),
|
|
408
419
|
config: /* @__PURE__ */ new Map([
|
|
@@ -412,79 +423,88 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
412
423
|
["initializationOrder", ""]
|
|
413
424
|
])
|
|
414
425
|
},
|
|
415
|
-
[
|
|
416
|
-
id:
|
|
426
|
+
[c.Nand8Gate]: {
|
|
427
|
+
id: c.Nand8Gate,
|
|
417
428
|
pins: /* @__PURE__ */ new Map([
|
|
418
429
|
["vcc", {
|
|
419
430
|
subtype: "vcc",
|
|
420
|
-
sourceType:
|
|
431
|
+
sourceType: h.Voltage
|
|
421
432
|
}],
|
|
422
|
-
["
|
|
433
|
+
["input-0", {
|
|
423
434
|
subtype: "logicInput",
|
|
424
435
|
logicPinData: {
|
|
425
436
|
interface: "input",
|
|
426
|
-
index: 0
|
|
437
|
+
index: 0,
|
|
438
|
+
size: 8
|
|
427
439
|
}
|
|
428
440
|
}],
|
|
429
|
-
["
|
|
441
|
+
["input-1", {
|
|
430
442
|
subtype: "logicInput",
|
|
431
443
|
logicPinData: {
|
|
432
444
|
interface: "input",
|
|
433
|
-
index: 1
|
|
445
|
+
index: 1,
|
|
446
|
+
size: 8
|
|
434
447
|
}
|
|
435
448
|
}],
|
|
436
|
-
["
|
|
449
|
+
["input-2", {
|
|
437
450
|
subtype: "logicInput",
|
|
438
451
|
logicPinData: {
|
|
439
452
|
interface: "input",
|
|
440
|
-
index: 2
|
|
453
|
+
index: 2,
|
|
454
|
+
size: 8
|
|
441
455
|
}
|
|
442
456
|
}],
|
|
443
|
-
["
|
|
457
|
+
["input-3", {
|
|
444
458
|
subtype: "logicInput",
|
|
445
459
|
logicPinData: {
|
|
446
460
|
interface: "input",
|
|
447
|
-
index: 3
|
|
461
|
+
index: 3,
|
|
462
|
+
size: 8
|
|
448
463
|
}
|
|
449
464
|
}],
|
|
450
|
-
["
|
|
465
|
+
["input-4", {
|
|
451
466
|
subtype: "logicInput",
|
|
452
467
|
logicPinData: {
|
|
453
468
|
interface: "input",
|
|
454
|
-
index: 4
|
|
469
|
+
index: 4,
|
|
470
|
+
size: 8
|
|
455
471
|
}
|
|
456
472
|
}],
|
|
457
|
-
["
|
|
473
|
+
["input-5", {
|
|
458
474
|
subtype: "logicInput",
|
|
459
475
|
logicPinData: {
|
|
460
476
|
interface: "input",
|
|
461
|
-
index: 5
|
|
477
|
+
index: 5,
|
|
478
|
+
size: 8
|
|
462
479
|
}
|
|
463
480
|
}],
|
|
464
|
-
["
|
|
481
|
+
["input-6", {
|
|
465
482
|
subtype: "logicInput",
|
|
466
483
|
logicPinData: {
|
|
467
484
|
interface: "input",
|
|
468
|
-
index: 6
|
|
485
|
+
index: 6,
|
|
486
|
+
size: 8
|
|
469
487
|
}
|
|
470
488
|
}],
|
|
471
|
-
["
|
|
489
|
+
["input-7", {
|
|
472
490
|
subtype: "logicInput",
|
|
473
491
|
logicPinData: {
|
|
474
492
|
interface: "input",
|
|
475
|
-
index: 7
|
|
493
|
+
index: 7,
|
|
494
|
+
size: 8
|
|
476
495
|
}
|
|
477
496
|
}],
|
|
478
497
|
["output", {
|
|
479
498
|
subtype: "logicOutput",
|
|
480
499
|
logicPinData: {
|
|
481
500
|
interface: "output",
|
|
482
|
-
index: 0
|
|
501
|
+
index: 0,
|
|
502
|
+
size: 1
|
|
483
503
|
}
|
|
484
504
|
}],
|
|
485
505
|
["gnd", {
|
|
486
506
|
subtype: "gnd",
|
|
487
|
-
sourceType:
|
|
507
|
+
sourceType: h.Current
|
|
488
508
|
}]
|
|
489
509
|
]),
|
|
490
510
|
config: /* @__PURE__ */ new Map([
|
|
@@ -494,37 +514,40 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
494
514
|
["initializationOrder", ""]
|
|
495
515
|
])
|
|
496
516
|
},
|
|
497
|
-
[
|
|
498
|
-
id:
|
|
517
|
+
[c.NorGate]: {
|
|
518
|
+
id: c.NorGate,
|
|
499
519
|
pins: /* @__PURE__ */ new Map([
|
|
500
520
|
["vcc", {
|
|
501
521
|
subtype: "vcc",
|
|
502
|
-
sourceType:
|
|
522
|
+
sourceType: h.Voltage
|
|
503
523
|
}],
|
|
504
|
-
["
|
|
524
|
+
["input-0", {
|
|
505
525
|
subtype: "logicInput",
|
|
506
526
|
logicPinData: {
|
|
507
527
|
interface: "input",
|
|
508
|
-
index: 0
|
|
528
|
+
index: 0,
|
|
529
|
+
size: 2
|
|
509
530
|
}
|
|
510
531
|
}],
|
|
511
|
-
["
|
|
532
|
+
["input-1", {
|
|
512
533
|
subtype: "logicInput",
|
|
513
534
|
logicPinData: {
|
|
514
535
|
interface: "input",
|
|
515
|
-
index: 1
|
|
536
|
+
index: 1,
|
|
537
|
+
size: 2
|
|
516
538
|
}
|
|
517
539
|
}],
|
|
518
540
|
["output", {
|
|
519
541
|
subtype: "logicOutput",
|
|
520
542
|
logicPinData: {
|
|
521
543
|
interface: "output",
|
|
522
|
-
index: 0
|
|
544
|
+
index: 0,
|
|
545
|
+
size: 1
|
|
523
546
|
}
|
|
524
547
|
}],
|
|
525
548
|
["gnd", {
|
|
526
549
|
subtype: "gnd",
|
|
527
|
-
sourceType:
|
|
550
|
+
sourceType: h.Current
|
|
528
551
|
}]
|
|
529
552
|
]),
|
|
530
553
|
config: /* @__PURE__ */ new Map([
|
|
@@ -534,51 +557,56 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
534
557
|
["initializationOrder", ""]
|
|
535
558
|
])
|
|
536
559
|
},
|
|
537
|
-
[
|
|
538
|
-
id:
|
|
560
|
+
[c.Nor4Gate]: {
|
|
561
|
+
id: c.Nor4Gate,
|
|
539
562
|
pins: /* @__PURE__ */ new Map([
|
|
540
563
|
["vcc", {
|
|
541
564
|
subtype: "vcc",
|
|
542
|
-
sourceType:
|
|
565
|
+
sourceType: h.Voltage
|
|
543
566
|
}],
|
|
544
|
-
["
|
|
567
|
+
["input-0", {
|
|
545
568
|
subtype: "logicInput",
|
|
546
569
|
logicPinData: {
|
|
547
570
|
interface: "input",
|
|
548
|
-
index: 0
|
|
571
|
+
index: 0,
|
|
572
|
+
size: 4
|
|
549
573
|
}
|
|
550
574
|
}],
|
|
551
|
-
["
|
|
575
|
+
["input-1", {
|
|
552
576
|
subtype: "logicInput",
|
|
553
577
|
logicPinData: {
|
|
554
578
|
interface: "input",
|
|
555
|
-
index: 1
|
|
579
|
+
index: 1,
|
|
580
|
+
size: 4
|
|
556
581
|
}
|
|
557
582
|
}],
|
|
558
|
-
["
|
|
583
|
+
["input-2", {
|
|
559
584
|
subtype: "logicInput",
|
|
560
585
|
logicPinData: {
|
|
561
586
|
interface: "input",
|
|
562
|
-
index: 2
|
|
587
|
+
index: 2,
|
|
588
|
+
size: 4
|
|
563
589
|
}
|
|
564
590
|
}],
|
|
565
|
-
["
|
|
591
|
+
["input-3", {
|
|
566
592
|
subtype: "logicInput",
|
|
567
593
|
logicPinData: {
|
|
568
594
|
interface: "input",
|
|
569
|
-
index: 3
|
|
595
|
+
index: 3,
|
|
596
|
+
size: 4
|
|
570
597
|
}
|
|
571
598
|
}],
|
|
572
599
|
["output", {
|
|
573
600
|
subtype: "logicOutput",
|
|
574
601
|
logicPinData: {
|
|
575
602
|
interface: "output",
|
|
576
|
-
index: 0
|
|
603
|
+
index: 0,
|
|
604
|
+
size: 1
|
|
577
605
|
}
|
|
578
606
|
}],
|
|
579
607
|
["gnd", {
|
|
580
608
|
subtype: "gnd",
|
|
581
|
-
sourceType:
|
|
609
|
+
sourceType: h.Current
|
|
582
610
|
}]
|
|
583
611
|
]),
|
|
584
612
|
config: /* @__PURE__ */ new Map([
|
|
@@ -588,79 +616,88 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
588
616
|
["initializationOrder", ""]
|
|
589
617
|
])
|
|
590
618
|
},
|
|
591
|
-
[
|
|
592
|
-
id:
|
|
619
|
+
[c.Nor8Gate]: {
|
|
620
|
+
id: c.Nor8Gate,
|
|
593
621
|
pins: /* @__PURE__ */ new Map([
|
|
594
622
|
["vcc", {
|
|
595
623
|
subtype: "vcc",
|
|
596
|
-
sourceType:
|
|
624
|
+
sourceType: h.Voltage
|
|
597
625
|
}],
|
|
598
|
-
["
|
|
626
|
+
["input-0", {
|
|
599
627
|
subtype: "logicInput",
|
|
600
628
|
logicPinData: {
|
|
601
629
|
interface: "input",
|
|
602
|
-
index: 0
|
|
630
|
+
index: 0,
|
|
631
|
+
size: 8
|
|
603
632
|
}
|
|
604
633
|
}],
|
|
605
|
-
["
|
|
634
|
+
["input-1", {
|
|
606
635
|
subtype: "logicInput",
|
|
607
636
|
logicPinData: {
|
|
608
637
|
interface: "input",
|
|
609
|
-
index: 1
|
|
638
|
+
index: 1,
|
|
639
|
+
size: 8
|
|
610
640
|
}
|
|
611
641
|
}],
|
|
612
|
-
["
|
|
642
|
+
["input-2", {
|
|
613
643
|
subtype: "logicInput",
|
|
614
644
|
logicPinData: {
|
|
615
645
|
interface: "input",
|
|
616
|
-
index: 2
|
|
646
|
+
index: 2,
|
|
647
|
+
size: 8
|
|
617
648
|
}
|
|
618
649
|
}],
|
|
619
|
-
["
|
|
650
|
+
["input-3", {
|
|
620
651
|
subtype: "logicInput",
|
|
621
652
|
logicPinData: {
|
|
622
653
|
interface: "input",
|
|
623
|
-
index: 3
|
|
654
|
+
index: 3,
|
|
655
|
+
size: 8
|
|
624
656
|
}
|
|
625
657
|
}],
|
|
626
|
-
["
|
|
658
|
+
["input-4", {
|
|
627
659
|
subtype: "logicInput",
|
|
628
660
|
logicPinData: {
|
|
629
661
|
interface: "input",
|
|
630
|
-
index: 4
|
|
662
|
+
index: 4,
|
|
663
|
+
size: 8
|
|
631
664
|
}
|
|
632
665
|
}],
|
|
633
|
-
["
|
|
666
|
+
["input-5", {
|
|
634
667
|
subtype: "logicInput",
|
|
635
668
|
logicPinData: {
|
|
636
669
|
interface: "input",
|
|
637
|
-
index: 5
|
|
670
|
+
index: 5,
|
|
671
|
+
size: 8
|
|
638
672
|
}
|
|
639
673
|
}],
|
|
640
|
-
["
|
|
674
|
+
["input-6", {
|
|
641
675
|
subtype: "logicInput",
|
|
642
676
|
logicPinData: {
|
|
643
677
|
interface: "input",
|
|
644
|
-
index: 6
|
|
678
|
+
index: 6,
|
|
679
|
+
size: 8
|
|
645
680
|
}
|
|
646
681
|
}],
|
|
647
|
-
["
|
|
682
|
+
["input-7", {
|
|
648
683
|
subtype: "logicInput",
|
|
649
684
|
logicPinData: {
|
|
650
685
|
interface: "input",
|
|
651
|
-
index: 7
|
|
686
|
+
index: 7,
|
|
687
|
+
size: 8
|
|
652
688
|
}
|
|
653
689
|
}],
|
|
654
690
|
["output", {
|
|
655
691
|
subtype: "logicOutput",
|
|
656
692
|
logicPinData: {
|
|
657
693
|
interface: "output",
|
|
658
|
-
index: 0
|
|
694
|
+
index: 0,
|
|
695
|
+
size: 1
|
|
659
696
|
}
|
|
660
697
|
}],
|
|
661
698
|
["gnd", {
|
|
662
699
|
subtype: "gnd",
|
|
663
|
-
sourceType:
|
|
700
|
+
sourceType: h.Current
|
|
664
701
|
}]
|
|
665
702
|
]),
|
|
666
703
|
config: /* @__PURE__ */ new Map([
|
|
@@ -670,37 +707,40 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
670
707
|
["initializationOrder", ""]
|
|
671
708
|
])
|
|
672
709
|
},
|
|
673
|
-
[
|
|
674
|
-
id:
|
|
710
|
+
[c.XorGate]: {
|
|
711
|
+
id: c.XorGate,
|
|
675
712
|
pins: /* @__PURE__ */ new Map([
|
|
676
713
|
["vcc", {
|
|
677
714
|
subtype: "vcc",
|
|
678
|
-
sourceType:
|
|
715
|
+
sourceType: h.Voltage
|
|
679
716
|
}],
|
|
680
|
-
["
|
|
717
|
+
["input-0", {
|
|
681
718
|
subtype: "logicInput",
|
|
682
719
|
logicPinData: {
|
|
683
720
|
interface: "input",
|
|
684
|
-
index: 0
|
|
721
|
+
index: 0,
|
|
722
|
+
size: 2
|
|
685
723
|
}
|
|
686
724
|
}],
|
|
687
|
-
["
|
|
725
|
+
["input-1", {
|
|
688
726
|
subtype: "logicInput",
|
|
689
727
|
logicPinData: {
|
|
690
728
|
interface: "input",
|
|
691
|
-
index: 1
|
|
729
|
+
index: 1,
|
|
730
|
+
size: 2
|
|
692
731
|
}
|
|
693
732
|
}],
|
|
694
733
|
["output", {
|
|
695
734
|
subtype: "logicOutput",
|
|
696
735
|
logicPinData: {
|
|
697
736
|
interface: "output",
|
|
698
|
-
index: 0
|
|
737
|
+
index: 0,
|
|
738
|
+
size: 1
|
|
699
739
|
}
|
|
700
740
|
}],
|
|
701
741
|
["gnd", {
|
|
702
742
|
subtype: "gnd",
|
|
703
|
-
sourceType:
|
|
743
|
+
sourceType: h.Current
|
|
704
744
|
}]
|
|
705
745
|
]),
|
|
706
746
|
config: /* @__PURE__ */ new Map([
|
|
@@ -710,51 +750,56 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
710
750
|
["initializationOrder", ""]
|
|
711
751
|
])
|
|
712
752
|
},
|
|
713
|
-
[
|
|
714
|
-
id:
|
|
753
|
+
[c.Xor4Gate]: {
|
|
754
|
+
id: c.Xor4Gate,
|
|
715
755
|
pins: /* @__PURE__ */ new Map([
|
|
716
756
|
["vcc", {
|
|
717
757
|
subtype: "vcc",
|
|
718
|
-
sourceType:
|
|
758
|
+
sourceType: h.Voltage
|
|
719
759
|
}],
|
|
720
|
-
["
|
|
760
|
+
["input-0", {
|
|
721
761
|
subtype: "logicInput",
|
|
722
762
|
logicPinData: {
|
|
723
763
|
interface: "input",
|
|
724
|
-
index: 0
|
|
764
|
+
index: 0,
|
|
765
|
+
size: 4
|
|
725
766
|
}
|
|
726
767
|
}],
|
|
727
|
-
["
|
|
768
|
+
["input-1", {
|
|
728
769
|
subtype: "logicInput",
|
|
729
770
|
logicPinData: {
|
|
730
771
|
interface: "input",
|
|
731
|
-
index: 1
|
|
772
|
+
index: 1,
|
|
773
|
+
size: 4
|
|
732
774
|
}
|
|
733
775
|
}],
|
|
734
|
-
["
|
|
776
|
+
["input-2", {
|
|
735
777
|
subtype: "logicInput",
|
|
736
778
|
logicPinData: {
|
|
737
779
|
interface: "input",
|
|
738
|
-
index: 2
|
|
780
|
+
index: 2,
|
|
781
|
+
size: 4
|
|
739
782
|
}
|
|
740
783
|
}],
|
|
741
|
-
["
|
|
784
|
+
["input-3", {
|
|
742
785
|
subtype: "logicInput",
|
|
743
786
|
logicPinData: {
|
|
744
787
|
interface: "input",
|
|
745
|
-
index: 3
|
|
788
|
+
index: 3,
|
|
789
|
+
size: 4
|
|
746
790
|
}
|
|
747
791
|
}],
|
|
748
792
|
["output", {
|
|
749
793
|
subtype: "logicOutput",
|
|
750
794
|
logicPinData: {
|
|
751
795
|
interface: "output",
|
|
752
|
-
index: 0
|
|
796
|
+
index: 0,
|
|
797
|
+
size: 1
|
|
753
798
|
}
|
|
754
799
|
}],
|
|
755
800
|
["gnd", {
|
|
756
801
|
subtype: "gnd",
|
|
757
|
-
sourceType:
|
|
802
|
+
sourceType: h.Current
|
|
758
803
|
}]
|
|
759
804
|
]),
|
|
760
805
|
config: /* @__PURE__ */ new Map([
|
|
@@ -764,79 +809,88 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
764
809
|
["initializationOrder", ""]
|
|
765
810
|
])
|
|
766
811
|
},
|
|
767
|
-
[
|
|
768
|
-
id:
|
|
812
|
+
[c.Xor8Gate]: {
|
|
813
|
+
id: c.Xor8Gate,
|
|
769
814
|
pins: /* @__PURE__ */ new Map([
|
|
770
815
|
["vcc", {
|
|
771
816
|
subtype: "vcc",
|
|
772
|
-
sourceType:
|
|
817
|
+
sourceType: h.Voltage
|
|
773
818
|
}],
|
|
774
|
-
["
|
|
819
|
+
["input-0", {
|
|
775
820
|
subtype: "logicInput",
|
|
776
821
|
logicPinData: {
|
|
777
822
|
interface: "input",
|
|
778
|
-
index: 0
|
|
823
|
+
index: 0,
|
|
824
|
+
size: 8
|
|
779
825
|
}
|
|
780
826
|
}],
|
|
781
|
-
["
|
|
827
|
+
["input-1", {
|
|
782
828
|
subtype: "logicInput",
|
|
783
829
|
logicPinData: {
|
|
784
830
|
interface: "input",
|
|
785
|
-
index: 1
|
|
831
|
+
index: 1,
|
|
832
|
+
size: 8
|
|
786
833
|
}
|
|
787
834
|
}],
|
|
788
|
-
["
|
|
835
|
+
["input-2", {
|
|
789
836
|
subtype: "logicInput",
|
|
790
837
|
logicPinData: {
|
|
791
838
|
interface: "input",
|
|
792
|
-
index: 2
|
|
839
|
+
index: 2,
|
|
840
|
+
size: 8
|
|
793
841
|
}
|
|
794
842
|
}],
|
|
795
|
-
["
|
|
843
|
+
["input-3", {
|
|
796
844
|
subtype: "logicInput",
|
|
797
845
|
logicPinData: {
|
|
798
846
|
interface: "input",
|
|
799
|
-
index: 3
|
|
847
|
+
index: 3,
|
|
848
|
+
size: 8
|
|
800
849
|
}
|
|
801
850
|
}],
|
|
802
|
-
["
|
|
851
|
+
["input-4", {
|
|
803
852
|
subtype: "logicInput",
|
|
804
853
|
logicPinData: {
|
|
805
854
|
interface: "input",
|
|
806
|
-
index: 4
|
|
855
|
+
index: 4,
|
|
856
|
+
size: 8
|
|
807
857
|
}
|
|
808
858
|
}],
|
|
809
|
-
["
|
|
859
|
+
["input-5", {
|
|
810
860
|
subtype: "logicInput",
|
|
811
861
|
logicPinData: {
|
|
812
862
|
interface: "input",
|
|
813
|
-
index: 5
|
|
863
|
+
index: 5,
|
|
864
|
+
size: 8
|
|
814
865
|
}
|
|
815
866
|
}],
|
|
816
|
-
["
|
|
867
|
+
["input-6", {
|
|
817
868
|
subtype: "logicInput",
|
|
818
869
|
logicPinData: {
|
|
819
870
|
interface: "input",
|
|
820
|
-
index: 6
|
|
871
|
+
index: 6,
|
|
872
|
+
size: 8
|
|
821
873
|
}
|
|
822
874
|
}],
|
|
823
|
-
["
|
|
875
|
+
["input-7", {
|
|
824
876
|
subtype: "logicInput",
|
|
825
877
|
logicPinData: {
|
|
826
878
|
interface: "input",
|
|
827
|
-
index: 7
|
|
879
|
+
index: 7,
|
|
880
|
+
size: 8
|
|
828
881
|
}
|
|
829
882
|
}],
|
|
830
883
|
["output", {
|
|
831
884
|
subtype: "logicOutput",
|
|
832
885
|
logicPinData: {
|
|
833
886
|
interface: "output",
|
|
834
|
-
index: 0
|
|
887
|
+
index: 0,
|
|
888
|
+
size: 1
|
|
835
889
|
}
|
|
836
890
|
}],
|
|
837
891
|
["gnd", {
|
|
838
892
|
subtype: "gnd",
|
|
839
|
-
sourceType:
|
|
893
|
+
sourceType: h.Current
|
|
840
894
|
}]
|
|
841
895
|
]),
|
|
842
896
|
config: /* @__PURE__ */ new Map([
|
|
@@ -846,44 +900,48 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
846
900
|
["initializationOrder", ""]
|
|
847
901
|
])
|
|
848
902
|
},
|
|
849
|
-
[
|
|
850
|
-
id:
|
|
903
|
+
[c.HalfAdder]: {
|
|
904
|
+
id: c.HalfAdder,
|
|
851
905
|
pins: /* @__PURE__ */ new Map([
|
|
852
906
|
["vcc", {
|
|
853
907
|
subtype: "vcc",
|
|
854
|
-
sourceType:
|
|
908
|
+
sourceType: h.Voltage
|
|
855
909
|
}],
|
|
856
910
|
["inputA", {
|
|
857
911
|
subtype: "logicInput",
|
|
858
912
|
logicPinData: {
|
|
859
913
|
interface: "input",
|
|
860
|
-
index: 0
|
|
914
|
+
index: 0,
|
|
915
|
+
size: 2
|
|
861
916
|
}
|
|
862
917
|
}],
|
|
863
918
|
["inputB", {
|
|
864
919
|
subtype: "logicInput",
|
|
865
920
|
logicPinData: {
|
|
866
921
|
interface: "input",
|
|
867
|
-
index: 1
|
|
922
|
+
index: 1,
|
|
923
|
+
size: 2
|
|
868
924
|
}
|
|
869
925
|
}],
|
|
870
926
|
["sum", {
|
|
871
927
|
subtype: "logicOutput",
|
|
872
928
|
logicPinData: {
|
|
873
929
|
interface: "sum",
|
|
874
|
-
index: 0
|
|
930
|
+
index: 0,
|
|
931
|
+
size: 1
|
|
875
932
|
}
|
|
876
933
|
}],
|
|
877
934
|
["carry", {
|
|
878
935
|
subtype: "logicOutput",
|
|
879
936
|
logicPinData: {
|
|
880
937
|
interface: "carry",
|
|
881
|
-
index: 0
|
|
938
|
+
index: 0,
|
|
939
|
+
size: 1
|
|
882
940
|
}
|
|
883
941
|
}],
|
|
884
942
|
["gnd", {
|
|
885
943
|
subtype: "gnd",
|
|
886
|
-
sourceType:
|
|
944
|
+
sourceType: h.Current
|
|
887
945
|
}]
|
|
888
946
|
]),
|
|
889
947
|
config: /* @__PURE__ */ new Map([
|
|
@@ -892,51 +950,56 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
892
950
|
["initializationOrder", ""]
|
|
893
951
|
])
|
|
894
952
|
},
|
|
895
|
-
[
|
|
896
|
-
id:
|
|
953
|
+
[c.Adder]: {
|
|
954
|
+
id: c.Adder,
|
|
897
955
|
pins: /* @__PURE__ */ new Map([
|
|
898
956
|
["vcc", {
|
|
899
957
|
subtype: "vcc",
|
|
900
|
-
sourceType:
|
|
958
|
+
sourceType: h.Voltage
|
|
901
959
|
}],
|
|
902
960
|
["carryIn", {
|
|
903
961
|
subtype: "logicInput",
|
|
904
962
|
logicPinData: {
|
|
905
963
|
interface: "carryIn",
|
|
906
|
-
index: 0
|
|
964
|
+
index: 0,
|
|
965
|
+
size: 1
|
|
907
966
|
}
|
|
908
967
|
}],
|
|
909
968
|
["inputA", {
|
|
910
969
|
subtype: "logicInput",
|
|
911
970
|
logicPinData: {
|
|
912
971
|
interface: "input",
|
|
913
|
-
index: 0
|
|
972
|
+
index: 0,
|
|
973
|
+
size: 2
|
|
914
974
|
}
|
|
915
975
|
}],
|
|
916
976
|
["inputB", {
|
|
917
977
|
subtype: "logicInput",
|
|
918
978
|
logicPinData: {
|
|
919
979
|
interface: "input",
|
|
920
|
-
index: 1
|
|
980
|
+
index: 1,
|
|
981
|
+
size: 2
|
|
921
982
|
}
|
|
922
983
|
}],
|
|
923
984
|
["sum", {
|
|
924
985
|
subtype: "logicOutput",
|
|
925
986
|
logicPinData: {
|
|
926
987
|
interface: "sum",
|
|
927
|
-
index: 0
|
|
988
|
+
index: 0,
|
|
989
|
+
size: 1
|
|
928
990
|
}
|
|
929
991
|
}],
|
|
930
992
|
["carryOut", {
|
|
931
993
|
subtype: "logicOutput",
|
|
932
994
|
logicPinData: {
|
|
933
995
|
interface: "carryOut",
|
|
934
|
-
index: 0
|
|
996
|
+
index: 0,
|
|
997
|
+
size: 1
|
|
935
998
|
}
|
|
936
999
|
}],
|
|
937
1000
|
["gnd", {
|
|
938
1001
|
subtype: "gnd",
|
|
939
|
-
sourceType:
|
|
1002
|
+
sourceType: h.Current
|
|
940
1003
|
}]
|
|
941
1004
|
]),
|
|
942
1005
|
config: /* @__PURE__ */ new Map([
|
|
@@ -945,344 +1008,875 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
945
1008
|
["initializationOrder", ""]
|
|
946
1009
|
])
|
|
947
1010
|
},
|
|
948
|
-
[
|
|
949
|
-
id:
|
|
1011
|
+
[c.EightBitAdder]: {
|
|
1012
|
+
id: c.EightBitAdder,
|
|
950
1013
|
pins: /* @__PURE__ */ new Map([
|
|
951
1014
|
["vcc", {
|
|
952
1015
|
subtype: "vcc",
|
|
953
|
-
sourceType:
|
|
1016
|
+
sourceType: h.Voltage
|
|
954
1017
|
}],
|
|
955
1018
|
["carryIn", {
|
|
956
1019
|
subtype: "logicInput",
|
|
957
1020
|
logicPinData: {
|
|
958
1021
|
interface: "carryIn",
|
|
959
|
-
index: 0
|
|
1022
|
+
index: 0,
|
|
1023
|
+
size: 1
|
|
960
1024
|
}
|
|
961
1025
|
}],
|
|
962
1026
|
["inputA-0", {
|
|
963
1027
|
subtype: "logicInput",
|
|
964
1028
|
logicPinData: {
|
|
965
1029
|
interface: "inputA",
|
|
966
|
-
index: 0
|
|
1030
|
+
index: 0,
|
|
1031
|
+
size: 8
|
|
967
1032
|
}
|
|
968
1033
|
}],
|
|
969
1034
|
["inputA-1", {
|
|
970
1035
|
subtype: "logicInput",
|
|
971
1036
|
logicPinData: {
|
|
972
1037
|
interface: "inputA",
|
|
973
|
-
index: 1
|
|
1038
|
+
index: 1,
|
|
1039
|
+
size: 8
|
|
974
1040
|
}
|
|
975
1041
|
}],
|
|
976
1042
|
["inputA-2", {
|
|
977
1043
|
subtype: "logicInput",
|
|
978
1044
|
logicPinData: {
|
|
979
1045
|
interface: "inputA",
|
|
980
|
-
index: 2
|
|
1046
|
+
index: 2,
|
|
1047
|
+
size: 8
|
|
981
1048
|
}
|
|
982
1049
|
}],
|
|
983
1050
|
["inputA-3", {
|
|
984
1051
|
subtype: "logicInput",
|
|
985
1052
|
logicPinData: {
|
|
986
1053
|
interface: "inputA",
|
|
987
|
-
index: 3
|
|
1054
|
+
index: 3,
|
|
1055
|
+
size: 8
|
|
988
1056
|
}
|
|
989
1057
|
}],
|
|
990
1058
|
["inputA-4", {
|
|
991
1059
|
subtype: "logicInput",
|
|
992
1060
|
logicPinData: {
|
|
993
1061
|
interface: "inputA",
|
|
994
|
-
index: 4
|
|
1062
|
+
index: 4,
|
|
1063
|
+
size: 8
|
|
995
1064
|
}
|
|
996
1065
|
}],
|
|
997
1066
|
["inputA-5", {
|
|
998
1067
|
subtype: "logicInput",
|
|
999
1068
|
logicPinData: {
|
|
1000
1069
|
interface: "inputA",
|
|
1001
|
-
index: 5
|
|
1070
|
+
index: 5,
|
|
1071
|
+
size: 8
|
|
1002
1072
|
}
|
|
1003
1073
|
}],
|
|
1004
1074
|
["inputA-6", {
|
|
1005
1075
|
subtype: "logicInput",
|
|
1006
1076
|
logicPinData: {
|
|
1007
1077
|
interface: "inputA",
|
|
1008
|
-
index: 6
|
|
1078
|
+
index: 6,
|
|
1079
|
+
size: 8
|
|
1009
1080
|
}
|
|
1010
1081
|
}],
|
|
1011
1082
|
["inputA-7", {
|
|
1012
1083
|
subtype: "logicInput",
|
|
1013
1084
|
logicPinData: {
|
|
1014
1085
|
interface: "inputA",
|
|
1015
|
-
index: 7
|
|
1086
|
+
index: 7,
|
|
1087
|
+
size: 8
|
|
1016
1088
|
}
|
|
1017
1089
|
}],
|
|
1018
1090
|
["inputB-0", {
|
|
1019
1091
|
subtype: "logicInput",
|
|
1020
1092
|
logicPinData: {
|
|
1021
1093
|
interface: "inputB",
|
|
1022
|
-
index: 0
|
|
1094
|
+
index: 0,
|
|
1095
|
+
size: 8
|
|
1023
1096
|
}
|
|
1024
1097
|
}],
|
|
1025
1098
|
["inputB-1", {
|
|
1026
1099
|
subtype: "logicInput",
|
|
1027
1100
|
logicPinData: {
|
|
1028
1101
|
interface: "inputB",
|
|
1029
|
-
index: 1
|
|
1102
|
+
index: 1,
|
|
1103
|
+
size: 8
|
|
1030
1104
|
}
|
|
1031
1105
|
}],
|
|
1032
1106
|
["inputB-2", {
|
|
1033
1107
|
subtype: "logicInput",
|
|
1034
1108
|
logicPinData: {
|
|
1035
1109
|
interface: "inputB",
|
|
1036
|
-
index: 2
|
|
1110
|
+
index: 2,
|
|
1111
|
+
size: 8
|
|
1037
1112
|
}
|
|
1038
1113
|
}],
|
|
1039
1114
|
["inputB-3", {
|
|
1040
1115
|
subtype: "logicInput",
|
|
1041
1116
|
logicPinData: {
|
|
1042
1117
|
interface: "inputB",
|
|
1043
|
-
index: 3
|
|
1118
|
+
index: 3,
|
|
1119
|
+
size: 8
|
|
1044
1120
|
}
|
|
1045
1121
|
}],
|
|
1046
1122
|
["inputB-4", {
|
|
1047
1123
|
subtype: "logicInput",
|
|
1048
1124
|
logicPinData: {
|
|
1049
1125
|
interface: "inputB",
|
|
1050
|
-
index: 4
|
|
1126
|
+
index: 4,
|
|
1127
|
+
size: 8
|
|
1051
1128
|
}
|
|
1052
1129
|
}],
|
|
1053
1130
|
["inputB-5", {
|
|
1054
1131
|
subtype: "logicInput",
|
|
1055
1132
|
logicPinData: {
|
|
1056
1133
|
interface: "inputB",
|
|
1057
|
-
index: 5
|
|
1134
|
+
index: 5,
|
|
1135
|
+
size: 8
|
|
1058
1136
|
}
|
|
1059
1137
|
}],
|
|
1060
1138
|
["inputB-6", {
|
|
1061
1139
|
subtype: "logicInput",
|
|
1062
1140
|
logicPinData: {
|
|
1063
1141
|
interface: "inputB",
|
|
1064
|
-
index: 6
|
|
1142
|
+
index: 6,
|
|
1143
|
+
size: 8
|
|
1065
1144
|
}
|
|
1066
1145
|
}],
|
|
1067
1146
|
["inputB-7", {
|
|
1068
1147
|
subtype: "logicInput",
|
|
1069
1148
|
logicPinData: {
|
|
1070
1149
|
interface: "inputB",
|
|
1071
|
-
index: 7
|
|
1150
|
+
index: 7,
|
|
1151
|
+
size: 8
|
|
1072
1152
|
}
|
|
1073
1153
|
}],
|
|
1074
1154
|
["sum-0", {
|
|
1075
1155
|
subtype: "logicOutput",
|
|
1076
1156
|
logicPinData: {
|
|
1077
1157
|
interface: "sum",
|
|
1078
|
-
index: 0
|
|
1158
|
+
index: 0,
|
|
1159
|
+
size: 8
|
|
1079
1160
|
}
|
|
1080
1161
|
}],
|
|
1081
1162
|
["sum-1", {
|
|
1082
1163
|
subtype: "logicOutput",
|
|
1083
1164
|
logicPinData: {
|
|
1084
1165
|
interface: "sum",
|
|
1085
|
-
index: 1
|
|
1166
|
+
index: 1,
|
|
1167
|
+
size: 8
|
|
1086
1168
|
}
|
|
1087
1169
|
}],
|
|
1088
1170
|
["sum-2", {
|
|
1089
1171
|
subtype: "logicOutput",
|
|
1090
1172
|
logicPinData: {
|
|
1091
1173
|
interface: "sum",
|
|
1092
|
-
index: 2
|
|
1174
|
+
index: 2,
|
|
1175
|
+
size: 8
|
|
1093
1176
|
}
|
|
1094
1177
|
}],
|
|
1095
1178
|
["sum-3", {
|
|
1096
1179
|
subtype: "logicOutput",
|
|
1097
1180
|
logicPinData: {
|
|
1098
1181
|
interface: "sum",
|
|
1099
|
-
index: 3
|
|
1182
|
+
index: 3,
|
|
1183
|
+
size: 8
|
|
1100
1184
|
}
|
|
1101
1185
|
}],
|
|
1102
1186
|
["sum-4", {
|
|
1103
1187
|
subtype: "logicOutput",
|
|
1104
1188
|
logicPinData: {
|
|
1105
1189
|
interface: "sum",
|
|
1106
|
-
index: 4
|
|
1190
|
+
index: 4,
|
|
1191
|
+
size: 8
|
|
1107
1192
|
}
|
|
1108
1193
|
}],
|
|
1109
1194
|
["sum-5", {
|
|
1110
1195
|
subtype: "logicOutput",
|
|
1111
1196
|
logicPinData: {
|
|
1112
|
-
interface: "sum",
|
|
1113
|
-
index: 5
|
|
1197
|
+
interface: "sum",
|
|
1198
|
+
index: 5,
|
|
1199
|
+
size: 8
|
|
1200
|
+
}
|
|
1201
|
+
}],
|
|
1202
|
+
["sum-6", {
|
|
1203
|
+
subtype: "logicOutput",
|
|
1204
|
+
logicPinData: {
|
|
1205
|
+
interface: "sum",
|
|
1206
|
+
index: 6,
|
|
1207
|
+
size: 8
|
|
1208
|
+
}
|
|
1209
|
+
}],
|
|
1210
|
+
["sum-7", {
|
|
1211
|
+
subtype: "logicOutput",
|
|
1212
|
+
logicPinData: {
|
|
1213
|
+
interface: "sum",
|
|
1214
|
+
index: 7,
|
|
1215
|
+
size: 8
|
|
1216
|
+
}
|
|
1217
|
+
}],
|
|
1218
|
+
["carryOut", {
|
|
1219
|
+
subtype: "logicOutput",
|
|
1220
|
+
logicPinData: {
|
|
1221
|
+
interface: "carryOut",
|
|
1222
|
+
index: 0,
|
|
1223
|
+
size: 1
|
|
1224
|
+
}
|
|
1225
|
+
}],
|
|
1226
|
+
["gnd", {
|
|
1227
|
+
subtype: "gnd",
|
|
1228
|
+
sourceType: h.Current
|
|
1229
|
+
}]
|
|
1230
|
+
]),
|
|
1231
|
+
config: /* @__PURE__ */ new Map([
|
|
1232
|
+
["defaultLogicFamily", "CMOS1"],
|
|
1233
|
+
["transitionSpan", "4"],
|
|
1234
|
+
["initializationOrder", ""]
|
|
1235
|
+
])
|
|
1236
|
+
},
|
|
1237
|
+
[c.EightBitOnesComplement]: {
|
|
1238
|
+
id: c.EightBitOnesComplement,
|
|
1239
|
+
pins: /* @__PURE__ */ new Map([
|
|
1240
|
+
["vcc", {
|
|
1241
|
+
subtype: "vcc",
|
|
1242
|
+
sourceType: h.Voltage
|
|
1243
|
+
}],
|
|
1244
|
+
["invert", {
|
|
1245
|
+
subtype: "logicInput",
|
|
1246
|
+
logicPinData: {
|
|
1247
|
+
interface: "invert",
|
|
1248
|
+
index: 0,
|
|
1249
|
+
size: 1
|
|
1250
|
+
}
|
|
1251
|
+
}],
|
|
1252
|
+
["input-0", {
|
|
1253
|
+
subtype: "logicInput",
|
|
1254
|
+
logicPinData: {
|
|
1255
|
+
interface: "input",
|
|
1256
|
+
index: 0,
|
|
1257
|
+
size: 8
|
|
1258
|
+
}
|
|
1259
|
+
}],
|
|
1260
|
+
["input-1", {
|
|
1261
|
+
subtype: "logicInput",
|
|
1262
|
+
logicPinData: {
|
|
1263
|
+
interface: "input",
|
|
1264
|
+
index: 1,
|
|
1265
|
+
size: 8
|
|
1266
|
+
}
|
|
1267
|
+
}],
|
|
1268
|
+
["input-2", {
|
|
1269
|
+
subtype: "logicInput",
|
|
1270
|
+
logicPinData: {
|
|
1271
|
+
interface: "input",
|
|
1272
|
+
index: 2,
|
|
1273
|
+
size: 8
|
|
1274
|
+
}
|
|
1275
|
+
}],
|
|
1276
|
+
["input-3", {
|
|
1277
|
+
subtype: "logicInput",
|
|
1278
|
+
logicPinData: {
|
|
1279
|
+
interface: "input",
|
|
1280
|
+
index: 3,
|
|
1281
|
+
size: 8
|
|
1282
|
+
}
|
|
1283
|
+
}],
|
|
1284
|
+
["input-4", {
|
|
1285
|
+
subtype: "logicInput",
|
|
1286
|
+
logicPinData: {
|
|
1287
|
+
interface: "input",
|
|
1288
|
+
index: 4,
|
|
1289
|
+
size: 8
|
|
1290
|
+
}
|
|
1291
|
+
}],
|
|
1292
|
+
["input-5", {
|
|
1293
|
+
subtype: "logicInput",
|
|
1294
|
+
logicPinData: {
|
|
1295
|
+
interface: "input",
|
|
1296
|
+
index: 5,
|
|
1297
|
+
size: 8
|
|
1298
|
+
}
|
|
1299
|
+
}],
|
|
1300
|
+
["input-6", {
|
|
1301
|
+
subtype: "logicInput",
|
|
1302
|
+
logicPinData: {
|
|
1303
|
+
interface: "input",
|
|
1304
|
+
index: 6,
|
|
1305
|
+
size: 8
|
|
1306
|
+
}
|
|
1307
|
+
}],
|
|
1308
|
+
["input-7", {
|
|
1309
|
+
subtype: "logicInput",
|
|
1310
|
+
logicPinData: {
|
|
1311
|
+
interface: "input",
|
|
1312
|
+
index: 7,
|
|
1313
|
+
size: 8
|
|
1314
|
+
}
|
|
1315
|
+
}],
|
|
1316
|
+
["output-0", {
|
|
1317
|
+
subtype: "logicOutput",
|
|
1318
|
+
logicPinData: {
|
|
1319
|
+
interface: "output",
|
|
1320
|
+
index: 0,
|
|
1321
|
+
size: 8
|
|
1322
|
+
}
|
|
1323
|
+
}],
|
|
1324
|
+
["output-1", {
|
|
1325
|
+
subtype: "logicOutput",
|
|
1326
|
+
logicPinData: {
|
|
1327
|
+
interface: "output",
|
|
1328
|
+
index: 1,
|
|
1329
|
+
size: 8
|
|
1330
|
+
}
|
|
1331
|
+
}],
|
|
1332
|
+
["output-2", {
|
|
1333
|
+
subtype: "logicOutput",
|
|
1334
|
+
logicPinData: {
|
|
1335
|
+
interface: "output",
|
|
1336
|
+
index: 2,
|
|
1337
|
+
size: 8
|
|
1338
|
+
}
|
|
1339
|
+
}],
|
|
1340
|
+
["output-3", {
|
|
1341
|
+
subtype: "logicOutput",
|
|
1342
|
+
logicPinData: {
|
|
1343
|
+
interface: "output",
|
|
1344
|
+
index: 3,
|
|
1345
|
+
size: 8
|
|
1346
|
+
}
|
|
1347
|
+
}],
|
|
1348
|
+
["output-4", {
|
|
1349
|
+
subtype: "logicOutput",
|
|
1350
|
+
logicPinData: {
|
|
1351
|
+
interface: "output",
|
|
1352
|
+
index: 4,
|
|
1353
|
+
size: 8
|
|
1354
|
+
}
|
|
1355
|
+
}],
|
|
1356
|
+
["output-5", {
|
|
1357
|
+
subtype: "logicOutput",
|
|
1358
|
+
logicPinData: {
|
|
1359
|
+
interface: "output",
|
|
1360
|
+
index: 5,
|
|
1361
|
+
size: 8
|
|
1362
|
+
}
|
|
1363
|
+
}],
|
|
1364
|
+
["output-6", {
|
|
1365
|
+
subtype: "logicOutput",
|
|
1366
|
+
logicPinData: {
|
|
1367
|
+
interface: "output",
|
|
1368
|
+
index: 6,
|
|
1369
|
+
size: 8
|
|
1370
|
+
}
|
|
1371
|
+
}],
|
|
1372
|
+
["output-7", {
|
|
1373
|
+
subtype: "logicOutput",
|
|
1374
|
+
logicPinData: {
|
|
1375
|
+
interface: "output",
|
|
1376
|
+
index: 7,
|
|
1377
|
+
size: 8
|
|
1378
|
+
}
|
|
1379
|
+
}],
|
|
1380
|
+
["gnd", {
|
|
1381
|
+
subtype: "gnd",
|
|
1382
|
+
sourceType: h.Current
|
|
1383
|
+
}]
|
|
1384
|
+
]),
|
|
1385
|
+
config: /* @__PURE__ */ new Map([
|
|
1386
|
+
["defaultLogicFamily", "CMOS1"],
|
|
1387
|
+
["transitionSpan", "3"],
|
|
1388
|
+
["initializationOrder", ""]
|
|
1389
|
+
])
|
|
1390
|
+
},
|
|
1391
|
+
[c.OneInput]: {
|
|
1392
|
+
id: c.OneInput,
|
|
1393
|
+
pins: /* @__PURE__ */ new Map([
|
|
1394
|
+
["vcc", {
|
|
1395
|
+
subtype: "vcc",
|
|
1396
|
+
sourceType: h.Voltage
|
|
1397
|
+
}],
|
|
1398
|
+
["output-0", {
|
|
1399
|
+
subtype: "logicOutput",
|
|
1400
|
+
logicPinData: {
|
|
1401
|
+
interface: "output",
|
|
1402
|
+
index: 0,
|
|
1403
|
+
size: 1
|
|
1404
|
+
}
|
|
1405
|
+
}],
|
|
1406
|
+
["gnd", {
|
|
1407
|
+
subtype: "gnd",
|
|
1408
|
+
sourceType: h.Current
|
|
1409
|
+
}]
|
|
1410
|
+
]),
|
|
1411
|
+
config: /* @__PURE__ */ new Map([
|
|
1412
|
+
["initialState", "0"],
|
|
1413
|
+
["transitionSpan", "1"],
|
|
1414
|
+
["size", "1"]
|
|
1415
|
+
])
|
|
1416
|
+
},
|
|
1417
|
+
[c.TwoInput]: {
|
|
1418
|
+
id: c.TwoInput,
|
|
1419
|
+
pins: /* @__PURE__ */ new Map([
|
|
1420
|
+
["vcc", {
|
|
1421
|
+
subtype: "vcc",
|
|
1422
|
+
sourceType: h.Voltage
|
|
1423
|
+
}],
|
|
1424
|
+
["output-0", {
|
|
1425
|
+
subtype: "logicOutput",
|
|
1426
|
+
logicPinData: {
|
|
1427
|
+
interface: "output",
|
|
1428
|
+
index: 0,
|
|
1429
|
+
size: 2
|
|
1430
|
+
}
|
|
1431
|
+
}],
|
|
1432
|
+
["output-1", {
|
|
1433
|
+
subtype: "logicOutput",
|
|
1434
|
+
logicPinData: {
|
|
1435
|
+
interface: "output",
|
|
1436
|
+
index: 1,
|
|
1437
|
+
size: 2
|
|
1438
|
+
}
|
|
1439
|
+
}],
|
|
1440
|
+
["gnd", {
|
|
1441
|
+
subtype: "gnd",
|
|
1442
|
+
sourceType: h.Current
|
|
1443
|
+
}]
|
|
1444
|
+
]),
|
|
1445
|
+
config: /* @__PURE__ */ new Map([
|
|
1446
|
+
["initialState", "0"],
|
|
1447
|
+
["transitionSpan", "1"],
|
|
1448
|
+
["size", "1"]
|
|
1449
|
+
])
|
|
1450
|
+
},
|
|
1451
|
+
[c.FourInput]: {
|
|
1452
|
+
id: c.FourInput,
|
|
1453
|
+
pins: /* @__PURE__ */ new Map([
|
|
1454
|
+
["vcc", {
|
|
1455
|
+
subtype: "vcc",
|
|
1456
|
+
sourceType: h.Voltage
|
|
1457
|
+
}],
|
|
1458
|
+
["output-0", {
|
|
1459
|
+
subtype: "logicOutput",
|
|
1460
|
+
logicPinData: {
|
|
1461
|
+
interface: "output",
|
|
1462
|
+
index: 0,
|
|
1463
|
+
size: 4
|
|
1464
|
+
}
|
|
1465
|
+
}],
|
|
1466
|
+
["output-1", {
|
|
1467
|
+
subtype: "logicOutput",
|
|
1468
|
+
logicPinData: {
|
|
1469
|
+
interface: "output",
|
|
1470
|
+
index: 1,
|
|
1471
|
+
size: 4
|
|
1472
|
+
}
|
|
1473
|
+
}],
|
|
1474
|
+
["output-2", {
|
|
1475
|
+
subtype: "logicOutput",
|
|
1476
|
+
logicPinData: {
|
|
1477
|
+
interface: "output",
|
|
1478
|
+
index: 2,
|
|
1479
|
+
size: 4
|
|
1480
|
+
}
|
|
1481
|
+
}],
|
|
1482
|
+
["output-3", {
|
|
1483
|
+
subtype: "logicOutput",
|
|
1484
|
+
logicPinData: {
|
|
1485
|
+
interface: "output",
|
|
1486
|
+
index: 3,
|
|
1487
|
+
size: 4
|
|
1488
|
+
}
|
|
1489
|
+
}],
|
|
1490
|
+
["gnd", {
|
|
1491
|
+
subtype: "gnd",
|
|
1492
|
+
sourceType: h.Current
|
|
1493
|
+
}]
|
|
1494
|
+
]),
|
|
1495
|
+
config: /* @__PURE__ */ new Map([
|
|
1496
|
+
["initialState", "0"],
|
|
1497
|
+
["transitionSpan", "1"],
|
|
1498
|
+
["size", "1"]
|
|
1499
|
+
])
|
|
1500
|
+
},
|
|
1501
|
+
[c.EightInput]: {
|
|
1502
|
+
id: c.EightInput,
|
|
1503
|
+
pins: /* @__PURE__ */ new Map([
|
|
1504
|
+
["vcc", {
|
|
1505
|
+
subtype: "vcc",
|
|
1506
|
+
sourceType: h.Voltage
|
|
1507
|
+
}],
|
|
1508
|
+
["output-0", {
|
|
1509
|
+
subtype: "logicOutput",
|
|
1510
|
+
logicPinData: {
|
|
1511
|
+
interface: "output",
|
|
1512
|
+
index: 0,
|
|
1513
|
+
size: 8
|
|
1514
|
+
}
|
|
1515
|
+
}],
|
|
1516
|
+
["output-1", {
|
|
1517
|
+
subtype: "logicOutput",
|
|
1518
|
+
logicPinData: {
|
|
1519
|
+
interface: "output",
|
|
1520
|
+
index: 1,
|
|
1521
|
+
size: 8
|
|
1522
|
+
}
|
|
1523
|
+
}],
|
|
1524
|
+
["output-2", {
|
|
1525
|
+
subtype: "logicOutput",
|
|
1526
|
+
logicPinData: {
|
|
1527
|
+
interface: "output",
|
|
1528
|
+
index: 2,
|
|
1529
|
+
size: 8
|
|
1530
|
+
}
|
|
1531
|
+
}],
|
|
1532
|
+
["output-3", {
|
|
1533
|
+
subtype: "logicOutput",
|
|
1534
|
+
logicPinData: {
|
|
1535
|
+
interface: "output",
|
|
1536
|
+
index: 3,
|
|
1537
|
+
size: 8
|
|
1538
|
+
}
|
|
1539
|
+
}],
|
|
1540
|
+
["output-4", {
|
|
1541
|
+
subtype: "logicOutput",
|
|
1542
|
+
logicPinData: {
|
|
1543
|
+
interface: "output",
|
|
1544
|
+
index: 4,
|
|
1545
|
+
size: 8
|
|
1546
|
+
}
|
|
1547
|
+
}],
|
|
1548
|
+
["output-5", {
|
|
1549
|
+
subtype: "logicOutput",
|
|
1550
|
+
logicPinData: {
|
|
1551
|
+
interface: "output",
|
|
1552
|
+
index: 5,
|
|
1553
|
+
size: 8
|
|
1554
|
+
}
|
|
1555
|
+
}],
|
|
1556
|
+
["output-6", {
|
|
1557
|
+
subtype: "logicOutput",
|
|
1558
|
+
logicPinData: {
|
|
1559
|
+
interface: "output",
|
|
1560
|
+
index: 6,
|
|
1561
|
+
size: 8
|
|
1562
|
+
}
|
|
1563
|
+
}],
|
|
1564
|
+
["output-7", {
|
|
1565
|
+
subtype: "logicOutput",
|
|
1566
|
+
logicPinData: {
|
|
1567
|
+
interface: "output",
|
|
1568
|
+
index: 7,
|
|
1569
|
+
size: 8
|
|
1570
|
+
}
|
|
1571
|
+
}],
|
|
1572
|
+
["gnd", {
|
|
1573
|
+
subtype: "gnd",
|
|
1574
|
+
sourceType: h.Current
|
|
1575
|
+
}]
|
|
1576
|
+
]),
|
|
1577
|
+
config: /* @__PURE__ */ new Map([
|
|
1578
|
+
["initialState", "00"],
|
|
1579
|
+
["transitionSpan", "1"],
|
|
1580
|
+
["size", "1"]
|
|
1581
|
+
])
|
|
1582
|
+
},
|
|
1583
|
+
[c.OneLight]: {
|
|
1584
|
+
id: c.OneLight,
|
|
1585
|
+
pins: /* @__PURE__ */ new Map([
|
|
1586
|
+
["vcc", {
|
|
1587
|
+
subtype: "vcc",
|
|
1588
|
+
sourceType: h.Voltage
|
|
1589
|
+
}],
|
|
1590
|
+
["input-0", {
|
|
1591
|
+
subtype: "logicInput",
|
|
1592
|
+
logicPinData: {
|
|
1593
|
+
interface: "input",
|
|
1594
|
+
index: 0,
|
|
1595
|
+
size: 1
|
|
1596
|
+
}
|
|
1597
|
+
}],
|
|
1598
|
+
["output-0", {
|
|
1599
|
+
subtype: "logicOutput",
|
|
1600
|
+
logicPinData: {
|
|
1601
|
+
interface: "output",
|
|
1602
|
+
index: 0,
|
|
1603
|
+
size: 1
|
|
1604
|
+
}
|
|
1605
|
+
}],
|
|
1606
|
+
["gnd", {
|
|
1607
|
+
subtype: "gnd",
|
|
1608
|
+
sourceType: h.Current
|
|
1609
|
+
}]
|
|
1610
|
+
]),
|
|
1611
|
+
config: /* @__PURE__ */ new Map([["transitionSpan", "2"], ["size", "1"]])
|
|
1612
|
+
},
|
|
1613
|
+
[c.TwoLight]: {
|
|
1614
|
+
id: c.TwoLight,
|
|
1615
|
+
pins: /* @__PURE__ */ new Map([
|
|
1616
|
+
["vcc", {
|
|
1617
|
+
subtype: "vcc",
|
|
1618
|
+
sourceType: h.Voltage
|
|
1619
|
+
}],
|
|
1620
|
+
["input-0", {
|
|
1621
|
+
subtype: "logicInput",
|
|
1622
|
+
logicPinData: {
|
|
1623
|
+
interface: "input",
|
|
1624
|
+
index: 0,
|
|
1625
|
+
size: 2
|
|
1626
|
+
}
|
|
1627
|
+
}],
|
|
1628
|
+
["input-1", {
|
|
1629
|
+
subtype: "logicInput",
|
|
1630
|
+
logicPinData: {
|
|
1631
|
+
interface: "input",
|
|
1632
|
+
index: 1,
|
|
1633
|
+
size: 2
|
|
1634
|
+
}
|
|
1635
|
+
}],
|
|
1636
|
+
["output-0", {
|
|
1637
|
+
subtype: "logicOutput",
|
|
1638
|
+
logicPinData: {
|
|
1639
|
+
interface: "output",
|
|
1640
|
+
index: 0,
|
|
1641
|
+
size: 2
|
|
1642
|
+
}
|
|
1643
|
+
}],
|
|
1644
|
+
["output-1", {
|
|
1645
|
+
subtype: "logicOutput",
|
|
1646
|
+
logicPinData: {
|
|
1647
|
+
interface: "output",
|
|
1648
|
+
index: 1,
|
|
1649
|
+
size: 2
|
|
1650
|
+
}
|
|
1651
|
+
}],
|
|
1652
|
+
["gnd", {
|
|
1653
|
+
subtype: "gnd",
|
|
1654
|
+
sourceType: h.Current
|
|
1655
|
+
}]
|
|
1656
|
+
]),
|
|
1657
|
+
config: /* @__PURE__ */ new Map([["transitionSpan", "2"], ["size", "1"]])
|
|
1658
|
+
},
|
|
1659
|
+
[c.FourLight]: {
|
|
1660
|
+
id: c.FourLight,
|
|
1661
|
+
pins: /* @__PURE__ */ new Map([
|
|
1662
|
+
["vcc", {
|
|
1663
|
+
subtype: "vcc",
|
|
1664
|
+
sourceType: h.Voltage
|
|
1665
|
+
}],
|
|
1666
|
+
["input-0", {
|
|
1667
|
+
subtype: "logicInput",
|
|
1668
|
+
logicPinData: {
|
|
1669
|
+
interface: "input",
|
|
1670
|
+
index: 0,
|
|
1671
|
+
size: 4
|
|
1672
|
+
}
|
|
1673
|
+
}],
|
|
1674
|
+
["input-1", {
|
|
1675
|
+
subtype: "logicInput",
|
|
1676
|
+
logicPinData: {
|
|
1677
|
+
interface: "input",
|
|
1678
|
+
index: 1,
|
|
1679
|
+
size: 4
|
|
1680
|
+
}
|
|
1681
|
+
}],
|
|
1682
|
+
["input-2", {
|
|
1683
|
+
subtype: "logicInput",
|
|
1684
|
+
logicPinData: {
|
|
1685
|
+
interface: "input",
|
|
1686
|
+
index: 2,
|
|
1687
|
+
size: 4
|
|
1688
|
+
}
|
|
1689
|
+
}],
|
|
1690
|
+
["input-3", {
|
|
1691
|
+
subtype: "logicInput",
|
|
1692
|
+
logicPinData: {
|
|
1693
|
+
interface: "input",
|
|
1694
|
+
index: 3,
|
|
1695
|
+
size: 4
|
|
1696
|
+
}
|
|
1697
|
+
}],
|
|
1698
|
+
["output-0", {
|
|
1699
|
+
subtype: "logicOutput",
|
|
1700
|
+
logicPinData: {
|
|
1701
|
+
interface: "output",
|
|
1702
|
+
index: 0,
|
|
1703
|
+
size: 4
|
|
1114
1704
|
}
|
|
1115
1705
|
}],
|
|
1116
|
-
["
|
|
1706
|
+
["output-1", {
|
|
1117
1707
|
subtype: "logicOutput",
|
|
1118
1708
|
logicPinData: {
|
|
1119
|
-
interface: "
|
|
1120
|
-
index:
|
|
1709
|
+
interface: "output",
|
|
1710
|
+
index: 1,
|
|
1711
|
+
size: 4
|
|
1121
1712
|
}
|
|
1122
1713
|
}],
|
|
1123
|
-
["
|
|
1714
|
+
["output-2", {
|
|
1124
1715
|
subtype: "logicOutput",
|
|
1125
1716
|
logicPinData: {
|
|
1126
|
-
interface: "
|
|
1127
|
-
index:
|
|
1717
|
+
interface: "output",
|
|
1718
|
+
index: 2,
|
|
1719
|
+
size: 4
|
|
1128
1720
|
}
|
|
1129
1721
|
}],
|
|
1130
|
-
["
|
|
1722
|
+
["output-3", {
|
|
1131
1723
|
subtype: "logicOutput",
|
|
1132
1724
|
logicPinData: {
|
|
1133
|
-
interface: "
|
|
1134
|
-
index:
|
|
1725
|
+
interface: "output",
|
|
1726
|
+
index: 3,
|
|
1727
|
+
size: 4
|
|
1135
1728
|
}
|
|
1136
1729
|
}],
|
|
1137
1730
|
["gnd", {
|
|
1138
1731
|
subtype: "gnd",
|
|
1139
|
-
sourceType:
|
|
1732
|
+
sourceType: h.Current
|
|
1140
1733
|
}]
|
|
1141
1734
|
]),
|
|
1142
|
-
config: /* @__PURE__ */ new Map([
|
|
1143
|
-
["defaultLogicFamily", "CMOS1"],
|
|
1144
|
-
["transitionSpan", "4"],
|
|
1145
|
-
["initializationOrder", ""]
|
|
1146
|
-
])
|
|
1735
|
+
config: /* @__PURE__ */ new Map([["transitionSpan", "2"], ["size", "1"]])
|
|
1147
1736
|
},
|
|
1148
|
-
[
|
|
1149
|
-
id:
|
|
1737
|
+
[c.EightLight]: {
|
|
1738
|
+
id: c.EightLight,
|
|
1150
1739
|
pins: /* @__PURE__ */ new Map([
|
|
1151
1740
|
["vcc", {
|
|
1152
1741
|
subtype: "vcc",
|
|
1153
|
-
sourceType:
|
|
1154
|
-
}],
|
|
1155
|
-
["invert", {
|
|
1156
|
-
subtype: "logicInput",
|
|
1157
|
-
logicPinData: {
|
|
1158
|
-
interface: "invert",
|
|
1159
|
-
index: 0
|
|
1160
|
-
}
|
|
1742
|
+
sourceType: h.Voltage
|
|
1161
1743
|
}],
|
|
1162
1744
|
["input-0", {
|
|
1163
1745
|
subtype: "logicInput",
|
|
1164
1746
|
logicPinData: {
|
|
1165
1747
|
interface: "input",
|
|
1166
|
-
index: 0
|
|
1748
|
+
index: 0,
|
|
1749
|
+
size: 8
|
|
1167
1750
|
}
|
|
1168
1751
|
}],
|
|
1169
1752
|
["input-1", {
|
|
1170
1753
|
subtype: "logicInput",
|
|
1171
1754
|
logicPinData: {
|
|
1172
1755
|
interface: "input",
|
|
1173
|
-
index: 1
|
|
1756
|
+
index: 1,
|
|
1757
|
+
size: 8
|
|
1174
1758
|
}
|
|
1175
1759
|
}],
|
|
1176
1760
|
["input-2", {
|
|
1177
1761
|
subtype: "logicInput",
|
|
1178
1762
|
logicPinData: {
|
|
1179
1763
|
interface: "input",
|
|
1180
|
-
index: 2
|
|
1764
|
+
index: 2,
|
|
1765
|
+
size: 8
|
|
1181
1766
|
}
|
|
1182
1767
|
}],
|
|
1183
1768
|
["input-3", {
|
|
1184
1769
|
subtype: "logicInput",
|
|
1185
1770
|
logicPinData: {
|
|
1186
1771
|
interface: "input",
|
|
1187
|
-
index: 3
|
|
1772
|
+
index: 3,
|
|
1773
|
+
size: 8
|
|
1188
1774
|
}
|
|
1189
1775
|
}],
|
|
1190
1776
|
["input-4", {
|
|
1191
1777
|
subtype: "logicInput",
|
|
1192
1778
|
logicPinData: {
|
|
1193
1779
|
interface: "input",
|
|
1194
|
-
index: 4
|
|
1780
|
+
index: 4,
|
|
1781
|
+
size: 8
|
|
1195
1782
|
}
|
|
1196
1783
|
}],
|
|
1197
1784
|
["input-5", {
|
|
1198
1785
|
subtype: "logicInput",
|
|
1199
1786
|
logicPinData: {
|
|
1200
1787
|
interface: "input",
|
|
1201
|
-
index: 5
|
|
1788
|
+
index: 5,
|
|
1789
|
+
size: 8
|
|
1202
1790
|
}
|
|
1203
1791
|
}],
|
|
1204
1792
|
["input-6", {
|
|
1205
1793
|
subtype: "logicInput",
|
|
1206
1794
|
logicPinData: {
|
|
1207
1795
|
interface: "input",
|
|
1208
|
-
index: 6
|
|
1796
|
+
index: 6,
|
|
1797
|
+
size: 8
|
|
1209
1798
|
}
|
|
1210
1799
|
}],
|
|
1211
1800
|
["input-7", {
|
|
1212
1801
|
subtype: "logicInput",
|
|
1213
1802
|
logicPinData: {
|
|
1214
1803
|
interface: "input",
|
|
1215
|
-
index: 7
|
|
1804
|
+
index: 7,
|
|
1805
|
+
size: 8
|
|
1216
1806
|
}
|
|
1217
1807
|
}],
|
|
1218
1808
|
["output-0", {
|
|
1219
1809
|
subtype: "logicOutput",
|
|
1220
1810
|
logicPinData: {
|
|
1221
1811
|
interface: "output",
|
|
1222
|
-
index: 0
|
|
1812
|
+
index: 0,
|
|
1813
|
+
size: 8
|
|
1223
1814
|
}
|
|
1224
1815
|
}],
|
|
1225
1816
|
["output-1", {
|
|
1226
1817
|
subtype: "logicOutput",
|
|
1227
1818
|
logicPinData: {
|
|
1228
1819
|
interface: "output",
|
|
1229
|
-
index: 1
|
|
1820
|
+
index: 1,
|
|
1821
|
+
size: 8
|
|
1230
1822
|
}
|
|
1231
1823
|
}],
|
|
1232
1824
|
["output-2", {
|
|
1233
1825
|
subtype: "logicOutput",
|
|
1234
1826
|
logicPinData: {
|
|
1235
1827
|
interface: "output",
|
|
1236
|
-
index: 2
|
|
1828
|
+
index: 2,
|
|
1829
|
+
size: 8
|
|
1237
1830
|
}
|
|
1238
1831
|
}],
|
|
1239
1832
|
["output-3", {
|
|
1240
1833
|
subtype: "logicOutput",
|
|
1241
1834
|
logicPinData: {
|
|
1242
1835
|
interface: "output",
|
|
1243
|
-
index: 3
|
|
1836
|
+
index: 3,
|
|
1837
|
+
size: 8
|
|
1244
1838
|
}
|
|
1245
1839
|
}],
|
|
1246
1840
|
["output-4", {
|
|
1247
1841
|
subtype: "logicOutput",
|
|
1248
1842
|
logicPinData: {
|
|
1249
1843
|
interface: "output",
|
|
1250
|
-
index: 4
|
|
1844
|
+
index: 4,
|
|
1845
|
+
size: 8
|
|
1251
1846
|
}
|
|
1252
1847
|
}],
|
|
1253
1848
|
["output-5", {
|
|
1254
1849
|
subtype: "logicOutput",
|
|
1255
1850
|
logicPinData: {
|
|
1256
1851
|
interface: "output",
|
|
1257
|
-
index: 5
|
|
1852
|
+
index: 5,
|
|
1853
|
+
size: 8
|
|
1258
1854
|
}
|
|
1259
1855
|
}],
|
|
1260
1856
|
["output-6", {
|
|
1261
1857
|
subtype: "logicOutput",
|
|
1262
1858
|
logicPinData: {
|
|
1263
1859
|
interface: "output",
|
|
1264
|
-
index: 6
|
|
1860
|
+
index: 6,
|
|
1861
|
+
size: 8
|
|
1265
1862
|
}
|
|
1266
1863
|
}],
|
|
1267
1864
|
["output-7", {
|
|
1268
1865
|
subtype: "logicOutput",
|
|
1269
1866
|
logicPinData: {
|
|
1270
1867
|
interface: "output",
|
|
1271
|
-
index: 7
|
|
1868
|
+
index: 7,
|
|
1869
|
+
size: 8
|
|
1272
1870
|
}
|
|
1273
1871
|
}],
|
|
1274
1872
|
["gnd", {
|
|
1275
1873
|
subtype: "gnd",
|
|
1276
|
-
sourceType:
|
|
1874
|
+
sourceType: h.Current
|
|
1277
1875
|
}]
|
|
1278
1876
|
]),
|
|
1279
|
-
config: /* @__PURE__ */ new Map([
|
|
1280
|
-
["defaultLogicFamily", "CMOS1"],
|
|
1281
|
-
["transitionSpan", "3"],
|
|
1282
|
-
["initializationOrder", ""]
|
|
1283
|
-
])
|
|
1877
|
+
config: /* @__PURE__ */ new Map([["transitionSpan", "2"], ["size", "1"]])
|
|
1284
1878
|
}
|
|
1285
|
-
},
|
|
1879
|
+
}, $ = class at {
|
|
1286
1880
|
id;
|
|
1287
1881
|
type;
|
|
1288
1882
|
component;
|
|
@@ -1291,11 +1885,12 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1291
1885
|
wires;
|
|
1292
1886
|
source;
|
|
1293
1887
|
subtype;
|
|
1294
|
-
|
|
1295
|
-
|
|
1888
|
+
logicMetadata;
|
|
1889
|
+
constructor(t, n, i, s, r = void 0, a = "free", o) {
|
|
1890
|
+
this.id = J(), this.type = t, this.component = n, this.pinLabel = i, this.position = s, this.wires = /* @__PURE__ */ new Set(), this.source = r, this.subtype = a, this.logicMetadata = o;
|
|
1296
1891
|
}
|
|
1297
1892
|
getPosition(t) {
|
|
1298
|
-
if (this.type ===
|
|
1893
|
+
if (this.type === w.Pin) {
|
|
1299
1894
|
if (!this.component) throw new Error("Pin node missing component reference");
|
|
1300
1895
|
const n = t.getComponent(this.component);
|
|
1301
1896
|
if (!n) throw new Error(`Component ${this.component} not found for pin node ${this.id}`);
|
|
@@ -1325,12 +1920,13 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1325
1920
|
id: this.id,
|
|
1326
1921
|
type: this.type,
|
|
1327
1922
|
source: this.source || null,
|
|
1328
|
-
subtype: this.subtype
|
|
1923
|
+
subtype: this.subtype,
|
|
1924
|
+
logicMetadata: this.logicMetadata || null
|
|
1329
1925
|
};
|
|
1330
|
-
return this.type ===
|
|
1926
|
+
return this.type === w.Pin ? (t.component = this.component || null, t.pinLabel = this.pinLabel || null) : t.position = this.position?.toJSON() || null, t;
|
|
1331
1927
|
}
|
|
1332
1928
|
static fromJSON(t) {
|
|
1333
|
-
const n = t.position ?
|
|
1929
|
+
const n = t.position ? H.fromJSON(t.position) : void 0, i = new at(t.type, t.component || void 0, t.pinLabel || void 0, n, t.source || void 0, t.subtype ?? "free", t.logicMetadata || void 0);
|
|
1334
1930
|
return Object.defineProperty(i, "id", {
|
|
1335
1931
|
value: t.id,
|
|
1336
1932
|
writable: !1,
|
|
@@ -1338,13 +1934,13 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1338
1934
|
configurable: !1
|
|
1339
1935
|
}), i;
|
|
1340
1936
|
}
|
|
1341
|
-
},
|
|
1937
|
+
}, N = class ot {
|
|
1342
1938
|
id;
|
|
1343
1939
|
node1;
|
|
1344
1940
|
node2;
|
|
1345
1941
|
intermediatePositions;
|
|
1346
1942
|
constructor(t, n, i = []) {
|
|
1347
|
-
this.id =
|
|
1943
|
+
this.id = J(), this.node1 = t, this.node2 = n, this.intermediatePositions = i;
|
|
1348
1944
|
}
|
|
1349
1945
|
isStraightLine() {
|
|
1350
1946
|
return this.intermediatePositions.length === 0;
|
|
@@ -1358,7 +1954,7 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1358
1954
|
};
|
|
1359
1955
|
}
|
|
1360
1956
|
static fromJSON(t) {
|
|
1361
|
-
const n = t.intermediatePositions.map((s) =>
|
|
1957
|
+
const n = t.intermediatePositions.map((s) => H.fromJSON(s)), i = new ot(t.node1, t.node2, n);
|
|
1362
1958
|
return Object.defineProperty(i, "id", {
|
|
1363
1959
|
value: t.id,
|
|
1364
1960
|
writable: !1,
|
|
@@ -1366,7 +1962,7 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1366
1962
|
configurable: !1
|
|
1367
1963
|
}), i;
|
|
1368
1964
|
}
|
|
1369
|
-
},
|
|
1965
|
+
}, Q = class ut {
|
|
1370
1966
|
id;
|
|
1371
1967
|
type;
|
|
1372
1968
|
position;
|
|
@@ -1375,8 +1971,8 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1375
1971
|
config;
|
|
1376
1972
|
editable;
|
|
1377
1973
|
constructor(t, n, i, s, r = !0) {
|
|
1378
|
-
if (this.id =
|
|
1379
|
-
const a = s.filter((o,
|
|
1974
|
+
if (this.id = J(), this.type = t, this.position = n, this.rotation = i, new Set(s).size !== s.length) {
|
|
1975
|
+
const a = s.filter((o, u) => s.indexOf(o) !== u);
|
|
1380
1976
|
throw new Error(`Duplicate pin names are not allowed: ${[...new Set(a)].join(", ")}`);
|
|
1381
1977
|
}
|
|
1382
1978
|
this.pins = s, this.config = new Map(I[t].config), this.editable = r;
|
|
@@ -1392,6 +1988,22 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1392
1988
|
if (n)
|
|
1393
1989
|
return I[this.type].pins.get(n);
|
|
1394
1990
|
}
|
|
1991
|
+
getPinIdByInterface(t, n) {
|
|
1992
|
+
let i = 0;
|
|
1993
|
+
for (const s of I[this.type].pins.values()) {
|
|
1994
|
+
const r = s.logicPinData;
|
|
1995
|
+
if (r && r.interface === t && r.index === n) return this.pins[i];
|
|
1996
|
+
i++;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
getInterfaceMaxIndex(t) {
|
|
2000
|
+
let n = -1;
|
|
2001
|
+
for (const i of I[this.type].pins.values()) {
|
|
2002
|
+
const s = i.logicPinData;
|
|
2003
|
+
s?.interface === t && s.index > n && (n = s.index);
|
|
2004
|
+
}
|
|
2005
|
+
return n;
|
|
2006
|
+
}
|
|
1395
2007
|
setAllParameters(t) {
|
|
1396
2008
|
this.config = new Map(t);
|
|
1397
2009
|
}
|
|
@@ -1426,7 +2038,7 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1426
2038
|
};
|
|
1427
2039
|
}
|
|
1428
2040
|
static fromJSON(t) {
|
|
1429
|
-
const n = new
|
|
2041
|
+
const n = new ut(t.type, H.fromJSON(t.position), mt.fromJSON(t.rotation), t.pins, t.editable);
|
|
1430
2042
|
return n.config = new Map(Object.entries(t.config)), Object.defineProperty(n, "id", {
|
|
1431
2043
|
value: t.id,
|
|
1432
2044
|
writable: !1,
|
|
@@ -1434,8 +2046,8 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1434
2046
|
configurable: !1
|
|
1435
2047
|
}), n;
|
|
1436
2048
|
}
|
|
1437
|
-
},
|
|
1438
|
-
constructor(t = "Untitled Circuit", n =
|
|
2049
|
+
}, q = class ct {
|
|
2050
|
+
constructor(t = "Untitled Circuit", n = rt) {
|
|
1439
2051
|
this.name = t, this.defaultLogicFamily = n;
|
|
1440
2052
|
}
|
|
1441
2053
|
toJSON() {
|
|
@@ -1445,9 +2057,9 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1445
2057
|
};
|
|
1446
2058
|
}
|
|
1447
2059
|
static fromJSON(t) {
|
|
1448
|
-
return new
|
|
2060
|
+
return new ct(t.name, t.defaultLogicFamily);
|
|
1449
2061
|
}
|
|
1450
|
-
},
|
|
2062
|
+
}, K = class pt {
|
|
1451
2063
|
constructor(t, n, i, s, r) {
|
|
1452
2064
|
if (this.version = t, this.options = n, this.size = i, this.divisions = s, this.cameraOptions = r, !Number.isInteger(i) || !Number.isInteger(s)) throw new TypeError(`Size and divisions must be integers (got size=${i}, divisions=${s})`);
|
|
1453
2065
|
}
|
|
@@ -1461,104 +2073,104 @@ var Z = "0.0.11", g = /* @__PURE__ */ (function(e) {
|
|
|
1461
2073
|
};
|
|
1462
2074
|
}
|
|
1463
2075
|
static fromJSON(t) {
|
|
1464
|
-
t.version !== "0.0.
|
|
2076
|
+
t.version !== "0.0.14" && console.warn(`This version of the engine supports v${st} circuit version files.
|
|
1465
2077
|
Unexpected behavior may occurs loading v${t.version}.`);
|
|
1466
|
-
const n = t.options ?
|
|
1467
|
-
return new
|
|
2078
|
+
const n = t.options ? q.fromJSON(t.options) : new q("Untitled Circuit", rt);
|
|
2079
|
+
return new pt(t.version, n, t.size, t.divisions, tt.fromJSON(t.cameraOptions));
|
|
1468
2080
|
}
|
|
1469
2081
|
toString() {
|
|
1470
2082
|
return `CircuitMetadata(${this.version}, ${this.options.name}, ${this.options.defaultLogicFamily}, ${this.size}, ${this.divisions}, ${this.cameraOptions.toString()})`;
|
|
1471
2083
|
}
|
|
1472
|
-
},
|
|
2084
|
+
}, bt = {
|
|
1473
2085
|
2: 1,
|
|
1474
2086
|
4: 1,
|
|
1475
2087
|
8: 2,
|
|
1476
2088
|
16: 2
|
|
1477
|
-
},
|
|
2089
|
+
}, Ct = {
|
|
1478
2090
|
2: 2,
|
|
1479
2091
|
4: 2,
|
|
1480
2092
|
8: 3,
|
|
1481
2093
|
16: 3
|
|
1482
|
-
},
|
|
2094
|
+
}, Pt = {
|
|
1483
2095
|
2: 1,
|
|
1484
2096
|
4: 2,
|
|
1485
2097
|
8: 2,
|
|
1486
2098
|
16: 3
|
|
1487
|
-
},
|
|
2099
|
+
}, xt = {
|
|
1488
2100
|
2: 2,
|
|
1489
2101
|
4: 3,
|
|
1490
2102
|
8: 3,
|
|
1491
2103
|
16: 4
|
|
1492
2104
|
};
|
|
1493
|
-
function
|
|
2105
|
+
function It(e) {
|
|
1494
2106
|
const t = e.config.get("defaultLogicFamily");
|
|
1495
|
-
if (!(!t || t === "Sandbox") &&
|
|
1496
|
-
const n = e.config.get("activationLogic") ?? "negative", i =
|
|
1497
|
-
return i &&
|
|
2107
|
+
if (!(!t || t === "Sandbox") && Tt(e.type)) {
|
|
2108
|
+
const n = e.config.get("activationLogic") ?? "negative", i = Ot(e.type, n);
|
|
2109
|
+
return i && Et(t, i.gateFamily, i.inputCount) || void 0;
|
|
1498
2110
|
}
|
|
1499
2111
|
}
|
|
1500
|
-
function
|
|
2112
|
+
function Tt(e) {
|
|
1501
2113
|
return [
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
2114
|
+
c.Inverter,
|
|
2115
|
+
c.NandGate,
|
|
2116
|
+
c.Nand4Gate,
|
|
2117
|
+
c.Nand8Gate,
|
|
2118
|
+
c.NorGate,
|
|
2119
|
+
c.Nor4Gate,
|
|
2120
|
+
c.Nor8Gate,
|
|
2121
|
+
c.XorGate,
|
|
2122
|
+
c.Xor4Gate,
|
|
2123
|
+
c.Xor8Gate
|
|
1512
2124
|
].includes(e);
|
|
1513
2125
|
}
|
|
1514
|
-
function
|
|
2126
|
+
function Ot(e, t) {
|
|
1515
2127
|
switch (e) {
|
|
1516
|
-
case
|
|
2128
|
+
case c.Inverter:
|
|
1517
2129
|
return {
|
|
1518
2130
|
gateFamily: t === "negative" ? "NOT" : "Buffer",
|
|
1519
2131
|
inputCount: 1
|
|
1520
2132
|
};
|
|
1521
|
-
case
|
|
2133
|
+
case c.NandGate:
|
|
1522
2134
|
return {
|
|
1523
2135
|
gateFamily: t === "negative" ? "NAND" : "AND",
|
|
1524
2136
|
inputCount: 2
|
|
1525
2137
|
};
|
|
1526
|
-
case
|
|
2138
|
+
case c.Nand4Gate:
|
|
1527
2139
|
return {
|
|
1528
2140
|
gateFamily: t === "negative" ? "NAND" : "AND",
|
|
1529
2141
|
inputCount: 4
|
|
1530
2142
|
};
|
|
1531
|
-
case
|
|
2143
|
+
case c.Nand8Gate:
|
|
1532
2144
|
return {
|
|
1533
2145
|
gateFamily: t === "negative" ? "NAND" : "AND",
|
|
1534
2146
|
inputCount: 8
|
|
1535
2147
|
};
|
|
1536
|
-
case
|
|
2148
|
+
case c.NorGate:
|
|
1537
2149
|
return {
|
|
1538
2150
|
gateFamily: t === "negative" ? "NOR" : "OR",
|
|
1539
2151
|
inputCount: 2
|
|
1540
2152
|
};
|
|
1541
|
-
case
|
|
2153
|
+
case c.Nor4Gate:
|
|
1542
2154
|
return {
|
|
1543
2155
|
gateFamily: t === "negative" ? "NOR" : "OR",
|
|
1544
2156
|
inputCount: 4
|
|
1545
2157
|
};
|
|
1546
|
-
case
|
|
2158
|
+
case c.Nor8Gate:
|
|
1547
2159
|
return {
|
|
1548
2160
|
gateFamily: t === "negative" ? "NOR" : "OR",
|
|
1549
2161
|
inputCount: 8
|
|
1550
2162
|
};
|
|
1551
|
-
case
|
|
2163
|
+
case c.XorGate:
|
|
1552
2164
|
return {
|
|
1553
2165
|
gateFamily: t === "negative" ? "XNOR" : "XOR",
|
|
1554
2166
|
inputCount: 2
|
|
1555
2167
|
};
|
|
1556
|
-
case
|
|
2168
|
+
case c.Xor4Gate:
|
|
1557
2169
|
return {
|
|
1558
2170
|
gateFamily: t === "negative" ? "XNOR" : "XOR",
|
|
1559
2171
|
inputCount: 4
|
|
1560
2172
|
};
|
|
1561
|
-
case
|
|
2173
|
+
case c.Xor8Gate:
|
|
1562
2174
|
return {
|
|
1563
2175
|
gateFamily: t === "negative" ? "XNOR" : "XOR",
|
|
1564
2176
|
inputCount: 8
|
|
@@ -1567,7 +2179,7 @@ function Pt(e, t) {
|
|
|
1567
2179
|
return null;
|
|
1568
2180
|
}
|
|
1569
2181
|
}
|
|
1570
|
-
function
|
|
2182
|
+
function Et(e, t, n) {
|
|
1571
2183
|
if (e === "Sandbox") throw new Error("computeGateDelay must not be called for Sandbox family");
|
|
1572
2184
|
if (t === "NOT") return 1;
|
|
1573
2185
|
if (t === "Buffer") return 2;
|
|
@@ -1590,16 +2202,16 @@ function xt(e, t, n) {
|
|
|
1590
2202
|
let i;
|
|
1591
2203
|
switch (t) {
|
|
1592
2204
|
case "NAND":
|
|
1593
|
-
i =
|
|
2205
|
+
i = bt;
|
|
1594
2206
|
break;
|
|
1595
2207
|
case "AND":
|
|
1596
|
-
i =
|
|
2208
|
+
i = Ct;
|
|
1597
2209
|
break;
|
|
1598
2210
|
case "NOR":
|
|
1599
|
-
i =
|
|
2211
|
+
i = Pt;
|
|
1600
2212
|
break;
|
|
1601
2213
|
case "OR":
|
|
1602
|
-
i =
|
|
2214
|
+
i = xt;
|
|
1603
2215
|
break;
|
|
1604
2216
|
}
|
|
1605
2217
|
const s = i[n];
|
|
@@ -1608,13 +2220,13 @@ function xt(e, t, n) {
|
|
|
1608
2220
|
}
|
|
1609
2221
|
throw new Error(`Unsupported logic family: ${e}`);
|
|
1610
2222
|
}
|
|
1611
|
-
var
|
|
2223
|
+
var $e = class lt {
|
|
1612
2224
|
metadata;
|
|
1613
2225
|
components;
|
|
1614
2226
|
enodes;
|
|
1615
2227
|
wires;
|
|
1616
2228
|
constructor(t) {
|
|
1617
|
-
this.metadata = new
|
|
2229
|
+
this.metadata = new K(st, t, 10, 10, new tt()), this.components = /* @__PURE__ */ new Map(), this.enodes = /* @__PURE__ */ new Map(), this.wires = /* @__PURE__ */ new Map();
|
|
1618
2230
|
}
|
|
1619
2231
|
get name() {
|
|
1620
2232
|
return this.metadata.options.name;
|
|
@@ -1624,13 +2236,13 @@ var me = class rt {
|
|
|
1624
2236
|
this.metadata.options.name = t;
|
|
1625
2237
|
}
|
|
1626
2238
|
addComponent(t, n, i, s) {
|
|
1627
|
-
const r = I[t], a = new
|
|
1628
|
-
if (s) for (const [
|
|
2239
|
+
const r = I[t], a = new Q(t, n, i, []);
|
|
2240
|
+
if (s) for (const [u, l] of s) a.config.set(u, l);
|
|
1629
2241
|
a.config.has("defaultLogicFamily") && !a.config.get("defaultLogicFamily") && a.config.set("defaultLogicFamily", this.metadata.options.defaultLogicFamily), this.resolveTransitionSpan(a);
|
|
1630
2242
|
const o = [];
|
|
1631
|
-
for (const [
|
|
1632
|
-
const
|
|
1633
|
-
this.enodes.set(
|
|
2243
|
+
for (const [u, l] of r.pins) {
|
|
2244
|
+
const p = new $(w.Pin, a.id, u, void 0, l.sourceType, l.subtype, l.logicPinData);
|
|
2245
|
+
this.enodes.set(p.id, p), o.push(p.id);
|
|
1634
2246
|
}
|
|
1635
2247
|
return Object.defineProperty(a, "pins", {
|
|
1636
2248
|
value: o,
|
|
@@ -1641,7 +2253,7 @@ var me = class rt {
|
|
|
1641
2253
|
}
|
|
1642
2254
|
resolveTransitionSpan(t) {
|
|
1643
2255
|
if (!t.config.has("transitionSpan")) return;
|
|
1644
|
-
const n =
|
|
2256
|
+
const n = It(t);
|
|
1645
2257
|
n && t.config.set("transitionSpan", String(n));
|
|
1646
2258
|
}
|
|
1647
2259
|
removeComponent(t) {
|
|
@@ -1652,8 +2264,8 @@ var me = class rt {
|
|
|
1652
2264
|
const a = this.enodes.get(r);
|
|
1653
2265
|
if (a) {
|
|
1654
2266
|
const o = Array.from(a.wires);
|
|
1655
|
-
for (const
|
|
1656
|
-
this.removeWire(
|
|
2267
|
+
for (const u of o)
|
|
2268
|
+
this.removeWire(u), i.push(u);
|
|
1657
2269
|
}
|
|
1658
2270
|
this.enodes.delete(r), s.push(r);
|
|
1659
2271
|
}
|
|
@@ -1686,13 +2298,13 @@ var me = class rt {
|
|
|
1686
2298
|
return Array.from(this.enodes.values());
|
|
1687
2299
|
}
|
|
1688
2300
|
addBranchingPoint(t, n) {
|
|
1689
|
-
const i = new
|
|
2301
|
+
const i = new $(w.BranchingPoint, void 0, void 0, t, n, void 0, void 0);
|
|
1690
2302
|
return this.enodes.set(i.id, i), i;
|
|
1691
2303
|
}
|
|
1692
2304
|
removeBranchingPoint(t) {
|
|
1693
2305
|
const n = this.enodes.get(t);
|
|
1694
2306
|
if (!n) throw new Error(`Enode ${t} does not exist`);
|
|
1695
|
-
if (n.type !==
|
|
2307
|
+
if (n.type !== w.BranchingPoint) throw new Error(`Enode ${t} is not a branching point, it must be removed with its component.`);
|
|
1696
2308
|
const i = {}, s = this.getWiresByNode(t);
|
|
1697
2309
|
if (s.length === 1 || s.length > 2) {
|
|
1698
2310
|
const r = [];
|
|
@@ -1700,11 +2312,11 @@ var me = class rt {
|
|
|
1700
2312
|
this.removeWire(a.id), r.push(a.id);
|
|
1701
2313
|
Object.assign(i, { deletedWires: r });
|
|
1702
2314
|
} else if (s.length === 2) {
|
|
1703
|
-
const r = s[0], a = s[1], o = r.node1 === t ? r.node2 : r.node1,
|
|
1704
|
-
o === r.node1 ?
|
|
1705
|
-
const
|
|
1706
|
-
if (
|
|
1707
|
-
Object.assign(i, { mergedWires: [r.id, a.id] }), Object.assign(i, { newWire:
|
|
2315
|
+
const r = s[0], a = s[1], o = r.node1 === t ? r.node2 : r.node1, u = a.node1 === t ? a.node2 : a.node1, l = [];
|
|
2316
|
+
o === r.node1 ? l.push(...r.intermediatePositions) : o === r.node2 && l.push(...[...r.intermediatePositions].reverse()), l.push(n.getPosition(this)), u === a.node1 ? l.push(...[...a.intermediatePositions].reverse()) : u === a.node2 && l.push(...a.intermediatePositions), this.removeWire(r.id), this.removeWire(a.id);
|
|
2317
|
+
const p = this.addWire(o, u, l);
|
|
2318
|
+
if (p instanceof Error) throw new Error(`Failed to merge wires at branching point ${t}: ${p.message}`);
|
|
2319
|
+
Object.assign(i, { mergedWires: [r.id, a.id] }), Object.assign(i, { newWire: p });
|
|
1708
2320
|
}
|
|
1709
2321
|
return this.enodes.delete(t), i;
|
|
1710
2322
|
}
|
|
@@ -1713,7 +2325,7 @@ var me = class rt {
|
|
|
1713
2325
|
const s = this.enodes.get(t), r = this.enodes.get(n);
|
|
1714
2326
|
if (!s || !r) return /* @__PURE__ */ new Error("Wire requires at least one existing ENode");
|
|
1715
2327
|
if (this.hasWireBetween(t, n)) return /* @__PURE__ */ new Error("Duplicate wire between same nodes");
|
|
1716
|
-
const a = new
|
|
2328
|
+
const a = new N(t, n, i || []);
|
|
1717
2329
|
return this.wires.set(a.id, a), s.wires.add(a.id), r.wires.add(a.id), a;
|
|
1718
2330
|
}
|
|
1719
2331
|
removeWire(t) {
|
|
@@ -1731,24 +2343,24 @@ var me = class rt {
|
|
|
1731
2343
|
r.getPosition(this),
|
|
1732
2344
|
...s.intermediatePositions,
|
|
1733
2345
|
a.getPosition(this)
|
|
1734
|
-
],
|
|
2346
|
+
], u = vt(o, n), l = o.slice(1, u), p = o.slice(u, o.length - 1);
|
|
1735
2347
|
this.wires.delete(t), r.wires.delete(t), a.wires.delete(t);
|
|
1736
2348
|
let d;
|
|
1737
2349
|
if (i) if (this.enodes.get(i)) d = this.enodes.get(i);
|
|
1738
2350
|
else throw new Error(`Target ENode ${i} does not exist`);
|
|
1739
2351
|
else d = this.addBranchingPoint(n);
|
|
1740
|
-
const
|
|
2352
|
+
const g = [];
|
|
1741
2353
|
if ((!d.component || r.component !== d.component) && !this.hasWireBetween(r.id, d.id)) {
|
|
1742
|
-
const f = this.addWire(r.id, d.id,
|
|
1743
|
-
f instanceof
|
|
2354
|
+
const f = this.addWire(r.id, d.id, l);
|
|
2355
|
+
f instanceof N ? (this.simplifyWireIntermediatePositions(f.id), g.push(f)) : console.warn(`Failure to create wire at split : ${f.message}`);
|
|
1744
2356
|
}
|
|
1745
2357
|
if ((!d.component || a.component !== d.component) && !this.hasWireBetween(a.id, d.id)) {
|
|
1746
|
-
const f = this.addWire(d.id, a.id,
|
|
1747
|
-
f instanceof
|
|
2358
|
+
const f = this.addWire(d.id, a.id, p);
|
|
2359
|
+
f instanceof N ? (this.simplifyWireIntermediatePositions(f.id), g.push(f)) : console.warn(`Failure to create wire at split : ${f.message}`);
|
|
1748
2360
|
}
|
|
1749
2361
|
return {
|
|
1750
2362
|
branchingPoint: d,
|
|
1751
|
-
wires:
|
|
2363
|
+
wires: g
|
|
1752
2364
|
};
|
|
1753
2365
|
}
|
|
1754
2366
|
getWireBetweenNodes(t, n) {
|
|
@@ -1810,9 +2422,9 @@ var me = class rt {
|
|
|
1810
2422
|
let i = 0;
|
|
1811
2423
|
const s = I[t.type], r = Array.from(s.pins.keys());
|
|
1812
2424
|
for (const a of t.pins) {
|
|
1813
|
-
const o = this.enodes.get(a),
|
|
1814
|
-
if (
|
|
1815
|
-
if (o &&
|
|
2425
|
+
const o = this.enodes.get(a), u = r[i];
|
|
2426
|
+
if (u) {
|
|
2427
|
+
if (o && u === n) return o;
|
|
1816
2428
|
i++;
|
|
1817
2429
|
}
|
|
1818
2430
|
}
|
|
@@ -1821,7 +2433,7 @@ var me = class rt {
|
|
|
1821
2433
|
const s = this.wires.get(t);
|
|
1822
2434
|
if (!s) throw new Error(`Wire ${t} does not exist`);
|
|
1823
2435
|
if (i) {
|
|
1824
|
-
const r =
|
|
2436
|
+
const r = V([
|
|
1825
2437
|
this.enodes.get(s.node1).getPosition(this),
|
|
1826
2438
|
...n,
|
|
1827
2439
|
this.enodes.get(s.node2).getPosition(this)
|
|
@@ -1833,12 +2445,12 @@ var me = class rt {
|
|
|
1833
2445
|
simplifyWireIntermediatePositions(t) {
|
|
1834
2446
|
const n = this.wires.get(t);
|
|
1835
2447
|
if (!n) throw new Error(`Wire ${t} does not exist`);
|
|
1836
|
-
const i =
|
|
2448
|
+
const i = V([
|
|
1837
2449
|
this.enodes.get(n.node1).getPosition(this),
|
|
1838
2450
|
...n.intermediatePositions,
|
|
1839
2451
|
this.enodes.get(n.node2).getPosition(this)
|
|
1840
2452
|
], 5);
|
|
1841
|
-
return n.intermediatePositions = i.slice(1, i.length - 1), n.intermediatePositions =
|
|
2453
|
+
return n.intermediatePositions = i.slice(1, i.length - 1), n.intermediatePositions = V(n.intermediatePositions), n;
|
|
1842
2454
|
}
|
|
1843
2455
|
updateENodeSourceType(t, n) {
|
|
1844
2456
|
const i = this.enodes.get(t);
|
|
@@ -1849,7 +2461,7 @@ var me = class rt {
|
|
|
1849
2461
|
let n = 0;
|
|
1850
2462
|
for (const i of this.components.values()) n = Math.max(n, Math.abs(i.position.x), Math.abs(i.position.y));
|
|
1851
2463
|
for (const i of this.enodes.values()) {
|
|
1852
|
-
if (i.type ===
|
|
2464
|
+
if (i.type === w.Pin) continue;
|
|
1853
2465
|
const s = i.position;
|
|
1854
2466
|
s && (n = Math.max(n, Math.abs(s.x), Math.abs(s.y)));
|
|
1855
2467
|
}
|
|
@@ -1865,41 +2477,166 @@ var me = class rt {
|
|
|
1865
2477
|
};
|
|
1866
2478
|
}
|
|
1867
2479
|
static fromJSON(t) {
|
|
1868
|
-
const n =
|
|
2480
|
+
const n = K.fromJSON(t.metadata), i = new lt(n.options);
|
|
1869
2481
|
i.metadata = n;
|
|
1870
2482
|
for (const s of t.components) {
|
|
1871
|
-
const r =
|
|
2483
|
+
const r = Q.fromJSON(s);
|
|
1872
2484
|
i.components.set(r.id, r);
|
|
1873
2485
|
}
|
|
1874
2486
|
for (const s of t.enodes) {
|
|
1875
|
-
const r =
|
|
2487
|
+
const r = $.fromJSON(s);
|
|
1876
2488
|
i.enodes.set(r.id, r);
|
|
1877
2489
|
}
|
|
1878
2490
|
if (t.wires) for (const s of t.wires) {
|
|
1879
|
-
const r =
|
|
2491
|
+
const r = N.fromJSON(s);
|
|
1880
2492
|
i.wires.set(r.id, r);
|
|
1881
2493
|
const a = i.enodes.get(r.node1), o = i.enodes.get(r.node2);
|
|
1882
2494
|
a && a.wires.add(r.id), o && o.wires.add(r.id);
|
|
1883
2495
|
}
|
|
1884
2496
|
return i;
|
|
1885
2497
|
}
|
|
1886
|
-
}
|
|
2498
|
+
};
|
|
2499
|
+
function We(e, t) {
|
|
2500
|
+
const n = /* @__PURE__ */ new Map(), i = e.getENode(t);
|
|
2501
|
+
if (!i || i.type !== w.BranchingPoint) return n;
|
|
2502
|
+
const s = /* @__PURE__ */ new Set([t]), r = [{
|
|
2503
|
+
id: t,
|
|
2504
|
+
edges: 0
|
|
2505
|
+
}];
|
|
2506
|
+
for (; r.length > 0; ) {
|
|
2507
|
+
const { id: a, edges: o } = r.shift();
|
|
2508
|
+
for (const u of e.getWiresByNode(a)) {
|
|
2509
|
+
const l = u.node1 === a ? u.node2 : u.node1, p = e.getENode(l);
|
|
2510
|
+
if (!p) continue;
|
|
2511
|
+
const d = o + 1;
|
|
2512
|
+
if (p.type === w.Pin) {
|
|
2513
|
+
const g = d, f = n.get(l);
|
|
2514
|
+
(f === void 0 || g < f) && n.set(l, g);
|
|
2515
|
+
continue;
|
|
2516
|
+
}
|
|
2517
|
+
s.has(l) || (s.add(l), r.push({
|
|
2518
|
+
id: l,
|
|
2519
|
+
edges: d
|
|
2520
|
+
}));
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
return n;
|
|
2524
|
+
}
|
|
2525
|
+
function Re(e, t) {
|
|
2526
|
+
const n = /* @__PURE__ */ new Map(), i = e.getENode(t);
|
|
2527
|
+
if (!i || i.type !== w.BranchingPoint) return n;
|
|
2528
|
+
const s = /* @__PURE__ */ new Set([t]), r = [{
|
|
2529
|
+
id: t,
|
|
2530
|
+
edges: 0,
|
|
2531
|
+
parent: t
|
|
2532
|
+
}];
|
|
2533
|
+
for (; r.length > 0; ) {
|
|
2534
|
+
const { id: a, edges: o } = r.shift();
|
|
2535
|
+
for (const u of e.getWiresByNode(a)) {
|
|
2536
|
+
const l = u.node1 === a ? u.node2 : u.node1, p = e.getENode(l);
|
|
2537
|
+
if (!p) continue;
|
|
2538
|
+
const d = o + 1;
|
|
2539
|
+
if (p.type === w.Pin) {
|
|
2540
|
+
const g = d, f = n.get(l);
|
|
2541
|
+
(f === void 0 || g < f.Dl) && n.set(l, {
|
|
2542
|
+
Dl: g,
|
|
2543
|
+
predecessor: a
|
|
2544
|
+
});
|
|
2545
|
+
continue;
|
|
2546
|
+
}
|
|
2547
|
+
s.has(l) || (s.add(l), r.push({
|
|
2548
|
+
id: l,
|
|
2549
|
+
edges: d,
|
|
2550
|
+
parent: a
|
|
2551
|
+
}));
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
return n;
|
|
2555
|
+
}
|
|
2556
|
+
function Fe(e, t, n) {
|
|
2557
|
+
if (n <= 0) return [];
|
|
2558
|
+
const i = e.getENode(t);
|
|
2559
|
+
if (!i || i.type !== w.Pin) return [];
|
|
2560
|
+
const s = n, r = [], a = /* @__PURE__ */ new Set([t]), o = [{
|
|
2561
|
+
id: t,
|
|
2562
|
+
edges: 0
|
|
2563
|
+
}];
|
|
2564
|
+
for (; o.length > 0; ) {
|
|
2565
|
+
const { id: u, edges: l } = o.shift();
|
|
2566
|
+
if (!(l > s))
|
|
2567
|
+
for (const p of e.getWiresByNode(u)) {
|
|
2568
|
+
const d = p.node1 === u ? p.node2 : p.node1;
|
|
2569
|
+
if (a.has(d)) continue;
|
|
2570
|
+
const g = e.getENode(d);
|
|
2571
|
+
if (!g) continue;
|
|
2572
|
+
const f = l + 1;
|
|
2573
|
+
if (g.type !== w.Pin) {
|
|
2574
|
+
if (a.add(d), f === s) {
|
|
2575
|
+
r.push(d);
|
|
2576
|
+
continue;
|
|
2577
|
+
}
|
|
2578
|
+
o.push({
|
|
2579
|
+
id: d,
|
|
2580
|
+
edges: f
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
return r;
|
|
2586
|
+
}
|
|
2587
|
+
function He(e, t, n) {
|
|
2588
|
+
if (n <= 0) return [];
|
|
2589
|
+
const i = e.getENode(t);
|
|
2590
|
+
if (!i || i.type !== w.Pin) return [];
|
|
2591
|
+
const s = n, r = [], a = /* @__PURE__ */ new Set([t]), o = [{
|
|
2592
|
+
id: t,
|
|
2593
|
+
edges: 0,
|
|
2594
|
+
parent: t
|
|
2595
|
+
}];
|
|
2596
|
+
for (; o.length > 0; ) {
|
|
2597
|
+
const { id: u, edges: l } = o.shift();
|
|
2598
|
+
if (!(l > s))
|
|
2599
|
+
for (const p of e.getWiresByNode(u)) {
|
|
2600
|
+
const d = p.node1 === u ? p.node2 : p.node1;
|
|
2601
|
+
if (a.has(d)) continue;
|
|
2602
|
+
const g = e.getENode(d);
|
|
2603
|
+
if (!g) continue;
|
|
2604
|
+
const f = l + 1;
|
|
2605
|
+
if (g.type !== w.Pin) {
|
|
2606
|
+
if (a.add(d), f === s) {
|
|
2607
|
+
r.push({
|
|
2608
|
+
id: d,
|
|
2609
|
+
predecessor: u
|
|
2610
|
+
});
|
|
2611
|
+
continue;
|
|
2612
|
+
}
|
|
2613
|
+
o.push({
|
|
2614
|
+
id: d,
|
|
2615
|
+
edges: f,
|
|
2616
|
+
parent: u
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
return r;
|
|
2622
|
+
}
|
|
2623
|
+
var Je = {
|
|
1887
2624
|
MIN_TPS: 1,
|
|
1888
2625
|
MAX_TPS: 100,
|
|
1889
2626
|
DEFAULT_TPS: 3,
|
|
1890
2627
|
DEFAULT_INTERVAL_MS: 500
|
|
1891
|
-
},
|
|
2628
|
+
}, dt = {
|
|
1892
2629
|
TRANSITION_SPAN_TICKS: 1,
|
|
1893
2630
|
TRANSITION_USER_SPAN_MS: 200
|
|
1894
2631
|
};
|
|
1895
|
-
function
|
|
2632
|
+
function O(...e) {
|
|
1896
2633
|
return {
|
|
1897
2634
|
hasVoltage: e.some((t) => t.hasVoltage),
|
|
1898
2635
|
hasCurrent: e.some((t) => t.hasCurrent),
|
|
1899
2636
|
locked: !1
|
|
1900
2637
|
};
|
|
1901
2638
|
}
|
|
1902
|
-
var
|
|
2639
|
+
var Y = class ht {
|
|
1903
2640
|
tick;
|
|
1904
2641
|
nodeStates;
|
|
1905
2642
|
wireStates;
|
|
@@ -1912,7 +2649,7 @@ var J = class ot {
|
|
|
1912
2649
|
this.tick = t;
|
|
1913
2650
|
}
|
|
1914
2651
|
clone() {
|
|
1915
|
-
const t = new
|
|
2652
|
+
const t = new ht(this.tick), n = /* @__PURE__ */ new Map();
|
|
1916
2653
|
for (const [r, a] of this.nodeStates.entries()) n.set(r, { ...a });
|
|
1917
2654
|
const i = /* @__PURE__ */ new Map();
|
|
1918
2655
|
for (const [r, a] of this.wireStates.entries()) i.set(r, { ...a });
|
|
@@ -1935,7 +2672,7 @@ var J = class ot {
|
|
|
1935
2672
|
enumerable: !0
|
|
1936
2673
|
}), t;
|
|
1937
2674
|
}
|
|
1938
|
-
},
|
|
2675
|
+
}, m = class {
|
|
1939
2676
|
componentId;
|
|
1940
2677
|
_state;
|
|
1941
2678
|
_startTick;
|
|
@@ -1967,26 +2704,26 @@ var J = class ot {
|
|
|
1967
2704
|
setNextState(e, t) {
|
|
1968
2705
|
this._nextState = e, this._expirationTick = t;
|
|
1969
2706
|
}
|
|
1970
|
-
},
|
|
2707
|
+
}, Dt = class extends m {
|
|
1971
2708
|
constructor(e) {
|
|
1972
2709
|
super(e, "on");
|
|
1973
2710
|
}
|
|
1974
|
-
},
|
|
2711
|
+
}, Nt = class extends m {
|
|
1975
2712
|
constructor(e, t = "off") {
|
|
1976
2713
|
super(e, t);
|
|
1977
2714
|
}
|
|
1978
2715
|
get isLit() {
|
|
1979
2716
|
return this.state === "on" || this.state === "goingOn";
|
|
1980
2717
|
}
|
|
1981
|
-
},
|
|
2718
|
+
}, gt = class extends m {
|
|
1982
2719
|
constructor(e, t = "off") {
|
|
1983
2720
|
super(e, t);
|
|
1984
2721
|
}
|
|
1985
2722
|
get isLit() {
|
|
1986
2723
|
return this.state === "on" || this.state === "goingOn";
|
|
1987
2724
|
}
|
|
1988
|
-
},
|
|
1989
|
-
},
|
|
2725
|
+
}, Mt = class extends gt {
|
|
2726
|
+
}, Lt = class extends m {
|
|
1990
2727
|
constructor(e, t = "open") {
|
|
1991
2728
|
super(e, t);
|
|
1992
2729
|
}
|
|
@@ -1996,7 +2733,7 @@ var J = class ot {
|
|
|
1996
2733
|
get isClosed() {
|
|
1997
2734
|
return this.state === "closed" || this.state === "closing";
|
|
1998
2735
|
}
|
|
1999
|
-
},
|
|
2736
|
+
}, zt = class extends m {
|
|
2000
2737
|
constructor(e, t = "open") {
|
|
2001
2738
|
super(e, t);
|
|
2002
2739
|
}
|
|
@@ -2006,18 +2743,18 @@ var J = class ot {
|
|
|
2006
2743
|
get isClosed() {
|
|
2007
2744
|
return this.state === "closed" || this.state === "closing";
|
|
2008
2745
|
}
|
|
2009
|
-
},
|
|
2746
|
+
}, Bt = class extends m {
|
|
2010
2747
|
constructor(e, t = "input1") {
|
|
2011
2748
|
super(e, t);
|
|
2012
2749
|
}
|
|
2013
2750
|
get isInTransition() {
|
|
2014
2751
|
return this.state === "1to2" || this.state === "2to1";
|
|
2015
2752
|
}
|
|
2016
|
-
},
|
|
2753
|
+
}, At = class extends m {
|
|
2017
2754
|
constructor(e) {
|
|
2018
2755
|
super(e, "high");
|
|
2019
2756
|
}
|
|
2020
|
-
},
|
|
2757
|
+
}, b = class extends m {
|
|
2021
2758
|
constructor(e, t = "low") {
|
|
2022
2759
|
super(e, t);
|
|
2023
2760
|
}
|
|
@@ -2027,47 +2764,47 @@ var J = class ot {
|
|
|
2027
2764
|
get isHigh() {
|
|
2028
2765
|
return this.state === "high";
|
|
2029
2766
|
}
|
|
2030
|
-
},
|
|
2767
|
+
}, kt = class extends b {
|
|
2031
2768
|
constructor(e, t = "low") {
|
|
2032
2769
|
super(e, t);
|
|
2033
2770
|
}
|
|
2034
|
-
},
|
|
2771
|
+
}, Gt = class extends b {
|
|
2035
2772
|
constructor(e, t = "low") {
|
|
2036
2773
|
super(e, t);
|
|
2037
2774
|
}
|
|
2038
|
-
},
|
|
2775
|
+
}, _t = class extends b {
|
|
2039
2776
|
constructor(e, t = "low") {
|
|
2040
2777
|
super(e, t);
|
|
2041
2778
|
}
|
|
2042
|
-
},
|
|
2779
|
+
}, Vt = class extends b {
|
|
2043
2780
|
constructor(e, t = "low") {
|
|
2044
2781
|
super(e, t);
|
|
2045
2782
|
}
|
|
2046
|
-
},
|
|
2783
|
+
}, $t = class extends b {
|
|
2047
2784
|
constructor(e, t = "low") {
|
|
2048
2785
|
super(e, t);
|
|
2049
2786
|
}
|
|
2050
|
-
},
|
|
2787
|
+
}, Wt = class extends b {
|
|
2051
2788
|
constructor(e, t = "low") {
|
|
2052
2789
|
super(e, t);
|
|
2053
2790
|
}
|
|
2054
|
-
},
|
|
2791
|
+
}, Rt = class extends b {
|
|
2055
2792
|
constructor(e, t = "low") {
|
|
2056
2793
|
super(e, t);
|
|
2057
2794
|
}
|
|
2058
|
-
},
|
|
2795
|
+
}, Ft = class extends b {
|
|
2059
2796
|
constructor(e, t = "low") {
|
|
2060
2797
|
super(e, t);
|
|
2061
2798
|
}
|
|
2062
|
-
},
|
|
2799
|
+
}, Ht = class extends b {
|
|
2063
2800
|
constructor(e, t = "low") {
|
|
2064
2801
|
super(e, t);
|
|
2065
2802
|
}
|
|
2066
|
-
},
|
|
2803
|
+
}, Jt = class extends b {
|
|
2067
2804
|
constructor(e, t = "low") {
|
|
2068
2805
|
super(e, t);
|
|
2069
2806
|
}
|
|
2070
|
-
},
|
|
2807
|
+
}, L = class extends m {
|
|
2071
2808
|
outputCount;
|
|
2072
2809
|
hexDigitCount;
|
|
2073
2810
|
allLowState;
|
|
@@ -2084,7 +2821,7 @@ var J = class ot {
|
|
|
2084
2821
|
const t = this.effectiveState;
|
|
2085
2822
|
return t === "indeterminate" ? !1 : (parseInt(t, 16) >> e & 1) === 1;
|
|
2086
2823
|
}
|
|
2087
|
-
},
|
|
2824
|
+
}, Ut = class extends L {
|
|
2088
2825
|
constructor(e, t = "0") {
|
|
2089
2826
|
super(e, 2, t);
|
|
2090
2827
|
}
|
|
@@ -2094,7 +2831,7 @@ var J = class ot {
|
|
|
2094
2831
|
get carryHigh() {
|
|
2095
2832
|
return this.isOutputHigh(1);
|
|
2096
2833
|
}
|
|
2097
|
-
},
|
|
2834
|
+
}, Xt = class extends L {
|
|
2098
2835
|
constructor(e, t = "0") {
|
|
2099
2836
|
super(e, 2, t);
|
|
2100
2837
|
}
|
|
@@ -2104,7 +2841,7 @@ var J = class ot {
|
|
|
2104
2841
|
get carryOutHigh() {
|
|
2105
2842
|
return this.isOutputHigh(1);
|
|
2106
2843
|
}
|
|
2107
|
-
},
|
|
2844
|
+
}, Qt = class extends L {
|
|
2108
2845
|
constructor(e, t = "0000") {
|
|
2109
2846
|
super(e, 16, t);
|
|
2110
2847
|
}
|
|
@@ -2117,7 +2854,7 @@ var J = class ot {
|
|
|
2117
2854
|
isCarryOutHigh() {
|
|
2118
2855
|
return this.isStageCarryHigh(7);
|
|
2119
2856
|
}
|
|
2120
|
-
},
|
|
2857
|
+
}, qt = class extends L {
|
|
2121
2858
|
constructor(e, t = "000") {
|
|
2122
2859
|
super(e, 9, t);
|
|
2123
2860
|
}
|
|
@@ -2127,7 +2864,97 @@ var J = class ot {
|
|
|
2127
2864
|
isInvertHigh() {
|
|
2128
2865
|
return this.isOutputHigh(8);
|
|
2129
2866
|
}
|
|
2130
|
-
},
|
|
2867
|
+
}, z = class extends m {
|
|
2868
|
+
outputCount;
|
|
2869
|
+
hexDigitCount;
|
|
2870
|
+
allLowState;
|
|
2871
|
+
constructor(e, t, n) {
|
|
2872
|
+
super(e, n), this.outputCount = t, this.hexDigitCount = Math.ceil(t / 4), this.allLowState = "0".repeat(this.hexDigitCount);
|
|
2873
|
+
}
|
|
2874
|
+
get isInTransition() {
|
|
2875
|
+
return this.state === "moving";
|
|
2876
|
+
}
|
|
2877
|
+
get effectiveState() {
|
|
2878
|
+
return this.isInTransition ? this.parameters.get("prevState") ?? this.allLowState : this.state;
|
|
2879
|
+
}
|
|
2880
|
+
isOutputHigh(e) {
|
|
2881
|
+
const t = this.effectiveState;
|
|
2882
|
+
return (parseInt(t, 16) >> e & 1) === 1;
|
|
2883
|
+
}
|
|
2884
|
+
getPendingMove(e) {
|
|
2885
|
+
const t = this.parameters.get(String(e));
|
|
2886
|
+
if (!t) return null;
|
|
2887
|
+
const n = t.split("-");
|
|
2888
|
+
if (n.length !== 3) return null;
|
|
2889
|
+
const i = parseInt(n[0], 10), s = parseInt(n[1], 10), r = parseInt(n[2], 10);
|
|
2890
|
+
return isNaN(i) || isNaN(s) || isNaN(r) ? null : {
|
|
2891
|
+
target: i === 1 ? 1 : 0,
|
|
2892
|
+
startTick: s,
|
|
2893
|
+
endTick: r
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
}, Kt = class extends z {
|
|
2897
|
+
constructor(e, t = "0") {
|
|
2898
|
+
super(e, 1, t);
|
|
2899
|
+
}
|
|
2900
|
+
}, Yt = class extends z {
|
|
2901
|
+
constructor(e, t = "0") {
|
|
2902
|
+
super(e, 2, t);
|
|
2903
|
+
}
|
|
2904
|
+
}, Zt = class extends z {
|
|
2905
|
+
constructor(e, t = "0") {
|
|
2906
|
+
super(e, 4, t);
|
|
2907
|
+
}
|
|
2908
|
+
}, jt = class extends z {
|
|
2909
|
+
constructor(e, t = "00") {
|
|
2910
|
+
super(e, 8, t);
|
|
2911
|
+
}
|
|
2912
|
+
}, B = class extends m {
|
|
2913
|
+
lightCount;
|
|
2914
|
+
hexDigitCount;
|
|
2915
|
+
allLowState;
|
|
2916
|
+
constructor(e, t, n) {
|
|
2917
|
+
super(e, n), this.lightCount = t, this.hexDigitCount = Math.ceil(t / 4), this.allLowState = "0".repeat(this.hexDigitCount);
|
|
2918
|
+
}
|
|
2919
|
+
get isInTransition() {
|
|
2920
|
+
return this.state === "moving";
|
|
2921
|
+
}
|
|
2922
|
+
get effectiveState() {
|
|
2923
|
+
return this.isInTransition ? this.parameters.get("prevState") ?? this.allLowState : this.state;
|
|
2924
|
+
}
|
|
2925
|
+
isOutputHigh(e) {
|
|
2926
|
+
const t = this.effectiveState;
|
|
2927
|
+
return t === "indeterminate" ? !1 : (parseInt(t, 16) >> e & 1) === 1;
|
|
2928
|
+
}
|
|
2929
|
+
getPendingMove(e) {
|
|
2930
|
+
const t = this.parameters.get(String(e));
|
|
2931
|
+
if (!t) return null;
|
|
2932
|
+
const n = t.split("-");
|
|
2933
|
+
if (n.length !== 3) return null;
|
|
2934
|
+
const i = parseInt(n[0], 10), s = parseInt(n[1], 10), r = parseInt(n[2], 10);
|
|
2935
|
+
return isNaN(i) || isNaN(s) || isNaN(r) ? null : {
|
|
2936
|
+
target: i === 1 ? 1 : 0,
|
|
2937
|
+
startTick: s,
|
|
2938
|
+
endTick: r
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
}, te = class extends B {
|
|
2942
|
+
constructor(e, t = "0") {
|
|
2943
|
+
super(e, 1, t);
|
|
2944
|
+
}
|
|
2945
|
+
}, ee = class extends B {
|
|
2946
|
+
constructor(e, t = "0") {
|
|
2947
|
+
super(e, 2, t);
|
|
2948
|
+
}
|
|
2949
|
+
}, ie = class extends B {
|
|
2950
|
+
constructor(e, t = "0") {
|
|
2951
|
+
super(e, 4, t);
|
|
2952
|
+
}
|
|
2953
|
+
}, ne = class extends B {
|
|
2954
|
+
constructor(e, t = "00") {
|
|
2955
|
+
super(e, 8, t);
|
|
2956
|
+
}
|
|
2957
|
+
}, Ue = class {
|
|
2131
2958
|
behaviors;
|
|
2132
2959
|
constructor() {
|
|
2133
2960
|
this.behaviors = /* @__PURE__ */ new Map();
|
|
@@ -2218,17 +3045,17 @@ var J = class ot {
|
|
|
2218
3045
|
};
|
|
2219
3046
|
function x(e) {
|
|
2220
3047
|
const t = parseInt(e.get("transitionSpan") || "", 10);
|
|
2221
|
-
return isNaN(t) || t < 1 ?
|
|
3048
|
+
return isNaN(t) || t < 1 ? dt.TRANSITION_SPAN_TICKS : t;
|
|
2222
3049
|
}
|
|
2223
|
-
var
|
|
3050
|
+
var se = class extends C {
|
|
2224
3051
|
constructor() {
|
|
2225
|
-
super(
|
|
3052
|
+
super(c.Battery);
|
|
2226
3053
|
}
|
|
2227
3054
|
createInitialState(e) {
|
|
2228
3055
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for BatteryBehavior: ${e.type}`);
|
|
2229
|
-
return new
|
|
3056
|
+
return new Dt(e.id);
|
|
2230
3057
|
}
|
|
2231
|
-
},
|
|
3058
|
+
}, U = class extends C {
|
|
2232
3059
|
getBehavior(e, t, n, i) {
|
|
2233
3060
|
let s = !1;
|
|
2234
3061
|
const r = [], a = x(e.config), o = t.expirationTick < 1 ? a : Math.max(i - t.startTick, 1);
|
|
@@ -2263,47 +3090,47 @@ var Ut = class extends C {
|
|
|
2263
3090
|
scheduledEvents: []
|
|
2264
3091
|
};
|
|
2265
3092
|
}
|
|
2266
|
-
},
|
|
3093
|
+
}, re = class extends U {
|
|
2267
3094
|
constructor() {
|
|
2268
|
-
super(
|
|
3095
|
+
super(c.Lightbulb);
|
|
2269
3096
|
}
|
|
2270
3097
|
createInitialState(e) {
|
|
2271
3098
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for lightbulbBehavior: ${e.type}`);
|
|
2272
|
-
return new
|
|
3099
|
+
return new Nt(e.id);
|
|
2273
3100
|
}
|
|
2274
3101
|
onPinsChange(e, t, n, i) {
|
|
2275
3102
|
const s = this.getPinStates(e, n);
|
|
2276
3103
|
t.pinStates = s;
|
|
2277
|
-
const r =
|
|
3104
|
+
const r = O(s.get("pin1"), s.get("pin2")), a = r.hasVoltage && r.hasCurrent;
|
|
2278
3105
|
return this.getBehavior(e, t, a, i);
|
|
2279
3106
|
}
|
|
2280
|
-
},
|
|
3107
|
+
}, ae = class extends U {
|
|
2281
3108
|
constructor() {
|
|
2282
|
-
super(
|
|
3109
|
+
super(c.RectangleLED);
|
|
2283
3110
|
}
|
|
2284
3111
|
createInitialState(e) {
|
|
2285
3112
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for RectangleLEDBehavior: ${e.type}`);
|
|
2286
|
-
return new
|
|
3113
|
+
return new Mt(e.id);
|
|
2287
3114
|
}
|
|
2288
3115
|
onPinsChange(e, t, n, i) {
|
|
2289
3116
|
const s = this.getPinStates(e, n);
|
|
2290
3117
|
t.pinStates = s;
|
|
2291
|
-
const r =
|
|
3118
|
+
const r = O(s.get("pin1"), s.get("pin2")), a = r.hasVoltage && r.hasCurrent;
|
|
2292
3119
|
return this.getBehavior(e, t, a, i);
|
|
2293
3120
|
}
|
|
2294
3121
|
};
|
|
2295
|
-
function
|
|
3122
|
+
function oe(e) {
|
|
2296
3123
|
const t = parseInt(e.get("transitionSpan") || "", 10);
|
|
2297
|
-
return isNaN(t) || t < 1 ?
|
|
3124
|
+
return isNaN(t) || t < 1 ? dt.TRANSITION_SPAN_TICKS : t;
|
|
2298
3125
|
}
|
|
2299
|
-
var
|
|
3126
|
+
var ue = class extends C {
|
|
2300
3127
|
constructor() {
|
|
2301
|
-
super(
|
|
3128
|
+
super(c.Relay);
|
|
2302
3129
|
}
|
|
2303
3130
|
createInitialState(e) {
|
|
2304
3131
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for RelayBehavior: ${e.type}`);
|
|
2305
3132
|
const t = e.config.get("activationLogic") === "negative" ? "closed" : "open";
|
|
2306
|
-
return new
|
|
3133
|
+
return new Lt(e.id, t);
|
|
2307
3134
|
}
|
|
2308
3135
|
allowConductivity(e, t, n, i, s) {
|
|
2309
3136
|
if (i === s) return !0;
|
|
@@ -2314,16 +3141,16 @@ var Kt = class extends C {
|
|
|
2314
3141
|
}
|
|
2315
3142
|
onPinsChange(e, t, n, i) {
|
|
2316
3143
|
const s = this.getPinStates(e, n);
|
|
2317
|
-
s.set("cmd_in*cmd_out",
|
|
3144
|
+
s.set("cmd_in*cmd_out", O(s.get("cmd_in"), s.get("cmd_out"))), s.set("power_in*power_out", O(s.get("power_in"), s.get("power_out")));
|
|
2318
3145
|
const r = t.pinStates;
|
|
2319
3146
|
t.pinStates = s;
|
|
2320
|
-
const a = this.getChangedPins(s, r), o = s.get("cmd_in*cmd_out"),
|
|
2321
|
-
let
|
|
2322
|
-
const d = [],
|
|
2323
|
-
if (
|
|
3147
|
+
const a = this.getChangedPins(s, r), o = s.get("cmd_in*cmd_out"), u = o.hasVoltage && o.hasCurrent, l = e.config.get("activationLogic") === "negative" ? !u : u;
|
|
3148
|
+
let p = a.size > 0;
|
|
3149
|
+
const d = [], g = oe(e.config);
|
|
3150
|
+
if (l) {
|
|
2324
3151
|
if (t.state === "open" || t.state === "opening") {
|
|
2325
|
-
let f = t.state === "open" ?
|
|
2326
|
-
|
|
3152
|
+
let f = t.state === "open" ? g : Math.max(i - t.startTick, 1);
|
|
3153
|
+
p = !0, t.setState("closing", i), t.setNextState("closed", i + f), d.push({
|
|
2327
3154
|
targetId: e.id,
|
|
2328
3155
|
scheduledAtTick: t.startTick,
|
|
2329
3156
|
readyAtTick: t.expirationTick,
|
|
@@ -2332,8 +3159,8 @@ var Kt = class extends C {
|
|
|
2332
3159
|
});
|
|
2333
3160
|
}
|
|
2334
3161
|
} else if (t.state === "closed" || t.state === "closing") {
|
|
2335
|
-
let f = t.state === "closed" ?
|
|
2336
|
-
|
|
3162
|
+
let f = t.state === "closed" ? g : Math.max(i - t.startTick, 1);
|
|
3163
|
+
p = !0, t.setState("opening", i), t.setNextState("open", i + f), d.push({
|
|
2337
3164
|
targetId: e.id,
|
|
2338
3165
|
scheduledAtTick: t.startTick,
|
|
2339
3166
|
readyAtTick: t.expirationTick,
|
|
@@ -2343,8 +3170,8 @@ var Kt = class extends C {
|
|
|
2343
3170
|
}
|
|
2344
3171
|
return {
|
|
2345
3172
|
componentState: t,
|
|
2346
|
-
hasChanged:
|
|
2347
|
-
shouldCancelPending:
|
|
3173
|
+
hasChanged: p,
|
|
3174
|
+
shouldCancelPending: p,
|
|
2348
3175
|
scheduledEvents: d
|
|
2349
3176
|
};
|
|
2350
3177
|
}
|
|
@@ -2357,28 +3184,28 @@ var Kt = class extends C {
|
|
|
2357
3184
|
scheduledEvents: []
|
|
2358
3185
|
};
|
|
2359
3186
|
}
|
|
2360
|
-
},
|
|
3187
|
+
}, ce = class extends U {
|
|
2361
3188
|
constructor() {
|
|
2362
|
-
super(
|
|
3189
|
+
super(c.SmallLED);
|
|
2363
3190
|
}
|
|
2364
3191
|
createInitialState(e) {
|
|
2365
3192
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for SmallLEDBehavior: ${e.type}`);
|
|
2366
|
-
return new
|
|
3193
|
+
return new gt(e.id);
|
|
2367
3194
|
}
|
|
2368
3195
|
onPinsChange(e, t, n, i) {
|
|
2369
3196
|
const s = this.getPinStates(e, n);
|
|
2370
3197
|
t.pinStates = s;
|
|
2371
|
-
const r =
|
|
3198
|
+
const r = O(s.get("pin1"), s.get("pin2")), a = r.hasVoltage && r.hasCurrent;
|
|
2372
3199
|
return this.getBehavior(e, t, a, i);
|
|
2373
3200
|
}
|
|
2374
|
-
},
|
|
3201
|
+
}, pe = class extends C {
|
|
2375
3202
|
constructor() {
|
|
2376
|
-
super(
|
|
3203
|
+
super(c.Switch);
|
|
2377
3204
|
}
|
|
2378
3205
|
createInitialState(e) {
|
|
2379
3206
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for SwitchBehavior: ${e.type}`);
|
|
2380
3207
|
const t = e.config.get("initialState") || "open";
|
|
2381
|
-
return new
|
|
3208
|
+
return new zt(e.id, t);
|
|
2382
3209
|
}
|
|
2383
3210
|
allowConductivity(e, t, n, i, s) {
|
|
2384
3211
|
return t.state === "closed" || t.state === "opening";
|
|
@@ -2424,14 +3251,14 @@ var Kt = class extends C {
|
|
|
2424
3251
|
scheduledEvents: []
|
|
2425
3252
|
};
|
|
2426
3253
|
}
|
|
2427
|
-
},
|
|
3254
|
+
}, le = class extends C {
|
|
2428
3255
|
constructor() {
|
|
2429
|
-
super(
|
|
3256
|
+
super(c.DoubleThrowSwitch);
|
|
2430
3257
|
}
|
|
2431
3258
|
createInitialState(e) {
|
|
2432
3259
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for DoubleThrowSwitchBehavior: ${e.type}`);
|
|
2433
3260
|
const t = e.config.get("initialState") || "input1";
|
|
2434
|
-
return new
|
|
3261
|
+
return new Bt(e.id, t);
|
|
2435
3262
|
}
|
|
2436
3263
|
allowConductivity(e, t, n, i, s) {
|
|
2437
3264
|
if (i === s) return !0;
|
|
@@ -2481,13 +3308,13 @@ var Kt = class extends C {
|
|
|
2481
3308
|
scheduledEvents: []
|
|
2482
3309
|
};
|
|
2483
3310
|
}
|
|
2484
|
-
},
|
|
3311
|
+
}, de = class extends C {
|
|
2485
3312
|
constructor() {
|
|
2486
|
-
super(
|
|
3313
|
+
super(c.Clock);
|
|
2487
3314
|
}
|
|
2488
3315
|
createInitialState(e) {
|
|
2489
3316
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for ClockBehavior: ${e.type}`);
|
|
2490
|
-
const t = new
|
|
3317
|
+
const t = new At(e.id), n = e.config.get("startHigh") == "true";
|
|
2491
3318
|
t.setState(n ? "high" : "low", 0);
|
|
2492
3319
|
const i = Number(e.config.get("halfPeriod"));
|
|
2493
3320
|
return t.setNextState(n ? "low" : "high", i), t;
|
|
@@ -2535,7 +3362,7 @@ var Kt = class extends C {
|
|
|
2535
3362
|
}]
|
|
2536
3363
|
};
|
|
2537
3364
|
}
|
|
2538
|
-
},
|
|
3365
|
+
}, P = class extends C {
|
|
2539
3366
|
vccGuardBehavior(e, t, n) {
|
|
2540
3367
|
if (t.get("vcc").hasVoltage) return null;
|
|
2541
3368
|
let i = !1, s = !1;
|
|
@@ -2549,15 +3376,15 @@ var Kt = class extends C {
|
|
|
2549
3376
|
nonLogicInputGuardBehavior(e, t, n) {
|
|
2550
3377
|
let i = !1;
|
|
2551
3378
|
const s = this.typeMetadata.pins;
|
|
2552
|
-
for (const [o,
|
|
3379
|
+
for (const [o, u] of t) {
|
|
2553
3380
|
if (!s.has(o)) continue;
|
|
2554
|
-
const
|
|
2555
|
-
if (
|
|
2556
|
-
if (
|
|
3381
|
+
const l = s.get(o);
|
|
3382
|
+
if (l && l?.subtype === "logicInput") {
|
|
3383
|
+
if (u.hasVoltage && u.hasCurrent) {
|
|
2557
3384
|
i = !0;
|
|
2558
3385
|
break;
|
|
2559
3386
|
}
|
|
2560
|
-
if (!
|
|
3387
|
+
if (!u.hasVoltage && !u.hasCurrent) {
|
|
2561
3388
|
i = !0;
|
|
2562
3389
|
break;
|
|
2563
3390
|
}
|
|
@@ -2647,14 +3474,14 @@ var Kt = class extends C {
|
|
|
2647
3474
|
scheduledEvents: []
|
|
2648
3475
|
};
|
|
2649
3476
|
}
|
|
2650
|
-
},
|
|
3477
|
+
}, he = class extends P {
|
|
2651
3478
|
constructor() {
|
|
2652
|
-
super(
|
|
3479
|
+
super(c.Inverter);
|
|
2653
3480
|
}
|
|
2654
3481
|
createInitialState(e) {
|
|
2655
3482
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for InverterBehavior: ${e.type}`);
|
|
2656
3483
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2657
|
-
return new
|
|
3484
|
+
return new kt(e.id, t);
|
|
2658
3485
|
}
|
|
2659
3486
|
onPinsChange(e, t, n, i) {
|
|
2660
3487
|
const s = this.getPinStates(e, n);
|
|
@@ -2663,17 +3490,17 @@ var Kt = class extends C {
|
|
|
2663
3490
|
if (r) return r;
|
|
2664
3491
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2665
3492
|
if (a) return a;
|
|
2666
|
-
const o = s.get("input").hasVoltage,
|
|
2667
|
-
return this.getBehavior(e, t,
|
|
3493
|
+
const o = s.get("input").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3494
|
+
return this.getBehavior(e, t, u, i);
|
|
2668
3495
|
}
|
|
2669
|
-
},
|
|
3496
|
+
}, ge = class extends P {
|
|
2670
3497
|
constructor() {
|
|
2671
|
-
super(
|
|
3498
|
+
super(c.NandGate);
|
|
2672
3499
|
}
|
|
2673
3500
|
createInitialState(e) {
|
|
2674
3501
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for NandGateBehavior: ${e.type}`);
|
|
2675
3502
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2676
|
-
return new
|
|
3503
|
+
return new Gt(e.id, t);
|
|
2677
3504
|
}
|
|
2678
3505
|
onPinsChange(e, t, n, i) {
|
|
2679
3506
|
const s = this.getPinStates(e, n);
|
|
@@ -2682,17 +3509,17 @@ var Kt = class extends C {
|
|
|
2682
3509
|
if (r) return r;
|
|
2683
3510
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2684
3511
|
if (a) return a;
|
|
2685
|
-
const o = s.get("
|
|
2686
|
-
return this.getBehavior(e, t,
|
|
3512
|
+
const o = s.get("input-0").hasVoltage && s.get("input-1").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3513
|
+
return this.getBehavior(e, t, u, i);
|
|
2687
3514
|
}
|
|
2688
|
-
},
|
|
3515
|
+
}, fe = class extends P {
|
|
2689
3516
|
constructor() {
|
|
2690
|
-
super(
|
|
3517
|
+
super(c.Nand4Gate);
|
|
2691
3518
|
}
|
|
2692
3519
|
createInitialState(e) {
|
|
2693
3520
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Nand4GateBehavior: ${e.type}`);
|
|
2694
3521
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2695
|
-
return new
|
|
3522
|
+
return new _t(e.id, t);
|
|
2696
3523
|
}
|
|
2697
3524
|
onPinsChange(e, t, n, i) {
|
|
2698
3525
|
const s = this.getPinStates(e, n);
|
|
@@ -2701,17 +3528,17 @@ var Kt = class extends C {
|
|
|
2701
3528
|
if (r) return r;
|
|
2702
3529
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2703
3530
|
if (a) return a;
|
|
2704
|
-
const o = s.get("
|
|
2705
|
-
return this.getBehavior(e, t,
|
|
3531
|
+
const o = s.get("input-0").hasVoltage && s.get("input-1").hasVoltage && s.get("input-2").hasVoltage && s.get("input-3").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3532
|
+
return this.getBehavior(e, t, u, i);
|
|
2706
3533
|
}
|
|
2707
|
-
},
|
|
3534
|
+
}, ye = class extends P {
|
|
2708
3535
|
constructor() {
|
|
2709
|
-
super(
|
|
3536
|
+
super(c.Nand8Gate);
|
|
2710
3537
|
}
|
|
2711
3538
|
createInitialState(e) {
|
|
2712
3539
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Nand8GateBehavior: ${e.type}`);
|
|
2713
3540
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2714
|
-
return new
|
|
3541
|
+
return new Vt(e.id, t);
|
|
2715
3542
|
}
|
|
2716
3543
|
onPinsChange(e, t, n, i) {
|
|
2717
3544
|
const s = this.getPinStates(e, n);
|
|
@@ -2720,17 +3547,17 @@ var Kt = class extends C {
|
|
|
2720
3547
|
if (r) return r;
|
|
2721
3548
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2722
3549
|
if (a) return a;
|
|
2723
|
-
const o = s.get("
|
|
2724
|
-
return this.getBehavior(e, t,
|
|
3550
|
+
const o = s.get("input-0").hasVoltage && s.get("input-1").hasVoltage && s.get("input-2").hasVoltage && s.get("input-3").hasVoltage && s.get("input-4").hasVoltage && s.get("input-5").hasVoltage && s.get("input-6").hasVoltage && s.get("input-7").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3551
|
+
return this.getBehavior(e, t, u, i);
|
|
2725
3552
|
}
|
|
2726
|
-
},
|
|
3553
|
+
}, ve = class extends P {
|
|
2727
3554
|
constructor() {
|
|
2728
|
-
super(
|
|
3555
|
+
super(c.NorGate);
|
|
2729
3556
|
}
|
|
2730
3557
|
createInitialState(e) {
|
|
2731
3558
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for NorGateBehavior: ${e.type}`);
|
|
2732
3559
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2733
|
-
return new
|
|
3560
|
+
return new $t(e.id, t);
|
|
2734
3561
|
}
|
|
2735
3562
|
onPinsChange(e, t, n, i) {
|
|
2736
3563
|
const s = this.getPinStates(e, n);
|
|
@@ -2739,17 +3566,17 @@ var Kt = class extends C {
|
|
|
2739
3566
|
if (r) return r;
|
|
2740
3567
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2741
3568
|
if (a) return a;
|
|
2742
|
-
const o = s.get("
|
|
2743
|
-
return this.getBehavior(e, t,
|
|
3569
|
+
const o = s.get("input-0").hasVoltage || s.get("input-1").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3570
|
+
return this.getBehavior(e, t, u, i);
|
|
2744
3571
|
}
|
|
2745
|
-
},
|
|
3572
|
+
}, Se = class extends P {
|
|
2746
3573
|
constructor() {
|
|
2747
|
-
super(
|
|
3574
|
+
super(c.Nor4Gate);
|
|
2748
3575
|
}
|
|
2749
3576
|
createInitialState(e) {
|
|
2750
3577
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Nor4GateBehavior: ${e.type}`);
|
|
2751
3578
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2752
|
-
return new
|
|
3579
|
+
return new Wt(e.id, t);
|
|
2753
3580
|
}
|
|
2754
3581
|
onPinsChange(e, t, n, i) {
|
|
2755
3582
|
const s = this.getPinStates(e, n);
|
|
@@ -2758,17 +3585,17 @@ var Kt = class extends C {
|
|
|
2758
3585
|
if (r) return r;
|
|
2759
3586
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2760
3587
|
if (a) return a;
|
|
2761
|
-
const o = s.get("
|
|
2762
|
-
return this.getBehavior(e, t,
|
|
3588
|
+
const o = s.get("input-0").hasVoltage || s.get("input-1").hasVoltage || s.get("input-2").hasVoltage || s.get("input-3").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3589
|
+
return this.getBehavior(e, t, u, i);
|
|
2763
3590
|
}
|
|
2764
|
-
},
|
|
3591
|
+
}, we = class extends P {
|
|
2765
3592
|
constructor() {
|
|
2766
|
-
super(
|
|
3593
|
+
super(c.Nor8Gate);
|
|
2767
3594
|
}
|
|
2768
3595
|
createInitialState(e) {
|
|
2769
3596
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Nor8GateBehavior: ${e.type}`);
|
|
2770
3597
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2771
|
-
return new
|
|
3598
|
+
return new Rt(e.id, t);
|
|
2772
3599
|
}
|
|
2773
3600
|
onPinsChange(e, t, n, i) {
|
|
2774
3601
|
const s = this.getPinStates(e, n);
|
|
@@ -2777,17 +3604,17 @@ var Kt = class extends C {
|
|
|
2777
3604
|
if (r) return r;
|
|
2778
3605
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2779
3606
|
if (a) return a;
|
|
2780
|
-
const o = s.get("
|
|
2781
|
-
return this.getBehavior(e, t,
|
|
3607
|
+
const o = s.get("input-0").hasVoltage || s.get("input-1").hasVoltage || s.get("input-2").hasVoltage || s.get("input-3").hasVoltage || s.get("input-4").hasVoltage || s.get("input-5").hasVoltage || s.get("input-6").hasVoltage || s.get("input-7").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3608
|
+
return this.getBehavior(e, t, u, i);
|
|
2782
3609
|
}
|
|
2783
|
-
},
|
|
3610
|
+
}, me = class extends P {
|
|
2784
3611
|
constructor() {
|
|
2785
|
-
super(
|
|
3612
|
+
super(c.XorGate);
|
|
2786
3613
|
}
|
|
2787
3614
|
createInitialState(e) {
|
|
2788
3615
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for XorGateBehavior: ${e.type}`);
|
|
2789
3616
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2790
|
-
return new
|
|
3617
|
+
return new Ft(e.id, t);
|
|
2791
3618
|
}
|
|
2792
3619
|
onPinsChange(e, t, n, i) {
|
|
2793
3620
|
const s = this.getPinStates(e, n);
|
|
@@ -2796,17 +3623,17 @@ var Kt = class extends C {
|
|
|
2796
3623
|
if (r) return r;
|
|
2797
3624
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2798
3625
|
if (a) return a;
|
|
2799
|
-
const o = s.get("
|
|
2800
|
-
return this.getBehavior(e, t,
|
|
3626
|
+
const o = s.get("input-0").hasVoltage !== s.get("input-1").hasVoltage, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3627
|
+
return this.getBehavior(e, t, u, i);
|
|
2801
3628
|
}
|
|
2802
|
-
},
|
|
3629
|
+
}, be = class extends P {
|
|
2803
3630
|
constructor() {
|
|
2804
|
-
super(
|
|
3631
|
+
super(c.Xor4Gate);
|
|
2805
3632
|
}
|
|
2806
3633
|
createInitialState(e) {
|
|
2807
3634
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Xor4GateBehavior: ${e.type}`);
|
|
2808
3635
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2809
|
-
return new
|
|
3636
|
+
return new Ht(e.id, t);
|
|
2810
3637
|
}
|
|
2811
3638
|
onPinsChange(e, t, n, i) {
|
|
2812
3639
|
const s = this.getPinStates(e, n);
|
|
@@ -2815,17 +3642,17 @@ var Kt = class extends C {
|
|
|
2815
3642
|
if (r) return r;
|
|
2816
3643
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2817
3644
|
if (a) return a;
|
|
2818
|
-
const o = ((s.get("
|
|
2819
|
-
return this.getBehavior(e, t,
|
|
3645
|
+
const o = ((s.get("input-0").hasVoltage ? 1 : 0) + (s.get("input-1").hasVoltage ? 1 : 0) + (s.get("input-2").hasVoltage ? 1 : 0) + (s.get("input-3").hasVoltage ? 1 : 0)) % 2 === 1, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3646
|
+
return this.getBehavior(e, t, u, i);
|
|
2820
3647
|
}
|
|
2821
|
-
},
|
|
3648
|
+
}, Ce = class extends P {
|
|
2822
3649
|
constructor() {
|
|
2823
|
-
super(
|
|
3650
|
+
super(c.Xor8Gate);
|
|
2824
3651
|
}
|
|
2825
3652
|
createInitialState(e) {
|
|
2826
3653
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for Xor8GateBehavior: ${e.type}`);
|
|
2827
3654
|
const t = e.config.get("activationLogic") === "negative" ? "high" : "low";
|
|
2828
|
-
return new
|
|
3655
|
+
return new Jt(e.id, t);
|
|
2829
3656
|
}
|
|
2830
3657
|
onPinsChange(e, t, n, i) {
|
|
2831
3658
|
const s = this.getPinStates(e, n);
|
|
@@ -2834,10 +3661,10 @@ var Kt = class extends C {
|
|
|
2834
3661
|
if (r) return r;
|
|
2835
3662
|
const a = this.nonLogicInputGuardBehavior(t, s, i);
|
|
2836
3663
|
if (a) return a;
|
|
2837
|
-
const o = ((s.get("
|
|
2838
|
-
return this.getBehavior(e, t,
|
|
3664
|
+
const o = ((s.get("input-0").hasVoltage ? 1 : 0) + (s.get("input-1").hasVoltage ? 1 : 0) + (s.get("input-2").hasVoltage ? 1 : 0) + (s.get("input-3").hasVoltage ? 1 : 0) + (s.get("input-4").hasVoltage ? 1 : 0) + (s.get("input-5").hasVoltage ? 1 : 0) + (s.get("input-6").hasVoltage ? 1 : 0) + (s.get("input-7").hasVoltage ? 1 : 0)) % 2 === 1, u = e.config.get("activationLogic") === "negative" ? !o : o;
|
|
3665
|
+
return this.getBehavior(e, t, u, i);
|
|
2839
3666
|
}
|
|
2840
|
-
},
|
|
3667
|
+
}, A = class extends C {
|
|
2841
3668
|
onPinsChange(e, t, n, i) {
|
|
2842
3669
|
const s = this.getPinStates(e, n);
|
|
2843
3670
|
t.pinStates = s;
|
|
@@ -2845,8 +3672,8 @@ var Kt = class extends C {
|
|
|
2845
3672
|
if (a) return a;
|
|
2846
3673
|
const o = this.nonLogicInputGuardBehavior(r, s, i);
|
|
2847
3674
|
if (o) return o;
|
|
2848
|
-
const
|
|
2849
|
-
return this.scheduleTransition(e, r,
|
|
3675
|
+
const u = this.computeTargetStableState(s);
|
|
3676
|
+
return this.scheduleTransition(e, r, u, i);
|
|
2850
3677
|
}
|
|
2851
3678
|
onEventFiring(e, t, n) {
|
|
2852
3679
|
if (!n.type.startsWith("to")) return this.noChange(t);
|
|
@@ -2864,12 +3691,12 @@ var Kt = class extends C {
|
|
|
2864
3691
|
if (r === "indeterminate") return !1;
|
|
2865
3692
|
const a = e.getPinMetadata(i), o = e.getPinMetadata(s);
|
|
2866
3693
|
if (!a || !o) return !1;
|
|
2867
|
-
let
|
|
2868
|
-
if (a.subtype === "logicOutput" && (
|
|
2869
|
-
let
|
|
2870
|
-
if (
|
|
3694
|
+
let u, l = 0;
|
|
3695
|
+
if (a.subtype === "logicOutput" && (l++, u = a), o.subtype === "logicOutput" && (l++, u = o), l !== 1 || !u?.logicPinData) return !1;
|
|
3696
|
+
let p = 0;
|
|
3697
|
+
if (p += a.subtype === "vcc" ? 1 : a.subtype === "gnd" ? -1 : 0, p += o.subtype === "vcc" ? 1 : o.subtype === "gnd" ? -1 : 0, p !== 1 && p !== -1) return !1;
|
|
2871
3698
|
const d = t;
|
|
2872
|
-
return (parseInt(r, 16) >> (
|
|
3699
|
+
return (parseInt(r, 16) >> (u.logicPinData.interface === "sum" ? u.logicPinData.index * 2 : d.outputCount - 1) & 1) === 1 ? p === 1 : p === -1;
|
|
2873
3700
|
}
|
|
2874
3701
|
vccGuardBehavior(e, t, n) {
|
|
2875
3702
|
if (t.get("vcc").hasVoltage) return null;
|
|
@@ -2911,8 +3738,8 @@ var Kt = class extends C {
|
|
|
2911
3738
|
scheduleTransition(e, t, n, i) {
|
|
2912
3739
|
const s = `to${n}`;
|
|
2913
3740
|
if (t.state === n || t.state === s) return this.noChange(t);
|
|
2914
|
-
const r = x(e.config), a = t.expirationTick < 1 ? r : Math.max(i - t.startTick, 1), o = t.effectiveState,
|
|
2915
|
-
return t.setState(s, i), t.setNextState(n, i + a), t.parameters.set("prevState",
|
|
3741
|
+
const r = x(e.config), a = t.expirationTick < 1 ? r : Math.max(i - t.startTick, 1), o = t.effectiveState, u = o === "indeterminate" ? t.allLowState : o;
|
|
3742
|
+
return t.setState(s, i), t.setNextState(n, i + a), t.parameters.set("prevState", u), {
|
|
2916
3743
|
componentState: t,
|
|
2917
3744
|
hasChanged: !0,
|
|
2918
3745
|
shouldCancelPending: !0,
|
|
@@ -2933,37 +3760,37 @@ var Kt = class extends C {
|
|
|
2933
3760
|
scheduledEvents: []
|
|
2934
3761
|
};
|
|
2935
3762
|
}
|
|
2936
|
-
},
|
|
3763
|
+
}, Pe = class extends A {
|
|
2937
3764
|
constructor() {
|
|
2938
|
-
super(
|
|
3765
|
+
super(c.HalfAdder);
|
|
2939
3766
|
}
|
|
2940
3767
|
createInitialState(e) {
|
|
2941
3768
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for HalfAdderBehavior: ${e.type}`);
|
|
2942
|
-
return new
|
|
3769
|
+
return new Ut(e.id, "0");
|
|
2943
3770
|
}
|
|
2944
3771
|
computeTargetStableState(e) {
|
|
2945
3772
|
const t = e.get("inputA").hasVoltage, n = e.get("inputB").hasVoltage;
|
|
2946
3773
|
return ((t !== n ? 1 : 0) | (t && n ? 2 : 0)).toString(16);
|
|
2947
3774
|
}
|
|
2948
|
-
},
|
|
3775
|
+
}, xe = class extends A {
|
|
2949
3776
|
constructor() {
|
|
2950
|
-
super(
|
|
3777
|
+
super(c.Adder);
|
|
2951
3778
|
}
|
|
2952
3779
|
createInitialState(e) {
|
|
2953
3780
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for AdderBehavior: ${e.type}`);
|
|
2954
|
-
return new
|
|
3781
|
+
return new Xt(e.id, "0");
|
|
2955
3782
|
}
|
|
2956
3783
|
computeTargetStableState(e) {
|
|
2957
3784
|
const t = e.get("inputA").hasVoltage, n = e.get("inputB").hasVoltage, i = e.get("carryIn").hasVoltage, s = (t ? 1 : 0) + (n ? 1 : 0) + (i ? 1 : 0);
|
|
2958
3785
|
return ((s % 2 === 1 ? 1 : 0) | (s >= 2 ? 2 : 0)).toString(16);
|
|
2959
3786
|
}
|
|
2960
|
-
},
|
|
3787
|
+
}, M = 8, Ie = class extends A {
|
|
2961
3788
|
constructor() {
|
|
2962
|
-
super(
|
|
3789
|
+
super(c.EightBitAdder);
|
|
2963
3790
|
}
|
|
2964
3791
|
createInitialState(e) {
|
|
2965
3792
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for EightBitAdderBehavior: ${e.type}`);
|
|
2966
|
-
return new
|
|
3793
|
+
return new Qt(e.id, "0000");
|
|
2967
3794
|
}
|
|
2968
3795
|
onPinsChange(e, t, n, i) {
|
|
2969
3796
|
const s = this.getPinStates(e, n);
|
|
@@ -2973,19 +3800,19 @@ var Kt = class extends C {
|
|
|
2973
3800
|
const o = this.nonLogicInputGuardBehavior(r, s, i);
|
|
2974
3801
|
if (o) return o;
|
|
2975
3802
|
if (i === 0) {
|
|
2976
|
-
const
|
|
2977
|
-
return this.scheduleTransition(e, r,
|
|
3803
|
+
const y = this.computeTargetStableState(s);
|
|
3804
|
+
return this.scheduleTransition(e, r, y, i);
|
|
2978
3805
|
}
|
|
2979
|
-
const
|
|
3806
|
+
const u = r.effectiveState, l = u === "indeterminate" ? 0 : parseInt(u, 16), p = s.get("carryIn").hasVoltage;
|
|
2980
3807
|
let d = 0;
|
|
2981
|
-
for (let
|
|
2982
|
-
const S = s.get(`inputA-${
|
|
2983
|
-
d =
|
|
3808
|
+
for (let y = 0; y < M; y++) {
|
|
3809
|
+
const S = s.get(`inputA-${y}`).hasVoltage, T = s.get(`inputB-${y}`).hasVoltage, { sum: E, carry: ft } = W(S, T, y === 0 ? p : (l >> 2 * (y - 1) + 1 & 1) === 1);
|
|
3810
|
+
d = R(d, y, E, ft);
|
|
2984
3811
|
}
|
|
2985
|
-
const
|
|
2986
|
-
if (
|
|
2987
|
-
const f = x(e.config), v =
|
|
2988
|
-
return r.setState(`to${
|
|
3812
|
+
const g = F(d);
|
|
3813
|
+
if (g === u) return this.noChange(t);
|
|
3814
|
+
const f = x(e.config), v = u === "indeterminate" ? r.allLowState : u;
|
|
3815
|
+
return r.setState(`to${g}`, i), r.setNextState(g, i + f), r.parameters.set("prevState", v), {
|
|
2989
3816
|
componentState: r,
|
|
2990
3817
|
hasChanged: !0,
|
|
2991
3818
|
shouldCancelPending: !0,
|
|
@@ -2993,37 +3820,37 @@ var Kt = class extends C {
|
|
|
2993
3820
|
targetId: e.id,
|
|
2994
3821
|
scheduledAtTick: i,
|
|
2995
3822
|
readyAtTick: i + f,
|
|
2996
|
-
type: `to${
|
|
3823
|
+
type: `to${g}`,
|
|
2997
3824
|
parameters: /* @__PURE__ */ new Map([["nextStage", "1"]])
|
|
2998
3825
|
}]
|
|
2999
3826
|
};
|
|
3000
3827
|
}
|
|
3001
3828
|
onEventFiring(e, t, n) {
|
|
3002
3829
|
if (!n.type.startsWith("to")) return this.noChange(t);
|
|
3003
|
-
const i = n.type.slice(2), s = parseInt(n.parameters?.get("nextStage") ?? `${
|
|
3830
|
+
const i = n.type.slice(2), s = parseInt(n.parameters?.get("nextStage") ?? `${M}`), r = t;
|
|
3004
3831
|
if (r.state === i) return this.noChange(r);
|
|
3005
|
-
if (r.setState(i, n.readyAtTick), r.parameters.delete("prevState"), s >=
|
|
3832
|
+
if (r.setState(i, n.readyAtTick), r.parameters.delete("prevState"), s >= M) return {
|
|
3006
3833
|
componentState: r,
|
|
3007
3834
|
hasChanged: !0,
|
|
3008
3835
|
shouldCancelPending: !1,
|
|
3009
3836
|
scheduledEvents: []
|
|
3010
3837
|
};
|
|
3011
|
-
const a = parseInt(i, 16), o = (a >> 2 * (s - 1) + 1 & 1) === 1,
|
|
3012
|
-
if (
|
|
3838
|
+
const a = parseInt(i, 16), o = (a >> 2 * (s - 1) + 1 & 1) === 1, u = r.pinStates.get(`inputA-${s}`).hasVoltage, l = r.pinStates.get(`inputB-${s}`).hasVoltage, { sum: p, carry: d } = W(u, l, o), g = (a >> 2 * s & 1) === 1, f = (a >> 2 * s + 1 & 1) === 1;
|
|
3839
|
+
if (p === g && d === f) return {
|
|
3013
3840
|
componentState: r,
|
|
3014
3841
|
hasChanged: !0,
|
|
3015
3842
|
shouldCancelPending: !1,
|
|
3016
3843
|
scheduledEvents: []
|
|
3017
3844
|
};
|
|
3018
|
-
const v =
|
|
3019
|
-
return r.setState(`to${v}`, n.readyAtTick), r.setNextState(v, n.readyAtTick +
|
|
3845
|
+
const v = F(R(a, s, p, d)), y = x(e.config);
|
|
3846
|
+
return r.setState(`to${v}`, n.readyAtTick), r.setNextState(v, n.readyAtTick + y), r.parameters.set("prevState", i), {
|
|
3020
3847
|
componentState: r,
|
|
3021
3848
|
hasChanged: !0,
|
|
3022
3849
|
shouldCancelPending: !1,
|
|
3023
3850
|
scheduledEvents: [{
|
|
3024
3851
|
targetId: e.id,
|
|
3025
3852
|
scheduledAtTick: n.readyAtTick,
|
|
3026
|
-
readyAtTick: n.readyAtTick +
|
|
3853
|
+
readyAtTick: n.readyAtTick + y,
|
|
3027
3854
|
type: `to${v}`,
|
|
3028
3855
|
parameters: /* @__PURE__ */ new Map([["nextStage", `${s + 1}`]])
|
|
3029
3856
|
}]
|
|
@@ -3031,34 +3858,34 @@ var Kt = class extends C {
|
|
|
3031
3858
|
}
|
|
3032
3859
|
computeTargetStableState(e) {
|
|
3033
3860
|
let t = e.get("carryIn").hasVoltage, n = 0;
|
|
3034
|
-
for (let i = 0; i <
|
|
3035
|
-
const s = e.get(`inputA-${i}`).hasVoltage, r = e.get(`inputB-${i}`).hasVoltage, a =
|
|
3036
|
-
n =
|
|
3861
|
+
for (let i = 0; i < M; i++) {
|
|
3862
|
+
const s = e.get(`inputA-${i}`).hasVoltage, r = e.get(`inputB-${i}`).hasVoltage, a = W(s, r, t);
|
|
3863
|
+
n = R(n, i, a.sum, a.carry), t = a.carry;
|
|
3037
3864
|
}
|
|
3038
|
-
return
|
|
3865
|
+
return F(n);
|
|
3039
3866
|
}
|
|
3040
3867
|
};
|
|
3041
|
-
function
|
|
3868
|
+
function W(e, t, n) {
|
|
3042
3869
|
return {
|
|
3043
3870
|
sum: e !== t !== n,
|
|
3044
3871
|
carry: e && t || e && n || t && n
|
|
3045
3872
|
};
|
|
3046
3873
|
}
|
|
3047
|
-
function
|
|
3874
|
+
function R(e, t, n, i) {
|
|
3048
3875
|
const s = 2 * t, r = s + 1;
|
|
3049
3876
|
let a = e;
|
|
3050
3877
|
return a = a & ~(1 << s) | (n ? 1 : 0) << s, a = a & ~(1 << r) | (i ? 1 : 0) << r, a;
|
|
3051
3878
|
}
|
|
3052
|
-
function
|
|
3879
|
+
function F(e) {
|
|
3053
3880
|
return e.toString(16).padStart(4, "0");
|
|
3054
3881
|
}
|
|
3055
|
-
var
|
|
3882
|
+
var Z = 8, Te = class extends A {
|
|
3056
3883
|
constructor() {
|
|
3057
|
-
super(
|
|
3884
|
+
super(c.EightBitOnesComplement);
|
|
3058
3885
|
}
|
|
3059
3886
|
createInitialState(e) {
|
|
3060
3887
|
if (e.type !== this._componentType) throw new Error(`Invalid component type for EightBitOnesComplementBehavior: ${e.type}`);
|
|
3061
|
-
return new
|
|
3888
|
+
return new qt(e.id, "000");
|
|
3062
3889
|
}
|
|
3063
3890
|
allowConductivity(e, t, n, i, s) {
|
|
3064
3891
|
if (i === s) return !0;
|
|
@@ -3066,18 +3893,274 @@ var U = 8, ge = class extends B {
|
|
|
3066
3893
|
if (r === "indeterminate") return !1;
|
|
3067
3894
|
const a = e.getPinMetadata(i), o = e.getPinMetadata(s);
|
|
3068
3895
|
if (!a || !o) return !1;
|
|
3069
|
-
let
|
|
3070
|
-
if (a.subtype === "logicOutput" && (
|
|
3071
|
-
let
|
|
3072
|
-
return
|
|
3896
|
+
let u, l = 0;
|
|
3897
|
+
if (a.subtype === "logicOutput" && (l++, u = a), o.subtype === "logicOutput" && (l++, u = o), l !== 1 || !u?.logicPinData) return !1;
|
|
3898
|
+
let p = 0;
|
|
3899
|
+
return p += a.subtype === "vcc" ? 1 : a.subtype === "gnd" ? -1 : 0, p += o.subtype === "vcc" ? 1 : o.subtype === "gnd" ? -1 : 0, p !== 1 && p !== -1 ? !1 : (parseInt(r, 16) >> u.logicPinData.index & 1) === 1 ? p === 1 : p === -1;
|
|
3073
3900
|
}
|
|
3074
3901
|
computeTargetStableState(e) {
|
|
3075
3902
|
const t = e.get("invert").hasVoltage;
|
|
3076
3903
|
let n = 0;
|
|
3077
|
-
for (let i = 0; i <
|
|
3078
|
-
return t && (n |= 1 <<
|
|
3904
|
+
for (let i = 0; i < Z; i++) e.get(`input-${i}`).hasVoltage !== t && (n |= 1 << i);
|
|
3905
|
+
return t && (n |= 1 << Z), n.toString(16).padStart(3, "0");
|
|
3906
|
+
}
|
|
3907
|
+
}, k = class extends C {
|
|
3908
|
+
onPinsChange(e, t, n, i) {
|
|
3909
|
+
const s = this.getPinStates(e, n);
|
|
3910
|
+
t.pinStates = s;
|
|
3911
|
+
const r = t;
|
|
3912
|
+
return s.get("vcc").hasVoltage ? this.noChange(t) : r.state === r.allLowState && r.parameters.size === 0 ? this.noChange(t) : (r.parameters.clear(), r.setState(r.allLowState, i), {
|
|
3913
|
+
componentState: r,
|
|
3914
|
+
hasChanged: !0,
|
|
3915
|
+
shouldCancelPending: !0,
|
|
3916
|
+
scheduledEvents: []
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
onUserCommand(e, t, n) {
|
|
3920
|
+
if (n.type !== "toggle_switch") return this.noChange(t);
|
|
3921
|
+
const i = t, s = n.parameters?.get("index");
|
|
3922
|
+
if (s === void 0) return this.noChange(t);
|
|
3923
|
+
const r = parseInt(s, 10);
|
|
3924
|
+
if (isNaN(r) || r < 0 || r >= i.outputCount) return this.noChange(t);
|
|
3925
|
+
const a = i.pinStates.get("vcc");
|
|
3926
|
+
if (a && !a.hasVoltage) return this.noChange(t);
|
|
3927
|
+
if (i.parameters.has(String(r))) return this.noChange(t);
|
|
3928
|
+
const o = n.scheduledAtTick, u = o + x(e.config), l = i.effectiveState, p = (parseInt(l, 16) >> r & 1) === 0 ? 1 : 0;
|
|
3929
|
+
return i.isInTransition || (i.parameters.set("prevState", l), i.setState("moving", o)), i.parameters.set(String(r), `${p}-${o}-${u}`), {
|
|
3930
|
+
componentState: i,
|
|
3931
|
+
hasChanged: !0,
|
|
3932
|
+
shouldCancelPending: !1,
|
|
3933
|
+
scheduledEvents: [{
|
|
3934
|
+
targetId: e.id,
|
|
3935
|
+
scheduledAtTick: o,
|
|
3936
|
+
readyAtTick: u,
|
|
3937
|
+
type: "switchChanged",
|
|
3938
|
+
parameters: /* @__PURE__ */ new Map([["index", String(r)], ["target", String(p)]])
|
|
3939
|
+
}]
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3942
|
+
onEventFiring(e, t, n) {
|
|
3943
|
+
if (n.type !== "switchChanged") return this.noChange(t);
|
|
3944
|
+
const i = t, s = n.parameters?.get("index"), r = n.parameters?.get("target");
|
|
3945
|
+
if (s === void 0 || r === void 0) return this.noChange(t);
|
|
3946
|
+
const a = parseInt(s, 10);
|
|
3947
|
+
if (isNaN(a) || !i.parameters.has(String(a))) return this.noChange(t);
|
|
3948
|
+
const o = parseInt(r, 10) === 1 ? 1 : 0, u = i.parameters.get("prevState") ?? i.allLowState;
|
|
3949
|
+
let l = parseInt(u, 16);
|
|
3950
|
+
l = l & ~(1 << a) | o << a;
|
|
3951
|
+
const p = l.toString(16).padStart(i.hexDigitCount, "0");
|
|
3952
|
+
return i.parameters.delete(String(a)), Array.from(i.parameters.keys()).some((d) => d !== "prevState") ? (i.parameters.set("prevState", p), {
|
|
3953
|
+
componentState: i,
|
|
3954
|
+
hasChanged: !0,
|
|
3955
|
+
shouldCancelPending: !1,
|
|
3956
|
+
scheduledEvents: []
|
|
3957
|
+
}) : (i.parameters.delete("prevState"), i.setState(p, n.readyAtTick), {
|
|
3958
|
+
componentState: i,
|
|
3959
|
+
hasChanged: !0,
|
|
3960
|
+
shouldCancelPending: !1,
|
|
3961
|
+
scheduledEvents: []
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
allowConductivity(e, t, n, i, s) {
|
|
3965
|
+
if (i === s) return !0;
|
|
3966
|
+
const r = t, a = e.getPinMetadata(i), o = e.getPinMetadata(s);
|
|
3967
|
+
if (!a || !o) return !1;
|
|
3968
|
+
let u, l = 0;
|
|
3969
|
+
if (a.subtype === "logicOutput" && (l++, u = a), o.subtype === "logicOutput" && (l++, u = o), l !== 1 || !u?.logicPinData) return !1;
|
|
3970
|
+
let p = 0;
|
|
3971
|
+
return p += a.subtype === "vcc" ? 1 : a.subtype === "gnd" ? -1 : 0, p += o.subtype === "vcc" ? 1 : o.subtype === "gnd" ? -1 : 0, p !== 1 && p !== -1 ? !1 : r.isOutputHigh(u.logicPinData.index) ? p === 1 : p === -1;
|
|
3972
|
+
}
|
|
3973
|
+
noChange(e) {
|
|
3974
|
+
return {
|
|
3975
|
+
componentState: e,
|
|
3976
|
+
hasChanged: !1,
|
|
3977
|
+
shouldCancelPending: !1,
|
|
3978
|
+
scheduledEvents: []
|
|
3979
|
+
};
|
|
3980
|
+
}
|
|
3981
|
+
}, Oe = class extends k {
|
|
3982
|
+
constructor() {
|
|
3983
|
+
super(c.OneInput);
|
|
3984
|
+
}
|
|
3985
|
+
createInitialState(e) {
|
|
3986
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for OneInputBehavior: ${e.type}`);
|
|
3987
|
+
const t = e.config.get("initialState") || "0";
|
|
3988
|
+
return new Kt(e.id, t);
|
|
3989
|
+
}
|
|
3990
|
+
}, Ee = class extends k {
|
|
3991
|
+
constructor() {
|
|
3992
|
+
super(c.TwoInput);
|
|
3993
|
+
}
|
|
3994
|
+
createInitialState(e) {
|
|
3995
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for TwoInputBehavior: ${e.type}`);
|
|
3996
|
+
const t = e.config.get("initialState") || "0";
|
|
3997
|
+
return new Yt(e.id, t);
|
|
3998
|
+
}
|
|
3999
|
+
}, De = class extends k {
|
|
4000
|
+
constructor() {
|
|
4001
|
+
super(c.FourInput);
|
|
4002
|
+
}
|
|
4003
|
+
createInitialState(e) {
|
|
4004
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for FourInputBehavior: ${e.type}`);
|
|
4005
|
+
const t = e.config.get("initialState") || "0";
|
|
4006
|
+
return new Zt(e.id, t);
|
|
4007
|
+
}
|
|
4008
|
+
}, Ne = class extends k {
|
|
4009
|
+
constructor() {
|
|
4010
|
+
super(c.EightInput);
|
|
4011
|
+
}
|
|
4012
|
+
createInitialState(e) {
|
|
4013
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for EightInputBehavior: ${e.type}`);
|
|
4014
|
+
const t = e.config.get("initialState") || "00";
|
|
4015
|
+
return new jt(e.id, t);
|
|
4016
|
+
}
|
|
4017
|
+
}, G = class extends C {
|
|
4018
|
+
onPinsChange(e, t, n, i) {
|
|
4019
|
+
const s = this.getPinStates(e, n);
|
|
4020
|
+
t.pinStates = s;
|
|
4021
|
+
const r = t, a = this.vccGuardBehavior(r, s, i);
|
|
4022
|
+
if (a) return a;
|
|
4023
|
+
const o = this.nonLogicInputGuardBehavior(r, s, i);
|
|
4024
|
+
return o || this.scheduleInputTransitions(e, r, s, i);
|
|
4025
|
+
}
|
|
4026
|
+
onEventFiring(e, t, n) {
|
|
4027
|
+
if (n.type !== "lightChanged") return this.noChange(t);
|
|
4028
|
+
const i = t, s = n.parameters?.get("index"), r = n.parameters?.get("target");
|
|
4029
|
+
if (s === void 0 || r === void 0) return this.noChange(t);
|
|
4030
|
+
const a = parseInt(s, 10);
|
|
4031
|
+
if (isNaN(a)) return this.noChange(t);
|
|
4032
|
+
const o = i.getPendingMove(a);
|
|
4033
|
+
if (!o) return this.noChange(t);
|
|
4034
|
+
if (o.endTick !== n.readyAtTick) return this.noChange(t);
|
|
4035
|
+
const u = o.target, l = i.parameters.get("prevState") ?? i.allLowState;
|
|
4036
|
+
let p = parseInt(l, 16);
|
|
4037
|
+
p = p & ~(1 << a) | u << a;
|
|
4038
|
+
const d = p.toString(16).padStart(i.hexDigitCount, "0");
|
|
4039
|
+
return i.parameters.delete(String(a)), Array.from(i.parameters.keys()).some((g) => g !== "prevState") ? (i.parameters.set("prevState", d), {
|
|
4040
|
+
componentState: i,
|
|
4041
|
+
hasChanged: !0,
|
|
4042
|
+
shouldCancelPending: !1,
|
|
4043
|
+
scheduledEvents: []
|
|
4044
|
+
}) : (i.parameters.delete("prevState"), i.setState(d, n.readyAtTick), {
|
|
4045
|
+
componentState: i,
|
|
4046
|
+
hasChanged: !0,
|
|
4047
|
+
shouldCancelPending: !1,
|
|
4048
|
+
scheduledEvents: []
|
|
4049
|
+
});
|
|
4050
|
+
}
|
|
4051
|
+
allowConductivity(e, t, n, i, s) {
|
|
4052
|
+
if (i === s) return !0;
|
|
4053
|
+
const r = t;
|
|
4054
|
+
if (r.effectiveState === "indeterminate") return !1;
|
|
4055
|
+
const a = e.getPinMetadata(i), o = e.getPinMetadata(s);
|
|
4056
|
+
if (!a || !o) return !1;
|
|
4057
|
+
let u, l = 0;
|
|
4058
|
+
if (a.subtype === "logicOutput" && (l++, u = a), o.subtype === "logicOutput" && (l++, u = o), l !== 1 || !u?.logicPinData) return !1;
|
|
4059
|
+
let p = 0;
|
|
4060
|
+
return p += a.subtype === "vcc" ? 1 : a.subtype === "gnd" ? -1 : 0, p += o.subtype === "vcc" ? 1 : o.subtype === "gnd" ? -1 : 0, p !== 1 && p !== -1 ? !1 : r.isOutputHigh(u.logicPinData.index) ? p === 1 : p === -1;
|
|
4061
|
+
}
|
|
4062
|
+
vccGuardBehavior(e, t, n) {
|
|
4063
|
+
return t.get("vcc").hasVoltage ? null : e.state === e.allLowState && e.parameters.size === 0 ? this.noChange(e) : (e.parameters.clear(), e.setState(e.allLowState, n), {
|
|
4064
|
+
componentState: e,
|
|
4065
|
+
hasChanged: !0,
|
|
4066
|
+
shouldCancelPending: !0,
|
|
4067
|
+
scheduledEvents: []
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
4070
|
+
nonLogicInputGuardBehavior(e, t, n) {
|
|
4071
|
+
const i = this.typeMetadata.pins;
|
|
4072
|
+
let s = !1;
|
|
4073
|
+
for (const [r, a] of t) {
|
|
4074
|
+
const o = i.get(r);
|
|
4075
|
+
if (!(!o || o.subtype !== "logicInput") && (a.hasVoltage && a.hasCurrent || !a.hasVoltage && !a.hasCurrent)) {
|
|
4076
|
+
s = !0;
|
|
4077
|
+
break;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
return s ? e.state === "indeterminate" && e.parameters.size === 0 ? this.noChange(e) : (e.parameters.clear(), e.setState("indeterminate", n), {
|
|
4081
|
+
componentState: e,
|
|
4082
|
+
hasChanged: !0,
|
|
4083
|
+
shouldCancelPending: !0,
|
|
4084
|
+
scheduledEvents: []
|
|
4085
|
+
}) : null;
|
|
4086
|
+
}
|
|
4087
|
+
scheduleInputTransitions(e, t, n, i) {
|
|
4088
|
+
const s = x(e.config), r = t.effectiveState === "indeterminate" ? t.allLowState : t.effectiveState, a = parseInt(r, 16), o = [];
|
|
4089
|
+
let u = !1;
|
|
4090
|
+
for (let l = 0; l < t.lightCount; l++) {
|
|
4091
|
+
const p = n.get(`input-${l}`);
|
|
4092
|
+
if (!p) continue;
|
|
4093
|
+
const d = p.hasVoltage ? 1 : 0, g = t.getPendingMove(l), f = a >> l & 1;
|
|
4094
|
+
if (g) {
|
|
4095
|
+
if (g.target === d) continue;
|
|
4096
|
+
const S = Math.max(g.endTick - g.startTick, 1), T = i, E = T + S;
|
|
4097
|
+
t.parameters.set(String(l), `${d}-${T}-${E}`), o.push({
|
|
4098
|
+
targetId: e.id,
|
|
4099
|
+
scheduledAtTick: T,
|
|
4100
|
+
readyAtTick: E,
|
|
4101
|
+
type: "lightChanged",
|
|
4102
|
+
parameters: /* @__PURE__ */ new Map([["index", String(l)], ["target", String(d)]])
|
|
4103
|
+
}), u = !0;
|
|
4104
|
+
continue;
|
|
4105
|
+
}
|
|
4106
|
+
if (f === d) continue;
|
|
4107
|
+
const v = i, y = v + s;
|
|
4108
|
+
t.isInTransition || (t.parameters.set("prevState", r), t.setState("moving", v)), t.parameters.set(String(l), `${d}-${v}-${y}`), o.push({
|
|
4109
|
+
targetId: e.id,
|
|
4110
|
+
scheduledAtTick: v,
|
|
4111
|
+
readyAtTick: y,
|
|
4112
|
+
type: "lightChanged",
|
|
4113
|
+
parameters: /* @__PURE__ */ new Map([["index", String(l)], ["target", String(d)]])
|
|
4114
|
+
}), u = !0;
|
|
4115
|
+
}
|
|
4116
|
+
return u ? {
|
|
4117
|
+
componentState: t,
|
|
4118
|
+
hasChanged: !0,
|
|
4119
|
+
shouldCancelPending: !1,
|
|
4120
|
+
scheduledEvents: o
|
|
4121
|
+
} : this.noChange(t);
|
|
4122
|
+
}
|
|
4123
|
+
noChange(e) {
|
|
4124
|
+
return {
|
|
4125
|
+
componentState: e,
|
|
4126
|
+
hasChanged: !1,
|
|
4127
|
+
shouldCancelPending: !1,
|
|
4128
|
+
scheduledEvents: []
|
|
4129
|
+
};
|
|
4130
|
+
}
|
|
4131
|
+
}, Me = class extends G {
|
|
4132
|
+
constructor() {
|
|
4133
|
+
super(c.OneLight);
|
|
3079
4134
|
}
|
|
3080
|
-
|
|
4135
|
+
createInitialState(e) {
|
|
4136
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for OneLightBehavior: ${e.type}`);
|
|
4137
|
+
return new te(e.id, "0");
|
|
4138
|
+
}
|
|
4139
|
+
}, Le = class extends G {
|
|
4140
|
+
constructor() {
|
|
4141
|
+
super(c.TwoLight);
|
|
4142
|
+
}
|
|
4143
|
+
createInitialState(e) {
|
|
4144
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for TwoLightBehavior: ${e.type}`);
|
|
4145
|
+
return new ee(e.id, "0");
|
|
4146
|
+
}
|
|
4147
|
+
}, ze = class extends G {
|
|
4148
|
+
constructor() {
|
|
4149
|
+
super(c.FourLight);
|
|
4150
|
+
}
|
|
4151
|
+
createInitialState(e) {
|
|
4152
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for FourLightBehavior: ${e.type}`);
|
|
4153
|
+
return new ie(e.id, "0");
|
|
4154
|
+
}
|
|
4155
|
+
}, Be = class extends G {
|
|
4156
|
+
constructor() {
|
|
4157
|
+
super(c.EightLight);
|
|
4158
|
+
}
|
|
4159
|
+
createInitialState(e) {
|
|
4160
|
+
if (e.type !== this._componentType) throw new Error(`Invalid component type for EightLightBehavior: ${e.type}`);
|
|
4161
|
+
return new ne(e.id, "00");
|
|
4162
|
+
}
|
|
4163
|
+
}, Ae = class {
|
|
3081
4164
|
heap;
|
|
3082
4165
|
constructor() {
|
|
3083
4166
|
this.heap = [];
|
|
@@ -3139,7 +4222,7 @@ var U = 8, ge = class extends B {
|
|
|
3139
4222
|
const e = this.heap[0], t = this.heap.pop();
|
|
3140
4223
|
return this.heap.length > 0 && t && (this.heap[0] = t, this.bubbleDown(0)), e;
|
|
3141
4224
|
}
|
|
3142
|
-
},
|
|
4225
|
+
}, ke = class {
|
|
3143
4226
|
dirtyComponents;
|
|
3144
4227
|
dirtyWires;
|
|
3145
4228
|
dirtyEnodes;
|
|
@@ -3187,7 +4270,7 @@ var U = 8, ge = class extends B {
|
|
|
3187
4270
|
getDirtyEnodeCount() {
|
|
3188
4271
|
return this.dirtyEnodes.size;
|
|
3189
4272
|
}
|
|
3190
|
-
},
|
|
4273
|
+
}, Ge = class {
|
|
3191
4274
|
currentState;
|
|
3192
4275
|
history;
|
|
3193
4276
|
historyEnabled;
|
|
@@ -3195,7 +4278,7 @@ var U = 8, ge = class extends B {
|
|
|
3195
4278
|
historyWriteIndex;
|
|
3196
4279
|
constructor(e = !1, t = 1e3) {
|
|
3197
4280
|
if (t < 1) throw new RangeError(`historyLimit must be at least 1 (got ${t})`);
|
|
3198
|
-
this.historyEnabled = e, this.historyLimit = t, this.currentState = new
|
|
4281
|
+
this.historyEnabled = e, this.historyLimit = t, this.currentState = new Y(0), this.history = [], this.historyWriteIndex = 0;
|
|
3199
4282
|
}
|
|
3200
4283
|
getCurrentState() {
|
|
3201
4284
|
return this.currentState;
|
|
@@ -3226,7 +4309,7 @@ var U = 8, ge = class extends B {
|
|
|
3226
4309
|
this.history = [], this.historyWriteIndex = 0;
|
|
3227
4310
|
}
|
|
3228
4311
|
reset() {
|
|
3229
|
-
this.currentState = new
|
|
4312
|
+
this.currentState = new Y(0), this.clearHistory();
|
|
3230
4313
|
}
|
|
3231
4314
|
isHistoryEnabled() {
|
|
3232
4315
|
return this.historyEnabled;
|
|
@@ -3240,7 +4323,7 @@ var U = 8, ge = class extends B {
|
|
|
3240
4323
|
saveToHistory(e) {
|
|
3241
4324
|
this.history.length < this.historyLimit ? this.history.push(e) : (this.history[this.historyWriteIndex] = e, this.historyWriteIndex = (this.historyWriteIndex + 1) % this.historyLimit);
|
|
3242
4325
|
}
|
|
3243
|
-
},
|
|
4326
|
+
}, Xe = class {
|
|
3244
4327
|
circuit;
|
|
3245
4328
|
stateManager;
|
|
3246
4329
|
eventQueue;
|
|
@@ -3248,7 +4331,7 @@ var U = 8, ge = class extends B {
|
|
|
3248
4331
|
dirtyTracker;
|
|
3249
4332
|
behaviorRegistry;
|
|
3250
4333
|
constructor(e, t, n = {}) {
|
|
3251
|
-
this.circuit = e, this.behaviorRegistry = t, this.stateManager = new
|
|
4334
|
+
this.circuit = e, this.behaviorRegistry = t, this.stateManager = new Ge(n.enableHistory ?? !1, n.historyLimit ?? 1e3), this.eventQueue = new Ae(), this.commands = /* @__PURE__ */ new Map(), this.dirtyTracker = new ke();
|
|
3252
4335
|
try {
|
|
3253
4336
|
this.initializeState();
|
|
3254
4337
|
} catch (i) {
|
|
@@ -3313,110 +4396,110 @@ var U = 8, ge = class extends B {
|
|
|
3313
4396
|
}
|
|
3314
4397
|
initializeState() {
|
|
3315
4398
|
const e = this.stateManager.getCurrentState();
|
|
3316
|
-
for (const
|
|
3317
|
-
if (
|
|
3318
|
-
const
|
|
3319
|
-
if (!
|
|
3320
|
-
const
|
|
3321
|
-
e.componentStates.set(
|
|
4399
|
+
for (const u of this.circuit.getAllComponents()) {
|
|
4400
|
+
if (u.pins.length < 1) continue;
|
|
4401
|
+
const l = this.behaviorRegistry.get(u.type);
|
|
4402
|
+
if (!l) continue;
|
|
4403
|
+
const p = l.createInitialState(u);
|
|
4404
|
+
e.componentStates.set(u.id, p), this.dirtyTracker.markComponentDirty(u.id);
|
|
3322
4405
|
}
|
|
3323
|
-
for (const
|
|
3324
|
-
hasVoltage:
|
|
3325
|
-
hasCurrent:
|
|
3326
|
-
locked: !!
|
|
4406
|
+
for (const u of this.circuit.getAllENodes()) e.nodeStates.set(u.id, {
|
|
4407
|
+
hasVoltage: u.source === h.Voltage,
|
|
4408
|
+
hasCurrent: u.source === h.Current,
|
|
4409
|
+
locked: !!u.source
|
|
3327
4410
|
});
|
|
3328
|
-
for (const
|
|
4411
|
+
for (const u of this.circuit.getAllWires()) e.wireStates.set(u.id, {
|
|
3329
4412
|
hasVoltage: !1,
|
|
3330
4413
|
hasCurrent: !1,
|
|
3331
4414
|
locked: !1
|
|
3332
4415
|
});
|
|
3333
4416
|
const t = this.circuit.getAllComponents(), n = /* @__PURE__ */ new Map();
|
|
3334
|
-
for (const
|
|
3335
|
-
const
|
|
3336
|
-
|
|
4417
|
+
for (const u of t) {
|
|
4418
|
+
const l = this.getInitializationOrder(u.config), p = n.get(l) ?? [];
|
|
4419
|
+
p.push(u), n.set(l, p);
|
|
3337
4420
|
}
|
|
3338
|
-
const i = Array.from(n.keys()).sort((
|
|
3339
|
-
for (const
|
|
4421
|
+
const i = Array.from(n.keys()).sort((u, l) => u - l);
|
|
4422
|
+
for (const u of i) n.get(u).sort((l, p) => l.id.localeCompare(p.id));
|
|
3340
4423
|
let s = !0, r = 0;
|
|
3341
4424
|
const a = 100;
|
|
3342
4425
|
for (; s && r < a; ) {
|
|
3343
4426
|
s = !1, r++;
|
|
3344
|
-
for (const
|
|
3345
|
-
const
|
|
3346
|
-
for (const
|
|
3347
|
-
const d = this.behaviorRegistry.get(
|
|
4427
|
+
for (const u of i) {
|
|
4428
|
+
const l = n.get(u);
|
|
4429
|
+
for (const p of l) {
|
|
4430
|
+
const d = this.behaviorRegistry.get(p.type);
|
|
3348
4431
|
if (!d) continue;
|
|
3349
|
-
const
|
|
3350
|
-
if (!
|
|
4432
|
+
const g = e.componentStates.get(p.id);
|
|
4433
|
+
if (!g) continue;
|
|
3351
4434
|
this.propagateConductivity();
|
|
3352
|
-
const f = d.onStart(
|
|
4435
|
+
const f = d.onStart(p, g);
|
|
3353
4436
|
if (f) {
|
|
3354
|
-
e.componentStates.set(
|
|
3355
|
-
for (const
|
|
4437
|
+
e.componentStates.set(p.id, f.componentState), f.shouldCancelPending && this.eventQueue.removeEventsForTarget(p.id);
|
|
4438
|
+
for (const y of f.scheduledEvents) this.eventQueue.schedule(y);
|
|
3356
4439
|
continue;
|
|
3357
4440
|
}
|
|
3358
|
-
const v = d.onPinsChange(
|
|
3359
|
-
v.hasChanged && (s = !0, e.componentStates.set(
|
|
3360
|
-
for (const
|
|
3361
|
-
const S = d.onEventFiring(
|
|
3362
|
-
S.hasChanged && (s = !0, e.componentStates.set(
|
|
4441
|
+
const v = d.onPinsChange(p, g, e.nodeStates, 0);
|
|
4442
|
+
v.hasChanged && (s = !0, e.componentStates.set(p.id, v.componentState));
|
|
4443
|
+
for (const y of v.scheduledEvents) {
|
|
4444
|
+
const S = d.onEventFiring(p, g, y);
|
|
4445
|
+
S.hasChanged && (s = !0, e.componentStates.set(p.id, S.componentState));
|
|
3363
4446
|
}
|
|
3364
4447
|
}
|
|
3365
4448
|
}
|
|
3366
4449
|
}
|
|
3367
4450
|
const o = this.updateState(0);
|
|
3368
|
-
return this.dirtyTracker.setDirtyComponents(/* @__PURE__ */ new Set([...this.circuit.getAllComponents().map((
|
|
4451
|
+
return this.dirtyTracker.setDirtyComponents(/* @__PURE__ */ new Set([...this.circuit.getAllComponents().map((u) => u.id)])), this.dirtyTracker.setDirtyEnodes(/* @__PURE__ */ new Set([...this.circuit.getAllENodes().map((u) => u.id)])), this.dirtyTracker.setDirtyWires(/* @__PURE__ */ new Set([...this.circuit.getAllWires().map((u) => u.id)])), o;
|
|
3369
4452
|
}
|
|
3370
4453
|
updateState(e) {
|
|
3371
4454
|
const t = this.stateManager.getCurrentState(), { updatedNodes: n, updatedWires: i } = this.propagateConductivity(), s = this.circuit.getComponentsOfPins(n), r = [], a = /* @__PURE__ */ new Set();
|
|
3372
4455
|
let o = Array.from(s);
|
|
3373
|
-
e === 0 && (o = o.sort((
|
|
3374
|
-
const
|
|
3375
|
-
return v !==
|
|
4456
|
+
e === 0 && (o = o.sort((p, d) => {
|
|
4457
|
+
const g = this.circuit.getComponent(p), f = this.circuit.getComponent(d), v = this.getInitializationOrder(g.config), y = this.getInitializationOrder(f.config);
|
|
4458
|
+
return v !== y ? v - y : p.localeCompare(d);
|
|
3376
4459
|
}));
|
|
3377
|
-
const
|
|
3378
|
-
for (const
|
|
3379
|
-
const d = this.circuit.getComponent(
|
|
3380
|
-
if (!
|
|
3381
|
-
const f =
|
|
3382
|
-
f.shouldCancelPending &&
|
|
3383
|
-
for (const v of f.scheduledEvents)
|
|
4460
|
+
const u = /* @__PURE__ */ new Set(), l = [];
|
|
4461
|
+
for (const p of o) {
|
|
4462
|
+
const d = this.circuit.getComponent(p), g = this.behaviorRegistry.get(d.type);
|
|
4463
|
+
if (!g) continue;
|
|
4464
|
+
const f = g.onPinsChange(d, t.componentStates.get(p), t.nodeStates, e);
|
|
4465
|
+
f.shouldCancelPending && u.add(p), f.hasChanged && (a.add(p), r.push(f));
|
|
4466
|
+
for (const v of f.scheduledEvents) l.push(v);
|
|
3384
4467
|
}
|
|
3385
|
-
return this.eventQueue.scheduleMany(
|
|
4468
|
+
return this.eventQueue.scheduleMany(l, u), this.dirtyTracker.setDirtyComponents(a), this.dirtyTracker.setDirtyEnodes(n), this.dirtyTracker.setDirtyWires(i), {
|
|
3386
4469
|
startTick: this.getCurrentTick(),
|
|
3387
4470
|
endTick: this.getCurrentTick(),
|
|
3388
4471
|
componentUpdateCount: a.size,
|
|
3389
4472
|
nodeUpdateCount: n.size,
|
|
3390
4473
|
wireUpdateCount: i.size,
|
|
3391
4474
|
processedCommandCount: 0,
|
|
3392
|
-
scheduledEventCount:
|
|
4475
|
+
scheduledEventCount: l.length,
|
|
3393
4476
|
firedEventCount: 0
|
|
3394
4477
|
};
|
|
3395
4478
|
}
|
|
3396
4479
|
propagateConductivity() {
|
|
3397
4480
|
const e = this.stateManager.getCurrentState(), t = (a) => {
|
|
3398
|
-
const o = /* @__PURE__ */ new Set(),
|
|
3399
|
-
for (const
|
|
3400
|
-
const S = e.nodeStates.get(
|
|
3401
|
-
S && !S.locked && (S[v] || (S[v] = !0, o.add(
|
|
4481
|
+
const o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), l = this.circuit.getAllENodes().filter((y) => y.source == a).map((y) => y.id), p = /* @__PURE__ */ new Set([...this.circuit.getAllENodes().filter((y) => !y.source).map((y) => y.id)]), d = /* @__PURE__ */ new Set([...this.circuit.getAllWires().map((y) => y.id)]), { nodes: g, wires: f } = this.computeReachability(a, l, e.componentStates), v = a == h.Voltage ? "hasVoltage" : "hasCurrent";
|
|
4482
|
+
for (const y of g) {
|
|
4483
|
+
const S = e.nodeStates.get(y);
|
|
4484
|
+
S && !S.locked && (S[v] || (S[v] = !0, o.add(y)), p.delete(y));
|
|
3402
4485
|
}
|
|
3403
|
-
for (const
|
|
3404
|
-
const S = e.nodeStates.get(
|
|
3405
|
-
S && !S.locked && S[v] && (S[v] = !1, o.add(
|
|
4486
|
+
for (const y of p) {
|
|
4487
|
+
const S = e.nodeStates.get(y);
|
|
4488
|
+
S && !S.locked && S[v] && (S[v] = !1, o.add(y));
|
|
3406
4489
|
}
|
|
3407
|
-
for (const
|
|
3408
|
-
const S = e.wireStates.get(
|
|
3409
|
-
S && (S[v] || (S[v] = !0,
|
|
4490
|
+
for (const y of f) {
|
|
4491
|
+
const S = e.wireStates.get(y);
|
|
4492
|
+
S && (S[v] || (S[v] = !0, u.add(y)), d.delete(y));
|
|
3410
4493
|
}
|
|
3411
|
-
for (const
|
|
3412
|
-
const S = e.wireStates.get(
|
|
3413
|
-
S && S[v] && (S[v] = !1,
|
|
4494
|
+
for (const y of d) {
|
|
4495
|
+
const S = e.wireStates.get(y);
|
|
4496
|
+
S && S[v] && (S[v] = !1, u.add(y));
|
|
3414
4497
|
}
|
|
3415
4498
|
return {
|
|
3416
4499
|
updatedNodes: o,
|
|
3417
|
-
updatedWires:
|
|
4500
|
+
updatedWires: u
|
|
3418
4501
|
};
|
|
3419
|
-
}, { updatedNodes: n, updatedWires: i } = t(
|
|
4502
|
+
}, { updatedNodes: n, updatedWires: i } = t(h.Voltage), { updatedNodes: s, updatedWires: r } = t(h.Current);
|
|
3420
4503
|
return {
|
|
3421
4504
|
updatedNodes: /* @__PURE__ */ new Set([...n, ...s]),
|
|
3422
4505
|
updatedWires: /* @__PURE__ */ new Set([...i, ...r])
|
|
@@ -3428,19 +4511,19 @@ var U = 8, ge = class extends B {
|
|
|
3428
4511
|
r.push(a), i.add(a);
|
|
3429
4512
|
for (; r.length > 0; ) {
|
|
3430
4513
|
const a = r.shift();
|
|
3431
|
-
for (const
|
|
3432
|
-
const
|
|
3433
|
-
i.has(
|
|
4514
|
+
for (const u of this.circuit.getWiresByNode(a)) {
|
|
4515
|
+
const l = u.node1 === a ? u.node2 : u.node1;
|
|
4516
|
+
i.has(l) || (i.add(l), r.push(l)), s.has(u.id) || s.add(u.id);
|
|
3434
4517
|
}
|
|
3435
4518
|
const o = this.circuit.getENode(a);
|
|
3436
|
-
if (o.type ===
|
|
3437
|
-
const
|
|
3438
|
-
if (!
|
|
3439
|
-
const
|
|
3440
|
-
if (
|
|
3441
|
-
const d = n.get(
|
|
3442
|
-
for (const
|
|
3443
|
-
|
|
4519
|
+
if (o.type === w.Pin) {
|
|
4520
|
+
const u = this.circuit.getComponent(o.component), l = this.behaviorRegistry.get(u.type);
|
|
4521
|
+
if (!l) continue;
|
|
4522
|
+
const p = u.getPinMetadata(a);
|
|
4523
|
+
if (p?.subtype === "logicInput" || p?.subtype === "logicOutput") continue;
|
|
4524
|
+
const d = n.get(u.id);
|
|
4525
|
+
for (const g of u.pins)
|
|
4526
|
+
g !== a && (i.has(g) || l.allowConductivity(u, d, e, a, g) && (i.add(g), r.push(g)));
|
|
3444
4527
|
}
|
|
3445
4528
|
}
|
|
3446
4529
|
return {
|
|
@@ -3451,110 +4534,138 @@ var U = 8, ge = class extends B {
|
|
|
3451
4534
|
applyReadyEvents(e) {
|
|
3452
4535
|
const t = this.stateManager.getCurrentState(), n = this.eventQueue.getReadyEvents(e), i = [], s = /* @__PURE__ */ new Set(), r = [];
|
|
3453
4536
|
for (const a of n) {
|
|
3454
|
-
const o = this.circuit.getComponent(a.targetId),
|
|
3455
|
-
if (!
|
|
3456
|
-
const
|
|
3457
|
-
|
|
3458
|
-
for (const d of
|
|
3459
|
-
i.push(
|
|
4537
|
+
const o = this.circuit.getComponent(a.targetId), u = this.behaviorRegistry.get(o.type);
|
|
4538
|
+
if (!u) continue;
|
|
4539
|
+
const l = t.componentStates.get(o.id), p = u.onEventFiring(o, l, a);
|
|
4540
|
+
p.shouldCancelPending && s.add(o.id);
|
|
4541
|
+
for (const d of p.scheduledEvents) r.push(d);
|
|
4542
|
+
i.push(p);
|
|
3460
4543
|
}
|
|
3461
4544
|
return this.eventQueue.scheduleMany(r, s), i;
|
|
3462
4545
|
}
|
|
3463
4546
|
};
|
|
3464
|
-
function
|
|
3465
|
-
return e.register(new
|
|
4547
|
+
function Qe(e) {
|
|
4548
|
+
return e.register(new se()).register(new re()).register(new ae()).register(new ue()).register(new ce()).register(new pe()).register(new le()).register(new de()), e;
|
|
4549
|
+
}
|
|
4550
|
+
function qe(e) {
|
|
4551
|
+
return e.register(new he()).register(new ge()).register(new fe()).register(new ye()).register(new ve()).register(new Se()).register(new we()).register(new me()).register(new be()).register(new Ce()), e;
|
|
3466
4552
|
}
|
|
3467
|
-
function
|
|
3468
|
-
return e.register(new
|
|
4553
|
+
function Ke(e) {
|
|
4554
|
+
return e.register(new Pe()).register(new xe()).register(new Ie()).register(new Te()), e;
|
|
3469
4555
|
}
|
|
3470
|
-
function
|
|
3471
|
-
return e.register(new
|
|
4556
|
+
function Ye(e) {
|
|
4557
|
+
return e.register(new Oe()).register(new Ee()).register(new De()).register(new Ne()).register(new Me()).register(new Le()).register(new ze()).register(new Be()), e;
|
|
3472
4558
|
}
|
|
3473
4559
|
export {
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
4560
|
+
qt as $,
|
|
4561
|
+
D as $t,
|
|
4562
|
+
fe as A,
|
|
4563
|
+
Re as At,
|
|
4564
|
+
se as B,
|
|
4565
|
+
Ve as Bt,
|
|
4566
|
+
Ce as C,
|
|
4567
|
+
Y as Ct,
|
|
4568
|
+
Se as D,
|
|
4569
|
+
Fe as Dt,
|
|
4570
|
+
we as E,
|
|
4571
|
+
dt as Et,
|
|
4572
|
+
pe as F,
|
|
4573
|
+
K as Ft,
|
|
4574
|
+
ee as G,
|
|
4575
|
+
h as Gt,
|
|
4576
|
+
Ue as H,
|
|
4577
|
+
I as Ht,
|
|
4578
|
+
ce as I,
|
|
4579
|
+
q as It,
|
|
4580
|
+
jt as J,
|
|
4581
|
+
mt as Jt,
|
|
4582
|
+
te as K,
|
|
4583
|
+
w as Kt,
|
|
4584
|
+
ue as L,
|
|
4585
|
+
Q as Lt,
|
|
4586
|
+
he as M,
|
|
4587
|
+
Ot as Mt,
|
|
4588
|
+
de as N,
|
|
4589
|
+
Et as Nt,
|
|
4590
|
+
ve as O,
|
|
4591
|
+
He as Ot,
|
|
4592
|
+
le as P,
|
|
4593
|
+
It as Pt,
|
|
4594
|
+
z as Q,
|
|
4595
|
+
tt as Qt,
|
|
4596
|
+
ae as R,
|
|
4597
|
+
N as Rt,
|
|
4598
|
+
Pe as S,
|
|
4599
|
+
m as St,
|
|
4600
|
+
me as T,
|
|
4601
|
+
Je as Tt,
|
|
4602
|
+
ne as U,
|
|
4603
|
+
c as Ut,
|
|
4604
|
+
x as V,
|
|
4605
|
+
st as Vt,
|
|
4606
|
+
ie as W,
|
|
4607
|
+
rt as Wt,
|
|
4608
|
+
Yt as X,
|
|
4609
|
+
vt as Xt,
|
|
4610
|
+
Zt as Y,
|
|
4611
|
+
H as Yt,
|
|
4612
|
+
Kt as Z,
|
|
4613
|
+
V as Zt,
|
|
4614
|
+
Oe as _,
|
|
4615
|
+
Lt as _t,
|
|
4616
|
+
Xe as a,
|
|
4617
|
+
Ht as at,
|
|
4618
|
+
Ie as b,
|
|
4619
|
+
Nt as bt,
|
|
4620
|
+
Ae as c,
|
|
4621
|
+
Wt as ct,
|
|
4622
|
+
Le as d,
|
|
4623
|
+
_t as dt,
|
|
4624
|
+
yt as en,
|
|
4625
|
+
Qt as et,
|
|
4626
|
+
Me as f,
|
|
4627
|
+
Gt as ft,
|
|
4628
|
+
Ee as g,
|
|
4629
|
+
zt as gt,
|
|
4630
|
+
De as h,
|
|
4631
|
+
Bt as ht,
|
|
4632
|
+
Ye as i,
|
|
4633
|
+
Jt as it,
|
|
4634
|
+
ge as j,
|
|
4635
|
+
$e as jt,
|
|
4636
|
+
ye as k,
|
|
4637
|
+
We as kt,
|
|
4638
|
+
Be as l,
|
|
4639
|
+
$t as lt,
|
|
4640
|
+
Ne as m,
|
|
4641
|
+
At as mt,
|
|
4642
|
+
Qe as n,
|
|
4643
|
+
Ut as nt,
|
|
4644
|
+
Ge as o,
|
|
4645
|
+
Ft as ot,
|
|
4646
|
+
G as p,
|
|
4647
|
+
kt as pt,
|
|
4648
|
+
B as q,
|
|
4649
|
+
J as qt,
|
|
4650
|
+
qe as r,
|
|
4651
|
+
L as rt,
|
|
4652
|
+
ke as s,
|
|
4653
|
+
Rt as st,
|
|
4654
|
+
Ke as t,
|
|
4655
|
+
_e as tn,
|
|
4656
|
+
Xt as tt,
|
|
4657
|
+
ze as u,
|
|
4658
|
+
Vt as ut,
|
|
4659
|
+
k as v,
|
|
4660
|
+
Mt as vt,
|
|
4661
|
+
be as w,
|
|
4662
|
+
O as wt,
|
|
4663
|
+
xe as x,
|
|
4664
|
+
Dt as xt,
|
|
4665
|
+
Te as y,
|
|
4666
|
+
gt as yt,
|
|
4667
|
+
re as z,
|
|
4668
|
+
$ as zt
|
|
3558
4669
|
};
|
|
3559
4670
|
|
|
3560
|
-
//# sourceMappingURL=core-
|
|
4671
|
+
//# sourceMappingURL=core-HH6iRWtB.js.map
|