@modular-circuit/perc 0.0.59 → 0.0.61

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.
@@ -15,7 +15,7 @@ import { ELECTRICAL_PINTYPE } from '@modular-circuit/electronics-model';
15
15
  // List of pin types that are considered drivers for usual input pins
16
16
  // i.e. pin type = ELECTRICAL_PINTYPE::PT_INPUT, but not PT_POWER_IN
17
17
  // that need only a PT_POWER_OUT pin type to be driven
18
- export const DrivingPinTypes = new Set([
18
+ export var DrivingPinTypes = new Set([
19
19
  ELECTRICAL_PINTYPE.PT_OUTPUT,
20
20
  ELECTRICAL_PINTYPE.PT_POWER_OUT,
21
21
  ELECTRICAL_PINTYPE.PT_PASSIVE,
@@ -25,6 +25,6 @@ export const DrivingPinTypes = new Set([
25
25
  // List of pin types that are considered drivers for power pins
26
26
  // In fact only a ELECTRICAL_PINTYPE::PT_POWER_OUT pin type can drive
27
27
  // power input pins
28
- export const PowerDrivingPinTypes = new Set([ELECTRICAL_PINTYPE.PT_POWER_OUT]);
28
+ export var PowerDrivingPinTypes = new Set([ELECTRICAL_PINTYPE.PT_POWER_OUT]);
29
29
  // List of pin types that require a driver elsewhere on the net
30
- export const DrivenPinTypes = new Set([ELECTRICAL_PINTYPE.PT_INPUT, ELECTRICAL_PINTYPE.PT_POWER_IN]);
30
+ export var DrivenPinTypes = new Set([ELECTRICAL_PINTYPE.PT_INPUT, ELECTRICAL_PINTYPE.PT_POWER_IN]);
@@ -1,44 +1,67 @@
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
+ };
1
12
  import { ConnectionNodeType } from '@modular-circuit/electronics-model';
2
13
  import { ERCE_DRIVER_CONFLICT, ERCE_PIN_NOT_CONNECTED } from '../../report';
3
- export class NetlistTester {
4
- ctx;
5
- constructor(ctx) {
14
+ var NetlistTester = /** @class */ (function () {
15
+ function NetlistTester(ctx) {
6
16
  this.ctx = ctx;
7
17
  }
8
- visit_cc(cc) {
18
+ NetlistTester.prototype.visit_cc = function (cc) {
9
19
  if (cc.nodes.length === 1 && cc.nodes[0].type === ConnectionNodeType.Port) {
10
20
  this.ctx.report.erc_errors.push(ERCE_PIN_NOT_CONNECTED(cc.nodes[0].uuid));
11
21
  return;
12
22
  }
13
23
  this.ercCheckMultipleDrivers(cc);
14
- }
15
- ercCheckMultipleDrivers(cc) {
24
+ };
25
+ NetlistTester.prototype.ercCheckMultipleDrivers = function (cc) {
26
+ var e_1, _a;
16
27
  if (!cc.net_drivers)
17
28
  return;
18
- const node_map = cc.nodes.reduce((map, node) => {
29
+ var node_map = cc.nodes.reduce(function (map, node) {
19
30
  map[node.uuid] = node;
20
31
  return map;
21
32
  }, {});
22
- for (const driver of cc.net_drivers.drivers) {
23
- if (driver === cc.net_drivers.primary_driver)
24
- continue;
25
- const node = node_map[driver];
26
- const net_name = cc.name;
27
- switch (node.type) {
28
- case ConnectionNodeType.Port:
29
- case ConnectionNodeType.Graphics:
30
- break;
31
- case ConnectionNodeType.NetLabel:
32
- if (net_name !== node.text) {
33
- this.ctx.report.erc_errors.push(ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.text));
34
- }
35
- break;
36
- case ConnectionNodeType.Power:
37
- if (net_name !== node.value) {
38
- this.ctx.report.erc_errors.push(ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.value));
33
+ try {
34
+ for (var _b = __values(cc.net_drivers.drivers), _c = _b.next(); !_c.done; _c = _b.next()) {
35
+ var driver = _c.value;
36
+ if (driver === cc.net_drivers.primary_driver)
37
+ continue;
38
+ var node = node_map[driver];
39
+ var net_name = cc.name;
40
+ switch (node.type) {
41
+ case ConnectionNodeType.Port:
42
+ case ConnectionNodeType.Graphics:
43
+ break;
44
+ case ConnectionNodeType.NetLabel:
45
+ if (net_name !== node.text) {
46
+ this.ctx.report.erc_errors.push(ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.text));
47
+ }
39
48
  break;
40
- }
49
+ case ConnectionNodeType.Power:
50
+ if (net_name !== node.value) {
51
+ this.ctx.report.erc_errors.push(ERCE_DRIVER_CONFLICT([cc.net_drivers.primary_driver, driver], cc.name, node.value));
52
+ break;
53
+ }
54
+ }
41
55
  }
42
56
  }
43
- }
44
- }
57
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
58
+ finally {
59
+ try {
60
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
61
+ }
62
+ finally { if (e_1) throw e_1.error; }
63
+ }
64
+ };
65
+ return NetlistTester;
66
+ }());
67
+ export { NetlistTester };
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * See https://github.com/BerkeleyHCI/PolymorphicBlocks/blob/master/compiler/src/main/scala/edg/compiler/CompilerError.scala
5
5
  */
6
+ var _a;
6
7
  import { SEVERITY } from '../context';
7
8
  export var PP_ERROR;
8
9
  (function (PP_ERROR) {
@@ -38,36 +39,36 @@ export var PP_ERROR;
38
39
  PP_ERROR["REQUIRES_CONNECTED_SOURCE_OR_BIDIR"] = "requires_connected_source_or_bidir";
39
40
  PP_ERROR["ILLEGAL_CONNECTION"] = "Illegal_connection";
40
41
  })(PP_ERROR || (PP_ERROR = {}));
41
- export const DEFAULT_PP_ERROR_SEVERITY = {
42
- [PP_ERROR.UN_COMPILED_BLOCK]: SEVERITY.RPT_SEVERITY_WARNING,
43
- [PP_ERROR.UN_COMPILED_LINK]: SEVERITY.RPT_SEVERITY_WARNING,
44
- [PP_ERROR.UN_COMPILED_LINK_ARRAY]: SEVERITY.RPT_SEVERITY_WARNING,
45
- [PP_ERROR.UN_COMPILED_PARAMETER]: SEVERITY.RPT_SEVERITY_WARNING,
46
- [PP_ERROR.UN_COMPILED_INTERNAL_ELEMENT]: SEVERITY.RPT_SEVERITY_WARNING,
47
- [PP_ERROR.UN_COMPILED_LIBRARY_ELEMENT]: SEVERITY.RPT_SEVERITY_WARNING,
48
- [PP_ERROR.UNDEFINED_PORT_ARRAY]: SEVERITY.RPT_SEVERITY_WARNING,
49
- [PP_ERROR.LIBRARY_ERROR]: SEVERITY.RPT_SEVERITY_WARNING,
50
- [PP_ERROR.GENERATOR_ERROR]: SEVERITY.RPT_SEVERITY_WARNING,
51
- [PP_ERROR.REFINEMENT_SUBCLASS_ERROR]: SEVERITY.RPT_SEVERITY_WARNING,
52
- [PP_ERROR.OVER_ASSIGN]: SEVERITY.RPT_SEVERITY_ERROR,
53
- [PP_ERROR.BAD_REFERENCE]: SEVERITY.RPT_SEVERITY_WARNING,
54
- [PP_ERROR.ABSTRACT_BLOCK]: SEVERITY.RPT_SEVERITY_WARNING,
55
- [PP_ERROR.FAILED_ASSERTION]: SEVERITY.RPT_SEVERITY_ERROR,
56
- [PP_ERROR.UN_EVALUATED_ASSERTION]: SEVERITY.RPT_SEVERITY_ERROR,
57
- [PP_ERROR.INCONSISTENT_LINK_ARRAY_ELEMENTS]: SEVERITY.RPT_SEVERITY_WARNING,
58
- [PP_ERROR.PP_UNANNOTATED]: SEVERITY.RPT_SEVERITY_WARNING,
59
- [PP_ERROR.PP_UNKNOWN_PORT_TYPE]: SEVERITY.RPT_SEVERITY_ERROR,
60
- [PP_ERROR.INAPPROPRIATE_FUNC]: SEVERITY.RPT_SEVERITY_ERROR,
61
- [PP_ERROR.NOT_DRIVEN]: SEVERITY.RPT_SEVERITY_WARNING,
62
- [PP_ERROR.DUPLICATED_PWR_SOURCES]: SEVERITY.RPT_SEVERITY_WARNING,
63
- [PP_ERROR.INSUFFICIENT_DRIVER]: SEVERITY.RPT_SEVERITY_WARNING,
64
- [PP_ERROR.OVER_DRIVEN]: SEVERITY.RPT_SEVERITY_WARNING,
65
- [PP_ERROR.IMPEDANCE_SIGNAL_INTEGRITY]: SEVERITY.RPT_SEVERITY_WARNING,
66
- [PP_ERROR.INCOMPATIBLE_VOLTAGE_LEVELS]: SEVERITY.RPT_SEVERITY_WARNING,
67
- [PP_ERROR.SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE]: SEVERITY.RPT_SEVERITY_WARNING,
68
- [PP_ERROR.INCOMPATIBLE_SIGNAL_LEVELS]: SEVERITY.RPT_SEVERITY_WARNING,
69
- [PP_ERROR.OVERCURRENT]: SEVERITY.RPT_SEVERITY_WARNING,
70
- [PP_ERROR.INCOMPATIBLE_DIGITAL_THRESHOLDS]: SEVERITY.RPT_SEVERITY_WARNING,
71
- [PP_ERROR.REQUIRES_CONNECTED_SOURCE_OR_BIDIR]: SEVERITY.RPT_SEVERITY_WARNING,
72
- [PP_ERROR.ILLEGAL_CONNECTION]: SEVERITY.RPT_SEVERITY_ERROR,
73
- };
42
+ export var DEFAULT_PP_ERROR_SEVERITY = (_a = {},
43
+ _a[PP_ERROR.UN_COMPILED_BLOCK] = SEVERITY.RPT_SEVERITY_WARNING,
44
+ _a[PP_ERROR.UN_COMPILED_LINK] = SEVERITY.RPT_SEVERITY_WARNING,
45
+ _a[PP_ERROR.UN_COMPILED_LINK_ARRAY] = SEVERITY.RPT_SEVERITY_WARNING,
46
+ _a[PP_ERROR.UN_COMPILED_PARAMETER] = SEVERITY.RPT_SEVERITY_WARNING,
47
+ _a[PP_ERROR.UN_COMPILED_INTERNAL_ELEMENT] = SEVERITY.RPT_SEVERITY_WARNING,
48
+ _a[PP_ERROR.UN_COMPILED_LIBRARY_ELEMENT] = SEVERITY.RPT_SEVERITY_WARNING,
49
+ _a[PP_ERROR.UNDEFINED_PORT_ARRAY] = SEVERITY.RPT_SEVERITY_WARNING,
50
+ _a[PP_ERROR.LIBRARY_ERROR] = SEVERITY.RPT_SEVERITY_WARNING,
51
+ _a[PP_ERROR.GENERATOR_ERROR] = SEVERITY.RPT_SEVERITY_WARNING,
52
+ _a[PP_ERROR.REFINEMENT_SUBCLASS_ERROR] = SEVERITY.RPT_SEVERITY_WARNING,
53
+ _a[PP_ERROR.OVER_ASSIGN] = SEVERITY.RPT_SEVERITY_ERROR,
54
+ _a[PP_ERROR.BAD_REFERENCE] = SEVERITY.RPT_SEVERITY_WARNING,
55
+ _a[PP_ERROR.ABSTRACT_BLOCK] = SEVERITY.RPT_SEVERITY_WARNING,
56
+ _a[PP_ERROR.FAILED_ASSERTION] = SEVERITY.RPT_SEVERITY_ERROR,
57
+ _a[PP_ERROR.UN_EVALUATED_ASSERTION] = SEVERITY.RPT_SEVERITY_ERROR,
58
+ _a[PP_ERROR.INCONSISTENT_LINK_ARRAY_ELEMENTS] = SEVERITY.RPT_SEVERITY_WARNING,
59
+ _a[PP_ERROR.PP_UNANNOTATED] = SEVERITY.RPT_SEVERITY_WARNING,
60
+ _a[PP_ERROR.PP_UNKNOWN_PORT_TYPE] = SEVERITY.RPT_SEVERITY_ERROR,
61
+ _a[PP_ERROR.INAPPROPRIATE_FUNC] = SEVERITY.RPT_SEVERITY_ERROR,
62
+ _a[PP_ERROR.NOT_DRIVEN] = SEVERITY.RPT_SEVERITY_WARNING,
63
+ _a[PP_ERROR.DUPLICATED_PWR_SOURCES] = SEVERITY.RPT_SEVERITY_WARNING,
64
+ _a[PP_ERROR.INSUFFICIENT_DRIVER] = SEVERITY.RPT_SEVERITY_WARNING,
65
+ _a[PP_ERROR.OVER_DRIVEN] = SEVERITY.RPT_SEVERITY_WARNING,
66
+ _a[PP_ERROR.IMPEDANCE_SIGNAL_INTEGRITY] = SEVERITY.RPT_SEVERITY_WARNING,
67
+ _a[PP_ERROR.INCOMPATIBLE_VOLTAGE_LEVELS] = SEVERITY.RPT_SEVERITY_WARNING,
68
+ _a[PP_ERROR.SIGNAL_LEVELS_NOT_CONTAINED_WITHIN_VOLTAGE] = SEVERITY.RPT_SEVERITY_WARNING,
69
+ _a[PP_ERROR.INCOMPATIBLE_SIGNAL_LEVELS] = SEVERITY.RPT_SEVERITY_WARNING,
70
+ _a[PP_ERROR.OVERCURRENT] = SEVERITY.RPT_SEVERITY_WARNING,
71
+ _a[PP_ERROR.INCOMPATIBLE_DIGITAL_THRESHOLDS] = SEVERITY.RPT_SEVERITY_WARNING,
72
+ _a[PP_ERROR.REQUIRES_CONNECTED_SOURCE_OR_BIDIR] = SEVERITY.RPT_SEVERITY_WARNING,
73
+ _a[PP_ERROR.ILLEGAL_CONNECTION] = SEVERITY.RPT_SEVERITY_ERROR,
74
+ _a);
@@ -1,39 +1,112 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __values = (this && this.__values) || function(o) {
17
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
18
+ if (m) return m.call(o);
19
+ if (o && typeof o.length === "number") return {
20
+ next: function () {
21
+ if (o && i >= o.length) o = void 0;
22
+ return { value: o && o[i++], done: !o };
23
+ }
24
+ };
25
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
26
+ };
27
+ var __read = (this && this.__read) || function (o, n) {
28
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
29
+ if (!m) return o;
30
+ var i = m.call(o), r, ar = [], e;
31
+ try {
32
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
33
+ }
34
+ catch (error) { e = { error: error }; }
35
+ finally {
36
+ try {
37
+ if (r && !r.done && (m = i["return"])) m.call(i);
38
+ }
39
+ finally { if (e) throw e.error; }
40
+ }
41
+ return ar;
42
+ };
1
43
  import { LABEL_ASSOCIATED } from '@modular-circuit/electronics-model';
2
- export class LinkTesterBase {
3
- ctx;
4
- ports;
5
- link;
6
- _all_port_ids;
7
- constructor(ctx, ports) {
44
+ var LinkTesterBase = /** @class */ (function () {
45
+ function LinkTesterBase(ctx, ports) {
8
46
  this.ctx = ctx;
9
47
  this.ports = ports;
10
48
  }
11
- test() {
49
+ LinkTesterBase.prototype.test = function () {
12
50
  if (!this.init_link())
13
51
  return;
14
52
  this.check_parameter_propagation();
53
+ };
54
+ Object.defineProperty(LinkTesterBase.prototype, "all_port_ids", {
55
+ get: function () {
56
+ var _this = this;
57
+ if (!this._all_port_ids)
58
+ this._all_port_ids = this.ports.map(function (v) { return _this.ctx.port_id.get(v); });
59
+ return this._all_port_ids;
60
+ },
61
+ enumerable: false,
62
+ configurable: true
63
+ });
64
+ return LinkTesterBase;
65
+ }());
66
+ export { LinkTesterBase };
67
+ var CompositePortLinkTesterBase = /** @class */ (function (_super) {
68
+ __extends(CompositePortLinkTesterBase, _super);
69
+ function CompositePortLinkTesterBase() {
70
+ return _super !== null && _super.apply(this, arguments) || this;
15
71
  }
16
- get all_port_ids() {
17
- if (!this._all_port_ids)
18
- this._all_port_ids = this.ports.map((v) => this.ctx.port_id.get(v));
19
- return this._all_port_ids;
20
- }
21
- }
22
- export class CompositePortLinkTesterBase extends LinkTesterBase {
23
- test() {
24
- for (const port of this.ports) {
25
- this.annot_composite_port(port, this.ctx.port_id.get(port));
72
+ CompositePortLinkTesterBase.prototype.test = function () {
73
+ var e_1, _a;
74
+ try {
75
+ for (var _b = __values(this.ports), _c = _b.next(); !_c.done; _c = _b.next()) {
76
+ var port = _c.value;
77
+ this.annot_composite_port(port, this.ctx.port_id.get(port));
78
+ }
26
79
  }
27
- super.test();
28
- }
29
- annot_composite_port(port, uuid) {
30
- for (const [k, v] of Object.entries(port)) {
31
- if (k === LABEL_ASSOCIATED && typeof v === 'string') {
32
- this.ctx.port_id.set(port, v);
80
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
81
+ finally {
82
+ try {
83
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
33
84
  }
34
- else if (typeof v === 'object' && !Array.isArray(v) && v !== null) {
35
- this.annot_composite_port(v, uuid);
85
+ finally { if (e_1) throw e_1.error; }
86
+ }
87
+ _super.prototype.test.call(this);
88
+ };
89
+ CompositePortLinkTesterBase.prototype.annot_composite_port = function (port, uuid) {
90
+ var e_2, _a;
91
+ try {
92
+ for (var _b = __values(Object.entries(port)), _c = _b.next(); !_c.done; _c = _b.next()) {
93
+ var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
94
+ if (k === LABEL_ASSOCIATED && typeof v === 'string') {
95
+ this.ctx.port_id.set(port, v);
96
+ }
97
+ else if (typeof v === 'object' && !Array.isArray(v) && v !== null) {
98
+ this.annot_composite_port(v, uuid);
99
+ }
36
100
  }
37
101
  }
38
- }
39
- }
102
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
103
+ finally {
104
+ try {
105
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
106
+ }
107
+ finally { if (e_2) throw e_2.error; }
108
+ }
109
+ };
110
+ return CompositePortLinkTesterBase;
111
+ }(LinkTesterBase));
112
+ export { CompositePortLinkTesterBase };