@modular-circuit/transpiler 0.1.4 → 0.1.5

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.js CHANGED
@@ -595,8 +595,7 @@ var LinkConverterBase = class {
595
595
  }
596
596
  gen_net_name(signal_name) {
597
597
  const base_net_name = signal_name ? `${this.net_pros.name}-${signal_name}` : `${this.net_pros.name}`;
598
- if (this.net_pros.is_global_pwr)
599
- return base_net_name;
598
+ if (this.net_pros.is_global_pwr) return base_net_name;
600
599
  if (!this.ctx.net_names_count.has(base_net_name)) {
601
600
  this.ctx.net_names_count.set(base_net_name, 0);
602
601
  return base_net_name;
@@ -1655,14 +1654,33 @@ var GraphConverter = class {
1655
1654
  for (const node of sub.nodes) {
1656
1655
  if (node.type === import_electronics_model4.ConnectionNodeType.Port) {
1657
1656
  const port_id = node.uuid;
1658
- port_map.set(node.param, port_id);
1659
- for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1660
- const pin_id = `pin-${++pin_count}`;
1661
- pin_shapes[pin_id] = shape;
1662
- if (!(port_id in pin_map)) {
1663
- pin_map[port_id] = {};
1657
+ const ir_port = node.param;
1658
+ port_map.set(ir_port, port_id);
1659
+ if (node.label_shapes) {
1660
+ for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1661
+ const pin_id = `pin-${++pin_count}`;
1662
+ pin_shapes[pin_id] = shape;
1663
+ if (!(port_id in pin_map)) {
1664
+ pin_map[port_id] = {};
1665
+ }
1666
+ pin_map[port_id][label_name] = pin_id;
1667
+ }
1668
+ } else {
1669
+ if (ir_port.type === import_electronics_model4.PortType.DigitalBidirBundle) {
1670
+ console.error(
1671
+ `DigitalBidirBundle shall be replaced by DigitalBidirs while building connection graph : ${ir_port.name}`
1672
+ );
1673
+ } else {
1674
+ const expected_signals = (0, import_electronics_model4.get_port_type_signals)(ir_port.type);
1675
+ for (const signal of expected_signals) {
1676
+ const pin_id = `pin-${++pin_count}`;
1677
+ pin_shapes[pin_id] = import_electronics_model4.LabelShapes.Passive;
1678
+ if (!(port_id in pin_map)) {
1679
+ pin_map[port_id] = {};
1680
+ }
1681
+ pin_map[port_id][`${ir_port.name}-${signal}`] = pin_id;
1682
+ }
1664
1683
  }
1665
- pin_map[port_id][label_name] = pin_id;
1666
1684
  }
1667
1685
  }
1668
1686
  }
package/dist/index.mjs CHANGED
@@ -165,9 +165,9 @@ var StringFormatter = class {
165
165
 
166
166
  // src/utils/collect_sub_sheets_by_id.ts
167
167
  import {
168
- fmt_module_name,
169
168
  KICAD_PCB_FILE_EXT,
170
169
  KICAD_SHC_FILE_EXT as KICAD_SHC_FILE_EXT2,
170
+ fmt_module_name,
171
171
  remove_filename_path_prefix as remove_filename_path_prefix2,
172
172
  unzipFile as unzipFile2
173
173
  } from "@modular-circuit/utils";
@@ -459,7 +459,10 @@ __decoratorMetadata(_init, SCHEMATIC_PRINTER);
459
459
 
460
460
  // src/converter/graph_to_netlist/graph_converter.ts
461
461
  import {
462
- ConnectionNodeType as ConnectionNodeType2
462
+ ConnectionNodeType as ConnectionNodeType2,
463
+ LabelShapes,
464
+ PortType as PortType2,
465
+ get_port_type_signals
463
466
  } from "@modular-circuit/electronics-model";
464
467
 
465
468
  // src/converter/link_to_netlist/converter.ts
@@ -491,8 +494,7 @@ var LinkConverterBase = class {
491
494
  }
492
495
  gen_net_name(signal_name) {
493
496
  const base_net_name = signal_name ? `${this.net_pros.name}-${signal_name}` : `${this.net_pros.name}`;
494
- if (this.net_pros.is_global_pwr)
495
- return base_net_name;
497
+ if (this.net_pros.is_global_pwr) return base_net_name;
496
498
  if (!this.ctx.net_names_count.has(base_net_name)) {
497
499
  this.ctx.net_names_count.set(base_net_name, 0);
498
500
  return base_net_name;
@@ -1551,14 +1553,33 @@ var GraphConverter = class {
1551
1553
  for (const node of sub.nodes) {
1552
1554
  if (node.type === ConnectionNodeType2.Port) {
1553
1555
  const port_id = node.uuid;
1554
- port_map.set(node.param, port_id);
1555
- for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1556
- const pin_id = `pin-${++pin_count}`;
1557
- pin_shapes[pin_id] = shape;
1558
- if (!(port_id in pin_map)) {
1559
- pin_map[port_id] = {};
1556
+ const ir_port = node.param;
1557
+ port_map.set(ir_port, port_id);
1558
+ if (node.label_shapes) {
1559
+ for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1560
+ const pin_id = `pin-${++pin_count}`;
1561
+ pin_shapes[pin_id] = shape;
1562
+ if (!(port_id in pin_map)) {
1563
+ pin_map[port_id] = {};
1564
+ }
1565
+ pin_map[port_id][label_name] = pin_id;
1566
+ }
1567
+ } else {
1568
+ if (ir_port.type === PortType2.DigitalBidirBundle) {
1569
+ console.error(
1570
+ `DigitalBidirBundle shall be replaced by DigitalBidirs while building connection graph : ${ir_port.name}`
1571
+ );
1572
+ } else {
1573
+ const expected_signals = get_port_type_signals(ir_port.type);
1574
+ for (const signal of expected_signals) {
1575
+ const pin_id = `pin-${++pin_count}`;
1576
+ pin_shapes[pin_id] = LabelShapes.Passive;
1577
+ if (!(port_id in pin_map)) {
1578
+ pin_map[port_id] = {};
1579
+ }
1580
+ pin_map[port_id][`${ir_port.name}-${signal}`] = pin_id;
1581
+ }
1560
1582
  }
1561
- pin_map[port_id][label_name] = pin_id;
1562
1583
  }
1563
1584
  }
1564
1585
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,8 +14,7 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "import": "./dist/index.mjs",
17
- "require": "./dist/index.js",
18
- "types": "./dist/index.d.ts"
17
+ "require": "./dist/index.js"
19
18
  }
20
19
  },
21
20
  "devDependencies": {
@@ -30,10 +29,10 @@
30
29
  "elkjs": "^0.11.0",
31
30
  "js-base64": "^3.7.7",
32
31
  "jszip": "^3.10.1",
33
- "@modular-circuit/electronics-model": "0.1.0",
34
- "@modular-circuit/ir": "0.1.1",
35
- "@modular-circuit/perc": "0.1.1",
36
- "@modular-circuit/utils": "0.1.1"
32
+ "@modular-circuit/electronics-model": "0.1.1",
33
+ "@modular-circuit/ir": "0.1.2",
34
+ "@modular-circuit/utils": "0.1.2",
35
+ "@modular-circuit/perc": "0.1.2"
37
36
  },
38
37
  "scripts": {
39
38
  "clean": "rimraf dist",