@modular-circuit/transpiler 0.1.3 → 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
@@ -327,6 +327,7 @@ async function collect_sub_sheets_by_id(module_ids, module_resolver) {
327
327
  design_block.pcb = { filename, content };
328
328
  }
329
329
  }
330
+ design_blocks.push(design_block);
330
331
  }
331
332
  return { sheets, module_main_sheet, modules, design_blocks };
332
333
  }
@@ -594,8 +595,7 @@ var LinkConverterBase = class {
594
595
  }
595
596
  gen_net_name(signal_name) {
596
597
  const base_net_name = signal_name ? `${this.net_pros.name}-${signal_name}` : `${this.net_pros.name}`;
597
- if (this.net_pros.is_global_pwr)
598
- return base_net_name;
598
+ if (this.net_pros.is_global_pwr) return base_net_name;
599
599
  if (!this.ctx.net_names_count.has(base_net_name)) {
600
600
  this.ctx.net_names_count.set(base_net_name, 0);
601
601
  return base_net_name;
@@ -1654,14 +1654,33 @@ var GraphConverter = class {
1654
1654
  for (const node of sub.nodes) {
1655
1655
  if (node.type === import_electronics_model4.ConnectionNodeType.Port) {
1656
1656
  const port_id = node.uuid;
1657
- port_map.set(node.param, port_id);
1658
- for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1659
- const pin_id = `pin-${++pin_count}`;
1660
- pin_shapes[pin_id] = shape;
1661
- if (!(port_id in pin_map)) {
1662
- 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
+ }
1663
1683
  }
1664
- pin_map[port_id][label_name] = pin_id;
1665
1684
  }
1666
1685
  }
1667
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";
@@ -214,6 +214,7 @@ async function collect_sub_sheets_by_id(module_ids, module_resolver) {
214
214
  design_block.pcb = { filename, content };
215
215
  }
216
216
  }
217
+ design_blocks.push(design_block);
217
218
  }
218
219
  return { sheets, module_main_sheet, modules, design_blocks };
219
220
  }
@@ -458,7 +459,10 @@ __decoratorMetadata(_init, SCHEMATIC_PRINTER);
458
459
 
459
460
  // src/converter/graph_to_netlist/graph_converter.ts
460
461
  import {
461
- ConnectionNodeType as ConnectionNodeType2
462
+ ConnectionNodeType as ConnectionNodeType2,
463
+ LabelShapes,
464
+ PortType as PortType2,
465
+ get_port_type_signals
462
466
  } from "@modular-circuit/electronics-model";
463
467
 
464
468
  // src/converter/link_to_netlist/converter.ts
@@ -490,8 +494,7 @@ var LinkConverterBase = class {
490
494
  }
491
495
  gen_net_name(signal_name) {
492
496
  const base_net_name = signal_name ? `${this.net_pros.name}-${signal_name}` : `${this.net_pros.name}`;
493
- if (this.net_pros.is_global_pwr)
494
- return base_net_name;
497
+ if (this.net_pros.is_global_pwr) return base_net_name;
495
498
  if (!this.ctx.net_names_count.has(base_net_name)) {
496
499
  this.ctx.net_names_count.set(base_net_name, 0);
497
500
  return base_net_name;
@@ -1550,14 +1553,33 @@ var GraphConverter = class {
1550
1553
  for (const node of sub.nodes) {
1551
1554
  if (node.type === ConnectionNodeType2.Port) {
1552
1555
  const port_id = node.uuid;
1553
- port_map.set(node.param, port_id);
1554
- for (const [label_name, shape] of Object.entries(node.label_shapes)) {
1555
- const pin_id = `pin-${++pin_count}`;
1556
- pin_shapes[pin_id] = shape;
1557
- if (!(port_id in pin_map)) {
1558
- 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
+ }
1559
1582
  }
1560
- pin_map[port_id][label_name] = pin_id;
1561
1583
  }
1562
1584
  }
1563
1585
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/transpiler",
3
- "version": "0.1.3",
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",