Giter Site home page Giter Site logo

aniketkumarroy / rvasm Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 55 KB

a small, fast and flexible assembler for risc-v assembly languange. currently it fully supports all the unpriviledged instructions of RV32M Instrution set

Assembly 18.01% C 80.61% CMake 1.39%
assembly c instruction-set-architecture risc-v

rvasm's Introduction

RISC-V Logo

rvasm

rvasm is a assembler for the RV32M Instruction set for RISC-V processors. the supported instructions are given here

building the assembler

git clone the repository and navigate inside it

git clone https://github.com/Aniketkumarroy/rvasm.git
cd rvasm

create a build folder, navigate into it and use cmake command to generate Makefile

mkdir build
cd build
cmake ..

now run the generated Makefile to generate the assembler

make

your assembler binary rvasm is ready in build folder

now you can use it by

./rvasm YOUR_CODE

it will generate a file with name YOUR_CODE.out for specifying the output file name use the -o flag

./rvasm YOUR_CODE -o output

the output will be in binary format in 0s and 1s to get a hex output or hex file use the -hex flag

./rvasm YOUR_CODE -o output -hex

options

to know about its various options use

./rvasm -h

or

./rvasm -help
rvasm is a assembler for RISC-V 32-bit instruction set architecture. 
It supports assembling RISC-V assembly code into machine code.

Usage:
./rvasm [source file] | [-o output file] | [-c comment string] | [-hex hexadecimal format] | [-e little endian] | [-f format]

Options:
-o, output file name, optional flag, default is <input file name>.out
-c, comment string, string that will be interpreted as a comment, optional flag, default is ';'
-hex, hexadecimal, to generate output in hexadecimal format, optional flag, by default it generates output in binary format
-e, little endian, it produces output in Little Endian memory model, optional flag, by default big Endian is used
-f, format, it specifies how many bytes separated by spaces to be printed in each line of output file, optional flag, by default whole instruction is printed in a line without any spaces
-h, -help, help flag

how to contribute

if you want to add more instruction support, start first implementing functional behaviour of the instruction in InstructionEncoding.c. add your function signature in InstructionEncoding.h. take care of the function signature format, its return type and parameter list should match the other function signatures in the file. you may also need to make the binary encoding for your instruction type, for that you need to define the encoding function in rv32Encoding.h and implement it in rv32Encoding.c.

once all this is done just add your function and its corresponding mnemonic in main.c in opcode_lookup. remember to write the mnemonic in all smaller case.

rvasm's People

Contributors

aniketkumarroy avatar

Stargazers

 avatar

Watchers

 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.