@modular-circuit/perc 0.1.2 → 0.1.4
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 +43 -18
- package/dist/index.d.ts +43 -18
- package/dist/index.js +119 -47
- package/dist/index.mjs +118 -48
- 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, DigitalBidirBundle, PowerShape, PowerSymbolPort, Connection, ConnectionNode } 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
|
|
|
@@ -423,12 +431,23 @@ interface CG_SCHEMATIC {
|
|
|
423
431
|
sheets: CG_SHEET[];
|
|
424
432
|
powers: NL_PowerSymbol[];
|
|
425
433
|
}
|
|
434
|
+
interface BundleInfo {
|
|
435
|
+
bundle: DigitalBidirBundle;
|
|
436
|
+
block_name: string;
|
|
437
|
+
circuit?: ModuleCircuit;
|
|
438
|
+
}
|
|
426
439
|
declare class IR_GRAPH_CONVERTER implements GRAPH_CONVERTER {
|
|
427
440
|
private readonly circuits;
|
|
428
441
|
private graph;
|
|
429
442
|
private connection_node_map;
|
|
430
443
|
private schematics;
|
|
444
|
+
private bundle_consumed_port_count;
|
|
445
|
+
private bundles;
|
|
431
446
|
private reporter_context;
|
|
447
|
+
get_bundle_consumed_port_count(): {
|
|
448
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
449
|
+
bundles: Record<string, BundleInfo>;
|
|
450
|
+
};
|
|
432
451
|
get_report_context(): ERC_REPORTER_CONTEXT;
|
|
433
452
|
constructor(circuits: Record<string, ModuleCircuit>);
|
|
434
453
|
convert_to_graph(designs: Record<string, IR_Graph>): true | Error[];
|
|
@@ -445,7 +464,6 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
445
464
|
private readonly connection_node_map;
|
|
446
465
|
private net_count;
|
|
447
466
|
private connection_graph;
|
|
448
|
-
private bundle_consumed_port_count;
|
|
449
467
|
constructor(connection_node_map: ConnectionNodeMap);
|
|
450
468
|
end_visit_component(cc: string[]): void;
|
|
451
469
|
resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
|
|
@@ -454,6 +472,10 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
454
472
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
455
473
|
connection_graph: ConnectionGraph;
|
|
456
474
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
475
|
+
bundle_consume_status: {
|
|
476
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
477
|
+
bundles: Record<string, BundleInfo>;
|
|
478
|
+
};
|
|
457
479
|
pin_name_table: Record<string, string>;
|
|
458
480
|
pin_module_name_table: Record<string, string>;
|
|
459
481
|
}>;
|
|
@@ -462,12 +484,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
|
|
|
462
484
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
463
485
|
schematics: Record<string, IR_Graph>;
|
|
464
486
|
}): Promise<{
|
|
487
|
+
erc_report: ERC_REPORT;
|
|
465
488
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
466
489
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
490
|
+
bundle_consume_status: {
|
|
491
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
492
|
+
bundles: Record<string, BundleInfo>;
|
|
493
|
+
};
|
|
467
494
|
pin_name_table: Record<string, string>;
|
|
468
495
|
pin_module_name_table: Record<string, string>;
|
|
469
|
-
markers: SCH_MARKER[];
|
|
470
|
-
erc_errors: SCH_ERC_ITEM[];
|
|
471
496
|
}>;
|
|
472
497
|
|
|
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 };
|
|
498
|
+
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, 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, DigitalBidirBundle, PowerShape, PowerSymbolPort, Connection, ConnectionNode } 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
|
|
|
@@ -423,12 +431,23 @@ interface CG_SCHEMATIC {
|
|
|
423
431
|
sheets: CG_SHEET[];
|
|
424
432
|
powers: NL_PowerSymbol[];
|
|
425
433
|
}
|
|
434
|
+
interface BundleInfo {
|
|
435
|
+
bundle: DigitalBidirBundle;
|
|
436
|
+
block_name: string;
|
|
437
|
+
circuit?: ModuleCircuit;
|
|
438
|
+
}
|
|
426
439
|
declare class IR_GRAPH_CONVERTER implements GRAPH_CONVERTER {
|
|
427
440
|
private readonly circuits;
|
|
428
441
|
private graph;
|
|
429
442
|
private connection_node_map;
|
|
430
443
|
private schematics;
|
|
444
|
+
private bundle_consumed_port_count;
|
|
445
|
+
private bundles;
|
|
431
446
|
private reporter_context;
|
|
447
|
+
get_bundle_consumed_port_count(): {
|
|
448
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
449
|
+
bundles: Record<string, BundleInfo>;
|
|
450
|
+
};
|
|
432
451
|
get_report_context(): ERC_REPORTER_CONTEXT;
|
|
433
452
|
constructor(circuits: Record<string, ModuleCircuit>);
|
|
434
453
|
convert_to_graph(designs: Record<string, IR_Graph>): true | Error[];
|
|
@@ -445,7 +464,6 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
445
464
|
private readonly connection_node_map;
|
|
446
465
|
private net_count;
|
|
447
466
|
private connection_graph;
|
|
448
|
-
private bundle_consumed_port_count;
|
|
449
467
|
constructor(connection_node_map: ConnectionNodeMap);
|
|
450
468
|
end_visit_component(cc: string[]): void;
|
|
451
469
|
resolve_net_drive(nodes: ConnectionNode[], sub_graph: ConnectionSubgraph): void;
|
|
@@ -454,6 +472,10 @@ declare class ConnectionGraphsBuilder implements CC_Visitor {
|
|
|
454
472
|
declare function build_connection_graph(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<{
|
|
455
473
|
connection_graph: ConnectionGraph;
|
|
456
474
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
475
|
+
bundle_consume_status: {
|
|
476
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
477
|
+
bundles: Record<string, BundleInfo>;
|
|
478
|
+
};
|
|
457
479
|
pin_name_table: Record<string, string>;
|
|
458
480
|
pin_module_name_table: Record<string, string>;
|
|
459
481
|
}>;
|
|
@@ -462,12 +484,15 @@ type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & Omit<ERC_CONTEXT, 'connection_gr
|
|
|
462
484
|
declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
463
485
|
schematics: Record<string, IR_Graph>;
|
|
464
486
|
}): Promise<{
|
|
487
|
+
erc_report: ERC_REPORT;
|
|
465
488
|
connection_graph: _modular_circuit_electronics_model.ConnectionGraph;
|
|
466
489
|
cg_schematics: Record<string, CG_SCHEMATIC>;
|
|
490
|
+
bundle_consume_status: {
|
|
491
|
+
bundle_consumed_port_count: Record<string, number>;
|
|
492
|
+
bundles: Record<string, BundleInfo>;
|
|
493
|
+
};
|
|
467
494
|
pin_name_table: Record<string, string>;
|
|
468
495
|
pin_module_name_table: Record<string, string>;
|
|
469
|
-
markers: SCH_MARKER[];
|
|
470
|
-
erc_errors: SCH_ERC_ITEM[];
|
|
471
496
|
}>;
|
|
472
497
|
|
|
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 };
|
|
498
|
+
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, 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
|
}
|
|
@@ -1582,11 +1589,19 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1582
1589
|
this.graph = {};
|
|
1583
1590
|
this.connection_node_map = {};
|
|
1584
1591
|
this.schematics = {};
|
|
1592
|
+
this.bundle_consumed_port_count = {};
|
|
1593
|
+
this.bundles = {};
|
|
1585
1594
|
this.reporter_context = {
|
|
1586
1595
|
pin_name_table: {},
|
|
1587
1596
|
pin_module_name_table: {}
|
|
1588
1597
|
};
|
|
1589
1598
|
}
|
|
1599
|
+
get_bundle_consumed_port_count() {
|
|
1600
|
+
return {
|
|
1601
|
+
bundle_consumed_port_count: this.bundle_consumed_port_count,
|
|
1602
|
+
bundles: this.bundles
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1590
1605
|
get_report_context() {
|
|
1591
1606
|
return this.reporter_context;
|
|
1592
1607
|
}
|
|
@@ -1595,6 +1610,12 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1595
1610
|
if (Object.keys(designs).length > 1) {
|
|
1596
1611
|
throw new Error("Multiple designs are not supported");
|
|
1597
1612
|
}
|
|
1613
|
+
const handle_graph_node = (uuid, port_block_name, port_name, port) => {
|
|
1614
|
+
this.add_node(uuid);
|
|
1615
|
+
this.connection_node_map[uuid] = port;
|
|
1616
|
+
this.reporter_context.pin_module_name_table[port.uuid] = port_block_name;
|
|
1617
|
+
this.reporter_context.pin_name_table[port.uuid] = port_name;
|
|
1618
|
+
};
|
|
1598
1619
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1599
1620
|
this.schematics[sch_name] = { uuid: design.uuid ?? (0, import_utils.gen_uuid)(), sheets: [], powers: [] };
|
|
1600
1621
|
for (const block of design.blocks ?? []) {
|
|
@@ -1608,17 +1629,29 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1608
1629
|
});
|
|
1609
1630
|
const port_map = (0, import_utils.get_circuit_ports)(circuit);
|
|
1610
1631
|
for (const port of block.ports) {
|
|
1611
|
-
|
|
1632
|
+
let param = (0, import_utils.deep_copy)(port_map[port.index]);
|
|
1633
|
+
if (!param || typeof param !== "object" || typeof param.type !== "string") {
|
|
1634
|
+
console.warn(`Cannot find port ${port.index} in circuit ${circuit.name}`);
|
|
1635
|
+
param = {
|
|
1636
|
+
type: import_electronics_model8.PortType.Passive,
|
|
1637
|
+
name: "GENERATED_PORT_DUE_DO_INDEX_NOT_FOUND"
|
|
1638
|
+
};
|
|
1639
|
+
}
|
|
1612
1640
|
const uuid = port.uuid;
|
|
1613
|
-
|
|
1614
|
-
|
|
1641
|
+
if (param.type === import_electronics_model8.PortType.DigitalBidirBundle) {
|
|
1642
|
+
this.bundles[uuid] = {
|
|
1643
|
+
bundle: param,
|
|
1644
|
+
block_name: circuit.name,
|
|
1645
|
+
circuit
|
|
1646
|
+
};
|
|
1647
|
+
continue;
|
|
1648
|
+
}
|
|
1649
|
+
handle_graph_node(uuid, circuit.name, port.name, {
|
|
1615
1650
|
uuid,
|
|
1616
1651
|
type: import_electronics_model8.ConnectionNodeType.Port,
|
|
1617
1652
|
param,
|
|
1618
1653
|
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;
|
|
1654
|
+
});
|
|
1622
1655
|
}
|
|
1623
1656
|
} else {
|
|
1624
1657
|
const sheet_name = design.name ?? block.name;
|
|
@@ -1631,17 +1664,21 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1631
1664
|
for (const port of block.ports) {
|
|
1632
1665
|
const param = port.port;
|
|
1633
1666
|
const uuid = port.uuid;
|
|
1634
|
-
|
|
1635
|
-
|
|
1667
|
+
if (typeof port.port !== "string" && port.port.type === import_electronics_model8.PortType.DigitalBidirBundle) {
|
|
1668
|
+
this.bundles[uuid] = {
|
|
1669
|
+
bundle: port.port,
|
|
1670
|
+
block_name: sheet_name
|
|
1671
|
+
};
|
|
1672
|
+
continue;
|
|
1673
|
+
}
|
|
1674
|
+
handle_graph_node(uuid, sheet_name, typeof port.port === "string" ? port.port : port.port.name, {
|
|
1636
1675
|
uuid,
|
|
1637
1676
|
type: import_electronics_model8.ConnectionNodeType.Port,
|
|
1638
1677
|
param: typeof param === "string" ? {
|
|
1639
1678
|
type: import_electronics_model8.PortType.Passive,
|
|
1640
1679
|
name: port.port
|
|
1641
1680
|
} : 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;
|
|
1681
|
+
});
|
|
1645
1682
|
}
|
|
1646
1683
|
}
|
|
1647
1684
|
}
|
|
@@ -1687,10 +1724,47 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1687
1724
|
this.add_node(uuid);
|
|
1688
1725
|
this.connection_node_map[uuid] = { uuid, type: import_electronics_model8.ConnectionNodeType.Graphics };
|
|
1689
1726
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
this.
|
|
1693
|
-
|
|
1727
|
+
const handel_wire_instance = (abstract_or_actual_wire, actual_wire_id) => {
|
|
1728
|
+
this.add_connection(abstract_or_actual_wire.from, abstract_or_actual_wire.to);
|
|
1729
|
+
this.connection_node_map[abstract_or_actual_wire.uuid] = {
|
|
1730
|
+
uuid: actual_wire_id,
|
|
1731
|
+
type: import_electronics_model8.ConnectionNodeType.Graphics
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
const handel_bundle_connection = (bundle_id) => {
|
|
1735
|
+
const uuid = (0, import_utils.gen_uuid)();
|
|
1736
|
+
const bundle_info = this.bundles[bundle_id];
|
|
1737
|
+
const consumed_count = bundle_id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[bundle_id] : 0;
|
|
1738
|
+
this.bundle_consumed_port_count[bundle_id] = consumed_count + 1;
|
|
1739
|
+
let labels_shapes = void 0;
|
|
1740
|
+
if (bundle_info.circuit) labels_shapes = (0, import_utils.get_port_labels)(bundle_info.bundle, bundle_info.circuit);
|
|
1741
|
+
const label = bundle_info.bundle.labels_associated[consumed_count] ?? `${bundle_info.bundle.name}-${consumed_count}`;
|
|
1742
|
+
const label_shape = labels_shapes?.[label];
|
|
1743
|
+
handle_graph_node(uuid, bundle_info.block_name, bundle_info.bundle.name, {
|
|
1744
|
+
type: import_electronics_model8.ConnectionNodeType.Port,
|
|
1745
|
+
label_shapes: label_shape ? { [label]: label_shape } : void 0,
|
|
1746
|
+
param: {
|
|
1747
|
+
...{
|
|
1748
|
+
...bundle_info.bundle,
|
|
1749
|
+
labels_associated: void 0,
|
|
1750
|
+
type: import_electronics_model8.PortType.DigitalBidir,
|
|
1751
|
+
label_associated: label
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
uuid
|
|
1755
|
+
});
|
|
1756
|
+
return uuid;
|
|
1757
|
+
};
|
|
1758
|
+
for (const actual_wire of design.wires ?? []) {
|
|
1759
|
+
const actual_wire_id = actual_wire.uuid;
|
|
1760
|
+
const connection = { ...actual_wire };
|
|
1761
|
+
if (connection.from in this.bundles) {
|
|
1762
|
+
connection.from = handel_bundle_connection(connection.from);
|
|
1763
|
+
}
|
|
1764
|
+
if (connection.to in this.bundles) {
|
|
1765
|
+
connection.to = handel_bundle_connection(connection.to);
|
|
1766
|
+
}
|
|
1767
|
+
handel_wire_instance(connection, actual_wire_id);
|
|
1694
1768
|
}
|
|
1695
1769
|
}
|
|
1696
1770
|
return errors.length ? errors : true;
|
|
@@ -1766,7 +1840,6 @@ var ConnectionGraphsBuilder = class {
|
|
|
1766
1840
|
constructor(connection_node_map) {
|
|
1767
1841
|
this.connection_node_map = connection_node_map;
|
|
1768
1842
|
this.net_count = 0;
|
|
1769
|
-
this.bundle_consumed_port_count = {};
|
|
1770
1843
|
this.connection_graph = {
|
|
1771
1844
|
subgraphs: []
|
|
1772
1845
|
};
|
|
@@ -1775,26 +1848,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1775
1848
|
const sub_graph = {};
|
|
1776
1849
|
sub_graph.is_global_pwr = false;
|
|
1777
1850
|
sub_graph.is_isolated = cc.length < 2;
|
|
1778
|
-
const nodes = cc.map((id) =>
|
|
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;
|
|
1797
|
-
});
|
|
1851
|
+
const nodes = cc.map((id) => this.connection_node_map[id]);
|
|
1798
1852
|
sub_graph.nodes = nodes;
|
|
1799
1853
|
this.resolve_net_drive(nodes, sub_graph);
|
|
1800
1854
|
this.connection_graph.subgraphs.push(sub_graph);
|
|
@@ -1863,21 +1917,39 @@ async function build_connection_graph(ctx) {
|
|
|
1863
1917
|
return {
|
|
1864
1918
|
...converter.get_report_context(),
|
|
1865
1919
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1866
|
-
cg_schematics: converter.get_schematics()
|
|
1920
|
+
cg_schematics: converter.get_schematics(),
|
|
1921
|
+
bundle_consume_status: converter.get_bundle_consumed_port_count()
|
|
1867
1922
|
};
|
|
1868
1923
|
}
|
|
1869
1924
|
|
|
1870
1925
|
// src/tester/graph/graph_erc.ts
|
|
1871
1926
|
async function graph_ecr(ctx) {
|
|
1927
|
+
const erc_report = {
|
|
1928
|
+
markers: [],
|
|
1929
|
+
erc_errors: []
|
|
1930
|
+
};
|
|
1872
1931
|
const connection_graph = await build_connection_graph(ctx);
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1932
|
+
for (const [port_id, count] of Object.entries(connection_graph.bundle_consume_status.bundle_consumed_port_count)) {
|
|
1933
|
+
const bundle_info = connection_graph.bundle_consume_status.bundles[port_id];
|
|
1934
|
+
const bundle = bundle_info.bundle;
|
|
1935
|
+
if (Array.isArray(bundle.labels_associated) && count > bundle.labels_associated.length) {
|
|
1936
|
+
erc_report.erc_errors.push(CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT(port_id));
|
|
1937
|
+
} else {
|
|
1938
|
+
console.warn(`Illegal bundle: ${port_id} , no associated labels`);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
const tester = new ERC_TESTER(
|
|
1942
|
+
{
|
|
1943
|
+
...ctx,
|
|
1944
|
+
connection_graph: connection_graph.connection_graph
|
|
1945
|
+
},
|
|
1946
|
+
erc_report
|
|
1947
|
+
);
|
|
1948
|
+
return { ...tester.run_test(), ...connection_graph, erc_report };
|
|
1878
1949
|
}
|
|
1879
1950
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1880
1951
|
0 && (module.exports = {
|
|
1952
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
|
|
1881
1953
|
ConnectionGraphsBuilder,
|
|
1882
1954
|
DEFAULT_ERC_SETTING,
|
|
1883
1955
|
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
|
}
|
|
@@ -1553,11 +1559,19 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1553
1559
|
this.graph = {};
|
|
1554
1560
|
this.connection_node_map = {};
|
|
1555
1561
|
this.schematics = {};
|
|
1562
|
+
this.bundle_consumed_port_count = {};
|
|
1563
|
+
this.bundles = {};
|
|
1556
1564
|
this.reporter_context = {
|
|
1557
1565
|
pin_name_table: {},
|
|
1558
1566
|
pin_module_name_table: {}
|
|
1559
1567
|
};
|
|
1560
1568
|
}
|
|
1569
|
+
get_bundle_consumed_port_count() {
|
|
1570
|
+
return {
|
|
1571
|
+
bundle_consumed_port_count: this.bundle_consumed_port_count,
|
|
1572
|
+
bundles: this.bundles
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1561
1575
|
get_report_context() {
|
|
1562
1576
|
return this.reporter_context;
|
|
1563
1577
|
}
|
|
@@ -1566,6 +1580,12 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1566
1580
|
if (Object.keys(designs).length > 1) {
|
|
1567
1581
|
throw new Error("Multiple designs are not supported");
|
|
1568
1582
|
}
|
|
1583
|
+
const handle_graph_node = (uuid, port_block_name, port_name, port) => {
|
|
1584
|
+
this.add_node(uuid);
|
|
1585
|
+
this.connection_node_map[uuid] = port;
|
|
1586
|
+
this.reporter_context.pin_module_name_table[port.uuid] = port_block_name;
|
|
1587
|
+
this.reporter_context.pin_name_table[port.uuid] = port_name;
|
|
1588
|
+
};
|
|
1569
1589
|
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1570
1590
|
this.schematics[sch_name] = { uuid: design.uuid ?? gen_uuid(), sheets: [], powers: [] };
|
|
1571
1591
|
for (const block of design.blocks ?? []) {
|
|
@@ -1579,17 +1599,29 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1579
1599
|
});
|
|
1580
1600
|
const port_map = get_circuit_ports(circuit);
|
|
1581
1601
|
for (const port of block.ports) {
|
|
1582
|
-
|
|
1602
|
+
let param = deep_copy(port_map[port.index]);
|
|
1603
|
+
if (!param || typeof param !== "object" || typeof param.type !== "string") {
|
|
1604
|
+
console.warn(`Cannot find port ${port.index} in circuit ${circuit.name}`);
|
|
1605
|
+
param = {
|
|
1606
|
+
type: PortType3.Passive,
|
|
1607
|
+
name: "GENERATED_PORT_DUE_DO_INDEX_NOT_FOUND"
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1583
1610
|
const uuid = port.uuid;
|
|
1584
|
-
|
|
1585
|
-
|
|
1611
|
+
if (param.type === PortType3.DigitalBidirBundle) {
|
|
1612
|
+
this.bundles[uuid] = {
|
|
1613
|
+
bundle: param,
|
|
1614
|
+
block_name: circuit.name,
|
|
1615
|
+
circuit
|
|
1616
|
+
};
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
handle_graph_node(uuid, circuit.name, port.name, {
|
|
1586
1620
|
uuid,
|
|
1587
1621
|
type: ConnectionNodeType3.Port,
|
|
1588
1622
|
param,
|
|
1589
1623
|
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;
|
|
1624
|
+
});
|
|
1593
1625
|
}
|
|
1594
1626
|
} else {
|
|
1595
1627
|
const sheet_name = design.name ?? block.name;
|
|
@@ -1602,17 +1634,21 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1602
1634
|
for (const port of block.ports) {
|
|
1603
1635
|
const param = port.port;
|
|
1604
1636
|
const uuid = port.uuid;
|
|
1605
|
-
|
|
1606
|
-
|
|
1637
|
+
if (typeof port.port !== "string" && port.port.type === PortType3.DigitalBidirBundle) {
|
|
1638
|
+
this.bundles[uuid] = {
|
|
1639
|
+
bundle: port.port,
|
|
1640
|
+
block_name: sheet_name
|
|
1641
|
+
};
|
|
1642
|
+
continue;
|
|
1643
|
+
}
|
|
1644
|
+
handle_graph_node(uuid, sheet_name, typeof port.port === "string" ? port.port : port.port.name, {
|
|
1607
1645
|
uuid,
|
|
1608
1646
|
type: ConnectionNodeType3.Port,
|
|
1609
1647
|
param: typeof param === "string" ? {
|
|
1610
1648
|
type: PortType3.Passive,
|
|
1611
1649
|
name: port.port
|
|
1612
1650
|
} : 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;
|
|
1651
|
+
});
|
|
1616
1652
|
}
|
|
1617
1653
|
}
|
|
1618
1654
|
}
|
|
@@ -1658,10 +1694,47 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1658
1694
|
this.add_node(uuid);
|
|
1659
1695
|
this.connection_node_map[uuid] = { uuid, type: ConnectionNodeType3.Graphics };
|
|
1660
1696
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
this.
|
|
1664
|
-
|
|
1697
|
+
const handel_wire_instance = (abstract_or_actual_wire, actual_wire_id) => {
|
|
1698
|
+
this.add_connection(abstract_or_actual_wire.from, abstract_or_actual_wire.to);
|
|
1699
|
+
this.connection_node_map[abstract_or_actual_wire.uuid] = {
|
|
1700
|
+
uuid: actual_wire_id,
|
|
1701
|
+
type: ConnectionNodeType3.Graphics
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
const handel_bundle_connection = (bundle_id) => {
|
|
1705
|
+
const uuid = gen_uuid();
|
|
1706
|
+
const bundle_info = this.bundles[bundle_id];
|
|
1707
|
+
const consumed_count = bundle_id in this.bundle_consumed_port_count ? this.bundle_consumed_port_count[bundle_id] : 0;
|
|
1708
|
+
this.bundle_consumed_port_count[bundle_id] = consumed_count + 1;
|
|
1709
|
+
let labels_shapes = void 0;
|
|
1710
|
+
if (bundle_info.circuit) labels_shapes = get_port_labels(bundle_info.bundle, bundle_info.circuit);
|
|
1711
|
+
const label = bundle_info.bundle.labels_associated[consumed_count] ?? `${bundle_info.bundle.name}-${consumed_count}`;
|
|
1712
|
+
const label_shape = labels_shapes?.[label];
|
|
1713
|
+
handle_graph_node(uuid, bundle_info.block_name, bundle_info.bundle.name, {
|
|
1714
|
+
type: ConnectionNodeType3.Port,
|
|
1715
|
+
label_shapes: label_shape ? { [label]: label_shape } : void 0,
|
|
1716
|
+
param: {
|
|
1717
|
+
...{
|
|
1718
|
+
...bundle_info.bundle,
|
|
1719
|
+
labels_associated: void 0,
|
|
1720
|
+
type: PortType3.DigitalBidir,
|
|
1721
|
+
label_associated: label
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
uuid
|
|
1725
|
+
});
|
|
1726
|
+
return uuid;
|
|
1727
|
+
};
|
|
1728
|
+
for (const actual_wire of design.wires ?? []) {
|
|
1729
|
+
const actual_wire_id = actual_wire.uuid;
|
|
1730
|
+
const connection = { ...actual_wire };
|
|
1731
|
+
if (connection.from in this.bundles) {
|
|
1732
|
+
connection.from = handel_bundle_connection(connection.from);
|
|
1733
|
+
}
|
|
1734
|
+
if (connection.to in this.bundles) {
|
|
1735
|
+
connection.to = handel_bundle_connection(connection.to);
|
|
1736
|
+
}
|
|
1737
|
+
handel_wire_instance(connection, actual_wire_id);
|
|
1665
1738
|
}
|
|
1666
1739
|
}
|
|
1667
1740
|
return errors.length ? errors : true;
|
|
@@ -1704,7 +1777,6 @@ var IR_GRAPH_CONVERTER = class {
|
|
|
1704
1777
|
import {
|
|
1705
1778
|
ConnectionNodeType as ConnectionNodeType4,
|
|
1706
1779
|
PRIORITY,
|
|
1707
|
-
PortType as PortType4,
|
|
1708
1780
|
get_connection_node_priority
|
|
1709
1781
|
} from "@modular-circuit/electronics-model";
|
|
1710
1782
|
import { test_connected_components } from "@modular-circuit/utils";
|
|
@@ -1745,7 +1817,6 @@ var ConnectionGraphsBuilder = class {
|
|
|
1745
1817
|
constructor(connection_node_map) {
|
|
1746
1818
|
this.connection_node_map = connection_node_map;
|
|
1747
1819
|
this.net_count = 0;
|
|
1748
|
-
this.bundle_consumed_port_count = {};
|
|
1749
1820
|
this.connection_graph = {
|
|
1750
1821
|
subgraphs: []
|
|
1751
1822
|
};
|
|
@@ -1754,26 +1825,7 @@ var ConnectionGraphsBuilder = class {
|
|
|
1754
1825
|
const sub_graph = {};
|
|
1755
1826
|
sub_graph.is_global_pwr = false;
|
|
1756
1827
|
sub_graph.is_isolated = cc.length < 2;
|
|
1757
|
-
const nodes = cc.map((id) =>
|
|
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;
|
|
1776
|
-
});
|
|
1828
|
+
const nodes = cc.map((id) => this.connection_node_map[id]);
|
|
1777
1829
|
sub_graph.nodes = nodes;
|
|
1778
1830
|
this.resolve_net_drive(nodes, sub_graph);
|
|
1779
1831
|
this.connection_graph.subgraphs.push(sub_graph);
|
|
@@ -1842,20 +1894,38 @@ async function build_connection_graph(ctx) {
|
|
|
1842
1894
|
return {
|
|
1843
1895
|
...converter.get_report_context(),
|
|
1844
1896
|
connection_graph: cc_builder.get_connection_graph(),
|
|
1845
|
-
cg_schematics: converter.get_schematics()
|
|
1897
|
+
cg_schematics: converter.get_schematics(),
|
|
1898
|
+
bundle_consume_status: converter.get_bundle_consumed_port_count()
|
|
1846
1899
|
};
|
|
1847
1900
|
}
|
|
1848
1901
|
|
|
1849
1902
|
// src/tester/graph/graph_erc.ts
|
|
1850
1903
|
async function graph_ecr(ctx) {
|
|
1904
|
+
const erc_report = {
|
|
1905
|
+
markers: [],
|
|
1906
|
+
erc_errors: []
|
|
1907
|
+
};
|
|
1851
1908
|
const connection_graph = await build_connection_graph(ctx);
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1909
|
+
for (const [port_id, count] of Object.entries(connection_graph.bundle_consume_status.bundle_consumed_port_count)) {
|
|
1910
|
+
const bundle_info = connection_graph.bundle_consume_status.bundles[port_id];
|
|
1911
|
+
const bundle = bundle_info.bundle;
|
|
1912
|
+
if (Array.isArray(bundle.labels_associated) && count > bundle.labels_associated.length) {
|
|
1913
|
+
erc_report.erc_errors.push(CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT(port_id));
|
|
1914
|
+
} else {
|
|
1915
|
+
console.warn(`Illegal bundle: ${port_id} , no associated labels`);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
const tester = new ERC_TESTER(
|
|
1919
|
+
{
|
|
1920
|
+
...ctx,
|
|
1921
|
+
connection_graph: connection_graph.connection_graph
|
|
1922
|
+
},
|
|
1923
|
+
erc_report
|
|
1924
|
+
);
|
|
1925
|
+
return { ...tester.run_test(), ...connection_graph, erc_report };
|
|
1857
1926
|
}
|
|
1858
1927
|
export {
|
|
1928
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT,
|
|
1859
1929
|
ConnectionGraphsBuilder,
|
|
1860
1930
|
DEFAULT_ERC_SETTING,
|
|
1861
1931
|
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.4",
|
|
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": {
|