@yowasp/yosys 0.0.0-experimental4 → 0.37.13-dev.624
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/README.md +47 -0
- package/gen/bundle-browser.js +21 -5
- package/gen/bundle-node.js +21 -5
- package/gen/yosys-share.json +1 -1
- package/gen/yosys.core.wasm +0 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
YoWASP Yosys package
|
|
2
|
+
====================
|
|
3
|
+
|
|
4
|
+
This package provides [Yosys][] binaries built for [WebAssembly][]. See the [overview of the YoWASP project][yowasp] for details.
|
|
5
|
+
|
|
6
|
+
At the moment, this package only provides an API allowing to run Yosys in a virtual filesystem; no binaries are provided.
|
|
7
|
+
|
|
8
|
+
This package does not provide access to `sby`, `yowasp-yosys-smtbmc`, and `yowasp-yosys-witness`; only the main `yosys` application is available.
|
|
9
|
+
|
|
10
|
+
[yosys]: https://github.com/YosysHQ/yosys/
|
|
11
|
+
[webassembly]: https://webassembly.org/
|
|
12
|
+
[yowasp]: https://yowasp.github.io/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
API reference
|
|
16
|
+
-------------
|
|
17
|
+
|
|
18
|
+
This package provides one function:
|
|
19
|
+
|
|
20
|
+
- `runYosys` (alias `cmd:yosys`)
|
|
21
|
+
|
|
22
|
+
For more detail, see the documentation for [the JavaScript YoWASP runtime](https://github.com/YoWASP/runtime-js#api-reference).
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Versioning
|
|
26
|
+
----------
|
|
27
|
+
|
|
28
|
+
The version of this package is derived from the upstream Yosys package version in the `X.Y[.Z][+N]` format, and can be in one of the two formats, `X.Y.M` (for builds from release branches) or `X.(Y+1).N-dev.M` (for development builds), where the symbols are:
|
|
29
|
+
|
|
30
|
+
1. `X`: Yosys major version
|
|
31
|
+
2. `Y`: Yosys minor version
|
|
32
|
+
3. `Z`: Yosys patch version; ignored if present
|
|
33
|
+
4. `N`: matches the `N` in the `X.Y+N` upstream version, if present
|
|
34
|
+
5. `M`: package build version; disambiguates different builds produced from the same Yosys source tree
|
|
35
|
+
6. `-dev`: present only for packages built from unreleased Yosys snapshots; marks these packages as pre-releases
|
|
36
|
+
|
|
37
|
+
With this scheme, there is a direct correspondence between upstream versions and [SemVer][semver] NPM package versions.
|
|
38
|
+
|
|
39
|
+
Note that for development builds, the minor version is incremented as required by the SemVer comparison order. This means that an NPM package built from the upstream version `0.45+12` and the 120th commit in this repository will have the version `0.46.12-dev.120`. Because this is a pre-release package, it will not be matched by version specifiers such as `^0.46` or `>=0.46`.
|
|
40
|
+
|
|
41
|
+
[semver]: https://semver.org/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
License
|
|
45
|
+
-------
|
|
46
|
+
|
|
47
|
+
This package is covered by the [ISC license](LICENSE.txt), which is the same as the [Yosys license](https://github.com/YosysHQ/yosys/blob/master/COPYING).
|
package/gen/bundle-browser.js
CHANGED
|
@@ -253,11 +253,17 @@ function directoryFromTree(tree) {
|
|
|
253
253
|
}
|
|
254
254
|
return new Directory(files);
|
|
255
255
|
}
|
|
256
|
-
function directoryIntoTree(directory) {
|
|
256
|
+
function directoryIntoTree(directory, { decodeASCII = true } = {}) {
|
|
257
|
+
function isASCII(buffer) {
|
|
258
|
+
for (const byte of buffer)
|
|
259
|
+
if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13 || byte >= 127)
|
|
260
|
+
return false;
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
257
263
|
const tree = {};
|
|
258
264
|
for (const [filename, entry] of Object.entries(directory.files)) {
|
|
259
265
|
if (entry instanceof File)
|
|
260
|
-
tree[filename] = new TextDecoder().decode(entry.data);
|
|
266
|
+
tree[filename] = decodeASCII && isASCII(entry.data) ? new TextDecoder().decode(entry.data) : entry.data;
|
|
261
267
|
if (entry instanceof Directory)
|
|
262
268
|
tree[filename] = directoryIntoTree(entry);
|
|
263
269
|
}
|
|
@@ -346,7 +352,7 @@ var BaseApplication = class {
|
|
|
346
352
|
this.instantiate = instantiate2;
|
|
347
353
|
this.argv0 = argv0;
|
|
348
354
|
}
|
|
349
|
-
async run(args, files = {}, printLine = console.log) {
|
|
355
|
+
async run(args, files = {}, { printLine = console.log, decodeASCII = true } = {}) {
|
|
350
356
|
if (this._resources === null)
|
|
351
357
|
this._resources = await this.getResources();
|
|
352
358
|
const environment = new Environment();
|
|
@@ -359,15 +365,24 @@ var BaseApplication = class {
|
|
|
359
365
|
(filename) => this.wasmModules[filename],
|
|
360
366
|
{ runtime: environment.exports }
|
|
361
367
|
);
|
|
368
|
+
let error = null;
|
|
362
369
|
try {
|
|
363
370
|
wasmCommand.run.run();
|
|
364
371
|
} catch (e) {
|
|
365
|
-
if (!(e instanceof Exit
|
|
372
|
+
if (!(e instanceof Exit))
|
|
366
373
|
throw e;
|
|
374
|
+
if (e instanceof Exit && e.code !== 0)
|
|
375
|
+
error = e;
|
|
367
376
|
}
|
|
368
377
|
for (const dirName of Object.keys(this._resources))
|
|
369
378
|
delete environment.root.files[dirName];
|
|
370
|
-
|
|
379
|
+
files = directoryIntoTree(environment.root, { decodeASCII });
|
|
380
|
+
if (error !== null) {
|
|
381
|
+
error.files = files;
|
|
382
|
+
throw error;
|
|
383
|
+
} else {
|
|
384
|
+
return files;
|
|
385
|
+
}
|
|
371
386
|
}
|
|
372
387
|
};
|
|
373
388
|
|
|
@@ -4548,5 +4563,6 @@ var yosys = new Application(import.meta.url, {
|
|
|
4548
4563
|
var runYosys = yosys.run.bind(yosys);
|
|
4549
4564
|
export {
|
|
4550
4565
|
Exit,
|
|
4566
|
+
runYosys as "cmd:yosys",
|
|
4551
4567
|
runYosys
|
|
4552
4568
|
};
|
package/gen/bundle-node.js
CHANGED
|
@@ -256,11 +256,17 @@ function directoryFromTree(tree) {
|
|
|
256
256
|
}
|
|
257
257
|
return new Directory(files);
|
|
258
258
|
}
|
|
259
|
-
function directoryIntoTree(directory) {
|
|
259
|
+
function directoryIntoTree(directory, { decodeASCII = true } = {}) {
|
|
260
|
+
function isASCII(buffer) {
|
|
261
|
+
for (const byte of buffer)
|
|
262
|
+
if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13 || byte >= 127)
|
|
263
|
+
return false;
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
260
266
|
const tree = {};
|
|
261
267
|
for (const [filename, entry] of Object.entries(directory.files)) {
|
|
262
268
|
if (entry instanceof File)
|
|
263
|
-
tree[filename] = new TextDecoder().decode(entry.data);
|
|
269
|
+
tree[filename] = decodeASCII && isASCII(entry.data) ? new TextDecoder().decode(entry.data) : entry.data;
|
|
264
270
|
if (entry instanceof Directory)
|
|
265
271
|
tree[filename] = directoryIntoTree(entry);
|
|
266
272
|
}
|
|
@@ -349,7 +355,7 @@ var BaseApplication = class {
|
|
|
349
355
|
this.instantiate = instantiate2;
|
|
350
356
|
this.argv0 = argv0;
|
|
351
357
|
}
|
|
352
|
-
async run(args, files = {}, printLine = console.log) {
|
|
358
|
+
async run(args, files = {}, { printLine = console.log, decodeASCII = true } = {}) {
|
|
353
359
|
if (this._resources === null)
|
|
354
360
|
this._resources = await this.getResources();
|
|
355
361
|
const environment = new Environment();
|
|
@@ -362,15 +368,24 @@ var BaseApplication = class {
|
|
|
362
368
|
(filename) => this.wasmModules[filename],
|
|
363
369
|
{ runtime: environment.exports }
|
|
364
370
|
);
|
|
371
|
+
let error = null;
|
|
365
372
|
try {
|
|
366
373
|
wasmCommand.run.run();
|
|
367
374
|
} catch (e) {
|
|
368
|
-
if (!(e instanceof Exit
|
|
375
|
+
if (!(e instanceof Exit))
|
|
369
376
|
throw e;
|
|
377
|
+
if (e instanceof Exit && e.code !== 0)
|
|
378
|
+
error = e;
|
|
370
379
|
}
|
|
371
380
|
for (const dirName of Object.keys(this._resources))
|
|
372
381
|
delete environment.root.files[dirName];
|
|
373
|
-
|
|
382
|
+
files = directoryIntoTree(environment.root, { decodeASCII });
|
|
383
|
+
if (error !== null) {
|
|
384
|
+
error.files = files;
|
|
385
|
+
throw error;
|
|
386
|
+
} else {
|
|
387
|
+
return files;
|
|
388
|
+
}
|
|
374
389
|
}
|
|
375
390
|
};
|
|
376
391
|
|
|
@@ -4551,5 +4566,6 @@ var yosys = new Application(import.meta.url, {
|
|
|
4551
4566
|
var runYosys = yosys.run.bind(yosys);
|
|
4552
4567
|
export {
|
|
4553
4568
|
Exit,
|
|
4569
|
+
runYosys as "cmd:yosys",
|
|
4554
4570
|
runYosys
|
|
4555
4571
|
};
|