Skip to content

Commit

Permalink
perf: switch to WASM based runtime
Browse files Browse the repository at this point in the history
it runs faster for complex designs (e.g. 20 fps for the "Logo" example, in contrast with 3 fps when using the JS runtime)
  • Loading branch information
urish committed May 21, 2024
1 parent fffdd95 commit 845bca8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as monaco from 'monaco-editor';
import { FPSCounter } from './FPSCounter';
import { examples } from './examples';
import { exportProject } from './exportProject';
import { HDLModuleJS } from './sim/hdlruntime';
import { HDLModuleWASM } from './sim/hdlwasm';
import { compileVerilator } from './verilator/compile';

let currentProject = structuredClone(examples[0]);
Expand All @@ -26,8 +26,8 @@ if (!res.output) {
throw new Error('Compile error');
}

// const jmod = new HDLModuleWASM(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
let jmod = new HDLModuleJS(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
let jmod = new HDLModuleWASM(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
//let jmod = new HDLModuleJS(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
await jmod.init();

function reset() {
Expand Down Expand Up @@ -81,8 +81,8 @@ editor.onDidChangeModelContent(async () => {
if (jmod) {
jmod.dispose();
}
jmod = new HDLModuleJS(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
jmod.init();
jmod = new HDLModuleWASM(res.output.modules['TOP'], res.output.modules['@CONST-POOL@']);
await jmod.init();
reset();
fpsCounter.reset();
stopped = false;
Expand Down

0 comments on commit 845bca8

Please sign in to comment.