Code Monkey home page Code Monkey logo

risc-v-simulator's Introduction

RISC-V Assembler and Simulator

A fully functional RISC-V Assembler and simulator that runs in web browser. The assembler and simulator were implemented using TypeScript and HTML5 Canvas.

Features

  • Assembler: Convert human-readable RISC-V assembly code into machine code instructions that can be executed by the simulator.
  • Simulator: Simulate the execution of RISC-V programs, providing a step-by-step visual representation of the CPU state.
  • CPU frequency: Users can dynamically change the CPU frequency to control the execution speed.
  • Example Programs: The project includes three example programs:
    • Fibonacci: Calculate the Fibonacci sequence up to a specified number.
    • Fast Multiplication: Perform fast multiplication of two numbers using bitwise operations.
    • Pyramid Array: Generate a pyramid-shaped array of numbers [0 1 2 ... n-1 n n-1 ... 2 1 0].

Usage

  1. Visit the project at https://srki.github.io/RISC-V-Simulator/.
  2. Select an example program or write your RISC-V assembly code using the editor.
  3. Click the "Build" button to convert the assembly code into machine code and load the code into the simulator.
  4. Adjust the CPU frequency using the provided interface. (Optional)
  5. Click the "Run" button to start executing the program in the simulator.

Supported instructions

The assembler and simulator support the following instruction from RV32I instruction set:

  • B-type: BEQ, BNE, BLT, BGE, BLTU, BGEU
  • I-type: LB, LH, LW, LBU, LHU, ADDI, SLTI, SLTIU, XORI, ORI, ANDI, SLLI, SRLI, SRAI
  • S-type: SB, SH, SW
  • R-type: ADD, SUB, SLL, SLT, SLTU, XOR, SRL, SRA, OR, AND

License

This project is licensed under the MIT License.

risc-v-simulator's People

Contributors

avery-whitaker avatar srki avatar

Watchers

 avatar  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.