@modular-circuit/perc 0.1.0 → 0.1.2
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 +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +79 -32
- package/dist/index.mjs +94 -33
- package/package.json +5 -6
package/dist/index.d.mts
CHANGED
|
@@ -273,7 +273,7 @@ interface GRAPH_CONVERTER {
|
|
|
273
273
|
|
|
274
274
|
interface CONNECTION_GRAPH_BUILDER_CTX {
|
|
275
275
|
module_resolver: ModuleResolver;
|
|
276
|
-
dependencies
|
|
276
|
+
dependencies?: Record<string, string>;
|
|
277
277
|
schematics: Record<string, unknown>;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -403,7 +403,7 @@ interface SCH_ERC_ITEM extends ERC_ITEM {
|
|
|
403
403
|
aux_item_sheet_path?: GS_SCH_SHEET_PATH;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
interface ERC_CONTEXT
|
|
406
|
+
interface ERC_CONTEXT {
|
|
407
407
|
erc_setting: ERC_SETTING;
|
|
408
408
|
pp_erc_setting: Record<PP_ERROR, SEVERITY>;
|
|
409
409
|
connection_graph: ConnectionGraph;
|
|
@@ -445,27 +445,24 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
445
445
|
private readonly connection_node_map;
|
|
446
446
|
private net_count;
|
|
447
447
|
private connection_graph;
|
|
448
|
-
private
|
|
448
|
+
private bundle_consumed_port_count;
|
|
449
449
|
constructor(connection_node_map: ConnectionNodeMap);
|
|
450
450
|
end_visit_component(cc: string[]): void;
|
|
451
451
|
resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
|
|
452
452
|
get_connection_graph(): ConnectionGraph;
|
|
453
|
-
get_item_graphs(): Record<string, ConnectionSubgraph>;
|
|
454
453
|
}
|
|
455
454
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
456
455
|
connection_graph: ConnectionGraph;
|
|
457
|
-
item_graphs: Record<string, ConnectionSubgraph>;
|
|
458
456
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
459
457
|
pin_name_table: Record<string, string>;
|
|
460
458
|
pin_module_name_table: Record<string, string>;
|
|
461
459
|
}>;
|
|
462
460
|
|
|
463
|
-
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & ERC_CONTEXT
|
|
461
|
+
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_graph'>;
|
|
464
462
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
465
463
|
schematics: Record<string, IR_Graph>;
|
|
466
464
|
}): Promise<{
|
|
467
465
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
468
|
-
item_graphs: Record<string, _modular_circuit_electronics_model.ConnectionSubgraph>;
|
|
469
466
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
470
467
|
pin_name_table: Record<string, string>;
|
|
471
468
|
pin_module_name_table: Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -273,7 +273,7 @@ interface GRAPH_CONVERTER {
|
|
|
273
273
|
|
|
274
274
|
interface CONNECTION_GRAPH_BUILDER_CTX {
|
|
275
275
|
module_resolver: ModuleResolver;
|
|
276
|
-
dependencies
|
|
276
|
+
dependencies?: Record<string, string>;
|
|
277
277
|
schematics: Record<string, unknown>;
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -403,7 +403,7 @@ interface SCH_ERC_ITEM extends ERC_ITEM {
|
|
|
403
403
|
aux_item_sheet_path?: GS_SCH_SHEET_PATH;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
interface ERC_CONTEXT
|
|
406
|
+
interface ERC_CONTEXT {
|
|
407
407
|
erc_setting: ERC_SETTING;
|
|
408
408
|
pp_erc_setting: Record<PP_ERROR, SEVERITY>;
|
|
409
409
|
connection_graph: ConnectionGraph;
|
|
@@ -445,27 +445,24 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
445
445
|
private readonly connection_node_map;
|
|
446
446
|
private net_count;
|
|
447
447
|
private connection_graph;
|
|
448
|
-
private
|
|
448
|
+
private bundle_consumed_port_count;
|
|
449
449
|
constructor(connection_node_map: ConnectionNodeMap);
|
|
450
450
|
end_visit_component(cc: string[]): void;
|
|
451
451
|
resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
|
|
452
452
|
get_connection_graph(): ConnectionGraph;
|
|
453
|
-
get_item_graphs(): Record<string, ConnectionSubgraph>;
|
|
454
453
|
}
|
|
455
454
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
456
455
|
connection_graph: ConnectionGraph;
|
|
457
|
-
item_graphs: Record<string, ConnectionSubgraph>;
|
|
458
456
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
459
457
|
pin_name_table: Record<string, string>;
|
|
460
458
|
pin_module_name_table: Record<string, string>;
|
|
461
459
|
}>;
|
|
462
460
|
|
|
463
|
-
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & ERC_CONTEXT
|
|
461
|
+
type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_graph'>;
|
|
464
462
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
465
463
|
schematics: Record<string, IR_Graph>;
|
|
466
464
|
}): Promise<{
|
|
467
465
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
468
|
-
item_graphs: Record<string, _modular_circuit_electronics_model.ConnectionSubgraph>;
|
|
469
466
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
470
467
|
pin_name_table: Record<string, string>;
|
|
471
468
|
pin_module_name_table: Record<string, string>;
|
package/dist/index.js
CHANGED
|
@@ -1574,6 +1574,7 @@ var ERC_TESTER = class {
|
|
|
1574
1574
|
// src/tester/graph/ir_graph_converter.ts
|
|
1575
1575
|
var import_electronics_model8 = require("@modular-circuit/electronics-model");
|
|
1576
1576
|
var import_electronics_model9 = require("@modular-circuit/electronics-model");
|
|
1577
|
+
var import_ir = require("@modular-circuit/ir");
|
|
1577
1578
|
var import_utils = require("@modular-circuit/utils");
|
|
1578
1579
|
var IR_GRAPH_CONVERTER = class {
|
|
1579
1580
|
constructor(circuits) {
|
|
@@ -1597,26 +1598,51 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1597
1598
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1598
1599
|
this.schematics[sch_name] = { uuid: design.uuid ?? (0, import_utils.gen_uuid)(), sheets: [], powers: [] };
|
|
1599
1600
|
for (const block of design.blocks ?? []) {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
uuid
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1601
|
+
if (!(0, import_ir.block_is_abstract)(block)) {
|
|
1602
|
+
const circuit = this.circuits[(0, import_ir.block_is_associated_with_concrete_module)(block.type) ? block.type : (0, import_utils.fmt_module_name)(block.type)];
|
|
1603
|
+
this.schematics[sch_name].sheets.push({
|
|
1604
|
+
uuid: block.uuid,
|
|
1605
|
+
sheet_name: design.name ?? circuit.name,
|
|
1606
|
+
sheet_file_name: circuit.main,
|
|
1607
|
+
ports: block.ports.map((p) => p.uuid)
|
|
1608
|
+
});
|
|
1609
|
+
const port_map = (0, import_utils.get_circuit_ports)(circuit);
|
|
1610
|
+
for (const port of block.ports) {
|
|
1611
|
+
const param = (0, import_utils.deep_copy)(port_map[port.index]);
|
|
1612
|
+
const uuid = port.uuid;
|
|
1613
|
+
this.add_node(uuid);
|
|
1614
|
+
this.connection_node_map[uuid] = {
|
|
1615
|
+
uuid,
|
|
1616
|
+
type: import_electronics_model8.ConnectionNodeType.Port,
|
|
1617
|
+
param,
|
|
1618
|
+
label_shapes: (0, import_utils.get_port_labels)(param, circuit)
|
|
1619
|
+
};
|
|
1620
|
+
this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
|
|
1621
|
+
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
1622
|
+
}
|
|
1623
|
+
} else {
|
|
1624
|
+
const sheet_name = design.name ?? block.name;
|
|
1625
|
+
this.schematics[sch_name].sheets.push({
|
|
1626
|
+
uuid: block.uuid,
|
|
1627
|
+
sheet_name,
|
|
1628
|
+
sheet_file_name: `${sheet_name}${import_utils.KICAD_SHC_FILE_EXT}`,
|
|
1629
|
+
ports: block.ports.map((p) => p.uuid)
|
|
1630
|
+
});
|
|
1631
|
+
for (const port of block.ports) {
|
|
1632
|
+
const param = port.port;
|
|
1633
|
+
const uuid = port.uuid;
|
|
1634
|
+
this.add_node(uuid);
|
|
1635
|
+
this.connection_node_map[uuid] = {
|
|
1636
|
+
uuid,
|
|
1637
|
+
type: import_electronics_model8.ConnectionNodeType.Port,
|
|
1638
|
+
param: typeof param === "string" ? {
|
|
1639
|
+
type: import_electronics_model8.PortType.Passive,
|
|
1640
|
+
name: port.port
|
|
1641
|
+
} : param
|
|
1642
|
+
};
|
|
1643
|
+
this.reporter_context.pin_module_name_table[port.uuid] = sheet_name;
|
|
1644
|
+
this.reporter_context.pin_name_table[port.uuid] = typeof port.port === "string" ? port.port : port.port.name;
|
|
1645
|
+
}
|
|
1620
1646
|
}
|
|
1621
1647
|
}
|
|
1622
1648
|
const lb_map = {};
|
|
@@ -1708,18 +1734,27 @@ var import_electronics_model10 = require("@modular-circuit/electronics-model");
|
|
|
1708
1734
|
var import_utils3 = require("@modular-circuit/utils");
|
|
1709
1735
|
|
|
1710
1736
|
// src/utils/get_dependent_modules_definition.ts
|
|
1737
|
+
var import_ir2 = require("@modular-circuit/ir");
|
|
1711
1738
|
var import_utils2 = require("@modular-circuit/utils");
|
|
1712
1739
|
async function get_dependent_modules_definition(ctx) {
|
|
1713
1740
|
const circuits = {};
|
|
1714
1741
|
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
1715
1742
|
for (const block of v.blocks ?? []) {
|
|
1716
|
-
|
|
1717
|
-
const version = ctx.dependencies[module_name];
|
|
1718
|
-
if (version === void 0) {
|
|
1719
|
-
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1743
|
+
if ((0, import_ir2.block_is_abstract)(block)) {
|
|
1720
1744
|
continue;
|
|
1721
1745
|
}
|
|
1722
|
-
const
|
|
1746
|
+
const module_name = (0, import_ir2.block_is_associated_with_concrete_module)(block.type) ? block.type : (0, import_utils2.fmt_module_name)(block.type);
|
|
1747
|
+
let def;
|
|
1748
|
+
if ((0, import_ir2.block_is_associated_with_concrete_module)(block.type)) {
|
|
1749
|
+
def = await ctx.module_resolver.get_module_circuit_by_id(block.type);
|
|
1750
|
+
} else if (ctx.dependencies) {
|
|
1751
|
+
const version = ctx.dependencies[module_name];
|
|
1752
|
+
if (version === void 0) {
|
|
1753
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1754
|
+
continue;
|
|
1755
|
+
}
|
|
1756
|
+
def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1757
|
+
}
|
|
1723
1758
|
if (def) circuits[module_name] = def;
|
|
1724
1759
|
}
|
|
1725
1760
|
}
|
|
@@ -1731,7 +1766,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1731
1766
|
constructor(connection_node_map) {
|
|
1732
1767
|
this.connection_node_map = connection_node_map;
|
|
1733
1768
|
this.net_count = 0;
|
|
1734
|
-
this.
|
|
1769
|
+
this.bundle_consumed_port_count = {};
|
|
1735
1770
|
this.connection_graph = {
|
|
1736
1771
|
subgraphs: []
|
|
1737
1772
|
};
|
|
@@ -1741,8 +1776,24 @@ var ConnectionGraphsBuilder = class {
|
|
|
1741
1776
|
sub_graph.is_global_pwr = false;
|
|
1742
1777
|
sub_graph.is_isolated = cc.length < 2;
|
|
1743
1778
|
const nodes = cc.map((id) => {
|
|
1744
|
-
this.
|
|
1745
|
-
|
|
1779
|
+
const node = this.connection_node_map[id];
|
|
1780
|
+
if (node.type === import_electronics_model10.ConnectionNodeType.Port) {
|
|
1781
|
+
const port = node.param;
|
|
1782
|
+
if (port.type === import_electronics_model10.PortType.DigitalBidirBundle) {
|
|
1783
|
+
const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
|
|
1784
|
+
this.bundle_consumed_port_count[id] = consumed_count + 1;
|
|
1785
|
+
const labels = port.labels_associated;
|
|
1786
|
+
return {
|
|
1787
|
+
...node,
|
|
1788
|
+
param: {
|
|
1789
|
+
...node.param,
|
|
1790
|
+
type: import_electronics_model10.PortType.DigitalBidir,
|
|
1791
|
+
label_associated: labels[consumed_count] ?? `${node.param.name}-${consumed_count}`
|
|
1792
|
+
}
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return node;
|
|
1746
1797
|
});
|
|
1747
1798
|
sub_graph.nodes = nodes;
|
|
1748
1799
|
this.resolve_net_drive(nodes, sub_graph);
|
|
@@ -1802,9 +1853,6 @@ var ConnectionGraphsBuilder = class {
|
|
|
1802
1853
|
get_connection_graph() {
|
|
1803
1854
|
return this.connection_graph;
|
|
1804
1855
|
}
|
|
1805
|
-
get_item_graphs() {
|
|
1806
|
-
return this.item_graphs;
|
|
1807
|
-
}
|
|
1808
1856
|
};
|
|
1809
1857
|
async function build_connection_graph(ctx) {
|
|
1810
1858
|
const converter = new IR_GRAPH_CONVERTER(await get_dependent_modules_definition(ctx));
|
|
@@ -1815,7 +1863,6 @@ async function build_connection_graph(ctx) {
|
|
|
1815
1863
|
return {
|
|
1816
1864
|
...converter.get_report_context(),
|
|
1817
1865
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1818
|
-
item_graphs: cc_builder.get_item_graphs(),
|
|
1819
1866
|
cg_schematics: converter.get_schematics()
|
|
1820
1867
|
};
|
|
1821
1868
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1535,7 +1535,18 @@ import {
|
|
|
1535
1535
|
import {
|
|
1536
1536
|
PowerShape
|
|
1537
1537
|
} from "@modular-circuit/electronics-model";
|
|
1538
|
-
import {
|
|
1538
|
+
import {
|
|
1539
|
+
block_is_abstract,
|
|
1540
|
+
block_is_associated_with_concrete_module
|
|
1541
|
+
} from "@modular-circuit/ir";
|
|
1542
|
+
import {
|
|
1543
|
+
KICAD_SHC_FILE_EXT,
|
|
1544
|
+
deep_copy,
|
|
1545
|
+
fmt_module_name,
|
|
1546
|
+
gen_uuid,
|
|
1547
|
+
get_circuit_ports,
|
|
1548
|
+
get_port_labels
|
|
1549
|
+
} from "@modular-circuit/utils";
|
|
1539
1550
|
var IR_GRAPH_CONVERTER = class {
|
|
1540
1551
|
constructor(circuits) {
|
|
1541
1552
|
this.circuits = circuits;
|
|
@@ -1558,26 +1569,51 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1558
1569
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1559
1570
|
this.schematics[sch_name] = { uuid: design.uuid ?? gen_uuid(), sheets: [], powers: [] };
|
|
1560
1571
|
for (const block of design.blocks ?? []) {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
uuid
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1572
|
+
if (!block_is_abstract(block)) {
|
|
1573
|
+
const circuit = this.circuits[block_is_associated_with_concrete_module(block.type) ? block.type : fmt_module_name(block.type)];
|
|
1574
|
+
this.schematics[sch_name].sheets.push({
|
|
1575
|
+
uuid: block.uuid,
|
|
1576
|
+
sheet_name: design.name ?? circuit.name,
|
|
1577
|
+
sheet_file_name: circuit.main,
|
|
1578
|
+
ports: block.ports.map((p) => p.uuid)
|
|
1579
|
+
});
|
|
1580
|
+
const port_map = get_circuit_ports(circuit);
|
|
1581
|
+
for (const port of block.ports) {
|
|
1582
|
+
const param = deep_copy(port_map[port.index]);
|
|
1583
|
+
const uuid = port.uuid;
|
|
1584
|
+
this.add_node(uuid);
|
|
1585
|
+
this.connection_node_map[uuid] = {
|
|
1586
|
+
uuid,
|
|
1587
|
+
type: ConnectionNodeType3.Port,
|
|
1588
|
+
param,
|
|
1589
|
+
label_shapes: get_port_labels(param, circuit)
|
|
1590
|
+
};
|
|
1591
|
+
this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
|
|
1592
|
+
this.reporter_context.pin_name_table[port.uuid] = port.name;
|
|
1593
|
+
}
|
|
1594
|
+
} else {
|
|
1595
|
+
const sheet_name = design.name ?? block.name;
|
|
1596
|
+
this.schematics[sch_name].sheets.push({
|
|
1597
|
+
uuid: block.uuid,
|
|
1598
|
+
sheet_name,
|
|
1599
|
+
sheet_file_name: `${sheet_name}${KICAD_SHC_FILE_EXT}`,
|
|
1600
|
+
ports: block.ports.map((p) => p.uuid)
|
|
1601
|
+
});
|
|
1602
|
+
for (const port of block.ports) {
|
|
1603
|
+
const param = port.port;
|
|
1604
|
+
const uuid = port.uuid;
|
|
1605
|
+
this.add_node(uuid);
|
|
1606
|
+
this.connection_node_map[uuid] = {
|
|
1607
|
+
uuid,
|
|
1608
|
+
type: ConnectionNodeType3.Port,
|
|
1609
|
+
param: typeof param === "string" ? {
|
|
1610
|
+
type: PortType3.Passive,
|
|
1611
|
+
name: port.port
|
|
1612
|
+
} : param
|
|
1613
|
+
};
|
|
1614
|
+
this.reporter_context.pin_module_name_table[port.uuid] = sheet_name;
|
|
1615
|
+
this.reporter_context.pin_name_table[port.uuid] = typeof port.port === "string" ? port.port : port.port.name;
|
|
1616
|
+
}
|
|
1581
1617
|
}
|
|
1582
1618
|
}
|
|
1583
1619
|
const lb_map = {};
|
|
@@ -1668,23 +1704,36 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1668
1704
|
import {
|
|
1669
1705
|
ConnectionNodeType as ConnectionNodeType4,
|
|
1670
1706
|
PRIORITY,
|
|
1707
|
+
PortType as PortType4,
|
|
1671
1708
|
get_connection_node_priority
|
|
1672
1709
|
} from "@modular-circuit/electronics-model";
|
|
1673
1710
|
import { test_connected_components } from "@modular-circuit/utils";
|
|
1674
1711
|
|
|
1675
1712
|
// src/utils/get_dependent_modules_definition.ts
|
|
1713
|
+
import {
|
|
1714
|
+
block_is_abstract as block_is_abstract2,
|
|
1715
|
+
block_is_associated_with_concrete_module as block_is_associated_with_concrete_module2
|
|
1716
|
+
} from "@modular-circuit/ir";
|
|
1676
1717
|
import { fmt_module_name as fmt_module_name2 } from "@modular-circuit/utils";
|
|
1677
1718
|
async function get_dependent_modules_definition(ctx) {
|
|
1678
1719
|
const circuits = {};
|
|
1679
1720
|
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
1680
1721
|
for (const block of v.blocks ?? []) {
|
|
1681
|
-
|
|
1682
|
-
const version = ctx.dependencies[module_name];
|
|
1683
|
-
if (version === void 0) {
|
|
1684
|
-
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1722
|
+
if (block_is_abstract2(block)) {
|
|
1685
1723
|
continue;
|
|
1686
1724
|
}
|
|
1687
|
-
const
|
|
1725
|
+
const module_name = block_is_associated_with_concrete_module2(block.type) ? block.type : fmt_module_name2(block.type);
|
|
1726
|
+
let def;
|
|
1727
|
+
if (block_is_associated_with_concrete_module2(block.type)) {
|
|
1728
|
+
def = await ctx.module_resolver.get_module_circuit_by_id(block.type);
|
|
1729
|
+
} else if (ctx.dependencies) {
|
|
1730
|
+
const version = ctx.dependencies[module_name];
|
|
1731
|
+
if (version === void 0) {
|
|
1732
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1733
|
+
continue;
|
|
1734
|
+
}
|
|
1735
|
+
def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1736
|
+
}
|
|
1688
1737
|
if (def) circuits[module_name] = def;
|
|
1689
1738
|
}
|
|
1690
1739
|
}
|
|
@@ -1696,7 +1745,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1696
1745
|
constructor(connection_node_map) {
|
|
1697
1746
|
this.connection_node_map = connection_node_map;
|
|
1698
1747
|
this.net_count = 0;
|
|
1699
|
-
this.
|
|
1748
|
+
this.bundle_consumed_port_count = {};
|
|
1700
1749
|
this.connection_graph = {
|
|
1701
1750
|
subgraphs: []
|
|
1702
1751
|
};
|
|
@@ -1706,8 +1755,24 @@ var ConnectionGraphsBuilder = class {
|
|
|
1706
1755
|
sub_graph.is_global_pwr = false;
|
|
1707
1756
|
sub_graph.is_isolated = cc.length < 2;
|
|
1708
1757
|
const nodes = cc.map((id) => {
|
|
1709
|
-
this.
|
|
1710
|
-
|
|
1758
|
+
const node = this.connection_node_map[id];
|
|
1759
|
+
if (node.type === ConnectionNodeType4.Port) {
|
|
1760
|
+
const port = node.param;
|
|
1761
|
+
if (port.type === PortType4.DigitalBidirBundle) {
|
|
1762
|
+
const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
|
|
1763
|
+
this.bundle_consumed_port_count[id] = consumed_count + 1;
|
|
1764
|
+
const labels = port.labels_associated;
|
|
1765
|
+
return {
|
|
1766
|
+
...node,
|
|
1767
|
+
param: {
|
|
1768
|
+
...node.param,
|
|
1769
|
+
type: PortType4.DigitalBidir,
|
|
1770
|
+
label_associated: labels[consumed_count] ?? `${node.param.name}-${consumed_count}`
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
return node;
|
|
1711
1776
|
});
|
|
1712
1777
|
sub_graph.nodes = nodes;
|
|
1713
1778
|
this.resolve_net_drive(nodes, sub_graph);
|
|
@@ -1767,9 +1832,6 @@ var ConnectionGraphsBuilder = class {
|
|
|
1767
1832
|
get_connection_graph() {
|
|
1768
1833
|
return this.connection_graph;
|
|
1769
1834
|
}
|
|
1770
|
-
get_item_graphs() {
|
|
1771
|
-
return this.item_graphs;
|
|
1772
|
-
}
|
|
1773
1835
|
};
|
|
1774
1836
|
async function build_connection_graph(ctx) {
|
|
1775
1837
|
const converter = new IR_GRAPH_CONVERTER(await get_dependent_modules_definition(ctx));
|
|
@@ -1780,7 +1842,6 @@ async function build_connection_graph(ctx) {
|
|
|
1780
1842
|
return {
|
|
1781
1843
|
...converter.get_report_context(),
|
|
1782
1844
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1783
|
-
item_graphs: cc_builder.get_item_graphs(),
|
|
1784
1845
|
cg_schematics: converter.get_schematics()
|
|
1785
1846
|
};
|
|
1786
1847
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/perc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Programmable Electronic Circuit Check",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"import": "./dist/index.mjs",
|
|
17
|
-
"require": "./dist/index.js"
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
17
|
+
"require": "./dist/index.js"
|
|
19
18
|
}
|
|
20
19
|
},
|
|
21
20
|
"devDependencies": {
|
|
@@ -27,9 +26,9 @@
|
|
|
27
26
|
"typescript": "^5.4.5"
|
|
28
27
|
},
|
|
29
28
|
"dependencies": {
|
|
30
|
-
"@modular-circuit/
|
|
31
|
-
"@modular-circuit/
|
|
32
|
-
"@modular-circuit/utils": "0.1.
|
|
29
|
+
"@modular-circuit/ir": "0.1.2",
|
|
30
|
+
"@modular-circuit/electronics-model": "0.1.1",
|
|
31
|
+
"@modular-circuit/utils": "0.1.2"
|
|
33
32
|
},
|
|
34
33
|
"scripts": {
|
|
35
34
|
"clean": "rimraf dist",
|