Giter Site home page Giter Site logo

thenamangoyal / risc-simulator Goto Github PK

View Code? Open in Web Editor NEW
7.0 0.0 1.0 441 KB

A C++ pipeline based simulator of RSIC architecture.

Home Page: https://github.com/thenamangoyal/RISC-Simulator/releases

C++ 97.86% Makefile 0.23% C 1.90%
risc-processor mem assembly risc-simulator pipeline-simulator risc-language architecture computer-architecture simplerisc-assembly-language simplerisc

risc-simulator's Introduction

RISC-Simulator: Functional & Pipeline Simulator for simple RISC processor

README

Table of contents

  1. Design Doc
  2. Directory Structure
  3. How to build
  4. How to execute

Design Doc:

To design a Functional and Pipeline Simulator for simple RISC processor. It takes an Assembly Program converted to Instruction MEM File in Simple RISC language, an adapted version of RISC instruction set architecture.

For understanding Simple RISC Language refer "Computer Organisation and Architecture" book by Dr. Sarangi, IIT Delhi. Link http://www.cse.iitd.ac.in/~srsarangi/archbooksoft.html

FLOW DIAGRAM

                       Assembler*[2]                        RISC-Simulator*[4]
Assembly Program*[1] -----------------> Inst MEM file*[3] ----------------------> Simulated Output*[5]

*[1] Assembly Program: An assembly program in Simple RISC language. You may find sample assembly program at https://github.com/namangl/architecture/tree/master/AssemblyPrograms [Usage Guide]: Use as input to Assembler.

*[2] Assembler: Converts assembly program to Inst MEM file. Use the Assembler designed by Dr. Neeraj Goel, IIT-RPR. Link https://goo.gl/tJy5Fx [Usage Guide]: Download and extract the tgz file from the link provided and refer its Readme.

*[3] Inst MEM file: Encoded assembly instructions in hex. Generated as Assembler Output. You may find sample Inst MEM file in "test" folder of this project/repository [Usage Guide]: Use as input to RISC-Simulator

*[4] RISC-Simulator: This project/repository

*[5] Simulated Output: Output of this project based on passed arguments. Refer "How to execute" section for more

Directory Structure:

CSL211-Project
  |
  |- bin  
      |
      |- sim      
  |- include  
      |
      |- Core.h
      |- Memory.h
      |- PipelineRegister.h
      |- Register.h      
  |- src  
      |- main.cpp
      |- Core.cpp
      |- Memory.cpp
      |- PipelineRegister.cpp      
  |- test  
      |- simple_add.mem
      |- fib.mem
      |- array_add.mem
      |- functioncall.mem

How to build

For building: $make

For cleaning the project: $make clean

How to execute

$./bin/sim

{ Example }

$./bin/sim -input test/simple_add.mem -output out.txt -debug 2 Use "simple_add.mem" as input and generate output in "out.txt" using functional debug level 2

$./bin/sim -input test/functioncall.mem -output out.txt -debug 1 -pipe -context context.txt Use "functioncall.mem" as input and generate output in "out.txt" using pipeline debug level 1 and context of program in "context.txt"

{ arguments }

Help
-h : Display Help

Mandatory Arguments
-input [Input MEM File name] : Specify Input File
-output [Input MEM File name] : Specify Output File

Optional Arguments
-pipe : Use pipeline based processor
-debug [1 | 2] : Specify debug level
-mem [Memory_OUT File name] : Specify Memory_OUT File Name
-context [Context_OUT File name] : Specify Context_OUT File Name

Note

*Memory_OUT is the complete memory file at the termination of program *Context_OUT is the complete context of processor (Register Values, Flags, PC) at the termination of program. *Please disable word wrap to see output. *In pipeline based version the register values are taken at beginning of each cycle and displayed in hex. *In functional based version Labels specified as relative signed integer with respect to PC in <> Example <-2> as label means label points to 2 instructions up from current instruction

The output contains instruction by instruction work done in each cycle in all stages namely -

  1. FETCH
  2. DEOCDE
  3. EXECUTE
  4. MEMORY ACCESS
  5. WRITEBACK

Developed by Naman Goyal (email: [email protected])

Supervised by Dr. Neeraj Goel (email: [email protected])

Notable Contributions by Eeshaan Sharma Ms. Varsha Bhat Ms. Amanjot Kaur

risc-simulator's People

Contributors

eeshaan7 avatar namgoyal avatar thenamangoyal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

qweokk

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.