3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-24 05:08:56 +00:00

Improved YosysJS WebWorker API

This commit is contained in:
Clifford Wolf 2015-07-04 17:08:44 +02:00
parent 766dd51447
commit c4dde71dca
3 changed files with 51 additions and 10 deletions

View file

@ -54,42 +54,50 @@ endmodule
document.getElementById('popup').style.visibility = 'hidden';
document.getElementById('popupmsg').textContent = 'Please wait..';
}
function handle_run_errors(logmsg, errmsg) {
if (errmsg != "") {
window.alert(errmsg);
document.getElementById('popup').style.visibility = 'hidden';
}
}
function synth1() {
document.getElementById('popup').style.visibility = 'visible';
ys.write_file("input.v", document.getElementById('code').value);
ys.run('design -reset; read_verilog input.v; show -stretch');
ys.run('design -reset; read_verilog input.v; show -stretch', handle_run_errors);
ys.read_file('show.dot', (function(text){
YosysJS.dot_into_svg(text, 'svg');
console.log(ys.errmsg);
if (ys.errmsg == "") YosysJS.dot_into_svg(text, 'svg');
document.getElementById('popup').style.visibility = 'hidden';
}));
}
function synth2() {
document.getElementById('popup').style.visibility = 'visible';
ys.write_file("input.v", document.getElementById('code').value);
ys.run('design -reset; read_verilog input.v; proc; opt_clean; show -stretch');
ys.run('design -reset; read_verilog input.v; proc; opt_clean; show -stretch', handle_run_errors);
ys.read_file('show.dot', (function(text){
YosysJS.dot_into_svg(text, 'svg');
if (ys.errmsg == "") YosysJS.dot_into_svg(text, 'svg');
document.getElementById('popup').style.visibility = 'hidden';
}));
}
function synth3() {
document.getElementById('popup').style.visibility = 'visible';
ys.write_file("input.v", document.getElementById('code').value);
ys.run('design -reset; read_verilog input.v; synth -run coarse; show -stretch');
ys.run('design -reset; read_verilog input.v; synth -run coarse; show -stretch', handle_run_errors);
ys.read_file('show.dot', (function(text){
YosysJS.dot_into_svg(text, 'svg');
if (ys.errmsg == "") YosysJS.dot_into_svg(text, 'svg');
document.getElementById('popup').style.visibility = 'hidden';
}));
}
function synth4() {
document.getElementById('popup').style.visibility = 'visible';
ys.write_file("input.v", document.getElementById('code').value);
ys.run('design -reset; read_verilog input.v; synth -run coarse; synth -run fine; show -stretch');
ys.run('design -reset; read_verilog input.v; synth -run coarse; synth -run fine; show -stretch', handle_run_errors);
ys.read_file('show.dot', (function(text){
YosysJS.dot_into_svg(text, 'svg');
if (ys.errmsg == "") YosysJS.dot_into_svg(text, 'svg');
document.getElementById('popup').style.visibility = 'hidden';
}));
}
var ys = YosysJS.create_worker(on_ys_ready);
ys.verbose(true);
</script>
</body></html>