{"id":41179347,"url":"https://github.com/franzflasch/riscv_em","last_synced_at":"2026-01-22T20:03:28.037Z","repository":{"id":42996889,"uuid":"164659248","full_name":"franzflasch/riscv_em","owner":"franzflasch","description":"Simple risc-v emulator, able to run linux, written in C. ","archived":false,"fork":false,"pushed_at":"2024-02-21T07:49:32.000Z","size":246,"stargazers_count":116,"open_issues_count":1,"forks_count":23,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-02-22T07:45:30.725Z","etag":null,"topics":["c","embedded-c","embedded-systems","emulator","linux","risc-v","risc-v-emulator","risc-v64","riscv","riscv-em","riscv-emulator","riscv-linux","riscv32","riscv64","rv32","rv64","uclinux"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franzflasch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-01-08T13:51:58.000Z","updated_at":"2024-02-22T07:45:30.726Z","dependencies_parsed_at":"2022-07-12T18:18:50.565Z","dependency_job_id":"500ddbaa-72ff-4dad-96bb-222de8014093","html_url":"https://github.com/franzflasch/riscv_em","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/franzflasch/riscv_em","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Friscv_em","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Friscv_em/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Friscv_em/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Friscv_em/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franzflasch","download_url":"https://codeload.github.com/franzflasch/riscv_em/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franzflasch%2Friscv_em/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28670366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T19:36:09.361Z","status":"ssl_error","status_checked_at":"2026-01-22T19:36:05.567Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["c","embedded-c","embedded-systems","emulator","linux","risc-v","risc-v-emulator","risc-v64","riscv","riscv-em","riscv-emulator","riscv-linux","riscv32","riscv64","rv32","rv64","uclinux"],"created_at":"2026-01-22T20:03:27.343Z","updated_at":"2026-01-22T20:03:28.029Z","avatar_url":"https://github.com/franzflasch.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# riscv_em\nThis is a risc-v emulator written in plain C.\nIt started as a fun project a while ago and is now capable of doing a few things (but still just a hobby, won't be big and professional like qemu ;)\n\n### Ever wanted to know what the absolute minimum requirements are to run linux?\nriscv_em is the answer. Yes, the emulator is capable of running Linux.\n\nOne goal of this project is to be easily able to understand its source code and thus also the risc-v isa. You can also see this project as an attempt to directly translate the RISC-V ISA specs (Currently Unprivileged Spec v.20191213 and Privileged Spec v.20190608) into plain C.\nImplementation focus is simplicity NOT efficiency! Altough I always try to improve it's performance whenever possible, as long as the code does not suffer losses in readability!\n\nCurrently the emulator supports RV32IMA and RV64IMA instructions.\nFurthermore it implements a CLINT (Core-Local Interrupt Controller) and also a PLIC (Platform Level Interrupt Controller), as well as a simple UART.\n\n## UPDATE 2021: Now the emulator also fully implements PMP and MMU.\nPlease see https://github.com/franzflasch/linux_for_riscv_em for a how-to-build appropriate linux images.\n\n* MMU support is currently only available for RV32 (Sv32). Support for RV64 MMU (Sv39, Sv48) will follow.\n* NOMMU is currently only supported for RV64 due to the kernel at the time of this writing only supports this for RV64.\n\n### How-To build RV64-nommu:\n```console\nmkdir build \u0026\u0026 cd build\ncmake -DRV_ARCH=64 ..\nmake\n```\n\n### How-To build RV32-mmu:\n```console\nmkdir build \u0026\u0026 cd build\ncmake -DRV_ARCH=32 ..\nmake\n```\n\n### Build the device tree binaries for RV64-nommu and RV32-mmu (device-tree-compiler needed):\n```sh\ncd dts\n./build_dtb.sh\n```\n\n### Build a linux image for this emulator:\nPlease see https://github.com/franzflasch/linux_for_riscv_em\n\n### Start the emulator and load (uc)linux (RV64-nommu):\n```sh\n./build/riscv_em -f \u003clinux_for_riscv_em-path\u003e/output/linux/loader_64.bin -d dts/riscv_em.dtb\n```\n\n### Start the emulator and load a full blown linux with opensbi (RV32-mmu):\n```sh\n./build/riscv_em -f \u003clinux_for_riscv_em-path\u003e/output_mmu_rv32/opensbi/build/platform/generic/firmware/fw_payload.bin -d dts/riscv_em32_linux.dtb\n```\n\n### RAM disk\n\nMake a filesystem image using the normal filesystem tools (e.g.\nmkfs.ext3, mksquashfs etc) with a maximum size of 200Mb. Then run\n\n```sh\n./build/riscv_em -f \u003clinux_for_riscv_em-path\u003e/output/linux/loader_64.bin -d dts/riscv_em.dtb -i mydiskimage.ext3\n```\n\nThe filesystem will be available as `/dev/pmem0`, which can be either\nmounted from userspace, or specified as the root filesystem. Note that\nthis does not use the initrd or initramdisk functionality, as that has\nsevere size limitations (tries to unpack/copy the whole filesystem at\nboot).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzflasch%2Friscv_em","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranzflasch%2Friscv_em","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranzflasch%2Friscv_em/lists"}