@modular-circuit/perc 0.1.1 → 0.1.3

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _modular_circuit_electronics_model from '@modular-circuit/electronics-model';
2
- import { VECTOR2, BOX2, ELECTRICAL_NODE, ELECTRICAL_PINTYPE, ConnectionSubgraph, ConnectionNodeMap, GS_SCH_SHEET_PATH, ConnectionGraph, CG_SHEET, NL_PowerSymbol, PowerShape, PowerSymbolPort, Connection, ConnectionNode } from '@modular-circuit/electronics-model';
2
+ import { VECTOR2, BOX2, ELECTRICAL_NODE, ELECTRICAL_PINTYPE, ConnectionSubgraph, ConnectionNodeMap, GS_SCH_SHEET_PATH, ConnectionGraph, CG_SHEET, NL_PowerSymbol, PowerShape, PowerSymbolPort, Connection, ConnectionNode, DigitalBidirBundle } from '@modular-circuit/electronics-model';
3
3
  import { SCH_ITEM, ModuleResolver, ModuleCircuit, IR_Graph } from '@modular-circuit/ir';
4
4
  import { PowerBase } from '@modular-circuit/ir/build/graph/pwr_base';
5
5
  import { CC_Visitor } from '@modular-circuit/utils';
@@ -159,6 +159,22 @@ declare const PP_ILLEGAL_CONNECTION: (eda_item_ids: string[], detail: string) =>
159
159
  error_message: string;
160
160
  eda_item_ids: string[];
161
161
  };
162
+ declare const CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT: (bundle_id: string) => {
163
+ error_code: PP_ERROR;
164
+ error_message: string;
165
+ eda_item_ids: string[];
166
+ };
167
+
168
+ interface REPORT_ITEM {
169
+ /**
170
+ * The UUIDs of the eda items that are related to this item.
171
+ */
172
+ eda_item_ids: string[];
173
+ /**
174
+ * A message describing the details of this specific error
175
+ */
176
+ error_message: string;
177
+ }
162
178
 
163
179
  /**Token from KiCAD
164
180
  * https://gitlab.com/kicad/code/kicad/-/blob/master/eeschema/erc/erc_settings.h
@@ -314,7 +330,8 @@ declare enum PP_ERROR {
314
330
  OVERCURRENT = "overcurrent",
315
331
  INCOMPATIBLE_DIGITAL_THRESHOLDS = "incompatible_digital_thresholds",
316
332
  REQUIRES_CONNECTED_SOURCE_OR_BIDIR = "requires_connected_source_or_bidir",
317
- ILLEGAL_CONNECTION = "Illegal_connection"
333
+ ILLEGAL_CONNECTION = "Illegal_connection",
334
+ CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit"
318
335
  }
319
336
  declare const DEFAULT_PP_ERROR_SEVERITY: Record<PP_ERROR, SEVERITY>;
320
337
 
@@ -347,19 +364,11 @@ declare class NetlistTester implements CG_Visitor {
347
364
  *
348
365
  * RC_ITEMs can have zero, one, or two related EDA_ITEMs.
349
366
  */
350
- interface RC_ITEM {
351
- /**
352
- * The UUIDs of the eda items that are related to this item.
353
- */
354
- eda_item_ids: string[];
367
+ interface RC_ITEM extends REPORT_ITEM {
355
368
  /**
356
369
  * The error code's numeric value
357
370
  */
358
371
  error_code: ERCE_T | PP_ERROR;
359
- /**
360
- * A message describing the details of this specific error
361
- */
362
- error_message: string;
363
372
  /**
364
373
  * The string describing the type of error
365
374
  */
@@ -410,11 +419,10 @@ interface ERC_CONTEXT {
410
419
  }
411
420
  declare class ERC_TESTER {
412
421
  private ctx;
413
- constructor(ctx: ERC_CONTEXT);
422
+ private report;
423
+ constructor(ctx: ERC_CONTEXT, report: ERC_REPORT);
414
424
  run_test(): {
415
425
  connection_graph: ConnectionGraph;
416
- markers: SCH_MARKER[];
417
- erc_errors: SCH_ERC_ITEM[];
418
426
  };
419
427
  }
420
428
 
@@ -445,17 +453,24 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
445
453
  private readonly connection_node_map;
446
454
  private net_count;
447
455
  private connection_graph;
448
- private item_graphs;
456
+ private bundle_consumed_port_count;
457
+ private bundles;
449
458
  constructor(connection_node_map: ConnectionNodeMap);
450
459
  end_visit_component(cc: string[]): void;
451
460
  resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
452
461
  get_connection_graph(): ConnectionGraph;
453
- get_item_graphs(): Record<string, ConnectionSubgraph>;
462
+ get_bundle_consumed_port_count(): {
463
+ bundle_consumed_port_count: Record<string, number>;
464
+ bundles: Record<string, DigitalBidirBundle>;
465
+ };
454
466
  }
455
467
  declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
456
468
  connection_graph: ConnectionGraph;
457
- item_graphs: Record<string, ConnectionSubgraph>;
458
469
  cg_schematics: Record<string, CG_SCHEMATIC>;
470
+ bundle_consume_status: {
471
+ bundle_consumed_port_count: Record<string, number>;
472
+ bundles: Record<string, DigitalBidirBundle>;
473
+ };
459
474
  pin_name_table: Record<string, string>;
460
475
  pin_module_name_table: Record<string, string>;
461
476
  }>;
