@modular-circuit/transpiler 0.0.59 → 0.0.63
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/builder/graph_to_kicad/do_convert_graph_to_kicad_project.js +15 -12
- package/build/builder/graph_to_kicad/index.js +8 -5
- package/build/builder/index.js +5 -1
- package/build/converter/graph_to_netlist/context.js +2 -0
- package/build/converter/graph_to_netlist/graph_converter.js +9 -5
- package/build/converter/graph_to_netlist/index.js +18 -2
- package/build/converter/index.js +19 -3
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/index.js +7 -4
- package/build/converter/kicad_sexpr/eeschema/drawing_sheet/sch_default_drawing_sheet.js +4 -1
- package/build/converter/kicad_sexpr/eeschema/index.js +18 -2
- package/build/converter/kicad_sexpr/eeschema/printer.js +16 -24
- package/build/converter/kicad_sexpr/index.js +18 -2
- package/build/converter/kicad_sexpr/pcb/index.js +2 -1
- package/build/converter/link_to_netlist/context.js +2 -0
- package/build/converter/link_to_netlist/converter.js +35 -31
- package/build/converter/link_to_netlist/index.js +18 -2
- package/build/converter/link_to_netlist/links/converter_base.js +9 -3
- package/build/converter/link_to_netlist/links/converters.js +54 -39
- package/build/converter/link_to_netlist/links/index.js +18 -2
- package/build/converter/netlist_to_kicad/context.js +2 -0
- package/build/converter/netlist_to_kicad/index.js +19 -3
- package/build/converter/netlist_to_kicad/layout.js +11 -6
- package/build/converter/netlist_to_kicad/netlist_converter.js +32 -28
- package/build/index.js +21 -5
- package/build/kicad/constraints/index.js +4 -1
- package/build/kicad/label/index.js +18 -2
- package/build/kicad/label/net_label.js +9 -5
- package/build/kicad/label/sheet_pin.js +10 -6
- package/build/kicad/project/index.js +18 -2
- package/build/kicad/project/kicad_prl.js +5 -1
- package/build/kicad/project/kicad_pro.js +7 -3
- package/build/kicad/project/kicad_project_achieve.js +18 -14
- package/build/kicad/project/wildcards_and_files_ext.js +65 -61
- package/build/kicad/sheet/index.js +17 -1
- package/build/kicad/sheet/sheet.js +10 -6
- package/build/kicad/symbols/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/gnd.js +19 -15
- package/build/kicad/symbols/lib_symbol/index.js +18 -2
- package/build/kicad/symbols/lib_symbol/vcc.js +19 -15
- package/build/kicad/symbols/sch_symbol/gnd.js +15 -11
- package/build/kicad/symbols/sch_symbol/index.js +18 -2
- package/build/kicad/symbols/sch_symbol/vcc.js +15 -11
- package/build/kicad/symbols/symbol_utils.js +5 -1
- package/build/utils/collect_sub_sheets.js +9 -6
- package/build/utils/constraints.js +9 -6
- package/build/utils/filter_null_undefined.d.ts +1 -1
- package/build/utils/filter_null_undefined.d.ts.map +1 -1
- package/build/utils/filter_null_undefined.js +2 -10
- package/build/utils/index.js +20 -4
- package/build/utils/string_formatter.js +7 -3
- package/package.json +5 -5
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Dvp8LinkTester = exports.UsbCcLinkTester = exports.UsbLinkTester = exports.UartLinkTester = exports.SpeakerLinkTester = exports.SpiLinkTester = exports.I2sLinkTester = exports.I2cLinkTester = exports.SwdLinkTester = exports.CrystalLinkTester = exports.CanDiffLinkTester = exports.CanLogicLinkTester = void 0;
|
|
4
|
+
const electronics_model_1 = require("@modular-circuit/electronics-model");
|
|
5
|
+
const converter_base_1 = require("./converter_base");
|
|
6
|
+
class CanLogicLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
4
7
|
get_signals() {
|
|
5
8
|
if (!this.link)
|
|
6
9
|
return [];
|
|
@@ -53,15 +56,15 @@ export class CanLogicLinkTester extends CompositePortLinkConverterBase {
|
|
|
53
56
|
const passive = [];
|
|
54
57
|
for (const v of this.ports) {
|
|
55
58
|
switch (v.type) {
|
|
56
|
-
case PortType.CanControllerPort: {
|
|
59
|
+
case electronics_model_1.PortType.CanControllerPort: {
|
|
57
60
|
controllers.push(v);
|
|
58
61
|
break;
|
|
59
62
|
}
|
|
60
|
-
case PortType.CanTransceiverPort: {
|
|
63
|
+
case electronics_model_1.PortType.CanTransceiverPort: {
|
|
61
64
|
transceivers.push(v);
|
|
62
65
|
break;
|
|
63
66
|
}
|
|
64
|
-
case PortType.CanPassivePort: {
|
|
67
|
+
case electronics_model_1.PortType.CanPassivePort: {
|
|
65
68
|
passive.push(v);
|
|
66
69
|
break;
|
|
67
70
|
}
|
|
@@ -81,7 +84,8 @@ export class CanLogicLinkTester extends CompositePortLinkConverterBase {
|
|
|
81
84
|
return true;
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
|
|
87
|
+
exports.CanLogicLinkTester = CanLogicLinkTester;
|
|
88
|
+
class CanDiffLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
85
89
|
get_signals() {
|
|
86
90
|
if (!this.link)
|
|
87
91
|
return [];
|
|
@@ -115,7 +119,7 @@ export class CanDiffLinkTester extends CompositePortLinkConverterBase {
|
|
|
115
119
|
init_link() {
|
|
116
120
|
const nodes = [];
|
|
117
121
|
for (const v of this.ports) {
|
|
118
|
-
if (v.type === PortType.CanDiffPort) {
|
|
122
|
+
if (v.type === electronics_model_1.PortType.CanDiffPort) {
|
|
119
123
|
nodes.push(v);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
@@ -128,7 +132,8 @@ export class CanDiffLinkTester extends CompositePortLinkConverterBase {
|
|
|
128
132
|
return true;
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
|
|
135
|
+
exports.CanDiffLinkTester = CanDiffLinkTester;
|
|
136
|
+
class CrystalLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
132
137
|
get_signals() {
|
|
133
138
|
if (!this.link)
|
|
134
139
|
return [];
|
|
@@ -168,11 +173,11 @@ export class CrystalLinkTester extends CompositePortLinkConverterBase {
|
|
|
168
173
|
const crystals = [];
|
|
169
174
|
for (const v of this.ports) {
|
|
170
175
|
switch (v.type) {
|
|
171
|
-
case PortType.CrystalDriver: {
|
|
176
|
+
case electronics_model_1.PortType.CrystalDriver: {
|
|
172
177
|
drivers.push(v);
|
|
173
178
|
break;
|
|
174
179
|
}
|
|
175
|
-
case PortType.CrystalPort: {
|
|
180
|
+
case electronics_model_1.PortType.CrystalPort: {
|
|
176
181
|
crystals.push(v);
|
|
177
182
|
break;
|
|
178
183
|
}
|
|
@@ -191,7 +196,8 @@ export class CrystalLinkTester extends CompositePortLinkConverterBase {
|
|
|
191
196
|
return true;
|
|
192
197
|
}
|
|
193
198
|
}
|
|
194
|
-
|
|
199
|
+
exports.CrystalLinkTester = CrystalLinkTester;
|
|
200
|
+
class SwdLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
195
201
|
get_signals() {
|
|
196
202
|
if (!this.link)
|
|
197
203
|
return [];
|
|
@@ -244,15 +250,15 @@ export class SwdLinkTester extends CompositePortLinkConverterBase {
|
|
|
244
250
|
const pull = [];
|
|
245
251
|
for (const v of this.ports) {
|
|
246
252
|
switch (v.type) {
|
|
247
|
-
case PortType.SwdHostPort: {
|
|
253
|
+
case electronics_model_1.PortType.SwdHostPort: {
|
|
248
254
|
hosts.push(v);
|
|
249
255
|
break;
|
|
250
256
|
}
|
|
251
|
-
case PortType.SwdTargetPort: {
|
|
257
|
+
case electronics_model_1.PortType.SwdTargetPort: {
|
|
252
258
|
devices.push(v);
|
|
253
259
|
break;
|
|
254
260
|
}
|
|
255
|
-
case PortType.SwdPullPort: {
|
|
261
|
+
case electronics_model_1.PortType.SwdPullPort: {
|
|
256
262
|
pull.push(v);
|
|
257
263
|
break;
|
|
258
264
|
}
|
|
@@ -272,7 +278,8 @@ export class SwdLinkTester extends CompositePortLinkConverterBase {
|
|
|
272
278
|
return true;
|
|
273
279
|
}
|
|
274
280
|
}
|
|
275
|
-
|
|
281
|
+
exports.SwdLinkTester = SwdLinkTester;
|
|
282
|
+
class I2cLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
276
283
|
get_signals() {
|
|
277
284
|
if (!this.link)
|
|
278
285
|
return [];
|
|
@@ -321,15 +328,15 @@ export class I2cLinkTester extends CompositePortLinkConverterBase {
|
|
|
321
328
|
const targets = [];
|
|
322
329
|
for (const v of this.ports) {
|
|
323
330
|
switch (v.type) {
|
|
324
|
-
case PortType.I2cPullupPort: {
|
|
331
|
+
case electronics_model_1.PortType.I2cPullupPort: {
|
|
325
332
|
pull.push(v);
|
|
326
333
|
break;
|
|
327
334
|
}
|
|
328
|
-
case PortType.I2cController: {
|
|
335
|
+
case electronics_model_1.PortType.I2cController: {
|
|
329
336
|
controllers.push(v);
|
|
330
337
|
break;
|
|
331
338
|
}
|
|
332
|
-
case PortType.I2cTarget: {
|
|
339
|
+
case electronics_model_1.PortType.I2cTarget: {
|
|
333
340
|
targets.push(v);
|
|
334
341
|
break;
|
|
335
342
|
}
|
|
@@ -349,7 +356,8 @@ export class I2cLinkTester extends CompositePortLinkConverterBase {
|
|
|
349
356
|
return true;
|
|
350
357
|
}
|
|
351
358
|
}
|
|
352
|
-
|
|
359
|
+
exports.I2cLinkTester = I2cLinkTester;
|
|
360
|
+
class I2sLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
353
361
|
get_signals() {
|
|
354
362
|
if (!this.link)
|
|
355
363
|
return [];
|
|
@@ -405,11 +413,11 @@ export class I2sLinkTester extends CompositePortLinkConverterBase {
|
|
|
405
413
|
const target_receivers = [];
|
|
406
414
|
for (const v of this.ports) {
|
|
407
415
|
switch (v.type) {
|
|
408
|
-
case PortType.I2sController: {
|
|
416
|
+
case electronics_model_1.PortType.I2sController: {
|
|
409
417
|
controllers.push(v);
|
|
410
418
|
break;
|
|
411
419
|
}
|
|
412
|
-
case PortType.I2sTargetReceiver: {
|
|
420
|
+
case electronics_model_1.PortType.I2sTargetReceiver: {
|
|
413
421
|
target_receivers.push(v);
|
|
414
422
|
break;
|
|
415
423
|
}
|
|
@@ -428,7 +436,8 @@ export class I2sLinkTester extends CompositePortLinkConverterBase {
|
|
|
428
436
|
return true;
|
|
429
437
|
}
|
|
430
438
|
}
|
|
431
|
-
|
|
439
|
+
exports.I2sLinkTester = I2sLinkTester;
|
|
440
|
+
class SpiLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
432
441
|
get_signals() {
|
|
433
442
|
if (!this.link)
|
|
434
443
|
return [];
|
|
@@ -484,11 +493,11 @@ export class SpiLinkTester extends CompositePortLinkConverterBase {
|
|
|
484
493
|
const peripherals = [];
|
|
485
494
|
for (const v of this.ports) {
|
|
486
495
|
switch (v.type) {
|
|
487
|
-
case PortType.SpiController: {
|
|
496
|
+
case electronics_model_1.PortType.SpiController: {
|
|
488
497
|
controllers.push(v);
|
|
489
498
|
break;
|
|
490
499
|
}
|
|
491
|
-
case PortType.SpiPeripheral: {
|
|
500
|
+
case electronics_model_1.PortType.SpiPeripheral: {
|
|
492
501
|
peripherals.push(v);
|
|
493
502
|
break;
|
|
494
503
|
}
|
|
@@ -507,7 +516,8 @@ export class SpiLinkTester extends CompositePortLinkConverterBase {
|
|
|
507
516
|
return true;
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
|
-
|
|
519
|
+
exports.SpiLinkTester = SpiLinkTester;
|
|
520
|
+
class SpeakerLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
511
521
|
get_signals() {
|
|
512
522
|
if (!this.link)
|
|
513
523
|
return [];
|
|
@@ -547,11 +557,11 @@ export class SpeakerLinkTester extends CompositePortLinkConverterBase {
|
|
|
547
557
|
const sinks = [];
|
|
548
558
|
for (const v of this.ports) {
|
|
549
559
|
switch (v.type) {
|
|
550
|
-
case PortType.SpeakerDriverPort: {
|
|
560
|
+
case electronics_model_1.PortType.SpeakerDriverPort: {
|
|
551
561
|
sources.push(v);
|
|
552
562
|
break;
|
|
553
563
|
}
|
|
554
|
-
case PortType.SpeakerPort: {
|
|
564
|
+
case electronics_model_1.PortType.SpeakerPort: {
|
|
555
565
|
sinks.push(v);
|
|
556
566
|
break;
|
|
557
567
|
}
|
|
@@ -570,7 +580,8 @@ export class SpeakerLinkTester extends CompositePortLinkConverterBase {
|
|
|
570
580
|
return true;
|
|
571
581
|
}
|
|
572
582
|
}
|
|
573
|
-
|
|
583
|
+
exports.SpeakerLinkTester = SpeakerLinkTester;
|
|
584
|
+
class UartLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
574
585
|
get_signals() {
|
|
575
586
|
if (!this.link)
|
|
576
587
|
return [];
|
|
@@ -608,7 +619,7 @@ export class UartLinkTester extends CompositePortLinkConverterBase {
|
|
|
608
619
|
init_link() {
|
|
609
620
|
const ports = [];
|
|
610
621
|
for (const v of this.ports) {
|
|
611
|
-
if (v.type === PortType.UartPort) {
|
|
622
|
+
if (v.type === electronics_model_1.PortType.UartPort) {
|
|
612
623
|
ports.push(v);
|
|
613
624
|
}
|
|
614
625
|
}
|
|
@@ -622,7 +633,8 @@ export class UartLinkTester extends CompositePortLinkConverterBase {
|
|
|
622
633
|
return true;
|
|
623
634
|
}
|
|
624
635
|
}
|
|
625
|
-
|
|
636
|
+
exports.UartLinkTester = UartLinkTester;
|
|
637
|
+
class UsbLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
626
638
|
get_signals() {
|
|
627
639
|
if (!this.link)
|
|
628
640
|
return [];
|
|
@@ -671,15 +683,15 @@ export class UsbLinkTester extends CompositePortLinkConverterBase {
|
|
|
671
683
|
const passive = [];
|
|
672
684
|
for (const v of this.ports) {
|
|
673
685
|
switch (v.type) {
|
|
674
|
-
case PortType.UsbHostPort: {
|
|
686
|
+
case electronics_model_1.PortType.UsbHostPort: {
|
|
675
687
|
hosts.push(v);
|
|
676
688
|
break;
|
|
677
689
|
}
|
|
678
|
-
case PortType.UsbDevicePort: {
|
|
690
|
+
case electronics_model_1.PortType.UsbDevicePort: {
|
|
679
691
|
devices.push(v);
|
|
680
692
|
break;
|
|
681
693
|
}
|
|
682
|
-
case PortType.UsbPassivePort: {
|
|
694
|
+
case electronics_model_1.PortType.UsbPassivePort: {
|
|
683
695
|
passive.push(v);
|
|
684
696
|
break;
|
|
685
697
|
}
|
|
@@ -699,7 +711,8 @@ export class UsbLinkTester extends CompositePortLinkConverterBase {
|
|
|
699
711
|
return true;
|
|
700
712
|
}
|
|
701
713
|
}
|
|
702
|
-
|
|
714
|
+
exports.UsbLinkTester = UsbLinkTester;
|
|
715
|
+
class UsbCcLinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
703
716
|
get_signals() {
|
|
704
717
|
if (!this.link)
|
|
705
718
|
return [];
|
|
@@ -737,7 +750,7 @@ export class UsbCcLinkTester extends CompositePortLinkConverterBase {
|
|
|
737
750
|
init_link() {
|
|
738
751
|
const nodes = [];
|
|
739
752
|
for (const v of this.ports) {
|
|
740
|
-
if (v.type === PortType.UsbCcPort) {
|
|
753
|
+
if (v.type === electronics_model_1.PortType.UsbCcPort) {
|
|
741
754
|
nodes.push(v);
|
|
742
755
|
}
|
|
743
756
|
}
|
|
@@ -751,7 +764,8 @@ export class UsbCcLinkTester extends CompositePortLinkConverterBase {
|
|
|
751
764
|
return true;
|
|
752
765
|
}
|
|
753
766
|
}
|
|
754
|
-
|
|
767
|
+
exports.UsbCcLinkTester = UsbCcLinkTester;
|
|
768
|
+
class Dvp8LinkTester extends converter_base_1.CompositePortLinkConverterBase {
|
|
755
769
|
get_signals() {
|
|
756
770
|
if (!this.link)
|
|
757
771
|
return [];
|
|
@@ -927,11 +941,11 @@ export class Dvp8LinkTester extends CompositePortLinkConverterBase {
|
|
|
927
941
|
const cams = [];
|
|
928
942
|
for (const v of this.ports) {
|
|
929
943
|
switch (v.type) {
|
|
930
|
-
case PortType.Dvp8Host: {
|
|
944
|
+
case electronics_model_1.PortType.Dvp8Host: {
|
|
931
945
|
hosts.push(v);
|
|
932
946
|
break;
|
|
933
947
|
}
|
|
934
|
-
case PortType.Dvp8Camera: {
|
|
948
|
+
case electronics_model_1.PortType.Dvp8Camera: {
|
|
935
949
|
cams.push(v);
|
|
936
950
|
break;
|
|
937
951
|
}
|
|
@@ -950,3 +964,4 @@ export class Dvp8LinkTester extends CompositePortLinkConverterBase {
|
|
|
950
964
|
return true;
|
|
951
965
|
}
|
|
952
966
|
}
|
|
967
|
+
exports.Dvp8LinkTester = Dvp8LinkTester;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./converters"), exports);
|
|
18
|
+
__exportStar(require("./converter_base"), exports);
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./context"), exports);
|
|
18
|
+
__exportStar(require("./layout"), exports);
|
|
19
|
+
__exportStar(require("./netlist_converter"), exports);
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Layout = exports.BLOCK_PIN_GAP = void 0;
|
|
4
|
+
exports.get_power_pos = get_power_pos;
|
|
5
|
+
const constraints_1 = require("../../utils/constraints");
|
|
2
6
|
const POWER_START_Y = 30;
|
|
3
|
-
const POWER_START_X = PAPER_SIZE.A4.height - 30;
|
|
7
|
+
const POWER_START_X = constraints_1.PAPER_SIZE.A4.height - 30;
|
|
4
8
|
const POWER_Y_STEP = 16;
|
|
5
|
-
|
|
9
|
+
function get_power_pos(pwr_number) {
|
|
6
10
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
7
11
|
}
|
|
8
12
|
const BLOCK_START_Y = 36;
|
|
9
13
|
const BLOCK_START_X = BLOCK_START_Y;
|
|
10
|
-
|
|
14
|
+
exports.BLOCK_PIN_GAP = 4;
|
|
11
15
|
const BLOCK_MARGIN_TOP = 8;
|
|
12
16
|
const BLOCK_WIDTH = 36;
|
|
13
17
|
const BLOCK_MARGIN_LEFT = 16;
|
|
14
18
|
const BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
15
|
-
|
|
19
|
+
class Layout {
|
|
16
20
|
width = BLOCK_START_X;
|
|
17
21
|
height = BLOCK_START_Y;
|
|
18
22
|
max_height = 0;
|
|
19
23
|
get_block_rect(pin_num) {
|
|
20
|
-
const block_height = (BLOCK_PIN_GAP * pin_num) / 2 + BLOCK_PIN_GAP * 2;
|
|
24
|
+
const block_height = (exports.BLOCK_PIN_GAP * pin_num) / 2 + exports.BLOCK_PIN_GAP * 2;
|
|
21
25
|
const rect = {
|
|
22
26
|
pos: {
|
|
23
27
|
x: this.width,
|
|
@@ -38,3 +42,4 @@ export class Layout {
|
|
|
38
42
|
return rect;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
45
|
+
exports.Layout = Layout;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NetListConverter = void 0;
|
|
4
|
+
const electronics_model_1 = require("@modular-circuit/electronics-model");
|
|
5
|
+
const ir_1 = require("@modular-circuit/ir");
|
|
6
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
7
|
+
const label_1 = require("../../kicad/label");
|
|
8
|
+
const sheet_1 = require("../../kicad/sheet");
|
|
9
|
+
const symbols_1 = require("../../kicad/symbols");
|
|
10
|
+
const constraints_1 = require("../../utils/constraints");
|
|
11
|
+
const layout_1 = require("./layout");
|
|
12
|
+
class NetListConverter {
|
|
10
13
|
ctx;
|
|
11
14
|
block_calc;
|
|
12
15
|
sheet_pwr_count = 0;
|
|
@@ -29,7 +32,7 @@ export class NetListConverter {
|
|
|
29
32
|
const all_sch = {};
|
|
30
33
|
for (const [k, v] of Object.entries(this.ctx.netlist.schematics)) {
|
|
31
34
|
this.sheet_pwr_count = 0;
|
|
32
|
-
this.block_calc = new Layout();
|
|
35
|
+
this.block_calc = new layout_1.Layout();
|
|
33
36
|
all_sch[k] = this.convert_sch(k, v);
|
|
34
37
|
}
|
|
35
38
|
return all_sch;
|
|
@@ -44,15 +47,15 @@ export class NetListConverter {
|
|
|
44
47
|
convert_sch(name, schematic) {
|
|
45
48
|
const powers = new Set();
|
|
46
49
|
const sch = {
|
|
47
|
-
version: SCH_VERSION,
|
|
48
|
-
generator: GENERATOR_NAME,
|
|
49
|
-
generator_version: GENERATOR_VERSION,
|
|
50
|
+
version: constraints_1.SCH_VERSION,
|
|
51
|
+
generator: constraints_1.GENERATOR_NAME,
|
|
52
|
+
generator_version: constraints_1.GENERATOR_VERSION,
|
|
50
53
|
paper: {
|
|
51
54
|
size: 'A4',
|
|
52
55
|
},
|
|
53
56
|
title_block: {
|
|
54
|
-
title: name.replace(`.${MODULAR_CIRCUIT_SCH_EXT}`, ''),
|
|
55
|
-
date: replaceAll(new Date().toISOString().slice(0, 10), '-', '/'),
|
|
57
|
+
title: name.replace(`.${ir_1.MODULAR_CIRCUIT_SCH_EXT}`, ''),
|
|
58
|
+
date: (0, utils_1.replaceAll)(new Date().toISOString().slice(0, 10), '-', '/'),
|
|
56
59
|
rev: '1.0',
|
|
57
60
|
comment: {
|
|
58
61
|
1: 'https://www.eda.cn',
|
|
@@ -71,16 +74,16 @@ export class NetListConverter {
|
|
|
71
74
|
for (const it of schematic.powers) {
|
|
72
75
|
if (!powers.has(it.value)) {
|
|
73
76
|
switch (it.shape) {
|
|
74
|
-
case PowerShape.VCC:
|
|
75
|
-
sch.lib_symbols?.symbols.push(gen_lib_vcc(it.value));
|
|
77
|
+
case electronics_model_1.PowerShape.VCC:
|
|
78
|
+
sch.lib_symbols?.symbols.push((0, symbols_1.gen_lib_vcc)(it.value));
|
|
76
79
|
break;
|
|
77
|
-
case PowerShape.GND:
|
|
78
|
-
sch.lib_symbols?.symbols.push(gen_lib_gnd(it.value));
|
|
80
|
+
case electronics_model_1.PowerShape.GND:
|
|
81
|
+
sch.lib_symbols?.symbols.push((0, symbols_1.gen_lib_gnd)(it.value));
|
|
79
82
|
break;
|
|
80
83
|
}
|
|
81
84
|
powers.add(it.value);
|
|
82
85
|
}
|
|
83
|
-
this.convert_pwr_symbol(it, get_power_pos(this.sheet_pwr_count++), sch);
|
|
86
|
+
this.convert_pwr_symbol(it, (0, layout_1.get_power_pos)(this.sheet_pwr_count++), sch);
|
|
84
87
|
}
|
|
85
88
|
const sheet_names_count = new Map();
|
|
86
89
|
for (const it of schematic.sheet_symbols.sort((a, b) => {
|
|
@@ -96,14 +99,14 @@ export class NetListConverter {
|
|
|
96
99
|
}
|
|
97
100
|
convert_hierarchical_label(pin, sch) {
|
|
98
101
|
const pin_pos = this.block_calc.get_block_rect(1).pos;
|
|
99
|
-
sch.labels?.push(gen_hierarchical_label(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
|
|
102
|
+
sch.labels?.push((0, label_1.gen_hierarchical_label)(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
|
|
100
103
|
}
|
|
101
104
|
convert_pwr_symbol(pwr, at, sch) {
|
|
102
105
|
// NOTE : The power uuid is used as the uuid of its pin ,cause all power symbols have only one pin
|
|
103
106
|
const pin_id = pwr.uuid;
|
|
104
|
-
const sch_pwr_symbol = pwr.shape === PowerShape.VCC
|
|
105
|
-
? gen_sch_vcc(pwr.value, this.sheet_pwr_count, pin_id, at)
|
|
106
|
-
: gen_sch_gnd(pwr.value, this.sheet_pwr_count, pin_id, at);
|
|
107
|
+
const sch_pwr_symbol = pwr.shape === electronics_model_1.PowerShape.VCC
|
|
108
|
+
? (0, symbols_1.gen_sch_vcc)(pwr.value, this.sheet_pwr_count, pin_id, at)
|
|
109
|
+
: (0, symbols_1.gen_sch_gnd)(pwr.value, this.sheet_pwr_count, pin_id, at);
|
|
107
110
|
sch.symbols.push(sch_pwr_symbol);
|
|
108
111
|
this.convert_net_label(pwr.value, at, sch);
|
|
109
112
|
}
|
|
@@ -113,7 +116,7 @@ export class NetListConverter {
|
|
|
113
116
|
for (let i = 0; i < port_count; i++) {
|
|
114
117
|
const is_left = i < port_count / 2;
|
|
115
118
|
const x = is_left ? rect.pos.x : rect.pos.x + rect.size.x;
|
|
116
|
-
const y = rect.pos.y + BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
|
|
119
|
+
const y = rect.pos.y + layout_1.BLOCK_PIN_GAP * ((i < port_count / 2 ? i : i - port_count / 2) + 1);
|
|
117
120
|
const justify = is_left ? 'left' : 'right';
|
|
118
121
|
const rotation = is_left ? 180 : 0;
|
|
119
122
|
pins.push(this.convert_sheet_pin(sheet_sym.pins[i], { x, y }, sch, justify, rotation));
|
|
@@ -127,7 +130,7 @@ export class NetListConverter {
|
|
|
127
130
|
else {
|
|
128
131
|
sheet_names_count.set(sheet_name, 1);
|
|
129
132
|
}
|
|
130
|
-
sch.sheets.push(gen_sch_sheet(rect, pins, {
|
|
133
|
+
sch.sheets.push((0, sheet_1.gen_sch_sheet)(rect, pins, {
|
|
131
134
|
Sheetfile: sheet_sym.sheet_file_name,
|
|
132
135
|
Sheetname: sheet_name,
|
|
133
136
|
}));
|
|
@@ -136,9 +139,10 @@ export class NetListConverter {
|
|
|
136
139
|
if (this.pin_is_connected(pin.uuid)) {
|
|
137
140
|
this.convert_net_label(this.get_pin_net_name(pin.uuid), pin_pos, sch, horizontal === 'left' ? 'right' : 'left');
|
|
138
141
|
}
|
|
139
|
-
return gen_sheet_pin(pin.name, pin_pos, { horizontal, vertical: 'bottom' }, rotation, pin.shape);
|
|
142
|
+
return (0, label_1.gen_sheet_pin)(pin.name, pin_pos, { horizontal, vertical: 'bottom' }, rotation, pin.shape);
|
|
140
143
|
}
|
|
141
144
|
convert_net_label(net_name, pin_pos, sch, horizontal = 'right') {
|
|
142
|
-
sch.labels.push(gen_net_label(net_name, pin_pos, { horizontal, vertical: 'bottom' }));
|
|
145
|
+
sch.labels.push((0, label_1.gen_net_label)(net_name, pin_pos, { horizontal, vertical: 'bottom' }));
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
exports.NetListConverter = NetListConverter;
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./converter"), exports);
|
|
18
|
+
__exportStar(require("./builder"), exports);
|
|
19
|
+
__exportStar(require("./kicad/project"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./kicad/symbols"), exports);
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./net_label"), exports);
|
|
18
|
+
__exportStar(require("./sheet_pin"), exports);
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_net_label = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../constraints");
|
|
6
|
+
const gen_net_label = (name, at, justify) => ({
|
|
4
7
|
label_type: 'label',
|
|
5
8
|
text: name,
|
|
6
9
|
fields: [],
|
|
7
10
|
fields_autoplaced: true,
|
|
8
11
|
at: { position: at, rotation: 0 },
|
|
9
12
|
effects: {
|
|
10
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
13
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
11
14
|
justify: justify,
|
|
12
15
|
},
|
|
13
|
-
uuid: gen_uuid(),
|
|
16
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
14
17
|
});
|
|
18
|
+
exports.gen_net_label = gen_net_label;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gen_hierarchical_label = exports.gen_sheet_pin = void 0;
|
|
4
|
+
const utils_1 = require("@modular-circuit/utils");
|
|
5
|
+
const constraints_1 = require("../constraints");
|
|
3
6
|
const gen_base_hierarchical_label = (text, at, justify, rotation, shape) => ({
|
|
4
7
|
shape,
|
|
5
8
|
effects: {
|
|
6
|
-
font: { size: DEFAULT_FONT_SIZE },
|
|
9
|
+
font: { size: constraints_1.DEFAULT_FONT_SIZE },
|
|
7
10
|
justify,
|
|
8
11
|
},
|
|
9
12
|
text,
|
|
10
13
|
at: { position: at, rotation },
|
|
11
|
-
uuid: gen_uuid(),
|
|
14
|
+
uuid: (0, utils_1.gen_uuid)(),
|
|
12
15
|
});
|
|
13
|
-
|
|
16
|
+
const gen_sheet_pin = (text, at, justify, rotation, shape) => ({
|
|
14
17
|
label_type: 'hierarchical_label',
|
|
15
18
|
...gen_base_hierarchical_label(text, at, justify, rotation, shape),
|
|
16
19
|
});
|
|
17
|
-
|
|
20
|
+
exports.gen_sheet_pin = gen_sheet_pin;
|
|
21
|
+
exports.gen_hierarchical_label = exports.gen_sheet_pin;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./wildcards_and_files_ext"), exports);
|
|
18
|
+
__exportStar(require("./kicad_project_achieve"), exports);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kicad_prl = void 0;
|
|
4
|
+
const kicad_prl = (prj_name) => ({
|
|
2
5
|
board: {
|
|
3
6
|
active_layer: 0,
|
|
4
7
|
active_layer_preset: '',
|
|
@@ -48,3 +51,4 @@ export const kicad_prl = (prj_name) => ({
|
|
|
48
51
|
files: [],
|
|
49
52
|
},
|
|
50
53
|
});
|
|
54
|
+
exports.kicad_prl = kicad_prl;
|