Git Product home page Git Product logo

dbt-rise-riscv's Introduction

DBT-RISE-RISCV

Core of an instruction set simulator based on DBT-RISE implementing the RISC-V ISA. The project is hosted at https://git.minres.com/DBT-RISE/DBT-RISE-RISCV .

This repo contains only the code of the RISC-V ISS and can only be used with the DBT_RISE. A complete VP using this ISS can be found at https://git.minres.com/VP/RISCV-VP which models SiFives FE310 controlling a brushless DC (BLDC) motor.

This library provide the infrastructure to build RISC-V ISS. Currently part of the library are the following implementations adhering to version 2.2 of the 'The RISC-V Instruction Set Manual Volume I: User-Level ISA':

  • RV32I
  • RV32IMAC
  • RV32GC
  • RC64I

Along with those ISA implementations there is a wrapper implementing the M/S/U modes inlcuding virtual memory management and CSRs as of privileged spec 1.10. The main.cpp in src allows to build a standalone ISS when integrated into a top-level project. For further information please have a look at https://git.minres.com/VP/RISCV-VP.

Last but not least an SystemC wrapper is provided to allow easy integration into SystemC based virtual platforms.

Since DBT-RISE uses a generative approch other needed combinations or custom extension can be generated. For further information please contact [email protected].

Standalone build instructions

You need to have conan newer than version 2.0 available. If you do not have it already it can be done in the following way (assuming you are using bash):

python3 -mvenv .venv
. .venv/bin/activate
pip3 install conan
conan profile default

Building the ISS is as simple as:

cmake -S . -B build/Release --preset Release && cmake --build build/Release -j24

Building a debug version is analogous:

cmake -S . -B build/Debug --preset Debug && cmake --build build/Debug -j24

To run a simple test one can use the MINRES Firmware examples:

git clone --recursive -b develop https://git.minres.com/Firmware/Firmwares.git build/Firmwares
make -C build/Firmwares/hello-world/ ISA=imc BOARD=iss
./build/Release/riscv-sim -f build/Firmwares/hello-world/hello.elf

dbt-rise-riscv's People

Contributors

ealexj avatar eyck avatar staskau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dbt-rise-riscv's Issues

Wait for debugger should happen before first instruction fetch

The debugger support uses the PRE_SYNC to hold execution of the first instruction until after a debugger allows the target to run.

However, the check for PRE_SYNC happens after the instruction fetch and decode. This is problematic because A) a debugger cannot gain control if the first fetch results in a TLM error and B) a debugger cannot be used to load an image into memory without the core first fetching an incorrect instruction.

Consider creating a new sync point for the debugger before fetch_ins is called.

Two debugger single-steps are required at reset vector

When attaching the debugger it seems that two single-steps are required to actually single step the first instruction.

Turning on verbose debug, the first single-step results in a memory read (finish read_mem(). The second-single step results in actual instruction execution.

Not a showstopper as it seems to be useable, just a bit confusing.

Debugger loses control when trap vector fetch fails

When the trap handler (MTVEC) resides at an address that returns a TLM error, the debugger will lose control of the session.

Specifically we end up in a loop where the vm detects the instruction fetch error and tries to enter the trap handler.

        if(fetch_ins(pc, data)!=iss::Ok){
            this->do_sync(POST_SYNC, std::numeric_limits<unsigned>::max());
            pc.val = super::core.enter_trap(std::numeric_limits<uint64_t>::max(), pc.val, 0);

the trap handler sets a new value for the next PC which causes execution to loop endlessly attempting trap handling.

As execution goes, this seems reasonable. But for the debugger interface we need a way to interrupt execution to see the state of the processor when in this looping trap handler state.

For the debugger we expect:

  1. When single-stepping the PC will advance to the trap handler address but not fetch the trap handler (yet)
  2. When running the debugger needs to be able to break execution, showing a PC value of the trap handler

When the debugger attempts to disassemble around the PC at the trap handler address it will get TLM errors and handle these appropriately.

rv64gc contains RVC rv32 opcodes instead of rv64 ones

I know rv64gc is still a work in progress but I wanted to document known issues here

The following opcodes appear in vm_rv64gc.cpp but are considered RV32-only instructions:

C__FLW
C__FSW
C__FLWSP
C__FSWSP

the corresponding rv64gc instructions that should be implemented in their place are:

C__LD
C__SD
C__LDSP
C__SDSP

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.