@modular-circuit/perc 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +48 -4
- package/dist/index.mjs +39 -5
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -164,6 +164,11 @@ declare const CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT: (bundle_id: string) => {
|
|
|
164
164
|
error_message: string;
|
|
165
165
|
eda_item_ids: string[];
|
|
166
166
|
};
|
|
167
|
+
declare const INVALID_INPUT: (eda_item_ids: string[], error_message: unknown) => {
|
|
168
|
+
error_code: PP_ERROR;
|
|
169
|
+
error_message: unknown;
|
|
170
|
+
eda_item_ids: string[];
|
|
171
|
+
};
|
|
167
172
|
|
|
168
173
|
interface REPORT_ITEM {
|
|
169
174
|
/**
|
|
@@ -173,7 +178,7 @@ interface REPORT_ITEM {
|
|
|
173
178
|
/**
|
|
174
179
|
* A message describing the details of this specific error
|
|
175
180
|
*/
|
|
176
|
-
error_message:
|
|
181
|
+
error_message: unknown;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
/**Token from KiCAD
|
|
@@ -331,7 +336,8 @@ declare enum PP_ERROR {
|
|
|
331
336
|
INCOMPATIBLE_DIGITAL_THRESHOLDS = "incompatible_digital_thresholds",
|
|
332
337
|
REQUIRES_CONNECTED_SOURCE_OR_BIDIR = "requires_connected_source_or_bidir",
|
|
333
338
|
ILLEGAL_CONNECTION = "Illegal_connection",
|
|
334
|
-
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit"
|
|
339
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit",
|
|
340
|
+
INVALID_INPUT = " INVALID_INPUT"
|
|
335
341
|
}
|
|
336
342
|
declare const DEFAULT_PP_ERROR_SEVERITY: Record<PP_ERROR, SEVERITY>;
|
|
337
343
|
|
|
@@ -495,4 +501,4 @@ declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
|
495
501
|
pin_module_name_table: Record<string, string>;
|
|
496
502
|
}>;
|
|
497
503
|
|
|
498
|
-
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
|
|
504
|
+
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, INVALID_INPUT, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,11 @@ declare const CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT: (bundle_id: string) => {
|
|
|
164
164
|
error_message: string;
|
|
165
165
|
eda_item_ids: string[];
|
|
166
166
|
};
|
|
167
|
+
declare const INVALID_INPUT: (eda_item_ids: string[], error_message: unknown) => {
|
|
168
|
+
error_code: PP_ERROR;
|
|
169
|
+
error_message: unknown;
|
|
170
|
+
eda_item_ids: string[];
|
|
171
|
+
};
|
|
167
172
|
|
|
168
173
|
interface REPORT_ITEM {
|
|
169
174
|
/**
|
|
@@ -173,7 +178,7 @@ interface REPORT_ITEM {
|
|
|
173
178
|
/**
|
|
174
179
|
* A message describing the details of this specific error
|
|
175
180
|
*/
|
|
176
|
-
error_message:
|
|
181
|
+
error_message: unknown;
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
/**Token from KiCAD
|
|
@@ -331,7 +336,8 @@ declare enum PP_ERROR {
|
|
|
331
336
|
INCOMPATIBLE_DIGITAL_THRESHOLDS = "incompatible_digital_thresholds",
|
|
332
337
|
REQUIRES_CONNECTED_SOURCE_OR_BIDIR = "requires_connected_source_or_bidir",
|
|
333
338
|
ILLEGAL_CONNECTION = "Illegal_connection",
|
|
334
|
-
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit"
|
|
339
|
+
CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = "connection_count_exceeds_bundle_limit",
|
|
340
|
+
INVALID_INPUT = " INVALID_INPUT"
|
|
335
341
|
}
|
|
336
342
|
declare const DEFAULT_PP_ERROR_SEVERITY: Record<PP_ERROR, SEVERITY>;
|
|
337
343
|
|
|
@@ -495,4 +501,4 @@ declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
|
|
|
495
501
|
pin_module_name_table: Record<string, string>;
|
|
496
502
|
}>;
|
|
497
503
|
|
|
498
|
-
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
|
|
504
|
+
export { type ADT_AdjacencyList, type ADT_Graph, type BundleInfo, type CG_SCHEMATIC, CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT, type CONNECTION_GRAPH_BUILDER_CTX, ConnectionGraphsBuilder, DEFAULT_ERC_SETTING, DEFAULT_PIN_MAP, DEFAULT_PP_ERROR_SEVERITY, DEFAULT_SEVERITY, DrivenPinTypes, DrivingPinTypes, ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED, ERCE_PIN_TO_PIN_ERROR, ERCE_T, ERCE_UNANNOTATED, type ERC_CONTEXT, type ERC_INPUT, type ERC_ITEM, type ERC_REPORT, type ERC_REPORTER_CONTEXT, ERC_SETTING, ERC_TESTER, type GRAPH_CONVERTER, INVALID_INPUT, IR_GRAPH_CONVERTER, MakerType, type MarkerBase, NetlistTester, PIN_COMPATIBILITY_MATRIX_TESTER, PIN_ERROR, type PIN_TO_PIN_TEST_CONTEXT, PP_DUPLICATED_SOURCES, PP_ERROR, PP_ILLEGAL_CONNECTION, PP_IMPEDANCE_SIGNAL_INTEGRITY, PP_INAPPROPRIATE_FUNC, PP_INCOMPATIBLE_DIGITAL_THRESHOLDS, PP_INCOMPATIBLE_SIGNAL_LEVELS, PP_INCOMPATIBLE_VOLTAGE_LEVELS, PP_INSUFFICIENT_DRIVER, PP_NOT_DRIVEN, PP_OVERCURRENT, PP_OVER_DRIVEN, PP_REQUIRES_CONNECTED_SOURCE_OR_BIDIR, PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE, type ParameterPropagationTestContext, ParameterPropagationTester, PowerDrivingPinTypes, type RC_ITEM, type REPORT_ITEM, type SCH_ERC_ITEM, type SCH_MARKER, SEVERITY, build_connection_graph, fmt_erc_item_description, get_erc_severity, graph_ecr };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -35,6 +45,7 @@ __export(index_exports, {
|
|
|
35
45
|
ERCE_UNANNOTATED: () => ERCE_UNANNOTATED,
|
|
36
46
|
ERC_SETTING: () => ERC_SETTING,
|
|
37
47
|
ERC_TESTER: () => ERC_TESTER,
|
|
48
|
+
INVALID_INPUT: () => INVALID_INPUT,
|
|
38
49
|
IR_GRAPH_CONVERTER: () => IR_GRAPH_CONVERTER,
|
|
39
50
|
MakerType: () => MakerType,
|
|
40
51
|
NetlistTester: () => NetlistTester,
|
|
@@ -123,6 +134,7 @@ var PP_ERROR = /* @__PURE__ */ ((PP_ERROR2) => {
|
|
|
123
134
|
PP_ERROR2["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
|
|
124
135
|
PP_ERROR2["ILLEGAL_CONNECTION"] = "Illegal_connection";
|
|
125
136
|
PP_ERROR2["CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT"] = "connection_count_exceeds_bundle_limit";
|
|
137
|
+
PP_ERROR2["INVALID_INPUT"] = " INVALID_INPUT";
|
|
126
138
|
return PP_ERROR2;
|
|
127
139
|
})(PP_ERROR || {});
|
|
128
140
|
var DEFAULT_PP_ERROR_SEVERITY = {
|
|
@@ -157,11 +169,13 @@ var DEFAULT_PP_ERROR_SEVERITY = {
|
|
|
157
169
|
["incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
158
170
|
["requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
159
171
|
["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
160
|
-
["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR
|
|
172
|
+
["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
173
|
+
[" INVALID_INPUT" /* INVALID_INPUT */]: 16 /* RPT_SEVERITY_WARNING */
|
|
161
174
|
};
|
|
162
175
|
|
|
163
176
|
// src/erc/parameter_propagation/tester.ts
|
|
164
177
|
var import_electronics_model4 = require("@modular-circuit/electronics-model");
|
|
178
|
+
var z = __toESM(require("zod"));
|
|
165
179
|
|
|
166
180
|
// src/report/erc_report.ts
|
|
167
181
|
function fmt_erc_item_description(id, ctx) {
|
|
@@ -268,6 +282,13 @@ var CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = (bundle_id) => ({
|
|
|
268
282
|
error_message: "Connections count exceeds bundle limit.",
|
|
269
283
|
eda_item_ids: [bundle_id]
|
|
270
284
|
});
|
|
285
|
+
var INVALID_INPUT = (eda_item_ids, error_message) => {
|
|
286
|
+
return {
|
|
287
|
+
error_code: " INVALID_INPUT" /* INVALID_INPUT */,
|
|
288
|
+
error_message,
|
|
289
|
+
eda_item_ids
|
|
290
|
+
};
|
|
291
|
+
};
|
|
271
292
|
|
|
272
293
|
// src/erc/parameter_propagation/link_testers/tester_impl.ts
|
|
273
294
|
var import_electronics_model3 = require("@modular-circuit/electronics-model");
|
|
@@ -362,7 +383,7 @@ var AnalogLinkTester = class extends LinkTesterBase {
|
|
|
362
383
|
}
|
|
363
384
|
}
|
|
364
385
|
}
|
|
365
|
-
if ((0, import_electronics_model3.all_range_are_defined)(source.signal_out, source.voltage_out)) {
|
|
386
|
+
if (source.voltage_out && source.signal_out && (0, import_electronics_model3.all_range_are_defined)(source.signal_out, source.voltage_out)) {
|
|
366
387
|
if (!(0, import_electronics_model3.interests)(source.voltage_out, source.signal_out)) {
|
|
367
388
|
this.ctx.report.erc_errors.push(PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE(source_id));
|
|
368
389
|
}
|
|
@@ -655,7 +676,7 @@ var CrystalLinkTester = class extends CompositePortLinkTesterBase {
|
|
|
655
676
|
if (!this.link) return;
|
|
656
677
|
const driver = this.link.driver;
|
|
657
678
|
const crystal = this.link.crystal;
|
|
658
|
-
if ((0, import_electronics_model3.all_range_are_defined)(driver.frequency_limits, crystal.frequency)) {
|
|
679
|
+
if (driver.frequency_limits && crystal.frequency && (0, import_electronics_model3.all_range_are_defined)(driver.frequency_limits, crystal.frequency)) {
|
|
659
680
|
if (!(0, import_electronics_model3.contains)(driver.frequency_limits, crystal.frequency)) {
|
|
660
681
|
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Frequency out of range"));
|
|
661
682
|
}
|
|
@@ -1153,13 +1174,35 @@ var ParameterPropagationTester = class {
|
|
|
1153
1174
|
this.has_passive_port = false;
|
|
1154
1175
|
}
|
|
1155
1176
|
run_test(CtorClass, ports) {
|
|
1177
|
+
const valid_ports = [];
|
|
1178
|
+
for (const p of ports) {
|
|
1179
|
+
const id = this.port_id.get(p);
|
|
1180
|
+
try {
|
|
1181
|
+
const zod_schema = (0, import_electronics_model4.get_port_schema)(p);
|
|
1182
|
+
if (!zod_schema) {
|
|
1183
|
+
this.ctx.report.erc_errors.push(INVALID_INPUT(id ? [id] : [], `Unknown port type in ${JSON.stringify(p)}`));
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
valid_ports.push(zod_schema.parse(p));
|
|
1187
|
+
} catch (err) {
|
|
1188
|
+
if (err instanceof z.ZodError) {
|
|
1189
|
+
this.ctx.report.erc_errors.push(
|
|
1190
|
+
INVALID_INPUT(id ? [id] : [], {
|
|
1191
|
+
input: p,
|
|
1192
|
+
issues: err.issues
|
|
1193
|
+
})
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
if (!valid_ports.length) return;
|
|
1156
1199
|
return new CtorClass(
|
|
1157
1200
|
{
|
|
1158
1201
|
report: this.ctx.report,
|
|
1159
1202
|
port_id: this.port_id,
|
|
1160
1203
|
has_passive_port: this.has_passive_port
|
|
1161
1204
|
},
|
|
1162
|
-
|
|
1205
|
+
valid_ports
|
|
1163
1206
|
).test();
|
|
1164
1207
|
}
|
|
1165
1208
|
visit_cc(cc) {
|
|
@@ -1964,6 +2007,7 @@ async function graph_ecr(ctx) {
|
|
|
1964
2007
|
ERCE_UNANNOTATED,
|
|
1965
2008
|
ERC_SETTING,
|
|
1966
2009
|
ERC_TESTER,
|
|
2010
|
+
INVALID_INPUT,
|
|
1967
2011
|
IR_GRAPH_CONVERTER,
|
|
1968
2012
|
MakerType,
|
|
1969
2013
|
NetlistTester,
|
package/dist/index.mjs
CHANGED
|
@@ -57,6 +57,7 @@ var PP_ERROR = /* @__PURE__ */ ((PP_ERROR2) => {
|
|
|
57
57
|
PP_ERROR2["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
|
|
58
58
|
PP_ERROR2["ILLEGAL_CONNECTION"] = "Illegal_connection";
|
|
59
59
|
PP_ERROR2["CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT"] = "connection_count_exceeds_bundle_limit";
|
|
60
|
+
PP_ERROR2["INVALID_INPUT"] = " INVALID_INPUT";
|
|
60
61
|
return PP_ERROR2;
|
|
61
62
|
})(PP_ERROR || {});
|
|
62
63
|
var DEFAULT_PP_ERROR_SEVERITY = {
|
|
@@ -91,7 +92,8 @@ var DEFAULT_PP_ERROR_SEVERITY = {
|
|
|
91
92
|
["incompatible_digital_thresholds" /* INCOMPATIBLE_DIGITAL_THRESHOLDS */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
92
93
|
["requires_connected_source_or_bidir" /* REQUIRES_CONNECTED_SOURCE_OR_BIDIR */]: 16 /* RPT_SEVERITY_WARNING */,
|
|
93
94
|
["Illegal_connection" /* ILLEGAL_CONNECTION */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
94
|
-
["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR
|
|
95
|
+
["connection_count_exceeds_bundle_limit" /* CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT */]: 32 /* RPT_SEVERITY_ERROR */,
|
|
96
|
+
[" INVALID_INPUT" /* INVALID_INPUT */]: 16 /* RPT_SEVERITY_WARNING */
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
// src/erc/parameter_propagation/tester.ts
|
|
@@ -100,8 +102,10 @@ import {
|
|
|
100
102
|
LinkType,
|
|
101
103
|
PortType as PortType2,
|
|
102
104
|
gen_link_map,
|
|
103
|
-
get_port_link_type
|
|
105
|
+
get_port_link_type,
|
|
106
|
+
get_port_schema
|
|
104
107
|
} from "@modular-circuit/electronics-model";
|
|
108
|
+
import * as z from "zod";
|
|
105
109
|
|
|
106
110
|
// src/report/erc_report.ts
|
|
107
111
|
function fmt_erc_item_description(id, ctx) {
|
|
@@ -208,6 +212,13 @@ var CONNECTIONS_COUNT_EXCEEDS_BUNDLE_LIMIT = (bundle_id) => ({
|
|
|
208
212
|
error_message: "Connections count exceeds bundle limit.",
|
|
209
213
|
eda_item_ids: [bundle_id]
|
|
210
214
|
});
|
|
215
|
+
var INVALID_INPUT = (eda_item_ids, error_message) => {
|
|
216
|
+
return {
|
|
217
|
+
error_code: " INVALID_INPUT" /* INVALID_INPUT */,
|
|
218
|
+
error_message,
|
|
219
|
+
eda_item_ids
|
|
220
|
+
};
|
|
221
|
+
};
|
|
211
222
|
|
|
212
223
|
// src/erc/parameter_propagation/link_testers/tester_impl.ts
|
|
213
224
|
import {
|
|
@@ -313,7 +324,7 @@ var AnalogLinkTester = class extends LinkTesterBase {
|
|
|
313
324
|
}
|
|
314
325
|
}
|
|
315
326
|
}
|
|
316
|
-
if (all_range_are_defined(source.signal_out, source.voltage_out)) {
|
|
327
|
+
if (source.voltage_out && source.signal_out && all_range_are_defined(source.signal_out, source.voltage_out)) {
|
|
317
328
|
if (!interests(source.voltage_out, source.signal_out)) {
|
|
318
329
|
this.ctx.report.erc_errors.push(PP_SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE(source_id));
|
|
319
330
|
}
|
|
@@ -606,7 +617,7 @@ var CrystalLinkTester = class extends CompositePortLinkTesterBase {
|
|
|
606
617
|
if (!this.link) return;
|
|
607
618
|
const driver = this.link.driver;
|
|
608
619
|
const crystal = this.link.crystal;
|
|
609
|
-
if (all_range_are_defined(driver.frequency_limits, crystal.frequency)) {
|
|
620
|
+
if (driver.frequency_limits && crystal.frequency && all_range_are_defined(driver.frequency_limits, crystal.frequency)) {
|
|
610
621
|
if (!contains(driver.frequency_limits, crystal.frequency)) {
|
|
611
622
|
this.ctx.report.erc_errors.push(PP_ILLEGAL_CONNECTION(this.all_port_ids, "Frequency out of range"));
|
|
612
623
|
}
|
|
@@ -1104,13 +1115,35 @@ var ParameterPropagationTester = class {
|
|
|
1104
1115
|
this.has_passive_port = false;
|
|
1105
1116
|
}
|
|
1106
1117
|
run_test(CtorClass, ports) {
|
|
1118
|
+
const valid_ports = [];
|
|
1119
|
+
for (const p of ports) {
|
|
1120
|
+
const id = this.port_id.get(p);
|
|
1121
|
+
try {
|
|
1122
|
+
const zod_schema = get_port_schema(p);
|
|
1123
|
+
if (!zod_schema) {
|
|
1124
|
+
this.ctx.report.erc_errors.push(INVALID_INPUT(id ? [id] : [], `Unknown port type in ${JSON.stringify(p)}`));
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
valid_ports.push(zod_schema.parse(p));
|
|
1128
|
+
} catch (err) {
|
|
1129
|
+
if (err instanceof z.ZodError) {
|
|
1130
|
+
this.ctx.report.erc_errors.push(
|
|
1131
|
+
INVALID_INPUT(id ? [id] : [], {
|
|
1132
|
+
input: p,
|
|
1133
|
+
issues: err.issues
|
|
1134
|
+
})
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
if (!valid_ports.length) return;
|
|
1107
1140
|
return new CtorClass(
|
|
1108
1141
|
{
|
|
1109
1142
|
report: this.ctx.report,
|
|
1110
1143
|
port_id: this.port_id,
|
|
1111
1144
|
has_passive_port: this.has_passive_port
|
|
1112
1145
|
},
|
|
1113
|
-
|
|
1146
|
+
valid_ports
|
|
1114
1147
|
).test();
|
|
1115
1148
|
}
|
|
1116
1149
|
visit_cc(cc) {
|
|
@@ -1940,6 +1973,7 @@ export {
|
|
|
1940
1973
|
ERCE_UNANNOTATED,
|
|
1941
1974
|
ERC_SETTING,
|
|
1942
1975
|
ERC_TESTER,
|
|
1976
|
+
INVALID_INPUT,
|
|
1943
1977
|
IR_GRAPH_CONVERTER,
|
|
1944
1978
|
MakerType,
|
|
1945
1979
|
NetlistTester,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/perc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Programmable Electronic Circuit Check",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
"typescript": "^5.4.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"
|
|
30
|
-
"@modular-circuit/
|
|
31
|
-
"@modular-circuit/
|
|
29
|
+
"zod": "^4.3.6",
|
|
30
|
+
"@modular-circuit/electronics-model": "0.2.2",
|
|
31
|
+
"@modular-circuit/ir": "0.2.1",
|
|
32
|
+
"@modular-circuit/utils": "0.2.1"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"clean": "rimraf dist",
|