GithubHelp home page GithubHelp logo

ourspike's Introduction

ourspike

  • A simulator for RISC-V program wriiten by Huang Yilun, Ye Gen and Xing Xinyu

QuickStart

$ make
$ ./ourspike a.out
  • About the usage of this program:
./ourspike [-options] <filename>

options:
	-u	print this usage message.
	-d	debugging mode. In this mode, you can give a '?' to get the debug help message
	-ic	print the total instruction amount after finishing running a program
	-trace	print the executing trace of a program, cover the -d option
  • Finally, you get what you want~

About Program

  • We have several modules, and the simulator consists of them. Let's have a look at them.

main.cpp/h (by HYL)

This module parses the running options and filename, also initializes the necessary data structure Machine and do some cleaning work after running the program.

machine.cpp/h (by HYL)

This module imitates the behaviors that a real machine will do with the executable program. What it does are:

  • Define the size of data used in the data transforms between memory and registers, system call numbers
  • Including the processes running an instruction, such as Fetch, Decode, Execute, Write Register, Write Memory.
  • Initialize all the data structures needed when running a program, such as Memory, Register File, Stack(ignored because it's implemented as memory in risc-v), Instruction.

loader.cpp/h (by YG)

This module actually includes two modules: Loadelf and Memory. Loadelf is a module to load necessary imformation from ELF files into memory; Memory imitates the real memory.

Stack.cpp/h (by XXY)

This module imitates the real stack. However, in risc-v instruction set, there is no "push" and "pop", and these 2 instructions is implemented as "ld" and "sd" with memory.

Register.cpp/h (by XXY)

This modeule imitates the real register file and define the register names (such as SP and A0). The register file includes Int register file and Float register file. Also, don't forget PC.

Instruction.cpp/h (by XXY)

This module get a binary code of an instruction, and parse it into different parts, such as opcode, funct7, imm and so on. The parsing process is written in the Decode method.

filed.h (by HYL)

This module doesn't do any actions. It just defines a parsing tree for binary codes of instructions for understanding what this instruction is quickly and clearly. Also, it helps a lot in making our source code more readable.

ourspike's People

Contributors

hylcool avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

xingxinyu96

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.