@modular-circuit/perc 0.0.61 → 0.1.1
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 +476 -0
- package/dist/index.d.ts +476 -0
- package/dist/index.js +1881 -0
- package/dist/index.mjs +1845 -0
- package/package.json +14 -11
- package/build/erc/connect_graph_visitor/index.d.ts +0 -2
- package/build/erc/connect_graph_visitor/index.d.ts.map +0 -1
- package/build/erc/connect_graph_visitor/index.js +0 -1
- package/build/erc/connect_graph_visitor/visitor.d.ts +0 -5
- package/build/erc/connect_graph_visitor/visitor.d.ts.map +0 -1
- package/build/erc/connect_graph_visitor/visitor.js +0 -0
- package/build/erc/context/connection_graph_builder_ctx.d.ts +0 -7
- package/build/erc/context/connection_graph_builder_ctx.d.ts.map +0 -1
- package/build/erc/context/connection_graph_builder_ctx.js +0 -0
- package/build/erc/context/error_severity.d.ts +0 -11
- package/build/erc/context/error_severity.d.ts.map +0 -1
- package/build/erc/context/error_severity.js +0 -13
- package/build/erc/context/graph.d.ts +0 -3
- package/build/erc/context/graph.d.ts.map +0 -1
- package/build/erc/context/graph.js +0 -0
- package/build/erc/context/graph_converter.d.ts +0 -8
- package/build/erc/context/graph_converter.d.ts.map +0 -1
- package/build/erc/context/graph_converter.js +0 -0
- package/build/erc/context/index.d.ts +0 -6
- package/build/erc/context/index.d.ts.map +0 -1
- package/build/erc/context/index.js +0 -5
- package/build/erc/context/pin_to_pin_test_ctx.d.ts +0 -7
- package/build/erc/context/pin_to_pin_test_ctx.d.ts.map +0 -1
- package/build/erc/context/pin_to_pin_test_ctx.js +0 -0
- package/build/erc/index.d.ts +0 -5
- package/build/erc/index.d.ts.map +0 -1
- package/build/erc/index.js +0 -4
- package/build/erc/netlist/constraints.d.ts +0 -5
- package/build/erc/netlist/constraints.d.ts.map +0 -1
- package/build/erc/netlist/constraints.js +0 -30
- package/build/erc/netlist/index.d.ts +0 -3
- package/build/erc/netlist/index.d.ts.map +0 -1
- package/build/erc/netlist/index.js +0 -2
- package/build/erc/netlist/tester.d.ts +0 -10
- package/build/erc/netlist/tester.d.ts.map +0 -1
- package/build/erc/netlist/tester.js +0 -67
- package/build/erc/parameter_propagation/error_code.d.ts +0 -41
- package/build/erc/parameter_propagation/error_code.d.ts.map +0 -1
- package/build/erc/parameter_propagation/error_code.js +0 -74
- package/build/erc/parameter_propagation/index.d.ts +0 -3
- package/build/erc/parameter_propagation/index.d.ts.map +0 -1
- package/build/erc/parameter_propagation/index.js +0 -2
- package/build/erc/parameter_propagation/link_testers/index.d.ts +0 -2
- package/build/erc/parameter_propagation/link_testers/index.d.ts.map +0 -1
- package/build/erc/parameter_propagation/link_testers/index.js +0 -1
- package/build/erc/parameter_propagation/link_testers/link_tester_base.d.ts +0 -23
- package/build/erc/parameter_propagation/link_testers/link_tester_base.d.ts.map +0 -1
- package/build/erc/parameter_propagation/link_testers/link_tester_base.js +0 -112
- package/build/erc/parameter_propagation/link_testers/tester_impl.d.ts +0 -247
- package/build/erc/parameter_propagation/link_testers/tester_impl.d.ts.map +0 -1
- package/build/erc/parameter_propagation/link_testers/tester_impl.js +0 -1456
- package/build/erc/parameter_propagation/tester.d.ts +0 -16
- package/build/erc/parameter_propagation/tester.d.ts.map +0 -1
- package/build/erc/parameter_propagation/tester.js +0 -215
- package/build/erc/pin_compatibility_matrix/erc_setting.d.ts +0 -29
- package/build/erc/pin_compatibility_matrix/erc_setting.d.ts.map +0 -1
- package/build/erc/pin_compatibility_matrix/erc_setting.js +0 -110
- package/build/erc/pin_compatibility_matrix/error_code.d.ts +0 -55
- package/build/erc/pin_compatibility_matrix/error_code.d.ts.map +0 -1
- package/build/erc/pin_compatibility_matrix/error_code.js +0 -56
- package/build/erc/pin_compatibility_matrix/index.d.ts +0 -5
- package/build/erc/pin_compatibility_matrix/index.d.ts.map +0 -1
- package/build/erc/pin_compatibility_matrix/index.js +0 -4
- package/build/erc/pin_compatibility_matrix/pin_error.d.ts +0 -7
- package/build/erc/pin_compatibility_matrix/pin_error.d.ts.map +0 -1
- package/build/erc/pin_compatibility_matrix/pin_error.js +0 -7
- package/build/erc/pin_compatibility_matrix/tester.d.ts +0 -9
- package/build/erc/pin_compatibility_matrix/tester.d.ts.map +0 -1
- package/build/erc/pin_compatibility_matrix/tester.js +0 -23
- package/build/graphics/index.d.ts +0 -3
- package/build/graphics/index.d.ts.map +0 -1
- package/build/graphics/index.js +0 -2
- package/build/graphics/maker/index.d.ts +0 -4
- package/build/graphics/maker/index.d.ts.map +0 -1
- package/build/graphics/maker/index.js +0 -3
- package/build/graphics/maker/maker_base.d.ts +0 -35
- package/build/graphics/maker/maker_base.d.ts.map +0 -1
- package/build/graphics/maker/maker_base.js +0 -0
- package/build/graphics/maker/maker_type.d.ts +0 -10
- package/build/graphics/maker/maker_type.d.ts.map +0 -1
- package/build/graphics/maker/maker_type.js +0 -10
- package/build/graphics/maker/sch_maker.d.ts +0 -5
- package/build/graphics/maker/sch_maker.d.ts.map +0 -1
- package/build/graphics/maker/sch_maker.js +0 -0
- package/build/graphics/sch_erc_item.d.ts +0 -28
- package/build/graphics/sch_erc_item.d.ts.map +0 -1
- package/build/graphics/sch_erc_item.js +0 -0
- package/build/index.d.ts +0 -6
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -5
- package/build/report/erc_report.d.ts +0 -16
- package/build/report/erc_report.d.ts.map +0 -1
- package/build/report/erc_report.js +0 -16
- package/build/report/erc_reporter.d.ts +0 -88
- package/build/report/erc_reporter.d.ts.map +0 -1
- package/build/report/erc_reporter.js +0 -87
- package/build/report/index.d.ts +0 -3
- package/build/report/index.d.ts.map +0 -1
- package/build/report/index.js +0 -2
- package/build/rule_check_item/erc_item.d.ts +0 -4
- package/build/rule_check_item/erc_item.d.ts.map +0 -1
- package/build/rule_check_item/erc_item.js +0 -0
- package/build/rule_check_item/index.d.ts +0 -3
- package/build/rule_check_item/index.d.ts.map +0 -1
- package/build/rule_check_item/index.js +0 -2
- package/build/rule_check_item/rc_item.d.ts +0 -33
- package/build/rule_check_item/rc_item.d.ts.map +0 -1
- package/build/rule_check_item/rc_item.js +0 -0
- package/build/tester/erc_tester.d.ts +0 -18
- package/build/tester/erc_tester.d.ts.map +0 -1
- package/build/tester/erc_tester.js +0 -66
- package/build/tester/graph/connection_graphs_builder.d.ts +0 -22
- package/build/tester/graph/connection_graphs_builder.d.ts.map +0 -1
- package/build/tester/graph/connection_graphs_builder.js +0 -187
- package/build/tester/graph/graph_erc.d.ts +0 -16
- package/build/tester/graph/graph_erc.d.ts.map +0 -1
- package/build/tester/graph/graph_erc.js +0 -63
- package/build/tester/graph/index.d.ts +0 -4
- package/build/tester/graph/index.d.ts.map +0 -1
- package/build/tester/graph/index.js +0 -3
- package/build/tester/graph/ir_graph_converter.d.ts +0 -30
- package/build/tester/graph/ir_graph_converter.d.ts.map +0 -1
- package/build/tester/graph/ir_graph_converter.js +0 -279
- package/build/tester/index.d.ts +0 -3
- package/build/tester/index.d.ts.map +0 -1
- package/build/tester/index.js +0 -2
- package/build/tsconfig.build.tsbuildinfo +0 -1
- package/build/utils/get_dependent_modules_definition.d.ts +0 -4
- package/build/utils/get_dependent_modules_definition.d.ts.map +0 -1
- package/build/utils/get_dependent_modules_definition.js +0 -145
- package/build/utils/index.d.ts +0 -2
- package/build/utils/index.d.ts.map +0 -1
- package/build/utils/index.js +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,1881 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ConnectionGraphsBuilder: () => ConnectionGraphsBuilder,
|
|
24
|
+
DEFAULT_ERC_SETTING: () => DEFAULT_ERC_SETTING,
|
|
25
|
+
DEFAULT_PIN_MAP: () => DEFAULT_PIN_MAP,
|
|
26
|
+
DEFAULT_PP_ERROR_SEVERITY: () => DEFAULT_PP_ERROR_SEVERITY,
|
|
27
|
+
DEFAULT_SEVERITY: () => DEFAULT_SEVERITY,
|
|
28
|
+
DrivenPinTypes: () => DrivenPinTypes,
|
|
29
|
+
DrivingPinTypes: () => DrivingPinTypes,
|
|
30
|
+
ERCE_DRIVER_CONFLICT: () => ERCE_DRIVER_CONFLICT,
|
|
31
|
+
ERCE_PIN_NOT_CONNECTED: () => ERCE_PIN_NOT_CONNECTED,
|
|
32
|
+
ERCE_PIN_TO_PIN_ERROR: () => ERCE_PIN_TO_PIN_ERROR,
|
|
33
|
+
ERCE_T: () => ERCE_T,
|
|
34
|
+
ERCE_UNANNOTATED: () => ERCE_UNANNOTATED,
|
|
35
|
+
ERC_SETTING: () => ERC_SETTING,
|
|
36
|
+
ERC_TESTER: () => ERC_TESTER,
|
|
37
|
+
IR_GRAPH_CONVERTER: () => IR_GRAPH_CONVERTER,
|
|
38
|
+
MakerType: () => MakerType,
|
|
39
|
+
NetlistTester: () => NetlistTester,
|
|
40
|
+
PIN_COMPATIBILITY_MATRIX_TESTER: () => PIN_COMPATIBILITY_MATRIX_TESTER,
|
|
41
|
+
PIN_ERROR: () => PIN_ERROR,
|
|
42
|
+
PP_DUPLICATED_SOURCES: () => PP_DUPLICATED_SOURCES,
|
|
43
|
+
PP_ERROR: () => PP_ERROR,
|
|
44
|
+
PP_ILLEGAL_CONNECTION: () => PP_ILLEGAL_CONNECTION,
|
|
45
|
+
PP_IMPEDANCE_SIGNAL_INTEGRITY: () => PP_IMPEDANCE_SIGNAL_INTEGRITY,
|
|
46
|
+
PP_INAPPROPRIATE_FUNC: () => PP_INAPPROPRIATE_FUNC,
|
|
47
|
+
PP_INCOMPATIBLE_DIGITAL_THRESHOLDS: () => PP_INCOMPATIBLE_DIGITAL_THRESHOLDS,
|
|
48
|
+
PP_INCOMPATIBLE_SIGNAL_LEVELS: () => PP_INCOMPATIBLE_SIGNAL_LEVELS,
|
|
49
|
+
PP_INCOMPATIBLE_VOLTAGE_LEVELS: () => PP_INCOMPATIBLE_VOLTAGE_LEVELS,
|
|
50
|
+
PP_INSUFFICIENT_DRIVER: () => PP_INSUFFICIENT_DRIVER,
|
|
51
|
+
PP_NOT_DRIVEN: () => PP_NOT_DRIVEN,
|
|
52
|
+
PP_OVERCURRENT: () => PP_OVERCURRENT,
|
|
53
|
+
PP_OVER_DRIVEN: () => PP_OVER_DRIVEN,
|
|
54
|
+
PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR: () => PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR,
|
|
55
|
+
PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE: () => PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE,
|
|
56
|
+
ParameterPropagationTester: () => ParameterPropagationTester,
|
|
57
|
+
PowerDrivingPinTypes: () => PowerDrivingPinTypes,
|
|
58
|
+
SEVERITY: () => SEVERITY,
|
|
59
|
+
build_connection_graph: () => build_connection_graph,
|
|
60
|
+
fmt_erc_item_description: () => fmt_erc_item_description,
|
|
61
|
+
get_erc_severity: () => get_erc_severity,
|
|
62
|
+
graph_ecr: () => graph_ecr
|
|
63
|
+
});
|
|
64
|
+
module.exports = __toCommonJS(index_exports);
|
|
65
|
+
|
|
66
|
+
// src/graphics/maker/maker_type.ts
|
|
67
|
+
var MakerType = /* @__PURE__ */ ((MakerType2) => {
|
|
68
|
+
MakerType2[MakerType2["MARKER_UNSPEC"] = 0] = "MARKER_UNSPEC";
|
|
69
|
+
MakerType2[MakerType2["MARKER_ERC"] = 1] = "MARKER_ERC";
|
|
70
|
+
MakerType2[MakerType2["MARKER_DRC"] = 2] = "MARKER_DRC";
|
|
71
|
+
MakerType2[MakerType2["MARKER_DRAWING_SHEET"] = 3] = "MARKER_DRAWING_SHEET";
|
|
72
|
+
MakerType2[MakerType2["MARKER_RATSNEST"] = 4] = "MARKER_RATSNEST";
|
|
73
|
+
MakerType2[MakerType2["MARKER_PARITY"] = 5] = "MARKER_PARITY";
|
|
74
|
+
MakerType2[MakerType2["MARKER_SIMUL"] = 6] = "MARKER_SIMUL";
|
|
75
|
+
return MakerType2;
|
|
76
|
+
})(MakerType || {});
|
|
77
|
+
|
|
78
|
+
// src/erc/context/error_severity.ts
|
|
79
|
+
var SEVERITY = /* @__PURE__ */ ((SEVERITY2) => {
|
|
80
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_UNDEFINED"] = 1] = "RPT_SEVERITY_UNDEFINED";
|
|
81
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_INFO"] = 2] = "RPT_SEVERITY_INFO";
|
|
82
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_EXCLUSION"] = 4] = "RPT_SEVERITY_EXCLUSION";
|
|
83
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_ACTION"] = 8] = "RPT_SEVERITY_ACTION";
|
|
84
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_WARNING"] = 16] = "RPT_SEVERITY_WARNING";
|
|
85
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_ERROR"] = 32] = "RPT_SEVERITY_ERROR";
|
|
86
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_IGNORE"] = 64] = "RPT_SEVERITY_IGNORE";
|
|
87
|
+
SEVERITY2[SEVERITY2["RPT_SEVERITY_DEBUG"] = 128] = "RPT_SEVERITY_DEBUG";
|
|
88
|
+
return SEVERITY2;
|
|
89
|
+
})(SEVERITY || {});
|
|
90
|
+
|
|
91
|
+
// src/erc/parameter_propagation/error_code.ts
|
|
92
|
+
var PP_ERROR = /* @__PURE__ */ ((PP_ERROR2) => {
|
|
93
|
+
PP_ERROR2["UN_COMPILED_BLOCK"] = "un_compiled_block";
|
|
94
|
+
PP_ERROR2["UN_COMPILED_LINK"] = "un_compiled_link";
|
|
95
|
+
PP_ERROR2["UN_COMPILED_LINK_ARRAY"] = "un_compiled_link_array";
|
|
96
|
+
PP_ERROR2["UN_COMPILED_PARAMETER"] = "un_compiled_parameter";
|
|
97
|
+
PP_ERROR2["UN_COMPILED_INTERNAL_ELEMENT"] = "un_compiled_internal_element";
|
|
98
|
+
PP_ERROR2["UN_COMPILED_LIBRARY_ELEMENT"] = "un_compiled_library_element";
|
|
99
|
+
PP_ERROR2["UNDEFINED_PORT_ARRAY"] = "undefined_port_array";
|
|
100
|
+
PP_ERROR2["LIBRARY_ERROR"] = "library_error";
|
|
101
|
+
PP_ERROR2["GENERATOR_ERROR"] = "generator_error";
|
|
102
|
+
PP_ERROR2["REFINEMENT_SUBCLASS_ERROR"] = "refinement_subclass_error";
|
|
103
|
+
PP_ERROR2["OVER_ASSIGN"] = "over_assign";
|
|
104
|
+
PP_ERROR2["BAD_REFERENCE"] = "bad_reference";
|
|
105
|
+
PP_ERROR2["ABSTRACT_BLOCK"] = "abstract_block";
|
|
106
|
+
PP_ERROR2["FAILED_ASSERTION"] = "failed_assertion";
|
|
107
|
+
PP_ERROR2["UN_EVALUATED_ASSERTION"] = "un_evaluated_assertion";
|
|
108
|
+
PP_ERROR2["INCONSISTENT_LINK_ARRAY_ELEMENTS"] = "inconsistent_link_array_elements";
|
|
109
|
+
PP_ERROR2["PP_UNANNOTATED"] = "pp_unannotated";
|
|
110
|
+
PP_ERROR2["PP_UNKNOWN_PORT_TYPE"] = "pp_unknown_port_type";
|
|
111
|
+
PP_ERROR2["INAPPROPRIATE_FUNC"] = "Functionally inappropriate link";
|
|
112
|
+
PP_ERROR2["NOT_DRIVEN"] = "pp_not_driven";
|
|
113
|
+
PP_ERROR2["DUPLICATED_PWR_SOURCES"] = "duplicated_pwr_sources";
|
|
114
|
+
PP_ERROR2["INSUFFICIENT_DRIVER"] = "Insufficient_driver";
|
|
115
|
+
PP_ERROR2["OVER_DRIVEN"] = "over_driven";
|
|
116
|
+
PP_ERROR2["IMPEDANCE_SIGNAL_INTEGRITY"] = "impedance_signal_integrity";
|
|
117
|
+
PP_ERROR2["INCOMPATIBLE_VOLTAGE_LEVELS"] = "incompatible_voltage_levels";
|
|
118
|
+
PP_ERROR2["SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE"] = "signal_levels_not_contained_within_voltage";
|
|
119
|
+
PP_ERROR2["INCOMPATIBLE_SIGNAL_LEVELS"] = "incompatible_signal_levels";
|
|
120
|
+
PP_ERROR2["OVERCURRENT"] = "overcurrent";
|
|
121
|
+
PP_ERROR2["INCOMPATIBLE_DIGITAL_THRESHOLDS"] = "incompatible_digital_thresholds";
|
|
122
|
+
PP_ERROR2["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
|
|
123
|
+
PP_ERROR2["ILLEGAL_CONNECTION"] = "Illegal_connection";
|
|
124
|
+
return PP_ERROR2;
|
|
125
|
+
})(PP_ERROR || {});
|
|
126
|
+
var DEFAULT_PP_ERROR_SEVERITY = {
|
|
127
|
+
["un_compiled_block" /* UN_COMPILED_BLOCK */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
128
|
+
["un_compiled_link" /* UN_COMPILED_LINK */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
129
|
+
["un_compiled_link_array" /* UN_COMPILED_LINK_ARRAY */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
130
|
+
["un_compiled_parameter" /* UN_COMPILED_PARAMETER */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
131
|
+
["un_compiled_internal_element" /* UN_COMPILED_INTERNAL_ELEMENT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
132
|
+
["un_compiled_library_element" /* UN_COMPILED_LIBRARY_ELEMENT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
133
|
+
["undefined_port_array" /* UNDEFINED_PORT_ARRAY */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
134
|
+
["library_error" /* LIBRARY_ERROR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
135
|
+
["generator_error" /* GENERATOR_ERROR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
136
|
+
["refinement_subclass_error" /* REFINEMENT_SUBCLASS_ERROR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
137
|
+
["over_assign" /* OVER_ASSIGN */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
138
|
+
["bad_reference" /* BAD_REFERENCE */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
139
|
+
["abstract_block" /* ABSTRACT_BLOCK */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
140
|
+
["failed_assertion" /* FAILED_ASSERTION */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
141
|
+
["un_evaluated_assertion" /* UN_EVALUATED_ASSERTION */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
142
|
+
["inconsistent_link_array_elements" /* INCONSISTENT_LINK_ARRAY_ELEMENTS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
143
|
+
["pp_unannotated" /* PP_UNANNOTATED */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
144
|
+
["pp_unknown_port_type" /* PP_UNKNOWN_PORT_TYPE */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
145
|
+
["Functionally inappropriate link" /* INAPPROPRIATE_FUNC */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
146
|
+
["pp_not_driven" /* NOT_DRIVEN */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
147
|
+
["duplicated_pwr_sources" /* DUPLICATED_PWR_SOURCES */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
148
|
+
["Insufficient_driver" /* INSUFFICIENT_DRIVER */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
149
|
+
["over_driven" /* OVER_DRIVEN */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
150
|
+
["impedance_signal_integrity" /* IMPEDANCE_SIGNAL_INTEGRITY */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
151
|
+
["incompatible_voltage_levels" /* INCOMPATIBLE_VOLTAGE_LEVELS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
152
|
+
["signal_levels_not_contained_within_voltage" /* SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
153
|
+
["incompatible_signal_levels" /* INCOMPATIBLE_SIGNAL_LEVELS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
154
|
+
["overcurrent" /* OVERCURRENT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
155
|
+
["incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
156
|
+
["requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
157
|
+
["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/erc/parameter_propagation/tester.ts
|
|
161
|
+
var import_electronics_model4 = require("@modular-circuit/electronics-model");
|
|
162
|
+
|
|
163
|
+
// src/report/erc_report.ts
|
|
164
|
+
function fmt_erc_item_description(id, ctx) {
|
|
165
|
+
if (id in ctx.pin_module_name_table) return `Module ${ctx.pin_module_name_table[id]} port ${ctx.pin_name_table[id]}`;
|
|
166
|
+
return ctx.pin_name_table[id];
|
|
167
|
+
}
|
|
168
|
+
function get_erc_severity(code, settings) {
|
|
169
|
+
const erc_setting = settings?.erc_setting || DEFAULT_SEVERITY;
|
|
170
|
+
const pp_erc_setting = settings?.pp_erc_setting || DEFAULT_PP_ERROR_SEVERITY;
|
|
171
|
+
const severity = erc_setting[code] ?? pp_erc_setting[code];
|
|
172
|
+
if (severity === void 0) throw new Error(`Unknown ERC code: ${code}`);
|
|
173
|
+
return severity;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/report/erc_reporter.ts
|
|
177
|
+
var import_electronics_model = require("@modular-circuit/electronics-model");
|
|
178
|
+
var ERCE_UNANNOTATED = (id) => ({
|
|
179
|
+
error_code: "unannotated" /* ERCE_UNANNOTATED */,
|
|
180
|
+
error_message: "Port has no electrical type specified.",
|
|
181
|
+
eda_item_ids: [id]
|
|
182
|
+
});
|
|
183
|
+
var ERCE_PIN_TO_PIN_ERROR = (a, b) => ({
|
|
184
|
+
error_code: "ERCE_PIN_TO_PIN_ERROR" /* ERCE_PIN_TO_PIN_ERROR */,
|
|
185
|
+
error_message: `Port ${(0, import_electronics_model.get_electrical_pin_type)(a)} and port ${(0, import_electronics_model.get_electrical_pin_type)(b)} are not compatible.`,
|
|
186
|
+
eda_item_ids: [a.uuid, b.uuid]
|
|
187
|
+
});
|
|
188
|
+
var ERCE_PIN_NOT_CONNECTED = (id) => ({
|
|
189
|
+
error_code: "pin_not_connected" /* ERCE_PIN_NOT_CONNECTED */,
|
|
190
|
+
error_message: "Port not connected.",
|
|
191
|
+
eda_item_ids: [id]
|
|
192
|
+
});
|
|
193
|
+
var ERCE_DRIVER_CONFLICT = (eda_item_ids, primaryName, secondaryName) => ({
|
|
194
|
+
error_code: "Functionally inappropriate link" /* INAPPROPRIATE_FUNC */,
|
|
195
|
+
error_message: `Both ${primaryName} and ${secondaryName} are attached to the same net. `,
|
|
196
|
+
eda_item_ids
|
|
197
|
+
});
|
|
198
|
+
var PP_INAPPROPRIATE_FUNC = (eda_item_ids) => ({
|
|
199
|
+
error_code: "Functionally inappropriate link" /* INAPPROPRIATE_FUNC */,
|
|
200
|
+
error_message: "Inappropriate ports functions.",
|
|
201
|
+
eda_item_ids
|
|
202
|
+
});
|
|
203
|
+
var PP_NOT_DRIVEN = (eda_item_ids) => ({
|
|
204
|
+
error_code: "pp_not_driven" /* NOT_DRIVEN */,
|
|
205
|
+
error_message: "Net not driven.",
|
|
206
|
+
eda_item_ids
|
|
207
|
+
});
|
|
208
|
+
var PP_DUPLICATED_SOURCES = (eda_item_ids) => ({
|
|
209
|
+
error_code: "duplicated_pwr_sources" /* DUPLICATED_PWR_SOURCES */,
|
|
210
|
+
error_message: "Net connected to multiple power sources.",
|
|
211
|
+
eda_item_ids
|
|
212
|
+
});
|
|
213
|
+
var PP_INSUFFICIENT_DRIVER = (eda_item_ids, desc) => ({
|
|
214
|
+
error_code: "Insufficient_driver" /* INSUFFICIENT_DRIVER */,
|
|
215
|
+
error_message: `Insufficient ${desc} driver.`,
|
|
216
|
+
eda_item_ids
|
|
217
|
+
});
|
|
218
|
+
var PP_OVER_DRIVEN = (eda_item_ids, desc) => ({
|
|
219
|
+
error_code: "over_driven" /* OVER_DRIVEN */,
|
|
220
|
+
error_message: `${desc} over driven.`,
|
|
221
|
+
eda_item_ids
|
|
222
|
+
});
|
|
223
|
+
var PP_IMPEDANCE_SIGNAL_INTEGRITY = (eda_item_ids) => ({
|
|
224
|
+
error_code: "impedance_signal_integrity" /* IMPEDANCE_SIGNAL_INTEGRITY */,
|
|
225
|
+
error_message: "Source impedance shall be 10x lower than sink impedance for signal integrity.",
|
|
226
|
+
eda_item_ids
|
|
227
|
+
});
|
|
228
|
+
var PP_INCOMPATIBLE_VOLTAGE_LEVELS = (source) => ({
|
|
229
|
+
error_code: "impedance_signal_integrity" /* IMPEDANCE_SIGNAL_INTEGRITY */,
|
|
230
|
+
error_message: "Incompatible voltage levels.",
|
|
231
|
+
eda_item_ids: [source]
|
|
232
|
+
});
|
|
233
|
+
var PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE = (source) => ({
|
|
234
|
+
error_code: "signal_levels_not_contained_within_voltage" /* SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE */,
|
|
235
|
+
error_message: "Signal levels not contained within voltage.",
|
|
236
|
+
eda_item_ids: [source]
|
|
237
|
+
});
|
|
238
|
+
var PP_INCOMPATIBLE_SIGNAL_LEVELS = (source) => ({
|
|
239
|
+
error_code: "incompatible_signal_levels" /* INCOMPATIBLE_SIGNAL_LEVELS */,
|
|
240
|
+
error_message: "Incompatible signal levels.",
|
|
241
|
+
eda_item_ids: [source]
|
|
242
|
+
});
|
|
243
|
+
var PP_OVERCURRENT = (source) => ({
|
|
244
|
+
error_code: "overcurrent" /* OVERCURRENT */,
|
|
245
|
+
error_message: "overcurrent.",
|
|
246
|
+
eda_item_ids: [source]
|
|
247
|
+
});
|
|
248
|
+
var PP_INCOMPATIBLE_DIGITAL_THRESHOLDS = (eda_item_ids) => ({
|
|
249
|
+
error_code: "incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */,
|
|
250
|
+
error_message: "Incompatible digital thresholds.",
|
|
251
|
+
eda_item_ids
|
|
252
|
+
});
|
|
253
|
+
var PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR = (eda_item_ids) => ({
|
|
254
|
+
error_code: "requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */,
|
|
255
|
+
error_message: "Requires connected source or bidir.",
|
|
256
|
+
eda_item_ids
|
|
257
|
+
});
|
|
258
|
+
var PP_ILLEGAL_CONNECTION = (eda_item_ids, detail) => ({
|
|
259
|
+
error_code: "Illegal_connection" /* ILLEGAL_CONNECTION */,
|
|
260
|
+
error_message: `Illegal connection: ${detail}`,
|
|
261
|
+
eda_item_ids
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// src/erc/parameter_propagation/link_testers/tester_impl.ts
|
|
265
|
+
var import_electronics_model3 = require("@modular-circuit/electronics-model");
|
|
266
|
+
|
|
267
|
+
// src/erc/parameter_propagation/link_testers/link_tester_base.ts
|
|
268
|
+
var import_electronics_model2 = require("@modular-circuit/electronics-model");
|
|
269
|
+
var LinkTesterBase = class {
|
|
270
|
+
constructor(ctx, ports) {
|
|
271
|
+
this.ctx = ctx;
|
|
272
|
+
this.ports = ports;
|
|
273
|
+
}
|
|
274
|
+
test() {
|
|
275
|
+
if (!this.init_link()) return;
|
|
276
|
+
this.check_parameter_propagation();
|
|
277
|
+
}
|
|
278
|
+
get all_port_ids() {
|
|
279
|
+
if (!this._all_port_ids) this._all_port_ids = this.ports.map((v) => this.ctx.port_id.get(v));
|
|
280
|
+
return this._all_port_ids;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
var CompositePortLinkTesterBase = class extends LinkTesterBase {
|
|
284
|
+
test() {
|
|
285
|
+
for (const port of this.ports) {
|
|
286
|
+
this.annot_composite_port(port, this.ctx.port_id.get(port));
|
|
287
|
+
}
|
|
288
|
+
super.test();
|
|
289
|
+
}
|
|
290
|
+
annot_composite_port(port, uuid) {
|
|
291
|
+
for (const [k, v] of Object.entries(port)) {
|
|
292
|
+
if (k === import_electronics_model2.LABEL_ASSOCIATED && typeof v === "string") {
|
|
293
|
+
this.ctx.port_id.set(port, v);
|
|
294
|
+
} else if (typeof v === "object" && !Array.isArray(v) && v !== null) {
|
|
295
|
+
this.annot_composite_port(v, uuid);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// src/erc/parameter_propagation/link_testers/tester_impl.ts
|
|
302
|
+
var AnalogLinkTester = class extends LinkTesterBase {
|
|
303
|
+
init_link() {
|
|
304
|
+
const sources = [];
|
|
305
|
+
const sinks = [];
|
|
306
|
+
for (const v of this.ports) {
|
|
307
|
+
switch (v.type) {
|
|
308
|
+
case import_electronics_model3.PortType.AnalogSource: {
|
|
309
|
+
sources.push(v);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case import_electronics_model3.PortType.AnalogSink: {
|
|
313
|
+
sinks.push(v);
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (sources.length === 0) {
|
|
319
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Requires a connected analog source"));
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
if (sources.length > 1) {
|
|
323
|
+
this.ctx.report.erc_errors.push(
|
|
324
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "Multiple analog sources are not allowed")
|
|
325
|
+
);
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
this.link = {
|
|
329
|
+
source: sources[0],
|
|
330
|
+
sinks
|
|
331
|
+
};
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
check_parameter_propagation() {
|
|
335
|
+
if (!this.link) return;
|
|
336
|
+
const source = this.link.source;
|
|
337
|
+
const sinks = this.link.sinks;
|
|
338
|
+
const source_id = this.ctx.port_id.get(source);
|
|
339
|
+
if ((0, import_electronics_model3.range_is_defined)(source.impedance)) {
|
|
340
|
+
const all_sinks_impedance = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.impedance));
|
|
341
|
+
if (all_sinks_impedance.length > 0) {
|
|
342
|
+
const sink_impedance = (0, import_electronics_model3.r_div)((0, import_electronics_model3.sum)(all_sinks_impedance.map((v) => (0, import_electronics_model3.r_div)(v, 1))), 1);
|
|
343
|
+
if (source.impedance.upper > sink_impedance.lower * 0.1) {
|
|
344
|
+
this.ctx.report.erc_errors.push(PP_IMPEDANCE_SIGNAL_INTEGRITY(this.all_port_ids));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if ((0, import_electronics_model3.range_is_defined)(source.voltage_out)) {
|
|
349
|
+
const all_voltage_limits = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.voltage_limits));
|
|
350
|
+
if (all_voltage_limits.length > 0) {
|
|
351
|
+
const voltage_limits = (0, import_electronics_model3.intersection)(all_voltage_limits);
|
|
352
|
+
if (!(0, import_electronics_model3.interests)(voltage_limits, source.voltage_out)) {
|
|
353
|
+
this.ctx.report.erc_errors.push(PP_INCOMPATIBLE_VOLTAGE_LEVELS(source_id));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if ((0, import_electronics_model3.all_range_are_defined)(source.signal_out, source.voltage_out)) {
|
|
358
|
+
if (!(0, import_electronics_model3.interests)(source.voltage_out, source.signal_out)) {
|
|
359
|
+
this.ctx.report.erc_errors.push(PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE(source_id));
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
if ((0, import_electronics_model3.range_is_defined)(source.signal_out)) {
|
|
363
|
+
const all_sinks_signal_limits = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.signal_limits));
|
|
364
|
+
if (all_sinks_signal_limits.length > 0) {
|
|
365
|
+
const signal_limits = (0, import_electronics_model3.intersection)(all_sinks_signal_limits);
|
|
366
|
+
if (!(0, import_electronics_model3.interests)(signal_limits, source.signal_out)) {
|
|
367
|
+
this.ctx.report.erc_errors.push(PP_INCOMPATIBLE_SIGNAL_LEVELS(source_id));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if ((0, import_electronics_model3.range_is_defined)(source.current_limits)) {
|
|
372
|
+
const all_sinks_current_drawn = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.current_drawn));
|
|
373
|
+
if (all_sinks_current_drawn.length > 0) {
|
|
374
|
+
const current_drawn = (0, import_electronics_model3.sum)(all_sinks_current_drawn);
|
|
375
|
+
if ((0, import_electronics_model3.interests)(current_drawn, source.current_limits)) {
|
|
376
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN([source_id], "current"));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
var DigitalLinkTester = class extends LinkTesterBase {
|
|
383
|
+
init_link() {
|
|
384
|
+
const sinks = [];
|
|
385
|
+
const sources = [];
|
|
386
|
+
const bidirs = [];
|
|
387
|
+
for (const v of this.ports) {
|
|
388
|
+
switch (v.type) {
|
|
389
|
+
case import_electronics_model3.PortType.DigitalSource: {
|
|
390
|
+
sources.push(v);
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
case import_electronics_model3.PortType.DigitalSink: {
|
|
394
|
+
sinks.push(v);
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
case import_electronics_model3.PortType.DigitalBidir: {
|
|
398
|
+
bidirs.push(v);
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
this.link = {
|
|
404
|
+
sources,
|
|
405
|
+
sinks,
|
|
406
|
+
bidirs
|
|
407
|
+
};
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
check_parameter_propagation() {
|
|
411
|
+
if (!this.link) return;
|
|
412
|
+
const sources = this.link.sources ?? [];
|
|
413
|
+
const sinks = this.link.sinks ?? [];
|
|
414
|
+
const bidirs = this.link.bidirs ?? [];
|
|
415
|
+
const all_defined_voltage = (0, import_electronics_model3.filter_defined_range)(
|
|
416
|
+
...bidirs.map((v) => v.voltage_out),
|
|
417
|
+
...sources.map((v) => v.voltage_out)
|
|
418
|
+
);
|
|
419
|
+
if (all_defined_voltage.length > 0) {
|
|
420
|
+
const voltage = (0, import_electronics_model3.hull)(all_defined_voltage);
|
|
421
|
+
const all_defined_voltage_limits = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.voltage_limits));
|
|
422
|
+
if (all_defined_voltage_limits.length > 0) {
|
|
423
|
+
const voltage_limits = (0, import_electronics_model3.intersection)(all_defined_voltage_limits);
|
|
424
|
+
if (!(0, import_electronics_model3.contains)(voltage_limits, voltage)) {
|
|
425
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN(this.all_port_ids, "voltage"));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const all_defined_current_limits = (0, import_electronics_model3.filter_defined_range)(
|
|
430
|
+
...bidirs.map((v) => v.current_limits),
|
|
431
|
+
...sources.map((v) => v.current_limits)
|
|
432
|
+
);
|
|
433
|
+
if (all_defined_current_limits.length > 0) {
|
|
434
|
+
const current_limits = (0, import_electronics_model3.sum)(all_defined_current_limits);
|
|
435
|
+
const all_defined_current_drawn = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.current_drawn));
|
|
436
|
+
if (all_defined_current_drawn.length > 0) {
|
|
437
|
+
const current_drawn = (0, import_electronics_model3.sum)(all_defined_current_drawn);
|
|
438
|
+
if ((0, import_electronics_model3.interests)(current_drawn, current_limits)) {
|
|
439
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN(this.all_port_ids, "current"));
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const all_defined_output_thresholds = (0, import_electronics_model3.filter_defined_range)(
|
|
444
|
+
...bidirs.map((v) => v.output_thresholds),
|
|
445
|
+
...sources.map((v) => v.output_thresholds)
|
|
446
|
+
);
|
|
447
|
+
if (all_defined_output_thresholds.length > 0) {
|
|
448
|
+
const output_thresholds = (0, import_electronics_model3.intersection)(all_defined_output_thresholds);
|
|
449
|
+
const all_defined_input_thresholds = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.input_thresholds));
|
|
450
|
+
if (all_defined_input_thresholds.length > 0) {
|
|
451
|
+
const input_thresholds = (0, import_electronics_model3.hull)(all_defined_input_thresholds);
|
|
452
|
+
if (!(0, import_electronics_model3.contains)(output_thresholds, input_thresholds)) {
|
|
453
|
+
this.ctx.report.erc_errors.push(PP_INCOMPATIBLE_DIGITAL_THRESHOLDS(this.all_port_ids));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (!sources.length && !bidirs.length) {
|
|
458
|
+
this.ctx.report.erc_errors.push(PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR(this.all_port_ids));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
var VoltageLinkTester = class extends LinkTesterBase {
|
|
463
|
+
check_parameter_propagation() {
|
|
464
|
+
const source = this.link.source;
|
|
465
|
+
const sinks = this.link.sinks;
|
|
466
|
+
if ((0, import_electronics_model3.range_is_defined)(source.voltage_out)) {
|
|
467
|
+
const all_voltage_limits = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.voltage_limits));
|
|
468
|
+
if (all_voltage_limits.length > 0) {
|
|
469
|
+
const voltage_limits = (0, import_electronics_model3.intersection)(all_voltage_limits);
|
|
470
|
+
if (!(0, import_electronics_model3.interests)(voltage_limits, source.voltage_out)) {
|
|
471
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN(this.all_port_ids, "voltage"));
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if ((0, import_electronics_model3.range_is_defined)(source.current_limits)) {
|
|
476
|
+
const all_sinks_current_drawn = (0, import_electronics_model3.filter_defined_range)(sinks.map((v) => v.current_drawn));
|
|
477
|
+
if (all_sinks_current_drawn.length > 0) {
|
|
478
|
+
const current_drawn = (0, import_electronics_model3.sum)(all_sinks_current_drawn);
|
|
479
|
+
if ((0, import_electronics_model3.interests)(current_drawn, source.current_limits)) {
|
|
480
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN(this.all_port_ids, "current"));
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
init_link() {
|
|
486
|
+
const sources = [];
|
|
487
|
+
const sinks = [];
|
|
488
|
+
for (const v of this.ports) {
|
|
489
|
+
switch (v.type) {
|
|
490
|
+
case import_electronics_model3.PortType.VoltageSource: {
|
|
491
|
+
sources.push(v);
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
case import_electronics_model3.PortType.VoltageSink: {
|
|
495
|
+
sinks.push(v);
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (sources.length === 0) {
|
|
501
|
+
this.ctx.report.erc_errors.push(PP_NOT_DRIVEN(this.all_port_ids));
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
if (sources.length > 1) {
|
|
505
|
+
this.ctx.report.erc_errors.push(PP_DUPLICATED_SOURCES(this.all_port_ids));
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
this.link = {
|
|
509
|
+
source: sources[0],
|
|
510
|
+
sinks
|
|
511
|
+
};
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
var GroundLinkTester = class extends LinkTesterBase {
|
|
516
|
+
check_parameter_propagation() {
|
|
517
|
+
if (!this.link) return;
|
|
518
|
+
const ref = this.link.ref;
|
|
519
|
+
const gnds = this.link.gnds;
|
|
520
|
+
let voltage = ref?.voltage_out;
|
|
521
|
+
if (!voltage || !(0, import_electronics_model3.range_is_defined)(voltage)) voltage = { lower: 0, upper: 0 };
|
|
522
|
+
const all_defined_voltage_limits = (0, import_electronics_model3.filter_defined_range)(gnds.map((v) => v.voltage_limits));
|
|
523
|
+
if (all_defined_voltage_limits.length > 0) {
|
|
524
|
+
const voltage_limits = (0, import_electronics_model3.intersection)(all_defined_voltage_limits);
|
|
525
|
+
if (!(0, import_electronics_model3.interests)(voltage_limits, voltage)) {
|
|
526
|
+
this.ctx.report.erc_errors.push(PP_OVER_DRIVEN(this.all_port_ids, "voltage"));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
init_link() {
|
|
531
|
+
const refs = [];
|
|
532
|
+
const gnds = [];
|
|
533
|
+
for (const v of this.ports) {
|
|
534
|
+
switch (v.type) {
|
|
535
|
+
case import_electronics_model3.PortType.GroundReference: {
|
|
536
|
+
refs.push(v);
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
case import_electronics_model3.PortType.Ground: {
|
|
540
|
+
gnds.push(v);
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (refs.length > 1) {
|
|
546
|
+
this.ctx.report.erc_errors.push(
|
|
547
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "Cannot connect multiple ground references to a ground.")
|
|
548
|
+
);
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
this.link = {
|
|
552
|
+
ref: refs[0],
|
|
553
|
+
gnds
|
|
554
|
+
};
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
var CanLogicLinkTester = class extends CompositePortLinkTesterBase {
|
|
559
|
+
check_parameter_propagation() {
|
|
560
|
+
if (!this.link) return;
|
|
561
|
+
const txd_tester = new DigitalLinkTester(this.ctx, [
|
|
562
|
+
this.link.controller.txd,
|
|
563
|
+
this.link.transceiver.rxd,
|
|
564
|
+
...this.link.passive.map((port) => port.rxd)
|
|
565
|
+
]);
|
|
566
|
+
const rxd_tester = new DigitalLinkTester(this.ctx, [
|
|
567
|
+
this.link.controller.rxd,
|
|
568
|
+
this.link.transceiver.txd,
|
|
569
|
+
...this.link.passive.map((port) => port.txd)
|
|
570
|
+
]);
|
|
571
|
+
for (const tst of [txd_tester, rxd_tester]) tst.test();
|
|
572
|
+
}
|
|
573
|
+
init_link() {
|
|
574
|
+
const controllers = [];
|
|
575
|
+
const transceivers = [];
|
|
576
|
+
const passive = [];
|
|
577
|
+
for (const v of this.ports) {
|
|
578
|
+
switch (v.type) {
|
|
579
|
+
case import_electronics_model3.PortType.CanControllerPort: {
|
|
580
|
+
controllers.push(v);
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
case import_electronics_model3.PortType.CanTransceiverPort: {
|
|
584
|
+
transceivers.push(v);
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
case import_electronics_model3.PortType.CanPassivePort: {
|
|
588
|
+
passive.push(v);
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (controllers.length !== 1) {
|
|
594
|
+
this.ctx.report.erc_errors.push(
|
|
595
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one controller port.")
|
|
596
|
+
);
|
|
597
|
+
return false;
|
|
598
|
+
}
|
|
599
|
+
if (transceivers.length !== 1) {
|
|
600
|
+
this.ctx.report.erc_errors.push(
|
|
601
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one transceiver port.")
|
|
602
|
+
);
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
this.link = {
|
|
606
|
+
controller: controllers[0],
|
|
607
|
+
transceiver: transceivers[0],
|
|
608
|
+
passive
|
|
609
|
+
};
|
|
610
|
+
return true;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
var CanDiffLinkTester = class extends CompositePortLinkTesterBase {
|
|
614
|
+
check_parameter_propagation() {
|
|
615
|
+
if (!this.link) return;
|
|
616
|
+
const canh_tester = new DigitalLinkTester(
|
|
617
|
+
this.ctx,
|
|
618
|
+
this.link.nodes.map((node) => node.canh)
|
|
619
|
+
);
|
|
620
|
+
const canl_tester = new DigitalLinkTester(
|
|
621
|
+
this.ctx,
|
|
622
|
+
this.link.nodes.map((node) => node.canl)
|
|
623
|
+
);
|
|
624
|
+
for (const tst of [canh_tester, canl_tester]) tst.test();
|
|
625
|
+
}
|
|
626
|
+
init_link() {
|
|
627
|
+
const nodes = [];
|
|
628
|
+
for (const v of this.ports) {
|
|
629
|
+
if (v.type === import_electronics_model3.PortType.CanDiffPort) {
|
|
630
|
+
nodes.push(v);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (nodes.length === 0) {
|
|
634
|
+
this.ctx.report.erc_errors.push(
|
|
635
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "Requires at least one CAN differential port")
|
|
636
|
+
);
|
|
637
|
+
return false;
|
|
638
|
+
}
|
|
639
|
+
this.link = {
|
|
640
|
+
nodes
|
|
641
|
+
};
|
|
642
|
+
return true;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var CrystalLinkTester = class extends CompositePortLinkTesterBase {
|
|
646
|
+
check_parameter_propagation() {
|
|
647
|
+
if (!this.link) return;
|
|
648
|
+
const driver = this.link.driver;
|
|
649
|
+
const crystal = this.link.crystal;
|
|
650
|
+
if ((0, import_electronics_model3.all_range_are_defined)(driver.frequency_limits, crystal.frequency)) {
|
|
651
|
+
if (!(0, import_electronics_model3.contains)(driver.frequency_limits, crystal.frequency)) {
|
|
652
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Frequency out of range"));
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
init_link() {
|
|
657
|
+
const drivers = [];
|
|
658
|
+
const crystals = [];
|
|
659
|
+
for (const v of this.ports) {
|
|
660
|
+
switch (v.type) {
|
|
661
|
+
case import_electronics_model3.PortType.CrystalDriver: {
|
|
662
|
+
drivers.push(v);
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
case import_electronics_model3.PortType.CrystalPort: {
|
|
666
|
+
crystals.push(v);
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (drivers.length !== 1) {
|
|
672
|
+
this.ctx.report.erc_errors.push(
|
|
673
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one crystal driver port.")
|
|
674
|
+
);
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
if (crystals.length !== 1) {
|
|
678
|
+
this.ctx.report.erc_errors.push(
|
|
679
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one crystal port.")
|
|
680
|
+
);
|
|
681
|
+
return false;
|
|
682
|
+
}
|
|
683
|
+
this.link = {
|
|
684
|
+
driver: drivers[0],
|
|
685
|
+
crystal: crystals[0]
|
|
686
|
+
};
|
|
687
|
+
return true;
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
var SwdLinkTester = class extends CompositePortLinkTesterBase {
|
|
691
|
+
check_parameter_propagation() {
|
|
692
|
+
if (!this.link) return;
|
|
693
|
+
const swdio_tester = new DigitalLinkTester(this.ctx, [
|
|
694
|
+
this.link.host.swdio,
|
|
695
|
+
this.link.device.swdio,
|
|
696
|
+
...this.link.pull.map((port) => port.swdio)
|
|
697
|
+
]);
|
|
698
|
+
const swclk_tester = new DigitalLinkTester(this.ctx, [
|
|
699
|
+
this.link.host.swclk,
|
|
700
|
+
this.link.device.swclk,
|
|
701
|
+
...this.link.pull.map((port) => port.swclk)
|
|
702
|
+
]);
|
|
703
|
+
for (const tst of [swdio_tester, swclk_tester]) tst.test();
|
|
704
|
+
}
|
|
705
|
+
init_link() {
|
|
706
|
+
const hosts = [];
|
|
707
|
+
const devices = [];
|
|
708
|
+
const pull = [];
|
|
709
|
+
for (const v of this.ports) {
|
|
710
|
+
switch (v.type) {
|
|
711
|
+
case import_electronics_model3.PortType.SwdHostPort: {
|
|
712
|
+
hosts.push(v);
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
case import_electronics_model3.PortType.SwdTargetPort: {
|
|
716
|
+
devices.push(v);
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
case import_electronics_model3.PortType.SwdPullPort: {
|
|
720
|
+
pull.push(v);
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (hosts.length !== 1) {
|
|
726
|
+
this.ctx.report.erc_errors.push(
|
|
727
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one SWD host port.")
|
|
728
|
+
);
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
if (devices.length !== 1) {
|
|
732
|
+
this.ctx.report.erc_errors.push(
|
|
733
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one SWD target port.")
|
|
734
|
+
);
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
this.link = {
|
|
738
|
+
host: hosts[0],
|
|
739
|
+
device: devices[0],
|
|
740
|
+
pull
|
|
741
|
+
};
|
|
742
|
+
return true;
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
var I2cLinkTester = class extends CompositePortLinkTesterBase {
|
|
746
|
+
check_parameter_propagation() {
|
|
747
|
+
if (!this.link) return;
|
|
748
|
+
const scl_tester = new DigitalLinkTester(this.ctx, [
|
|
749
|
+
...this.link.pull.map((device) => device.scl),
|
|
750
|
+
this.link.controller.scl,
|
|
751
|
+
...this.link.targets.map((device) => device.scl)
|
|
752
|
+
]);
|
|
753
|
+
const sda_tester = new DigitalLinkTester(this.ctx, [
|
|
754
|
+
...this.link.pull.map((device) => device.sda),
|
|
755
|
+
this.link.controller.sda,
|
|
756
|
+
...this.link.targets.map((device) => device.sda)
|
|
757
|
+
]);
|
|
758
|
+
for (const tst of [scl_tester, sda_tester]) tst.test();
|
|
759
|
+
if (!this.link.pull.length && !this.link.controller.has_pullup) {
|
|
760
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Requires at least one pullup"));
|
|
761
|
+
}
|
|
762
|
+
if (this.link.pull.length > 1) {
|
|
763
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "At most one pullup allowed"));
|
|
764
|
+
}
|
|
765
|
+
const addresses = this.link.targets.map((target) => target.addresses);
|
|
766
|
+
if (new Set(addresses).size !== addresses.length) {
|
|
767
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Conflicting addresses on I2C bus"));
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
init_link() {
|
|
771
|
+
const pull = [];
|
|
772
|
+
const controllers = [];
|
|
773
|
+
const targets = [];
|
|
774
|
+
for (const v of this.ports) {
|
|
775
|
+
switch (v.type) {
|
|
776
|
+
case import_electronics_model3.PortType.I2cPullupPort: {
|
|
777
|
+
pull.push(v);
|
|
778
|
+
break;
|
|
779
|
+
}
|
|
780
|
+
case import_electronics_model3.PortType.I2cController: {
|
|
781
|
+
controllers.push(v);
|
|
782
|
+
break;
|
|
783
|
+
}
|
|
784
|
+
case import_electronics_model3.PortType.I2cTarget: {
|
|
785
|
+
targets.push(v);
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
if (controllers.length !== 1) {
|
|
791
|
+
this.ctx.report.erc_errors.push(
|
|
792
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one I2C controller port.")
|
|
793
|
+
);
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
if (targets.length === 0) {
|
|
797
|
+
this.ctx.report.erc_errors.push(
|
|
798
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be at least one I2C target port.")
|
|
799
|
+
);
|
|
800
|
+
return false;
|
|
801
|
+
}
|
|
802
|
+
this.link = {
|
|
803
|
+
pull,
|
|
804
|
+
controller: controllers[0],
|
|
805
|
+
targets
|
|
806
|
+
};
|
|
807
|
+
return true;
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
var I2sLinkTester = class extends CompositePortLinkTesterBase {
|
|
811
|
+
check_parameter_propagation() {
|
|
812
|
+
if (!this.link) return;
|
|
813
|
+
const controller = this.link.controller;
|
|
814
|
+
const target_receiver = this.link.target_receiver;
|
|
815
|
+
const sck_tester = new DigitalLinkTester(this.ctx, [controller.sck, target_receiver.sck]);
|
|
816
|
+
const ws_tester = new DigitalLinkTester(this.ctx, [controller.ws, target_receiver.ws]);
|
|
817
|
+
const sd_tester = new DigitalLinkTester(this.ctx, [controller.sd, target_receiver.sd]);
|
|
818
|
+
for (const tst of [sck_tester, ws_tester, sd_tester]) tst.test();
|
|
819
|
+
}
|
|
820
|
+
init_link() {
|
|
821
|
+
const controllers = [];
|
|
822
|
+
const target_receivers = [];
|
|
823
|
+
for (const v of this.ports) {
|
|
824
|
+
switch (v.type) {
|
|
825
|
+
case import_electronics_model3.PortType.I2sController: {
|
|
826
|
+
controllers.push(v);
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
case import_electronics_model3.PortType.I2sTargetReceiver: {
|
|
830
|
+
target_receivers.push(v);
|
|
831
|
+
break;
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
if (controllers.length !== 1) {
|
|
836
|
+
this.ctx.report.erc_errors.push(
|
|
837
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one I2S controller port.")
|
|
838
|
+
);
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
if (target_receivers.length !== 1) {
|
|
842
|
+
this.ctx.report.erc_errors.push(
|
|
843
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one I2S target receiver port.")
|
|
844
|
+
);
|
|
845
|
+
return false;
|
|
846
|
+
}
|
|
847
|
+
this.link = {
|
|
848
|
+
controller: controllers[0],
|
|
849
|
+
target_receiver: target_receivers[0]
|
|
850
|
+
};
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
var SpiLinkTester = class extends CompositePortLinkTesterBase {
|
|
855
|
+
check_parameter_propagation() {
|
|
856
|
+
if (!this.link) return;
|
|
857
|
+
const controller = this.link.controller;
|
|
858
|
+
const peripherals = this.link.peripherals;
|
|
859
|
+
const sck_tester = new DigitalLinkTester(this.ctx, [controller.sck, ...peripherals.map((device) => device.sck)]);
|
|
860
|
+
const miso_tester = new DigitalLinkTester(this.ctx, [controller.miso, ...peripherals.map((device) => device.miso)]);
|
|
861
|
+
const mosi_tester = new DigitalLinkTester(this.ctx, [controller.mosi, ...peripherals.map((device) => device.mosi)]);
|
|
862
|
+
for (const tst of [sck_tester, miso_tester, mosi_tester]) tst.test();
|
|
863
|
+
}
|
|
864
|
+
init_link() {
|
|
865
|
+
const controllers = [];
|
|
866
|
+
const peripherals = [];
|
|
867
|
+
for (const v of this.ports) {
|
|
868
|
+
switch (v.type) {
|
|
869
|
+
case import_electronics_model3.PortType.SpiController: {
|
|
870
|
+
controllers.push(v);
|
|
871
|
+
break;
|
|
872
|
+
}
|
|
873
|
+
case import_electronics_model3.PortType.SpiPeripheral: {
|
|
874
|
+
peripherals.push(v);
|
|
875
|
+
break;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (controllers.length !== 1) {
|
|
880
|
+
this.ctx.report.erc_errors.push(
|
|
881
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one SPI controller port.")
|
|
882
|
+
);
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
if (peripherals.length === 0) {
|
|
886
|
+
this.ctx.report.erc_errors.push(
|
|
887
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be at least one SPI peripheral port.")
|
|
888
|
+
);
|
|
889
|
+
return false;
|
|
890
|
+
}
|
|
891
|
+
this.link = {
|
|
892
|
+
controller: controllers[0],
|
|
893
|
+
peripherals
|
|
894
|
+
};
|
|
895
|
+
return true;
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
var SpeakerLinkTester = class extends CompositePortLinkTesterBase {
|
|
899
|
+
check_parameter_propagation() {
|
|
900
|
+
if (!this.link) return;
|
|
901
|
+
const a_tester = new AnalogLinkTester(this.ctx, [this.link.source.a, this.link.sink.a]);
|
|
902
|
+
const b_tester = new AnalogLinkTester(this.ctx, [this.link.source.b, this.link.sink.b]);
|
|
903
|
+
for (const tst of [a_tester, b_tester]) tst.test();
|
|
904
|
+
}
|
|
905
|
+
init_link() {
|
|
906
|
+
const sources = [];
|
|
907
|
+
const sinks = [];
|
|
908
|
+
for (const v of this.ports) {
|
|
909
|
+
switch (v.type) {
|
|
910
|
+
case import_electronics_model3.PortType.SpeakerDriverPort: {
|
|
911
|
+
sources.push(v);
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
case import_electronics_model3.PortType.SpeakerPort: {
|
|
915
|
+
sinks.push(v);
|
|
916
|
+
break;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
if (sources.length !== 1) {
|
|
921
|
+
this.ctx.report.erc_errors.push(
|
|
922
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one speaker driver port.")
|
|
923
|
+
);
|
|
924
|
+
return false;
|
|
925
|
+
}
|
|
926
|
+
if (sinks.length !== 1) {
|
|
927
|
+
this.ctx.report.erc_errors.push(
|
|
928
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one speaker port.")
|
|
929
|
+
);
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
this.link = {
|
|
933
|
+
source: sources[0],
|
|
934
|
+
sink: sinks[0]
|
|
935
|
+
};
|
|
936
|
+
return true;
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
var TouchLinkTester = class extends LinkTesterBase {
|
|
940
|
+
init_link() {
|
|
941
|
+
const drivers = [];
|
|
942
|
+
const pads = [];
|
|
943
|
+
for (const v of this.ports) {
|
|
944
|
+
switch (v.type) {
|
|
945
|
+
case import_electronics_model3.PortType.TouchDriver: {
|
|
946
|
+
drivers.push(v);
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
949
|
+
case import_electronics_model3.PortType.TouchPadPort: {
|
|
950
|
+
pads.push(v);
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
if (drivers.length !== 1) {
|
|
956
|
+
this.ctx.report.erc_errors.push(
|
|
957
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one touch driver port.")
|
|
958
|
+
);
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
if (pads.length !== 1) {
|
|
962
|
+
this.ctx.report.erc_errors.push(
|
|
963
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one touch pad port.")
|
|
964
|
+
);
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
this.link = {
|
|
968
|
+
driver: drivers[0],
|
|
969
|
+
pad: pads[0]
|
|
970
|
+
};
|
|
971
|
+
return true;
|
|
972
|
+
}
|
|
973
|
+
check_parameter_propagation() {
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
var UartLinkTester = class extends CompositePortLinkTesterBase {
|
|
978
|
+
check_parameter_propagation() {
|
|
979
|
+
if (!this.link) return;
|
|
980
|
+
const tx_tester = new DigitalLinkTester(this.ctx, [this.link.a.tx, this.link.b.rx]);
|
|
981
|
+
const rx_tester = new DigitalLinkTester(this.ctx, [this.link.b.tx, this.link.a.rx]);
|
|
982
|
+
for (const tst of [tx_tester, rx_tester]) tst.test();
|
|
983
|
+
}
|
|
984
|
+
init_link() {
|
|
985
|
+
const ports = [];
|
|
986
|
+
for (const v of this.ports) {
|
|
987
|
+
if (v.type === import_electronics_model3.PortType.UartPort) {
|
|
988
|
+
ports.push(v);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (ports.length !== 2) {
|
|
992
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly two UART ports."));
|
|
993
|
+
return false;
|
|
994
|
+
}
|
|
995
|
+
this.link = {
|
|
996
|
+
a: ports[0],
|
|
997
|
+
b: ports[1]
|
|
998
|
+
};
|
|
999
|
+
return true;
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
var UsbLinkTester = class extends CompositePortLinkTesterBase {
|
|
1003
|
+
check_parameter_propagation() {
|
|
1004
|
+
if (!this.link) return;
|
|
1005
|
+
const dp_tester = new DigitalLinkTester(this.ctx, [
|
|
1006
|
+
this.link.host.dp,
|
|
1007
|
+
this.link.device.dp,
|
|
1008
|
+
...this.link.passive.map((port) => port.dp)
|
|
1009
|
+
]);
|
|
1010
|
+
const dm_tester = new DigitalLinkTester(this.ctx, [
|
|
1011
|
+
this.link.host.dm,
|
|
1012
|
+
this.link.device.dm,
|
|
1013
|
+
...this.link.passive.map((port) => port.dm)
|
|
1014
|
+
]);
|
|
1015
|
+
for (const tst of [dp_tester, dm_tester]) tst.test();
|
|
1016
|
+
}
|
|
1017
|
+
init_link() {
|
|
1018
|
+
const hosts = [];
|
|
1019
|
+
const devices = [];
|
|
1020
|
+
const passive = [];
|
|
1021
|
+
for (const v of this.ports) {
|
|
1022
|
+
switch (v.type) {
|
|
1023
|
+
case import_electronics_model3.PortType.UsbHostPort: {
|
|
1024
|
+
hosts.push(v);
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
case import_electronics_model3.PortType.UsbDevicePort: {
|
|
1028
|
+
devices.push(v);
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
case import_electronics_model3.PortType.UsbPassivePort: {
|
|
1032
|
+
passive.push(v);
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (hosts.length !== 1) {
|
|
1038
|
+
this.ctx.report.erc_errors.push(
|
|
1039
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one USB host port.")
|
|
1040
|
+
);
|
|
1041
|
+
return false;
|
|
1042
|
+
}
|
|
1043
|
+
if (devices.length !== 1) {
|
|
1044
|
+
this.ctx.report.erc_errors.push(
|
|
1045
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one USB device port.")
|
|
1046
|
+
);
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
this.link = {
|
|
1050
|
+
host: hosts[0],
|
|
1051
|
+
device: devices[0],
|
|
1052
|
+
passive
|
|
1053
|
+
};
|
|
1054
|
+
return true;
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
var UsbCcLinkTester = class extends CompositePortLinkTesterBase {
|
|
1058
|
+
check_parameter_propagation() {
|
|
1059
|
+
if (!this.link) return;
|
|
1060
|
+
const cc1_tester = new DigitalLinkTester(this.ctx, [this.link.a.cc1, this.link.b.cc1]);
|
|
1061
|
+
const cc2_tester = new DigitalLinkTester(this.ctx, [this.link.a.cc2, this.link.b.cc2]);
|
|
1062
|
+
for (const tst of [cc1_tester, cc2_tester]) tst.test();
|
|
1063
|
+
}
|
|
1064
|
+
init_link() {
|
|
1065
|
+
const nodes = [];
|
|
1066
|
+
for (const v of this.ports) {
|
|
1067
|
+
if (v.type === import_electronics_model3.PortType.UsbCcPort) {
|
|
1068
|
+
nodes.push(v);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
if (nodes.length !== 2) {
|
|
1072
|
+
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly two CC ports."));
|
|
1073
|
+
return false;
|
|
1074
|
+
}
|
|
1075
|
+
this.link = {
|
|
1076
|
+
a: nodes[0],
|
|
1077
|
+
b: nodes[1]
|
|
1078
|
+
};
|
|
1079
|
+
return true;
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
var Dvp8LinkTester = class extends CompositePortLinkTesterBase {
|
|
1083
|
+
check_parameter_propagation() {
|
|
1084
|
+
if (!this.link) return;
|
|
1085
|
+
const host = this.link.host;
|
|
1086
|
+
const cam = this.link.cam;
|
|
1087
|
+
const digitalLinks = [
|
|
1088
|
+
[host.xclk, cam.xclk],
|
|
1089
|
+
[host.pclk, cam.pclk],
|
|
1090
|
+
[host.href, cam.href],
|
|
1091
|
+
[host.vsync, cam.vsync],
|
|
1092
|
+
[host.y0, cam.y0],
|
|
1093
|
+
[host.y1, cam.y1],
|
|
1094
|
+
[host.y2, cam.y2],
|
|
1095
|
+
[host.y3, cam.y3],
|
|
1096
|
+
[host.y4, cam.y4],
|
|
1097
|
+
[host.y5, cam.y5],
|
|
1098
|
+
[host.y6, cam.y6],
|
|
1099
|
+
[host.y7, cam.y7]
|
|
1100
|
+
];
|
|
1101
|
+
for (const [hostPort, camPort] of digitalLinks) {
|
|
1102
|
+
const tester = new DigitalLinkTester(this.ctx, [hostPort, camPort]);
|
|
1103
|
+
tester.test();
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
init_link() {
|
|
1107
|
+
const hosts = [];
|
|
1108
|
+
const cams = [];
|
|
1109
|
+
for (const v of this.ports) {
|
|
1110
|
+
switch (v.type) {
|
|
1111
|
+
case import_electronics_model3.PortType.Dvp8Host: {
|
|
1112
|
+
hosts.push(v);
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
case import_electronics_model3.PortType.Dvp8Camera: {
|
|
1116
|
+
cams.push(v);
|
|
1117
|
+
break;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
if (hosts.length !== 1) {
|
|
1122
|
+
this.ctx.report.erc_errors.push(
|
|
1123
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one DVP8 host port.")
|
|
1124
|
+
);
|
|
1125
|
+
return false;
|
|
1126
|
+
}
|
|
1127
|
+
if (cams.length !== 1) {
|
|
1128
|
+
this.ctx.report.erc_errors.push(
|
|
1129
|
+
PP_ILLEGAL_CONNECTION(this.all_port_ids, "There must be exactly one DVP8 camera port.")
|
|
1130
|
+
);
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
this.link = {
|
|
1134
|
+
host: hosts[0],
|
|
1135
|
+
cam: cams[0]
|
|
1136
|
+
};
|
|
1137
|
+
return true;
|
|
1138
|
+
}
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1141
|
+
// src/erc/parameter_propagation/tester.ts
|
|
1142
|
+
var ParameterPropagationTester = class {
|
|
1143
|
+
constructor(ctx) {
|
|
1144
|
+
this.ctx = ctx;
|
|
1145
|
+
this.has_passive_port = false;
|
|
1146
|
+
}
|
|
1147
|
+
run_test(CtorClass, ports) {
|
|
1148
|
+
return new CtorClass(
|
|
1149
|
+
{
|
|
1150
|
+
report: this.ctx.report,
|
|
1151
|
+
port_id: this.port_id,
|
|
1152
|
+
has_passive_port: this.has_passive_port
|
|
1153
|
+
},
|
|
1154
|
+
ports
|
|
1155
|
+
).test();
|
|
1156
|
+
}
|
|
1157
|
+
visit_cc(cc) {
|
|
1158
|
+
if (cc.nodes.length < 2) {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
this.link_map = (0, import_electronics_model4.gen_link_map)();
|
|
1162
|
+
const ports = [];
|
|
1163
|
+
for (const p of cc.nodes) {
|
|
1164
|
+
switch (p.type) {
|
|
1165
|
+
case import_electronics_model4.ConnectionNodeType.Port: {
|
|
1166
|
+
ports.push(p);
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
case import_electronics_model4.ConnectionNodeType.Power: {
|
|
1170
|
+
ports.push({
|
|
1171
|
+
type: import_electronics_model4.ConnectionNodeType.Port,
|
|
1172
|
+
param: p.param,
|
|
1173
|
+
label_shapes: {},
|
|
1174
|
+
uuid: p.uuid
|
|
1175
|
+
});
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
case import_electronics_model4.ConnectionNodeType.NetLabel: {
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
case import_electronics_model4.ConnectionNodeType.Graphics: {
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
this.port_id = /* @__PURE__ */ new Map();
|
|
1187
|
+
for (const p of ports) this.port_id.set(p.param, p.uuid);
|
|
1188
|
+
for (const v of ports) {
|
|
1189
|
+
const port = v.param;
|
|
1190
|
+
if (port.type === import_electronics_model4.PortType.Passive) this.has_passive_port = true;
|
|
1191
|
+
const arr = this.link_map[(0, import_electronics_model4.get_port_link_type)(port)];
|
|
1192
|
+
arr.push(port);
|
|
1193
|
+
}
|
|
1194
|
+
let link_t = 0;
|
|
1195
|
+
for (const [k, v] of Object.entries(this.link_map)) {
|
|
1196
|
+
if (!v || !v.length) continue;
|
|
1197
|
+
switch (k) {
|
|
1198
|
+
case import_electronics_model4.LinkType.AnalogLink: {
|
|
1199
|
+
this.run_test(AnalogLinkTester, v);
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
case import_electronics_model4.LinkType.DigitalLink: {
|
|
1203
|
+
this.run_test(DigitalLinkTester, v);
|
|
1204
|
+
break;
|
|
1205
|
+
}
|
|
1206
|
+
case import_electronics_model4.LinkType.VoltageLink: {
|
|
1207
|
+
this.run_test(VoltageLinkTester, v);
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
case import_electronics_model4.LinkType.GroundLink: {
|
|
1211
|
+
this.run_test(GroundLinkTester, v);
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
case import_electronics_model4.LinkType.CanLogicLink: {
|
|
1215
|
+
this.run_test(CanLogicLinkTester, v);
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
case import_electronics_model4.LinkType.CanDiffLink: {
|
|
1219
|
+
this.run_test(CanDiffLinkTester, v);
|
|
1220
|
+
break;
|
|
1221
|
+
}
|
|
1222
|
+
case import_electronics_model4.LinkType.PassiveLink: {
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
case import_electronics_model4.LinkType.CrystalLink: {
|
|
1226
|
+
this.run_test(CrystalLinkTester, v);
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
case import_electronics_model4.LinkType.SwdLink: {
|
|
1230
|
+
this.run_test(SwdLinkTester, v);
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
case import_electronics_model4.LinkType.I2cLink: {
|
|
1234
|
+
this.run_test(I2cLinkTester, v);
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
case import_electronics_model4.LinkType.I2sLink: {
|
|
1238
|
+
this.run_test(I2sLinkTester, v);
|
|
1239
|
+
break;
|
|
1240
|
+
}
|
|
1241
|
+
case import_electronics_model4.LinkType.SpiLink: {
|
|
1242
|
+
this.run_test(SpiLinkTester, v);
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
case import_electronics_model4.LinkType.SpeakerLink: {
|
|
1246
|
+
this.run_test(SpeakerLinkTester, v);
|
|
1247
|
+
break;
|
|
1248
|
+
}
|
|
1249
|
+
case import_electronics_model4.LinkType.TouchLink: {
|
|
1250
|
+
this.run_test(TouchLinkTester, v);
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
case import_electronics_model4.LinkType.UartLink: {
|
|
1254
|
+
this.run_test(UartLinkTester, v);
|
|
1255
|
+
break;
|
|
1256
|
+
}
|
|
1257
|
+
case import_electronics_model4.LinkType.UsbLink: {
|
|
1258
|
+
this.run_test(UsbLinkTester, v);
|
|
1259
|
+
break;
|
|
1260
|
+
}
|
|
1261
|
+
case import_electronics_model4.LinkType.UsbCcLink: {
|
|
1262
|
+
this.run_test(UsbCcLinkTester, v);
|
|
1263
|
+
break;
|
|
1264
|
+
}
|
|
1265
|
+
case import_electronics_model4.LinkType.Dvp8Link: {
|
|
1266
|
+
this.run_test(Dvp8LinkTester, v);
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
default: {
|
|
1270
|
+
throw new Error(`Unhandled link type: ${k}`);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
if (v.length > 1) link_t += 1;
|
|
1274
|
+
}
|
|
1275
|
+
if (link_t > 2 || link_t === 2 && !this.has_passive_port) {
|
|
1276
|
+
this.ctx.report.erc_errors.push(PP_INAPPROPRIATE_FUNC(cc.nodes.map((i) => i.uuid)));
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
// src/erc/pin_compatibility_matrix/error_code.ts
|
|
1282
|
+
var ERCE_T = /* @__PURE__ */ ((ERCE_T2) => {
|
|
1283
|
+
ERCE_T2["ERCE_DUPLICATE_SHEET_NAME"] = "duplicate_sheet_names";
|
|
1284
|
+
ERCE_T2["ERCE_ENDPOINT_OFF_GRID"] = "endpoint_off_grid";
|
|
1285
|
+
ERCE_T2["ERCE_PIN_NOT_CONNECTED"] = "pin_not_connected";
|
|
1286
|
+
ERCE_T2["ERCE_PIN_NOT_DRIVEN"] = "pin_not_driven";
|
|
1287
|
+
ERCE_T2["ERCE_POWERPIN_NOT_DRIVEN"] = "power_pin_not_driven";
|
|
1288
|
+
ERCE_T2["ERCE_HIERACHICAL_LABEL"] = "hier_label_mismatch";
|
|
1289
|
+
ERCE_T2["ERCE_NOCONNECT_CONNECTED"] = "no_connect_connected";
|
|
1290
|
+
ERCE_T2["ERCE_NOCONNECT_NOT_CONNECTED"] = "no_connect_dangling";
|
|
1291
|
+
ERCE_T2["ERCE_LABEL_NOT_CONNECTED"] = "label_dangling";
|
|
1292
|
+
ERCE_T2["ERCE_SIMILAR_LABELS"] = "similar_labels";
|
|
1293
|
+
ERCE_T2["ERCE_SIMILAR_POWER"] = "similar_power";
|
|
1294
|
+
ERCE_T2["ERCE_SIMILAR_LABEL_AND_POWER"] = "similar_label_and_power";
|
|
1295
|
+
ERCE_T2["ERCE_SINGLE_GLOBAL_LABEL"] = "single_global_label";
|
|
1296
|
+
ERCE_T2["ERCE_SAME_LOCAL_GLOBAL_LABEL"] = "same_local_global_label";
|
|
1297
|
+
ERCE_T2["ERCE_DIFFERENT_UNIT_FP"] = "different_unit_footprint";
|
|
1298
|
+
ERCE_T2["ERCE_MISSING_POWER_INPUT_PIN"] = "missing_power_input_pin";
|
|
1299
|
+
ERCE_T2["ERCE_MISSING_INPUT_PIN"] = "missing_input_pin";
|
|
1300
|
+
ERCE_T2["ERCE_MISSING_BIDI_PIN"] = "missing_bidi_pin";
|
|
1301
|
+
ERCE_T2["ERCE_MISSING_UNIT"] = "missing_unit";
|
|
1302
|
+
ERCE_T2["ERCE_DIFFERENT_UNIT_NET"] = "different_unit_net";
|
|
1303
|
+
ERCE_T2["ERCE_BUS_ALIAS_CONFLICT"] = "bus_definition_conflict";
|
|
1304
|
+
ERCE_T2["ERCE_DRIVER_CONFLICT"] = "multiple_net_names";
|
|
1305
|
+
ERCE_T2["ERCE_BUS_ENTRY_CONFLICT"] = "net_not_bus_member";
|
|
1306
|
+
ERCE_T2["ERCE_BUS_TO_BUS_CONFLICT"] = "bus_to_bus_conflict";
|
|
1307
|
+
ERCE_T2["ERCE_BUS_TO_NET_CONFLICT"] = "bus_to_net_conflict";
|
|
1308
|
+
ERCE_T2["ERCE_GLOBLABEL"] = "global_label_dangling";
|
|
1309
|
+
ERCE_T2["ERCE_UNRESOLVED_VARIABLE"] = "unresolved_variable";
|
|
1310
|
+
ERCE_T2["ERCE_UNDEFINED_NETCLASS"] = "undefined_netclass";
|
|
1311
|
+
ERCE_T2["ERCE_SIMULATION_MODEL"] = "simulation_model_issue";
|
|
1312
|
+
ERCE_T2["ERCE_WIRE_DANGLING"] = "wire_dangling";
|
|
1313
|
+
ERCE_T2["ERCE_LIB_SYMBOL_ISSUES"] = "lib_symbol_issues";
|
|
1314
|
+
ERCE_T2["ERCE_LIB_SYMBOL_MISMATCH"] = "lib_symbol_mismatch";
|
|
1315
|
+
ERCE_T2["ERCE_FOOTPRINT_LINK_ISSUES"] = "footprint_link_issues";
|
|
1316
|
+
ERCE_T2["ERCE_FOOTPRINT_FILTERS"] = "footprint_filter";
|
|
1317
|
+
ERCE_T2["ERCE_UNANNOTATED"] = "unannotated";
|
|
1318
|
+
ERCE_T2["ERCE_EXTRA_UNITS"] = "extra_units";
|
|
1319
|
+
ERCE_T2["ERCE_DIFFERENT_UNIT_VALUE"] = "unit_value_mismatch";
|
|
1320
|
+
ERCE_T2["ERCE_DUPLICATE_REFERENCE"] = "duplicate_reference";
|
|
1321
|
+
ERCE_T2["ERCE_BUS_ENTRY_NEEDED"] = "bus_entry_needed";
|
|
1322
|
+
ERCE_T2["ERCE_FOUR_WAY_JUNCTION"] = "four_way_junction";
|
|
1323
|
+
ERCE_T2["ERCE_LABEL_MULTIPLE_WIRES"] = "label_multiple_wires";
|
|
1324
|
+
ERCE_T2["ERCE_UNCONNECTED_WIRE_ENDPOINT"] = "unconnected_wire_endpoint";
|
|
1325
|
+
ERCE_T2["ERCE_LAST"] = "unconnected_wire_endpoint";
|
|
1326
|
+
ERCE_T2["ERCE_DUPLICATE_PIN_ERROR"] = "ERCE_DUPLICATE_PIN_ERROR";
|
|
1327
|
+
ERCE_T2["ERCE_PIN_TO_PIN_WARNING"] = "ERCE_PIN_TO_PIN_WARNING";
|
|
1328
|
+
ERCE_T2["ERCE_PIN_TO_PIN_ERROR"] = "ERCE_PIN_TO_PIN_ERROR";
|
|
1329
|
+
ERCE_T2["ERCE_ANNOTATION_ACTION"] = "ERCE_ANNOTATION_ACTION";
|
|
1330
|
+
ERCE_T2["ERCE_GENERIC_WARNING"] = "ERCE_GENERIC_WARNING";
|
|
1331
|
+
ERCE_T2["ERCE_GENERIC_ERROR"] = "ERCE_GENERIC_ERROR";
|
|
1332
|
+
return ERCE_T2;
|
|
1333
|
+
})(ERCE_T || {});
|
|
1334
|
+
|
|
1335
|
+
// src/erc/pin_compatibility_matrix/pin_error.ts
|
|
1336
|
+
var PIN_ERROR = /* @__PURE__ */ ((PIN_ERROR2) => {
|
|
1337
|
+
PIN_ERROR2[PIN_ERROR2["OK"] = 0] = "OK";
|
|
1338
|
+
PIN_ERROR2[PIN_ERROR2["WARNING"] = 1] = "WARNING";
|
|
1339
|
+
PIN_ERROR2[PIN_ERROR2["PP_ERROR"] = 2] = "PP_ERROR";
|
|
1340
|
+
PIN_ERROR2[PIN_ERROR2["UNCONNECTED"] = 3] = "UNCONNECTED";
|
|
1341
|
+
return PIN_ERROR2;
|
|
1342
|
+
})(PIN_ERROR || {});
|
|
1343
|
+
|
|
1344
|
+
// src/erc/pin_compatibility_matrix/erc_setting.ts
|
|
1345
|
+
var ERC_SETTING = class {
|
|
1346
|
+
constructor({
|
|
1347
|
+
pin_map,
|
|
1348
|
+
rule_severities
|
|
1349
|
+
}) {
|
|
1350
|
+
this.pin_map = pin_map;
|
|
1351
|
+
this.rule_severities = rule_severities;
|
|
1352
|
+
}
|
|
1353
|
+
IsTestEnabled(code) {
|
|
1354
|
+
return this.rule_severities[code] !== 64 /* RPT_SEVERITY_IGNORE */;
|
|
1355
|
+
}
|
|
1356
|
+
GetPinMapValue(aFirstType, aSecondType) {
|
|
1357
|
+
return this.pin_map[aFirstType][aSecondType];
|
|
1358
|
+
}
|
|
1359
|
+
SetPinMapValue(aFirstType, aSecondType, aValue) {
|
|
1360
|
+
this.pin_map[aFirstType][aSecondType] = aValue;
|
|
1361
|
+
}
|
|
1362
|
+
GetSeverity(code) {
|
|
1363
|
+
return this.rule_severities[code];
|
|
1364
|
+
}
|
|
1365
|
+
SetSeverity(code, severity) {
|
|
1366
|
+
this.rule_severities[code] = severity;
|
|
1367
|
+
}
|
|
1368
|
+
toJSON() {
|
|
1369
|
+
return {
|
|
1370
|
+
pin_map: this.pin_map,
|
|
1371
|
+
rule_severities: this.rule_severities,
|
|
1372
|
+
erc_exclusions: [],
|
|
1373
|
+
meta: {
|
|
1374
|
+
version: 0
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
var OK = 0 /* OK */;
|
|
1380
|
+
var WAR = 1 /* WARNING */;
|
|
1381
|
+
var ERR = 2 /* PP_ERROR */;
|
|
1382
|
+
var DEFAULT_PIN_MAP = [
|
|
1383
|
+
/* I, O, Bi, 3S, Pas, NIC, UnS, PwrI, PwrO, OC, OE, NC */
|
|
1384
|
+
/* I */
|
|
1385
|
+
[OK, OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR],
|
|
1386
|
+
/* O */
|
|
1387
|
+
[OK, ERR, OK, WAR, OK, OK, WAR, OK, ERR, ERR, ERR, ERR],
|
|
1388
|
+
/* Bi */
|
|
1389
|
+
[OK, OK, OK, OK, OK, OK, WAR, OK, WAR, OK, WAR, ERR],
|
|
1390
|
+
/* 3S */
|
|
1391
|
+
[OK, WAR, OK, OK, OK, OK, WAR, WAR, ERR, WAR, WAR, ERR],
|
|
1392
|
+
/*Pas */
|
|
1393
|
+
[OK, OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR],
|
|
1394
|
+
/*NIC */
|
|
1395
|
+
[OK, OK, OK, OK, OK, OK, OK, OK, OK, OK, OK, ERR],
|
|
1396
|
+
/*UnS */
|
|
1397
|
+
[WAR, WAR, WAR, WAR, WAR, OK, WAR, WAR, WAR, WAR, WAR, ERR],
|
|
1398
|
+
/*PwrI*/
|
|
1399
|
+
[OK, OK, OK, WAR, OK, OK, WAR, OK, OK, OK, OK, ERR],
|
|
1400
|
+
/*PwrO*/
|
|
1401
|
+
[OK, ERR, WAR, ERR, OK, OK, WAR, OK, ERR, ERR, ERR, ERR],
|
|
1402
|
+
/* OC */
|
|
1403
|
+
[OK, ERR, OK, WAR, OK, OK, WAR, OK, ERR, OK, OK, ERR],
|
|
1404
|
+
/* OE */
|
|
1405
|
+
[OK, ERR, WAR, WAR, OK, OK, WAR, OK, ERR, OK, OK, ERR],
|
|
1406
|
+
/* NC */
|
|
1407
|
+
[ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR]
|
|
1408
|
+
];
|
|
1409
|
+
var DEFAULT_SEVERITY = {
|
|
1410
|
+
["endpoint_off_grid" /* ERCE_ENDPOINT_OFF_GRID */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1411
|
+
["ERCE_PIN_TO_PIN_WARNING" /* ERCE_PIN_TO_PIN_WARNING */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1412
|
+
["similar_labels" /* ERCE_SIMILAR_LABELS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1413
|
+
["similar_power" /* ERCE_SIMILAR_POWER */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1414
|
+
["similar_label_and_power" /* ERCE_SIMILAR_LABEL_AND_POWER */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1415
|
+
["single_global_label" /* ERCE_SINGLE_GLOBAL_LABEL */]: 64 /* RPT_SEVERITY_IGNORE */,
|
|
1416
|
+
["same_local_global_label" /* ERCE_SAME_LOCAL_GLOBAL_LABEL */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1417
|
+
["global_label_dangling" /* ERCE_GLOBLABEL */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1418
|
+
["multiple_net_names" /* ERCE_DRIVER_CONFLICT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1419
|
+
["net_not_bus_member" /* ERCE_BUS_ENTRY_CONFLICT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1420
|
+
["lib_symbol_issues" /* ERCE_LIB_SYMBOL_ISSUES */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1421
|
+
["lib_symbol_mismatch" /* ERCE_LIB_SYMBOL_MISMATCH */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1422
|
+
["footprint_link_issues" /* ERCE_FOOTPRINT_LINK_ISSUES */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1423
|
+
["footprint_filter" /* ERCE_FOOTPRINT_FILTERS */]: 64 /* RPT_SEVERITY_IGNORE */,
|
|
1424
|
+
["no_connect_connected" /* ERCE_NOCONNECT_CONNECTED */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1425
|
+
["no_connect_dangling" /* ERCE_NOCONNECT_NOT_CONNECTED */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1426
|
+
["missing_unit" /* ERCE_MISSING_UNIT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1427
|
+
["missing_input_pin" /* ERCE_MISSING_INPUT_PIN */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1428
|
+
["missing_bidi_pin" /* ERCE_MISSING_BIDI_PIN */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1429
|
+
["simulation_model_issue" /* ERCE_SIMULATION_MODEL */]: 64 /* RPT_SEVERITY_IGNORE */,
|
|
1430
|
+
["four_way_junction" /* ERCE_FOUR_WAY_JUNCTION */]: 64 /* RPT_SEVERITY_IGNORE */,
|
|
1431
|
+
["label_multiple_wires" /* ERCE_LABEL_MULTIPLE_WIRES */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1432
|
+
["unconnected_wire_endpoint" /* ERCE_UNCONNECTED_WIRE_ENDPOINT */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
1433
|
+
["pin_not_connected" /* ERCE_PIN_NOT_CONNECTED */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1434
|
+
["pin_not_driven" /* ERCE_PIN_NOT_DRIVEN */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1435
|
+
["power_pin_not_driven" /* ERCE_POWERPIN_NOT_DRIVEN */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1436
|
+
["hier_label_mismatch" /* ERCE_HIERACHICAL_LABEL */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1437
|
+
["label_dangling" /* ERCE_LABEL_NOT_CONNECTED */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1438
|
+
["different_unit_footprint" /* ERCE_DIFFERENT_UNIT_FP */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1439
|
+
["missing_power_input_pin" /* ERCE_MISSING_POWER_INPUT_PIN */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1440
|
+
["different_unit_net" /* ERCE_DIFFERENT_UNIT_NET */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1441
|
+
["bus_definition_conflict" /* ERCE_BUS_ALIAS_CONFLICT */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1442
|
+
["bus_to_bus_conflict" /* ERCE_BUS_TO_BUS_CONFLICT */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1443
|
+
["bus_to_net_conflict" /* ERCE_BUS_TO_NET_CONFLICT */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1444
|
+
["unresolved_variable" /* ERCE_UNRESOLVED_VARIABLE */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1445
|
+
["undefined_netclass" /* ERCE_UNDEFINED_NETCLASS */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1446
|
+
["wire_dangling" /* ERCE_WIRE_DANGLING */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1447
|
+
["unannotated" /* ERCE_UNANNOTATED */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1448
|
+
["extra_units" /* ERCE_EXTRA_UNITS */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1449
|
+
["unit_value_mismatch" /* ERCE_DIFFERENT_UNIT_VALUE */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1450
|
+
["duplicate_reference" /* ERCE_DUPLICATE_REFERENCE */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1451
|
+
["bus_entry_needed" /* ERCE_BUS_ENTRY_NEEDED */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1452
|
+
["ERCE_DUPLICATE_PIN_ERROR" /* ERCE_DUPLICATE_PIN_ERROR */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1453
|
+
["ERCE_PIN_TO_PIN_ERROR" /* ERCE_PIN_TO_PIN_ERROR */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1454
|
+
["ERCE_ANNOTATION_ACTION" /* ERCE_ANNOTATION_ACTION */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1455
|
+
["ERCE_GENERIC_WARNING" /* ERCE_GENERIC_WARNING */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1456
|
+
["ERCE_GENERIC_ERROR" /* ERCE_GENERIC_ERROR */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
1457
|
+
["duplicate_sheet_names" /* ERCE_DUPLICATE_SHEET_NAME */]: 32 /* RPT_SEVERITY_ERROR */
|
|
1458
|
+
};
|
|
1459
|
+
var DEFAULT_ERC_SETTING = new ERC_SETTING({
|
|
1460
|
+
pin_map: DEFAULT_PIN_MAP,
|
|
1461
|
+
rule_severities: DEFAULT_SEVERITY
|
|
1462
|
+
});
|
|
1463
|
+
|
|
1464
|
+
// src/erc/pin_compatibility_matrix/tester.ts
|
|
1465
|
+
var import_electronics_model5 = require("@modular-circuit/electronics-model");
|
|
1466
|
+
var PIN_COMPATIBILITY_MATRIX_TESTER = class {
|
|
1467
|
+
constructor(ctx) {
|
|
1468
|
+
this.ctx = ctx;
|
|
1469
|
+
}
|
|
1470
|
+
visit_cc(cc) {
|
|
1471
|
+
const nodes = cc.nodes.filter((i) => (0, import_electronics_model5.node_is_electrical_node)(i));
|
|
1472
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
1473
|
+
const current = (0, import_electronics_model5.get_electrical_pin_type)(nodes[i]);
|
|
1474
|
+
for (let j = i + 1; j < nodes.length; j++) {
|
|
1475
|
+
const other = (0, import_electronics_model5.get_electrical_pin_type)(nodes[j]);
|
|
1476
|
+
const error = this.ctx.erc_setting.GetPinMapValue(current, other);
|
|
1477
|
+
if (error !== 0 /* OK */) {
|
|
1478
|
+
this.ctx.report.erc_errors.push(ERCE_PIN_TO_PIN_ERROR(nodes[i], nodes[j]));
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
// src/erc/netlist/constraints.ts
|
|
1486
|
+
var import_electronics_model6 = require("@modular-circuit/electronics-model");
|
|
1487
|
+
var DrivingPinTypes = /* @__PURE__ */ new Set([
|
|
1488
|
+
import_electronics_model6.ELECTRICAL_PINTYPE.PT_OUTPUT,
|
|
1489
|
+
import_electronics_model6.ELECTRICAL_PINTYPE.PT_POWER_OUT,
|
|
1490
|
+
import_electronics_model6.ELECTRICAL_PINTYPE.PT_PASSIVE,
|
|
1491
|
+
import_electronics_model6.ELECTRICAL_PINTYPE.PT_TRISTATE,
|
|
1492
|
+
import_electronics_model6.ELECTRICAL_PINTYPE.PT_BIDI
|
|
1493
|
+
]);
|
|
1494
|
+
var PowerDrivingPinTypes = /* @__PURE__ */ new Set([import_electronics_model6.ELECTRICAL_PINTYPE.PT_POWER_OUT]);
|
|
1495
|
+
var DrivenPinTypes = /* @__PURE__ */ new Set([import_electronics_model6.ELECTRICAL_PINTYPE.PT_INPUT, import_electronics_model6.ELECTRICAL_PINTYPE.PT_POWER_IN]);
|
|
1496
|
+
|
|
1497
|
+
// src/erc/netlist/tester.ts
|
|
1498
|
+
var import_electronics_model7 = require("@modular-circuit/electronics-model");
|
|
1499
|
+
var NetlistTester = class {
|
|
1500
|
+
constructor(ctx) {
|
|
1501
|
+
this.ctx = ctx;
|
|
1502
|
+
}
|
|
1503
|
+
visit_cc(cc) {
|
|
1504
|
+
if (cc.nodes.length === 1 && cc.nodes[0].type === import_electronics_model7.ConnectionNodeType.Port) {
|
|
1505
|
+
this.ctx.report.erc_errors.push(ERCE_PIN_NOT_CONNECTED(cc.nodes[0].uuid));
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
this.ercCheckMultipleDrivers(cc);
|
|
1509
|
+
}
|
|
1510
|
+
ercCheckMultipleDrivers(cc) {
|
|
1511
|
+
if (!cc.net_drivers) return;
|
|
1512
|
+
const node_map = cc.nodes.reduce(
|
|
1513
|
+
(map, node) => {
|
|
1514
|
+
map[node.uuid] = node;
|
|
1515
|
+
return map;
|
|
1516
|
+
},
|
|
1517
|
+
{}
|
|
1518
|
+
);
|
|
1519
|
+
for (const driver of cc.net_drivers.drivers) {
|
|
1520
|
+
if (driver === cc.net_drivers.primary_driver) continue;
|
|
1521
|
+
const node = node_map[driver];
|
|
1522
|
+
const net_name = cc.name;
|
|
1523
|
+
switch (node.type) {
|
|
1524
|
+
case import_electronics_model7.ConnectionNodeType.Port:
|
|
1525
|
+
case import_electronics_model7.ConnectionNodeType.Graphics:
|
|
1526
|
+
break;
|
|
1527
|
+
case import_electronics_model7.ConnectionNodeType.NetLabel:
|
|
1528
|
+
if (net_name !== node.text) {
|
|
1529
|
+
this.ctx.report.erc_errors.push(
|
|
1530
|
+
ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.text)
|
|
1531
|
+
);
|
|
1532
|
+
}
|
|
1533
|
+
break;
|
|
1534
|
+
case import_electronics_model7.ConnectionNodeType.Power:
|
|
1535
|
+
if (net_name !== node.value) {
|
|
1536
|
+
this.ctx.report.erc_errors.push(
|
|
1537
|
+
ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.value)
|
|
1538
|
+
);
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1546
|
+
// src/tester/erc_tester.ts
|
|
1547
|
+
var ERC_TESTER = class {
|
|
1548
|
+
constructor(ctx) {
|
|
1549
|
+
this.ctx = ctx;
|
|
1550
|
+
}
|
|
1551
|
+
run_test() {
|
|
1552
|
+
const report = { erc_errors: [], markers: [] };
|
|
1553
|
+
const tester_context = {
|
|
1554
|
+
report,
|
|
1555
|
+
...this.ctx
|
|
1556
|
+
};
|
|
1557
|
+
const visitors = [
|
|
1558
|
+
new PIN_COMPATIBILITY_MATRIX_TESTER(tester_context),
|
|
1559
|
+
new ParameterPropagationTester(tester_context),
|
|
1560
|
+
new NetlistTester(tester_context)
|
|
1561
|
+
];
|
|
1562
|
+
for (const cc of this.ctx.connection_graph.subgraphs) {
|
|
1563
|
+
for (const visitor of visitors) {
|
|
1564
|
+
visitor.visit_cc(cc);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
return {
|
|
1568
|
+
...report,
|
|
1569
|
+
connection_graph: this.ctx.connection_graph
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1574
|
+
// src/tester/graph/ir_graph_converter.ts
|
|
1575
|
+
var import_electronics_model8 = require("@modular-circuit/electronics-model");
|
|
1576
|
+
var import_electronics_model9 = require("@modular-circuit/electronics-model");
|
|
1577
|
+
var import_ir = require("@modular-circuit/ir");
|
|
1578
|
+
var import_utils = require("@modular-circuit/utils");
|
|
1579
|
+
var IR_GRAPH_CONVERTER = class {
|
|
1580
|
+
constructor(circuits) {
|
|
1581
|
+
this.circuits = circuits;
|
|
1582
|
+
this.graph = {};
|
|
1583
|
+
this.connection_node_map = {};
|
|
1584
|
+
this.schematics = {};
|
|
1585
|
+
this.reporter_context = {
|
|
1586
|
+
pin_name_table: {},
|
|
1587
|
+
pin_module_name_table: {}
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
get_report_context() {
|
|
1591
|
+
return this.reporter_context;
|
|
1592
|
+
}
|
|
1593
|
+
convert_to_graph(designs) {
|
|
1594
|
+
const errors = [];
|
|
1595
|
+
if (Object.keys(designs).length > 1) {
|
|
1596
|
+
throw new Error("Multiple designs are not supported");
|
|
1597
|
+
}
|
|
1598
|
+
for (const [sch_name, design] of Object.entries(designs)) {
|
|
1599
|
+
this.schematics[sch_name] = { uuid: design.uuid ?? (0, import_utils.gen_uuid)(), sheets: [], powers: [] };
|
|
1600
|
+
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;
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
const lb_map = {};
|
|
1624
|
+
for (const lb of design.labels ?? []) {
|
|
1625
|
+
this.add_node(lb.uuid);
|
|
1626
|
+
this.reporter_context.pin_name_table[lb.uuid] = lb.text;
|
|
1627
|
+
lb_map[lb.text] = [...lb_map[lb.text] ?? [], lb.uuid];
|
|
1628
|
+
switch (lb.type) {
|
|
1629
|
+
case "label":
|
|
1630
|
+
this.connection_node_map[lb.uuid] = { uuid: lb.uuid, type: import_electronics_model8.ConnectionNodeType.NetLabel, text: lb.text };
|
|
1631
|
+
break;
|
|
1632
|
+
default:
|
|
1633
|
+
throw new Error(`Unsupported label type ${lb.type}`);
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
for (const labels of Object.values(lb_map)) {
|
|
1637
|
+
for (let i = 0; i < labels.length - 1; i++) {
|
|
1638
|
+
this.add_connection(labels[i], labels[i + 1]);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
for (const pwr of design.pwr ?? []) {
|
|
1642
|
+
this.add_pwr(pwr, import_electronics_model9.PowerShape.VCC, sch_name, {
|
|
1643
|
+
type: import_electronics_model8.PortType.VoltageSource,
|
|
1644
|
+
name: pwr.value,
|
|
1645
|
+
link_type: import_electronics_model8.LinkType.VoltageLink,
|
|
1646
|
+
label_associated: pwr.value,
|
|
1647
|
+
voltage_out: pwr.param ? pwr.param.voltage_out : {},
|
|
1648
|
+
current_limits: pwr.param ? pwr.param.current_limits : {}
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
for (const pwr of design.gnd ?? []) {
|
|
1652
|
+
this.add_pwr(pwr, import_electronics_model9.PowerShape.GND, sch_name, {
|
|
1653
|
+
type: import_electronics_model8.PortType.Ground,
|
|
1654
|
+
name: pwr.value,
|
|
1655
|
+
link_type: import_electronics_model8.LinkType.GroundLink,
|
|
1656
|
+
label_associated: pwr.value,
|
|
1657
|
+
voltage_limits: pwr.param ? pwr.param.voltage_limits : {}
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
for (const j of design.junctions ?? []) {
|
|
1661
|
+
const uuid = j.uuid;
|
|
1662
|
+
this.add_node(uuid);
|
|
1663
|
+
this.connection_node_map[uuid] = { uuid, type: import_electronics_model8.ConnectionNodeType.Graphics };
|
|
1664
|
+
}
|
|
1665
|
+
for (const connection of design.wires ?? []) {
|
|
1666
|
+
const uuid = connection.uuid;
|
|
1667
|
+
this.add_connection(connection.from, connection.to);
|
|
1668
|
+
this.connection_node_map[uuid] = { uuid, type: import_electronics_model8.ConnectionNodeType.Graphics };
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
return errors.length ? errors : true;
|
|
1672
|
+
}
|
|
1673
|
+
add_node(id) {
|
|
1674
|
+
if (!this.graph[id]) this.graph[id] = /* @__PURE__ */ new Set();
|
|
1675
|
+
}
|
|
1676
|
+
add_pwr(pwr, shape, sch_name, param) {
|
|
1677
|
+
const uuid = pwr.uuid;
|
|
1678
|
+
const value = pwr.value;
|
|
1679
|
+
this.add_node(uuid);
|
|
1680
|
+
this.reporter_context.pin_name_table[uuid] = pwr.value;
|
|
1681
|
+
this.connection_node_map[uuid] = { uuid, type: import_electronics_model8.ConnectionNodeType.Power, value, param };
|
|
1682
|
+
this.schematics[sch_name].powers.push({
|
|
1683
|
+
uuid,
|
|
1684
|
+
value,
|
|
1685
|
+
shape
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
add_connection(from, to) {
|
|
1689
|
+
this.do_add_connection({ from, to });
|
|
1690
|
+
}
|
|
1691
|
+
do_add_connection(conn) {
|
|
1692
|
+
for (const p of [conn.from, conn.to]) this.add_node(p);
|
|
1693
|
+
this.graph[conn.from].add(conn.to);
|
|
1694
|
+
this.graph[conn.to].add(conn.from);
|
|
1695
|
+
}
|
|
1696
|
+
get_connection_node_map() {
|
|
1697
|
+
return this.connection_node_map;
|
|
1698
|
+
}
|
|
1699
|
+
get_graph() {
|
|
1700
|
+
return this.graph;
|
|
1701
|
+
}
|
|
1702
|
+
get_schematics() {
|
|
1703
|
+
return this.schematics;
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
// src/tester/graph/connection_graphs_builder.ts
|
|
1708
|
+
var import_electronics_model10 = require("@modular-circuit/electronics-model");
|
|
1709
|
+
var import_utils3 = require("@modular-circuit/utils");
|
|
1710
|
+
|
|
1711
|
+
// src/utils/get_dependent_modules_definition.ts
|
|
1712
|
+
var import_ir2 = require("@modular-circuit/ir");
|
|
1713
|
+
var import_utils2 = require("@modular-circuit/utils");
|
|
1714
|
+
async function get_dependent_modules_definition(ctx) {
|
|
1715
|
+
const circuits = {};
|
|
1716
|
+
for (const [, v] of Object.entries(ctx.schematics)) {
|
|
1717
|
+
for (const block of v.blocks ?? []) {
|
|
1718
|
+
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
|
+
let def;
|
|
1720
|
+
if ((0, import_ir2.block_is_associated_with_concrete_module)(block.type)) {
|
|
1721
|
+
def = await ctx.module_resolver.get_module_circuit_by_id(block.type);
|
|
1722
|
+
} else if (ctx.dependencies) {
|
|
1723
|
+
const version = ctx.dependencies[module_name];
|
|
1724
|
+
if (version === void 0) {
|
|
1725
|
+
console.warn(`Module ${module_name} not found in dependencies`);
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
def = await ctx.module_resolver.get_module_circuit({ ...block.type, version });
|
|
1729
|
+
}
|
|
1730
|
+
if (def) circuits[module_name] = def;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
return circuits;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
// src/tester/graph/connection_graphs_builder.ts
|
|
1737
|
+
var ConnectionGraphsBuilder = class {
|
|
1738
|
+
constructor(connection_node_map) {
|
|
1739
|
+
this.connection_node_map = connection_node_map;
|
|
1740
|
+
this.net_count = 0;
|
|
1741
|
+
this.item_graphs = {};
|
|
1742
|
+
this.connection_graph = {
|
|
1743
|
+
subgraphs: []
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
end_visit_component(cc) {
|
|
1747
|
+
const sub_graph = {};
|
|
1748
|
+
sub_graph.is_global_pwr = false;
|
|
1749
|
+
sub_graph.is_isolated = cc.length < 2;
|
|
1750
|
+
const nodes = cc.map((id) => {
|
|
1751
|
+
this.item_graphs[id] = sub_graph;
|
|
1752
|
+
return this.connection_node_map[id];
|
|
1753
|
+
});
|
|
1754
|
+
sub_graph.nodes = nodes;
|
|
1755
|
+
this.resolve_net_drive(nodes, sub_graph);
|
|
1756
|
+
this.connection_graph.subgraphs.push(sub_graph);
|
|
1757
|
+
}
|
|
1758
|
+
resolve_net_drive(nodes, sub_graph) {
|
|
1759
|
+
const drivers = {
|
|
1760
|
+
[import_electronics_model10.PRIORITY.INVALID]: [],
|
|
1761
|
+
[import_electronics_model10.PRIORITY.NONE]: [],
|
|
1762
|
+
[import_electronics_model10.PRIORITY.PIN]: [],
|
|
1763
|
+
[import_electronics_model10.PRIORITY.SHEET_PIN]: [],
|
|
1764
|
+
[import_electronics_model10.PRIORITY.HIER_LABEL]: [],
|
|
1765
|
+
[import_electronics_model10.PRIORITY.LOCAL_LABEL]: [],
|
|
1766
|
+
[import_electronics_model10.PRIORITY.POWER_PIN]: [],
|
|
1767
|
+
[import_electronics_model10.PRIORITY.GLOBAL]: []
|
|
1768
|
+
};
|
|
1769
|
+
for (const node of nodes) {
|
|
1770
|
+
drivers[(0, import_electronics_model10.get_connection_node_priority)(node)] = drivers[(0, import_electronics_model10.get_connection_node_priority)(node)] || [];
|
|
1771
|
+
drivers[(0, import_electronics_model10.get_connection_node_priority)(node)].push(node);
|
|
1772
|
+
}
|
|
1773
|
+
sub_graph.name = (() => {
|
|
1774
|
+
for (const priority of [
|
|
1775
|
+
import_electronics_model10.PRIORITY.GLOBAL,
|
|
1776
|
+
import_electronics_model10.PRIORITY.POWER_PIN,
|
|
1777
|
+
import_electronics_model10.PRIORITY.LOCAL_LABEL,
|
|
1778
|
+
import_electronics_model10.PRIORITY.HIER_LABEL,
|
|
1779
|
+
import_electronics_model10.PRIORITY.SHEET_PIN,
|
|
1780
|
+
import_electronics_model10.PRIORITY.PIN
|
|
1781
|
+
]) {
|
|
1782
|
+
const driver_list = drivers[priority];
|
|
1783
|
+
if (driver_list.length) {
|
|
1784
|
+
switch (priority) {
|
|
1785
|
+
case import_electronics_model10.PRIORITY.POWER_PIN:
|
|
1786
|
+
case import_electronics_model10.PRIORITY.LOCAL_LABEL:
|
|
1787
|
+
switch (driver_list[0].type) {
|
|
1788
|
+
case import_electronics_model10.ConnectionNodeType.NetLabel:
|
|
1789
|
+
sub_graph.net_drivers = {
|
|
1790
|
+
primary_driver: driver_list[0].uuid,
|
|
1791
|
+
drivers: driver_list.map((d) => d.uuid)
|
|
1792
|
+
};
|
|
1793
|
+
return driver_list[0].text;
|
|
1794
|
+
case import_electronics_model10.ConnectionNodeType.Power:
|
|
1795
|
+
sub_graph.net_drivers = {
|
|
1796
|
+
primary_driver: driver_list[0].uuid,
|
|
1797
|
+
drivers: driver_list.map((d) => d.uuid)
|
|
1798
|
+
};
|
|
1799
|
+
sub_graph.is_global_pwr = true;
|
|
1800
|
+
return driver_list[0].value;
|
|
1801
|
+
}
|
|
1802
|
+
break;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return `Net-${this.net_count++}`;
|
|
1807
|
+
})();
|
|
1808
|
+
}
|
|
1809
|
+
get_connection_graph() {
|
|
1810
|
+
return this.connection_graph;
|
|
1811
|
+
}
|
|
1812
|
+
get_item_graphs() {
|
|
1813
|
+
return this.item_graphs;
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
async function build_connection_graph(ctx) {
|
|
1817
|
+
const converter = new IR_GRAPH_CONVERTER(await get_dependent_modules_definition(ctx));
|
|
1818
|
+
const res = converter.convert_to_graph(ctx.schematics);
|
|
1819
|
+
if (res !== true) throw new Error(`Failed to convert graph ${res.join(",")}`);
|
|
1820
|
+
const cc_builder = new ConnectionGraphsBuilder(converter.get_connection_node_map());
|
|
1821
|
+
(0, import_utils3.test_connected_components)(converter.get_graph(), [cc_builder]);
|
|
1822
|
+
return {
|
|
1823
|
+
...converter.get_report_context(),
|
|
1824
|
+
connection_graph: cc_builder.get_connection_graph(),
|
|
1825
|
+
item_graphs: cc_builder.get_item_graphs(),
|
|
1826
|
+
cg_schematics: converter.get_schematics()
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
// src/tester/graph/graph_erc.ts
|
|
1831
|
+
async function graph_ecr(ctx) {
|
|
1832
|
+
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 };
|
|
1838
|
+
}
|
|
1839
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1840
|
+
0 && (module.exports = {
|
|
1841
|
+
ConnectionGraphsBuilder,
|
|
1842
|
+
DEFAULT_ERC_SETTING,
|
|
1843
|
+
DEFAULT_PIN_MAP,
|
|
1844
|
+
DEFAULT_PP_ERROR_SEVERITY,
|
|
1845
|
+
DEFAULT_SEVERITY,
|
|
1846
|
+
DrivenPinTypes,
|
|
1847
|
+
DrivingPinTypes,
|
|
1848
|
+
ERCE_DRIVER_CONFLICT,
|
|
1849
|
+
ERCE_PIN_NOT_CONNECTED,
|
|
1850
|
+
ERCE_PIN_TO_PIN_ERROR,
|
|
1851
|
+
ERCE_T,
|
|
1852
|
+
ERCE_UNANNOTATED,
|
|
1853
|
+
ERC_SETTING,
|
|
1854
|
+
ERC_TESTER,
|
|
1855
|
+
IR_GRAPH_CONVERTER,
|
|
1856
|
+
MakerType,
|
|
1857
|
+
NetlistTester,
|
|
1858
|
+
PIN_COMPATIBILITY_MATRIX_TESTER,
|
|
1859
|
+
PIN_ERROR,
|
|
1860
|
+
PP_DUPLICATED_SOURCES,
|
|
1861
|
+
PP_ERROR,
|
|
1862
|
+
PP_ILLEGAL_CONNECTION,
|
|
1863
|
+
PP_IMPEDANCE_SIGNAL_INTEGRITY,
|
|
1864
|
+
PP_INAPPROPRIATE_FUNC,
|
|
1865
|
+
PP_INCOMPATIBLE_DIGITAL_THRESHOLDS,
|
|
1866
|
+
PP_INCOMPATIBLE_SIGNAL_LEVELS,
|
|
1867
|
+
PP_INCOMPATIBLE_VOLTAGE_LEVELS,
|
|
1868
|
+
PP_INSUFFICIENT_DRIVER,
|
|
1869
|
+
PP_NOT_DRIVEN,
|
|
1870
|
+
PP_OVERCURRENT,
|
|
1871
|
+
PP_OVER_DRIVEN,
|
|
1872
|
+
PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR,
|
|
1873
|
+
PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE,
|
|
1874
|
+
ParameterPropagationTester,
|
|
1875
|
+
PowerDrivingPinTypes,
|
|
1876
|
+
SEVERITY,
|
|
1877
|
+
build_connection_graph,
|
|
1878
|
+
fmt_erc_item_description,
|
|
1879
|
+
get_erc_severity,
|
|
1880
|
+
graph_ecr
|
|
1881
|
+
});
|