Skip to content

Commit 040c469

Browse files
committed
Hack around the assembler/disasssembler
1 parent a47c93c commit 040c469

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@typeberry/block": "0.0.1-447d5c4",
3232
"@typeberry/jam-host-calls": "0.0.1-459ce0b",
3333
"@typeberry/pvm-debugger-adapter": "0.1.0-83a3aec",
34-
"@typeberry/spectool-wasm": "0.20.7",
34+
"@typeberry/spectool-wasm": "0.20.8",
3535
"@uiw/react-codemirror": "^4.23.6",
3636
"blake2b": "^2.1.4",
3737
"class-variance-authority": "^0.7.0",

src/components/ProgramLoader/Assembly.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ function assemblyFromInputProgram(initialState: InitialState, program: number[])
5252
// 4. `ecalli` instructions seem to have `// INVALID` comments next to them, but
5353
// the assembler does not handle comments at all.
5454
// 5. disassembler produces unary minus (i.e. `r0 = -r7`), which isn't handled by the compiler.
55+
// 6. disassembler produces <<r (rotate) which is not supported
56+
// 7. diassembler produces only 32-bit representation of negative values `0xffffffff`
5557
const fixedLines: string[] = lines.map((l: string) => {
5658
// remove leading whitespace
5759
l = l.trim();
@@ -67,6 +69,10 @@ function assemblyFromInputProgram(initialState: InitialState, program: number[])
6769
l = l.replace("invalid", "// invalid");
6870
// set first block as entry point
6971
l = l.replace("@block0", "pub @main");
72+
// replace rotate with shift (INCORRECT!)
73+
l = l.replace("<<r", "<<").replace(">>r", ">>");
74+
// replace large values with their 64-bit extensions (INCORRECT!; just for fib)
75+
l = l.replace("0xffffffff", "0xffffffffffffffff");
7076
return l;
7177
});
7278

0 commit comments

Comments
 (0)