{"id":19645430,"url":"https://github.com/corani/go-riscv","last_synced_at":"2025-10-28T23:39:38.218Z","repository":{"id":57660028,"uuid":"379144973","full_name":"corani/go-riscv","owner":"corani","description":"Playing around with Risc-V in Go","archived":false,"fork":false,"pushed_at":"2021-07-02T04:56:51.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T20:48:29.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/corani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-22T04:50:22.000Z","updated_at":"2021-07-02T04:56:54.000Z","dependencies_parsed_at":"2022-09-26T20:31:09.138Z","dependency_job_id":null,"html_url":"https://github.com/corani/go-riscv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fgo-riscv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fgo-riscv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fgo-riscv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fgo-riscv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corani","download_url":"https://codeload.github.com/corani/go-riscv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240952975,"owners_count":19884020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:33:57.329Z","updated_at":"2025-10-28T23:39:38.113Z","avatar_url":"https://github.com/corani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Risc-V\n\nPlaying around with Risc-V in Go.\n\n## Setup\n\n1. Install the riscv gnu toolchain from github.com/riscv/riscv-gnu-toolchain, follow the\n   instructions for installing Newlib.\n2. Clone and build github.com/riscv/riscv-tests under this repository\n\n## Disassembler\n\nDisassembles rv32i with zifenci and zicsr extensions.\n\n```bash\nmake\n./bin/disassemble -in ./riscv-tests/isa/rv32ui-p-simple\n```\n\n## Emulator\n\nThe emulator needs to be charged with gas before running, each instruction and memory access uses\ngas and the emulator is killed when we run out. By default 500 gas is charged, which is sufficient\nfor (very) simple programs. See the command line arguments below if you need to charge more.\n\nEmulates rv32i with zifenci and zicsr extensions.\n\n```bash\nmake\n\n./bin/emulate -in ./riscv-tests/isa/rv32ui-p-add\n```\n\nTo run the emulator for all the riscv-tests:\n\n```bash\nmake riscv-tests\n```\n\nTo run the emulator for the samples:\n\n```bash\nmake\nmake -C sample\n\n./bin/emulate -in ./sample/bin/hello\n```\n\nAdditional command line arguments:\n\n- `-gas N`  charge the emulator with `N` gas (default=500)\n- `-v N`    verbose logging\n  - 1       print a profile after completion\n  - 2       print the disassembly before starting\n  - 4       print each instruction before executing\n  - 5       print all registers after executing each instruction\n\n## Future\n\n- Emulator\n  - Memory mapped I/O\n  - Proper trapping of ecalls\n  - Proper memory map\n  - Dynamic memory\n- Create an assembler\n- Create a debugger\n- Support rv32g: rv32m (mul/div) + rv32a (atomic) + rv32f (float) + rv32d (double)?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorani%2Fgo-riscv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorani%2Fgo-riscv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorani%2Fgo-riscv/lists"}