@modular-circuit/perc 0.1.2 → 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 +37 -17
- package/dist/index.d.ts +37 -17
- package/dist/index.js +52 -13
- package/dist/index.mjs +51 -13
- package/package.json +2 -2
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
|
-
|
|
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
|
|
|
@@ -446,14 +454,23 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
446
454
|
private net_count;
|
|
447
455
|
private connection_graph;
|
|
448
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;
|
|
462
|
+
get_bundle_consumed_port_count(): {
|
|
463
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
464
|
+
bundles: Record<string, DigitalBidirBundle>;
|
|
465
|
+
};
|
|
453
466
|
}
|
|
454
467
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
455
468
|
connection_graph: ConnectionGraph;
|
|
456
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
|
+
};
|
|
457
474
|
pin_name_table: Record<string, string>;
|
|
458
475
|
pin_module_name_table: Record<string, string>;
|
|
459
476
|
}>;
|
|
@@ -462,12 +479,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
|
|
|
462
479
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
463
480
|
schematics: Record<string, IR_Graph>;
|
|
464
481
|
}): Promise<{
|
|
482
|
+
erc_report: ERC_REPORT;
|
|
465
483
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
466
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
|
+
};
|
|
467
489
|
pin_name_table: Record<string, string>;
|
|
468
490
|
pin_module_name_table: Record<string, string>;
|
|
469
|
-
markers: SCH_MARKER[];
|
|
470
|
-
erc_errors: SCH_ERC_ITEM[];
|
|
471
491
|
}>;
|
|
472
492
|
|
|
473
|
-
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
|
-
|
|
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
|
|
|
@@ -446,14 +454,23 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
446
454
|
private net_count;
|
|
447
455
|
private connection_graph;
|
|
448
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;
|
|
462
|
+
get_bundle_consumed_port_count(): {
|
|
463
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
464
|
+
bundles: Record<string, DigitalBidirBundle>;
|
|
465
|
+
};
|
|
453
466
|
}
|
|
454
467
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
455
468
|
connection_graph: ConnectionGraph;
|
|
456
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
|
+
};
|
|
457
474
|
pin_name_table: Record<string, string>;
|
|
458
475
|
pin_module_name_table: Record<string, string>;
|
|
459
476
|
}>;
|
|
@@ -462,12 +479,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
|
|
|
462
479
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
463
480
|
schematics: Record<string, IR_Graph>;
|
|
464
481
|
}): Promise<{
|
|
482
|
+
erc_report: ERC_REPORT;
|
|
465
483
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
466
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
|
+
};
|
|
467
489
|
pin_name_table: Record<string, string>;
|
|
468
490
|
pin_module_name_table: Record<string, string>;
|
|
469
|
-
markers: SCH_MARKER[];
|
|
470
|
-
erc_errors: SCH_ERC_ITEM[];
|
|
471
491
|
}>;
|
|
472
492
|
|
|
473
|
-
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
|
}
|
|
@@ -1608,7 +1615,14 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1608
1615
|
});
|
|
1609
1616
|
const port_map = (0, import_utils.get_circuit_ports)(circuit);
|
|
1610
1617
|
for (const port of block.ports) {
|
|
1611
|
-
|
|
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
|
+
}
|
|
1612
1626
|
const uuid = port.uuid;
|
|
1613
1627
|
this.add_node(uuid);
|
|
1614
1628
|
this.connection_node_map[uuid] = {
|
|
@@ -1767,6 +1781,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1767
1781
|
this.connection_node_map = connection_node_map;
|
|
1768
1782
|
this.net_count = 0;
|
|
1769
1783
|
this.bundle_consumed_port_count = {};
|
|
1784
|
+
this.bundles = {};
|
|
1770
1785
|
this.connection_graph = {
|
|
1771
1786
|
subgraphs: []
|
|
1772
1787
|
};
|
|
@@ -1777,11 +1792,12 @@ var ConnectionGraphsBuilder = class {
|
|
|
1777
1792
|
sub_graph.is_isolated = cc.length < 2;
|
|
1778
1793
|
const nodes = cc.map((id) => {
|
|
1779
1794
|
const node = this.connection_node_map[id];
|
|
1780
|
-
if (node
|
|
1795
|
+
if (node?.type === import_electronics_model10.ConnectionNodeType.Port) {
|
|
1781
1796
|
const port = node.param;
|
|
1782
1797
|
if (port.type === import_electronics_model10.PortType.DigitalBidirBundle) {
|
|
1783
1798
|
const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
|
|
1784
1799
|
this.bundle_consumed_port_count[id] = consumed_count + 1;
|
|
1800
|
+
this.bundles[id] = port;
|
|
1785
1801
|
const labels = port.labels_associated;
|
|
1786
1802
|
return {
|
|
1787
1803
|
...node,
|
|
@@ -1853,6 +1869,12 @@ var ConnectionGraphsBuilder = class {
|
|
|
1853
1869
|
get_connection_graph() {
|
|
1854
1870
|
return this.connection_graph;
|
|
1855
1871
|
}
|
|
1872
|
+
get_bundle_consumed_port_count() {
|
|
1873
|
+
return {
|
|
1874
|
+
bundle_consumed_port_count: this.bundle_consumed_port_count,
|
|
1875
|
+
bundles: this.bundles
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1856
1878
|
};
|
|
1857
1879
|
async function build_connection_graph(ctx) {
|
|
1858
1880
|
const converter = new IR_GRAPH_CONVERTER(await get_dependent_modules_definition(ctx));
|
|
@@ -1863,21 +1885,38 @@ async function build_connection_graph(ctx) {
|
|
|
1863
1885
|
return {
|
|
1864
1886
|
...converter.get_report_context(),
|
|
1865
1887
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1866
|
-
cg_schematics: converter.get_schematics()
|
|
1888
|
+
cg_schematics: converter.get_schematics(),
|
|
1889
|
+
bundle_consume_status: cc_builder.get_bundle_consumed_port_count()
|
|
1867
1890
|
};
|
|
1868
1891
|
}
|
|
1869
1892
|
|
|
1870
1893
|
// src/tester/graph/graph_erc.ts
|
|
1871
1894
|
async function graph_ecr(ctx) {
|
|
1895
|
+
const erc_report = {
|
|
1896
|
+
markers: [],
|
|
1897
|
+
erc_errors: []
|
|
1898
|
+
};
|
|
1872
1899
|
const connection_graph = await build_connection_graph(ctx);
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
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 };
|
|
1878
1916
|
}
|
|
1879
1917
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1880
1918
|
0 && (module.exports = {
|
|
1919
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
|
|
1881
1920
|
ConnectionGraphsBuilder,
|
|
1882
1921
|
DEFAULT_ERC_SETTING,
|
|
1883
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
|
}
|
|
@@ -1579,7 +1585,14 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1579
1585
|
});
|
|
1580
1586
|
const port_map = get_circuit_ports(circuit);
|
|
1581
1587
|
for (const port of block.ports) {
|
|
1582
|
-
|
|
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
|
+
}
|
|
1583
1596
|
const uuid = port.uuid;
|
|
1584
1597
|
this.add_node(uuid);
|
|
1585
1598
|
this.connection_node_map[uuid] = {
|
|
@@ -1746,6 +1759,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1746
1759
|
this.connection_node_map = connection_node_map;
|
|
1747
1760
|
this.net_count = 0;
|
|
1748
1761
|
this.bundle_consumed_port_count = {};
|
|
1762
|
+
this.bundles = {};
|
|
1749
1763
|
this.connection_graph = {
|
|
1750
1764
|
subgraphs: []
|
|
1751
1765
|
};
|
|
@@ -1756,11 +1770,12 @@ var ConnectionGraphsBuilder = class {
|
|
|
1756
1770
|
sub_graph.is_isolated = cc.length < 2;
|
|
1757
1771
|
const nodes = cc.map((id) => {
|
|
1758
1772
|
const node = this.connection_node_map[id];
|
|
1759
|
-
if (node
|
|
1773
|
+
if (node?.type === ConnectionNodeType4.Port) {
|
|
1760
1774
|
const port = node.param;
|
|
1761
1775
|
if (port.type === PortType4.DigitalBidirBundle) {
|
|
1762
1776
|
const consumed_count = id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[id] : 0;
|
|
1763
1777
|
this.bundle_consumed_port_count[id] = consumed_count + 1;
|
|
1778
|
+
this.bundles[id] = port;
|
|
1764
1779
|
const labels = port.labels_associated;
|
|
1765
1780
|
return {
|
|
1766
1781
|
...node,
|
|
@@ -1832,6 +1847,12 @@ var ConnectionGraphsBuilder = class {
|
|
|
1832
1847
|
get_connection_graph() {
|
|
1833
1848
|
return this.connection_graph;
|
|
1834
1849
|
}
|
|
1850
|
+
get_bundle_consumed_port_count() {
|
|
1851
|
+
return {
|
|
1852
|
+
bundle_consumed_port_count: this.bundle_consumed_port_count,
|
|
1853
|
+
bundles: this.bundles
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1835
1856
|
};
|
|
1836
1857
|
async function build_connection_graph(ctx) {
|
|
1837
1858
|
const converter = new IR_GRAPH_CONVERTER(await get_dependent_modules_definition(ctx));
|
|
@@ -1842,20 +1863,37 @@ async function build_connection_graph(ctx) {
|
|
|
1842
1863
|
return {
|
|
1843
1864
|
...converter.get_report_context(),
|
|
1844
1865
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1845
|
-
cg_schematics: converter.get_schematics()
|
|
1866
|
+
cg_schematics: converter.get_schematics(),
|
|
1867
|
+
bundle_consume_status: cc_builder.get_bundle_consumed_port_count()
|
|
1846
1868
|
};
|
|
1847
1869
|
}
|
|
1848
1870
|
|
|
1849
1871
|
// src/tester/graph/graph_erc.ts
|
|
1850
1872
|
async function graph_ecr(ctx) {
|
|
1873
|
+
const erc_report = {
|
|
1874
|
+
markers: [],
|
|
1875
|
+
erc_errors: []
|
|
1876
|
+
};
|
|
1851
1877
|
const connection_graph = await build_connection_graph(ctx);
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
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 };
|
|
1857
1894
|
}
|
|
1858
1895
|
export {
|
|
1896
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
|
|
1859
1897
|
ConnectionGraphsBuilder,
|
|
1860
1898
|
DEFAULT_ERC_SETTING,
|
|
1861
1899
|
DEFAULT_PIN_MAP,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/perc",
|
|
3
|
-
"version": "0.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",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"typescript": "^5.4.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@modular-circuit/ir": "0.1.2",
|
|
30
29
|
"@modular-circuit/electronics-model": "0.1.1",
|
|
30
|
+
"@modular-circuit/ir": "0.1.2",
|
|
31
31
|
"@modular-circuit/utils": "0.1.2"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|