@modular-circuit/perc 0.0.58 → 0.0.59
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/build/erc/netlist/constraints.js +3 -3
- package/build/erc/netlist/tester.js +27 -50
- package/build/erc/parameter_propagation/error_code.js +33 -34
- package/build/erc/parameter_propagation/link_testers/link_tester_base.js +27 -100
- package/build/erc/parameter_propagation/link_testers/tester_impl.js +424 -886
- package/build/erc/parameter_propagation/tester.js +123 -191
- package/build/erc/pin_compatibility_matrix/erc_setting.js +72 -74
- package/build/erc/pin_compatibility_matrix/tester.js +12 -13
- package/build/report/erc_report.js +5 -6
- package/build/report/erc_reporter.js +49 -49
- package/build/tester/erc_tester.js +19 -57
- package/build/tester/graph/connection_graphs_builder.js +75 -163
- package/build/tester/graph/graph_erc.js +7 -59
- package/build/tester/graph/ir_graph_converter.js +112 -253
- package/build/utils/get_dependent_modules_definition.js +14 -141
- package/package.json +4 -4
|
@@ -1,279 +1,138 @@
|
|
|
1
|
-
var __values = (this && this.__values) || function(o) {
|
|
2
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
-
if (m) return m.call(o);
|
|
4
|
-
if (o && typeof o.length === "number") return {
|
|
5
|
-
next: function () {
|
|
6
|
-
if (o && i >= o.length) o = void 0;
|
|
7
|
-
return { value: o && o[i++], done: !o };
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
-
};
|
|
12
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
-
if (!m) return o;
|
|
15
|
-
var i = m.call(o), r, ar = [], e;
|
|
16
|
-
try {
|
|
17
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
-
}
|
|
19
|
-
catch (error) { e = { error: error }; }
|
|
20
|
-
finally {
|
|
21
|
-
try {
|
|
22
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
-
}
|
|
24
|
-
finally { if (e) throw e.error; }
|
|
25
|
-
}
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
-
if (ar || !(i in from)) {
|
|
31
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
-
ar[i] = from[i];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
-
};
|
|
37
1
|
import { ConnectionNodeType, LinkType, PortType, } from '@modular-circuit/electronics-model';
|
|
38
2
|
import { PowerShape, } from '@modular-circuit/electronics-model';
|
|
39
3
|
import { deep_copy, fmt_module_name, gen_uuid, get_circuit_ports, get_port_labels } from '@modular-circuit/utils';
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
export class IR_GRAPH_CONVERTER {
|
|
5
|
+
circuits;
|
|
6
|
+
graph = {};
|
|
7
|
+
connection_node_map = {};
|
|
8
|
+
schematics = {};
|
|
9
|
+
reporter_context = {
|
|
10
|
+
pin_name_table: {},
|
|
11
|
+
pin_module_name_table: {},
|
|
12
|
+
};
|
|
13
|
+
get_report_context() {
|
|
14
|
+
return this.reporter_context;
|
|
15
|
+
}
|
|
16
|
+
constructor(circuits) {
|
|
42
17
|
this.circuits = circuits;
|
|
43
|
-
this.graph = {};
|
|
44
|
-
this.connection_node_map = {};
|
|
45
|
-
this.schematics = {};
|
|
46
|
-
this.reporter_context = {
|
|
47
|
-
pin_name_table: {},
|
|
48
|
-
pin_module_name_table: {},
|
|
49
|
-
};
|
|
50
18
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
IR_GRAPH_CONVERTER.prototype.convert_to_graph = function (designs) {
|
|
55
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f, e_7, _g, e_8, _h, e_9, _j;
|
|
56
|
-
var _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
57
|
-
var errors = [];
|
|
19
|
+
convert_to_graph(designs) {
|
|
20
|
+
const errors = [];
|
|
58
21
|
if (Object.keys(designs).length > 1) {
|
|
59
22
|
throw new Error('Multiple designs are not supported');
|
|
60
23
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type: ConnectionNodeType.Port,
|
|
86
|
-
param: param,
|
|
87
|
-
label_shapes: get_port_labels(param, circuit),
|
|
88
|
-
};
|
|
89
|
-
this.reporter_context.pin_module_name_table[port.uuid] = block.type.name;
|
|
90
|
-
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
94
|
-
finally {
|
|
95
|
-
try {
|
|
96
|
-
if (_0 && !_0.done && (_c = _z.return)) _c.call(_z);
|
|
97
|
-
}
|
|
98
|
-
finally { if (e_3) throw e_3.error; }
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
103
|
-
finally {
|
|
104
|
-
try {
|
|
105
|
-
if (_y && !_y.done && (_b = _x.return)) _b.call(_x);
|
|
106
|
-
}
|
|
107
|
-
finally { if (e_2) throw e_2.error; }
|
|
24
|
+
// Blocks
|
|
25
|
+
for (const [sch_name, design] of Object.entries(designs)) {
|
|
26
|
+
this.schematics[sch_name] = { uuid: design.uuid ?? gen_uuid(), sheets: [], powers: [] };
|
|
27
|
+
for (const block of design.blocks ?? []) {
|
|
28
|
+
const circuit = this.circuits[fmt_module_name(block.type)];
|
|
29
|
+
this.schematics[sch_name].sheets.push({
|
|
30
|
+
uuid: block.uuid,
|
|
31
|
+
sheet_name: design.name ?? circuit.name,
|
|
32
|
+
sheet_file_name: circuit.main,
|
|
33
|
+
ports: block.ports.map((p) => p.uuid),
|
|
34
|
+
});
|
|
35
|
+
const port_map = get_circuit_ports(circuit);
|
|
36
|
+
for (const port of block.ports) {
|
|
37
|
+
const param = deep_copy(port_map[port.index]);
|
|
38
|
+
const uuid = port.uuid;
|
|
39
|
+
this.add_node(uuid);
|
|
40
|
+
this.connection_node_map[uuid] = {
|
|
41
|
+
uuid,
|
|
42
|
+
type: ConnectionNodeType.Port,
|
|
43
|
+
param,
|
|
44
|
+
label_shapes: get_port_labels(param, circuit),
|
|
45
|
+
};
|
|
46
|
+
this.reporter_context.pin_module_name_table[port.uuid] = block.type.name;
|
|
47
|
+
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
108
48
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
throw new Error("Unsupported label type ".concat(lb.type));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
127
|
-
finally {
|
|
128
|
-
try {
|
|
129
|
-
if (_2 && !_2.done && (_d = _1.return)) _d.call(_1);
|
|
130
|
-
}
|
|
131
|
-
finally { if (e_4) throw e_4.error; }
|
|
132
|
-
}
|
|
133
|
-
try {
|
|
134
|
-
for (var _3 = (e_5 = void 0, __values(Object.values(lb_map))), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
135
|
-
var labels = _4.value;
|
|
136
|
-
for (var i = 0; i < labels.length - 1; i++) {
|
|
137
|
-
this.add_connection(labels[i], labels[i + 1]);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
142
|
-
finally {
|
|
143
|
-
try {
|
|
144
|
-
if (_4 && !_4.done && (_e = _3.return)) _e.call(_3);
|
|
145
|
-
}
|
|
146
|
-
finally { if (e_5) throw e_5.error; }
|
|
147
|
-
}
|
|
148
|
-
try {
|
|
149
|
-
// POWER
|
|
150
|
-
for (var _5 = (e_6 = void 0, __values((_q = design.pwr) !== null && _q !== void 0 ? _q : [])), _6 = _5.next(); !_6.done; _6 = _5.next()) {
|
|
151
|
-
var pwr = _6.value;
|
|
152
|
-
this.add_pwr(pwr, PowerShape.VCC, sch_name, {
|
|
153
|
-
type: PortType.VoltageSource,
|
|
154
|
-
name: pwr.value,
|
|
155
|
-
link_type: LinkType.VoltageLink,
|
|
156
|
-
label_associated: pwr.value,
|
|
157
|
-
voltage_out: pwr.param ? pwr.param.voltage_out : {},
|
|
158
|
-
current_limits: pwr.param ? pwr.param.current_limits : {},
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
163
|
-
finally {
|
|
164
|
-
try {
|
|
165
|
-
if (_6 && !_6.done && (_f = _5.return)) _f.call(_5);
|
|
166
|
-
}
|
|
167
|
-
finally { if (e_6) throw e_6.error; }
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
for (var _7 = (e_7 = void 0, __values((_r = design.gnd) !== null && _r !== void 0 ? _r : [])), _8 = _7.next(); !_8.done; _8 = _7.next()) {
|
|
171
|
-
var pwr = _8.value;
|
|
172
|
-
this.add_pwr(pwr, PowerShape.GND, sch_name, {
|
|
173
|
-
type: PortType.Ground,
|
|
174
|
-
name: pwr.value,
|
|
175
|
-
link_type: LinkType.GroundLink,
|
|
176
|
-
label_associated: pwr.value,
|
|
177
|
-
voltage_limits: pwr.param ? pwr.param.voltage_limits : {},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
182
|
-
finally {
|
|
183
|
-
try {
|
|
184
|
-
if (_8 && !_8.done && (_g = _7.return)) _g.call(_7);
|
|
185
|
-
}
|
|
186
|
-
finally { if (e_7) throw e_7.error; }
|
|
187
|
-
}
|
|
188
|
-
try {
|
|
189
|
-
// Junctions
|
|
190
|
-
for (var _9 = (e_8 = void 0, __values((_s = design.junctions) !== null && _s !== void 0 ? _s : [])), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
191
|
-
var j = _10.value;
|
|
192
|
-
var uuid = j.uuid;
|
|
193
|
-
this.add_node(uuid);
|
|
194
|
-
this.connection_node_map[uuid] = { uuid: uuid, type: ConnectionNodeType.Graphics };
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
198
|
-
finally {
|
|
199
|
-
try {
|
|
200
|
-
if (_10 && !_10.done && (_h = _9.return)) _h.call(_9);
|
|
201
|
-
}
|
|
202
|
-
finally { if (e_8) throw e_8.error; }
|
|
203
|
-
}
|
|
204
|
-
try {
|
|
205
|
-
// Connections
|
|
206
|
-
for (var _11 = (e_9 = void 0, __values((_t = design.wires) !== null && _t !== void 0 ? _t : [])), _12 = _11.next(); !_12.done; _12 = _11.next()) {
|
|
207
|
-
var connection = _12.value;
|
|
208
|
-
var uuid = connection.uuid;
|
|
209
|
-
this.add_connection(connection.from, connection.to);
|
|
210
|
-
this.connection_node_map[uuid] = { uuid: uuid, type: ConnectionNodeType.Graphics };
|
|
211
|
-
}
|
|
49
|
+
}
|
|
50
|
+
// Labels
|
|
51
|
+
const lb_map = {};
|
|
52
|
+
for (const lb of design.labels ?? []) {
|
|
53
|
+
this.add_node(lb.uuid);
|
|
54
|
+
this.reporter_context.pin_name_table[lb.uuid] = lb.text;
|
|
55
|
+
lb_map[lb.text] = [...(lb_map[lb.text] ?? []), lb.uuid];
|
|
56
|
+
switch (lb.type) {
|
|
57
|
+
case 'label':
|
|
58
|
+
this.connection_node_map[lb.uuid] = { uuid: lb.uuid, type: ConnectionNodeType.NetLabel, text: lb.text };
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
throw new Error(`Unsupported label type ${lb.type}`);
|
|
212
62
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
finally { if (e_9) throw e_9.error; }
|
|
63
|
+
}
|
|
64
|
+
for (const labels of Object.values(lb_map)) {
|
|
65
|
+
for (let i = 0; i < labels.length - 1; i++) {
|
|
66
|
+
this.add_connection(labels[i], labels[i + 1]);
|
|
219
67
|
}
|
|
220
68
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
69
|
+
// POWER
|
|
70
|
+
for (const pwr of design.pwr ?? []) {
|
|
71
|
+
this.add_pwr(pwr, PowerShape.VCC, sch_name, {
|
|
72
|
+
type: PortType.VoltageSource,
|
|
73
|
+
name: pwr.value,
|
|
74
|
+
link_type: LinkType.VoltageLink,
|
|
75
|
+
label_associated: pwr.value,
|
|
76
|
+
voltage_out: pwr.param ? pwr.param.voltage_out : {},
|
|
77
|
+
current_limits: pwr.param ? pwr.param.current_limits : {},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
for (const pwr of design.gnd ?? []) {
|
|
81
|
+
this.add_pwr(pwr, PowerShape.GND, sch_name, {
|
|
82
|
+
type: PortType.Ground,
|
|
83
|
+
name: pwr.value,
|
|
84
|
+
link_type: LinkType.GroundLink,
|
|
85
|
+
label_associated: pwr.value,
|
|
86
|
+
voltage_limits: pwr.param ? pwr.param.voltage_limits : {},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Junctions
|
|
90
|
+
for (const j of design.junctions ?? []) {
|
|
91
|
+
const uuid = j.uuid;
|
|
92
|
+
this.add_node(uuid);
|
|
93
|
+
this.connection_node_map[uuid] = { uuid, type: ConnectionNodeType.Graphics };
|
|
94
|
+
}
|
|
95
|
+
// Connections
|
|
96
|
+
for (const connection of design.wires ?? []) {
|
|
97
|
+
const uuid = connection.uuid;
|
|
98
|
+
this.add_connection(connection.from, connection.to);
|
|
99
|
+
this.connection_node_map[uuid] = { uuid, type: ConnectionNodeType.Graphics };
|
|
226
100
|
}
|
|
227
|
-
finally { if (e_1) throw e_1.error; }
|
|
228
101
|
}
|
|
229
102
|
return errors.length ? errors : true;
|
|
230
|
-
}
|
|
231
|
-
|
|
103
|
+
}
|
|
104
|
+
add_node(id) {
|
|
232
105
|
if (!this.graph[id])
|
|
233
106
|
this.graph[id] = new Set();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
107
|
+
}
|
|
108
|
+
add_pwr(pwr, shape, sch_name, param) {
|
|
109
|
+
const uuid = pwr.uuid;
|
|
110
|
+
const value = pwr.value;
|
|
238
111
|
this.add_node(uuid);
|
|
239
112
|
this.reporter_context.pin_name_table[uuid] = pwr.value;
|
|
240
|
-
this.connection_node_map[uuid] = { uuid
|
|
113
|
+
this.connection_node_map[uuid] = { uuid, type: ConnectionNodeType.Power, value, param };
|
|
241
114
|
this.schematics[sch_name].powers.push({
|
|
242
|
-
uuid
|
|
243
|
-
value
|
|
244
|
-
shape
|
|
115
|
+
uuid,
|
|
116
|
+
value,
|
|
117
|
+
shape,
|
|
245
118
|
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
this.do_add_connection({ from
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
for (var _b = __values([conn.from, conn.to]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
254
|
-
var p = _c.value;
|
|
255
|
-
this.add_node(p);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
259
|
-
finally {
|
|
260
|
-
try {
|
|
261
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
262
|
-
}
|
|
263
|
-
finally { if (e_10) throw e_10.error; }
|
|
264
|
-
}
|
|
119
|
+
}
|
|
120
|
+
add_connection(from, to) {
|
|
121
|
+
this.do_add_connection({ from, to });
|
|
122
|
+
}
|
|
123
|
+
do_add_connection(conn) {
|
|
124
|
+
for (const p of [conn.from, conn.to])
|
|
125
|
+
this.add_node(p);
|
|
265
126
|
this.graph[conn.from].add(conn.to);
|
|
266
127
|
this.graph[conn.to].add(conn.from);
|
|
267
|
-
}
|
|
268
|
-
|
|
128
|
+
}
|
|
129
|
+
get_connection_node_map() {
|
|
269
130
|
return this.connection_node_map;
|
|
270
|
-
}
|
|
271
|
-
|
|
131
|
+
}
|
|
132
|
+
get_graph() {
|
|
272
133
|
return this.graph;
|
|
273
|
-
}
|
|
274
|
-
|
|
134
|
+
}
|
|
135
|
+
get_schematics() {
|
|
275
136
|
return this.schematics;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
}());
|
|
279
|
-
export { IR_GRAPH_CONVERTER };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -1,145 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
1
|
+
import { fmt_module_name } from '@modular-circuit/utils';
|
|
2
|
+
export async function get_dependent_modules_definition(ctx) {
|
|
3
|
+
const circuits = {};
|
|
4
|
+
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
5
|
+
for (const block of v.blocks ?? []) {
|
|
6
|
+
const module_name = fmt_module_name(block.type);
|
|
7
|
+
const version = ctx.dependencies[module_name];
|
|
8
|
+
if (version === undefined) {
|
|
9
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
10
|
+
continue;
|
|
42
11
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __values = (this && this.__values) || function(o) {
|
|
49
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
50
|
-
if (m) return m.call(o);
|
|
51
|
-
if (o && typeof o.length === "number") return {
|
|
52
|
-
next: function () {
|
|
53
|
-
if (o && i >= o.length) o = void 0;
|
|
54
|
-
return { value: o && o[i++], done: !o };
|
|
12
|
+
const def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
13
|
+
if (def)
|
|
14
|
+
circuits[module_name] = def;
|
|
55
15
|
}
|
|
56
|
-
};
|
|
57
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
58
|
-
};
|
|
59
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
60
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
-
if (!m) return o;
|
|
62
|
-
var i = m.call(o), r, ar = [], e;
|
|
63
|
-
try {
|
|
64
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
65
16
|
}
|
|
66
|
-
|
|
67
|
-
finally {
|
|
68
|
-
try {
|
|
69
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
70
|
-
}
|
|
71
|
-
finally { if (e) throw e.error; }
|
|
72
|
-
}
|
|
73
|
-
return ar;
|
|
74
|
-
};
|
|
75
|
-
import { fmt_module_name } from '@modular-circuit/utils';
|
|
76
|
-
export function get_dependent_modules_definition(ctx) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var circuits, _a, _b, _c, v, _d, _e, block, module_name, version, def, e_1_1, e_2_1;
|
|
79
|
-
var e_2, _f, e_1, _g;
|
|
80
|
-
var _h;
|
|
81
|
-
return __generator(this, function (_j) {
|
|
82
|
-
switch (_j.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
circuits = {};
|
|
85
|
-
_j.label = 1;
|
|
86
|
-
case 1:
|
|
87
|
-
_j.trys.push([1, 12, 13, 14]);
|
|
88
|
-
_a = __values(Object.entries(ctx.schematics)), _b = _a.next();
|
|
89
|
-
_j.label = 2;
|
|
90
|
-
case 2:
|
|
91
|
-
if (!!_b.done) return [3 /*break*/, 11];
|
|
92
|
-
_c = __read(_b.value, 2), v = _c[1];
|
|
93
|
-
_j.label = 3;
|
|
94
|
-
case 3:
|
|
95
|
-
_j.trys.push([3, 8, 9, 10]);
|
|
96
|
-
_d = (e_1 = void 0, __values((_h = v.blocks) !== null && _h !== void 0 ? _h : [])), _e = _d.next();
|
|
97
|
-
_j.label = 4;
|
|
98
|
-
case 4:
|
|
99
|
-
if (!!_e.done) return [3 /*break*/, 7];
|
|
100
|
-
block = _e.value;
|
|
101
|
-
module_name = fmt_module_name(block.type);
|
|
102
|
-
version = ctx.dependencies[module_name];
|
|
103
|
-
if (version === undefined) {
|
|
104
|
-
console.warn("Module ".concat(module_name, " not found in dependencies"));
|
|
105
|
-
return [3 /*break*/, 6];
|
|
106
|
-
}
|
|
107
|
-
return [4 /*yield*/, ctx.module_resolver.get_module_circuit(__assign(__assign({}, block.type), { version: version }))];
|
|
108
|
-
case 5:
|
|
109
|
-
def = _j.sent();
|
|
110
|
-
if (def)
|
|
111
|
-
circuits[module_name] = def;
|
|
112
|
-
_j.label = 6;
|
|
113
|
-
case 6:
|
|
114
|
-
_e = _d.next();
|
|
115
|
-
return [3 /*break*/, 4];
|
|
116
|
-
case 7: return [3 /*break*/, 10];
|
|
117
|
-
case 8:
|
|
118
|
-
e_1_1 = _j.sent();
|
|
119
|
-
e_1 = { error: e_1_1 };
|
|
120
|
-
return [3 /*break*/, 10];
|
|
121
|
-
case 9:
|
|
122
|
-
try {
|
|
123
|
-
if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
|
|
124
|
-
}
|
|
125
|
-
finally { if (e_1) throw e_1.error; }
|
|
126
|
-
return [7 /*endfinally*/];
|
|
127
|
-
case 10:
|
|
128
|
-
_b = _a.next();
|
|
129
|
-
return [3 /*break*/, 2];
|
|
130
|
-
case 11: return [3 /*break*/, 14];
|
|
131
|
-
case 12:
|
|
132
|
-
e_2_1 = _j.sent();
|
|
133
|
-
e_2 = { error: e_2_1 };
|
|
134
|
-
return [3 /*break*/, 14];
|
|
135
|
-
case 13:
|
|
136
|
-
try {
|
|
137
|
-
if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
|
|
138
|
-
}
|
|
139
|
-
finally { if (e_2) throw e_2.error; }
|
|
140
|
-
return [7 /*endfinally*/];
|
|
141
|
-
case 14: return [2 /*return*/, circuits];
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
});
|
|
17
|
+
return circuits;
|
|
145
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/perc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "Programmable Electronic Circuit Check",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"typescript": "^5.4.5"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@modular-circuit/electronics-model": "0.0.
|
|
28
|
-
"@modular-circuit/
|
|
29
|
-
"@modular-circuit/
|
|
27
|
+
"@modular-circuit/electronics-model": "0.0.52",
|
|
28
|
+
"@modular-circuit/utils": "0.0.38",
|
|
29
|
+
"@modular-circuit/ir": "0.0.59"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"clean": "rimraf build",
|