All Projects → fnuecke → sedna

fnuecke / sedna

Licence: MIT license
Sedna - a pure Java RISC-V emulator.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to sedna

riscv em
Simple risc-v emulator, able to run linux, written in C.
Stars: ✭ 51 (-1.92%)
Mutual labels:  emulator, riscv, risc-v
rv32emu
RISC-V RV32I[MAC] emulator with ELF support
Stars: ✭ 61 (+17.31%)
Mutual labels:  emulator, riscv, risc-v
ravel
A RISC-V simulator
Stars: ✭ 24 (-53.85%)
Mutual labels:  emulator, riscv, risc-v
Riscv Rust
RISC-V processor emulator written in Rust+WASM
Stars: ✭ 253 (+386.54%)
Mutual labels:  emulator, riscv, risc-v
Neorv32
A small and customizable full-scale 32-bit RISC-V soft-core CPU and SoC written in platform-independent VHDL.
Stars: ✭ 106 (+103.85%)
Mutual labels:  riscv, risc-v
yarvi
Yet Another RISC-V Implementation
Stars: ✭ 59 (+13.46%)
Mutual labels:  riscv, risc-v
Riscv Fs
F# RISC-V Instruction Set formal specification
Stars: ✭ 173 (+232.69%)
Mutual labels:  riscv, risc-v
Cores Swerv El2
SweRV EL2 Core
Stars: ✭ 79 (+51.92%)
Mutual labels:  riscv, risc-v
Rvemu
RISC-V emulator for CLI and Web written in Rust with WebAssembly. It supports xv6 and Linux (ongoing).
Stars: ✭ 289 (+455.77%)
Mutual labels:  emulator, riscv
Unicorn
Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, X86)
Stars: ✭ 4,934 (+9388.46%)
Mutual labels:  emulator, riscv
platform-shakti
Shakti: development platform for PlatformIO
Stars: ✭ 26 (-50%)
Mutual labels:  riscv, risc-v
Diosix
A lightweight, secure, multiprocessor bare-metal hypervisor written in Rust for RISC-V
Stars: ✭ 116 (+123.08%)
Mutual labels:  riscv, risc-v
Meta Riscv
OpenEmbedded/Yocto layer for RISC-V Architecture
Stars: ✭ 114 (+119.23%)
Mutual labels:  riscv, risc-v
Rvemu For Book
Reference implementation for the book "Writing a RISC-V Emulator in Rust".
Stars: ✭ 141 (+171.15%)
Mutual labels:  emulator, riscv
riscv-meta
RISC-V Instruction Set Metadata
Stars: ✭ 33 (-36.54%)
Mutual labels:  riscv, risc-v
Zelda.RISCV.Emulator
A System Level RISCV32 Emulator Over x86_64: capable of booting RISCV Linux
Stars: ✭ 18 (-65.38%)
Mutual labels:  riscv, risc-v
Darkriscv
opensouce RISC-V cpu core implemented in Verilog from scratch in one night!
Stars: ✭ 1,062 (+1942.31%)
Mutual labels:  riscv, risc-v
Ustc Rvsoc
FPGA-based RISC-V CPU+SoC.
Stars: ✭ 77 (+48.08%)
Mutual labels:  riscv, risc-v
Rv8
RISC-V simulator for x86-64
Stars: ✭ 476 (+815.38%)
Mutual labels:  emulator, riscv
nuclei-sdk
Nuclei RISC-V Software Development Kit
Stars: ✭ 65 (+25%)
Mutual labels:  riscv, risc-v

Sedna RISC-V Emulator

Sedna is a 64-bit RISC-V emulator written purely in Java. It implements all extensions necessary to be considered "general purpose" plus supervisor mode, meaning it can boot Linux. At the time of writing (2020/12/06) Sedna passes all tests in the RISC-V test suite. It also supports serializing and deserializing machine state.

Structure

The code layout is relatively flat, with different parts of the emulator living in their respective packages. Here are some notable ones.

Package Description
li.cil.sedna.device Non-ISA specific device implementations.
li.cil.sedna.devicetree Utilities for constructing device trees.
li.cil.sedna.elf An ELF loader, currently only used to load tests.
li.cil.sedna.fs Virtual file system layer for VirtIO filesystem device.
li.cil.sedna.instruction Instruction loader and decoder generator.
li.cil.sedna.memory Memory map implementation and utilities.
li.cil.sedna.riscv RISC-V CPU and devices (CLINT, PLIC).

RISC-V Extensions

Sedna implements the G meta extension, i.e. the general purpose computing set of extensions: rv64imacfd and Zifencei. For the uninitiated, this means:

  • i: basic 64-bit integer ISA.
  • m: integer multiplication, division, etc.
  • a: atomic operations.
  • c: compressed instructions.
  • f: single precision (32-bit) floating-point operations.
  • d: double precision (64-bit) floating-point operations.
  • Zifencei: memory fence for instruction fetch.

This comes with a couple of caveats:

  • The FENCE and FENCE.I instructions are no-ops and atomic operations do not lock underlying memory. Multi-core setups will behave incorrectly.
  • Floating-point operations have been reimplemented in software for flag correctness. Meaning they're slow.

Instructions and decoding

Sedna uses run-time byte-code generation to create the decoder switch used by the instruction interpreter. This makes it very easy to add new instructions and to experiment with different switch layouts to improve performance. The instruction loader and switch generator are technically general purpose, i.e. they have no direct dependencies on the RISC-V part of this project. However, there are some assumptions on how instructions are defined and processed baked into their design.

The current set of supported RISC-V instructions is declared in this file.

Instruction implementations are defined in the RISC-V CPU class.

Endianness

The emulator presents itself as a little-endian system to code running inside it. This should also work correctly on big-endian host systems, but has not been tested.

Tests

Sedna tests ISA conformity using the RISC-V test suite. The tests are run using a simple JUnit test runner. The compiled test binaries are included in this repository and can be found here.

Maven

Sedna can be included into a project via the Github Package Repository. See the documentation for more information on how to set that up. In short, you'll want to add your username and a public access token into your ~/.gradle/gradle.properties and use those variables in your repository declaration. Note that the public access token will need read:packages permissions.

For example, using Gradle:

repositories {
  maven {
    url = uri("https://maven.pkg.github.com/fnuecke/sedna")
    credentials {
      username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
      password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
    }
  }
}

dependencies {
  implementation 'li.cil.ceres:sedna:2.0.0'
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].