GithubHelp home page GithubHelp logo

jbropark / pyrisc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snu-csl/pyrisc

0.0 0.0 0.0 274 KB

The Educational RISC-V Toolset in Python

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.46% Assembly 4.27% Python 94.27%

pyrisc's Introduction

The PyRISC Project

Introduction

The PyRISC project aims at providing various RISC-V toolset written in Python for educational purposes. It includes the RISC-V instruction set simulator and pipelined RISC-V processor simulators. All the simulators accept the executable file compiled with the standard GNU toolchain that supports RV32I base instruction set. Some of instructions are intentionally left unimplemented for class projects.

The PyRISC Project Subdirectories

Currently, the following tools are available:

  • ./sim: A RISC-V instruction set simulator for RV32I base instruction set
  • ./pipe5: A simulator for 5-stage pipelined RISC-V processor implementation with RV32I instruction set
  • ./asm: Makefile, linker script, and examples for building PyRISC-compatible RISC-V executable files

Please see the README file in each subdirectory for more information.

Prerequisites

The PyRISC toolset requires Python version 3.6 or higher. In addition, the PyRISC toolset depends on Python modules such as numpy and pyelftools. These modules can be installed on Ubuntu 18.04LTS as follows:

$ sudo apt-get install python3-numpy python3-pyelftools

Building PyRISC-compatible RISC-V GNU toolchain

In order to work with the PyRISC toolset, you need to build a RISC-V GNU toolchain for the RV32I instruction set. To build the RISC-V toolchain on your machine (on either Linux or MacOS), please take the following steps.

1. Install prerequisite packages first

For Ubuntu 18.04LTS, perform the following command:

$ sudo apt-get install autoconf automake autotools-dev curl libmpc-dev
$ sudo apt-get install libmpfr-dev libgmp-dev gawk build-essential bison flex
$ sudo apt-get install texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

If your machine runs MacOS, perform the following command:

$ brew install gawk gnu-sed gmp mpfr libmpc isl zlib expat

2. Download the RISC-V GNU Toolchain from Github

$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain

3. Configure the RISC-V GNU toolchain

$ cd riscv-gnu-toolchain
$ mkdir build
$ cd build
$ ../configure --prefix=/opt/riscv --with-arch=rv32i

4. Compile and install them.

$ sudo make

Note that they are installed in the path given as the prefix, i.e. /opt/riscv in this example.

5. Add /opt/riscv/bin in your PATH

$ export PATH=/opt/riscv/bin:$PATH

License

PyRISC is offered under the terms of the Open Source Initiative BSD 3-Clause License. More information about this license can be found here.


Jin-Soo Kim
Systems Software and Architecture Laboratory
Seoul National University
http://csl.snu.ac.kr

pyrisc's People

Contributors

jinsoox avatar abcinje avatar

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.