@modular-circuit/transpiler 0.0.72 → 0.0.74
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 +5 -1
- package/build/converter/netlist_to_kicad/layout.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/layout.js +18 -7
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/netlist_converter.js +13 -11
- package/package.json +3 -3
|
@@ -16,10 +16,14 @@ export interface BlockLabelPadding {
|
|
|
16
16
|
outer: LabelPadding;
|
|
17
17
|
total_pin_num: number;
|
|
18
18
|
}
|
|
19
|
+
export interface BoxGeometry {
|
|
20
|
+
box: BOX2;
|
|
21
|
+
bounding_box: BOX2;
|
|
22
|
+
}
|
|
19
23
|
export declare class Layout {
|
|
20
24
|
private width;
|
|
21
25
|
private height;
|
|
22
26
|
private max_height;
|
|
23
|
-
|
|
27
|
+
get_block_geometry(factor: BlockLabelPadding): BoxGeometry;
|
|
24
28
|
}
|
|
25
29
|
//# 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;AAEvC,eAAO,MAAM,SAAS,QAAY,CAAA;AAQlC,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM;;;EAE/C;AAKD,eAAO,MAAM,aAAa,QAAgB,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;AAQ1C,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"}
|
|
@@ -10,11 +10,12 @@ export function get_power_pos(pwr_number) {
|
|
|
10
10
|
}
|
|
11
11
|
var BLOCK_START_Y = 36 * GRID_SIZE;
|
|
12
12
|
var BLOCK_START_X = BLOCK_START_Y;
|
|
13
|
-
export var BLOCK_PIN_GAP =
|
|
13
|
+
export var BLOCK_PIN_GAP = 3 * GRID_SIZE;
|
|
14
14
|
var BLOCK_MARGIN_TOP = 8 * GRID_SIZE;
|
|
15
|
-
var MIN_BLOCK_WIDTH =
|
|
15
|
+
var MIN_BLOCK_WIDTH = 8 * GRID_SIZE;
|
|
16
16
|
var BLOCK_MARGIN_LEFT = 16 * GRID_SIZE;
|
|
17
17
|
var BLOCK_MARGIN_RIGHT = BLOCK_MARGIN_LEFT;
|
|
18
|
+
var INTERNAL_LABEL_MARGIN = 8 * FONT_SIZE;
|
|
18
19
|
export var WIRE_PADDING = GRID_SIZE;
|
|
19
20
|
var Layout = /** @class */ (function () {
|
|
20
21
|
function Layout() {
|
|
@@ -22,16 +23,16 @@ var Layout = /** @class */ (function () {
|
|
|
22
23
|
this.height = BLOCK_START_Y;
|
|
23
24
|
this.max_height = 0;
|
|
24
25
|
}
|
|
25
|
-
Layout.prototype.
|
|
26
|
+
Layout.prototype.get_block_geometry = function (factor) {
|
|
26
27
|
var block_height = (BLOCK_PIN_GAP * factor.total_pin_num) / 2 + BLOCK_PIN_GAP * 2;
|
|
27
|
-
var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side +
|
|
28
|
+
var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + INTERNAL_LABEL_MARGIN);
|
|
28
29
|
var block_bounding_width = Math.max(block_width, factor.internal.l_side +
|
|
29
30
|
factor.internal.r_side +
|
|
30
31
|
factor.outer.l_side +
|
|
31
32
|
factor.outer.r_side +
|
|
32
33
|
// | txt | | txt |
|
|
33
34
|
WIRE_PADDING * 4);
|
|
34
|
-
var
|
|
35
|
+
var box = {
|
|
35
36
|
pos: {
|
|
36
37
|
x: this.width,
|
|
37
38
|
y: this.height,
|
|
@@ -41,14 +42,24 @@ var Layout = /** @class */ (function () {
|
|
|
41
42
|
y: block_height,
|
|
42
43
|
},
|
|
43
44
|
};
|
|
45
|
+
var bounding_box = {
|
|
46
|
+
pos: {
|
|
47
|
+
x: this.width,
|
|
48
|
+
y: this.height,
|
|
49
|
+
},
|
|
50
|
+
size: {
|
|
51
|
+
x: block_bounding_width,
|
|
52
|
+
y: block_height,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
44
55
|
this.max_height = Math.max(this.max_height, block_height);
|
|
45
56
|
this.width += block_bounding_width + BLOCK_MARGIN_LEFT;
|
|
46
|
-
if (this.width + BLOCK_MARGIN_RIGHT +
|
|
57
|
+
if (this.width + BLOCK_MARGIN_RIGHT + MIN_BLOCK_WIDTH + BLOCK_MARGIN_LEFT > POWER_START_X) {
|
|
47
58
|
this.width = BLOCK_START_X;
|
|
48
59
|
this.height += this.max_height + BLOCK_MARGIN_TOP;
|
|
49
60
|
this.max_height = 0;
|
|
50
61
|
}
|
|
51
|
-
return
|
|
62
|
+
return { box: box, bounding_box: bounding_box };
|
|
52
63
|
};
|
|
53
64
|
return Layout;
|
|
54
65
|
}());
|
|
@@ -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;AAatD,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;
|
|
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;AAatD,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;IAiEnB,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,2BAA2B;IA8CnC,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,iBAAiB;IAgCzB,OAAO,CAAC,iBAAiB;CAQ1B"}
|
|
@@ -155,33 +155,35 @@ var NetListConverter = /** @class */ (function () {
|
|
|
155
155
|
finally { if (e_4) throw e_4.error; }
|
|
156
156
|
}
|
|
157
157
|
var sheet_names_count = new Map();
|
|
158
|
+
var ordered_sheets = schematic.sheet_symbols.sort(function (a, b) {
|
|
159
|
+
return b.pins.length - a.pins.length;
|
|
160
|
+
});
|
|
158
161
|
try {
|
|
159
|
-
for (var
|
|
160
|
-
|
|
161
|
-
})), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
162
|
-
var it_3 = _j.value;
|
|
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
|
+
var it_3 = ordered_sheets_1_1.value;
|
|
163
164
|
var sheet_padding = this.get_sheet_symbol_lb_padding(it_3);
|
|
164
|
-
|
|
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);
|
|
165
167
|
}
|
|
166
168
|
}
|
|
167
169
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
168
170
|
finally {
|
|
169
171
|
try {
|
|
170
|
-
if (
|
|
172
|
+
if (ordered_sheets_1_1 && !ordered_sheets_1_1.done && (_b = ordered_sheets_1.return)) _b.call(ordered_sheets_1);
|
|
171
173
|
}
|
|
172
174
|
finally { if (e_5) throw e_5.error; }
|
|
173
175
|
}
|
|
174
176
|
try {
|
|
175
177
|
// Finally the hierarchical labels
|
|
176
|
-
for (var
|
|
177
|
-
var it_4 =
|
|
178
|
+
for (var _h = __values(schematic.hiera_labels), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
179
|
+
var it_4 = _j.value;
|
|
178
180
|
this.convert_hierarchical_label(it_4, sch);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
182
184
|
finally {
|
|
183
185
|
try {
|
|
184
|
-
if (
|
|
186
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
185
187
|
}
|
|
186
188
|
finally { if (e_6) throw e_6.error; }
|
|
187
189
|
}
|
|
@@ -190,11 +192,11 @@ var NetListConverter = /** @class */ (function () {
|
|
|
190
192
|
};
|
|
191
193
|
NetListConverter.prototype.convert_hierarchical_label = function (pin, sch) {
|
|
192
194
|
var _a;
|
|
193
|
-
var pin_pos = this.block_calc.
|
|
195
|
+
var pin_pos = this.block_calc.get_block_geometry({
|
|
194
196
|
internal: { l_side: 0, r_side: 0 },
|
|
195
197
|
outer: { l_side: 0, r_side: 0 },
|
|
196
198
|
total_pin_num: 1,
|
|
197
|
-
}).pos;
|
|
199
|
+
}).box.pos;
|
|
198
200
|
(_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));
|
|
199
201
|
};
|
|
200
202
|
NetListConverter.prototype.convert_pwr_symbol = function (pwr, at, sch) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/transpiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
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/ir": "0.0.58",
|
|
30
|
-
"@modular-circuit/electronics-model": "0.0.51",
|
|
31
30
|
"@modular-circuit/perc": "0.0.58",
|
|
32
|
-
"@modular-circuit/utils": "0.0.37"
|
|
31
|
+
"@modular-circuit/utils": "0.0.37",
|
|
32
|
+
"@modular-circuit/electronics-model": "0.0.51"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"clean": "rimraf build",
|