@@ -464,13 +479,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
464
479
  declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
465
480
  schematics: Record<string, IR_Graph>;
466
481
  }): Promise<{
482
+ erc_report: ERC_REPORT;
467
483
  connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
468
- item_graphs: Record<string, _modular_circuit_electronics_model.ConnectionSubgraph>;
469
484
  cg_schematics: Record<string, CG_SCHEMATIC>;
485
+ bundle_consume_status: {
486
+ bundle_consumed_port_count: Record<string, number>;
487
+ bundles: Record<string, _modular_circuit_electronics_model.DigitalBidirBundle>;
488
+ };
470
489
  pin_name_table: Record<string, string>;
471
490
  pin_module_name_table: Record<string, string>;
472
- markers: SCH_MARKER[];
473
- erc_errors: SCH_ERC_ITEM[];
474
491
  }>;
475
492
 
476
- export { type ADT_AdjacencyList, type ADT_Graph, type CG_SCHEMATIC, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
493
+ export { type ADT_AdjacencyList, type ADT_Graph, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _modular_circuit_electronics_model from '@modular-circuit/electronics-model';
2
- import { VECTOR2, BOX2, ELECTRICAL_NODE, ELECTRICAL_PINTYPE, ConnectionSubgraph, ConnectionNodeMap, GS_SCH_SHEET_PATH, ConnectionGraph, CG_SHEET, NL_PowerSymbol, PowerShape, PowerSymbolPort, Connection, ConnectionNode } from '@modular-circuit/electronics-model';
2
+ import { VECTOR2, BOX2, ELECTRICAL_NODE, ELECTRICAL_PINTYPE, ConnectionSubgraph, ConnectionNodeMap, GS_SCH_SHEET_PATH, ConnectionGraph, CG_SHEET, NL_PowerSymbol, PowerShape, PowerSymbolPort, Connection, ConnectionNode, DigitalBidirBundle } from '@modular-circuit/electronics-model';
3
3
  import { SCH_ITEM, ModuleResolver, ModuleCircuit, IR_Graph } from '@modular-circuit/ir';
4
4
  import { PowerBase } from '@modular-circuit/ir/build/graph/pwr_base';
5
5
  import { CC_Visitor } from '@modular-circuit/utils';
@@ -159,6 +159,22 @@ declare const PP_ILLEGAL_CONNECTION: (eda_item_ids: string[], detail: string) =>
159
159
  error_message: string;
160
160
  eda_item_ids: string[];
161
161
  };
162
+ declare const CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT: (bundle_id: string) => {
163
+ error_code: PP_ERROR;
164
+ error_message: string;
165
+ eda_item_ids: string[];
166
+ };
167
+
168
+ interface REPORT_ITEM {
169
+ /**
170
+ * The UUIDs of the eda items that are related to this item.
171
+ */
172
+ eda_item_ids: string[];
173
+ /**
174
+ * A message describing the details of this specific error
175
+ */
176
+ error_message: string;
177
+ }
162
178
 
163
179
  /**Token from KiCAD
164
180
  * https://gitlab.com/kicad/code/kicad/-/blob/master/eeschema/erc/erc_settings.h
@@ -314,7 +330,8 @@ declare enum PP_ERROR {
314
330
  OVERCURRENT = "overcurrent",
315
331
  INCOMPATIBLE_DIGITAL_THRESHOLDS = "incompatible_digital_thresholds",
316
332
  REQUIRES_CONNECTED_SOURCE_OR_BIDIR = "requires_connected_source_or_bidir",
317
- ILLEGAL_CONNECTION = "Illegal_connection"
333
+ ILLEGAL_CONNECTION = "Illegal_connection",
334
+ CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit"
318
335
  }
319
336
  declare const DEFAULT_PP_ERROR_SEVERITY: Record<PP_ERROR, SEVERITY>;
320
337
 
@@ -347,19 +364,11 @@ declare class NetlistTester implements CG_Visitor {
347
364
  *
348
365
  * RC_ITEMs can have zero, one, or two related EDA_ITEMs.
349
366
  */
350
- interface RC_ITEM {
351
- /**
352
- * The UUIDs of the eda items that are related to this item.
353
- */
354
- eda_item_ids: string[];
367
+ interface RC_ITEM extends REPORT_ITEM {
355
368
  /**
356
369
  * The error code's numeric value
357
370
  */
358
371
  error_code: ERCE_T | PP_ERROR;
359
- /**
360
- * A message describing the details of this specific error
361
- */
362
- error_message: string;
363
372
  /**
364
373
  * The string describing the type of error
365
374
  */
@@ -410,11 +419,10 @@ interface ERC_CONTEXT {
410
419
  }
411
420
  declare class ERC_TESTER {
412
421
  private ctx;
413
- constructor(ctx: ERC_CONTEXT);
422
+ private report;
423
+ constructor(ctx: ERC_CONTEXT, report: ERC_REPORT);
414
424
  run_test(): {
415
425
  connection_graph: ConnectionGraph;
416
- markers: SCH_MARKER[];
417
- erc_errors: SCH_ERC_ITEM[];
418
426
  };
419
427
  }
420
428
 
@@ -445,17 +453,24 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
445
453
  private readonly connection_node_map;
446
454
  private net_count;
447
455
  private connection_graph;
448
- private item_graphs;
456
+ private bundle_consumed_port_count;
457
+ private bundles;
449
458
  constructor(connection_node_map: ConnectionNodeMap);
450
459
  end_visit_component(cc: string[]): void;
451
460
  resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
452
461
  get_connection_graph(): ConnectionGraph;
453
- get_item_graphs(): Record<string, ConnectionSubgraph>;
462
+ get_bundle_consumed_port_count(): {
463
+ bundle_consumed_port_count: Record<string, number>;
464
+ bundles: Record<string, DigitalBidirBundle>;
465
+ };
454
466
  }
455
467
  declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
456
468
  connection_graph: ConnectionGraph;
457
- item_graphs: Record<string, ConnectionSubgraph>;
458
469
  cg_schematics: Record<string, CG_SCHEMATIC>;
470
+ bundle_consume_status: {
471
+ bundle_consumed_port_count: Record<string, number>;
472
+ bundles: Record<string, DigitalBidirBundle>;
473
+ };
459
474
  pin_name_table: Record<string, string>;
460
475
  pin_module_name_table: Record<string, string>;
461
476
  }>;
@@ -464,13 +479,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
464
479
  declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
465
480
  schematics: Record<string, IR_Graph>;
466
481
  }): Promise<{
482
+ erc_report: ERC_REPORT;
467
483
  connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
468
- item_graphs: Record<string, _modular_circuit_electronics_model.ConnectionSubgraph>;
469
484
  cg_schematics: Record<string, CG_SCHEMATIC>;
485
+ bundle_consume_status: {
486
+ bundle_consumed_port_count: Record<string, number>;
487
+ bundles: Record<string, _modular_circuit_electronics_model.DigitalBidirBundle>;
488
+ };
470
489
  pin_name_table: Record<string, string>;
471
490
  pin_module_name_table: Record<string, string>;
472
- markers: SCH_MARKER[];
473
- erc_errors: SCH_ERC_ITEM[];
474
491
  }>;
