mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
YosysJS stuff
This commit is contained in:
parent
08c0fe164f
commit
e0e6d130cd
7 changed files with 156 additions and 16 deletions
|
@ -45,6 +45,7 @@ var YosysJS = new function() {
|
|||
ys.verbose = false;
|
||||
ys.logprint = false;
|
||||
ys.echo = false;
|
||||
ys.errmsg = "";
|
||||
|
||||
if (typeof(reference_element) == 'string' && reference_element != "")
|
||||
reference_element = document.getElementById(reference_element);
|
||||
|
@ -151,12 +152,20 @@ var YosysJS = new function() {
|
|||
ys.write("");
|
||||
ys.write(ys.prompt() + cmd);
|
||||
}
|
||||
mod.ccall('run', '', ['string'], [cmd]);
|
||||
try {
|
||||
mod.ccall('run', '', ['string'], [cmd]);
|
||||
} catch (e) {
|
||||
ys.errmsg = mod.ccall('errmsg', 'string', [], []);;
|
||||
}
|
||||
return ys.print_buffer;
|
||||
}
|
||||
|
||||
ys.read_file = function(filename) {
|
||||
return ys.window.FS.readFile(filename, {encoding: 'utf8'});
|
||||
try {
|
||||
return ys.window.FS.readFile(filename, {encoding: 'utf8'});
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
ys.write_file = function(filename, text) {
|
||||
|
@ -167,6 +176,12 @@ var YosysJS = new function() {
|
|||
return ys.window.FS.readdir(dirname);
|
||||
}
|
||||
|
||||
ys.remove_file = function(filename) {
|
||||
try {
|
||||
ys.window.FS.unlink(filename);
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
doc.open()
|
||||
doc.write('<script type="text/javascript" src="' + this.url_prefix + 'yosys.js"></' + 'script>');
|
||||
doc.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue