@modular-circuit/perc 0.0.51

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.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -0
  3. package/build/erc/connect_graph_visitor/index.d.ts +2 -0
  4. package/build/erc/connect_graph_visitor/index.d.ts.map +1 -0
  5. package/build/erc/connect_graph_visitor/index.js +1 -0
  6. package/build/erc/connect_graph_visitor/visitor.d.ts +5 -0
  7. package/build/erc/connect_graph_visitor/visitor.d.ts.map +1 -0
  8. package/build/erc/connect_graph_visitor/visitor.js +0 -0
  9. package/build/erc/context/connection_graph_builder_ctx.d.ts +7 -0
  10. package/build/erc/context/connection_graph_builder_ctx.d.ts.map +1 -0
  11. package/build/erc/context/connection_graph_builder_ctx.js +0 -0
  12. package/build/erc/context/error_severity.d.ts +11 -0
  13. package/build/erc/context/error_severity.d.ts.map +1 -0
  14. package/build/erc/context/error_severity.js +13 -0
  15. package/build/erc/context/graph.d.ts +3 -0
  16. package/build/erc/context/graph.d.ts.map +1 -0
  17. package/build/erc/context/graph.js +0 -0
  18. package/build/erc/context/graph_converter.d.ts +8 -0
  19. package/build/erc/context/graph_converter.d.ts.map +1 -0
  20. package/build/erc/context/graph_converter.js +0 -0
  21. package/build/erc/context/index.d.ts +6 -0
  22. package/build/erc/context/index.d.ts.map +1 -0
  23. package/build/erc/context/index.js +5 -0
  24. package/build/erc/context/pin_to_pin_test_ctx.d.ts +7 -0
  25. package/build/erc/context/pin_to_pin_test_ctx.d.ts.map +1 -0
  26. package/build/erc/context/pin_to_pin_test_ctx.js +0 -0
  27. package/build/erc/index.d.ts +5 -0
  28. package/build/erc/index.d.ts.map +1 -0
  29. package/build/erc/index.js +4 -0
  30. package/build/erc/netlist/constraints.d.ts +5 -0
  31. package/build/erc/netlist/constraints.d.ts.map +1 -0
  32. package/build/erc/netlist/constraints.js +30 -0
  33. package/build/erc/netlist/index.d.ts +3 -0
  34. package/build/erc/netlist/index.d.ts.map +1 -0
  35. package/build/erc/netlist/index.js +2 -0
  36. package/build/erc/netlist/tester.d.ts +10 -0
  37. package/build/erc/netlist/tester.d.ts.map +1 -0
  38. package/build/erc/netlist/tester.js +67 -0
  39. package/build/erc/parameter_propagation/error_code.d.ts +41 -0
  40. package/build/erc/parameter_propagation/error_code.d.ts.map +1 -0
  41. package/build/erc/parameter_propagation/error_code.js +74 -0
  42. package/build/erc/parameter_propagation/index.d.ts +3 -0
  43. package/build/erc/parameter_propagation/index.d.ts.map +1 -0
  44. package/build/erc/parameter_propagation/index.js +2 -0
  45. package/build/erc/parameter_propagation/link_testers/index.d.ts +2 -0
  46. package/build/erc/parameter_propagation/link_testers/index.d.ts.map +1 -0
  47. package/build/erc/parameter_propagation/link_testers/index.js +1 -0
  48. package/build/erc/parameter_propagation/link_testers/link_tester_base.d.ts +23 -0
  49. package/build/erc/parameter_propagation/link_testers/link_tester_base.d.ts.map +1 -0
  50. package/build/erc/parameter_propagation/link_testers/link_tester_base.js +112 -0
  51. package/build/erc/parameter_propagation/link_testers/tester_impl.d.ts +247 -0
  52. package/build/erc/parameter_propagation/link_testers/tester_impl.d.ts.map +1 -0
  53. package/build/erc/parameter_propagation/link_testers/tester_impl.js +1456 -0
  54. package/build/erc/parameter_propagation/tester.d.ts +16 -0
  55. package/build/erc/parameter_propagation/tester.d.ts.map +1 -0
  56. package/build/erc/parameter_propagation/tester.js +215 -0
  57. package/build/erc/pin_compatibility_matrix/erc_setting.d.ts +29 -0
  58. package/build/erc/pin_compatibility_matrix/erc_setting.d.ts.map +1 -0
  59. package/build/erc/pin_compatibility_matrix/erc_setting.js +110 -0
  60. package/build/erc/pin_compatibility_matrix/error_code.d.ts +55 -0
  61. package/build/erc/pin_compatibility_matrix/error_code.d.ts.map +1 -0
  62. package/build/erc/pin_compatibility_matrix/error_code.js +56 -0
  63. package/build/erc/pin_compatibility_matrix/index.d.ts +5 -0
  64. package/build/erc/pin_compatibility_matrix/index.d.ts.map +1 -0
  65. package/build/erc/pin_compatibility_matrix/index.js +4 -0
  66. package/build/erc/pin_compatibility_matrix/pin_error.d.ts +7 -0
  67. package/build/erc/pin_compatibility_matrix/pin_error.d.ts.map +1 -0
  68. package/build/erc/pin_compatibility_matrix/pin_error.js +7 -0
  69. package/build/erc/pin_compatibility_matrix/tester.d.ts +9 -0
  70. package/build/erc/pin_compatibility_matrix/tester.d.ts.map +1 -0
  71. package/build/erc/pin_compatibility_matrix/tester.js +23 -0
  72. package/build/graphics/index.d.ts +3 -0
  73. package/build/graphics/index.d.ts.map +1 -0
  74. package/build/graphics/index.js +2 -0
  75. package/build/graphics/maker/index.d.ts +4 -0
  76. package/build/graphics/maker/index.d.ts.map +1 -0
  77. package/build/graphics/maker/index.js +3 -0
  78. package/build/graphics/maker/maker_base.d.ts +35 -0
  79. package/build/graphics/maker/maker_base.d.ts.map +1 -0
  80. package/build/graphics/maker/maker_base.js +0 -0
  81. package/build/graphics/maker/maker_type.d.ts +10 -0
  82. package/build/graphics/maker/maker_type.d.ts.map +1 -0
  83. package/build/graphics/maker/maker_type.js +10 -0
  84. package/build/graphics/maker/sch_maker.d.ts +5 -0
  85. package/build/graphics/maker/sch_maker.d.ts.map +1 -0
  86. package/build/graphics/maker/sch_maker.js +0 -0
  87. package/build/graphics/sch_erc_item.d.ts +28 -0
  88. package/build/graphics/sch_erc_item.d.ts.map +1 -0
  89. package/build/graphics/sch_erc_item.js +0 -0
  90. package/build/index.d.ts +6 -0
  91. package/build/index.d.ts.map +1 -0
  92. package/build/index.js +5 -0
  93. package/build/report/erc_report.d.ts +16 -0
  94. package/build/report/erc_report.d.ts.map +1 -0
  95. package/build/report/erc_report.js +16 -0
  96. package/build/report/erc_reporter.d.ts +88 -0
  97. package/build/report/erc_reporter.d.ts.map +1 -0
  98. package/build/report/erc_reporter.js +87 -0
  99. package/build/report/index.d.ts +3 -0
  100. package/build/report/index.d.ts.map +1 -0
  101. package/build/report/index.js +2 -0
  102. package/build/rule_check_item/erc_item.d.ts +4 -0
  103. package/build/rule_check_item/erc_item.d.ts.map +1 -0
  104. package/build/rule_check_item/erc_item.js +0 -0
  105. package/build/rule_check_item/index.d.ts +3 -0
  106. package/build/rule_check_item/index.d.ts.map +1 -0
  107. package/build/rule_check_item/index.js +2 -0
  108. package/build/rule_check_item/rc_item.d.ts +33 -0
  109. package/build/rule_check_item/rc_item.d.ts.map +1 -0
  110. package/build/rule_check_item/rc_item.js +0 -0
  111. package/build/tester/erc_tester.d.ts +18 -0
  112. package/build/tester/erc_tester.d.ts.map +1 -0
  113. package/build/tester/erc_tester.js +66 -0
  114. package/build/tester/graph/connection_graphs_builder.d.ts +22 -0
  115. package/build/tester/graph/connection_graphs_builder.d.ts.map +1 -0
  116. package/build/tester/graph/connection_graphs_builder.js +187 -0
  117. package/build/tester/graph/graph_erc.d.ts +16 -0
  118. package/build/tester/graph/graph_erc.d.ts.map +1 -0
  119. package/build/tester/graph/graph_erc.js +63 -0
  120. package/build/tester/graph/index.d.ts +4 -0
  121. package/build/tester/graph/index.d.ts.map +1 -0
  122. package/build/tester/graph/index.js +3 -0
  123. package/build/tester/graph/ir_graph_converter.d.ts +30 -0
  124. package/build/tester/graph/ir_graph_converter.d.ts.map +1 -0
  125. package/build/tester/graph/ir_graph_converter.js +279 -0
  126. package/build/tester/index.d.ts +3 -0
  127. package/build/tester/index.d.ts.map +1 -0
  128. package/build/tester/index.js +2 -0
  129. package/build/tsconfig.build.tsbuildinfo +1 -0
  130. package/build/utils/get_dependent_modules_definition.d.ts +4 -0
  131. package/build/utils/get_dependent_modules_definition.d.ts.map +1 -0
  132. package/build/utils/get_dependent_modules_definition.js +145 -0
  133. package/build/utils/index.d.ts +2 -0
  134. package/build/utils/index.d.ts.map +1 -0
  135. package/build/utils/index.js +1 -0
  136. package/package.json +39 -0