475
492
 
476
- export { type ADT_AdjacencyList, type ADT_Graph, type CG_SCHEMATIC, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
493
+ export { type ADT_AdjacencyList, type ADT_Graph, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT: () => CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
23
24
  ConnectionGraphsBuilder: () => ConnectionGraphsBuilder,
24
25
  DEFAULT_ERC_SETTING: () => DEFAULT_ERC_SETTING,
25
26
  DEFAULT_PIN_MAP: () => DEFAULT_PIN_MAP,
@@ -121,6 +122,7 @@ var PP_ERROR = /* @__PURE__ */ ((PP_ERROR2) => {
121
122
  PP_ERROR2["INCOMPATIBLE_DIGITAL_THRESHOLDS"] = "incompatible_digital_thresholds";
122
123
  PP_ERROR2["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
123
124
  PP_ERROR2["ILLEGAL_CONNECTION"] = "Illegal_connection";
125
+ PP_ERROR2["CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT"] = "connection_count_exceeds_bundle_limit";
124
126
  return PP_ERROR2;
125
127
  })(PP_ERROR || {});
126
128
  var DEFAULT_PP_ERROR_SEVERITY = {
@@ -154,7 +156,8 @@ var DEFAULT_PP_ERROR_SEVERITY = {
154
156
  ["overcurrent" /* OVERCURRENT */]: 16 /* RPT_SEVERITY_WARNING */,
155
157
  ["incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */]: 16 /* RPT_SEVERITY_WARNING */,
156
158
  ["requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */]: 16 /* RPT_SEVERITY_WARNING */,
157
- ["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */
159
+ ["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */,
160
+ ["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR */
158
161
  };
159
162
 
160
163
  // src/erc/parameter_propagation/tester.ts
@@ -260,6 +263,11 @@ var PP_ILLEGAL_CONNECTION = (eda_item_ids, detail) => ({
260
263
  error_message: `Illegal connection: ${detail}`,
261
264
  eda_item_ids
262
265
  });
266
+ var CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = (bundle_id) => ({
267
+ error_code: "connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */,
268
+ error_message: "Connections count exceeds bundle limit.",
269
+ eda_item_ids: [bundle_id]
270
+ });
263
271
 
264
272
  // src/erc/parameter_propagation/link_testers/tester_impl.ts
265
273
  var import_electronics_model3 = require("@modular-circuit/electronics-model");
@@ -1545,13 +1553,13 @@ var NetlistTester = class {
1545
1553
 
1546
1554
  // src/tester/erc_tester.ts
1547
1555
  var ERC_TESTER = class {
1548
- constructor(ctx) {
1556
+ constructor(ctx, report) {
1549
1557
  this.ctx = ctx;
1558
+ this.report = report;
1550
1559
  }
1551
1560
  run_test() {
1552
- const report = { erc_errors: [], markers: [] };
1553
1561
  const tester_context = {
1554
- report,
1562
+ report: this.report,
1555
1563
  ...this.ctx
1556
1564
  };
1557
1565
  const visitors = [
@@ -1565,7 +1573,6 @@ var ERC_TESTER = class {
1565
1573
  }
1566
1574
  }
1567
1575
  return {
1568
- ...report,
1569
1576
  connection_graph: this.ctx.connection_graph
1570
1577
  };
1571
1578
  }
@@ -1598,26 +1605,58 @@ var IR_GRAPH_CONVERTER = class {
1598
1605
  for (const [sch_name, design] of Object.entries(designs)) {
1599
1606
  this.schematics[sch_name] = { uuid: design.uuid ?? (0, import_utils.gen_uuid)(), sheets: [], powers: [] };
1600
1607
  for (const block of design.blocks ?? []) {
1601
- 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)];
1602
- this.schematics[sch_name].sheets.push({
1603
- uuid: block.uuid,
1604
- sheet_name: design.name ?? circuit.name,
1605
- sheet_file_name: circuit.main,
1606
- ports: block.ports.map((p) => p.uuid)
1607
- });
1608
- const port_map = (0, import_utils.get_circuit_ports)(circuit);
1609
- for (const port of block.ports) {
1610
- const param = (0, import_utils.deep_copy)(port_map[port.index]);
1611
- const uuid = port.uuid;
1612
- this.add_node(uuid);
1613
- this.connection_node_map[uuid] = {
1614
- uuid,
1615
- type: import_electronics_model8.ConnectionNodeType.Port,
1616
- param,
1617
- label_shapes: (0, import_utils.get_port_labels)(param, circuit)
1618
- };
1619
- this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
1620
- this.reporter_context.pin_name_table[port.uuid] = port.name;
1608
+ if (!(0, import_ir.block_is_abstract)(block)) {
1609
+ 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)];
1610
+ this.schematics[sch_name].sheets.push({
1611
+ uuid: block.uuid,
1612
+ sheet_name: design.name ?? circuit.name,
1613
+ sheet_file_name: circuit.main,
1614
+ ports: block.ports.map((p) => p.uuid)
1615
+ });
1616
+ const port_map = (0, import_utils.get_circuit_ports)(circuit);
1617
+ for (const port of block.ports) {
1618
+ let param = (0, import_utils.deep_copy)(port_map[port.index]);
1619
+ if (!param || typeof param !== "object" || typeof param.type !== "string") {
1620
+ console.warn(`Cannot find port ${port.index} in circuit ${circuit.name}`);
1621
+ param = {
1622
+ type: import_electronics_model8.PortType.Passive,
1623
+ name: "GENERATED_PORT_DUE_DO_INDEX_NOT_FOUND"
1624
+ };
1625
+ }
1626
+ const uuid = port.uuid;
1627
+ this.add_node(uuid);
1628
+ this.connection_node_map[uuid] = {
1629
+ uuid,
1630
+ type: import_electronics_model8.ConnectionNodeType.Port,
1631
+ param,
1632
+ label_shapes: (0, import_utils.get_port_labels)(param, circuit)
1633
+ };
1634
+ this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
1635
+ this.reporter_context.pin_name_table[port.uuid] = port.name;
1636
+ }
1637
+ } else {
1638
+ const sheet_name = design.name ?? block.name;
1639
+ this.schematics[sch_name].sheets.push({
1640
+ uuid: block.uuid,
1641
+ sheet_name,
1642
+ sheet_file_name: `${sheet_name}${import_utils.KICAD_SHC_FILE_EXT}`,
1643
+ ports: block.ports.map((p) => p.uuid)
1644
+ });
1645
+ for (const port of block.ports) {
1646
+ const param = port.port;
1647
+ const uuid = port.uuid;
1648
+ this.add_node(uuid);
1649
+ this.connection_node_map[uuid] = {
1650
+ uuid,
1651
+ type: import_electronics_model8.ConnectionNodeType.Port,
1652
+ param: typeof param === "string" ? {
1653
+ type: import_electronics_model8.PortType.Passive,
1654
+ name: port.port
1655
+ } : param
1656
+ };
1657
+ this.reporter_context.pin_module_name_table[port.uuid] = sheet_name;
1658
+ this.reporter_context.pin_name_table[port.uuid] = typeof port.port === "string" ? port.port : port.port.name;
1659
+ }
1621
1660
  }
1622
1661
  }
1623
1662
  const lb_map = {};
@@ -1715,6 +1754,9 @@ async function get_dependent_modules_definition(ctx) {
1715
1754
  const circuits = {};
1716
1755
  for (const [, v] of Object.entries(ctx.schematics)) {
1717
1756
  for (const block of v.blocks ?? []) {
1757
+ if ((0, import_ir2.block_is_abstract)(block)) {
1758
+ continue;
1759
+ }
1718
1760
  const module_name = (0, import_ir2.block_is_associated_with_concrete_module)(block.type) ? block.type : (0, import_utils2.fmt_module_name)(block.type);
1719
1761
  let def;
1720
1762
  if ((0, import_ir2.block_is_associated_with_concrete_module)(block.type)) {
@@ -1738,7 +1780,8 @@ var ConnectionGraphsBuilder = class {
1738
1780
  constructor(connection_node_map) {
1739
1781
  this.connection_node_map = connection_node_map;
1740
1782
  this.net_count = 0;
1741
- this.item_graphs = {};
1783
+ this.bundle_consumed_port_count = {};
1784
+ this.bundles = {};
1742
1785
  this.connection_graph = {
1743
1786
  subgraphs: []
1744
1787
  };
@@ -1748,8 +1791,25 @@ var ConnectionGraphsBuilder = class {
1748
1791
  sub_graph.is_global_pwr = false;
1749
1792
  sub_graph.is_isolated = cc.length < 2;
1750
1793
  const nodes = cc.map((id) => {
1751
- this.item_graphs[id] = sub_graph;
1752
- return this.connection_node_map[id];
1794
+ const node = this.connection_node_map[id];
1795
+ if (node?.type === import_electronics_model10.ConnectionNodeType.Port) {
1796
+ const port = node.param;
1797
+ if (port.type === import_electronics_model10.PortType.DigitalBidirBundle) {
1798
+ const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
1799
+ this.bundle_consumed_port_count[id] = consumed_count + 1;
1800
+ this.bundles[id] = port;
1801
+ const labels = port.labels_associated;
1802
+ return {
1803
+ ...node,
1804
+ param: {
1805
+ ...node.param,
1806
+ type: import_electronics_model10.PortType.DigitalBidir,
1807
+ label_associated: labels[consumed_count] ?? `${node.param.name}-${consumed_count}`
1808
+ }
1809
+ };
1810
+ }
1811
+ }
1812
+ return node;
1753
1813
  });
1754
1814
  sub_graph.nodes = nodes;
1755
1815
  this.resolve_net_drive(nodes, sub_graph);
@@ -1809,8 +1869,11 @@ var ConnectionGraphsBuilder = class {
1809
1869
  get_connection_graph() {
1810
1870
  return this.connection_graph;
1811
1871
  }
1812
- get_item_graphs() {
1813
- return this.item_graphs;
1872
+ get_bundle_consumed_port_count() {
1873
+ return {
1874
+ bundle_consumed_port_count: this.bundle_consumed_port_count,
1875
+ bundles: this.bundles
1876
+ };
1814
1877
  }
1815
1878
  };
1816
1879
  async function build_connection_graph(ctx) {
@@ -1822,22 +1885,38 @@ async function build_connection_graph(ctx) {
1822
1885
  return {
1823
1886
  ...converter.get_report_context(),
1824
1887
  connection_graph: cc_builder.get_connection_graph(),
1825
- item_graphs: cc_builder.get_item_graphs(),
1826
- cg_schematics: converter.get_schematics()
1888
+ cg_schematics: converter.get_schematics(),
1889
+ bundle_consume_status: cc_builder.get_bundle_consumed_port_count()
1827
1890
  };
1828
1891
  }
1829
1892
 
1830
1893
  // src/tester/graph/graph_erc.ts
1831
1894
  async function graph_ecr(ctx) {
1895
+ const erc_report = {
1896
+ markers: [],
1897
+ erc_errors: []
1898
+ };
1832
1899
  const connection_graph = await build_connection_graph(ctx);
1833
- const tester = new ERC_TESTER({
1834
- ...ctx,
1835
- connection_graph: connection_graph.connection_graph
1836
- });
1837
- return { ...tester.run_test(), ...connection_graph };
1900
+ for (const [port_id, count] of Object.entries(connection_graph.bundle_consume_status.bundle_consumed_port_count)) {
1901
+ const bundle = connection_graph.bundle_consume_status.bundles[port_id];
1902
+ if (Array.isArray(bundle.labels_associated) && count > bundle.labels_associated.length) {
1903
+ erc_report.erc_errors.push(CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT(port_id));
1904
+ } else {
1905
+ console.warn(`Illegal bundle: ${port_id} , no associated labels`);
1906
+ }
1907
+ }
1908
+ const tester = new ERC_TESTER(
1909
+ {
1910
+ ...ctx,
1911
+ connection_graph: connection_graph.connection_graph
1912
+ },
1913
+ erc_report
1914
+ );
1915
+ return { ...tester.run_test(), ...connection_graph, erc_report };
1838
1916
  }
1839
1917
  // Annotate the CommonJS export names for ESM import in node:
1840
1918
  0 && (module.exports = {
1919
+ CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
1841
1920
  ConnectionGraphsBuilder,
1842
1921
  DEFAULT_ERC_SETTING,
1843
1922
  DEFAULT_PIN_MAP,
package/dist/index.mjs CHANGED
@@ -56,6 +56,7 @@ var PP_ERROR = /* @__PURE__ */ ((PP_ERROR2) => {
56
56
  PP_ERROR2["INCOMPATIBLE_DIGITAL_THRESHOLDS"] = "incompatible_digital_thresholds";
57
57
  PP_ERROR2["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
58
58
  PP_ERROR2["ILLEGAL_CONNECTION"] = "Illegal_connection";
59
+ PP_ERROR2["CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT"] = "connection_count_exceeds_bundle_limit";
59
60
  return PP_ERROR2;
60
61
  })(PP_ERROR || {});
61
62
  var DEFAULT_PP_ERROR_SEVERITY = {
@@ -89,7 +90,8 @@ var DEFAULT_PP_ERROR_SEVERITY = {
89
90
  ["overcurrent" /* OVERCURRENT */]: 16 /* RPT_SEVERITY_WARNING */,
90
91
  ["incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */]: 16 /* RPT_SEVERITY_WARNING */,
91
92
  ["requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */]: 16 /* RPT_SEVERITY_WARNING */,
92
- ["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */
93
+ ["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */,
94
+ ["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR */
93
95
  };
94
96
 
95
97
  // src/erc/parameter_propagation/tester.ts
@@ -201,6 +203,11 @@ var PP_ILLEGAL_CONNECTION = (eda_item_ids, detail) => ({
201
203
  error_message: `Illegal connection: ${detail}`,
202
204
  eda_item_ids
203
205
  });
206
+ var CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = (bundle_id) => ({
207
+ error_code: "connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */,
208
+ error_message: "Connections count exceeds bundle limit.",
209
+ eda_item_ids: [bundle_id]
210
+ });
204
211
 
205
212
  // src/erc/parameter_propagation/link_testers/tester_impl.ts
206
213
  import {
@@ -1500,13 +1507,13 @@ var NetlistTester = class {
1500
1507
 
1501
1508
  // src/tester/erc_tester.ts
1502
1509
  var ERC_TESTER = class {
1503
- constructor(ctx) {
1510
+ constructor(ctx, report) {
1504
1511
  this.ctx = ctx;
1512
+ this.report = report;
1505
1513
  }
1506
1514
  run_test() {
1507
- const report = { erc_errors: [], markers: [] };
1508
1515
  const tester_context = {
1509
- report,
1516
+ report: this.report,
1510
1517
  ...this.ctx
1511
1518
  };
1512
1519
  const visitors = [
@@ -1520,7 +1527,6 @@ var ERC_TESTER = class {
1520
1527
  }
1521
1528
  }
1522
1529
  return {
1523
- ...report,
1524
1530
  connection_graph: this.ctx.connection_graph
1525
1531
  };
1526
1532
  }
@@ -1535,8 +1541,18 @@ import {
1535
1541
  import {
1536
1542
  PowerShape
1537
1543
  } from "@modular-circuit/electronics-model";
1538
- import { block_is_associated_with_concrete_module } from "@modular-circuit/ir";
1539
- import { deep_copy, fmt_module_name, gen_uuid, get_circuit_ports, get_port_labels } from "@modular-circuit/utils";
1544
+ import {
1545
+ block_is_abstract,
1546
+ block_is_associated_with_concrete_module
1547
+ } from "@modular-circuit/ir";
1548
+ import {
1549
+ KICAD_SHC_FILE_EXT,
1550
+ deep_copy,
1551
+ fmt_module_name,
1552
+ gen_uuid,
1553
+ get_circuit_ports,
1554
+ get_port_labels
1555
+ } from "@modular-circuit/utils";
1540
1556
  var IR_GRAPH_CONVERTER = class {
1541
1557
  constructor(circuits) {
1542
1558
  this.circuits = circuits;
@@ -1559,26 +1575,58 @@ var IR_GRAPH_CONVERTER = class {
1559
1575
  for (const [sch_name, design] of Object.entries(designs)) {
1560
1576
  this.schematics[sch_name] = { uuid: design.uuid ?? gen_uuid(), sheets: [], powers: [] };
1561
1577
  for (const block of design.blocks ?? []) {
1562
- const circuit = this.circuits[block_is_associated_with_concrete_module(block.type) ? block.type : fmt_module_name(block.type)];
1563
- this.schematics[sch_name].sheets.push({
1564
- uuid: block.uuid,
1565
- sheet_name: design.name ?? circuit.name,
1566
- sheet_file_name: circuit.main,
1567
- ports: block.ports.map((p) => p.uuid)
1568
- });
1569
- const port_map = get_circuit_ports(circuit);
1570
- for (const port of block.ports) {
1571
- const param = deep_copy(port_map[port.index]);
1572
- const uuid = port.uuid;
1573
- this.add_node(uuid);
1574
- this.connection_node_map[uuid] = {
1575
- uuid,
1576
- type: ConnectionNodeType3.Port,
1577
- param,
1578
- label_shapes: get_port_labels(param, circuit)
1579
- };
1580
- this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
1581
- this.reporter_context.pin_name_table[port.uuid] = port.name;
1578
+ if (!block_is_abstract(block)) {
1579
+ const circuit = this.circuits[block_is_associated_with_concrete_module(block.type) ? block.type : fmt_module_name(block.type)];
1580
+ this.schematics[sch_name].sheets.push({
1581
+ uuid: block.uuid,
1582
+ sheet_name: design.name ?? circuit.name,
1583
+ sheet_file_name: circuit.main,
1584
+ ports: block.ports.map((p) => p.uuid)
1585
+ });
1586
+ const port_map = get_circuit_ports(circuit);
1587
+ for (const port of block.ports) {
1588
+ let param = deep_copy(port_map[port.index]);
1589
+ if (!param || typeof param !== "object" || typeof param.type !== "string") {
1590
+ console.warn(`Cannot find port ${port.index} in circuit ${circuit.name}`);
1591
+ param = {
1592
+ type: PortType3.Passive,
1593
+ name: "GENERATED_PORT_DUE_DO_INDEX_NOT_FOUND"
1594
+ };
1595
+ }
1596
+ const uuid = port.uuid;
1597
+ this.add_node(uuid);
1598
+ this.connection_node_map[uuid] = {
1599
+ uuid,
1600
+ type: ConnectionNodeType3.Port,
1601
+ param,
1602
+ label_shapes: get_port_labels(param, circuit)
1603
+ };
1604
+ this.reporter_context.pin_module_name_table[port.uuid] = circuit.name;
1605
+ this.reporter_context.pin_name_table[port.uuid] = port.name;
1606
+ }
1607
+ } else {
1608
+ const sheet_name = design.name ?? block.name;
1609
+ this.schematics[sch_name].sheets.push({
1610
+ uuid: block.uuid,
1611
+ sheet_name,
1612
+ sheet_file_name: `${sheet_name}${KICAD_SHC_FILE_EXT}`,
1613
+ ports: block.ports.map((p) => p.uuid)
1614
+ });
1615
+ for (const port of block.ports) {
1616
+ const param = port.port;
1617
+ const uuid = port.uuid;
1618
+ this.add_node(uuid);
1619
+ this.connection_node_map[uuid] = {
1620
+ uuid,
1621
+ type: ConnectionNodeType3.Port,
1622
+ param: typeof param === "string" ? {
1623
+ type: PortType3.Passive,
1624
+ name: port.port
1625
+ } : param
1626
+ };
1627
+ this.reporter_context.pin_module_name_table[port.uuid] = sheet_name;
1628
+ this.reporter_context.pin_name_table[port.uuid] = typeof port.port === "string" ? port.port : port.port.name;
1629
+ }
1582
1630
  }
1583
1631
  }
1584
1632
  const lb_map = {};
@@ -1669,17 +1717,24 @@ var IR_GRAPH_CONVERTER = class {
1669
1717
  import {
1670
1718
  ConnectionNodeType as ConnectionNodeType4,
1671
1719
  PRIORITY,
1720
+ PortType as PortType4,
1672
1721
  get_connection_node_priority
1673
1722
  } from "@modular-circuit/electronics-model";
1674
1723
  import { test_connected_components } from "@modular-circuit/utils";
1675
1724
 
1676
1725
  // src/utils/get_dependent_modules_definition.ts
1677
- import { block_is_associated_with_concrete_module as block_is_associated_with_concrete_module2 } from "@modular-circuit/ir";
1726
+ import {
1727
+ block_is_abstract as block_is_abstract2,
1728
+ block_is_associated_with_concrete_module as block_is_associated_with_concrete_module2
1729
+ } from "@modular-circuit/ir";
1678
1730
  import { fmt_module_name as fmt_module_name2 } from "@modular-circuit/utils";
1679
1731
  async function get_dependent_modules_definition(ctx) {
1680
1732
  const circuits = {};
1681
1733
  for (const [, v] of Object.entries(ctx.schematics)) {
1682
1734
  for (const block of v.blocks ?? []) {
1735
+ if (block_is_abstract2(block)) {
1736
+ continue;
1737
+ }
1683
1738
  const module_name = block_is_associated_with_concrete_module2(block.type) ? block.type : fmt_module_name2(block.type);
1684
1739
  let def;
1685
1740
  if (block_is_associated_with_concrete_module2(block.type)) {
@@ -1703,7 +1758,8 @@ var ConnectionGraphsBuilder = class {
1703
1758
  constructor(connection_node_map) {
1704
1759
  this.connection_node_map = connection_node_map;
1705
1760
  this.net_count = 0;
1706
- this.item_graphs = {};
1761
+ this.bundle_consumed_port_count = {};
1762
+ this.bundles = {};
1707
1763
  this.connection_graph = {
1708
1764
  subgraphs: []
1709
1765
  };
@@ -1713,8 +1769,25 @@ var ConnectionGraphsBuilder = class {
1713
1769
  sub_graph.is_global_pwr = false;
1714
1770
  sub_graph.is_isolated = cc.length < 2;
1715
1771
  const nodes = cc.map((id) => {
1716
- this.item_graphs[id] = sub_graph;
1717
- return this.connection_node_map[id];
1772
+ const node = this.connection_node_map[id];
1773
+ if (node?.type === ConnectionNodeType4.Port) {
1774
+ const port = node.param;
1775
+ if (port.type === PortType4.DigitalBidirBundle) {
1776
+ const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
1777
+ this.bundle_consumed_port_count[id] = consumed_count + 1;
1778
+ this.bundles[id] = port;
1779
+ const labels = port.labels_associated;
1780
+ return {
1781
+ ...node,
1782
+ param: {
1783
+ ...node.param,
1784
+ type: PortType4.DigitalBidir,
1785
+ label_associated: labels[consumed_count] ?? `${node.param.name}-${consumed_count}`
1786
+ }
1787
+ };
1788
+ }
1789
+ }
1790
+ return node;
1718
1791
  });
1719
1792
  sub_graph.nodes = nodes;
1720
1793
  this.resolve_net_drive(nodes, sub_graph);
@@ -1774,8 +1847,11 @@ var ConnectionGraphsBuilder = class {
1774
1847
  get_connection_graph() {
1775
1848
  return this.connection_graph;
1776
1849
  }
1777
- get_item_graphs() {
1778
- return this.item_graphs;
1850
+ get_bundle_consumed_port_count() {
1851
+ return {
1852
+ bundle_consumed_port_count: this.bundle_consumed_port_count,
1853
+ bundles: this.bundles
1854
+ };
1779
1855
  }
1780
1856
  };
1781
1857
  async function build_connection_graph(ctx) {
@@ -1787,21 +1863,37 @@ async function build_connection_graph(ctx) {
1787
1863
  return {
1788
1864
  ...converter.get_report_context(),
1789
1865
  connection_graph: cc_builder.get_connection_graph(),
1790
- item_graphs: cc_builder.get_item_graphs(),
1791
- cg_schematics: converter.get_schematics()
1866
+ cg_schematics: converter.get_schematics(),
1867
+ bundle_consume_status: cc_builder.get_bundle_consumed_port_count()
1792
1868
  };
1793
1869
  }
1794
1870
 
1795
1871
  // src/tester/graph/graph_erc.ts
1796
1872
  async function graph_ecr(ctx) {
1873
+ const erc_report = {
1874
+ markers: [],
1875
+ erc_errors: []
1876
+ };
1797
1877
  const connection_graph = await build_connection_graph(ctx);
1798
- const tester = new ERC_TESTER({
1799
- ...ctx,
1800
- connection_graph: connection_graph.connection_graph
1801
- });
1802
- return { ...tester.run_test(), ...connection_graph };
1878
+ for (const [port_id, count] of Object.entries(connection_graph.bundle_consume_status.bundle_consumed_port_count)) {
1879
+ const bundle = connection_graph.bundle_consume_status.bundles[port_id];
1880
+ if (Array.isArray(bundle.labels_associated) && count > bundle.labels_associated.length) {
1881
+ erc_report.erc_errors.push(CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT(port_id));
1882
+ } else {
1883
+ console.warn(`Illegal bundle: ${port_id} , no associated labels`);
1884
+ }
1885
+ }
1886
+ const tester = new ERC_TESTER(
1887
+ {
1888
+ ...ctx,
1889
+ connection_graph: connection_graph.connection_graph
1890
+ },
1891
+ erc_report
1892
+ );
1893
+ return { ...tester.run_test(), ...connection_graph, erc_report };
1803
1894
  }
1804
1895
  export {
1896
+ CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
1805
1897
  ConnectionGraphsBuilder,
1806
1898
  DEFAULT_ERC_SETTING,
1807
1899
  DEFAULT_PIN_MAP,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/perc",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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/electronics-model": "0.1.0",
31
- "@modular-circuit/utils": "0.1.0",
32
- "@modular-circuit/ir": "0.1.1"
29
+ "@modular-circuit/electronics-model": "0.1.1",
30
+ "@modular-circuit/ir": "0.1.2",
31
+ "@modular-circuit/utils": "0.1.2"
33
32
  },
34
33
  "scripts": {
35
34
  "clean": "rimraf dist",