HomeOverviewValsValidatorsGovGovernanceIBCRelayersN/AInfraInfra
/
powered by GATA HUB

p/moul/x/vm/riscv/v0

Gno.land

Package
Files178 tests
Lines of code1,482gno code
FunctionsN/Aexported
Storage107.3 KB10.73 GNOT deposit
Deployed27 Sep 2026block 385,158

Package

Pathgno.land/p/moul/x/vm/riscv/v0
Deployer@moul
TransactionB01ADDF4A4…DF707B81

Documentation

Package riscv is an RV32IM emulator for gno.land: 48 instructions that every real compiler already targets. A guest here is not written in a new language. \`rustc --target riscv32im-unknown-none-elf\`, \`clang -target riscv32\`, TinyGo and Zig all emit it, so a program arrives compiled by the real compiler and optimized by the real optimizer. The interpreter is a decode loop rather than a semantic minefield: fetch four bytes, switch on seven bits, do arithmetic. No F or D. No floats means no rounding-mode ambiguity and nothing that can differ between nodes. The M extension's divide-by-zero and overflow cases are defined by the spec to RETURN a value rather than trap, which is exactly what a deterministic chain wants. It implements [vmkit.Machine](/gno.land/p/moul/x/vm/vmkit/v0#Machine), so it shares the fuel meter, the snapshot codec and the instance store with [p/moul/x/vm/bf](/p/moul/x/vm/bf)(/p/moul/x/vm/bf/v0). That sharing is the point: the second guest is what tells you whether the ABI was shaped around the first one. Live demo: [r/moul/x/vm/riscvdemo](/r/moul/x/vm/riscvdemo)(/r/moul/x/vm/riscvdemo/v0).