{"id":13837553,"url":"https://github.com/fnuecke/sedna","last_synced_at":"2025-09-13T07:41:09.015Z","repository":{"id":38020857,"uuid":"296733504","full_name":"fnuecke/sedna","owner":"fnuecke","description":"Sedna - a pure Java RISC-V emulator.","archived":false,"fork":false,"pushed_at":"2024-04-15T06:41:17.000Z","size":1730,"stargazers_count":86,"open_issues_count":6,"forks_count":17,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-04-16T08:32:49.984Z","etag":null,"topics":["emulator","java","risc-v","riscv"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnuecke.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,"publiccode":null,"codemeta":null}},"created_at":"2020-09-18T21:29:34.000Z","updated_at":"2024-05-30T05:09:40.800Z","dependencies_parsed_at":"2024-04-14T09:36:21.288Z","dependency_job_id":"207635d9-b414-476a-b553-0038dcda1976","html_url":"https://github.com/fnuecke/sedna","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/fnuecke/sedna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnuecke%2Fsedna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnuecke%2Fsedna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnuecke%2Fsedna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnuecke%2Fsedna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnuecke","download_url":"https://codeload.github.com/fnuecke/sedna/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnuecke%2Fsedna/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274935949,"owners_count":25376832,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["emulator","java","risc-v","riscv"],"created_at":"2024-08-04T15:01:13.715Z","updated_at":"2025-09-13T07:41:08.991Z","avatar_url":"https://github.com/fnuecke.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Sedna RISC-V Emulator\n\nSedna is a 64-bit RISC-V emulator written purely in Java. It implements all extensions necessary to be considered\n\"general purpose\" plus supervisor mode, meaning it can boot Linux. At the time of writing (2020/12/06) Sedna passes all\ntests in the [RISC-V test suite](https://github.com/riscv/riscv-tests). It also supports serializing and deserializing\nmachine state.\n\n## Structure\n\nThe code layout is relatively flat, with different parts of the emulator living in their respective packages. Here are\nsome notable ones.\n\n| Package                                                            | Description                                              |\n|--------------------------------------------------------------------|----------------------------------------------------------|\n| [li.cil.sedna.device](src/main/java/li/cil/sedna/device)           | Non-ISA specific device implementations.                 |\n| [li.cil.sedna.devicetree](src/main/java/li/cil/sedna/devicetree)   | Utilities for constructing device trees.                 |\n| [li.cil.sedna.elf](src/main/java/li/cil/sedna/elf)                 | An ELF loader, currently only used to load tests.        |\n| [li.cil.sedna.fs](src/main/java/li/cil/sedna/fs)                   | Virtual file system layer for VirtIO filesystem device.  |\n| [li.cil.sedna.instruction](src/main/java/li/cil/sedna/instruction) | Instruction loader and decoder generator.                |\n| [li.cil.sedna.memory](src/main/java/li/cil/sedna/memory)           | Memory map implementation and utilities.                 |\n| [li.cil.sedna.riscv](src/main/java/li/cil/sedna/riscv)             | RISC-V CPU and devices (CLINT, PLIC).                    |\n\n## RISC-V Extensions\n\nSedna implements the `G` meta extension, i.e. the general purpose computing set of extensions: `rv64imacfd`\nand `Zifencei`. For the uninitiated, this means:\n\n- `i`: basic 64-bit integer ISA.\n- `m`: integer multiplication, division, etc.\n- `a`: atomic operations.\n- `c`: compressed instructions.\n- `f`: single precision (32-bit) floating-point operations.\n- `d`: double precision (64-bit) floating-point operations.\n- `Zifencei`: memory fence for instruction fetch.\n\nThis comes with a couple of caveats:\n\n- The `FENCE` and `FENCE.I` instructions are no-ops and atomic operations do not lock underlying memory. Multi-core\n  setups will behave incorrectly.\n- Floating-point operations have been reimplemented in software for flag correctness. Meaning they're slow.\n\n## Instructions and decoding\n\nSedna uses run-time byte-code generation to create the decoder switch used by the instruction interpreter. This makes it\nvery easy to add new instructions and to experiment with different switch layouts to improve performance. The\ninstruction loader and switch generator are technically general purpose, i.e. they have no direct dependencies on the\nRISC-V part of this project. However, there are some assumptions on how instructions are defined and processed baked\ninto their design.\n\nThe current set of supported RISC-V instructions is declared [in this file](src/main/resources/riscv/instructions.txt).\n\nInstruction implementations are defined in [the RISC-V CPU class](src/main/java/li/cil/sedna/riscv/R5CPUTemplate.java).\n\n## Endianness\n\nThe emulator presents itself as a little-endian system to code running inside it. This should also work correctly on\nbig-endian host systems, but has not been tested.\n\n## Tests\n\nSedna tests ISA conformity using the [RISC-V test suite](https://github.com/riscv/riscv-tests). The tests are run using\na simple JUnit [test runner](src/test/java/li/cil/sedna/riscv/ISATests.java). The compiled test binaries are included in\nthis repository and can be found [here](src/test/data/riscv-tests).\n\nNote that an additional tests may be included from this fork: https://github.com/fnuecke/riscv-tests\n\n- A test for page misaligned access (e.g. loads spanning multiple pages) has been contributed by @ja2142 on\n  branch [page_misaligned_access_test](https://github.com/fnuecke/riscv-tests/tree/page_misaligned_access_test).\n\n## Maven\n\nSedna can be included into a project via the Github Package Repository. See [the documentation][GithubPackagesGradle]\nfor more information on how to set that up. In short, you'll want to add your username and a public access token into\nyour `~/.gradle/gradle.properties` and use those variables in your repository declaration. Note that the public access\ntoken will need `read:packages` permissions.\n\nFor example, using Gradle:\n\n```groovy\nrepositories {\n  maven {\n    url = uri(\"https://maven.pkg.github.com/fnuecke/sedna\")\n    credentials {\n      username = project.findProperty(\"gpr.user\") ?: System.getenv(\"USERNAME\")\n      password = project.findProperty(\"gpr.key\") ?: System.getenv(\"TOKEN\")\n    }\n  }\n}\n\ndependencies {\n  implementation 'li.cil.ceres:sedna:2.0.0'\n}\n```\n\n[GithubPackagesGradle]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnuecke%2Fsedna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnuecke%2Fsedna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnuecke%2Fsedna/lists"}