@@ -0,0 +1,187 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __values = (this && this.__values) || function(o) {
49
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
50
+ if (m) return m.call(o);
51
+ if (o && typeof o.length === "number") return {
52
+ next: function () {
53
+ if (o && i >= o.length) o = void 0;
54
+ return { value: o && o[i++], done: !o };
55
+ }
56
+ };
57
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
58
+ };
59
+ import { ConnectionNodeType, PRIORITY, get_connection_node_priority, } from '@modular-circuit/electronics-model';
60
+ import { test_connected_components } from '@modular-circuit/utils';
61
+ import { get_dependent_modules_definition } from '../../utils';
62
+ import { IR_GRAPH_CONVERTER } from './ir_graph_converter';
63
+ var ConnectionGraphsBuilder = /** @class */ (function () {
64
+ function ConnectionGraphsBuilder(connection_node_map) {
65
+ this.connection_node_map = connection_node_map;
66
+ this.net_count = 0;
67
+ this.item_graphs = {};
68
+ this.connection_graph = {
69
+ subgraphs: [],
70
+ };
71
+ }
72
+ ConnectionGraphsBuilder.prototype.end_visit_component = function (cc) {
73
+ var _this = this;
74
+ var sub_graph = {};
75
+ sub_graph.is_global_pwr = false;
76
+ sub_graph.is_isolated = cc.length < 2;
77
+ var nodes = cc.map(function (id) {
78
+ _this.item_graphs[id] = sub_graph;
79
+ return _this.connection_node_map[id];
80
+ });
81
+ sub_graph.nodes = nodes;
82
+ this.resolve_net_drive(nodes, sub_graph);
83
+ this.connection_graph.subgraphs.push(sub_graph);
84
+ };
85
+ ConnectionGraphsBuilder.prototype.resolve_net_drive = function (nodes, sub_graph) {
86
+ var _a, e_1, _b;
87
+ var _this = this;
88
+ var drivers = (_a = {},
89
+ _a[PRIORITY.INVALID] = [],
90
+ _a[PRIORITY.NONE] = [],
91
+ _a[PRIORITY.PIN] = [],
92
+ _a[PRIORITY.SHEET_PIN] = [],
93
+ _a[PRIORITY.HIER_LABEL] = [],
94
+ _a[PRIORITY.LOCAL_LABEL] = [],
95
+ _a[PRIORITY.POWER_PIN] = [],
96
+ _a[PRIORITY.GLOBAL] = [],
97
+ _a);
98
+ try {
99
+ for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
100
+ var node = nodes_1_1.value;
101
+ drivers[get_connection_node_priority(node)] = drivers[get_connection_node_priority(node)] || [];
102
+ drivers[get_connection_node_priority(node)].push(node);
103
+ }
104
+ }
105
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
106
+ finally {
107
+ try {
108
+ if (nodes_1_1 && !nodes_1_1.done && (_b = nodes_1.return)) _b.call(nodes_1);
109
+ }
110
+ finally { if (e_1) throw e_1.error; }
111
+ }
112
+ sub_graph.name = (function () {
113
+ var e_2, _a;
114
+ try {
115
+ for (var _b = __values([
116
+ PRIORITY.GLOBAL,
117
+ PRIORITY.POWER_PIN,
118
+ PRIORITY.LOCAL_LABEL,
119
+ PRIORITY.HIER_LABEL,
120
+ PRIORITY.SHEET_PIN,
121
+ PRIORITY.PIN,
122
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
123
+ var priority = _c.value;
124
+ var driver_list = drivers[priority];
125
+ if (driver_list.length) {
126
+ switch (priority) {
127
+ case PRIORITY.POWER_PIN:
128
+ case PRIORITY.LOCAL_LABEL:
129
+ switch (driver_list[0].type) {
130
+ case ConnectionNodeType.NetLabel:
131
+ sub_graph.net_drivers = {
132
+ primary_driver: driver_list[0].uuid,
133
+ drivers: driver_list.map(function (d) { return d.uuid; }),
134
+ };
135
+ return driver_list[0].text;
136
+ case ConnectionNodeType.Power:
137
+ sub_graph.net_drivers = {
138
+ primary_driver: driver_list[0].uuid,
139
+ drivers: driver_list.map(function (d) { return d.uuid; }),
140
+ };
141
+ sub_graph.is_global_pwr = true;
142
+ return driver_list[0].value;
143
+ }
144
+ break;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
150
+ finally {
151
+ try {
152
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
153
+ }
154
+ finally { if (e_2) throw e_2.error; }
155
+ }
156
+ return "Net-".concat(_this.net_count++);
157
+ })();
158
+ };
159
+ ConnectionGraphsBuilder.prototype.get_connection_graph = function () {
160
+ return this.connection_graph;
161
+ };
162
+ ConnectionGraphsBuilder.prototype.get_item_graphs = function () {
163
+ return this.item_graphs;
164
+ };
165
+ return ConnectionGraphsBuilder;
166
+ }());
167
+ export { ConnectionGraphsBuilder };
168
+ export function build_connection_graph(ctx) {
169
+ return __awaiter(this, void 0, void 0, function () {
170
+ var converter, _a, res, cc_builder;
171
+ return __generator(this, function (_b) {
172
+ switch (_b.label) {
173
+ case 0:
174
+ _a = IR_GRAPH_CONVERTER.bind;
175
+ return [4 /*yield*/, get_dependent_modules_definition(ctx)];
176
+ case 1:
177
+ converter = new (_a.apply(IR_GRAPH_CONVERTER, [void 0, _b.sent()]))();
178
+ res = converter.convert_to_graph(ctx.schematics);
179
+ if (res !== true)
180
+ throw new Error("Failed to convert graph ".concat(res.join(',')));
181
+ cc_builder = new ConnectionGraphsBuilder(converter.get_connection_node_map());
182
+ test_connected_components(converter.get_graph(), [cc_builder]);
183
+ return [2 /*return*/, __assign(__assign({}, converter.get_report_context()), { connection_graph: cc_builder.get_connection_graph(), item_graphs: cc_builder.get_item_graphs(), cg_schematics: converter.get_schematics() })];
184
+ }
185
+ });
186
+ });
187
+ }
@@ -0,0 +1,16 @@
1
+ import type { IR_Graph } from '@modular-circuit/ir';
2
+ import type { CONNECTION_GRAPH_BUILDER_CTX } from '../../erc';
3
+ import { type ERC_CONTEXT } from '../erc_tester';
4
+ export type ERC_INPUT = CONNECTION_GRAPH_BUILDER_CTX & ERC_CONTEXT;
5
+ export declare function graph_ecr(ctx: Omit<ERC_INPUT, 'schematics'> & {
6
+ schematics: Record<string, IR_Graph>;
7
+ }): Promise<{
8
+ connection_graph: import("@modular-circuit/electronics-model").ConnectionGraph;
9
+ item_graphs: Record<string, import("@modular-circuit/electronics-model").ConnectionSubgraph>;
10
+ cg_schematics: Record<string, import("./ir_graph_converter").CG_SCHEMATIC>;
11
+ pin_name_table: Record<string, string>;
12
+ pin_module_name_table: Record<string, string>;
13
+ markers: import("../..").SCH_MARKER[];
14
+ erc_errors: import("../..").SCH_ERC_ITEM[];
15
+ }>;
16
+ //# sourceMappingURL=graph_erc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph_erc.d.ts","sourceRoot":"","sources":["../../../src/tester/graph/graph_erc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,eAAe,CAAA;AAG5D,MAAM,MAAM,SAAS,GAAG,4BAA4B,GAAG,WAAW,CAAA;AAElE,wBAAsB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAAE;;;;;;;;GAW5G"}
@@ -0,0 +1,63 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { ERC_TESTER } from '../erc_tester';
49
+ import { build_connection_graph } from './connection_graphs_builder';
50
+ export function graph_ecr(ctx) {
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var connection_graph, tester;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0: return [4 /*yield*/, build_connection_graph(ctx)];
56
+ case 1:
57
+ connection_graph = _a.sent();
58
+ tester = new ERC_TESTER(__assign(__assign({}, ctx), { connection_graph: connection_graph.connection_graph }));
59
+ return [2 /*return*/, __assign(__assign({}, tester.run_test()), connection_graph)];
60
+ }
61
+ });
62
+ });
63
+ }
@@ -0,0 +1,4 @@
1
+ export * from './ir_graph_converter';
2
+ export * from './connection_graphs_builder';
3
+ export * from './graph_erc';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tester/graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './ir_graph_converter';
2
+ export * from './connection_graphs_builder';
3
+ export * from './graph_erc';
@@ -0,0 +1,30 @@
1
+ import { type Connection, type PowerSymbolPort } from '@modular-circuit/electronics-model';
2
+ import { type CG_SHEET, type ConnectionNodeMap, type NL_PowerSymbol, PowerShape } from '@modular-circuit/electronics-model';
3
+ import type { IR_Graph, ModuleCircuit } from '@modular-circuit/ir';
4
+ import type { PowerBase } from '@modular-circuit/ir/build/graph/pwr_base';
5
+ import type { ADT_Graph } from '../../erc/context/graph';
6
+ import type { GRAPH_CONVERTER } from '../../erc/context/graph_converter';
7
+ import type { ERC_REPORTER_CONTEXT } from '../../report';
8
+ export interface CG_SCHEMATIC {
9
+ uuid: string;
10
+ sheets: CG_SHEET[];
11
+ powers: NL_PowerSymbol[];
12
+ }
13
+ export declare class IR_GRAPH_CONVERTER implements GRAPH_CONVERTER {
14
+ private readonly circuits;
15
+ private graph;
16
+ private connection_node_map;
17
+ private schematics;
18
+ private reporter_context;
19
+ get_report_context(): ERC_REPORTER_CONTEXT;
20
+ constructor(circuits: Record<string, ModuleCircuit>);
21
+ convert_to_graph(designs: Record<string, IR_Graph>): true | Error[];
22
+ add_node(id: string): void;
23
+ add_pwr(pwr: PowerBase, shape: PowerShape, sch_name: string, param: PowerSymbolPort): void;
24
+ add_connection(from: string, to: string): void;
25
+ do_add_connection(conn: Connection): void;
26
+ get_connection_node_map(): ConnectionNodeMap;
27
+ get_graph(): ADT_Graph;
28
+ get_schematics(): Record<string, CG_SCHEMATIC>;
29
+ }
30
+ //# sourceMappingURL=ir_graph_converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir_graph_converter.d.ts","sourceRoot":"","sources":["../../../src/tester/graph/ir_graph_converter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,eAAe,EAErB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACnB,UAAU,EACX,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAA;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAExD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,EAAE,CAAA;IAClB,MAAM,EAAE,cAAc,EAAE,CAAA;CACzB;AAED,qBAAa,kBAAmB,YAAW,eAAe;IAgBrC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAf5C,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,mBAAmB,CAAwB;IAEnD,OAAO,CAAC,UAAU,CAAmC;IAErD,OAAO,CAAC,gBAAgB,CAGvB;IAEM,kBAAkB,IAAI,oBAAoB;gBAIb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAE3E,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE;IAoGnE,QAAQ,CAAC,EAAE,EAAE,MAAM;IAInB,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe;IAcnF,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAIvC,iBAAiB,CAAC,IAAI,EAAE,UAAU;IAOlC,uBAAuB,IAAI,iBAAiB;IAI5C,SAAS;IAIT,cAAc;CAGf"}
@@ -0,0 +1,279 @@
1
+ var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
37
+ import { ConnectionNodeType, LinkType, PortType, } from '@modular-circuit/electronics-model';
38
+ import { PowerShape, } from '@modular-circuit/electronics-model';
39
+ import { deep_copy, fmt_module_name, gen_uuid, get_circuit_ports, get_port_labels } from '@modular-circuit/utils';
40
+ var IR_GRAPH_CONVERTER = /** @class */ (function () {
41
+ function IR_GRAPH_CONVERTER(circuits) {
42
+ this.circuits = circuits;
43
+ this.graph = {};
44
+ this.connection_node_map = {};
45
+ this.schematics = {};
46
+ this.reporter_context = {
47
+ pin_name_table: {},
48
+ pin_module_name_table: {},
49
+ };
50
+ }
51
+ IR_GRAPH_CONVERTER.prototype.get_report_context = function () {
52
+ return this.reporter_context;
53
+ };
54
+ IR_GRAPH_CONVERTER.prototype.convert_to_graph = function (designs) {
55
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f, e_7, _g, e_8, _h, e_9, _j;
56
+ var _k, _l, _m, _o, _p, _q, _r, _s, _t;
57
+ var errors = [];
58
+ if (Object.keys(designs).length > 1) {
59
+ throw new Error('Multiple designs are not supported');
60
+ }
61
+ try {
62
+ // Blocks
63
+ for (var _u = __values(Object.entries(designs)), _v = _u.next(); !_v.done; _v = _u.next()) {
64
+ var _w = __read(_v.value, 2), sch_name = _w[0], design = _w[1];
65
+ this.schematics[sch_name] = { uuid: (_k = design.uuid) !== null && _k !== void 0 ? _k : gen_uuid(), sheets: [], powers: [] };
66
+ try {
67
+ for (var _x = (e_2 = void 0, __values((_l = design.blocks) !== null && _l !== void 0 ? _l : [])), _y = _x.next(); !_y.done; _y = _x.next()) {
68
+ var block = _y.value;
69
+ var circuit = this.circuits[fmt_module_name(block.type)];
70
+ this.schematics[sch_name].sheets.push({
71
+ uuid: block.uuid,
72
+ sheet_name: (_m = design.name) !== null && _m !== void 0 ? _m : circuit.name,
73
+ sheet_file_name: circuit.main,
74
+ ports: block.ports.map(function (p) { return p.uuid; }),
75
+ });
76
+ var port_map = get_circuit_ports(circuit);
77
+ try {
78
+ for (var _z = (e_3 = void 0, __values(block.ports)), _0 = _z.next(); !_0.done; _0 = _z.next()) {
79
+ var port = _0.value;
80
+ var param = deep_copy(port_map[port.index]);
81
+ var uuid = port.uuid;
82
+ this.add_node(uuid);
83
+ this.connection_node_map[uuid] = {
84
+ uuid: uuid,
85
+ type: ConnectionNodeType.Port,
86
+ param: param,
87
+ label_shapes: get_port_labels(param, circuit),
88
+ };
89
+ this.reporter_context.pin_module_name_table[port.uuid] = block.type.name;
90
+ this.reporter_context.pin_name_table[port.uuid] = port.name;
91
+ }
92
+ }
93
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
94
+ finally {
95
+ try {
96
+ if (_0 && !_0.done && (_c = _z.return)) _c.call(_z);
97
+ }
98
+ finally { if (e_3) throw e_3.error; }
99
+ }
100
+ }
101
+ }
102
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
103
+ finally {
104
+ try {
105
+ if (_y && !_y.done && (_b = _x.return)) _b.call(_x);
106
+ }
107
+ finally { if (e_2) throw e_2.error; }
108
+ }
109
+ // Labels
110
+ var lb_map = {};
111
+ try {
112
+ for (var _1 = (e_4 = void 0, __values((_o = design.labels) !== null && _o !== void 0 ? _o : [])), _2 = _1.next(); !_2.done; _2 = _1.next()) {
113
+ var lb = _2.value;
114
+ this.add_node(lb.uuid);
115
+ this.reporter_context.pin_name_table[lb.uuid] = lb.text;
116
+ lb_map[lb.text] = __spreadArray(__spreadArray([], __read(((_p = lb_map[lb.text]) !== null && _p !== void 0 ? _p : [])), false), [lb.uuid], false);
117
+ switch (lb.type) {
118
+ case 'label':
119
+ this.connection_node_map[lb.uuid] = { uuid: lb.uuid, type: ConnectionNodeType.NetLabel, text: lb.text };
120
+ break;
121
+ default:
122
+ throw new Error("Unsupported label type ".concat(lb.type));
123
+ }
124
+ }
125
+ }
126
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
127
+ finally {
128
+ try {
129
+ if (_2 && !_2.done && (_d = _1.return)) _d.call(_1);
130
+ }
131
+ finally { if (e_4) throw e_4.error; }
132
+ }
133
+ try {
134
+ for (var _3 = (e_5 = void 0, __values(Object.values(lb_map))), _4 = _3.next(); !_4.done; _4 = _3.next()) {
135
+ var labels = _4.value;
136
+ for (var i = 0; i < labels.length - 1; i++) {
137
+ this.add_connection(labels[i], labels[i + 1]);
138
+ }
139
+ }
140
+ }
141
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
142
+ finally {
143
+ try {
144
+ if (_4 && !_4.done && (_e = _3.return)) _e.call(_3);
145
+ }
146
+ finally { if (e_5) throw e_5.error; }
147
+ }
148
+ try {
149
+ // POWER
150
+ for (var _5 = (e_6 = void 0, __values((_q = design.pwr) !== null && _q !== void 0 ? _q : [])), _6 = _5.next(); !_6.done; _6 = _5.next()) {
151
+ var pwr = _6.value;
152
+ this.add_pwr(pwr, PowerShape.VCC, sch_name, {
153
+ type: PortType.VoltageSource,
154
+ name: pwr.value,
155
+ link_type: LinkType.VoltageLink,
156
+ label_associated: pwr.value,
157
+ voltage_out: pwr.param ? pwr.param.voltage_out : {},
158
+ current_limits: pwr.param ? pwr.param.current_limits : {},
159
+ });
160
+ }
161
+ }
162
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
163
+ finally {
164
+ try {
165
+ if (_6 && !_6.done && (_f = _5.return)) _f.call(_5);
166
+ }
167
+ finally { if (e_6) throw e_6.error; }
168
+ }
169
+ try {
170
+ for (var _7 = (e_7 = void 0, __values((_r = design.gnd) !== null && _r !== void 0 ? _r : [])), _8 = _7.next(); !_8.done; _8 = _7.next()) {
171
+ var pwr = _8.value;
172
+ this.add_pwr(pwr, PowerShape.GND, sch_name, {
173
+ type: PortType.Ground,
174
+ name: pwr.value,
175
+ link_type: LinkType.GroundLink,
176
+ label_associated: pwr.value,
177
+ voltage_limits: pwr.param ? pwr.param.voltage_limits : {},
178
+ });
179
+ }
180
+ }
181
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
182
+ finally {
183
+ try {
184
+ if (_8 && !_8.done && (_g = _7.return)) _g.call(_7);
185
+ }
186
+ finally { if (e_7) throw e_7.error; }
187
+ }
188
+ try {
189
+ // Junctions
190
+ for (var _9 = (e_8 = void 0, __values((_s = design.junctions) !== null && _s !== void 0 ? _s : [])), _10 = _9.next(); !_10.done; _10 = _9.next()) {
191
+ var j = _10.value;
192
+ var uuid = j.uuid;
193
+ this.add_node(uuid);
194
+ this.connection_node_map[uuid] = { uuid: uuid, type: ConnectionNodeType.Graphics };
195
+ }
196
+ }
197
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
198
+ finally {
199
+ try {
200
+ if (_10 && !_10.done && (_h = _9.return)) _h.call(_9);
201
+ }
202
+ finally { if (e_8) throw e_8.error; }
203
+ }
204
+ try {
205
+ // Connections
206
+ for (var _11 = (e_9 = void 0, __values((_t = design.wires) !== null && _t !== void 0 ? _t : [])), _12 = _11.next(); !_12.done; _12 = _11.next()) {
207
+ var connection = _12.value;
208
+ var uuid = connection.uuid;
209
+ this.add_connection(connection.from, connection.to);
210
+ this.connection_node_map[uuid] = { uuid: uuid, type: ConnectionNodeType.Graphics };
211
+ }
212
+ }
213
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
214
+ finally {
215
+ try {
216
+ if (_12 && !_12.done && (_j = _11.return)) _j.call(_11);
217
+ }
218
+ finally { if (e_9) throw e_9.error; }
219
+ }
220
+ }
221
+ }
222
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
223
+ finally {
224
+ try {
225
+ if (_v && !_v.done && (_a = _u.return)) _a.call(_u);
226
+ }
227
+ finally { if (e_1) throw e_1.error; }
228
+ }
229
+ return errors.length ? errors : true;
230
+ };
231
+ IR_GRAPH_CONVERTER.prototype.add_node = function (id) {
232
+ if (!this.graph[id])
233
+ this.graph[id] = new Set();
234
+ };
235
+ IR_GRAPH_CONVERTER.prototype.add_pwr = function (pwr, shape, sch_name, param) {
236
+ var uuid = pwr.uuid;
237
+ var value = pwr.value;
238
+ this.add_node(uuid);
239
+ this.reporter_context.pin_name_table[uuid] = pwr.value;
240
+ this.connection_node_map[uuid] = { uuid: uuid, type: ConnectionNodeType.Power, value: value, param: param };
241
+ this.schematics[sch_name].powers.push({
242
+ uuid: uuid,
243
+ value: value,
244
+ shape: shape,
245
+ });
246
+ };
247
+ IR_GRAPH_CONVERTER.prototype.add_connection = function (from, to) {
248
+ this.do_add_connection({ from: from, to: to });
249
+ };
250
+ IR_GRAPH_CONVERTER.prototype.do_add_connection = function (conn) {
251
+ var e_10, _a;
252
+ try {
253
+ for (var _b = __values([conn.from, conn.to]), _c = _b.next(); !_c.done; _c = _b.next()) {
254
+ var p = _c.value;
255
+ this.add_node(p);
256
+ }
257
+ }
258
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
259
+ finally {
260
+ try {
261
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
262
+ }
263
+ finally { if (e_10) throw e_10.error; }
264
+ }
265
+ this.graph[conn.from].add(conn.to);
266
+ this.graph[conn.to].add(conn.from);
267
+ };
268
+ IR_GRAPH_CONVERTER.prototype.get_connection_node_map = function () {
269
+ return this.connection_node_map;
270
+ };
271
+ IR_GRAPH_CONVERTER.prototype.get_graph = function () {
272
+ return this.graph;
273
+ };
274
+ IR_GRAPH_CONVERTER.prototype.get_schematics = function () {
275
+ return this.schematics;
276
+ };
277
+ return IR_GRAPH_CONVERTER;
278
+ }());
279
+ export { IR_GRAPH_CONVERTER };
@@ -0,0 +1,3 @@
1
+ export * from './erc_tester';
2
+ export * from './graph';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tester/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './erc_tester';
2
+ export * from './graph';
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/erc/index.ts","../src/erc/connect_graph_visitor/index.ts","../src/erc/connect_graph_visitor/visitor.ts","../src/erc/context/connection_graph_builder_ctx.ts","../src/erc/context/error_severity.ts","../src/erc/context/graph.ts","../src/erc/context/graph_converter.ts","../src/erc/context/index.ts","../src/erc/context/pin_to_pin_test_ctx.ts","../src/erc/netlist/constraints.ts","../src/erc/netlist/index.ts","../src/erc/netlist/tester.ts","../src/erc/parameter_propagation/error_code.ts","../src/erc/parameter_propagation/index.ts","../src/erc/parameter_propagation/tester.ts","../src/erc/parameter_propagation/link_testers/index.ts","../src/erc/parameter_propagation/link_testers/link_tester_base.ts","../src/erc/parameter_propagation/link_testers/tester_impl.ts","../src/erc/pin_compatibility_matrix/erc_setting.ts","../src/erc/pin_compatibility_matrix/error_code.ts","../src/erc/pin_compatibility_matrix/index.ts","../src/erc/pin_compatibility_matrix/pin_error.ts","../src/erc/pin_compatibility_matrix/tester.ts","../src/graphics/index.ts","../src/graphics/sch_erc_item.ts","../src/graphics/maker/index.ts","../src/graphics/maker/maker_base.ts","../src/graphics/maker/maker_type.ts","../src/graphics/maker/sch_maker.ts","../src/report/erc_report.ts","../src/report/erc_reporter.ts","../src/report/index.ts","../src/rule_check_item/erc_item.ts","../src/rule_check_item/index.ts","../src/rule_check_item/rc_item.ts","../src/tester/erc_tester.ts","../src/tester/index.ts","../src/tester/graph/connection_graphs_builder.ts","../src/tester/graph/graph_erc.ts","../src/tester/graph/index.ts","../src/tester/graph/ir_graph_converter.ts","../src/utils/get_dependent_modules_definition.ts","../src/utils/index.ts"],"version":"5.8.3"}
@@ -0,0 +1,4 @@
1
+ import type { ModuleCircuit } from '@modular-circuit/ir';
2
+ import type { CONNECTION_GRAPH_BUILDER_CTX } from '../erc';
3
+ export declare function get_dependent_modules_definition(ctx: CONNECTION_GRAPH_BUILDER_CTX): Promise<Record<string, ModuleCircuit>>;
4
+ //# sourceMappingURL=get_dependent_modules_definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_dependent_modules_definition.d.ts","sourceRoot":"","sources":["../../src/utils/get_dependent_modules_definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAElE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,QAAQ,CAAA;AAE1D,wBAAsB,gCAAgC,CAAC,GAAG,EAAE,4BAA4B,0CAkBvF"}