@modular-circuit/transpiler 0.0.94 → 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 +0 -4
- package/build/converter/netlist_to_kicad/layout.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/layout.js +23 -84
- package/build/converter/netlist_to_kicad/netlist_converter.d.ts.map +1 -1
- package/build/converter/netlist_to_kicad/netlist_converter.js +1 -2
- package/package.json +1 -1
|
@@ -25,10 +25,6 @@ export declare class Layout {
|
|
|
25
25
|
private width;
|
|
26
26
|
private height;
|
|
27
27
|
private max_height;
|
|
28
|
-
private current_row_index;
|
|
29
|
-
private current_row_items;
|
|
30
|
-
private flush_row;
|
|
31
28
|
get_block_geometry(factor: BlockLabelPadding): BoxGeometry;
|
|
32
|
-
finalize(): void;
|
|
33
29
|
}
|
|
34
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;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;
|
|
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,39 +1,3 @@
|
|
|
1
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
2
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
3
|
-
if (!m) return o;
|
|
4
|
-
var i = m.call(o), r, ar = [], e;
|
|
5
|
-
try {
|
|
6
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
7
|
-
}
|
|
8
|
-
catch (error) { e = { error: error }; }
|
|
9
|
-
finally {
|
|
10
|
-
try {
|
|
11
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
12
|
-
}
|
|
13
|
-
finally { if (e) throw e.error; }
|
|
14
|
-
}
|
|
15
|
-
return ar;
|
|
16
|
-
};
|
|
17
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
-
if (ar || !(i in from)) {
|
|
20
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
-
ar[i] = from[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
-
};
|
|
26
|
-
var __values = (this && this.__values) || function(o) {
|
|
27
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
28
|
-
if (m) return m.call(o);
|
|
29
|
-
if (o && typeof o.length === "number") return {
|
|
30
|
-
next: function () {
|
|
31
|
-
if (o && i >= o.length) o = void 0;
|
|
32
|
-
return { value: o && o[i++], done: !o };
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
36
|
-
};
|
|
37
1
|
import { PAPER_SIZE } from '../../utils/constraints';
|
|
38
2
|
var MIL_TO_MM = 0.0254;
|
|
39
3
|
export var GRID_SIZE = 50 * MIL_TO_MM;
|
|
@@ -44,7 +8,7 @@ var POWER_Y_STEP = 16 * GRID_SIZE;
|
|
|
44
8
|
export function get_power_pos(pwr_number) {
|
|
45
9
|
return { x: POWER_START_X, y: POWER_START_Y + POWER_Y_STEP * pwr_number };
|
|
46
10
|
}
|
|
47
|
-
var BLOCK_START_Y = GRID_SIZE;
|
|
11
|
+
var BLOCK_START_Y = 36 * GRID_SIZE;
|
|
48
12
|
var BLOCK_START_X = BLOCK_START_Y;
|
|
49
13
|
export var BLOCK_PIN_GAP = 4 * GRID_SIZE;
|
|
50
14
|
export var BLOCK_PIN_TB_MARGIN = 2 * GRID_SIZE;
|
|
@@ -59,70 +23,45 @@ var Layout = /** @class */ (function () {
|
|
|
59
23
|
this.width = BLOCK_START_X;
|
|
60
24
|
this.height = BLOCK_START_Y;
|
|
61
25
|
this.max_height = 0;
|
|
62
|
-
this.current_row_index = 0;
|
|
63
|
-
this.current_row_items = [];
|
|
64
26
|
}
|
|
65
|
-
Layout.prototype.flush_row = function () {
|
|
66
|
-
var e_1, _a;
|
|
67
|
-
if (this.current_row_items.length === 0)
|
|
68
|
-
return;
|
|
69
|
-
// If this row is odd: apply right-to-left packing
|
|
70
|
-
var rtl = this.current_row_index % 2 === 1;
|
|
71
|
-
if (rtl) {
|
|
72
|
-
// right-most limit
|
|
73
|
-
var cursor = POWER_START_X - BLOCK_MARGIN_RIGHT;
|
|
74
|
-
try {
|
|
75
|
-
for (var _b = __values(__spreadArray([], __read(this.current_row_items), false).reverse()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
76
|
-
var item = _c.value;
|
|
77
|
-
var w = item.bounding_box.size.x;
|
|
78
|
-
cursor -= w;
|
|
79
|
-
item.box.pos.x = cursor;
|
|
80
|
-
item.bounding_box.pos.x = cursor;
|
|
81
|
-
cursor -= BLOCK_MARGIN_LEFT;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
85
|
-
finally {
|
|
86
|
-
try {
|
|
87
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
88
|
-
}
|
|
89
|
-
finally { if (e_1) throw e_1.error; }
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// row finished → move to next
|
|
93
|
-
this.current_row_items = [];
|
|
94
|
-
this.current_row_index++;
|
|
95
|
-
};
|
|
96
27
|
Layout.prototype.get_block_geometry = function (factor) {
|
|
97
28
|
var block_height = Math.floor(factor.total_pin_num / 2) * BLOCK_PIN_GAP + 2 * BLOCK_PIN_TB_MARGIN;
|
|
98
29
|
var block_width = Math.max(MIN_BLOCK_WIDTH, factor.internal.l_side + factor.internal.r_side + INTERNAL_LABEL_MARGIN);
|
|
99
|
-
var block_bounding_width = Math.max(block_width, factor.internal.l_side +
|
|
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);
|
|
100
36
|
var box = {
|
|
101
|
-
pos: {
|
|
102
|
-
|
|
37
|
+
pos: {
|
|
38
|
+
x: this.width,
|
|
39
|
+
y: this.height,
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
x: block_width,
|
|
43
|
+
y: block_height,
|
|
44
|
+
},
|
|
103
45
|
};
|
|
104
46
|
var bounding_box = {
|
|
105
|
-
pos: {
|
|
106
|
-
|
|
47
|
+
pos: {
|
|
48
|
+
x: this.width,
|
|
49
|
+
y: this.height,
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
x: block_bounding_width,
|
|
53
|
+
y: block_height,
|
|
54
|
+
},
|
|
107
55
|
};
|
|
108
|
-
this.current_row_items.push({ box: box, bounding_box: bounding_box });
|
|
109
56
|
this.max_height = Math.max(this.max_height, block_height);
|
|
110
|
-
// compute next X
|
|
111
57
|
this.width += block_bounding_width + BLOCK_MARGIN_LEFT;
|
|
112
|
-
// Row break?
|
|
113
58
|
if (this.width + BLOCK_MARGIN_RIGHT + MIN_BLOCK_WIDTH + BLOCK_MARGIN_LEFT > POWER_START_X) {
|
|
114
|
-
this.flush_row();
|
|
115
|
-
// reset for next row
|
|
116
59
|
this.width = BLOCK_START_X;
|
|
117
60
|
this.height += this.max_height + BLOCK_MARGIN_TOP;
|
|
118
61
|
this.max_height = 0;
|
|
119
62
|
}
|
|
120
63
|
return { box: box, bounding_box: bounding_box };
|
|
121
64
|
};
|
|
122
|
-
// When all blocks processed, call this
|
|
123
|
-
Layout.prototype.finalize = function () {
|
|
124
|
-
this.flush_row();
|
|
125
|
-
};
|
|
126
65
|
return Layout;
|
|
127
66
|
}());
|
|
128
67
|
export { Layout };
|
|
@@ -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) {
|
|
@@ -186,7 +186,6 @@ var NetListConverter = /** @class */ (function () {
|
|
|
186
186
|
}
|
|
187
187
|
finally { if (e_6) throw e_6.error; }
|
|
188
188
|
}
|
|
189
|
-
this.block_calc.finalize();
|
|
190
189
|
sch.wires = this.wires;
|
|
191
190
|
return sch;
|
|
192
191
|
};
|