@modular-circuit/transpiler 0.0.92 → 0.0.95
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/build/converter/netlist_to_kicad/layout.d.ts +8 -18
- package/build/converter/netlist_to_kicad/layout.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/layout.js +46 -185
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts +2 -0
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/netlist_converter.js +32 -28
- package/package.json +3 -3
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { BOX2 } from '@modular-circuit/electronics-model';
|
|
2
2
|
export declare const GRID_SIZE: number;
|
|
3
3
|
export declare const FONT_SIZE: number;
|
|
4
|
+
export declare function get_power_pos(pwr_number: number): {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
4
8
|
export declare const BLOCK_PIN_GAP: number;
|
|
5
9
|
export declare const BLOCK_PIN_TB_MARGIN: number;
|
|
6
10
|
export declare const WIRE_PADDING: number;
|
|
@@ -17,24 +21,10 @@ export interface BoxGeometry {
|
|
|
17
21
|
box: BOX2;
|
|
18
22
|
bounding_box: BOX2;
|
|
19
23
|
}
|
|
20
|
-
export declare function get_power_pos(pwr_number: number): {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
};
|
|
24
24
|
export declare class Layout {
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* PHASE 1: Create provisional columns using greedy online assignment.
|
|
31
|
-
*/
|
|
32
|
-
private initial_column_assign;
|
|
33
|
-
/**
|
|
34
|
-
* PHASE 2: Rebalance columns globally.
|
|
35
|
-
* Produce near-equal column heights for professional appearance.
|
|
36
|
-
*/
|
|
37
|
-
private rebalance_columns;
|
|
38
|
-
finalize(): BoxGeometry[];
|
|
25
|
+
private width;
|
|
26
|
+
private height;
|
|
27
|
+
private max_height;
|
|
28
|
+
get_block_geometry(factor: BlockLabelPadding): BoxGeometry;
|
|
39
29
|
}
|
|
40
30
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAI9D,eAAO,MAAM,SAAS,QAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAI9D,eAAO,MAAM,SAAS,QAAiB,CAAA;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;AAQlC,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM;;;EAE/C;AAKD,eAAO,MAAM,aAAa,QAAgB,CAAA;AAE1C,eAAO,MAAM,mBAAmB,QAAgB,CAAA;AAQhD,eAAO,MAAM,YAAY,QAAY,CAAA;AAErC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,YAAY,CAAA;IACtB,KAAK,EAAE,YAAY,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,IAAI,CAAA;IACT,YAAY,EAAE,IAAI,CAAA;CACnB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,MAAM,CAAgB;IAE9B,OAAO,CAAC,UAAU,CAAI;IAEf,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW;CAoDlE"}
|
|
@@ -1,205 +1,66 @@
|
|
|
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
1
|
import { PAPER_SIZE } from '../../utils/constraints';
|
|
13
2
|
var MIL_TO_MM = 0.0254;
|
|
14
3
|
export var GRID_SIZE = 50 * MIL_TO_MM;
|
|
15
4
|
export var FONT_SIZE = GRID_SIZE;
|
|
16
|
-
var BLOCK_START_Y = 5 * GRID_SIZE;
|
|
17
|
-
var BLOCK_START_X = 5 * GRID_SIZE;
|
|
18
|
-
export var BLOCK_PIN_GAP = 4 * GRID_SIZE;
|
|
19
|
-
export var BLOCK_PIN_TB_MARGIN = 2 * GRID_SIZE;
|
|
20
|
-
var BLOCK_MARGIN_TOP = 6 * GRID_SIZE;
|
|
21
|
-
var BLOCK_MARGIN_LEFT = 4 * GRID_SIZE;
|
|
22
|
-
var INTERNAL_LABEL_MARGIN = 3 * FONT_SIZE;
|
|
23
|
-
var MIN_BLOCK_WIDTH = 8 * GRID_SIZE;
|
|
24
|
-
export var WIRE_PADDING = GRID_SIZE;
|
|
25
5
|
var POWER_START_Y = 30 * GRID_SIZE;
|
|
26
6
|
var POWER_START_X = (PAPER_SIZE.A4.height - 30) * GRID_SIZE;
|
|
27
7
|
var POWER_Y_STEP = 16 * GRID_SIZE;
|
|
28
8
|
export function get_power_pos(pwr_number) {
|
|
29
9
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
30
10
|
}
|
|
11
|
+
var BLOCK_START_Y = 36 * GRID_SIZE;
|
|
12
|
+
var BLOCK_START_X = BLOCK_START_Y;
|
|
13
|
+
export var BLOCK_PIN_GAP = 4 * GRID_SIZE;
|
|
14
|
+
export var BLOCK_PIN_TB_MARGIN = 2 * GRID_SIZE;
|
|
15
|
+
var BLOCK_MARGIN_TOP = 8 * GRID_SIZE;
|
|
16
|
+
var MIN_BLOCK_WIDTH = 8 * GRID_SIZE;
|
|
17
|
+
var BLOCK_MARGIN_LEFT = 16 * GRID_SIZE;
|
|
18
|
+
var BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
19
|
+
var INTERNAL_LABEL_MARGIN = 8 * FONT_SIZE;
|
|
20
|
+
export var WIRE_PADDING = GRID_SIZE;
|
|
31
21
|
var Layout = /** @class */ (function () {
|
|
32
22
|
function Layout() {
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
this.assignments = [];
|
|
23
|
+
this.width = BLOCK_START_X;
|
|
24
|
+
this.height = BLOCK_START_Y;
|
|
25
|
+
this.max_height = 0;
|
|
37
26
|
}
|
|
38
|
-
Layout.prototype.
|
|
27
|
+
Layout.prototype.get_block_geometry = function (factor) {
|
|
39
28
|
var block_height = Math.floor(factor.total_pin_num / 2) * BLOCK_PIN_GAP + 2 * BLOCK_PIN_TB_MARGIN;
|
|
40
29
|
var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + INTERNAL_LABEL_MARGIN);
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
var block_bounding_width = Math.max(block_width, factor.internal.l_side +
|
|
31
|
+
factor.internal.r_side +
|
|
32
|
+
factor.outer.l_side +
|
|
33
|
+
factor.outer.r_side +
|
|
34
|
+
// | txt | | txt |
|
|
35
|
+
WIRE_PADDING * 4);
|
|
36
|
+
var box = {
|
|
37
|
+
pos: {
|
|
38
|
+
x: this.width,
|
|
39
|
+
y: this.height,
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
x: block_width,
|
|
43
|
+
y: block_height,
|
|
44
|
+
},
|
|
46
45
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// find shortest column
|
|
64
|
-
var bestIdx = 0;
|
|
65
|
-
for (var c = 1; c < cols.length; c++) {
|
|
66
|
-
if (cols[c].height < cols[bestIdx].height)
|
|
67
|
-
bestIdx = c;
|
|
68
|
-
}
|
|
69
|
-
var best = cols[bestIdx];
|
|
70
|
-
var newColWidth = Math.max(best.width, b.bounding_width);
|
|
71
|
-
// Check if expanding this column fits page width
|
|
72
|
-
var currentTotalWidth = cols.reduce(function (s, c) { return s + c.width; }, 0) + BLOCK_MARGIN_LEFT * (cols.length - 1);
|
|
73
|
-
var totalIfExpand = currentTotalWidth - best.width + newColWidth;
|
|
74
|
-
if (totalIfExpand <= this.PAGE_MAX_WIDTH - BLOCK_START_X) {
|
|
75
|
-
// expand best column
|
|
76
|
-
best.width = newColWidth;
|
|
77
|
-
this.assignments.push(bestIdx);
|
|
78
|
-
best.height += b.height + BLOCK_MARGIN_TOP;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
// try new column
|
|
82
|
-
var widthIfNew = currentTotalWidth + BLOCK_MARGIN_LEFT + b.bounding_width;
|
|
83
|
-
if (widthIfNew <= this.PAGE_MAX_WIDTH - BLOCK_START_X) {
|
|
84
|
-
cols.push({
|
|
85
|
-
height: b.height + BLOCK_MARGIN_TOP,
|
|
86
|
-
width: b.bounding_width,
|
|
87
|
-
});
|
|
88
|
-
this.assignments.push(cols.length - 1);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
// fallback: place in best column even if slightly overflowing
|
|
92
|
-
best.width = newColWidth;
|
|
93
|
-
this.assignments.push(bestIdx);
|
|
94
|
-
best.height += b.height + BLOCK_MARGIN_TOP;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return cols;
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* PHASE 2: Rebalance columns globally.
|
|
102
|
-
* Produce near-equal column heights for professional appearance.
|
|
103
|
-
*/
|
|
104
|
-
Layout.prototype.rebalance_columns = function (initialCols) {
|
|
105
|
-
var _this = this;
|
|
106
|
-
var colCount = initialCols.length;
|
|
107
|
-
var itemsPerColumn = Array.from({ length: colCount }, function () { return []; });
|
|
108
|
-
for (var i = 0; i < this.blocks.length; i++) {
|
|
109
|
-
itemsPerColumn[this.assignments[i]].push(i);
|
|
110
|
-
}
|
|
111
|
-
// Compute heights per column
|
|
112
|
-
var heights = itemsPerColumn.map(function (colIndices) {
|
|
113
|
-
return colIndices.reduce(function (sum, idx) { return sum + _this.blocks[idx].height + BLOCK_MARGIN_TOP; }, 0);
|
|
114
|
-
});
|
|
115
|
-
// Simple redistribution: move from tallest to shortest until balanced
|
|
116
|
-
var changed = true;
|
|
117
|
-
while (changed) {
|
|
118
|
-
changed = false;
|
|
119
|
-
// Find tallest & shortest
|
|
120
|
-
var maxIdx = 0;
|
|
121
|
-
var minIdx = 0;
|
|
122
|
-
for (var i = 1; i < colCount; i++) {
|
|
123
|
-
if (heights[i] > heights[maxIdx])
|
|
124
|
-
maxIdx = i;
|
|
125
|
-
if (heights[i] < heights[minIdx])
|
|
126
|
-
minIdx = i;
|
|
127
|
-
}
|
|
128
|
-
if (heights[maxIdx] - heights[minIdx] < BLOCK_MARGIN_TOP * 2)
|
|
129
|
-
break; // good enough
|
|
130
|
-
// Move one block (the last one) from max column to min column
|
|
131
|
-
var from = itemsPerColumn[maxIdx];
|
|
132
|
-
if (from.length <= 1)
|
|
133
|
-
break;
|
|
134
|
-
var idxToMove = from.pop();
|
|
135
|
-
var b = this.blocks[idxToMove];
|
|
136
|
-
heights[maxIdx] -= b.height + BLOCK_MARGIN_TOP;
|
|
137
|
-
itemsPerColumn[minIdx].push(idxToMove);
|
|
138
|
-
heights[minIdx] += b.height + BLOCK_MARGIN_TOP;
|
|
139
|
-
this.assignments[idxToMove] = minIdx;
|
|
140
|
-
changed = true;
|
|
141
|
-
}
|
|
142
|
-
return itemsPerColumn;
|
|
143
|
-
};
|
|
144
|
-
Layout.prototype.finalize = function () {
|
|
145
|
-
var e_1, _a, e_2, _b;
|
|
146
|
-
var initialCols = this.initial_column_assign();
|
|
147
|
-
var itemsPerColumn = this.rebalance_columns(initialCols);
|
|
148
|
-
var colCount = itemsPerColumn.length;
|
|
149
|
-
// Recompute column widths after rebalancing
|
|
150
|
-
var finalColWidths = new Array(colCount).fill(0);
|
|
151
|
-
for (var c = 0; c < colCount; c++) {
|
|
152
|
-
try {
|
|
153
|
-
for (var _c = (e_1 = void 0, __values(itemsPerColumn[c])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
154
|
-
var idx = _d.value;
|
|
155
|
-
finalColWidths[c] = Math.max(finalColWidths[c], this.blocks[idx].bounding_width);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
159
|
-
finally {
|
|
160
|
-
try {
|
|
161
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
162
|
-
}
|
|
163
|
-
finally { if (e_1) throw e_1.error; }
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// Compute X positions
|
|
167
|
-
var colX = [];
|
|
168
|
-
var x = BLOCK_START_X;
|
|
169
|
-
for (var c = 0; c < colCount; c++) {
|
|
170
|
-
colX[c] = x;
|
|
171
|
-
x += finalColWidths[c] + BLOCK_MARGIN_LEFT;
|
|
172
|
-
}
|
|
173
|
-
// Produce final coordinates
|
|
174
|
-
var result = new Array(this.blocks.length);
|
|
175
|
-
var colY = new Array(colCount).fill(BLOCK_START_Y);
|
|
176
|
-
for (var c = 0; c < colCount; c++) {
|
|
177
|
-
try {
|
|
178
|
-
for (var _e = (e_2 = void 0, __values(itemsPerColumn[c])), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
179
|
-
var idx = _f.value;
|
|
180
|
-
var b = this.blocks[idx];
|
|
181
|
-
result[idx] = {
|
|
182
|
-
box: {
|
|
183
|
-
pos: { x: colX[c], y: colY[c] },
|
|
184
|
-
size: { x: b.block_width, y: b.height },
|
|
185
|
-
},
|
|
186
|
-
bounding_box: {
|
|
187
|
-
pos: { x: colX[c], y: colY[c] },
|
|
188
|
-
size: { x: finalColWidths[c], y: b.height },
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
colY[c] += b.height + BLOCK_MARGIN_TOP;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
195
|
-
finally {
|
|
196
|
-
try {
|
|
197
|
-
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
198
|
-
}
|
|
199
|
-
finally { if (e_2) throw e_2.error; }
|
|
200
|
-
}
|
|
46
|
+
var bounding_box = {
|
|
47
|
+
pos: {
|
|
48
|
+
x: this.width,
|
|
49
|
+
y: this.height,
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
x: block_bounding_width,
|
|
53
|
+
y: block_height,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
this.max_height = Math.max(this.max_height, block_height);
|
|
57
|
+
this.width += block_bounding_width + BLOCK_MARGIN_LEFT;
|
|
58
|
+
if (this.width + BLOCK_MARGIN_RIGHT + MIN_BLOCK_WIDTH + BLOCK_MARGIN_LEFT > POWER_START_X) {
|
|
59
|
+
this.width = BLOCK_START_X;
|
|
60
|
+
this.height += this.max_height + BLOCK_MARGIN_TOP;
|
|
61
|
+
this.max_height = 0;
|
|
201
62
|
}
|
|
202
|
-
return
|
|
63
|
+
return { box: box, bounding_box: bounding_box };
|
|
203
64
|
};
|
|
204
65
|
return Layout;
|
|
205
66
|
}());
|
|
@@ -2,6 +2,7 @@ import { type SCHEMATIC } from '@modular-circuit/ir';
|
|
|
2
2
|
import type { NetlistToKicadContext } from './context';
|
|
3
3
|
export declare class NetListConverter {
|
|
4
4
|
private ctx;
|
|
5
|
+
private block_calc;
|
|
5
6
|
private sheet_pwr_count;
|
|
6
7
|
private net_name;
|
|
7
8
|
private wires;
|
|
@@ -17,6 +18,7 @@ export declare class NetListConverter {
|
|
|
17
18
|
* @returns
|
|
18
19
|
*/
|
|
19
20
|
private convert_sch;
|
|
21
|
+
private convert_hierarchical_label;
|
|
20
22
|
private convert_pwr_symbol;
|
|
21
23
|
private get_sheet_symbol_lb_padding;
|
|
22
24
|
private convert_sheet_symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"netlist_converter.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/netlist_converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"netlist_converter.d.ts","sourceRoot":"","sources":["../../../src/converter/netlist_to_kicad/netlist_converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EAGf,MAAM,qBAAqB,CAAA;AAM5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AAKtD,qBAAa,gBAAgB;IASR,OAAO,CAAC,GAAG;IAR9B,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,QAAQ,CAA6B;IAE7C,OAAO,CAAC,KAAK,CAAiB;gBAEH,GAAG,EAAE,qBAAqB;IAQrD,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAI3B,gBAAgB,CAAC,EAAE,EAAE,MAAM;IAIpB,gBAAgB;IAYvB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IA+DnB,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA+CnC,OAAO,CAAC,oBAAoB;IAsC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
|
|
@@ -32,7 +32,7 @@ import { gen_hierarchical_label, gen_net_label, gen_sheet_pin } from '../../kica
|
|
|
32
32
|
import { gen_sch_sheet } from '../../kicad/sheet';
|
|
33
33
|
import { gen_lib_gnd, gen_lib_vcc, gen_sch_gnd, gen_sch_vcc } from '../../kicad/symbols';
|
|
34
34
|
import { GENERATOR_NAME, GENERATOR_VERSION, SCH_VERSION } from '../../utils/constraints';
|
|
35
|
-
import { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, FONT_SIZE, Layout, WIRE_PADDING, get_power_pos
|
|
35
|
+
import { BLOCK_PIN_GAP, BLOCK_PIN_TB_MARGIN, FONT_SIZE, Layout, WIRE_PADDING, get_power_pos } from './layout';
|
|
36
36
|
import { gen_wire } from '../../kicad/wire/gen_wire';
|
|
37
37
|
var NetListConverter = /** @class */ (function () {
|
|
38
38
|
function NetListConverter(ctx) {
|
|
@@ -80,6 +80,7 @@ var NetListConverter = /** @class */ (function () {
|
|
|
80
80
|
for (var _b = __values(Object.entries(this.ctx.netlist.schematics)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
81
81
|
var _d = __read(_c.value, 2), k = _d[0], v = _d[1];
|
|
82
82
|
this.sheet_pwr_count = 0;
|
|
83
|
+
this.block_calc = new Layout();
|
|
83
84
|
all_sch[k] = this.convert_sch(k, v);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
@@ -100,8 +101,8 @@ var NetListConverter = /** @class */ (function () {
|
|
|
100
101
|
* @returns
|
|
101
102
|
*/
|
|
102
103
|
NetListConverter.prototype.convert_sch = function (name, schematic) {
|
|
103
|
-
var e_4, _a, e_5, _b;
|
|
104
|
-
var
|
|
104
|
+
var e_4, _a, e_5, _b, e_6, _c;
|
|
105
|
+
var _d, _e;
|
|
105
106
|
var powers = new Set();
|
|
106
107
|
this.wires = [];
|
|
107
108
|
var sch = {
|
|
@@ -130,15 +131,15 @@ var NetListConverter = /** @class */ (function () {
|
|
|
130
131
|
sheets: [],
|
|
131
132
|
};
|
|
132
133
|
try {
|
|
133
|
-
for (var
|
|
134
|
-
var it_2 =
|
|
134
|
+
for (var _f = __values(schematic.powers), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
135
|
+
var it_2 = _g.value;
|
|
135
136
|
if (!powers.has(it_2.value)) {
|
|
136
137
|
switch (it_2.shape) {
|
|
137
138
|
case PowerShape.VCC:
|
|
138
|
-
(
|
|
139
|
+
(_d = sch.lib_symbols) === null || _d === void 0 ? void 0 : _d.symbols.push(gen_lib_vcc(it_2.value));
|
|
139
140
|
break;
|
|
140
141
|
case PowerShape.GND:
|
|
141
|
-
(
|
|
142
|
+
(_e = sch.lib_symbols) === null || _e === void 0 ? void 0 : _e.symbols.push(gen_lib_gnd(it_2.value));
|
|
142
143
|
break;
|
|
143
144
|
}
|
|
144
145
|
powers.add(it_2.value);
|
|
@@ -149,7 +150,7 @@ var NetListConverter = /** @class */ (function () {
|
|
|
149
150
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
150
151
|
finally {
|
|
151
152
|
try {
|
|
152
|
-
if (
|
|
153
|
+
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
153
154
|
}
|
|
154
155
|
finally { if (e_4) throw e_4.error; }
|
|
155
156
|
}
|
|
@@ -157,12 +158,12 @@ var NetListConverter = /** @class */ (function () {
|
|
|
157
158
|
var ordered_sheets = schematic.sheet_symbols.sort(function (a, b) {
|
|
158
159
|
return b.pins.length - a.pins.length;
|
|
159
160
|
});
|
|
160
|
-
var layout = new Layout();
|
|
161
161
|
try {
|
|
162
162
|
for (var ordered_sheets_1 = __values(ordered_sheets), ordered_sheets_1_1 = ordered_sheets_1.next(); !ordered_sheets_1_1.done; ordered_sheets_1_1 = ordered_sheets_1.next()) {
|
|
163
163
|
var it_3 = ordered_sheets_1_1.value;
|
|
164
164
|
var sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
|
|
165
|
-
|
|
165
|
+
var block_geo = this.block_calc.get_block_geometry(sheet_padding);
|
|
166
|
+
this.convert_sheet_symbol(it_3, block_geo.box, sch, sheet_names_count);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
@@ -172,28 +173,31 @@ var NetListConverter = /** @class */ (function () {
|
|
|
172
173
|
}
|
|
173
174
|
finally { if (e_5) throw e_5.error; }
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
try {
|
|
177
|
+
for (var _h = __values(schematic.hiera_labels), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
178
|
+
var it_4 = _j.value;
|
|
179
|
+
this.convert_hierarchical_label(it_4, sch);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
183
|
+
finally {
|
|
184
|
+
try {
|
|
185
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
186
|
+
}
|
|
187
|
+
finally { if (e_6) throw e_6.error; }
|
|
180
188
|
}
|
|
181
|
-
// for (const it of schematic.hiera_labels) {
|
|
182
|
-
// this.convert_hierarchical_label(it, sch)
|
|
183
|
-
// }
|
|
184
189
|
sch.wires = this.wires;
|
|
185
190
|
return sch;
|
|
186
191
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
// }
|
|
192
|
+
NetListConverter.prototype.convert_hierarchical_label = function (pin, sch) {
|
|
193
|
+
var _a;
|
|
194
|
+
var pin_pos = this.block_calc.get_block_geometry({
|
|
195
|
+
internal: { l_side: 0, r_side: 0 },
|
|
196
|
+
outer: { l_side: 0, r_side: 0 },
|
|
197
|
+
total_pin_num: 1,
|
|
198
|
+
}).box.pos;
|
|
199
|
+
(_a = sch.labels) === null || _a === void 0 ? void 0 : _a.push(gen_hierarchical_label(pin.name, pin_pos, { horizontal: 'left', vertical: 'bottom' }, 0, pin.shape));
|
|
200
|
+
};
|
|
197
201
|
NetListConverter.prototype.convert_pwr_symbol = function (pwr, at, sch) {
|
|
198
202
|
// NOTE : The power uuid is used as the uuid of its pin ,cause all power symbols have only one pin
|
|
199
203
|
var pin_id = pwr.uuid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"description": "Intermediate representation of the modular circuit",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"files": [
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"js-base64": "^3.7.7",
|
|
28
28
|
"jszip": "^3.10.1",
|
|
29
29
|
"@modular-circuit/electronics-model": "0.0.54",
|
|
30
|
-
"@modular-circuit/perc": "0.0.61",
|
|
31
30
|
"@modular-circuit/ir": "0.0.63",
|
|
32
|
-
"@modular-circuit/utils": "0.0.41"
|
|
31
|
+
"@modular-circuit/utils": "0.0.41",
|
|
32
|
+
"@modular-circuit/perc": "0.0.61"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"clean": "rimraf build",
|