@modular-circuit/transpiler 0.2.8 → 0.2.10
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/dist/index.d.mts +1 -12
- package/dist/index.d.ts +1 -12
- package/dist/index.js +171 -97
- package/dist/index.mjs +109 -29
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -378,17 +378,6 @@ declare function collect_sub_sheets(dependencies: Record<string, string>, module
|
|
|
378
378
|
modules: Record<string, ModuleCircuit>;
|
|
379
379
|
}>;
|
|
380
380
|
|
|
381
|
-
interface Size {
|
|
382
|
-
height: number;
|
|
383
|
-
width: number;
|
|
384
|
-
}
|
|
385
|
-
declare const PAPER_SIZE: Record<string, Size>;
|
|
386
|
-
declare const DEFAULT_PAPER_SIZE: Size;
|
|
387
|
-
declare const GENERATOR_NAME = "modular_circuit";
|
|
388
|
-
declare const SCH_VERSION = 20231120;
|
|
389
|
-
declare const PAPER = "A4";
|
|
390
|
-
declare const GENERATOR_VERSION = "8.0";
|
|
391
|
-
|
|
392
381
|
declare function filterNullOrUndefined(originalMethod: unknown, _context: ClassMethodDecoratorContext): (this: unknown, ...args: unknown[]) => any;
|
|
393
382
|
|
|
394
383
|
declare const tab = "\t";
|
|
@@ -425,4 +414,4 @@ declare const gen_sch_gnd: (value: string, pwr_number: number, port_id: string,
|
|
|
425
414
|
|
|
426
415
|
declare const gen_sch_vcc: (value: string, pwr_number: number, port_id: string, position: VECTOR2) => SCH_SYMBOL;
|
|
427
416
|
|
|
428
|
-
export { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, type BlockLabelPadding, type BlockSize, type BoxGeometry, type ConnectionGraphMap, type ConvertGraphToKiCadContext, type ConvertGraphToKiCadInput,
|
|
417
|
+
export { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, type BlockLabelPadding, type BlockSize, type BoxGeometry, type ConnectionGraphMap, type ConvertGraphToKiCadContext, type ConvertGraphToKiCadInput, FONT_SIZE, GRID_SIZE, GraphConverter, KICAD_SCH_FRAME, KiCadProjectArchive, type LabelPadding, Layout, NetListConverter, type NetlistProject, type NetlistToKicadContext, SCHEMATIC_PRINTER, StringFormatter, WIRE_PADDING, collect_sub_sheets, collect_sub_sheets_by_id, convert_graph_to_design_block, convert_graph_to_kicad_project, convert_graph_to_sheets, filterNullOrUndefined, fmt_module_place_holder_sch_name, fmt_to_valid_filename, gen_empty_sch, gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc, get_power_pos, get_sch_default_drawing_sheet, tab };
|
package/dist/index.d.ts
CHANGED
|
@@ -378,17 +378,6 @@ declare function collect_sub_sheets(dependencies: Record<string, string>, module
|
|
|
378
378
|
modules: Record<string, ModuleCircuit>;
|
|
379
379
|
}>;
|
|
380
380
|
|
|
381
|
-
interface Size {
|
|
382
|
-
height: number;
|
|
383
|
-
width: number;
|
|
384
|
-
}
|
|
385
|
-
declare const PAPER_SIZE: Record<string, Size>;
|
|
386
|
-
declare const DEFAULT_PAPER_SIZE: Size;
|
|
387
|
-
declare const GENERATOR_NAME = "modular_circuit";
|
|
388
|
-
declare const SCH_VERSION = 20231120;
|
|
389
|
-
declare const PAPER = "A4";
|
|
390
|
-
declare const GENERATOR_VERSION = "8.0";
|
|
391
|
-
|
|
392
381
|
declare function filterNullOrUndefined(originalMethod: unknown, _context: ClassMethodDecoratorContext): (this: unknown, ...args: unknown[]) => any;
|
|
393
382
|
|
|
394
383
|
declare const tab = "\t";
|
|
@@ -425,4 +414,4 @@ declare const gen_sch_gnd: (value: string, pwr_number: number, port_id: string,
|
|
|
425
414
|
|
|
426
415
|
declare const gen_sch_vcc: (value: string, pwr_number: number, port_id: string, position: VECTOR2) => SCH_SYMBOL;
|
|
427
416
|
|
|
428
|
-
export { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, type BlockLabelPadding, type BlockSize, type BoxGeometry, type ConnectionGraphMap, type ConvertGraphToKiCadContext, type ConvertGraphToKiCadInput,
|
|
417
|
+
export { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, type BlockLabelPadding, type BlockSize, type BoxGeometry, type ConnectionGraphMap, type ConvertGraphToKiCadContext, type ConvertGraphToKiCadInput, FONT_SIZE, GRID_SIZE, GraphConverter, KICAD_SCH_FRAME, KiCadProjectArchive, type LabelPadding, Layout, NetListConverter, type NetlistProject, type NetlistToKicadContext, SCHEMATIC_PRINTER, StringFormatter, WIRE_PADDING, collect_sub_sheets, collect_sub_sheets_by_id, convert_graph_to_design_block, convert_graph_to_kicad_project, convert_graph_to_sheets, filterNullOrUndefined, fmt_module_place_holder_sch_name, fmt_to_valid_filename, gen_empty_sch, gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc, get_power_pos, get_sch_default_drawing_sheet, tab };
|
package/dist/index.js
CHANGED
|
@@ -76,20 +76,14 @@ var index_exports = {};
|
|
|
76
76
|
__export(index_exports, {
|
|
77
77
|
BLOCK_PIN_GAP: () => BLOCK_PIN_GAP,
|
|
78
78
|
BLOCK_PIN_TB_MARGIN: () => BLOCK_PIN_TB_MARGIN,
|
|
79
|
-
DEFAULT_PAPER_SIZE: () => DEFAULT_PAPER_SIZE,
|
|
80
79
|
FONT_SIZE: () => FONT_SIZE,
|
|
81
|
-
GENERATOR_NAME: () => GENERATOR_NAME,
|
|
82
|
-
GENERATOR_VERSION: () => GENERATOR_VERSION,
|
|
83
80
|
GRID_SIZE: () => GRID_SIZE,
|
|
84
81
|
GraphConverter: () => GraphConverter,
|
|
85
82
|
KICAD_SCH_FRAME: () => KICAD_SCH_FRAME,
|
|
86
83
|
KiCadProjectArchive: () => KiCadProjectArchive,
|
|
87
84
|
Layout: () => Layout,
|
|
88
85
|
NetListConverter: () => NetListConverter,
|
|
89
|
-
PAPER: () => PAPER,
|
|
90
|
-
PAPER_SIZE: () => PAPER_SIZE,
|
|
91
86
|
SCHEMATIC_PRINTER: () => SCHEMATIC_PRINTER,
|
|
92
|
-
SCH_VERSION: () => SCH_VERSION,
|
|
93
87
|
StringFormatter: () => StringFormatter,
|
|
94
88
|
WIRE_PADDING: () => WIRE_PADDING,
|
|
95
89
|
collect_sub_sheets: () => collect_sub_sheets,
|
|
@@ -172,24 +166,6 @@ async function collect_sub_sheets(dependencies, module_resolver) {
|
|
|
172
166
|
return { sheets, module_main_sheet, modules };
|
|
173
167
|
}
|
|
174
168
|
|
|
175
|
-
// src/utils/constraints.ts
|
|
176
|
-
var PAPER_SIZE = {
|
|
177
|
-
A0: { width: 841, height: 1189 },
|
|
178
|
-
A1: { width: 594, height: 841 },
|
|
179
|
-
A2: { width: 420, height: 594 },
|
|
180
|
-
A3: { width: 297, height: 420 },
|
|
181
|
-
A4: { width: 210, height: 297 },
|
|
182
|
-
A5: { width: 148, height: 210 },
|
|
183
|
-
A6: { width: 105, height: 148 },
|
|
184
|
-
A7: { width: 74, height: 105 },
|
|
185
|
-
A8: { width: 52, height: 74 }
|
|
186
|
-
};
|
|
187
|
-
var DEFAULT_PAPER_SIZE = PAPER_SIZE.A4;
|
|
188
|
-
var GENERATOR_NAME = "modular_circuit";
|
|
189
|
-
var SCH_VERSION = 20231120;
|
|
190
|
-
var PAPER = "A4";
|
|
191
|
-
var GENERATOR_VERSION = "8.0";
|
|
192
|
-
|
|
193
169
|
// src/utils/filter_null_undefined.ts
|
|
194
170
|
function filterNullOrUndefined(originalMethod, _context) {
|
|
195
171
|
function replacementMethod(...args) {
|
|
@@ -353,11 +329,11 @@ var SCHEMATIC_PRINTER = class {
|
|
|
353
329
|
})();
|
|
354
330
|
return `
|
|
355
331
|
(kicad_sch
|
|
356
|
-
(version ${SCH_VERSION})
|
|
357
|
-
(generator "${GENERATOR_NAME}")
|
|
358
|
-
(generator_version "${GENERATOR_VERSION}")
|
|
332
|
+
(version ${import_utils4.SCH_VERSION})
|
|
333
|
+
(generator "${import_utils4.GENERATOR_NAME}")
|
|
334
|
+
(generator_version "${import_utils4.GENERATOR_VERSION}")
|
|
359
335
|
(uuid "${(0, import_utils4.gen_uuid)()}")
|
|
360
|
-
(paper "${PAPER}")
|
|
336
|
+
(paper "${import_utils4.PAPER}")
|
|
361
337
|
${lib_symbols}
|
|
362
338
|
${wires}
|
|
363
339
|
${labels}
|
|
@@ -1545,6 +1521,105 @@ var Dvp8LinkTester = class extends CompositePortLinkConverterBase {
|
|
|
1545
1521
|
return true;
|
|
1546
1522
|
}
|
|
1547
1523
|
};
|
|
1524
|
+
var JtagLinkTester = class extends CompositePortLinkConverterBase {
|
|
1525
|
+
get_signals() {
|
|
1526
|
+
if (!this.link) return [];
|
|
1527
|
+
return [
|
|
1528
|
+
{
|
|
1529
|
+
name: "TCK",
|
|
1530
|
+
ports: [
|
|
1531
|
+
{
|
|
1532
|
+
parent: this.link.host,
|
|
1533
|
+
meta_port: this.link.host.TCK
|
|
1534
|
+
},
|
|
1535
|
+
{
|
|
1536
|
+
parent: this.link.target,
|
|
1537
|
+
meta_port: this.link.target.TCK
|
|
1538
|
+
}
|
|
1539
|
+
]
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
name: "TDI",
|
|
1543
|
+
ports: [
|
|
1544
|
+
{
|
|
1545
|
+
parent: this.link.host,
|
|
1546
|
+
meta_port: this.link.host.TDI
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
parent: this.link.target,
|
|
1550
|
+
meta_port: this.link.target.TDI
|
|
1551
|
+
}
|
|
1552
|
+
]
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
name: "TDO",
|
|
1556
|
+
ports: [
|
|
1557
|
+
{
|
|
1558
|
+
parent: this.link.host,
|
|
1559
|
+
meta_port: this.link.host.TDO
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
parent: this.link.target,
|
|
1563
|
+
meta_port: this.link.target.TDO
|
|
1564
|
+
}
|
|
1565
|
+
]
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
name: "TMS",
|
|
1569
|
+
ports: [
|
|
1570
|
+
{
|
|
1571
|
+
parent: this.link.host,
|
|
1572
|
+
meta_port: this.link.host.TMS
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
parent: this.link.target,
|
|
1576
|
+
meta_port: this.link.target.TMS
|
|
1577
|
+
}
|
|
1578
|
+
]
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
name: "TRST",
|
|
1582
|
+
ports: [
|
|
1583
|
+
{
|
|
1584
|
+
parent: this.link.host,
|
|
1585
|
+
meta_port: this.link.host.TRST
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
parent: this.link.target,
|
|
1589
|
+
meta_port: this.link.target.TRST
|
|
1590
|
+
}
|
|
1591
|
+
]
|
|
1592
|
+
}
|
|
1593
|
+
];
|
|
1594
|
+
}
|
|
1595
|
+
init_link() {
|
|
1596
|
+
const hosts = [];
|
|
1597
|
+
const targets = [];
|
|
1598
|
+
for (const v of this.ports) {
|
|
1599
|
+
switch (v.type) {
|
|
1600
|
+
case import_electronics_model2.PortType.JtagHostPort: {
|
|
1601
|
+
hosts.push(v);
|
|
1602
|
+
break;
|
|
1603
|
+
}
|
|
1604
|
+
case import_electronics_model2.PortType.JtagTargetPort: {
|
|
1605
|
+
targets.push(v);
|
|
1606
|
+
break;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (hosts.length !== 1) {
|
|
1611
|
+
return false;
|
|
1612
|
+
}
|
|
1613
|
+
if (targets.length !== 1) {
|
|
1614
|
+
return false;
|
|
1615
|
+
}
|
|
1616
|
+
this.link = {
|
|
1617
|
+
host: hosts[0],
|
|
1618
|
+
target: targets[0]
|
|
1619
|
+
};
|
|
1620
|
+
return true;
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1548
1623
|
|
|
1549
1624
|
// src/converter/link_to_netlist/converter.ts
|
|
1550
1625
|
var LINK_CONVERTER = class {
|
|
@@ -1633,6 +1708,10 @@ var LINK_CONVERTER = class {
|
|
|
1633
1708
|
this.do_convert(Dvp8LinkTester, v, cc);
|
|
1634
1709
|
break;
|
|
1635
1710
|
}
|
|
1711
|
+
case import_electronics_model3.LinkType.JtagLink: {
|
|
1712
|
+
this.do_convert(JtagLinkTester, v, cc);
|
|
1713
|
+
break;
|
|
1714
|
+
}
|
|
1636
1715
|
default: {
|
|
1637
1716
|
throw new Error(`Unhandled link type: ${k}`);
|
|
1638
1717
|
}
|
|
@@ -1732,12 +1811,13 @@ var GraphConverter = class {
|
|
|
1732
1811
|
};
|
|
1733
1812
|
|
|
1734
1813
|
// src/converter/netlist_to_kicad/layout.ts
|
|
1814
|
+
var import_utils6 = require("@modular-circuit/utils");
|
|
1735
1815
|
var import_elk_bundled = __toESM(require("elkjs/lib/elk.bundled.js"));
|
|
1736
1816
|
var MIL_TO_MM = 0.0254;
|
|
1737
1817
|
var GRID_SIZE = 50 * MIL_TO_MM;
|
|
1738
1818
|
var FONT_SIZE = GRID_SIZE;
|
|
1739
1819
|
var POWER_START_Y = 30 * GRID_SIZE;
|
|
1740
|
-
var POWER_START_X = (PAPER_SIZE.A4.height - 30) * GRID_SIZE;
|
|
1820
|
+
var POWER_START_X = (import_utils6.PAPER_SIZE.A4.height - 30) * GRID_SIZE;
|
|
1741
1821
|
var POWER_Y_STEP = 16 * GRID_SIZE;
|
|
1742
1822
|
var BLOCK_V_SPACE = 8 * GRID_SIZE;
|
|
1743
1823
|
var BLOCK_H_SPACE = 14 * GRID_SIZE - BLOCK_V_SPACE;
|
|
@@ -1775,8 +1855,8 @@ var Layout = class {
|
|
|
1775
1855
|
"org.eclipse.elk.aspectRatio": "1.414",
|
|
1776
1856
|
"elk.spacing.nodeNode": `${BLOCK_V_SPACE}`,
|
|
1777
1857
|
"elk.padding": `[top=${PADDING_TOP},left=${PADDING},bottom=${PADDING},right=${PADDING}]`,
|
|
1778
|
-
"elk.childAreaWidth": `${PAPER_SIZE.A4.height}`,
|
|
1779
|
-
"elk.childAreaHeight": `${PAPER_SIZE.A4.width}`
|
|
1858
|
+
"elk.childAreaWidth": `${import_utils6.PAPER_SIZE.A4.height}`,
|
|
1859
|
+
"elk.childAreaHeight": `${import_utils6.PAPER_SIZE.A4.width}`
|
|
1780
1860
|
},
|
|
1781
1861
|
children: [],
|
|
1782
1862
|
edges: []
|
|
@@ -1835,10 +1915,10 @@ var Layout = class {
|
|
|
1835
1915
|
// src/converter/netlist_to_kicad/netlist_converter.ts
|
|
1836
1916
|
var import_electronics_model8 = require("@modular-circuit/electronics-model");
|
|
1837
1917
|
var import_ir4 = require("@modular-circuit/ir");
|
|
1838
|
-
var
|
|
1918
|
+
var import_utils15 = require("@modular-circuit/utils");
|
|
1839
1919
|
|
|
1840
1920
|
// src/kicad/label/net_label.ts
|
|
1841
|
-
var
|
|
1921
|
+
var import_utils7 = require("@modular-circuit/utils");
|
|
1842
1922
|
var gen_net_label = (name, at, justify) => ({
|
|
1843
1923
|
label_type: "label",
|
|
1844
1924
|
text: name,
|
|
@@ -1846,23 +1926,23 @@ var gen_net_label = (name, at, justify) => ({
|
|
|
1846
1926
|
fields_autoplaced: true,
|
|
1847
1927
|
at: { position: at, rotation: 0 },
|
|
1848
1928
|
effects: {
|
|
1849
|
-
font: { size:
|
|
1929
|
+
font: { size: import_utils7.DEFAULT_FONT_SIZE },
|
|
1850
1930
|
justify
|
|
1851
1931
|
},
|
|
1852
|
-
uuid: (0,
|
|
1932
|
+
uuid: (0, import_utils7.gen_uuid)()
|
|
1853
1933
|
});
|
|
1854
1934
|
|
|
1855
1935
|
// src/kicad/label/sheet_pin.ts
|
|
1856
|
-
var
|
|
1936
|
+
var import_utils8 = require("@modular-circuit/utils");
|
|
1857
1937
|
var gen_base_hierarchical_label = (text, at, justify, rotation, shape) => ({
|
|
1858
1938
|
shape,
|
|
1859
1939
|
effects: {
|
|
1860
|
-
font: { size:
|
|
1940
|
+
font: { size: import_utils8.DEFAULT_FONT_SIZE },
|
|
1861
1941
|
justify
|
|
1862
1942
|
},
|
|
1863
1943
|
text,
|
|
1864
1944
|
at: { position: at, rotation },
|
|
1865
|
-
uuid: (0,
|
|
1945
|
+
uuid: (0, import_utils8.gen_uuid)()
|
|
1866
1946
|
});
|
|
1867
1947
|
var gen_sheet_pin = (text, at, justify, rotation, shape) => ({
|
|
1868
1948
|
label_type: "hierarchical_label",
|
|
@@ -1871,7 +1951,7 @@ var gen_sheet_pin = (text, at, justify, rotation, shape) => ({
|
|
|
1871
1951
|
var gen_hierarchical_label = gen_sheet_pin;
|
|
1872
1952
|
|
|
1873
1953
|
// src/kicad/sheet/sheet.ts
|
|
1874
|
-
var
|
|
1954
|
+
var import_utils9 = require("@modular-circuit/utils");
|
|
1875
1955
|
var TEXT_MARGIN = 0.7116;
|
|
1876
1956
|
var gen_sch_sheet = (rect, pins, fields) => ({
|
|
1877
1957
|
// NOTE no rotation in the sheet
|
|
@@ -1884,7 +1964,7 @@ var gen_sch_sheet = (rect, pins, fields) => ({
|
|
|
1884
1964
|
text: fields.Sheetname,
|
|
1885
1965
|
at: { position: { x: rect.pos.x, y: rect.pos.y - TEXT_MARGIN }, rotation: 0 },
|
|
1886
1966
|
effects: {
|
|
1887
|
-
font: { size:
|
|
1967
|
+
font: { size: import_utils9.DEFAULT_FONT_SIZE },
|
|
1888
1968
|
justify: {
|
|
1889
1969
|
vertical: "bottom",
|
|
1890
1970
|
horizontal: "left"
|
|
@@ -1896,7 +1976,7 @@ var gen_sch_sheet = (rect, pins, fields) => ({
|
|
|
1896
1976
|
text: fields.Sheetfile,
|
|
1897
1977
|
at: { position: { x: rect.pos.x, y: rect.pos.y + rect.size.y + TEXT_MARGIN }, rotation: 0 },
|
|
1898
1978
|
effects: {
|
|
1899
|
-
font: { size:
|
|
1979
|
+
font: { size: import_utils9.DEFAULT_FONT_SIZE },
|
|
1900
1980
|
justify: {
|
|
1901
1981
|
vertical: "top",
|
|
1902
1982
|
horizontal: "left"
|
|
@@ -1912,13 +1992,13 @@ var gen_sch_sheet = (rect, pins, fields) => ({
|
|
|
1912
1992
|
fill: {
|
|
1913
1993
|
color: { r: 0, g: 0, b: 0, a: 0 }
|
|
1914
1994
|
},
|
|
1915
|
-
uuid: (0,
|
|
1995
|
+
uuid: (0, import_utils9.gen_uuid)()
|
|
1916
1996
|
});
|
|
1917
1997
|
|
|
1918
1998
|
// src/kicad/symbols/lib_symbol/gnd.ts
|
|
1919
1999
|
var import_electronics_model5 = require("@modular-circuit/electronics-model");
|
|
1920
2000
|
var import_ir2 = require("@modular-circuit/ir");
|
|
1921
|
-
var
|
|
2001
|
+
var import_utils10 = require("@modular-circuit/utils");
|
|
1922
2002
|
var gen_lib_gnd = (value) => ({
|
|
1923
2003
|
name: `power:${value}`,
|
|
1924
2004
|
pin_numbers: {
|
|
@@ -1938,7 +2018,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1938
2018
|
text: "#PWR",
|
|
1939
2019
|
at: { position: { x: 0, y: -6.35 }, rotation: 0 },
|
|
1940
2020
|
effects: {
|
|
1941
|
-
font: { size:
|
|
2021
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE },
|
|
1942
2022
|
hide: true
|
|
1943
2023
|
}
|
|
1944
2024
|
},
|
|
@@ -1947,7 +2027,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1947
2027
|
text: `${value}`,
|
|
1948
2028
|
at: { position: { x: 0, y: -3.81 }, rotation: 0 },
|
|
1949
2029
|
effects: {
|
|
1950
|
-
font: { size:
|
|
2030
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE }
|
|
1951
2031
|
}
|
|
1952
2032
|
},
|
|
1953
2033
|
{
|
|
@@ -1955,7 +2035,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1955
2035
|
text: "",
|
|
1956
2036
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
1957
2037
|
effects: {
|
|
1958
|
-
font: { size:
|
|
2038
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE },
|
|
1959
2039
|
hide: true
|
|
1960
2040
|
}
|
|
1961
2041
|
},
|
|
@@ -1964,7 +2044,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1964
2044
|
text: "",
|
|
1965
2045
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
1966
2046
|
effects: {
|
|
1967
|
-
font: { size:
|
|
2047
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE },
|
|
1968
2048
|
hide: true
|
|
1969
2049
|
}
|
|
1970
2050
|
},
|
|
@@ -1973,7 +2053,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1973
2053
|
text: 'Power symbol creates a global label with name \\"GND\\" , ground',
|
|
1974
2054
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
1975
2055
|
effects: {
|
|
1976
|
-
font: { size:
|
|
2056
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE },
|
|
1977
2057
|
hide: true
|
|
1978
2058
|
}
|
|
1979
2059
|
},
|
|
@@ -1982,7 +2062,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
1982
2062
|
text: "global power",
|
|
1983
2063
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
1984
2064
|
effects: {
|
|
1985
|
-
font: { size:
|
|
2065
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE },
|
|
1986
2066
|
hide: true
|
|
1987
2067
|
}
|
|
1988
2068
|
}
|
|
@@ -2023,13 +2103,13 @@ var gen_lib_gnd = (value) => ({
|
|
|
2023
2103
|
name: {
|
|
2024
2104
|
text: "~",
|
|
2025
2105
|
effects: {
|
|
2026
|
-
font: { size:
|
|
2106
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE }
|
|
2027
2107
|
}
|
|
2028
2108
|
},
|
|
2029
2109
|
number: {
|
|
2030
2110
|
text: "1",
|
|
2031
2111
|
effects: {
|
|
2032
|
-
font: { size:
|
|
2112
|
+
font: { size: import_utils10.DEFAULT_FONT_SIZE }
|
|
2033
2113
|
}
|
|
2034
2114
|
}
|
|
2035
2115
|
}
|
|
@@ -2041,7 +2121,7 @@ var gen_lib_gnd = (value) => ({
|
|
|
2041
2121
|
// src/kicad/symbols/lib_symbol/vcc.ts
|
|
2042
2122
|
var import_electronics_model6 = require("@modular-circuit/electronics-model");
|
|
2043
2123
|
var import_ir3 = require("@modular-circuit/ir");
|
|
2044
|
-
var
|
|
2124
|
+
var import_utils11 = require("@modular-circuit/utils");
|
|
2045
2125
|
var gen_lib_vcc = (value) => ({
|
|
2046
2126
|
name: `power:${value}`,
|
|
2047
2127
|
power: true,
|
|
@@ -2062,7 +2142,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2062
2142
|
text: "#PWR",
|
|
2063
2143
|
at: { position: { x: 0, y: -3.81 }, rotation: 0 },
|
|
2064
2144
|
effects: {
|
|
2065
|
-
font: { size:
|
|
2145
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE },
|
|
2066
2146
|
hide: true
|
|
2067
2147
|
}
|
|
2068
2148
|
},
|
|
@@ -2071,7 +2151,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2071
2151
|
text: `${value}`,
|
|
2072
2152
|
at: { position: { x: 0, y: 3.556 }, rotation: 0 },
|
|
2073
2153
|
effects: {
|
|
2074
|
-
font: { size:
|
|
2154
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE }
|
|
2075
2155
|
}
|
|
2076
2156
|
},
|
|
2077
2157
|
{
|
|
@@ -2079,7 +2159,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2079
2159
|
text: "",
|
|
2080
2160
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
2081
2161
|
effects: {
|
|
2082
|
-
font: { size:
|
|
2162
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE },
|
|
2083
2163
|
hide: true
|
|
2084
2164
|
}
|
|
2085
2165
|
},
|
|
@@ -2088,7 +2168,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2088
2168
|
text: "",
|
|
2089
2169
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
2090
2170
|
effects: {
|
|
2091
|
-
font: { size:
|
|
2171
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE },
|
|
2092
2172
|
hide: true
|
|
2093
2173
|
}
|
|
2094
2174
|
},
|
|
@@ -2097,7 +2177,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2097
2177
|
text: `Power symbol creates a global label with name \\"${value}\\"`,
|
|
2098
2178
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
2099
2179
|
effects: {
|
|
2100
|
-
font: { size:
|
|
2180
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE },
|
|
2101
2181
|
hide: true
|
|
2102
2182
|
}
|
|
2103
2183
|
},
|
|
@@ -2106,7 +2186,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2106
2186
|
text: "global power",
|
|
2107
2187
|
at: { position: { x: 0, y: 0 }, rotation: 0 },
|
|
2108
2188
|
effects: {
|
|
2109
|
-
font: { size:
|
|
2189
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE },
|
|
2110
2190
|
hide: true
|
|
2111
2191
|
}
|
|
2112
2192
|
}
|
|
@@ -2144,13 +2224,13 @@ var gen_lib_vcc = (value) => ({
|
|
|
2144
2224
|
name: {
|
|
2145
2225
|
text: "~",
|
|
2146
2226
|
effects: {
|
|
2147
|
-
font: { size:
|
|
2227
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE }
|
|
2148
2228
|
}
|
|
2149
2229
|
},
|
|
2150
2230
|
number: {
|
|
2151
2231
|
text: "1",
|
|
2152
2232
|
effects: {
|
|
2153
|
-
font: { size:
|
|
2233
|
+
font: { size: import_utils11.DEFAULT_FONT_SIZE }
|
|
2154
2234
|
}
|
|
2155
2235
|
}
|
|
2156
2236
|
}
|
|
@@ -2160,7 +2240,7 @@ var gen_lib_vcc = (value) => ({
|
|
|
2160
2240
|
});
|
|
2161
2241
|
|
|
2162
2242
|
// src/kicad/symbols/sch_symbol/gnd.ts
|
|
2163
|
-
var
|
|
2243
|
+
var import_utils12 = require("@modular-circuit/utils");
|
|
2164
2244
|
|
|
2165
2245
|
// src/kicad/symbols/symbol_utils.ts
|
|
2166
2246
|
var gen_pwr_ref = (pwr_num) => `#PWR${pwr_num}`;
|
|
@@ -2175,14 +2255,14 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2175
2255
|
on_board: true,
|
|
2176
2256
|
dnp: false,
|
|
2177
2257
|
fields_autoplaced: true,
|
|
2178
|
-
uuid: (0,
|
|
2258
|
+
uuid: (0, import_utils12.gen_uuid)(),
|
|
2179
2259
|
properties: [
|
|
2180
2260
|
{
|
|
2181
2261
|
name: "Reference",
|
|
2182
2262
|
text: gen_pwr_ref(pwr_number),
|
|
2183
2263
|
at: { position: { x: position.x, y: position.y + 6.35 }, rotation: 0 },
|
|
2184
2264
|
effects: {
|
|
2185
|
-
font: { size:
|
|
2265
|
+
font: { size: import_utils12.DEFAULT_FONT_SIZE },
|
|
2186
2266
|
hide: true
|
|
2187
2267
|
}
|
|
2188
2268
|
},
|
|
@@ -2191,7 +2271,7 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2191
2271
|
text: `${value}`,
|
|
2192
2272
|
at: { position: { x: position.x, y: position.y + 5.08 }, rotation: 0 },
|
|
2193
2273
|
effects: {
|
|
2194
|
-
font: { size:
|
|
2274
|
+
font: { size: import_utils12.DEFAULT_FONT_SIZE }
|
|
2195
2275
|
}
|
|
2196
2276
|
},
|
|
2197
2277
|
{
|
|
@@ -2199,7 +2279,7 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2199
2279
|
text: "",
|
|
2200
2280
|
at: { position, rotation: 0 },
|
|
2201
2281
|
effects: {
|
|
2202
|
-
font: { size:
|
|
2282
|
+
font: { size: import_utils12.DEFAULT_FONT_SIZE },
|
|
2203
2283
|
hide: true
|
|
2204
2284
|
}
|
|
2205
2285
|
},
|
|
@@ -2208,7 +2288,7 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2208
2288
|
text: "",
|
|
2209
2289
|
at: { position, rotation: 0 },
|
|
2210
2290
|
effects: {
|
|
2211
|
-
font: { size:
|
|
2291
|
+
font: { size: import_utils12.DEFAULT_FONT_SIZE },
|
|
2212
2292
|
hide: true
|
|
2213
2293
|
}
|
|
2214
2294
|
},
|
|
@@ -2217,7 +2297,7 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2217
2297
|
text: `Power symbol creates a global label with name \\"${value}\\" , ground`,
|
|
2218
2298
|
at: { position, rotation: 0 },
|
|
2219
2299
|
effects: {
|
|
2220
|
-
font: { size:
|
|
2300
|
+
font: { size: import_utils12.DEFAULT_FONT_SIZE },
|
|
2221
2301
|
hide: true
|
|
2222
2302
|
}
|
|
2223
2303
|
}
|
|
@@ -2231,7 +2311,7 @@ var gen_sch_gnd = (value, pwr_number, port_id, position) => ({
|
|
|
2231
2311
|
});
|
|
2232
2312
|
|
|
2233
2313
|
// src/kicad/symbols/sch_symbol/vcc.ts
|
|
2234
|
-
var
|
|
2314
|
+
var import_utils13 = require("@modular-circuit/utils");
|
|
2235
2315
|
var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
2236
2316
|
lib_id: `power:${value}`,
|
|
2237
2317
|
at: { position, rotation: 0 },
|
|
@@ -2241,14 +2321,14 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2241
2321
|
on_board: true,
|
|
2242
2322
|
dnp: false,
|
|
2243
2323
|
fields_autoplaced: true,
|
|
2244
|
-
uuid: (0,
|
|
2324
|
+
uuid: (0, import_utils13.gen_uuid)(),
|
|
2245
2325
|
properties: [
|
|
2246
2326
|
{
|
|
2247
2327
|
name: "Reference",
|
|
2248
2328
|
text: gen_pwr_ref(pwr_number),
|
|
2249
2329
|
at: { position: { x: position.x, y: position.y + 3.81 }, rotation: 0 },
|
|
2250
2330
|
effects: {
|
|
2251
|
-
font: { size:
|
|
2331
|
+
font: { size: import_utils13.DEFAULT_FONT_SIZE },
|
|
2252
2332
|
hide: true
|
|
2253
2333
|
}
|
|
2254
2334
|
},
|
|
@@ -2257,7 +2337,7 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2257
2337
|
text: `${value}`,
|
|
2258
2338
|
at: { position: { x: position.x, y: position.y - 5.08 }, rotation: 0 },
|
|
2259
2339
|
effects: {
|
|
2260
|
-
font: { size:
|
|
2340
|
+
font: { size: import_utils13.DEFAULT_FONT_SIZE }
|
|
2261
2341
|
}
|
|
2262
2342
|
},
|
|
2263
2343
|
{
|
|
@@ -2265,7 +2345,7 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2265
2345
|
text: "",
|
|
2266
2346
|
at: { position, rotation: 0 },
|
|
2267
2347
|
effects: {
|
|
2268
|
-
font: { size:
|
|
2348
|
+
font: { size: import_utils13.DEFAULT_FONT_SIZE },
|
|
2269
2349
|
hide: true
|
|
2270
2350
|
}
|
|
2271
2351
|
},
|
|
@@ -2274,7 +2354,7 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2274
2354
|
text: "",
|
|
2275
2355
|
at: { position, rotation: 0 },
|
|
2276
2356
|
effects: {
|
|
2277
|
-
font: { size:
|
|
2357
|
+
font: { size: import_utils13.DEFAULT_FONT_SIZE },
|
|
2278
2358
|
hide: true
|
|
2279
2359
|
}
|
|
2280
2360
|
},
|
|
@@ -2283,7 +2363,7 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2283
2363
|
text: `Power symbol creates a global label with name \\"${value}\\"`,
|
|
2284
2364
|
at: { position, rotation: 0 },
|
|
2285
2365
|
effects: {
|
|
2286
|
-
font: { size:
|
|
2366
|
+
font: { size: import_utils13.DEFAULT_FONT_SIZE },
|
|
2287
2367
|
hide: true
|
|
2288
2368
|
}
|
|
2289
2369
|
}
|
|
@@ -2298,7 +2378,7 @@ var gen_sch_vcc = (value, pwr_number, port_id, position) => ({
|
|
|
2298
2378
|
|
|
2299
2379
|
// src/kicad/wire/gen_wire.ts
|
|
2300
2380
|
var import_electronics_model7 = require("@modular-circuit/electronics-model");
|
|
2301
|
-
var
|
|
2381
|
+
var import_utils14 = require("@modular-circuit/utils");
|
|
2302
2382
|
var gen_wire = (start, end) => ({
|
|
2303
2383
|
stroke: {
|
|
2304
2384
|
type: "default",
|
|
@@ -2306,7 +2386,7 @@ var gen_wire = (start, end) => ({
|
|
|
2306
2386
|
},
|
|
2307
2387
|
start,
|
|
2308
2388
|
end,
|
|
2309
|
-
uuid: (0,
|
|
2389
|
+
uuid: (0, import_utils14.gen_uuid)(),
|
|
2310
2390
|
type: import_electronics_model7.GS_SCH_ITEM_TYPE.LINE
|
|
2311
2391
|
});
|
|
2312
2392
|
|
|
@@ -2354,15 +2434,15 @@ var NetListConverter = class {
|
|
|
2354
2434
|
const powers = /* @__PURE__ */ new Set();
|
|
2355
2435
|
this.wires = [];
|
|
2356
2436
|
const sch = {
|
|
2357
|
-
version: SCH_VERSION,
|
|
2358
|
-
generator: GENERATOR_NAME,
|
|
2359
|
-
generator_version: GENERATOR_VERSION,
|
|
2437
|
+
version: import_utils15.SCH_VERSION,
|
|
2438
|
+
generator: import_utils15.GENERATOR_NAME,
|
|
2439
|
+
generator_version: import_utils15.GENERATOR_VERSION,
|
|
2360
2440
|
paper: {
|
|
2361
2441
|
size: "A4"
|
|
2362
2442
|
},
|
|
2363
2443
|
title_block: {
|
|
2364
2444
|
title: name.replace(`.${import_ir4.MODULAR_CIRCUIT_SCH_EXT}`, ""),
|
|
2365
|
-
date: (0,
|
|
2445
|
+
date: (0, import_utils15.replaceAll)((/* @__PURE__ */ new Date()).toISOString().slice(0, 10), "-", "/"),
|
|
2366
2446
|
rev: "1.0",
|
|
2367
2447
|
comment: {
|
|
2368
2448
|
1: "https://www.eda.cn",
|
|
@@ -2525,7 +2605,7 @@ var NetListConverter = class {
|
|
|
2525
2605
|
// src/builder/graph_to_kicad/convert_graph_to_sheets.ts
|
|
2526
2606
|
var import_ir5 = require("@modular-circuit/ir");
|
|
2527
2607
|
var import_perc = require("@modular-circuit/perc");
|
|
2528
|
-
var
|
|
2608
|
+
var import_utils16 = require("@modular-circuit/utils");
|
|
2529
2609
|
async function do_convert_graph_to_kicad_project(ctx) {
|
|
2530
2610
|
const module_ids = [];
|
|
2531
2611
|
for (const sch of Object.values(ctx.schematics)) {
|
|
@@ -2561,7 +2641,7 @@ async function do_convert_graph_to_kicad_project(ctx) {
|
|
|
2561
2641
|
if (k in sheets) {
|
|
2562
2642
|
console.error(`Duplicated sheet file name found ${k}`);
|
|
2563
2643
|
}
|
|
2564
|
-
sheets[k.replace(import_ir5.MODULAR_CIRCUIT_SCH_EXT,
|
|
2644
|
+
sheets[k.replace(import_ir5.MODULAR_CIRCUIT_SCH_EXT, import_utils16.KiCadSchematicFileExtension)] = sexpr_printer.schematic(v);
|
|
2565
2645
|
}
|
|
2566
2646
|
return sheets;
|
|
2567
2647
|
}
|
|
@@ -2576,7 +2656,7 @@ async function convert_graph_to_sheets(ctx) {
|
|
|
2576
2656
|
}
|
|
2577
2657
|
|
|
2578
2658
|
// src/kicad/project/kicad_project_archive.ts
|
|
2579
|
-
var
|
|
2659
|
+
var import_utils19 = require("@modular-circuit/utils");
|
|
2580
2660
|
var import_jszip = __toESM(require("jszip"));
|
|
2581
2661
|
|
|
2582
2662
|
// src/kicad/project/kicad_prl.ts
|
|
@@ -2665,7 +2745,7 @@ var kicad_prl = (prj_name) => ({
|
|
|
2665
2745
|
});
|
|
2666
2746
|
|
|
2667
2747
|
// src/kicad/project/kicad_pro.ts
|
|
2668
|
-
var
|
|
2748
|
+
var import_utils18 = require("@modular-circuit/utils");
|
|
2669
2749
|
var kicad_pro = (project_name) => ({
|
|
2670
2750
|
board: {
|
|
2671
2751
|
"3dviewports": [],
|
|
@@ -2875,7 +2955,7 @@ var kicad_pro = (project_name) => ({
|
|
|
2875
2955
|
version: 1
|
|
2876
2956
|
},
|
|
2877
2957
|
net_format_name: "",
|
|
2878
|
-
page_layout_descr_file: `${project_name}.${
|
|
2958
|
+
page_layout_descr_file: `${project_name}.${import_utils18.DrawingSheetFileExtension}`,
|
|
2879
2959
|
plot_directory: "",
|
|
2880
2960
|
spice_current_sheet_as_root: false,
|
|
2881
2961
|
spice_external_command: 'spice "%I"',
|
|
@@ -2913,16 +2993,16 @@ var KiCadProjectArchive = class {
|
|
|
2913
2993
|
return kicad_pro(this.project_name);
|
|
2914
2994
|
}
|
|
2915
2995
|
get main_sch_name() {
|
|
2916
|
-
return this.get_project_directive_file_name(
|
|
2996
|
+
return this.get_project_directive_file_name(import_utils19.KiCadSchematicFileExtension);
|
|
2917
2997
|
}
|
|
2918
2998
|
get_project_directive_file_name(ext) {
|
|
2919
2999
|
return `${this.project_name}.${ext}`;
|
|
2920
3000
|
}
|
|
2921
3001
|
async toZip() {
|
|
2922
3002
|
const zip = new import_jszip.default();
|
|
2923
|
-
zip.file(this.get_project_directive_file_name(
|
|
2924
|
-
zip.file(this.get_project_directive_file_name(
|
|
2925
|
-
zip.file(this.get_project_directive_file_name(
|
|
3003
|
+
zip.file(this.get_project_directive_file_name(import_utils19.ProjectLocalSettingsFileExtension), JSON.stringify(this.kicad_prl));
|
|
3004
|
+
zip.file(this.get_project_directive_file_name(import_utils19.ProjectFileExtension), JSON.stringify(this.kicad_pro));
|
|
3005
|
+
zip.file(this.get_project_directive_file_name(import_utils19.DrawingSheetFileExtension), this.sch_frame);
|
|
2926
3006
|
for (const schematic of this.designBlock.schematics) {
|
|
2927
3007
|
zip.file(schematic.filename, schematic.content);
|
|
2928
3008
|
}
|
|
@@ -2970,9 +3050,9 @@ var KiCadProjectArchive = class {
|
|
|
2970
3050
|
};
|
|
2971
3051
|
|
|
2972
3052
|
// src/builder/graph_to_kicad/convert_graph_to_design_block.ts
|
|
2973
|
-
var
|
|
3053
|
+
var import_utils20 = require("@modular-circuit/utils");
|
|
2974
3054
|
async function convert_graph_to_design_block(ctx) {
|
|
2975
|
-
const root = ctx.project.main.replace(
|
|
3055
|
+
const root = ctx.project.main.replace(import_utils20.ModularCircuitFileExtension, import_utils20.KiCadSchematicFileExtension);
|
|
2976
3056
|
const sheets = await convert_graph_to_sheets(ctx);
|
|
2977
3057
|
if (!(root in sheets)) {
|
|
2978
3058
|
throw new Error(`Cannot find root sch file ${root}`);
|
|
@@ -3001,20 +3081,14 @@ async function convert_graph_to_kicad_project(ctx) {
|
|
|
3001
3081
|
0 && (module.exports = {
|
|
3002
3082
|
BLOCK_PIN_GAP,
|
|
3003
3083
|
BLOCK_PIN_TB_MARGIN,
|
|
3004
|
-
DEFAULT_PAPER_SIZE,
|
|
3005
3084
|
FONT_SIZE,
|
|
3006
|
-
GENERATOR_NAME,
|
|
3007
|
-
GENERATOR_VERSION,
|
|
3008
3085
|
GRID_SIZE,
|
|
3009
3086
|
GraphConverter,
|
|
3010
3087
|
KICAD_SCH_FRAME,
|
|
3011
3088
|
KiCadProjectArchive,
|
|
3012
3089
|
Layout,
|
|
3013
3090
|
NetListConverter,
|
|
3014
|
-
PAPER,
|
|
3015
|
-
PAPER_SIZE,
|
|
3016
3091
|
SCHEMATIC_PRINTER,
|
|
3017
|
-
SCH_VERSION,
|
|
3018
3092
|
StringFormatter,
|
|
3019
3093
|
WIRE_PADDING,
|
|
3020
3094
|
collect_sub_sheets,
|
package/dist/index.mjs
CHANGED
|
@@ -62,7 +62,7 @@ import { READABLE_ELECTRICAL_PINTYPE } from "@modular-circuit/electronics-model"
|
|
|
62
62
|
import {
|
|
63
63
|
SHAPE_T
|
|
64
64
|
} from "@modular-circuit/ir";
|
|
65
|
-
import { gen_uuid as gen_uuid2 } from "@modular-circuit/utils";
|
|
65
|
+
import { GENERATOR_NAME, GENERATOR_VERSION, PAPER, SCH_VERSION, gen_uuid as gen_uuid2 } from "@modular-circuit/utils";
|
|
66
66
|
|
|
67
67
|
// src/utils/collect_sub_sheets.ts
|
|
68
68
|
import {
|
|
@@ -114,24 +114,6 @@ async function collect_sub_sheets(dependencies, module_resolver) {
|
|
|
114
114
|
return { sheets, module_main_sheet, modules };
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// src/utils/constraints.ts
|
|
118
|
-
var PAPER_SIZE = {
|
|
119
|
-
A0: { width: 841, height: 1189 },
|
|
120
|
-
A1: { width: 594, height: 841 },
|
|
121
|
-
A2: { width: 420, height: 594 },
|
|
122
|
-
A3: { width: 297, height: 420 },
|
|
123
|
-
A4: { width: 210, height: 297 },
|
|
124
|
-
A5: { width: 148, height: 210 },
|
|
125
|
-
A6: { width: 105, height: 148 },
|
|
126
|
-
A7: { width: 74, height: 105 },
|
|
127
|
-
A8: { width: 52, height: 74 }
|
|
128
|
-
};
|
|
129
|
-
var DEFAULT_PAPER_SIZE = PAPER_SIZE.A4;
|
|
130
|
-
var GENERATOR_NAME = "modular_circuit";
|
|
131
|
-
var SCH_VERSION = 20231120;
|
|
132
|
-
var PAPER = "A4";
|
|
133
|
-
var GENERATOR_VERSION = "8.0";
|
|
134
|
-
|
|
135
117
|
// src/utils/filter_null_undefined.ts
|
|
136
118
|
function filterNullOrUndefined(originalMethod, _context) {
|
|
137
119
|
function replacementMethod(...args) {
|
|
@@ -1505,6 +1487,105 @@ var Dvp8LinkTester = class extends CompositePortLinkConverterBase {
|
|
|
1505
1487
|
return true;
|
|
1506
1488
|
}
|
|
1507
1489
|
};
|
|
1490
|
+
var JtagLinkTester = class extends CompositePortLinkConverterBase {
|
|
1491
|
+
get_signals() {
|
|
1492
|
+
if (!this.link) return [];
|
|
1493
|
+
return [
|
|
1494
|
+
{
|
|
1495
|
+
name: "TCK",
|
|
1496
|
+
ports: [
|
|
1497
|
+
{
|
|
1498
|
+
parent: this.link.host,
|
|
1499
|
+
meta_port: this.link.host.TCK
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
parent: this.link.target,
|
|
1503
|
+
meta_port: this.link.target.TCK
|
|
1504
|
+
}
|
|
1505
|
+
]
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
name: "TDI",
|
|
1509
|
+
ports: [
|
|
1510
|
+
{
|
|
1511
|
+
parent: this.link.host,
|
|
1512
|
+
meta_port: this.link.host.TDI
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
parent: this.link.target,
|
|
1516
|
+
meta_port: this.link.target.TDI
|
|
1517
|
+
}
|
|
1518
|
+
]
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
name: "TDO",
|
|
1522
|
+
ports: [
|
|
1523
|
+
{
|
|
1524
|
+
parent: this.link.host,
|
|
1525
|
+
meta_port: this.link.host.TDO
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
parent: this.link.target,
|
|
1529
|
+
meta_port: this.link.target.TDO
|
|
1530
|
+
}
|
|
1531
|
+
]
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
name: "TMS",
|
|
1535
|
+
ports: [
|
|
1536
|
+
{
|
|
1537
|
+
parent: this.link.host,
|
|
1538
|
+
meta_port: this.link.host.TMS
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
parent: this.link.target,
|
|
1542
|
+
meta_port: this.link.target.TMS
|
|
1543
|
+
}
|
|
1544
|
+
]
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
name: "TRST",
|
|
1548
|
+
ports: [
|
|
1549
|
+
{
|
|
1550
|
+
parent: this.link.host,
|
|
1551
|
+
meta_port: this.link.host.TRST
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
parent: this.link.target,
|
|
1555
|
+
meta_port: this.link.target.TRST
|
|
1556
|
+
}
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
];
|
|
1560
|
+
}
|
|
1561
|
+
init_link() {
|
|
1562
|
+
const hosts = [];
|
|
1563
|
+
const targets = [];
|
|
1564
|
+
for (const v of this.ports) {
|
|
1565
|
+
switch (v.type) {
|
|
1566
|
+
case PortType.JtagHostPort: {
|
|
1567
|
+
hosts.push(v);
|
|
1568
|
+
break;
|
|
1569
|
+
}
|
|
1570
|
+
case PortType.JtagTargetPort: {
|
|
1571
|
+
targets.push(v);
|
|
1572
|
+
break;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
if (hosts.length !== 1) {
|
|
1577
|
+
return false;
|
|
1578
|
+
}
|
|
1579
|
+
if (targets.length !== 1) {
|
|
1580
|
+
return false;
|
|
1581
|
+
}
|
|
1582
|
+
this.link = {
|
|
1583
|
+
host: hosts[0],
|
|
1584
|
+
target: targets[0]
|
|
1585
|
+
};
|
|
1586
|
+
return true;
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1508
1589
|
|
|
1509
1590
|
// src/converter/link_to_netlist/converter.ts
|
|
1510
1591
|
var LINK_CONVERTER = class {
|
|
@@ -1593,6 +1674,10 @@ var LINK_CONVERTER = class {
|
|
|
1593
1674
|
this.do_convert(Dvp8LinkTester, v, cc);
|
|
1594
1675
|
break;
|
|
1595
1676
|
}
|
|
1677
|
+
case LinkType.JtagLink: {
|
|
1678
|
+
this.do_convert(JtagLinkTester, v, cc);
|
|
1679
|
+
break;
|
|
1680
|
+
}
|
|
1596
1681
|
default: {
|
|
1597
1682
|
throw new Error(`Unhandled link type: ${k}`);
|
|
1598
1683
|
}
|
|
@@ -1692,6 +1777,7 @@ var GraphConverter = class {
|
|
|
1692
1777
|
};
|
|
1693
1778
|
|
|
1694
1779
|
// src/converter/netlist_to_kicad/layout.ts
|
|
1780
|
+
import { PAPER_SIZE } from "@modular-circuit/utils";
|
|
1695
1781
|
import ELK from "elkjs/lib/elk.bundled.js";
|
|
1696
1782
|
var MIL_TO_MM = 0.0254;
|
|
1697
1783
|
var GRID_SIZE = 50 * MIL_TO_MM;
|
|
@@ -1797,7 +1883,7 @@ import { PowerShape } from "@modular-circuit/electronics-model";
|
|
|
1797
1883
|
import {
|
|
1798
1884
|
MODULAR_CIRCUIT_SCH_EXT
|
|
1799
1885
|
} from "@modular-circuit/ir";
|
|
1800
|
-
import { replaceAll } from "@modular-circuit/utils";
|
|
1886
|
+
import { GENERATOR_NAME as GENERATOR_NAME2, GENERATOR_VERSION as GENERATOR_VERSION2, SCH_VERSION as SCH_VERSION2, replaceAll } from "@modular-circuit/utils";
|
|
1801
1887
|
|
|
1802
1888
|
// src/kicad/label/net_label.ts
|
|
1803
1889
|
import { DEFAULT_FONT_SIZE, gen_uuid as gen_uuid3 } from "@modular-circuit/utils";
|
|
@@ -2316,9 +2402,9 @@ var NetListConverter = class {
|
|
|
2316
2402
|
const powers = /* @__PURE__ */ new Set();
|
|
2317
2403
|
this.wires = [];
|
|
2318
2404
|
const sch = {
|
|
2319
|
-
version:
|
|
2320
|
-
generator:
|
|
2321
|
-
generator_version:
|
|
2405
|
+
version: SCH_VERSION2,
|
|
2406
|
+
generator: GENERATOR_NAME2,
|
|
2407
|
+
generator_version: GENERATOR_VERSION2,
|
|
2322
2408
|
paper: {
|
|
2323
2409
|
size: "A4"
|
|
2324
2410
|
},
|
|
@@ -2971,20 +3057,14 @@ async function convert_graph_to_kicad_project(ctx) {
|
|
|
2971
3057
|
export {
|
|
2972
3058
|
BLOCK_PIN_GAP,
|
|
2973
3059
|
BLOCK_PIN_TB_MARGIN,
|
|
2974
|
-
DEFAULT_PAPER_SIZE,
|
|
2975
3060
|
FONT_SIZE,
|
|
2976
|
-
GENERATOR_NAME,
|
|
2977
|
-
GENERATOR_VERSION,
|
|
2978
3061
|
GRID_SIZE,
|
|
2979
3062
|
GraphConverter,
|
|
2980
3063
|
KICAD_SCH_FRAME,
|
|
2981
3064
|
KiCadProjectArchive,
|
|
2982
3065
|
Layout,
|
|
2983
3066
|
NetListConverter,
|
|
2984
|
-
PAPER,
|
|
2985
|
-
PAPER_SIZE,
|
|
2986
3067
|
SCHEMATIC_PRINTER,
|
|
2987
|
-
SCH_VERSION,
|
|
2988
3068
|
StringFormatter,
|
|
2989
3069
|
WIRE_PADDING,
|
|
2990
3070
|
collect_sub_sheets,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "Intermediate representation of the modular circuit",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"elkjs": "^0.11.0",
|
|
30
30
|
"js-base64": "^3.7.7",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
32
|
-
"@modular-circuit/
|
|
33
|
-
"@modular-circuit/
|
|
34
|
-
"@modular-circuit/
|
|
35
|
-
"@modular-circuit/
|
|
32
|
+
"@modular-circuit/ir": "0.2.10",
|
|
33
|
+
"@modular-circuit/electronics-model": "0.2.12",
|
|
34
|
+
"@modular-circuit/perc": "0.2.18",
|
|
35
|
+
"@modular-circuit/utils": "0.2.10"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"clean": "rimraf dist",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean --tsconfig tsconfig.build.json",
|
|
41
41
|
"lint:ci": "biome ci",
|
|
42
42
|
"lint": "biome check --fix --unsafe",
|
|
43
|
-
"
|
|
43
|
+
"type-check": "tsc --noEmit"
|
|
44
44
|
}
|
|
45
45
|
}
|