From: Clifford Wolf Date: Mon, 16 Feb 2015 11:41:48 +0000 (+0100) Subject: Added YosysJS wrapper X-Git-Tag: yosys-0.6~421 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=33e80b96c7aac6b93e6bee18572abf529f8cc1fa;p=yosys.git Added YosysJS wrapper --- diff --git a/.gitignore b/.gitignore index 4334b3d84..2e937c735 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ /yosys /yosys.exe /yosys.js -/yosys.html /yosys-abc /yosys-abc.exe /yosys-config diff --git a/Makefile b/Makefile index a7035008c..a301df2fc 100644 --- a/Makefile +++ b/Makefile @@ -113,12 +113,18 @@ LDLIBS = EXE = .js TARGETS := $(filter-out yosys-config,$(TARGETS)) -EXTRA_TARGETS += yosys.html viz.js +EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip viz.js: wget -O viz.js.part https://github.com/mdaines/viz.js/releases/download/0.0.3/viz.js mv viz.js.part viz.js +yosysjs-$(YOSYS_VER).zip: yosys.js viz.js misc/yosysjs/* + rm -rf yosysjs-$(YOSYS_VER) yosysjs-$(YOSYS_VER).zip + mkdir -p yosysjs-$(YOSYS_VER) + cp viz.js misc/yosysjs/* yosys.js yosysjs-$(YOSYS_VER)/ + zip -r yosysjs-$(YOSYS_VER).zip yosysjs-$(YOSYS_VER) + yosys.html: misc/yosys.html $(P) cp misc/yosys.html yosys.html diff --git a/kernel/driver.cc b/kernel/driver.cc index 6df7cf2e8..69a7b8e15 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -93,7 +93,9 @@ void run(const char *command) const char *prompt() { - return create_prompt(yosys_get_design(), 0); + const char *p = create_prompt(yosys_get_design(), 0); + while (*p == '\n') p++; + return p; } #else /* EMSCRIPTEN */ diff --git a/misc/yosys.html b/misc/yosys.html deleted file mode 100644 index 264a58f96..000000000 --- a/misc/yosys.html +++ /dev/null @@ -1,237 +0,0 @@ - - yosys.js example application - -

yosys.js example application

-
[ load example ]
- - -
-

Loading...
- - - - diff --git a/misc/yosysjs/demo01.html b/misc/yosysjs/demo01.html new file mode 100644 index 000000000..e0ba0248f --- /dev/null +++ b/misc/yosysjs/demo01.html @@ -0,0 +1,237 @@ + + YosysJS Example Application #01 + +

YosysJS Example Application #01

+
[ load example ]
+ + +
+

Loading...
+ + + + diff --git a/misc/yosysjs/demo02.html b/misc/yosysjs/demo02.html new file mode 100644 index 000000000..ec33198c7 --- /dev/null +++ b/misc/yosysjs/demo02.html @@ -0,0 +1,102 @@ + + YosysJS Example Application #02 + + + +

YosysJS Example Application #02

+

+

+ + + +

+ + + + diff --git a/misc/yosysjs/yosysjs.js b/misc/yosysjs/yosysjs.js new file mode 100644 index 000000000..ad6df348b --- /dev/null +++ b/misc/yosysjs/yosysjs.js @@ -0,0 +1,159 @@ +var YosysJS = new function() { + this.script_element = document.currentScript; + this.viz_element = undefined; + + this.url_prefix = this.script_element.src.replace(/[^/]+$/, '') + + this.load_viz = function() { + if (this.viz_element) + return; + + this.viz_element = document.createElement('iframe') + this.viz_element.style.display = 'none' + document.body.appendChild(this.viz_element); + + this.viz_element.contentWindow.document.open() + this.viz_element.contentWindow.document.write('