@yowasp/yosys 0.57.985 → 0.58.1010
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/gen/bundle.js +265 -122
- package/gen/yosys-resources.tar +0 -0
- package/gen/yosys.core.wasm +0 -0
- package/lib/api.d.ts +4 -0
- package/package.json +6 -7
- package/gen/resources-yosys.js +0 -428
- package/gen/share/ice40/cells_sim.v +0 -3502
- package/gen/share/nexus/cells_xtra.v +0 -10389
- package/gen/share/quicklogic/qlf_k6n10f/bram_types_sim.v +0 -74035
- package/gen/share/quicklogic/qlf_k6n10f/brams_sim.v +0 -10949
- package/gen/share/xilinx/cells_sim.v +0 -4397
- package/gen/share/xilinx/cells_xtra.v +0 -34120
package/gen/bundle.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// node_modules/@yowasp/runtime/lib/fetch.js
|
|
2
8
|
var fetch;
|
|
3
9
|
if (typeof process === "object" && process.release?.name === "node") {
|
|
4
10
|
fetch = async function(url, options) {
|
|
5
11
|
if (url.protocol === "file:") {
|
|
6
|
-
const { readFile } = await import("fs/promises");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const { readFile } = await import("node:fs/promises");
|
|
13
|
+
const data = await readFile(url);
|
|
14
|
+
const isWasm = url.pathname.endsWith(".wasm");
|
|
15
|
+
const headers = {
|
|
16
|
+
"content-length": data.length,
|
|
17
|
+
"content-type": isWasm ? "application/wasm" : "application/octet-stream"
|
|
18
|
+
};
|
|
19
|
+
return new Response(data, { headers });
|
|
11
20
|
} else {
|
|
12
21
|
return globalThis.fetch(url, options);
|
|
13
22
|
}
|
|
@@ -121,8 +130,13 @@ var TerminalInput = class {
|
|
|
121
130
|
};
|
|
122
131
|
var TerminalOutput = class {
|
|
123
132
|
};
|
|
133
|
+
var nextFilesystemId = /* @__PURE__ */ (function() {
|
|
134
|
+
let id = 0;
|
|
135
|
+
return () => id++;
|
|
136
|
+
})();
|
|
124
137
|
var File = class {
|
|
125
138
|
constructor(data = "") {
|
|
139
|
+
this.id = nextFilesystemId();
|
|
126
140
|
if (data instanceof Uint8Array) {
|
|
127
141
|
this.data = data;
|
|
128
142
|
} else if (typeof data === "string") {
|
|
@@ -135,40 +149,15 @@ var File = class {
|
|
|
135
149
|
return this.data.length;
|
|
136
150
|
}
|
|
137
151
|
};
|
|
138
|
-
var ReadStream = class extends InputStream {
|
|
139
|
-
constructor(file, offset) {
|
|
140
|
-
super();
|
|
141
|
-
this.file = file;
|
|
142
|
-
this.offset = offset;
|
|
143
|
-
}
|
|
144
|
-
read(len) {
|
|
145
|
-
const data = this.file.data.subarray(Number(this.offset), Number(this.offset + len));
|
|
146
|
-
this.offset += len;
|
|
147
|
-
return data;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
var WriteStream = class extends OutputStream {
|
|
151
|
-
constructor(file, offset) {
|
|
152
|
-
super();
|
|
153
|
-
this.file = file;
|
|
154
|
-
this.offset = offset;
|
|
155
|
-
}
|
|
156
|
-
write(contents) {
|
|
157
|
-
const newData = new Uint8Array(this.file.data.length + contents.length);
|
|
158
|
-
newData.set(this.file.data);
|
|
159
|
-
newData.subarray(Number(this.offset)).set(contents);
|
|
160
|
-
this.file.data = newData;
|
|
161
|
-
this.offset += BigInt(contents.length);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
152
|
var Directory = class _Directory {
|
|
165
153
|
constructor(files = {}) {
|
|
154
|
+
this.id = nextFilesystemId();
|
|
166
155
|
this.files = files;
|
|
167
156
|
}
|
|
168
157
|
get size() {
|
|
169
158
|
return Object.keys(this.files).length;
|
|
170
159
|
}
|
|
171
|
-
traverse(path,
|
|
160
|
+
traverse(path, { create = null, remove = false } = {}) {
|
|
172
161
|
let entry = this;
|
|
173
162
|
let separatorAt = -1;
|
|
174
163
|
do {
|
|
@@ -177,7 +166,7 @@ var Directory = class _Directory {
|
|
|
177
166
|
const files = entry.files;
|
|
178
167
|
separatorAt = path.indexOf("/");
|
|
179
168
|
const segment = separatorAt === -1 ? path : path.substring(0, separatorAt);
|
|
180
|
-
if (separatorAt === -1 &&
|
|
169
|
+
if (separatorAt === -1 && remove)
|
|
181
170
|
delete files[segment];
|
|
182
171
|
else if (segment === "" || segment === ".")
|
|
183
172
|
;
|
|
@@ -185,10 +174,12 @@ var Directory = class _Directory {
|
|
|
185
174
|
;
|
|
186
175
|
else if (Object.hasOwn(files, segment))
|
|
187
176
|
entry = files[segment];
|
|
188
|
-
else if (
|
|
177
|
+
else if (create === "directory" || create !== null && separatorAt !== -1)
|
|
189
178
|
entry = files[segment] = new _Directory({});
|
|
190
|
-
else if (
|
|
179
|
+
else if (create === "file")
|
|
191
180
|
entry = files[segment] = new File(new Uint8Array());
|
|
181
|
+
else if (create instanceof File || create instanceof _Directory)
|
|
182
|
+
entry = files[segment] = create;
|
|
192
183
|
else
|
|
193
184
|
throw "no-entry";
|
|
194
185
|
path = path.substring(separatorAt + 1);
|
|
@@ -196,6 +187,33 @@ var Directory = class _Directory {
|
|
|
196
187
|
return entry;
|
|
197
188
|
}
|
|
198
189
|
};
|
|
190
|
+
var ReadStream = class extends InputStream {
|
|
191
|
+
constructor(file, offset) {
|
|
192
|
+
super();
|
|
193
|
+
this.file = file;
|
|
194
|
+
this.offset = offset;
|
|
195
|
+
}
|
|
196
|
+
read(len) {
|
|
197
|
+
const data = this.file.data.subarray(Number(this.offset), Number(this.offset + len));
|
|
198
|
+
this.offset += len;
|
|
199
|
+
return data;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
var WriteStream = class extends OutputStream {
|
|
203
|
+
constructor(file, offset) {
|
|
204
|
+
super();
|
|
205
|
+
this.file = file;
|
|
206
|
+
this.offset = offset;
|
|
207
|
+
}
|
|
208
|
+
write(contents) {
|
|
209
|
+
const offset = Number(this.offset);
|
|
210
|
+
const newData = new Uint8Array(Math.max(this.file.data.length, offset + contents.length));
|
|
211
|
+
newData.set(this.file.data);
|
|
212
|
+
newData.subarray(offset).set(contents);
|
|
213
|
+
this.file.data = newData;
|
|
214
|
+
this.offset += BigInt(contents.length);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
199
217
|
var Descriptor = class _Descriptor {
|
|
200
218
|
constructor(entry) {
|
|
201
219
|
this.entry = entry;
|
|
@@ -210,7 +228,7 @@ var Descriptor = class _Descriptor {
|
|
|
210
228
|
return {};
|
|
211
229
|
}
|
|
212
230
|
metadataHash() {
|
|
213
|
-
return { upper: 0, lower:
|
|
231
|
+
return { upper: 0, lower: this.entry.id };
|
|
214
232
|
}
|
|
215
233
|
metadataHashAt(_pathFlags, path) {
|
|
216
234
|
if (!(this.entry instanceof Directory))
|
|
@@ -242,7 +260,7 @@ var Descriptor = class _Descriptor {
|
|
|
242
260
|
openAt(_pathFlags, path, openFlags, _descriptorFlags) {
|
|
243
261
|
if (!(this.entry instanceof Directory))
|
|
244
262
|
throw "invalid";
|
|
245
|
-
const openEntry = this.entry.traverse(path,
|
|
263
|
+
const openEntry = this.entry.traverse(path, openFlags.create ? { create: "file" } : {});
|
|
246
264
|
if (openFlags.directory) {
|
|
247
265
|
if (!(openEntry instanceof Directory))
|
|
248
266
|
throw "not-directory";
|
|
@@ -272,6 +290,18 @@ var Descriptor = class _Descriptor {
|
|
|
272
290
|
writeViaStream(offset) {
|
|
273
291
|
return new WriteStream(this.entry, offset);
|
|
274
292
|
}
|
|
293
|
+
setSize(size) {
|
|
294
|
+
if (this.entry instanceof Directory)
|
|
295
|
+
throw "is-directory";
|
|
296
|
+
size = Number(size);
|
|
297
|
+
if (size > this.entry.data.length) {
|
|
298
|
+
const newData = new Uint8Array(size);
|
|
299
|
+
newData.set(this.entry.data);
|
|
300
|
+
this.entry.data = newData;
|
|
301
|
+
} else if (size < this.entry.data.length) {
|
|
302
|
+
this.entry.data = this.entry.data.subarray(0, size);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
275
305
|
readDirectory() {
|
|
276
306
|
return new DirectoryEntryStream(this.entry);
|
|
277
307
|
}
|
|
@@ -281,15 +311,28 @@ var Descriptor = class _Descriptor {
|
|
|
281
311
|
unlinkFileAt(path) {
|
|
282
312
|
const pathEntry = this.entry.traverse(path);
|
|
283
313
|
if (pathEntry instanceof Directory)
|
|
284
|
-
|
|
314
|
+
throw "is-directory";
|
|
285
315
|
this.entry.traverse(path, { remove: true });
|
|
286
316
|
}
|
|
287
317
|
removeDirectoryAt(path) {
|
|
288
318
|
const pathEntry = this.entry.traverse(path);
|
|
289
319
|
if (!(pathEntry instanceof Directory))
|
|
290
|
-
|
|
320
|
+
throw "not-directory";
|
|
291
321
|
this.entry.traverse(path, { remove: true });
|
|
292
322
|
}
|
|
323
|
+
readlinkAt(path) {
|
|
324
|
+
const _pathEntry = this.entry.traverse(path);
|
|
325
|
+
throw "invalid";
|
|
326
|
+
}
|
|
327
|
+
renameAt(oldPath, newDescriptor, newPath) {
|
|
328
|
+
if (!(this.entry instanceof Directory))
|
|
329
|
+
throw "not-directory";
|
|
330
|
+
if (!(newDescriptor.entry instanceof Directory))
|
|
331
|
+
throw "not-directory";
|
|
332
|
+
const oldEntry = this.entry.traverse(oldPath);
|
|
333
|
+
this.entry.traverse(newPath, { create: oldEntry });
|
|
334
|
+
this.entry.traverse(oldPath, { remove: true });
|
|
335
|
+
}
|
|
293
336
|
};
|
|
294
337
|
var DirectoryEntryStream = class {
|
|
295
338
|
constructor(directory) {
|
|
@@ -400,8 +443,7 @@ var Environment = class {
|
|
|
400
443
|
filesystemErrorCode() {
|
|
401
444
|
},
|
|
402
445
|
getDirectories() {
|
|
403
|
-
if ($this.root === null)
|
|
404
|
-
return [];
|
|
446
|
+
if ($this.root === null) return [];
|
|
405
447
|
return [[new Descriptor($this.root), "/"]];
|
|
406
448
|
}
|
|
407
449
|
}
|
|
@@ -450,58 +492,61 @@ function lineBuffered(processLine) {
|
|
|
450
492
|
}
|
|
451
493
|
|
|
452
494
|
// node_modules/@yowasp/runtime/lib/api.js
|
|
453
|
-
async function fetchObject(obj, fetchFn) {
|
|
454
|
-
const promises = [];
|
|
455
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
456
|
-
if (typeof value === "string" || value instanceof Uint8Array) {
|
|
457
|
-
promises.push(Promise.resolve([key, value]));
|
|
458
|
-
} else if (value instanceof URL) {
|
|
459
|
-
promises.push(fetchFn(value).then((fetched) => [key, fetched]));
|
|
460
|
-
} else {
|
|
461
|
-
promises.push(fetchObject(value, fetchFn).then((fetched) => [key, fetched]));
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
for (const [key, value] of await Promise.all(promises))
|
|
465
|
-
obj[key] = value;
|
|
466
|
-
return obj;
|
|
467
|
-
}
|
|
468
|
-
function fetchWebAssembly(url) {
|
|
469
|
-
return fetch_default(url).then(WebAssembly.compileStreaming);
|
|
470
|
-
}
|
|
471
|
-
function fetchUint8Array(url) {
|
|
472
|
-
return fetch_default(url).then((resp) => resp.arrayBuffer()).then((buf) => new Uint8Array(buf));
|
|
473
|
-
}
|
|
474
|
-
function fetchResources({ modules, filesystem }) {
|
|
475
|
-
return Promise.all([
|
|
476
|
-
fetchObject(modules, fetchWebAssembly),
|
|
477
|
-
fetchObject(filesystem, fetchUint8Array)
|
|
478
|
-
]).then(([modules2, filesystem2]) => {
|
|
479
|
-
return { modules: modules2, filesystem: filesystem2 };
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
495
|
var Application = class {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
496
|
+
#resourceModule;
|
|
497
|
+
#resourceData;
|
|
498
|
+
#instantiate;
|
|
499
|
+
#argv0;
|
|
500
|
+
constructor(resourceModule, instantiate2, argv0) {
|
|
501
|
+
this.#resourceModule = resourceModule;
|
|
502
|
+
this.#resourceData = null;
|
|
503
|
+
this.#instantiate = instantiate2;
|
|
504
|
+
this.#argv0 = argv0;
|
|
505
|
+
}
|
|
506
|
+
get argv0() {
|
|
507
|
+
return this.#argv0;
|
|
508
|
+
}
|
|
509
|
+
async #fetchResources(fetchProgress) {
|
|
510
|
+
const resourceModule = await this.#resourceModule;
|
|
511
|
+
let fetchFn = fetch_default;
|
|
512
|
+
if (fetchProgress !== void 0) {
|
|
513
|
+
const status = { source: this, totalLength: resourceModule.totalSize, doneLength: 0 };
|
|
514
|
+
fetchProgress(status);
|
|
515
|
+
fetchFn = (input, init) => fetch_default(input, init).then((response) => {
|
|
516
|
+
return new Response(response.body.pipeThrough(new TransformStream({
|
|
517
|
+
transform(chunk, controller) {
|
|
518
|
+
controller.enqueue(chunk);
|
|
519
|
+
status.doneLength += chunk.length;
|
|
520
|
+
fetchProgress(status);
|
|
521
|
+
}
|
|
522
|
+
})), response);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
const [modules2, filesystem2] = await Promise.all([
|
|
526
|
+
resourceModule.modules(fetchFn),
|
|
527
|
+
resourceModule.filesystem(fetchFn)
|
|
528
|
+
]);
|
|
529
|
+
this.#resourceData = { modules: modules2, filesystem: filesystem2 };
|
|
488
530
|
}
|
|
489
531
|
// The `printLine` option is deprecated and not documented but still accepted for compatibility.
|
|
490
532
|
run(args = null, files = {}, options = {}) {
|
|
491
|
-
if (this
|
|
533
|
+
if (this.#resourceData === null) {
|
|
492
534
|
if (options.synchronously)
|
|
493
535
|
throw new Error("Cannot run application synchronously unless resources are prefetched first; use `await run()` to do so");
|
|
494
|
-
|
|
495
|
-
|
|
536
|
+
const defaultFetchProgress = ({ source, totalLength, doneLength }) => {
|
|
537
|
+
const percent = (100 * doneLength / totalLength).toFixed(0);
|
|
538
|
+
console.log(`${source.argv0}: fetched ${percent}% (${doneLength} / ${totalLength})`);
|
|
539
|
+
};
|
|
540
|
+
return this.#fetchResources(options.fetchProgress ?? defaultFetchProgress).then(() => {
|
|
496
541
|
return this.run(args, files, options);
|
|
497
542
|
});
|
|
498
543
|
}
|
|
499
544
|
if (args === null)
|
|
500
545
|
return;
|
|
501
546
|
const environment = new Environment();
|
|
502
|
-
environment.args = [this
|
|
547
|
+
environment.args = [this.#argv0].concat(args);
|
|
503
548
|
environment.root = directoryFromTree(files);
|
|
504
|
-
for (const [dirName, dirContents] of Object.entries(this
|
|
549
|
+
for (const [dirName, dirContents] of Object.entries(this.#resourceData.filesystem))
|
|
505
550
|
environment.root.files[dirName] = directoryFromTree(dirContents);
|
|
506
551
|
const lineBufferedConsole = lineBuffered(options.printLine ?? console.log);
|
|
507
552
|
environment.stdin = options.stdin === void 0 ? null : options.stdin;
|
|
@@ -517,7 +562,7 @@ var Application = class {
|
|
|
517
562
|
if (e instanceof Exit && e.code !== 0)
|
|
518
563
|
error = e;
|
|
519
564
|
}
|
|
520
|
-
for (const dirName of Object.keys(this
|
|
565
|
+
for (const dirName of Object.keys(this.#resourceData.filesystem))
|
|
521
566
|
delete environment.root.files[dirName];
|
|
522
567
|
files = directoryIntoTree(environment.root, { decodeASCII: options.decodeASCII ?? true });
|
|
523
568
|
if (error !== null) {
|
|
@@ -527,17 +572,132 @@ var Application = class {
|
|
|
527
572
|
return files;
|
|
528
573
|
}
|
|
529
574
|
};
|
|
530
|
-
const getCoreModule = (filename) => this
|
|
575
|
+
const getCoreModule = (filename) => this.#resourceData.modules[filename];
|
|
531
576
|
const imports = { runtime: environment.exports };
|
|
532
577
|
if (options.synchronously) {
|
|
533
578
|
const instantiateCore = (module, imports2) => new WebAssembly.Instance(module, imports2);
|
|
534
|
-
return runCommand(this
|
|
579
|
+
return runCommand(this.#instantiate(getCoreModule, imports, instantiateCore));
|
|
535
580
|
} else {
|
|
536
|
-
return this
|
|
581
|
+
return this.#instantiate(getCoreModule, imports).then(runCommand);
|
|
537
582
|
}
|
|
538
583
|
}
|
|
539
584
|
};
|
|
540
585
|
|
|
586
|
+
// gen/yosys-resources.js
|
|
587
|
+
var yosys_resources_exports = {};
|
|
588
|
+
__export(yosys_resources_exports, {
|
|
589
|
+
filesystem: () => filesystem,
|
|
590
|
+
modules: () => modules,
|
|
591
|
+
totalSize: () => totalSize
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
// node_modules/nanotar/dist/index.mjs
|
|
595
|
+
var TAR_TYPE_FILE = 0;
|
|
596
|
+
var TAR_TYPE_DIR = 5;
|
|
597
|
+
function parseTar(data, opts) {
|
|
598
|
+
const buffer = data.buffer || data;
|
|
599
|
+
const files = [];
|
|
600
|
+
let offset = 0;
|
|
601
|
+
while (offset < buffer.byteLength - 512) {
|
|
602
|
+
const name = _readString(buffer, offset, 100);
|
|
603
|
+
if (name.length === 0) {
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
const mode = _readString(buffer, offset + 100, 8).trim();
|
|
607
|
+
const uid = Number.parseInt(_readString(buffer, offset + 108, 8));
|
|
608
|
+
const gid = Number.parseInt(_readString(buffer, offset + 116, 8));
|
|
609
|
+
const size = _readNumber(buffer, offset + 124, 12);
|
|
610
|
+
const seek = 512 + 512 * Math.trunc(size / 512) + (size % 512 ? 512 : 0);
|
|
611
|
+
const mtime = _readNumber(buffer, offset + 136, 12);
|
|
612
|
+
const _type = _readNumber(buffer, offset + 156, 1);
|
|
613
|
+
const type = _type === TAR_TYPE_FILE ? "file" : _type === TAR_TYPE_DIR ? "directory" : _type;
|
|
614
|
+
const user = _readString(buffer, offset + 265, 32);
|
|
615
|
+
const group = _readString(buffer, offset + 297, 32);
|
|
616
|
+
const meta = {
|
|
617
|
+
name,
|
|
618
|
+
type,
|
|
619
|
+
size,
|
|
620
|
+
attrs: {
|
|
621
|
+
mode,
|
|
622
|
+
uid,
|
|
623
|
+
gid,
|
|
624
|
+
mtime,
|
|
625
|
+
user,
|
|
626
|
+
group
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
if (opts?.filter && !opts.filter(meta)) {
|
|
630
|
+
offset += seek;
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
if (opts?.metaOnly) {
|
|
634
|
+
files.push(meta);
|
|
635
|
+
offset += seek;
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
const data2 = _type === TAR_TYPE_DIR ? void 0 : new Uint8Array(buffer, offset + 512, size);
|
|
639
|
+
files.push({
|
|
640
|
+
...meta,
|
|
641
|
+
data: data2,
|
|
642
|
+
get text() {
|
|
643
|
+
return new TextDecoder().decode(this.data);
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
offset += seek;
|
|
647
|
+
}
|
|
648
|
+
return files;
|
|
649
|
+
}
|
|
650
|
+
function _readString(buffer, offset, size) {
|
|
651
|
+
const view = new Uint8Array(buffer, offset, size);
|
|
652
|
+
const i = view.indexOf(0);
|
|
653
|
+
const td = new TextDecoder();
|
|
654
|
+
return td.decode(i === -1 ? view : view.slice(0, i));
|
|
655
|
+
}
|
|
656
|
+
function _readNumber(buffer, offset, size) {
|
|
657
|
+
const view = new Uint8Array(buffer, offset, size);
|
|
658
|
+
let str = "";
|
|
659
|
+
for (let i = 0; i < size; i++) {
|
|
660
|
+
str += String.fromCodePoint(view[i]);
|
|
661
|
+
}
|
|
662
|
+
return Number.parseInt(str, 8);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// gen/yosys-resources.js
|
|
666
|
+
function compileWasmModule(response) {
|
|
667
|
+
if (WebAssembly.compileStreaming !== void 0) {
|
|
668
|
+
return WebAssembly.compileStreaming(response);
|
|
669
|
+
} else {
|
|
670
|
+
return WebAssembly.compile(response.arrayBuffer());
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
function unpackTarFilesystem(buffer) {
|
|
674
|
+
const root = {};
|
|
675
|
+
for (const tarEntry of parseTar(buffer)) {
|
|
676
|
+
const nameParts = tarEntry.name.split("/");
|
|
677
|
+
const dirNames = nameParts.slice(0, -1);
|
|
678
|
+
const fileName = nameParts[nameParts.length - 1];
|
|
679
|
+
let dir = root;
|
|
680
|
+
for (const dirName of dirNames)
|
|
681
|
+
dir = dir[dirName];
|
|
682
|
+
if (tarEntry.type === "directory") {
|
|
683
|
+
dir[fileName] = {};
|
|
684
|
+
} else {
|
|
685
|
+
dir[fileName] = tarEntry.data;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return root;
|
|
689
|
+
}
|
|
690
|
+
var modules = async (fetch2) => ({
|
|
691
|
+
"yosys.core.wasm": await fetch2(new URL("./yosys.core.wasm", import.meta.url)).then(compileWasmModule),
|
|
692
|
+
"yosys.core2.wasm": await fetch2(new URL("./yosys.core2.wasm", import.meta.url)).then(compileWasmModule),
|
|
693
|
+
"yosys.core3.wasm": await fetch2(new URL("./yosys.core3.wasm", import.meta.url)).then(compileWasmModule),
|
|
694
|
+
"yosys.core4.wasm": await fetch2(new URL("./yosys.core4.wasm", import.meta.url)).then(compileWasmModule)
|
|
695
|
+
});
|
|
696
|
+
var filesystem = async (fetch2) => ({
|
|
697
|
+
"share": await fetch2(new URL("./yosys-resources.tar", import.meta.url)).then((resp) => resp.arrayBuffer()).then(unpackTarFilesystem)
|
|
698
|
+
});
|
|
699
|
+
var totalSize = 48344675;
|
|
700
|
+
|
|
541
701
|
// gen/yosys.js
|
|
542
702
|
var ComponentError = class extends Error {
|
|
543
703
|
constructor(value) {
|
|
@@ -550,10 +710,8 @@ var curResourceBorrows = [];
|
|
|
550
710
|
var dv = new DataView(new ArrayBuffer());
|
|
551
711
|
var dataView = (mem) => dv.buffer === mem.buffer ? dv : dv = new DataView(mem.buffer);
|
|
552
712
|
function getErrorPayload(e) {
|
|
553
|
-
if (e && hasOwnProperty.call(e, "payload"))
|
|
554
|
-
|
|
555
|
-
if (e instanceof Error)
|
|
556
|
-
throw e;
|
|
713
|
+
if (e && hasOwnProperty.call(e, "payload")) return e.payload;
|
|
714
|
+
if (e instanceof Error) throw e;
|
|
557
715
|
return e;
|
|
558
716
|
}
|
|
559
717
|
var handleTables = [];
|
|
@@ -576,8 +734,7 @@ function rscTableRemove(table, handle) {
|
|
|
576
734
|
const val = table[(handle << 1) + 1];
|
|
577
735
|
const own = (val & T_FLAG) !== 0;
|
|
578
736
|
const rep = val & ~T_FLAG;
|
|
579
|
-
if (val === 0 || (scope & T_FLAG) !== 0)
|
|
580
|
-
throw new TypeError("Invalid handle");
|
|
737
|
+
if (val === 0 || (scope & T_FLAG) !== 0) throw new TypeError("Invalid handle");
|
|
581
738
|
table[handle << 1] = table[0] | T_FLAG;
|
|
582
739
|
table[0] = handle | T_FLAG;
|
|
583
740
|
return { rep, scope, own };
|
|
@@ -594,8 +751,7 @@ var utf8Decoder = new TextDecoder();
|
|
|
594
751
|
var utf8Encoder = new TextEncoder();
|
|
595
752
|
var utf8EncodedLen = 0;
|
|
596
753
|
function utf8Encode(s, realloc, memory) {
|
|
597
|
-
if (typeof s !== "string")
|
|
598
|
-
throw new TypeError("expected a string");
|
|
754
|
+
if (typeof s !== "string") throw new TypeError("expected a string");
|
|
599
755
|
if (s.length === 0) {
|
|
600
756
|
utf8EncodedLen = 0;
|
|
601
757
|
return 1;
|
|
@@ -645,7 +801,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
645
801
|
} = monotonicClock;
|
|
646
802
|
const { getRandomBytes } = random;
|
|
647
803
|
const { now: now$1 } = wallClock;
|
|
648
|
-
let gen = function* init() {
|
|
804
|
+
let gen = (function* init() {
|
|
649
805
|
let exports0;
|
|
650
806
|
let exports1;
|
|
651
807
|
function trampoline0() {
|
|
@@ -5090,8 +5246,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5090
5246
|
if (handleEntry.own) {
|
|
5091
5247
|
const rsc = captureTable7.get(handleEntry.rep);
|
|
5092
5248
|
if (rsc) {
|
|
5093
|
-
if (rsc[symbolDispose])
|
|
5094
|
-
rsc[symbolDispose]();
|
|
5249
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5095
5250
|
captureTable7.delete(handleEntry.rep);
|
|
5096
5251
|
} else if (DirectoryEntryStream2[symbolCabiDispose]) {
|
|
5097
5252
|
DirectoryEntryStream2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5103,8 +5258,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5103
5258
|
if (handleEntry.own) {
|
|
5104
5259
|
const rsc = captureTable3.get(handleEntry.rep);
|
|
5105
5260
|
if (rsc) {
|
|
5106
|
-
if (rsc[symbolDispose])
|
|
5107
|
-
rsc[symbolDispose]();
|
|
5261
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5108
5262
|
captureTable3.delete(handleEntry.rep);
|
|
5109
5263
|
} else if (OutputStream2[symbolCabiDispose]) {
|
|
5110
5264
|
OutputStream2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5116,8 +5270,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5116
5270
|
if (handleEntry.own) {
|
|
5117
5271
|
const rsc = captureTable0.get(handleEntry.rep);
|
|
5118
5272
|
if (rsc) {
|
|
5119
|
-
if (rsc[symbolDispose])
|
|
5120
|
-
rsc[symbolDispose]();
|
|
5273
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5121
5274
|
captureTable0.delete(handleEntry.rep);
|
|
5122
5275
|
} else if (Error$1[symbolCabiDispose]) {
|
|
5123
5276
|
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5129,8 +5282,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5129
5282
|
if (handleEntry.own) {
|
|
5130
5283
|
const rsc = captureTable2.get(handleEntry.rep);
|
|
5131
5284
|
if (rsc) {
|
|
5132
|
-
if (rsc[symbolDispose])
|
|
5133
|
-
rsc[symbolDispose]();
|
|
5285
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5134
5286
|
captureTable2.delete(handleEntry.rep);
|
|
5135
5287
|
} else if (InputStream2[symbolCabiDispose]) {
|
|
5136
5288
|
InputStream2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5142,8 +5294,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5142
5294
|
if (handleEntry.own) {
|
|
5143
5295
|
const rsc = captureTable6.get(handleEntry.rep);
|
|
5144
5296
|
if (rsc) {
|
|
5145
|
-
if (rsc[symbolDispose])
|
|
5146
|
-
rsc[symbolDispose]();
|
|
5297
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5147
5298
|
captureTable6.delete(handleEntry.rep);
|
|
5148
5299
|
} else if (Descriptor2[symbolCabiDispose]) {
|
|
5149
5300
|
Descriptor2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5155,8 +5306,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5155
5306
|
if (handleEntry.own) {
|
|
5156
5307
|
const rsc = captureTable1.get(handleEntry.rep);
|
|
5157
5308
|
if (rsc) {
|
|
5158
|
-
if (rsc[symbolDispose])
|
|
5159
|
-
rsc[symbolDispose]();
|
|
5309
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5160
5310
|
captureTable1.delete(handleEntry.rep);
|
|
5161
5311
|
} else if (Pollable[symbolCabiDispose]) {
|
|
5162
5312
|
Pollable[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5168,8 +5318,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5168
5318
|
if (handleEntry.own) {
|
|
5169
5319
|
const rsc = captureTable4.get(handleEntry.rep);
|
|
5170
5320
|
if (rsc) {
|
|
5171
|
-
if (rsc[symbolDispose])
|
|
5172
|
-
rsc[symbolDispose]();
|
|
5321
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5173
5322
|
captureTable4.delete(handleEntry.rep);
|
|
5174
5323
|
} else if (TerminalInput2[symbolCabiDispose]) {
|
|
5175
5324
|
TerminalInput2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5181,8 +5330,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5181
5330
|
if (handleEntry.own) {
|
|
5182
5331
|
const rsc = captureTable5.get(handleEntry.rep);
|
|
5183
5332
|
if (rsc) {
|
|
5184
|
-
if (rsc[symbolDispose])
|
|
5185
|
-
rsc[symbolDispose]();
|
|
5333
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
5186
5334
|
captureTable5.delete(handleEntry.rep);
|
|
5187
5335
|
} else if (TerminalOutput2[symbolCabiDispose]) {
|
|
5188
5336
|
TerminalOutput2[symbolCabiDispose](handleEntry.rep);
|
|
@@ -5411,7 +5559,7 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5411
5559
|
run
|
|
5412
5560
|
};
|
|
5413
5561
|
return { run: run020, "wasi:cli/run@0.2.0": run020 };
|
|
5414
|
-
}();
|
|
5562
|
+
})();
|
|
5415
5563
|
let promise, resolve, reject;
|
|
5416
5564
|
function runNext(value) {
|
|
5417
5565
|
try {
|
|
@@ -5420,19 +5568,14 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5420
5568
|
({ value, done } = gen.next(value));
|
|
5421
5569
|
} while (!(value instanceof Promise) && !done);
|
|
5422
5570
|
if (done) {
|
|
5423
|
-
if (resolve)
|
|
5424
|
-
|
|
5425
|
-
else
|
|
5426
|
-
return value;
|
|
5571
|
+
if (resolve) resolve(value);
|
|
5572
|
+
else return value;
|
|
5427
5573
|
}
|
|
5428
|
-
if (!promise)
|
|
5429
|
-
promise = new Promise((_resolve, _reject) => (resolve = _resolve, reject = _reject));
|
|
5574
|
+
if (!promise) promise = new Promise((_resolve, _reject) => (resolve = _resolve, reject = _reject));
|
|
5430
5575
|
value.then((nextVal) => done ? resolve() : runNext(nextVal), reject);
|
|
5431
5576
|
} catch (e) {
|
|
5432
|
-
if (reject)
|
|
5433
|
-
|
|
5434
|
-
else
|
|
5435
|
-
throw e;
|
|
5577
|
+
if (reject) reject(e);
|
|
5578
|
+
else throw e;
|
|
5436
5579
|
}
|
|
5437
5580
|
}
|
|
5438
5581
|
const maybeSyncReturn = runNext(null);
|
|
@@ -5440,10 +5583,10 @@ function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.insta
|
|
|
5440
5583
|
}
|
|
5441
5584
|
|
|
5442
5585
|
// lib/api.js
|
|
5443
|
-
var yosys = new Application(
|
|
5586
|
+
var yosys = new Application(yosys_resources_exports, instantiate, "yowasp-yosys");
|
|
5444
5587
|
var runYosys = yosys.run.bind(yosys);
|
|
5445
5588
|
var commands = { "yosys": runYosys };
|
|
5446
|
-
var version = "0.
|
|
5589
|
+
var version = "0.58.1010";
|
|
5447
5590
|
export {
|
|
5448
5591
|
Exit,
|
|
5449
5592
|
commands,
|
|
Binary file
|
package/gen/yosys.core.wasm
CHANGED
|
Binary file
|
package/lib/api.d.ts
CHANGED
|
@@ -8,12 +8,16 @@ export type InputStream =
|
|
|
8
8
|
export type OutputStream =
|
|
9
9
|
(bytes: Uint8Array | null) => void;
|
|
10
10
|
|
|
11
|
+
export type ProgressCallback =
|
|
12
|
+
(event: { source: object, totalLength: number, doneLength: number }) => void;
|
|
13
|
+
|
|
11
14
|
export type RunOptions = {
|
|
12
15
|
stdin?: InputStream | null;
|
|
13
16
|
stdout?: OutputStream | null;
|
|
14
17
|
stderr?: OutputStream | null;
|
|
15
18
|
decodeASCII?: boolean;
|
|
16
19
|
synchronously?: boolean;
|
|
20
|
+
fetchProgress?: ProgressCallback;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export type Command =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yowasp/yosys",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.1010",
|
|
4
4
|
"description": "Yosys Open SYnthesis Suite",
|
|
5
5
|
"author": "Catherine <whitequark@whitequark.org>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"lib/api.d.ts",
|
|
18
18
|
"gen/bundle.js",
|
|
19
|
-
"gen/resources-*.js",
|
|
20
19
|
"gen/*.wasm",
|
|
21
|
-
"gen
|
|
20
|
+
"gen/*-resources.tar"
|
|
22
21
|
],
|
|
23
22
|
"exports": {
|
|
24
23
|
"types": "./lib/api.d.ts",
|
|
@@ -27,13 +26,13 @@
|
|
|
27
26
|
"types": "./lib/api.d.ts",
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@bytecodealliance/jco": "1.3.0",
|
|
30
|
-
"@yowasp/runtime": "
|
|
31
|
-
"esbuild": "^0.
|
|
29
|
+
"@yowasp/runtime": "11.0.66",
|
|
30
|
+
"esbuild": "^0.25.11"
|
|
32
31
|
},
|
|
33
32
|
"scripts": {
|
|
34
33
|
"transpile": "jco new ../yosys-build/yosys.wasm --wasi-command --output yosys.wasm && jco transpile yosys.wasm --instantiation async --no-typescript --no-namespaced-exports --map 'wasi:io/*=runtime#io' --map 'wasi:cli/*=runtime#cli' --map 'wasi:clocks/*=runtime#*' --map 'wasi:filesystem/*=runtime#fs' --map 'wasi:random/*=runtime#random' --out-dir gen/",
|
|
35
|
-
"pack": "yowasp-pack-resources gen/resources
|
|
36
|
-
"build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --
|
|
34
|
+
"pack": "yowasp-pack-resources gen/yosys-resources.js gen ../yosys-build/share",
|
|
35
|
+
"build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node --define:VERSION=\\\"0.58.1010\\\"",
|
|
37
36
|
"all": "npm run transpile && npm run pack && npm run build"
|
|
38
37
|
}
|
|
39
38
|
}
|